ygot
ygot copied to clipboard
ygot doesn't support a union with multiple enums
When generating a proto message, if more than one enum is defined within a union then ygot will pick whatever the first enum that is declared in the schema, instead of listing them all within oneof message.
Consider example:
container bar {
leaf my-mode {
type union {
type string;
type enumeration {
enum short;
enum long;
enum wide;
}
type enumeration {
enum red;
enum green;
enum blue;
}
}
}
}
When this is given to ygot the oneof message will contain one string and one enum (the first one).
In the real openconfig schema the following leafs have a union type with multiple enums:
-
/openconfig-network-instance/network-instances/network-instance/protocols/protocol/isis/interfaces/interface/levels/level/afi-safi/af/segment-routing/adjacency-sids/adjacency-sid/state/sid-id
-
/openconfig-network-instance/network-instances/network-instance/protocols/protocol/isis/interfaces/interface/levels/level/afi-safi/af/segment-routing/adjacency-sids/adjacency-sid/config/sid-id
Interestingly, if union contains multiple identifyrefs then each one will have an entry in the oneof message.
Confirmed that this an issue with the given OC paths. sid-id
's DYNAMIC enum value is ungenerated.
Fixing https://github.com/openconfig/goyang/issues/131 is a prerequisite.