cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1348
Views
0
Helpful
3
Replies

SD-WAN - Use API to attach a device template containing optional value

Pixelweb
Level 1
Level 1

Hi Community,
I have automated the process of attaching a Device Template to an SD-WAN Router (C1121X). When the template is attached I'll need to supply the different configuration values to configure the router - like systemID, WAN IP adrresess, hostname, etc.

One of the feature templates used in the device template contains some static route entries but these are all "Optional".

If I do this from the vManage GUI and manually type in the configs and skipping the optional values, all works fine.

 

If I try to do the same from the script I get 2 different errors.

If I leave out the entire line I get an error since the config does not include all the values from the template.

If I include the config line but with an empty value: "" I get an error as the value does not conform to the syntax check.

 

My question here... How do I attach a Device Template to a Device using the API and supply the necessary config when some is "Optional"?

I have tried to write the work "Optional" but that gives same error as leaving it out ""

I hope you can help

 

Regards

Jeppe 

1 Accepted Solution

Accepted Solutions

Pixelweb
Level 1
Level 1

I found the solution - and the magic keyword is "TEMPLATE_IGNORE" 

 

I accessed vManage using Google Chrome and turned on the inspector window.

It appears that the entire vManage GUI is actually doing all its stuff using the API behind the scenes.

 

I tried to attach the Device Template while monitoring the inspector, and captured the following:

2021-08-26_12-52-19.png

After adding this to the body of my API POST - no errors in vManage and the template was successfully added

 

If you have an Optional config in the template you’re trying to attach using the API:

  • The config line MUST be in the body of your POST - even though it is optional - otherwise vManage will fail attaching the template
  • And the value must be either the correct value, or “TEMPLATE_IGNORE” if you don’t want to configure the specific optional config

Hope this helps

Regards

Jeppe

View solution in original post

3 Replies 3

Pixelweb
Level 1
Level 1

If the value for the optional config is empty I get this error in vManage:

 
[25-Aug-2021 11:30:57 UTC] Configuring device with feature template: DT_C1121X-8PLTEP_GENERIC_V001
[25-Aug-2021 11:30:57 UTC] Failed to update configuration - Error on line 232: invalid value for: prefix in /templates/template/vpn/vpn-instance/ip/route/prefix

 

If I leave out the Optional config I get this error:

[25-Aug-2021 11:41:06 UTC] Configuring device with feature template: DT_C1121X-8PLTEP_GENERIC_V001
[25-Aug-2021 11:41:06 UTC] Failed to update configuration - Failed to create device configuration

 

If I supply the correct (expected) values all works fine however it is like the "Optional" feature is not supported when this is done using an automated process.

 

/Jeppe

Pixelweb
Level 1
Level 1

I found the solution - and the magic keyword is "TEMPLATE_IGNORE" 

 

I accessed vManage using Google Chrome and turned on the inspector window.

It appears that the entire vManage GUI is actually doing all its stuff using the API behind the scenes.

 

I tried to attach the Device Template while monitoring the inspector, and captured the following:

2021-08-26_12-52-19.png

After adding this to the body of my API POST - no errors in vManage and the template was successfully added

 

If you have an Optional config in the template you’re trying to attach using the API:

  • The config line MUST be in the body of your POST - even though it is optional - otherwise vManage will fail attaching the template
  • And the value must be either the correct value, or “TEMPLATE_IGNORE” if you don’t want to configure the specific optional config

Hope this helps

Regards

Jeppe

Great findings - thanks Jeppe

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: