Cisco – TCP Client / Server in Cisco EEM 3.0

ciscocisco-eemcisco-ios-12

I'm attempting to set up client / server sockets in Cisco EEM 3.0 TCL with IOS version 12.4(24)T8 (this was recently upgraded to determine whether the problem was EEM ver).

I have the following two example Tcl scripts (ref: http://wiki.tcl.tk/15315 )

Server.tcl:

::cisco::eem::event_register_none maxrun 120

namespace import ::cisco::eem::*
namespace import ::cisco::lib::*

proc accept {chan addr port} {
    puts "$addr:$port says [gets $chan]"
    puts $chan goodbye
    close $chan
}
socket -server accept 12345
vwait forever

Client.tcl:

::cisco::eem::event_register_none maxrun 20

namespace import ::cisco::eem::*
namespace import ::cisco::lib::*

set chan [socket 10.0.0.2 12345]
puts $chan hello
flush $chan
puts "10.0.0.2:12345 says [gets $chan]"
close $chan

10.0.0.2 is assigned to a loopback.

When I show the listening ports via the "show control-plane host open-ports" command, the server port of 12345 is listening, but the client script does not produce any output. A telnet to the router (via a physical interface) to port 12345 results in a connection refused. No ACLs are enabled.

These scripts work from a Windows XP computer running ActiveTCL 8.5.

Is this a bug or security feature within EEM 3.0? Are any additional commands or settings required to enable TCP sockets within EEM 3.0?

Best Answer

I would start with debugging commands. I'd start with

debug event manager tcl cli

There's more information in the EEM best practices document over at https://supportforums.cisco.com/docs/DOC-12757 about debugging and troubleshooting.

Related Topic