08-18-2019 12:47 PM - edited 08-18-2019 12:59 PM
I want to use leaf ref to make it possible to make dropdown list of devices in a specific group and choose one to configur ?
Solved! Go to Solution.
08-18-2019 07:04 PM - edited 08-18-2019 07:05 PM
Hi Ahmed,
One solution can be where you hard-code your group-name as a leaf in your yang and then another leaf for your devices referring to the "group-name" leaf in the yang. This can be a user input(more dynamic) or defaulted (static)
Here's a pattern for reference
leaf group-name {
type string {
pattern "MY GROUP";
}
default "MY GROUP";
tailf:info "desired group name";
description "desired group name";
}
leaf device-name {
type leafref {
path "/ncs:devices/ncs:device-group[ncs:name=current()/../group-name]/ncs:device-name";
}
tailf:info "MY GROUP devices";
description "MY GROUP devices";
}
Hope this helps!
08-18-2019 07:04 PM - edited 08-18-2019 07:05 PM
Hi Ahmed,
One solution can be where you hard-code your group-name as a leaf in your yang and then another leaf for your devices referring to the "group-name" leaf in the yang. This can be a user input(more dynamic) or defaulted (static)
Here's a pattern for reference
leaf group-name {
type string {
pattern "MY GROUP";
}
default "MY GROUP";
tailf:info "desired group name";
description "desired group name";
}
leaf device-name {
type leafref {
path "/ncs:devices/ncs:device-group[ncs:name=current()/../group-name]/ncs:device-name";
}
tailf:info "MY GROUP devices";
description "MY GROUP devices";
}
Hope this helps!
08-18-2019 09:16 PM
08-19-2019 02:16 AM
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