Cloud Managed Networks

Reply
Highlighted
Occasional Contributor II

Problem using empty variables with configuration templates switches in Aruba Central

Hello,

 

I have the following issue.

 

I want to use one configuration template for all my switches. The problem is when i use vlan variables and a vlan is not present on a switch and i do not configure the vlan variable or keep it empty i get a Template error. I says that the variable is not being used. I now use different config templates for every switch as a workaround this problem. But there should be a sollution for this.

 

Anybody got any tips?

Highlighted
Moderator

Re: Problem using empty variables with configuration templates switches in Aruba Central

Please excuse the delay in getting back to this. Here are some tips regarding variables in Aruba Central:

 

If a template has a certain variable in the middle of the configuration template, all devices associated to the template need to have that variable, otherwise the configuration would error out.

 

However, you may want to use the same template for diferent devices, and not all devices may need all variables. When this is the case, you can use %if%, %else% %if_else% to create scripts. I've added a few examples below.

 

Then... What happens if you have more variables than the template is really "consuming"? That would be perfectly fine, Central would just carry those as "dead weight" associated to the device, and they would remain there in case the device is moved to a template that does consume them.

 

CLI Scripts

A CLI script is anything that use 'If-else-endif' syntax. Syntax could be as simple as only 'if-endif' structure to as complex as 'Nested if' structure. 'If-endif'

 

%if condition1=true%
routing-profile 10.10.1.0 255.255.255.0 10.10.1.255
%endif%

 

 'If-else-endif'

 

%if condition1=true%
routing-profile 10.40.0.0 255.255.255.0 10.40.0.255
%else%
routing-profile 10.20.1.0 255.255.255.0 10.20.1.255
%endif%

 

 'Nested if'

 

%if condition1=true%
routing-profile 10.10.0.0 255.255.255.0 10.10.0.255
           %if condition2=true%
            routing-profile 10.30.1.0 255.255.255.0 10.30.1.255
            %else%
            routing-profile 10.50.1.0 255.255.255.0 10.50.1.255
            %endif%
%else%
routing-profile 10.20.0.0 255.255.255.0 10.20.0.255
            %if condition3=true%
             routing-profile 10.70.1.0 255.255.255.0 10.70.1.255
             %else%
             routing-profile 10.40.1.0 255.255.255.0 10.40.1.255
             %endif%
%endif%

 

 

 

 


Samuel Pérez
ACMP, ACCP, ACDX#100

---

If I answerd your question, please click on "Accept as Solution".
If you find this post useful, give me kudos for it ;)
Highlighted
New Contributor

Re: Problem using empty variables with configuration templates switches in Aruba Central

Hello,

 

We set up a stack  of 2930M in Aruba Central with TG, after use a conditionals for accomplish our sh run, is possible to use loops like "for, while"? 

 

I think, it would let us a easier and cleaner template.

 

Regards,

 

Lluís P.