Thu 10 Aug 2006
Scripting en Cisco…
Enviado al blog por el pinche cash segun el bajo la categoria cisco
Pues navegando por ahi encontre que los routers cisco soportan scripting, trae un shellecillo de lenguaje TCL con el cual se pueden crear funciones, estas se insertan via terminal o bien puede el router puede bajar las funciones via TFTP de otro equipo.
ruter#tclsh
ruter(tcl)#proc get_ints {} {
+> #puts "BEFORE\n"
+> set check ""
+> set int_out [ exec "show interfaces\n" ]
+>
+> set mylist [regexp -all -nocase -line -inline {(^[a-z]*[0-9]/*[0-9]*/*[0-9]*)} $int_out]
+> #puts "MYLIST $mylist\n"
+>
+>foreach int $mylist {
+> #puts "INT $int\n"
+> if {![string equal $check $int]} {
+> if {[info exists ints_out]} {
+> append ints_out ", " $int
+> } else {
+> set ints_out $int
+> }
+> set check $int
+> }
+> }
+>
+> #puts "AFTER\n"
+> return $ints_out
+>}
ruter(tcl)#
ruter(tcl)#puts ""
ruter(tcl)#puts [eval get_ints]
FastEthernet0/0, FastEthernet0/1, Serial0/0/0, NVI0, Loopback0, Loopback20
ruter(tcl)#
Incoherencias parecidas y calificaciones a este post:
0 votos


