cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Announcements

Community Helping Community

556
Views
10
Helpful
6
Replies
Beginner

Help required with EEM: Storing and comparing variables - Is it possible?

Hello all,

 

I'm currently have difficulty with an EEM applet for finding and selecting the best cellular provider. Ideally I want to store the RSSI of varying carriers as variables, then do a comparison to see which has the lowest value to action. (In place of true roaming due to a SIM preferred network list)

 

A snippet of the applet:

 

 action 2.5 cli command "show cellular 0 Network"
 action 2.6 regexp "MCC = 234, MNC = 33" "$_cli_result" _match
 action 2.7 if $_regexp_result eq "1"
 action 2.8 cli command "cellular 0 gsm plmn select manual 234 33"
 action 2.9  syslog msg "Selection Successful"
 action 3.0 wait 60
 action 3.2 cli command "show cellular 0 all | inc Current RSSI"
 action 3.3 regexp "Current RSSI = (-[0-9]+) dBm" "$_cli_result" _match net1dBm
 action 3.4 set NET1RSSI "$net1dBm"

 

Is it possible to repeat this process storing all of the RSSI values as variables, then comparing all of those variables using some form of "if $Variable1 le $Variable2, $Varible3 then cellular 0 gsm plmn select manual XXX XX"

 

Many thanks in advance!

 

1 ACCEPTED SOLUTION

Accepted Solutions
Cisco Employee

Re: Help required with EEM: Storing and comparing variables - Is it possible?

Here is an EEM TCL file that does the plmn search and chooses the best network based on RSSI.   Output looks like  this:

 

C819-Tmobile#event manager run plmn_search.tcl
*** Searching networks. This will take a few minutes

*Dec 10 21:49:12.999: %SYS-5-CONFIG_I: Configured from console by on vty1 (EEM:plmn_search.tcl)
*Dec 10 21:49:14.791: %LINK-5-CHANGED: Interface Cellular0, changed state to administratively down
*Dec 10 21:49:15.791: %LINEPROTO-5-UPDOWN: Line protocol on Interface Cellular0, changed state to down
C819-Tmobile#
*** Networks available with lte or umts

1 310 260 lte T-Mobile
3 311 870 lte Sprint
4 311 480 lte Verizon
5 310 410 umts AT&T
6 310 830 lte 310-830
7 312 530 lte 312-530
8 310 120 lte Sprint
9 311 882 lte 311-882
10 311 490 lte Sprint

C819-Tmobile#

 

*Dec 10 21:49:15.791: %LINEPROTO-5-UPDOWN: Line protocol on Interface Cellular0, changed state to down
*Dec 10 21:53:37.695: %HA_EM-6-LOG: plmn_search.tcl: Connected to MCC 310 MNC 260 RAT lte with RSSI = -76
*Dec 10 21:54:38.035: %HA_EM-6-LOG: plmn_search.tcl: Connected to MCC 311 MNC 870 RAT lte with RSSI = -68
*Dec 10 21:55:38.371: %HA_EM-6-LOG: plmn_search.tcl: Connected to MCC 311 MNC 480 RAT lte with RSSI = -73
*Dec 10 21:56:38.707: %HA_EM-6-LOG: plmn_search.tcl: Connected to MCC 310 MNC 410 RAT umts with RSSI = -121
*Dec 10 21:57:39.043: %HA_EM-6-LOG: plmn_search.tcl: Connected to MCC 310 MNC 830 RAT lte with RSSI = -61
*Dec 10 21:58:39.379: %HA_EM-6-LOG: plmn_search.tcl: Connected to MCC 312 MNC 530 RAT lte with RSSI = -72
*Dec 10 21:59:39.715: %HA_EM-6-LOG: plmn_search.tcl: Connected to MCC 310 MNC 120 RAT lte with RSSI = -75
*Dec 10 22:00:40.051: %HA_EM-6-LOG: plmn_search.tcl: Connected to MCC 311 MNC 882 RAT lte with RSSI = -65
*Dec 10 22:01:40.395: %HA_EM-6-LOG: plmn_search.tcl: Connected to MCC 311 MNC 490 RAT lte with RSSI = -83
*Dec 10 22:02:40.731: %HA_EM-6-LOG: plmn_search.tcl: Connected to MCC 310 MNC 410 RAT lte with RSSI = -65
*Dec 10 22:03:41.067: %HA_EM-6-LOG: plmn_search.tcl: Connected to MCC 313 MNC 100 RAT lte with RSSI = -76
C819-Tmobile#
C819-Tmobile#
C819-Tmobile#
Comparing RSSI values of each network

*** 310 830 lte RSSI = -61 has the best RSSI value

View solution in original post

6 REPLIES 6
VIP Advisor

Re: Help required with EEM: Storing and comparing variables - Is it possible?

Cisco Employee

Re: Help required with EEM: Storing and comparing variables - Is it possible?

Here is an EEM TCL file that does the plmn search and chooses the best network based on RSSI.   Output looks like  this:

 

C819-Tmobile#event manager run plmn_search.tcl
*** Searching networks. This will take a few minutes

*Dec 10 21:49:12.999: %SYS-5-CONFIG_I: Configured from console by on vty1 (EEM:plmn_search.tcl)
*Dec 10 21:49:14.791: %LINK-5-CHANGED: Interface Cellular0, changed state to administratively down
*Dec 10 21:49:15.791: %LINEPROTO-5-UPDOWN: Line protocol on Interface Cellular0, changed state to down
C819-Tmobile#
*** Networks available with lte or umts

1 310 260 lte T-Mobile
3 311 870 lte Sprint
4 311 480 lte Verizon
5 310 410 umts AT&T
6 310 830 lte 310-830
7 312 530 lte 312-530
8 310 120 lte Sprint
9 311 882 lte 311-882
10 311 490 lte Sprint

C819-Tmobile#

 

*Dec 10 21:49:15.791: %LINEPROTO-5-UPDOWN: Line protocol on Interface Cellular0, changed state to down
*Dec 10 21:53:37.695: %HA_EM-6-LOG: plmn_search.tcl: Connected to MCC 310 MNC 260 RAT lte with RSSI = -76
*Dec 10 21:54:38.035: %HA_EM-6-LOG: plmn_search.tcl: Connected to MCC 311 MNC 870 RAT lte with RSSI = -68
*Dec 10 21:55:38.371: %HA_EM-6-LOG: plmn_search.tcl: Connected to MCC 311 MNC 480 RAT lte with RSSI = -73
*Dec 10 21:56:38.707: %HA_EM-6-LOG: plmn_search.tcl: Connected to MCC 310 MNC 410 RAT umts with RSSI = -121
*Dec 10 21:57:39.043: %HA_EM-6-LOG: plmn_search.tcl: Connected to MCC 310 MNC 830 RAT lte with RSSI = -61
*Dec 10 21:58:39.379: %HA_EM-6-LOG: plmn_search.tcl: Connected to MCC 312 MNC 530 RAT lte with RSSI = -72
*Dec 10 21:59:39.715: %HA_EM-6-LOG: plmn_search.tcl: Connected to MCC 310 MNC 120 RAT lte with RSSI = -75
*Dec 10 22:00:40.051: %HA_EM-6-LOG: plmn_search.tcl: Connected to MCC 311 MNC 882 RAT lte with RSSI = -65
*Dec 10 22:01:40.395: %HA_EM-6-LOG: plmn_search.tcl: Connected to MCC 311 MNC 490 RAT lte with RSSI = -83
*Dec 10 22:02:40.731: %HA_EM-6-LOG: plmn_search.tcl: Connected to MCC 310 MNC 410 RAT lte with RSSI = -65
*Dec 10 22:03:41.067: %HA_EM-6-LOG: plmn_search.tcl: Connected to MCC 313 MNC 100 RAT lte with RSSI = -76
C819-Tmobile#
C819-Tmobile#
C819-Tmobile#
Comparing RSSI values of each network

*** 310 830 lte RSSI = -61 has the best RSSI value

View solution in original post

Beginner

Re: Help required with EEM: Storing and comparing variables - Is it possible?

