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

EEM TCL for interface commands

I am working on a script that will make interface changes.  I am trying to do the following:

1) save the output from the following command:  #show cdp nei detail | i Interface

2) this will most likely give a list of interfaces some of which will be repeated.  If the interface is listed more than once then i would like to remove the

    repeated interface.  (note i am not concerned about the outgoing interface)

3)using the above information i would then like to make configuration to the interfaces with the following commands

     #config t

     #interface $intf

     #no mls qos vlan-based

     #mls qos trust dscp

i have started this script (please see attached file) and would really appreciate some assistance especially with how to eliminate multiple instances of the same interface.

thanks!!

Everyone's tags (2)
3 REPLIES
Cisco Employee

Re: EEM TCL for interface commands

Add "set summary [lsort -unique $summary] " to your script after creating $summary. 

if [catch {cli_exec $cli1(fd) "show cdp neighbors detail | include Interface" } summary ] {

    error $summary $errorInfo

}

set summary [lsort -unique $summary]

set lines [split $summary "\n"]

ect....

Dan

Community Member

EEM TCL for interface commands

I am having issues running scripts on my 3750x.  One of the few commands i am getting to work is the

router(tcl)#puts "testing this command"

most all other commands are not working for example:  ios_config, set

I am attaching a file with more details.  Any help would be greatly appreciated!

tcltshoot1.png

tcltshoot2.png

Cisco Employee

Tclsh doesn't work with

Tclsh doesn't work with command authorization.  If you need to use command authz, you will need to switch to EEM Tcl and configure:

 

event manager session cli username USER

 

Where USER is a user authorized to run all of the CLI commands.  Since this thread doesn't seem to be applicable to what you're doing, I recommend you start a new one if you require more help.

1388
Views
0
Helpful
3
Replies
CreatePlease to create content