cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1768
Views
0
Helpful
6
Replies

TCL Script to reset interface

billobob123
Level 1
Level 1

Hi all

I've been searching for a way to have the router check the status of the dialed and if it's not responding and or down to have a TCL scrip reset the interface.

Is this possible?

Sent from Cisco Technical Support iPad App

6 Replies 6

andrew.prince
Level 10
Level 10

EEM would also serve the purpose.

Sent from Cisco Technical Support iPad App

Hi,

I have a similuar  TCL  script but for PPPoE dialer and it just checks if the VI interface  in UP status and tries to reset the assotiated physical interface if it's in DOWN status.

Umm okay I would be interest in having a look

Sent from Cisco Technical Support iPad App

Marwan ALshawi
VIP Alumni
VIP Alumni

i recomnd you sereach the fourm in the network managment section and if you cant find it then put your post there

good luck

it's quite "rough" as it was "developed" for a test  purpose but went in production

You can assign it the even manger and serach in logging or, as we do it, just call it very 10 minutes from event manager.

#create flash file

#


after 30000



#::cisco::eem::event_register_syslog maxrun 60



#namespace import ::cisco::eem::*


#namespace import ::cisco::lib::*



#get all lines in PADISNT  status


set sh_pppoe_ses [ split [ exec "show pppoe session | i PADISNT" ] "\n" ]



foreach line $sh_pppoe_ses {


if { [ llength $line ] > 0 } {


#Find the according Vi interface and it Vlan interface


if { [ regexp {Vl[0-9]+} [ lindex $line 3 ] ] } {


set result [regexp {Vl([0-9]+)} [ lindex $line 3 ] match IF ]


#Find the all existing Vlan

set  sh_int_sta [ split [ exec "sh vlan-sw bri | e unsup"] "\n" ]


#Find the Phisycal  interface assotiated with a VLAN interface which assotiated with the Vi interface

foreach line_sta $sh_int_sta {


  if { [ llength $line_sta ] > 0 } {


   if { [ regexp "$IF" [ lindex $line_sta 0 ] ] && [ regexp "active" [ lindex $line_sta 2] ] } {


     set LENGTH [ expr  [ llength $line_sta ] - 1 ]


     set result [regexp {(Fa[0-9]+)} [ lindex $line_sta $LENGTH ] match FA ]


     set syslog [open "syslog:" w+]


     puts $syslog "%Reset-PPP-Int-TCL shutting down interface $FA"


     flush $syslog


     ios_config "interface $FA" "shutdown"


     after 10000


     puts $syslog "%Reset-PPP-Int-TCL starting interface $FA"


     ios_config "interface $FA" "no shutdown"


     close $syslog


   }


  }


}


}


#Find the according Vi interface and its Phisycal interface if PPPoE

#is directly configured on a phisycal interface

if { [ regexp {Fa[0-9]+} [ lindex $line 3 ] ] } {
set result [regexp {Fa([0-9]+)} [ lindex $line 3 ] match IF ]
set FA "Fa$IF"
set syslog [open "syslog:" w+]
puts $syslog "%Reset-PPP-Int-TCL shutting down interface $FA"

flush $syslog


ios_config "interface $FA" "shutdown"

after 10000
puts $syslog "%Reset-PPP-Int-TCL starting interface $FA"
ios_config "interface $FA" "no shutdown"
close $syslog

}

}
set IF ""
set FA ""

}




Thanks I'll give it a shot and let you know how things go

Sent from Cisco Technical Support iPad App

Review Cisco Networking for a $25 gift card