Thanks both for your responses. I will give the EEM TCL a test tomorrow and report back.

Kind regards.
Beginner

Re: Help required with EEM: Storing and comparing variables - Is it possible?


@Daniel Frey wrote:

Here is an EEM TCL file that does the plmn search and chooses the best network based on RSSI.   Output looks like  this:

 

C819-Tmobile#event manager run plmn_search.tcl
*** Searching networks. This will take a few minutes

*Dec 10 21:49:12.999: %SYS-5-CONFIG_I: Configured from console by on vty1 (EEM:plmn_search.tcl)
*Dec 10 21:49:14.791: %LINK-5-CHANGED: Interface Cellular0, changed state to administratively down
*Dec 10 21:49:15.791: %LINEPROTO-5-UPDOWN: Line protocol on Interface Cellular0, changed state to down
C819-Tmobile#
*** Networks available with lte or umts

1 310 260 lte T-Mobile
3 311 870 lte Sprint
4 311 480 lte Verizon
5 310 410 umts AT&T
6 310 830 lte 310-830
7 312 530 lte 312-530
8 310 120 lte Sprint
9 311 882 lte 311-882
10 311 490 lte Sprint

C819-Tmobile#

 

*Dec 10 21:49:15.791: %LINEPROTO-5-UPDOWN: Line protocol on Interface Cellular0, changed state to down
*Dec 10 21:53:37.695: %HA_EM-6-LOG: plmn_search.tcl: Connected to MCC 310 MNC 260 RAT lte with RSSI = -76
*Dec 10 21:54:38.035: %HA_EM-6-LOG: plmn_search.tcl: Connected to MCC 311 MNC 870 RAT lte with RSSI = -68
*Dec 10 21:55:38.371: %HA_EM-6-LOG: plmn_search.tcl: Connected to MCC 311 MNC 480 RAT lte with RSSI = -73
*Dec 10 21:56:38.707: %HA_EM-6-LOG: plmn_search.tcl: Connected to MCC 310 MNC 410 RAT umts with RSSI = -121
*Dec 10 21:57:39.043: %HA_EM-6-LOG: plmn_search.tcl: Connected to MCC 310 MNC 830 RAT lte with RSSI = -61
*Dec 10 21:58:39.379: %HA_EM-6-LOG: plmn_search.tcl: Connected to MCC 312 MNC 530 RAT lte with RSSI = -72
*Dec 10 21:59:39.715: %HA_EM-6-LOG: plmn_search.tcl: Connected to MCC 310 MNC 120 RAT lte with RSSI = -75
*Dec 10 22:00:40.051: %HA_EM-6-LOG: plmn_search.tcl: Connected to MCC 311 MNC 882 RAT lte with RSSI = -65
*Dec 10 22:01:40.395: %HA_EM-6-LOG: plmn_search.tcl: Connected to MCC 311 MNC 490 RAT lte with RSSI = -83
*Dec 10 22:02:40.731: %HA_EM-6-LOG: plmn_search.tcl: Connected to MCC 310 MNC 410 RAT lte with RSSI = -65
*Dec 10 22:03:41.067: %HA_EM-6-LOG: plmn_search.tcl: Connected to MCC 313 MNC 100 RAT lte with RSSI = -76
C819-Tmobile#
C819-Tmobile#
C819-Tmobile#
Comparing RSSI values of each network

*** 310 830 lte RSSI = -61 has the best RSSI value


Hi Daniel,

 

I have sent you a PM

 

Kind Regards.

Highlighted
Hall of Fame Cisco Employee

Re: Help required with EEM: Storing and comparing variables - Is it possible?

I don't understand.  You're already storing the current RSSI as a variable.  The MCC and MNC numbers appear to be magic, but they could easily come from other variables.  It would be helpful if you presented at least some more pseudo code of what you're trying to accomplish.

Beginner

Re: Help required with EEM: Storing and comparing variables - Is it possible?

Hi Joe,

 

This has now been resolved.

 

Kind Regards

CreatePlease to create content
Content for Community-Ad
July's Community Spotlight Awards