question

nawraj avatar image
nawraj asked ericnute edited

Need procedure to increment ipv4 and mac address in tcl.

Requirement: ipv4 address range = 103.0.0.1 to 103.0.3.235 mac address ranges = 00:10:94:01:00:02 to 00:10:94:01:03:E8 proc should be able to scale any range. Appreciate your help. Thanks, Nawraj
Spirent TestCenter (STC)apitcl scriptprocedures
2 comments
10 |950

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

LarryVeilleux avatar image LarryVeilleux ♦♦ commented ·
Hi Nawraj, I tagged this as Spirent TestCenter. Let me know if that is correct. Sorry I'm not and API guy so I do not know the answer to your question.
0 Likes 0 ·
nawraj avatar image nawraj commented ·
Actually it is related to TCL scripting. Anyway we are trying to implement same in STC. Shouldn't be an issue.
0 Likes 0 ·

1 Answer

·
LBalcerak avatar image
LBalcerak answered LarryVeilleux edited
There are many different methods to achieve what you want. I am not sure if you are talking about Devices, or Raw StreamBlocks. I have attached a PDF that describes how to create multiple Devices each with a different MAC and IP Address. This is old material and references Hosts (Host has since been replaced with Device within the API) however, the process is the same.

\multiple_hosts.pdf (480.7 KiB)
\multiple_hosts.pdf (480.7 KiB)
1 comment
10 |950

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

nawraj avatar image nawraj commented ·
I am trying to acheive this through HLTAPI. In one port i need to create 5K devices and each device should have unique mac address. for {set i 1} {$i <= $num_blocks} {incr i} { set device_ret1 [sth::pppox_config\ -mode create -encap ethernet_ii_vlan -protocol pppoe\ -port_handle $port1 -num_sessions 1 -auth_mode chap \ -username bnguser$i@cisco.com -password cisco123 \ -mac_addr "00:10:94:01:00:02" -mac_addr_step "00:00:00:00:00:01" \ -vlan_id 100 \ ] Though we have mac_addr_step option here, but it won't do increment when we are using it under for loop . hence need a separate tcl proc to implement same. Similar is the case while creating bgp routes, we don't have -next_hop_step option for next_hop ip increment so need a tcl proc to increment ip address too.
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.