cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Announcements
Popup Hotspot Using ISR 1000 with WiFi/LTE for Teleworkers and Micro Branchesr
118
Views
0
Helpful
1
Replies
Highlighted
Beginner

Yang 1.1, Union with multiple leafrefs only lists <string>

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";
}

 

 

1 REPLY 1
Highlighted
Beginner

Re: Yang 1.1, Union with multiple leafrefs only lists <string>

I’ve provided you (below) a way to use the built-in examples.ncs/service-provider/mpls-vpn example to reproduce this limitation.

If I add a simple leafref to the example (called joint-leafrefs) with only one leafref, you get a pulldown in the webui and a picklist in the CLI.

(l3vpn.yang)
module l3vpn {
yang-version 1.1; 
namespace "http://com/example/l3vpn";
prefix l3vpn;

typedef joint-leafref-paths {
//type union {
// type leafref
//

{ path "/topology/role/role"; }
type leafref
{ path "/topology/connection/name"; }
//}
}
container topology {

leaf joint-leafrefs { type joint-leafref-paths; }


list role {
admin@ncs(config)# topology joint-leafrefs ?
Possible completions:
c0 c1 c2 c3 c4 c5 c6 core-link-1 core-link-2 core-link-3 core-link-4 pe-link-1 pe-link-2 pe-link-3 pe-link-4

If I make the type a Yang 1.1 typedef with a union of 2 leafrefs, all I get is a string entry dialog that is not ever validated to contain an entry valid in either configured list.

typedef joint-leafref-paths {
type union {
type leafref
{ path "/topology/role/role"; }

type leafref

{ path "/topology/connection/name"; }

}
}

[mk39@sv69536 mpls-vpn]$ ncs_cli -u admin -C

admin connected from x.x.x.x using ssh on localhost
admin@ncs# config
Entering configuration mode terminal
admin@ncs(config)# topology joint-leafrefs ?
Possible completions:
<string>
admin@ncs(config)# topology joint-leafrefs wrong
admin@ncs(config)# commit
Commit complete.
As you can see in the above image, the picklist pulldown widget has been lost and the completely invalid value “wrong” was committed successfully.
My example below was more complex as I had a specific customer requirement to achieve related to the two leafrefs being directed to different lists separated by the same case statement.
Does this give you enough to go on given you can quickly reproduce my test case with the examples.ncs project mpls-vpn with my minor edits above.
Thanks,

CreatePlease to create content
Content for Community-Ad