Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements

Welcome to Cisco Support Community. We would love to have your feedback.

For an introduction to the new site, click here. And see here for current known issues.

New Member

EEM Menu on IOS-XR

Howdy,

Since XR doesn't support EMM, I'm using a TCL script and gets to capture user input via STDIN.  The problem is that once the script is running, XR appears to get confused between the script, and the actual IOS-XR CLI interface...  Pressing enter will switch between the TCL script and the XR CLI prompt, at random, the STDIN buffer ends up with either garbage in it, and/or input randomly gets sent to either the script or the XR CLI.

Is there a better way to go about this?

Sample output of the script, cleaned up a little for brevity's sake:

[Menu]

> 1 <------------------ Valid user input

08/14/12 19:07:56

[Menu]

>

                                ^

% Invalid input detected at '^' marker.

RP/0/RSP1/CPU0:ttnet-ch-ropip-1#

RP/0/RSP1/CPU0:ttnet-ch-ropip-1#Input Chars: 49

[ Expected Output was here ] <---------------------- User input above actually got processed/displayed here (after pressing enter 3 more times)

08/14/12 19:07:59

[ Menu ]

>

RP/0/RSP1/CPU0:ch-ropip-1#Input Chars:

08/14/12 19:08:01

[ Menu ]

>

08/14/12 19:08:01

[ Menu ]

>  Input Chars:

The script is registered as an event manager policy, and run using 'event manager run xr-test.tcl':

event manager policy xr-test.tcl username admin persist-time 3600 type user

And the pertinant part of the script:

::cisco::eem::event_register_none maxrun 480

namespace import ::cisco::eem::*

namespace import ::cisco::lib::*

set input [gets stdin]

set t_input [string trim $input]

binary scan $t_input c* _input

puts "Input Chars: $_input"

switch -- $t_input {

    1 {

        get_cust_info

        return

    }

    2 {

        get_logs

        return

    }

    3 {

        display_cust_menu

        return

    }

    4 {

        display_ping_menu

    }

    x {

        cli_close $cli1(fd) $cli1(tty_id)

        return -1

    }

    default {

        print_menu [array get main_menu]

        return

    }

}   

730
Views
0
Helpful
0
Replies