02-14-2018 04:18 AM - edited 03-01-2019 04:06 AM
I am trying to fulfill the following two requirements in NSO 4.5.3.
- Display only interfaces that have the description "UNUSED"
- Change the description to "{vpn-name}-{VLAN number}" when the interface is assigned to a VPN service
1) If I use a "must" = "UNUSED" constraint, the initial matching interfaces are constrained properly and only interfaces with the description "UNUSED" are displayed, however this constraint fails when I perform a commit because the service model changes the interface description to indicate that it is now assigned.
2) I also tried using tailf:display-when but it appears to have no effect in constraining the listed interfaces, all interfaces on the device are still listed in both the cli and webui-one.
The "must" and "tailf:display-when" that I tried are below. Any suggestions?
leaf switch-interface-id {
tailf:info "The switch interface identifier";
type leafref {
path "/ncs:devices/ncs:device[ncs:name=current()/../../switch-name]/ncs:config/ios:interface/ios:GigabitEthernet/ios:name";
}
// must "deref(current())/../ios:description = 'UNUSED'"
// tailf:display-when "deref(current())/../ios:description = 'UNUSED'"
}
Solved! Go to Solution.
02-14-2018 04:48 AM
As you have seen, neither of must or display-when do what you want here.
- with must, you are enforcing that the interface description forever remains "UNUSED"
- with display-when, you are making the switch-interface-id only show if switch-interface-id points to an interface that has description "UNUSED". How this leaf would be configured in the first place in this case is beyond me, since it's not showing. Luckily for you, the NSO webui never cares about the display-when hint and displays it anyway (or it would never show).
If you're looking for something to sort and filter the config data in the webui, plus add some side effects, I suggest you open your javascript editor. Or you could add an action to let a user allocate an interface, or an operational list in your service that displays the available interfaces or a reactive fastmap loop that allocates an available interface automatically.
02-14-2018 04:48 AM
As you have seen, neither of must or display-when do what you want here.
- with must, you are enforcing that the interface description forever remains "UNUSED"
- with display-when, you are making the switch-interface-id only show if switch-interface-id points to an interface that has description "UNUSED". How this leaf would be configured in the first place in this case is beyond me, since it's not showing. Luckily for you, the NSO webui never cares about the display-when hint and displays it anyway (or it would never show).
If you're looking for something to sort and filter the config data in the webui, plus add some side effects, I suggest you open your javascript editor. Or you could add an action to let a user allocate an interface, or an operational list in your service that displays the available interfaces or a reactive fastmap loop that allocates an available interface automatically.
02-14-2018 10:11 AM
Thanks. I was hoping that I was missing a simple filter. I will start looking into other options.
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