Monitor default route BGP - tcl
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-31-2016 01:45 AM
In IOS we use the following EEM script to monitor the default route in BGP.
!
event manager applet MONITOR_DEFAULT_ROUTE_BGP
event routing network 0.0.0.0/0 protocol BGP vrf name INT
action 1 set msg "Route changed: Type: $_routing_type, Network: $_routing_network"
action 2 syslog msg "$msg"
action 3 if $_routing_type eq "remove"
action 4 track set 1 state down
action 5 end
action 6 if $_routing_type eq "add"
action 7 track set 1 state up
action 8 end
!
I want to convert this to IOS-XR where I must use tcl. I tried to use the EEM Applet to tcl policy tool (http://www.marcuscom.com/convert_applet/)
Receive the following errors. Or is there a beter solution?:
----------------------------------------------------------------------
::cisco::eem::event_register_routing network 0.0.0.0/0 protocol BGP vrf name INT
namespace import ::cisco::eem::*
namespace import ::cisco::lib::*
array set arr_einfo [event_reqinfo]
invalid command name "event_reqinfo"
set msg "Route changed: Type: $arr_einfo(type), Network: $arr_einfo(network)"
can't read "arr_einfo(type)": no such variable
action_syslog msg "$msg"
can't read "msg": no such variable
if {$arr_einfo(type) == "remove"} {
action_track_set 1 state down
}
can't read "arr_einfo(type)": no such variable
if {$arr_einfo(type) == "add"} {
action_track_set 1 state up
}
can't read "arr_einfo(type)": no such variable
----------------------------------------------------------------------
- Labels:
-
EEM Scripting

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-31-2016 06:10 AM
I don't believe XR supports the routing event detector yet, so it's likely this will not work. I haven't checked very recent versions of XR, though. And it looks like you're running this script through the Tcl shell as opposed to registering it as an EEM policy. See http://www.cisco.com/c/en/us/td/docs/routers/crs/software/crs_r4-2/system_monitoring/configuration/guide/b_sysmon_cg42crs/b_sysmon_cg42crs_chapter_010.html#con_1027188 on how to register these policies.
