×

Warning message

  • Cisco Support Forums is in Read Only mode while the site is being migrated.
  • Cisco Support Forums is in Read Only mode while the site is being migrated.

EEM TCL for interface commands

Unanswered Question
Feb 17th, 2014
User Badges:

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

  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 0 (0 ratings)
Loading.
Daniel Frey Mon, 02/17/2014 - 13:26
User Badges:
  • 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

bryan totten Fri, 03/07/2014 - 09:14
User Badges:

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

Joe Clarke Sat, 03/08/2014 - 13:29
User Badges:
  • Cisco Employee,
  • Hall of Fame,

    Founding Member

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.

Actions

This Discussion

Related Content