06-18-2012 06:07 AM
Hello,
Is it possible to access global variables (current device and current port) in the CLI commands and what are there names?
The customer wants to run the "default interface gi x/y/z" command before deploying customized commands, but it is not inside the interface context and need to be parametrisized, for example:
<cli name="edgeConfig">
<clicommand>
default interface ${current_port?}
switchport access vlan ${access-vlan-id}
switchport mode access
switchport voice vlan ${voice-vlan-id}
</clicommand>
</cli>
Steffen
06-19-2012 01:11 AM
The ${interface} variable should hold the current interface.
08-30-2012 03:18 AM
Hi Jo,
Thx for the variablename, but the 2nd part of problem with differnt command level in one template is left:
default interface ${current_port?}
belongs at global level and the remaining statements at interface level.
Please see, why it is not working below. Have you got an idea to get this working?
Results for Device Sw01234
Device Deployed
Pre Device Execution Message:
Post Device Execution Message:
Update Startup Not Attempted
Results of Deploy:
Message: Deploy command partially failed
defaultdefault
% Incomplete command.
Sw01234(config)#
interface Gi2/0/43Sw01234(config-if)#
switchport access vlan 20Sw01234(config-if)#
switchport mode accessSw01234(config-if)#
switchport voice vlan 152Sw01234(config-if)#
Sw01234(config-if)#
08-30-2012 06:48 AM
Ah, yes. I did something similar at CiscoLive!, but I used a device template. Sadly, the default int thing did not work. I ran into a bug (CSCua86328). You cannot reuse the same variable within a template.
I have not tried this within an interface template, but I don't think it would work given that you'd have to reuse a variable. The other alternative is to use a lot of "default" commands within the interface. This is what I ended up doing at CiscoLive!.
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