Date created: Monday, August 5, 2019 12:28:20 PM. Last modified: Wednesday, December 2, 2020 6:03:27 PM

Shutdown L3 Interface Pair

This example script can be used to shutdown multiple layer 3 interfaces (which are not in a bundle/LAG). In this example two 10G layer 3/MPLS links facing a pair of P nodes are on line card 0. There is also two layer 3/MPLS link on line card 1 connecting to a different pair of P nodes. Because the interfaces are not in a LAG/bundle they are placed on the same line card, line resilience is not required because in the because in the case that one link fails towards a P node pair, the other link should not be used because it won't have enough capacity. Instead, an EEM script shuts down the other 10G interface on the same line card.


! This is one pair of core facing interfaces
track 20 interface TenGigabitEthernet0/0/0 line-protocol
track 21 interface TenGigabitEthernet0/1/0 line-protocol

! This is another pair of core facing interfaces
track 22 interface TenGigabitEthernet1/0/0 line-protocol
track 23 interface TenGigabitEthernet1/1/0 line-protocol


track 11 list boolean and
object 20
object 21
!
track 12 list boolean and
object 22
object 23
!
track 13 list boolean or
object 20
object 21
delay up 10
!
track 14 list boolean or
object 22
object 23
delay up 10

event manager applet INTERFACE-DOWN-Te0
event tag 1.0 track 11 state down
action 1.0 cli command "enable"
action 2.0 cli command "show ip interface brief | inc ^Te0/0/0"
action 3.0 string first "down" "$_cli_result"
action 4.0 if $_string_result eq "-1"
action 5.0 syslog msg "Interface Te0/1/0 has gone down --> EEM is shutting down the partner interface Te0/0/0"
action 5.1 cli command "conf t"
action 5.2 cli command "interface Te0/0/0"
action 5.3 cli command "shutdown"
action 5.4 cli command "end"
action 6.0 else
action 7.0 syslog msg "Interface Te0/0/0 has gone down --> EEM is shutting down the partner interface Te0/1/0"
action 7.1 cli command "conf t"
action 7.2 cli command "interface Te0/1/0"
action 7.3 cli command "shutdown"
action 7.4 cli command "end"
action 8.0 end

event manager applet INTERFACE-DOWN-Te1
event tag 1.0 track 12 state down
action 1.0 cli command "enable"
action 2.0 cli command "show ip interface brief | inc ^Te1/0/0"
action 3.0 string first "down" "$_cli_result"
action 4.0 if $_string_result eq "-1"
action 5.0 syslog msg "Interface Te1/1/0 has gone down --> EEM is shutting down the partner interface Te1/0/0"
action 5.1 cli command "conf t"
action 5.2 cli command "interface Te1/0/0"
action 5.3 cli command "shutdown"
action 5.4 cli command "end"
action 6.0 else
action 7.0 syslog msg "Interface Te1/0/0 has gone down --> EEM is shutting down the partner interface Te1/1/0"
action 7.1 cli command "conf t"
action 7.2 cli command "interface Te1/1/0"
action 7.3 cli command "shutdown"
action 7.4 cli command "end"
action 8.0 end

event manager applet INTERFACE-UP-Te0
event tag 1.0 track 13 state up
action 1.0 syslog msg "One Te0/*/0 core interface has come up --> EEM is bringing up the partner interface"
action 2.0 cli command "enable"
action 2.1 cli command "conf t"
action 2.2 cli command "int range Te0/0/0, Te0/1/0"
action 2.3 cli command "no shut"
action 2.4 cli command "end"

event manager applet INTERFACE-UP-Te1
event tag 1.0 track 14 state up
action 1.0 syslog msg "One Te1/*/0 core interface has come up --> EEM is bringing up the partner interface"
action 2.0 cli command "enable"
action 2.1 cli command "conf t"
action 2.2 cli command "int range Te1/0/0, Te1/1/0"
action 2.3 cli command "no shut"
action 2.4 cli command "end"

 


Previous page: Repeat Command X Times
Next page: TCP/SSH/VTY Sessions