01-14-2009 05:17 PM
Hi, I am currently searching for a method to use an Ethernet interfaces as a backup route to a primary Cellular connection. The catch is that the FastEthernet port needs to enabled/disabled based on Cellular signal strength. Alternatively the Ethernet device attached to the FE has the ability to receive AT commands for connection control. This may be possible with TCL or other methods. If anyone can assist either options or source of TCL information, this will be greatly appreciated.
Solved! Go to Solution.
01-15-2009 09:44 PM
I think I see what's happening. IT looks like you didn't re-register the script. Once you've copied the new script onto flash, be sure you do:
no event manager policy tm_cellular_watch.tcl
event manager policy tm_cellular_watch.tcl
As for an editor, I use vim on FreeBSD. However, there is a very full-featured IDE for EEM from Nidus Software (http://www.nidussoft.com/).
01-14-2009 07:51 PM
This sounds like a very feasible thing for the Embedded Event Manager to do. What version of IOS is this device running? Exactly what steps would need to be done, and under what exact conditions?
01-14-2009 08:00 PM
Thanks for the reply Joe. The device is currently running IOS version 12.4(20)T although I am currently looking at any added benefits of 12.4(22)T.
In order for my system to work correctly I need to either shut or unshut FastEthernet 4 OR send AT commands via FastE4 when Cellular coverage is not avaliable.
At this time the only way that I can find this information is issuing the CLI command "show cellular 0 network" and looking at the "Current Service Status".
I have looked at trying to use EEM although at this time have not succeeded in creating a log entry when the cellular network status changes.
01-14-2009 08:04 PM
What does the "show cellular 0 network" look like when the connection is healthy, and when it is not? How do you send the AT commands?
01-14-2009 08:15 PM
HEALTHY
-------
Router#show cellular 0 network
Current Service Status = Normal, Service Error = None
Current Service = Combined
Packet Service = UMTS/WCDMA (Attached)
Packet Session Status = Inactive
Current Roaming Status = Home
Network Selection Mode = Automatic
Country = AUS, Network = Telstra
Mobile Country Code (MCC) = 505
Mobile Network Code (MNC) = 1
Location Area Code (LAC) = 30800
Routing Area Code (RAC) = 1
Cell ID = 6332
Primary Scrambling Code = 497
PLMN Selection = Automatic
Registered PLMN = , Abbreviated =
Service Provider = Telstra
Router#
NOT HEALTHY
-----------
Router#show cellular 0 network
Current Service Status = No service, Service Error = None
Current Service = Combined
Packet Service = None
Packet Session Status = Inactive
Current Roaming Status = Home
Network Selection Mode = Automatic
Country = AUS, Network = Telstra
Mobile Country Code (MCC) = 505
Mobile Network Code (MNC) = 1
Location Area Code (LAC) = 30800
Routing Area Code (RAC) = 1
Cell ID = 6332
Primary Scrambling Code = 0
PLMN Selection = Automatic
Router#
In regards to sending AT commands, this is the second component that I have been unable to resolve. If the coonection was to a serial modem connection via serial I would use the "chat-script" command. Is it possible to send AT modem type commands via ethernet?
01-14-2009 09:06 PM
Is it possible to create a TCL script to run every X minutes (5 for example) which will issue a CLI command, look for a described response and based on the response issue other CLI commands such as shut or no shut of an interface?
If this is possible the method may be to use TCL to identify if cellular network is present and then control the ethernet interface accordingly.
01-15-2009 06:16 PM
This EEM policy should do what you want. To register it, first decide where on the device you want to store your EEM policies. If your device's flash supports creating directoies, I recommend you create a policies directory:
mkdir flash:policies
Then copy the tm_cellular_watch.tcl file to that directory. If not, then copy the tm_cellular_watch.tcl to the root of your flash file system.
Next, configure IOS to point to this location to find EEM Tcl policies:
Router(config)#event manager directory user policy flash:policies
Next, set the two required environment variables. See the comments in the script for what they are. For example:
Router(config)#event manager environment cellular_interface 0
Router(config)#event manager environment cellular_noshut_interface FastEthernet0
Finally, register the policy:
Router(config)#event manager policy tm_cellular_watch.tcl
The policy is untested as I don't have a cellular device, but it should do what you want.
01-15-2009 08:28 PM
Thanks for your help thus far. This code appears to be working correctly. I am currently looking at the code in closer detail to add an extra step for which I may need to ask for further assistance.
Is it possible to change the code to shut the interface if the cellular network is avaliable. As the shut command should only be applied if network is avaliable I wouild predict that it will appear after
if { $status == "Normal" || $status == $prev_state } {
set prev_state $status
catch { context_save CELLULARCTXT prev_state } errmsg
return -code ok
Additionally, does this script run every 300 seconds regardless of previous attempt. If I am correct the first line in the tcl sets this?
01-15-2009 08:43 PM
01-15-2009 09:08 PM
The script seems to stop prior to issuing the cli commands. At the moment I have managed to shut the interface by forcing the Cellular to loose conectivity and this therfore shut the interface although now that the Cellular has returned to normal the "shut" command is still not being applied.
Is there a way to debug TCL scripts to see exactly what is occuring?
01-15-2009 09:24 PM
It could be that the service string isn't exactly "Normal". You can enable "debug event manager tcl cli_library" to see what is going on.
01-15-2009 09:40 PM
Looking at the debug, the below appears to be the critical component. Is there a recommened script editor so I can play around with different options?
: Router#show cellular 0 network | include Current Service Status
*Jan 16 05:34:44.051: %HA_EM-6-LOG: tm_cellular_watch.tcl : DEBUG(cli_lib) : OUT
: Current Service Status = Normal, Service Error = None
*Jan 16 05:34:44.051: %HA_EM-6-LOG: tm_cellular_watch.tcl : DEBUG(cli_lib) : OUT
: Router#
*Jan 16 05:34:44.051: %HA_EM-6-LOG: tm_cellular_watch.tcl : DEBUG(cli_lib) : CTL
: cli_close called.
01-15-2009 09:44 PM
I think I see what's happening. IT looks like you didn't re-register the script. Once you've copied the new script onto flash, be sure you do:
no event manager policy tm_cellular_watch.tcl
event manager policy tm_cellular_watch.tcl
As for an editor, I use vim on FreeBSD. However, there is a very full-featured IDE for EEM from Nidus Software (http://www.nidussoft.com/).
01-15-2009 10:04 PM
Thankyou for all of your assistance. It appears that I had two issues. First, you correctly identified that I had not re-registered the script.Additionally, as the code issues commands based on previous code I had to revert everything to a normal operation to start the process correctly before taking the unit out/in of cellular coverage.
Thanks agin, solution now working.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide