04-07-2020 01:54 PM - edited 04-08-2020 08:26 AM
Hi, I am interested in using the yang 1.1. feature for multiple leafrefs in a union. I am using NSO 5.3.1.1 and it compiles fine but in the CLI, it just prompts with <string> instead of the list entries. I am using leafrefs into two YANG choices for device name.
Thanks in Advance.
Jim
module loadbalancers {
yang-version 1.1;
namespace "http://com/something/slfloadbalancers";
prefix loadbalancers;
import ietf-inet-types {
prefix inet;
}
import tailf-common {
prefix tailf;
}
import tailf-ncs {
prefix ncs;
}
import tailf-ned-f5-bigip {
prefix bigip;
}
import f5-bigip-gen-3.9 {
prefix f5-bigip-gen-3.9;
}
typedef joint-device-paths {
type union {
type leafref {
path "/ncs:devices/ncs:device[ncs:name=current()/../devices/by-devgroup/device/name]/ncs:config/bigip:ltm/bigip:profile/bigip:http/bigip:name";
}
type leafref {
path "/ncs:devices/ncs:device[ncs:name=current()/../devices/device/name]/ncs:config/bigip:ltm/bigip:profile/bigip:http/bigip:name";
}
}
}
augment "/ncs:services" {
description "TBD";
container loadbalancers {
description "TBD";
list loadbalancer {
key "name";
description
"Load Balancer Service";
leaf some-f5-netconf-list {
when
"derived-from-or-self(/ncs:devices/ncs:device[ncs:name=current()/../devices/by-devgroup/device/name]/ncs:device-type/ncs:netconf/ncs:ned-id, 'f5-bigip-gen-3.9:f5-bigip-gen-3.9')";
type leafref {
path "/ncs:devices/ncs:device[ncs:name=current()/../devices/by-devgroup/device/name]/ncs:config/bigip:ltm/bigip:profile/bigip:http/bigip:name";
}
}
leaf some-f5-generic-list {
when
"derived-from-or-self(/ncs:devices/ncs:device[ncs:name=current()/../devices/by-devgroup/device/name]/ncs:device-type/ncs:generic/ncs:ned-id, 'f5-bigip-gen-3.9:f5-bigip-gen-3.9')";
type leafref {
path "/ncs:devices/ncs:device[ncs:name=current()/../devices/by-devgroup/device/name]/ncs:config/bigip:ltm/bigip:profile/bigip:http/bigip:name";
}
}
//Only prompts with <string>
leaf joint-f5-crypto-cert-list {
type joint-device-paths;
}
//Works great
leaf f5-crypto-cert-list {
type leafref {
path "/ncs:devices/ncs:device[ncs:name=current()/../devices/by-devgroup/device/name]/ncs:config/bigip:sys/bigip:crypto/bigip:cert/bigip:name";
}
}
//Works great
leaf f5-crypto-key-list {
type leafref {
path "/ncs:devices/ncs:device[ncs:name=current()/../devices/by-devgroup/device/name]/ncs:config/bigip:sys/bigip:crypto/bigip:key/bigip:name";
}
}
container devices {
description "TBD";
choice by-dev-or-devgroup {
description "TBD";
case by-devgroup {
description "TBD";
container by-devgroup {
description "TBD";
leaf device-group {
type leafref {
path "/ncs:devices/ncs:device-group/ncs:name";
}
description "TBD";
tailf:info "The device-group name of the network devices doing the load balance";
}
list device {
key "name";
min-elements 1;
max-elements "2";
ordered-by user;
description "TBD";
leaf name {
type leafref {
path "/ncs:devices/ncs:device/ncs:name";
}
tailf:info "The name of the network devices doing the load balance";
tailf:non-strict-leafref {
path "/ncs:devices/ncs:device-group[ncs:name = current()/../../loadbalancers:device-group]/ncs:member";
}
}
}
}
}
case by-dev {
description "TBD";
list device {
key "name";
min-elements 1;
max-elements "2";
ordered-by user;
description "TBD";
leaf name {
type leafref {
path "/ncs:devices/ncs:device/ncs:name";
}
description "TBD";
tailf:info "The name of the network devices doing the load balance";
}
}
}
}
tailf:info "Configure Devices";
}