Is it allowed to define a leaf-list something like this
leaf-list entry-match {
type union {
type int32;
type string;
type enum {
enum any;
enum first;
enum second;
}
type binary;
}
}
Is it allowed to define a leaf-list something like this
leaf-list entry-match {
type union {
type int32;
type string;
type enum {
enum any;
enum first;
enum second;
}
type binary;
}
}
Absolutely (you could just try it:-). But given how the YANG union type is defined (see eg RFC 6020), that exact definition of the union probably doesn’t do what you want. E.g. the enum
values, and any binary
value, will match the string
type, and the enumeration
and binary
union members are effectively redundant. The basic rule is that if type definitions overlap, you probably want the more specific types earlier in the member order. Moving type string
to make it come after type binary
would achieve that. Another alternative would be to keep the order, but add length
and/or pattern
restrictions that exclude the enum
and binary
values to the string
definition.