08-25-2021 04:25 AM
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
Solved! Go to Solution.
08-26-2021 04:07 AM
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:
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:
Hope this helps
Regards
Jeppe
08-25-2021 04:44 AM
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
08-26-2021 04:07 AM
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:
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:
Hope this helps
Regards
Jeppe
02-08-2022 08:29 AM
Great findings - thanks Jeppe
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide