01-09-2019 02:46 AM
Hi,
I am having some challenges when implementing config templates based on device version using config-template only.
My solution is aiming to use the platform version from the devices provided by the NED based on the version nr a config template is pushed.
The Version can be anything between saos-06-11-01-0000 and saos-06-17-01-0149. The logic I am aiming to implement is when the version is above saos-06-15-00-000 then push the new config style else push the old format.
Here is an example of the version output:
nsoadmin@ncs# show devices device 3916-* platform version
NAME VERSION
----------------------------
3916-A saos-06-17-01-0149
3916-B saos-06-14-00-0434
nsoadmin@ncs# show devices device 3916-* platform version | display xpath
/devices/device[name='3916-A']/platform/version saos-06-17-01-0149
/devices/device[name='3916-B']/platform/version saos-06-14-00-0434
nsoadmin@ncs#
First I tried to use the following logic:
I realized it was not working due to the datatype which is a string so comparison operators will not work.
Also converting the check to number did not result in a valid result.
<?if {number(/version) <= 'saos-06-15-00-0000'}?>
I end up using the following logic:
Solved! Go to Solution.
01-09-2019 04:50 AM
You may want to try string-compare(string,string)
returning -1, 0, or 1. It is NSO XPath extension usable in other contexts, maybe it works in templates too - see tailf_yang_extension
man page.
01-09-2019 04:50 AM
You may want to try string-compare(string,string)
returning -1, 0, or 1. It is NSO XPath extension usable in other contexts, maybe it works in templates too - see tailf_yang_extension
man page.
01-09-2019 05:32 AM
Thank you very much for pointing that out, after reading the man page I have to change the logic to the following:
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