11-12-2012 11:56 AM
Hello,
I am trying to use tcl to configure multiple IP SLA operations. Unfortunately, this is not working. I'm using the following script:
proc ios_config {x} {
for {set n 1} {$n<=$x} {incr n 4} {
puts [ ios_config "ip sla $x" ]
puts [ ios_config "udp-jitter 10.0.0.$n 16800 source-ip 10.255.255.20 codec g711ulaw" ]
puts [ ios_config "tos 184" ]
puts [ ios_config "freq 60" ]
puts [ ios_config "ip sla schedule $x life forever start-time now" ]
}
}
ios_config 20
When I run the script I get the following output:
3945e_IPSLA(tcl)#proc ios_config {x} {
+>for {set n 1} {$n<=$x} {incr n 4} {
+>puts [ ios_config "ip sla $x" ]
+>puts [ ios_config "udp-jitter 10.0.0.$n 16800 source-ip 10.255.255.20 codec g711ulaw" ]
+>puts [ ios_config "tos 184" ]
+>puts [ ios_config "freq 60" ]
+>puts [ ios_config "ip sla schedule $x life forever start-time now" ]
+>}
+>}
3945e_IPSLA(tcl)#ios_config 20
stack space too low while in Tcl_EvalObj (infinite loop?)
Can someone assist me in figuring out where I'm going wrong? I'm relatively new to tcl scripts.
Thanks,
-Bobby
11-12-2012 12:53 PM
Wrong forum, Post in "EEM scripting". You can move your post using the actions panel on the right.
11-13-2012 12:14 PM
ok,
I have changed the script to the following and the router seems to take the script, but nothing is configured when I do a show run?
proc ip_sla {x} {
for {set n 1} {$n<=$x} {incr n 4} {
puts { ios_config "ip sla $n" "udp-jitter 10.0.0.$n 16800 source-ip 10.255.255.20 codec g711ulaw" "tos 184" "freq 60" "ip sla schedule $n life forever start-time now"}
}
}
ip_sla 2
11-14-2012 08:33 AM
You are only printing the ios_config command, not actually executing it. Remove the puts, then add "end" as your last element of the ios_config list.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide