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

Advanced BaseLine template in CiscoWorks

Hi

Does anyone know if its possible to make a template that gets data and uses it to make commands, example:

Say i want the description field on all trunks to include the hostname of the next-hop.

Could i use something like "show cdp nei" as preceding/parrent and then somehow refer to that data with my + [#description something #] command? Or maybe do it without a preceding command?

Any help would be much appreciated.

Thanks.

12 REPLIES
Cisco Employee

Re: Advanced BaseLine template in CiscoWorks

Unfortunately not.  Operational data like this is something we have asked for, and we will likely see it in a future release.  You could use embedded scripting such as the Embedded Event Manager on the device to detect CDP neighbor changes on an interface and update the description.  You could use an EEM applet like the following on switches running recent code:

event manager applet cdp-descr

event neigh cdp add interface regexp .*Ethernet.*

action 1.0 cli command "enable"

action 2.0 cli command "config t"

action 3.0 cli command "int $_nd_local_intf_name"

action 4.0 cli command "description Connection to $_nd_cdp_entry_name"

action 5.0 cli command "end"

New Member

Re: Advanced BaseLine template in CiscoWorks

Thanks for the answer.

It looks like it would be a perfect solution, but i need it on 2000+ switches which doesnt have the ip service image. So is there an alternative?

Also what i actually need in the description field is hostname and port name of next hop. How would you get the next-hop port in an EEM aplet.

Thanks.

Cisco Employee

Re: Advanced BaseLine template in CiscoWorks

IP SERVICES should not be a prereq if the switches are running new enough code.  However, if they are 29XX switches, EEM will not work.  Auto Smart Ports macros will, though.  You can use LMS to push macro configurations down to your switches.

For the next-hop port, you could use:


event manager applet cdp-descr
event neigh cdp add interface regexp .*Ethernet.*
action 1.0 cli command "enable"
action 2.0 cli command "config t"
action 3.0 cli command "int $_nd_local_intf_name"
action 4.0 cli command "description Connection to $_nd_cdp_entry_name : $
_nd_port_id"
action 5.0 cli command "end"
New Member

Re: Advanced BaseLine template in CiscoWorks

Thanks for the answers.

I think i might be able to do it with Auto smart ports. But how would you write the macro? I dont know how to refer to a value from cdp.

Thanks.

Cisco Employee

Advanced BaseLine template in CiscoWorks

Check out the command "show shell functions".  This will show you the built-in ASP macros, which are great ways of getting started.  While I haven't tried this, ASP is built on top of EEM, so you should be able to use something like:

$_nd_cdp_entry_name

and

$_nd_port_id

Within your macro.

New Member

Advanced BaseLine template in CiscoWorks

Ok im with you this far, but do you then know how to add a variable to a description field. So it will be used as the value of the variable instead of regular text.

I can see that "macro description" accepts commands like $trigger - - but the regular description doesnt seem to accept variables that easy.

Thanks.

Cisco Employee

Re: Advanced BaseLine template in CiscoWorks

Have a look at http://www.cisco.com/en/US/partner/docs/switches/lan/auto_smartports/12.2_58_se/configuration/guide/configure.html#wp1053766.  In particular, you will likely be configuring a CISCO_ROUTER_EVENT, CISCO_SWITCH_EVENT, and/or CISCO_WIRELESS_AP_EVENT.

New Member

Re: Advanced BaseLine template in CiscoWorks

I get "Forbidden File or Application" when i try to log in.

Do you have another link?

Thanks.

Cisco Employee

Re: Advanced BaseLine template in CiscoWorks

New Member

Re: Advanced BaseLine template in CiscoWorks

First off all, thanks for all your help.

I've tried to read through the document, but i cant find what im seeking. Maybe im reading it wrong.

I do understant that im making an event that causes some commands to be executed on all or a specific interface, depending on how i configure it.

My problem is that i dont know the command/commands to tell the switch that what i write in the description field is not just text but a variable. Ive tried  $_nd_cdp_entry_name and {$_nd_cdp_entry_name} and [$_nd_cdp_entry_name]...  the list could go on. Do you have an idea of how to tell the description field that "its" a variable instead of just text.

Thanks.

Cisco Employee

Re: Advanced BaseLine template in CiscoWorks

Your first try was right.  Something like:

if [[ $LINKUP -eq YES ]]; then

  config t

    interface $INTERFACE

      description $_nd_cdp_entry_name ...

    end

fi

New Member

Advanced BaseLine template in CiscoWorks

Very nice input.

Do you know if there is any reason why this works:

macro auto execute AIRONET_3502I ACCESS_VLAN=m-net {

if [[ $LINKUP == YES ]]

  then conf t

  interface  $INTERFACE

  macro description $TRIGGER

  desc m-net

  switchport access vlan $ACCESS_VLAN

  switchport mode access

  exit

  end

fi

if [[ $LINKUP == NO ]]

  then  conf t

  interface  $INTERFACE

  no macro description

  no desc m-net

  no switchport access vlan $ACCESS_VLAN

  no switchport mode access

  exit

  end

fi

}

But this doesnt:

macro auto execute CISCO_CUSTOM_EVENT ACCESS_VLAN=P-net {

if [[ $LINKUP == YES ]]

  then conf t

  interface  $INTERFACE

  exit

  end

fi

if [[ $LINKUP == NO ]]

  then conf t

  interface $INTERFACE

desc P-net

switchport access vlan $ACCESS_VLAN

switchport mode access

  exit

  end

fi

}

Thanks for your help

Isaac

1146
Views
0
Helpful
12
Replies
CreatePlease to create content