SPONSORS:






User Tag List

Results 1 to 10 of 10
  1. #1
    Member
    Join Date
    Jan 2001
    Posts
    43
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    **** Increment..... *******

    Hello Silk Users,
    I really need help on this...
    We are trying to automate the Networking
    product.
    The front end is Desktop GUI, coded in Java.
    We have a testcase: running in a loop,
    during which the IP address needs to be incremented.How do we handle the delimiter
    period(.) in the IP address?
    Thanks in advance...
    ~Girija



  2. #2
    Senior Member
    Join Date
    Jul 2000
    Posts
    186
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: **** Increment..... *******

    Sounds like a series of nested for loops would do the trick. The upper limit each for loop would be max value for that subnet. If you are using a 3 byte mask, you would only need 1 for loop. A 1 byte mask would require 3 for loops. If you need to refer to them in a string the syntax would look like this:

    "10.{i1}.{i2}.{i3}"

    Hope this helps.
    Tom

  3. #3
    Member
    Join Date
    Jan 2001
    Posts
    43
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: **** Increment..... *******

    Thank You...Can you explain more on this...
    ~Girija

  4. #4
    Senior Member
    Join Date
    Jan 2001
    Posts
    750
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: **** Increment..... *******

    When you use {myVariable} between quote SILK convert myVariable to a string.

    EX:

    myVariable=100

    print("{myVariable}")

    result:
    100

    so string xxx.xxx.xxx.xxx would be

    IP="{x1}.{x2}.{x3}.{x4}"

    SILK concatenates everything within quotes

  5. #5
    Member
    Join Date
    Jan 2001
    Posts
    43
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: **** Increment..... *******


    Thanks for the suggestions...
    The following code increments the 3rd value,
    in the IPaddress. How do I put the new value
    back to the string..


    testcase IPincrement ()
    INTEGER Int1
    STRING Ipvar1 = "31.1.1.1"
    STRING Ipvar2 = ""
    GetField(Ipvar1,'.',3)
    Int1 = VAL(Ipvar1,'.',3)
    Int1 = Int1 + 1
    Ipvar2 = str(Int1)

    Thanks
    ~Girija


  6. #6
    Senior Member
    Join Date
    Aug 1999
    Location
    San Diego, CA USA
    Posts
    219
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: **** Increment..... *******

    Here's the whole testcase:
    And the results are below. I started with the 3rd number being 9 so I could make sure all was OK when a digit gets added.

    [This message has been edited by pcostigan (edited 04-05-2001).]

  7. #7
    Member
    Join Date
    Jan 2001
    Posts
    43
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: **** Increment..... *******

    Thanks for the code,
    though I got it working for fixed value
    of IP address..your code can handle
    any value of IP address...

    [-] testcase lp()
    Integer intt
    Integer intt2
    String Ipvariable
    String Ipvariable2
    intt = 1
    while (intt < 5)
    Ipvariable="31.{intt}"
    intt++
    intt2=1
    while (intt2 < 5)
    Ipvariable2="{Ipvariable}.{intt2}.1"
    print (Ipvariable2)
    intt2++

    Thanks
    Regards
    ~Girija

  8. #8
    Senior Member
    Join Date
    Jul 1999
    Location
    Bellingham, WA USA
    Posts
    1,323
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: **** Increment..... *******

    Here is a script with a function that accpets a string IP address (e.g. "10.1.1.1") or allows you to leave it blank, in which case it will set the IP to "0.0.0.0" and will increment it by 1 beginning with the last 0 until the full IP reaches "255.255.255.255"

    Use it and modify it as you need to to suit your needs.

    - damon

  9. #9
    Senior Member
    Join Date
    Jul 1999
    Location
    Bellingham, WA USA
    Posts
    1,323
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: **** Increment..... *******

    BTW,

    Just as a tidbit of interesting information, if you were to run this script, incrementing by 1 from 0.0.0.0 to 255.255.255.255, you will end up with over 4.3 billion IP addresses.

    Just so you know, that's a lot!

  10. #10
    Member
    Join Date
    Jan 2001
    Posts
    43
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: **** Increment..... *******

    Hello DJGRAY,
    The testing we do is for a fixed value
    of IP address. and it is repeated for
    counter = 1000 or 2000 max.
    The Network gets so slow, that we can run
    the scripts only 10 times.After which
    the Silk stops executing, comes up with the
    error stating
    'Window not enabled'...


 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.0.9 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Questions / Answers Form provided by vBAnswers (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominatevBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 05:52 AM.

Copyright BetaSoft Inc.