11-29-2019 12:04 AM
Hello,
I'm currently trying to get failover & fallback working on a Cisco 819-4G router.
Although able to get failover working one way with the following EEM applet, getting to simulate fall back to the primary SIM is where I'm stuck at.
event manager applet LINK-FAILOVER
event track 10 state down
action 1.0 syslog msg "!!!!FAILOVER TO BACKUP SIM!!!!"
action 1.1 cli command "enable"
action 1.2 cli command "clear interface cellular 0"
action 1.3 cli command "cellular 0 lte sim activate slot 1"
action 1.4 cli command "exit"
!
I've tried using the following to include for fallback but that doesnt seem to work
event manager applet LINK-FAILOVER
event track 10 state down
action 1.0 syslog msg "!!!!FAILOVER TO BACKUP!!!!"
action 1.1 cli command "enable"
action 1.2 cli command "show cellular0 security"
action 1.3 regexp "Active SIM = ([0-9])" $_cli_result match sim
action 1.4 if $sim eq 0
action 1.5 cli command "clear interface cellular 0"
action 1.6 cli command "cellular 0 lte sim activate slot 1"
action 1.7 else
action 1.8 if $sim eq 1
action 1.9 syslog msg "!!!!FALLBACK TO PRIMARY!!!!"
action 2.0 cli command "clear interface cellular 1"
action 2.1 cli command "cellular 0 lte sim activate slot 0"
action 2.2 end
action 2.3 end
The following output is noted when doing the initial failover the second applet
*: %TRACK-6-STATE: 10 ip sla 10 state Up -> Down
*: %HA_EM-6-LOG: LINK-FAILOVER: !!!!FAILOVER TO BACKUP!!!!
*: %HA_EM-3-FMPD_UNKNOWN_ENV: fh_parse_var: could not find environment variable: sim
*: %HA_EM-3-FMPD_UNKNOWN_ENV: fh_parse_var: could not find environment variable: sim
Would appreciate if the applet noted above can be verified/corrected.
Kind Regards,
Solved! Go to Solution.
11-30-2019 06:17 AM
Thank you Daniel and appreciated very much your pointing out the space - my bad.
The 2nd applet in my initial Post works okay now.
Although I tried amending action 1.3 as mentioned, the output noted was still %HA_EM-3-FMPD_UNKNOWN_ENV: fh_parse_var: could not find environment variable: sim
Each of the following lines were attempted separately:
- action 1.3 regexp "Active SIM = ([$sim])" $_cli_result match sim
- action 1.3 regexp "Active SIM = ($sim)" $_cli_result match sim
- action 1.3 regexp "Active SIM = $sim" $_cli_result match sim
- action 1.3 regexp "Active SIM = <$sim>" $_cli_result match sim
- action 1.3 regexp "Active SIM <$sim>" $_cli_result match sim
Thank you again for your support.
Kind Regards,
Paul.
11-29-2019 12:53 PM - edited 11-29-2019 12:54 PM
The second applet has action 1.3 to run a show command, parse out the line that has "Active SIM <number>" and assign variable $sim to the number. Action 1.3 is not getting the value as I tried on my 819.
C819-Tmobile#show cellular0 security
% Invalid input detected at '^' marker.
C819-Tmobile#
Action 1.3 needs to be update to include a space between cellular and 0.
C819-Tmobile#show cellular 0 security
Active SIM = 0
You should run the CLI commands in the EEM policy manually and verify that the commands are valid.
-Dan
11-30-2019 06:17 AM
Thank you Daniel and appreciated very much your pointing out the space - my bad.
The 2nd applet in my initial Post works okay now.
Although I tried amending action 1.3 as mentioned, the output noted was still %HA_EM-3-FMPD_UNKNOWN_ENV: fh_parse_var: could not find environment variable: sim
Each of the following lines were attempted separately:
- action 1.3 regexp "Active SIM = ([$sim])" $_cli_result match sim
- action 1.3 regexp "Active SIM = ($sim)" $_cli_result match sim
- action 1.3 regexp "Active SIM = $sim" $_cli_result match sim
- action 1.3 regexp "Active SIM = <$sim>" $_cli_result match sim
- action 1.3 regexp "Active SIM <$sim>" $_cli_result match sim
Thank you again for your support.
Kind Regards,
Paul.
11-30-2019 08:56 AM - edited 11-30-2019 08:58 AM
The value gets assigned to $sim by this syntax: action 1.3 regexp "Active SIM = ([0-9])" $_cli_result match sim
The other iterations you tried will break regexp and no match is made.
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: