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

A9k TCL script shutdown interfaces under router hsrp

Simek Ondrej
Level 1
Level 1

Hi,

 

Can someone pls help me with TCL script using tracking for shuting down every interfaces under router hsrp?

 

RP/0/RSP0/CPU0:NPE3#sh run router hsrp | i interface
Mon Jul 20 14:15:19.627 CET
interface TenGigE0/0/0/22.1036900011
interface TenGigE0/0/0/22.1036920010

 

event manager policy TEST.tcl username eem persist-time 3600 type user

 

 

::cisco::eem::event_register_track 99 state down

namespace import ::cisco::eem::*
namespace import ::cisco::lib::*

array set arr_einfo [event_reqinfo]

if [catch {cli_open} result] {
error $result $errorInfo
} else {
array set cli1 $result
}

if [catch {cli_exec $cli1(fd) "enable"} _cli_result] {
error $_cli_result $errorInfo
}

if [catch {cli_exec $cli1(fd) "config t"} _cli_result] {
error $_cli_result $errorInfo
}

if [catch {cli_exec $cli1(fd) "do show run router hsrp | i interface"} _cli_result] 
 
foreach {line} "$_cli_result" {
append $line shutdown
puts $line
}

if [catch {cli_exec $cli1(fd) "interface lo5 shutdown"} _cli_result] {
error $_cli_result $errorInfo
}

if [catch {cli_exec $cli1(fd) "commit"} _cli_result] {
error $_cli_result $errorInfo
}

if [catch {cli_exec $cli1(fd) "end"} _cli_result] {
error $_cli_result $errorInfo
}

action_syslog msg ">>> Router je izolovan, provadim admin shutdown interfacu!!! <<<"

# Close open cli before exit.
catch {cli_close $cli1(fd) $cli1(tty_id)} result

 

Thank you for helping me.

 

O.

0 Replies 0