cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
3036
Views
0
Helpful
3
Replies

EEM TCL for interface commands

bryan totten
Level 1
Level 1

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!!

3 Replies 3

Dan Frey
Cisco Employee
Cisco Employee

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

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

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.

Review Cisco Networking for a $25 gift card