ā05-10-2015 05:35 AM
Hi
I am trying a simple tcl script to make a VRF ping but are getting this in return , are running version 5.3.0, quiet new to TCL scriptning maybe i am missing something here.
#run tclsh
% foreach i {
220.200.200.15
} {[exec "ping vrf 200 $i"]}
%The executable: ping vrf 200 220.200.200.15 cannot be launched. Error: 'libovl' detected the 'fatal' condition 'No such file or directory'
No error
%
ā05-10-2015 01:32 PM
are you running the tcl inside eem on the router?
the error you are getting here means that the command "ping ..." is run on a shell and that shell doesn't know what ping is, so you may be running it in ksh or from a station that has no ping concept.
in that case you may need to open the cli first and also use cli_exec for that, an example:
proc run_cli { clist } {
set rbuf ""
if {[llength $clist] < 1} {
return -code ok $rbuf
}
if {[catch {cli_open} result]} {
return -code error $result
} else {
array set cliarr $result
}
if {[catch {cli_exec $cliarr(fd) "enable"} result]} {
return -code error $result
}
foreach cmd $clist {
if {[catch {cli_exec $cliarr(fd) $cmd} result]} {
return -code error $result
}
append rbuf $result
}
if {[catch {cli_close $cliarr(fd) $cliarr(tty_id)} result]} {
puts "WARNING: $result"
}
return -code ok $rbuf
}
cheers!
xander
ā06-01-2017 04:50 AM
Hi,
I am having the same problem with verifiy mpls connectivity within a mixed LAB of IOS-XE
and IOS-XR. Running a script using "exec ping mpls ipv4 ..." from tclsh is working fine on IOS-XE.
the same script fails on IOS-XR.
The problem is that IOS-XR enters tcl sh by "#run tclsh" which is IOS-XR --> Korn shell --> TCL Shell,
so any "exec whatevercommand" is looked up in ksh instead of IOS-XR.
In XE this is different. Anything unknow or prepended with "exec" is looked up in IOS-XE.
So, how can I send "exec ping mpls..." directly to IOS-XR from within tclsh%?
ā06-01-2017 05:02 AM
the ksh equivalent for a command you can generally find via describe. for
ping mpls ipv4 it is:
lspv_ping -M 0x0 -P 1.1.1.1 -m 0x20
the -P is the address and the -m is the mask in hex 0x20 = 32:
RP/0/RSP0/CPU0:A9K-BNG#describe ping mpls ipv4 1.1.1.1/3
cheers!
xander
ā06-01-2017 05:12 AM
Many thanks, god xander. I am bloody impressed.
You saved my day.
cheers,
Rene
ā12-13-2018 04:23 AM
Hi Xander,
How are you? I really hope that you're doing fine!!, Please, could tell me where can I find Ksh equivalent command in case that I couldn't do that with "describe"? (I have ios xr 6.2.3).
Thank you very much
REgards
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