08-01-2024 02:27 AM
Hello,
I'm writing a very basic service in order to configure an interface vlan on a list of switch. Le vlan number is the same for all switches, and each switch has its own IP address for this vlan interface.
When I create the service one switch, it works fine. But when I create the service with 2 switches, I have a behavior I don't understand. The evaluation of ip-add is correct for each switch, but it concatenates both ip-add to push on the device !
admin@ncs(config)# services int-vlan-cfs TEST-CFS-57 vlan-id 57 switch nx1 ip-add 10.10.10.1/24
admin@ncs(config)# services int-vlan-cfs TEST-CFS-57 vlan-id 57 switch nx2 ip-add 10.10.10.2/24
admin@ncs(config-switch-nx2)# commit dry-run | debug template
Evaluating "/switch/ip-add" (from file "int-vlan-cfs-template.xml", line 11)
.../...
Context node: /services/int-vlan-cfs:int-vlan-cfs[cfs-name='TEST-CFS-57']
Result:
For /services/int-vlan-cfs:int-vlan-cfs[cfs-name='TEST-CFS-57']/switch[name='nx1'], it evaluates to "10.10.10.1/24"
For /services/int-vlan-cfs:int-vlan-cfs[cfs-name='TEST-CFS-57']/switch[name='nx2'], it evaluates to "10.10.10.2/24"
Aborted: int-vlan-cfs-template.xml:11 Expression '{/switch/ip-add}' resulted in an incompatible value '10.10.10.1/2410.10.10.2/24' for /ncs:devices/device{nx1}/config/nx:interface/Vlan{57}/ip/address
I joined the xml, yang and full commit result files.
Regards.
Solved! Go to Solution.
08-09-2024 06:32 AM
My bad !!!
I mixed up with several proposed solution !
@Marcel Zehndersolution with @radioman modification makes it work !!
The thing is that I'm not sure to understand why... I will have a look at the doc
Thanks for your help !
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