clicon / clixon

YANG-based toolchain including NETCONF and RESTCONF interfaces and an interactive CLI
http://www.clicon.org/
Other
206 stars 69 forks source link

Validation of YANG leafref within union does not work #498

Open olofhagsand opened 4 months ago

olofhagsand commented 4 months ago

Suppose one has the following yang:

container a {
   leaf ref {
     type reftype;
   }
  list b {
    key c;
    leaf c;
 }
}

And the following CLI commands:

cli> set a b x
cli> set a ref y
error: validation fail

This works, if reftype is:

 typedef reftype {
            type leafref {
                path "/a/b/c";
            }
  }

But the following does not work (validation does not fail)if reftype is a leafref within a union:

typedef reftype {
        type union {
                type string {
                    pattern 'default';
                }
                type leafref {
                    path "/a/b/c";
                }
            }
}