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

EEM script to reload the whole ASR9000 chassis

bkowtana
Cisco Employee
Cisco Employee

Hi,

i want to reload the whole ASR9K chassis with eem script ( tcl ) , i did try below script but not reach my target yet.

::cisco::eem::event_register_syslog tag 1 pattern "TEST" occurs 1 maxrun 1200
namespace import ::cisco::eem::*
namespace import ::cisco::lib::*

action_syslog priority warning msg "EEM Triggered"

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

if [catch {cli_exec $cli1(fd) "admin"} result] {
error $result $errorInfo
}

if [catch {cli_write $cli1(fd) "reload location all"} result] {
error $result $errorInfo
}
if [catch {cli_read_pattern $cli1(fd) "Proceed with reload"} result] {
error $result $errorInfo
}
if [catch {cli_write $cli1(fd) "\n"} result] {
error $result $errorInfo
}

if [catch {cli_close $cli1(fd) $cli1(tty_id)} result] {
error $result $errorInfo
}

 Once above script was triggered all the LCs and standby RSP was reload, but not the active RSP 

RP/0/RSP0/CPU0:PE3#show platform 
Fri Dec 9 22:57:30.284 UTC
Node Type State Config State
-----------------------------------------------------------------------------
0/RSP0/CPU0 A9K-RSP440-SE(Active) IOS XR RUN PWR,NSHUT,MON
0/RSP1/CPU0 A9K-RSP440-SE(Standby) IOS XR RUN PWR,NSHUT,MON
0/1/CPU0 A9K-2T20GE-E IOS XR RUN PWR,NSHUT,MON
0/2/CPU0 A9K-MOD80-TR IOS XR RUN PWR,NSHUT,MON
0/2/1 A9K-MPA-4X10GE OK PWR,NSHUT,MON
RP/0/RSP0/CPU0:PE3#
RP/0/RSP0/CPU0:PE3#
RP/0/RSP0/CPU0:PE3#
RP/0/RSP0/CPU0:PE3#logmsg TEST
Fri Dec 9 22:57:38.199 UTC
RP/0/RSP0/CPU0:PE3#RP/0/RSP0/CPU0:Dec 9 22:57:39.300 : tclsh[65865]: %HA-HA_EEM-4-ACTION_SYSLOG_LOG_WARNING : test.tcl: eem Triggered
RP/0/RSP0/CPU0:PE3#show platform 
Fri Dec 9 22:57:51.463 UTC
Node Type State Config State
-----------------------------------------------------------------------------
0/RSP0/CPU0 A9K-RSP440-SE(Active) IOS XR RUN PWR,NSHUT,MON
0/RSP1/CPU0 A9K-RSP440-SE(Standby) BRINGDOWN PWR,NSHUT,MON
0/1/CPU0 A9K-2T20GE-E BRINGDOWN PWR,NSHUT,MON
0/2/CPU0 A9K-MOD80-TR BRINGDOWN PWR,NSHUT,MON

i also try action_reload ( eem tcl command extension ) but the result is, it reload only the active RSP. 

Please suggest, how to reload the whole chassis ? 

3 Replies 3

Joe Clarke
Cisco Employee
Cisco Employee

How would you reload the chassis manually?  EEM doesn't have any magic capabilities.  If there is a CLI command to do it (and this reload location all sounds right), then if EEM executes it, the chassis should reload.  If that is not working for some reason, it sounds like you could do the CLI process, then call action_reload.

Thanks Joe,

the way we reload the chassis manually is " admin --> reload location all "

For the eem script to reload the chassis i got this work.

::cisco::eem::event_register_syslog tag 1 pattern "TEST" occurs 1 maxrun 1200
namespace import ::cisco::eem::*
namespace import ::cisco::lib::*

action_syslog priority warning msg "EEM Triggered"

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

if [catch {cli_exec $cli1(fd) "admin"} result] {
error $result $errorInfo
}

if [catch {cli_write $cli1(fd) "reload location all"} result] {
error $result $errorInfo
}
if [catch {cli_read_pattern $cli1(fd) "Proceed with reload"} result] {
error $result $errorInfo
}
if [catch {cli_write $cli1(fd) "\n"} result] {
error $result $errorInfo
}

action_reload

if [catch {cli_close $cli1(fd) $cli1(tty_id)} result] {
error $result $errorInfo
}

Okay, so it seems like you found the solution?  Not sure if you're still asking a question in this post.

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: