cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Announcements
Popup Hotspot Using ISR 1000 with WiFi/LTE for Teleworkers and Micro Branchesr
250
Views
5
Helpful
2
Replies
Highlighted

Can EEM detect the routers prompt?

Is it possible for EEM scripting to be used to check that the correct prompt is showing when a particular command is entered?

 

For example if I am in BGP config mode and I type:

Router(config-router)#address-family ipv4 unicast vrf 1234

 

I would like to make sure that the prompt changes to:

Router(config-router-af)#

 

This would prevent someone accidentally mistyping the VRF and end up putting code in the global address family that could cause problems. An alternative might be to detect the % VRF 1234 does not exist. warning instead?

Everyone's tags (4)
2 REPLIES 2
Highlighted
Hall of Fame Cisco Employee

Unfortunately, you cannot

Unfortunately, you cannot match the prompt in this manner.  However, you can use the CLI event detector to match the address-family ... command and then check to see that the VRF actually exists.  If it doesn't you can print a message that might be more visible to the user.  I'm not sure if this would be sufficient for your use case, though.
 

Highlighted

Hi Joseph, We have managed to

Hi Joseph,

 

We have managed to come up with this to server our purpose:

event manager session cli username eemauto

event manager applet BGP_VRF_CHECK
 event cli pattern "address-family ipv4 vrf .*" sync yes
  action 10  cli command "enable"
  action 20  cli command "configure terminal"
  action 30  cli command "router bgp 1234"
  action 40  cli command "$_cli_msg"
  action 50  string length "$_cli_result"
  action 60  if $_string_result lt 50 goto END
  action 70  regexp "% VRF (.*) does not exist." "$_cli_result" not_configured vrf
  action 80  syslog msg "CATCH_AF_VRF_NOT_EXIST: VRF $vrf is not configured.  Networks please investigate."
  action END set _exit_status "1"

 

Not as smooth as I would like as it is dependent on the resulting length of the % VRF (.*) does not exist. message. It will generate a syslog message that we can then detect and send a message out.

CreatePlease to create content
Content for Community-Ad