09-20-2011 12:44 AM - edited 03-07-2019 02:19 AM
Hi,
one more question about Auto Smartports:
I am searching for dynamic arguments I can use for my user-defined macros.
I know the following ones:
$LINKUP ; $INTERFACE ; $TRIGGER ; $ACCESS_VLAN ; $VOICE_VLAN
Are there some more arguments I can use?
For example I want to get the hostname from a CDP neighbor to configure a description with hostname of the neighbor.
Thanks a lot!
Sven
Solved! Go to Solution.
09-20-2011 02:53 AM
Hi Sven,
Dynamic arguments like $LINKUP ; $INTERFACE ; $TRIGGER are taken care automatically by ASP.
Like - INTERFACE is initilaized when a cdp update is received on an interace, script is triggered, and ASP comes to know the interafce
You can define more dynamic arguments,but you need to give the values of these arguments when mapping the macro using "macro auto execute.." command.
Arguments like $ACCESS_VLAN have some default values for well defined macros which you can see using command "sh macro auto device".
Dynamic updation of cdp neighbor hostname won't be possible.
Thanks,
Ankur
09-20-2011 02:53 AM
Hi Sven,
Dynamic arguments like $LINKUP ; $INTERFACE ; $TRIGGER are taken care automatically by ASP.
Like - INTERFACE is initilaized when a cdp update is received on an interace, script is triggered, and ASP comes to know the interafce
You can define more dynamic arguments,but you need to give the values of these arguments when mapping the macro using "macro auto execute.." command.
Arguments like $ACCESS_VLAN have some default values for well defined macros which you can see using command "sh macro auto device".
Dynamic updation of cdp neighbor hostname won't be possible.
Thanks,
Ankur
09-20-2011 03:34 AM
Well,i meant they won't be dynamic after all,because you need to give their values before hand :)..They will just be like $ACCESS_VLAN etc.
09-21-2011 01:26 AM
Thanks for your response!
It is not what I need, but okay ;-)
Yes....they are not dynamic. I never understood where the benefit is to have some arguments but need to give the values by hand.
Sven
09-21-2011 01:38 AM
Hi Sven,
Benefit will be like,you have some macro defined with access vlans,native vlans etc.You can change the values of these parameters without modifying your macro every time.You just need to change the values in the mapping.
Not a breakthru concept,but little ease of use ,since you were asking.
Thanks for your feedback.We will see if some more dynamic variables can be implemented.
-Ankur
09-21-2011 02:26 AM
Hi Ankur,
it would be great to decouple the macro from the config template.
At the moment I have to configure the macro
macro auto execute Testclient ACCESS_VLAN=123 VOICE_VLAN=127
and then the macro mode starts. It is not possible to change only the values for ACCESS and VOICE, right?
So I can't see the little benefit you mean
Better to use would be creating a config template with a name and in a second step you can map the macro with the arguments to the template.
So it would be possible to use the same config template more than one time per switch.
Maybe someday.....
Sven
09-24-2011 11:48 PM
Hi Sven,
Sorry for late reply
We have concept of remote macros,where you can put macro on the remote server,or flash etc...In those cases we can use the same config template more than one time per switch.
Well,you will argue that why such a functionality is not there on the regular macros defined on switch !!
The fact is it was tried to implement,but didn't get successful,so not advertised in config guide.You can define a functions in this way--
SWITCH3#function ankur () {
>blah
>}
SWITCH3#sh shell fun
SWITCH3#sh shell functions
#User defined functions:
function CISCO () {
if [[ $LINKUP -eq YES ]]; then
conf t
interface $INTERFACE
macro description $TRIGGER
switchport trunk encapsulation dot1q
switchport trunk native vlan $NATIVE_VLAN
switchport trunk allowed vlan ALL
switchport mode trunk
}
function ankur () {
blah
}
This will start showing up in "sh shell functions",but is not much usable for practical purposes.
Little weird for now,but thats how it is for present ..Will let you know if i get it working in some way.
Thanks,
-Ankur
09-26-2011 01:33 AM
Hi Ankur,
thanks a lot for your answer!
I searched for that "function" command, but didn't get it in the past!
I will now understand the structure of all the parts of ASP a little bit better
What do you think about the remote macros? Is it a useful feature or is it not as stable as to put the macros on every switch? If the ASPs are working well in our environment we want to use it on ca 3000 switches.
Sven
09-26-2011 02:18 AM
Hi Sven,
I wish it to be stable .
But now you are asking,check this bug - CSCtn94724...This was fixed in 55SE4...We have retries built in remote macro.If somehow,your remote server is not reachable,switch will keep on retrying to reach remote server,which was taking cpu util high..If remote server is reachable,everything will work fine.
If you are using 55SE4,then the former case should also be fine.
Thanks,
-Ankur
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide