cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2490
Views
0
Helpful
3
Replies

TCL Script for IP SLA

bkimble
Level 1
Level 1

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

3 Replies 3

paolo bevilacqua
Hall of Fame
Hall of Fame

Wrong forum, Post in "EEM scripting". You can move your post using the actions panel on the right.

bkimble
Level 1
Level 1

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

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.

Review Cisco Networking for a $25 gift card