cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
322
Views
0
Helpful
5
Replies

Pulling variables from network devices in to CLI templates.

AaronStreet
Level 1
Level 1

Hi, 

I have a need to move the Default route from the global root table to a VRF, so what i want to do is pull the existing route from the running configuration in to a variable so i can then apply it under the interface. 

The inbuilt variables do not contain anything about ip routes and sometime its useful to be able pull something specific back and then make changes. 

I want to so something like below (i know this is not a real command) does any one have a solution, dont mind is its Velocity or Jinja? 

 {% set default_gateway = exec("show ip route | include ^S.*0.0.0.0/0") %}

Thank you. 

5 Replies 5

Torbjørn
Spotlight
Spotlight

I think EEM will be the way to solve this.

Can you give an example of the specific changes you wish to perform through template to a device?

Happy to help! Please mark as helpful/solution if applicable.
Get in touch: https://torbjorn.dev

We have a few cases as we are looking to use DNA to standised our configuration as well as deply from scratch. 

I dont really want to use EEM as this really works best for event driven changes. But what we are looking at here are one of changes. 

Such as at the moment we want to change one vlan SVI to be forwarded over a vrf which means we need to 

1. create the VRF

2. Rpply the vrf under the vlan interface (which removes the IP address info) 

3. Reapply the IP address info (using the variables built in to DNA)

4. remove the global default route for that subnet 

5. reapply it to be under the VRF

6. add a new default global default route. 

It would be possible to do it with EEM which we use for other things, but then it starts removing the purpose of intent based networking from DNA if we are just using it to write EEM scripts and macros.  

Preston Chilcote
Cisco Employee
Cisco Employee

If there enough devices to justify the coding time, you could use the command runner API to get the ip info you need.  Then you can either keep using APIs to kick off the provision or put these IPs into a CSV template to import into the normal GUI provision workflow.

 

If it's not a lot of devices you can still manually populate a CSV file with the variables.  (You can download the template by kicking off the provision workflow and proceeding to the advanced configuration steps.  You will see links there to download and upload a CSV template.

 

 

In my view the idea is that DNA should allow a team to design / and set up DNA and simplified hand over to operation. It is not a sutible situation if an operation guy (who could be one of 30 people) needs to know to run API scripts or manualy update CSV files acroos mutiply screens. 

We use a lot of API script to keep our various platfoms in sync and pull out information. But once you start asking people to run commans on one screen, populate a csv, upload it on a different screen you soon lost the efficence and simplicity that intent based networking can bring. 

I think we would just use static varibles. 

This is something i will be discussing with our account team, as i cant image i am the first to ask about it and in truth the ability to run somthing like this  {% set default_gateway = exec("show ip route | include ^S.*0.0.0.0/0") %} would be a really useful feature and open up the flexibility of the CLi templates. 

Preston Chilcote
Cisco Employee
Cisco Employee

The best way for your feedback to be heard by the right people is to submit a "Make a Wish" from the Cat Center help menu (upper right corner of the GUI)