cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
702
Views
1
Helpful
7
Replies

DNAC Template System Variables Doc?

Marcel Zehnder
Spotlight
Spotlight

Hi

Is there a doc for the DNAC template system variables? I'm looking for the schemas for these variables:

MicrosoftTeams-image.png

Thanks
Marcel

7 Replies 7

Hey buddy like these?

${hostname} - Populates with the host name of the device
${site} - Populates with the site of the device

 

Please mark this as helpful or solution accepted to help others
Connect with me https://bigevilbeard.github.io

Hey Stu, yeah plus what I'm most intrested in is the format of the corresponding return values, for example for interface.portName is the output "Gig1/0/1", "G1/0/1" or "GigabitEthernet1/0/1"... ...again, interface.portName is just an example, I'm looking for a doc containing this information for all available system vars. I was not able to find such a doc.

Sure, I can check it on the fly in the template editor for a certain var, but that's a little bit time consuming..

@Marcel Zehnder ive not seen one on my travel buddy, but this does not mean there isnt one. I am wondering if you can extract a list of the system variables referenced in the OpenAPI specs by parsing through the JSON file?

 

DNAC SDK has a TemplateSystemVariable class that represents these variables. You can query for the list of supported system variables like this (BTW untested on the sandbox as he SDK does not support the current AO versions)
 
Just thinking outloud here and pasting in stuff i have come over in other platforms/asks...
 

 

from dnacentersdk import DNACenterAPI

dnac = DNACenterAPI(
    username="devnetuser",
    password="Cisco123!",
    base_url="https://sandboxdnac2.cisco.com:443",
    version="2.3.5.3",
    verify=True)


dnac.authentication.login()

template_api = dnac.system.api.template_programmability


variables = template_api.systems.template_system_variable.get_template_system_variable()

for var in variables['response']:
    print(var['name'])

 

Please mark this as helpful or solution accepted to help others
Connect with me https://bigevilbeard.github.io

Hey @Marcel Zehnder,

Did you find a way or a document? I didn't find a correct way to specify the interface "index".

#if ( __interface[GigabitEthernet0/0].description == "Blabla")
Execute Stuff
#else
Execute else stuff
#end

Hi @leonardo_neves nope, I went with try/error...

Marcel Zehnder
Spotlight
Spotlight

Thanks Stu, I will dig into it.

I think i made a boo boo, as the DNAC open.api.json i cannot find...

Please mark this as helpful or solution accepted to help others
Connect with me https://bigevilbeard.github.io