Cloud Managed Networks

 View Only
last person joined: 2 days ago 

Forum to discuss all things related to HPE Aruba Networking Central and UXI Network Management, including deployment of managed networks, configuration, best practices, APIs, Cloud Guest, AIOps, Presence Analytics, and other included Applications
Expand all | Collapse all

Using empty variables in templates

This thread has been viewed 10 times
  • 1.  Using empty variables in templates

    Posted Jun 21, 2022 10:27 AM
    I'm wondering if someone knows about a syntax guide for templates in Aruba Central. 
    We are managing a bunch of CX switch stacks. I have configured them using templates. My apoach is that I configure all ports as a standard colorless client port. We do however, have a couple of exceptions where a port needs a different config. We are using variables to define those ports.

    See the following code example:

    %if special_ports_999%
      interface %special_ports_999%
        no shutdown
        vlan access 999
        no aaa authentication port-access dot1x authenticator
        no aaa authentication port-access mac-auth
    %endif%

    The intention is that, if the variable is empty, the above piece of code is ignored. Our initial deployment included those variables, with an empty value. Everything committed fine, and the template was synced succesfully. 

    However, now I changed my template a bit, (not in this part!) and all my switches that have empty variables refuse to sync  until I remove the variable. I would like to figure out how to proceed, but I cannot find a clear guide on how the syntax for these templates exactly works. For instance, can I use something like: 

    %if special_ports_999 != "NONE"%

     I would prefer something like this because the value of variables can be edited trought the central GUI, but to remove a variable you'll have to export a json file, edit that and import it, which is a bit cumbersome.


    ------------------------------
    Jelmer Hartman
    ------------------------------


  • 2.  RE: Using empty variables in templates

    Posted Jun 22, 2022 04:55 AM
    Hi Jelmer,

    I believe you can do it like this:

    %if special_port_config=1%
      <use this config>
    %endif%

    %if special_port_config=0%
      <use this config>
    %endif%