Jan Kundrát <[email protected]> writes:

Hi, I'm augmenting the ietf-network and ietf-network-topology from RFC 8345, trying to add geolocation information to the network nodes. I found your draft (thanks for it!), draft-ietf-netmod-geo-location-01. What I am struggling with is adding the geolocation as an *optional* element. When I try this YANG construct: augment "/nw:networks/nw:network/nw:node" { when "../nw:network-types/my-topo:topology-type"; description "Optical elements within a network"; uses geo:geo-location; } ....then my YANG instance data validator, libyang, complains when the location is missing:

The "location" choice is defined as mandatory, so an instance of one of the cases must be present. I don't know whether it is necessary or not, but you can avoid it easily by overriding the definition:

     uses geo:geo-location {
         refine geo-location/location {
             mandatory false;
         }
     }

Ahoj, Lada


err : Mandatory choice "location" missing a case branch. (/ietf-network:networks/network[network-id='...']/node[node-id='...']/my-topo:location/geo-location) I can do the augmentation with one more container (a presence one) like this: augment "/nw:networks/nw:network/nw:node" { when "../nw:network-types/my-topo:topology-type"; description "Optical elements within a network"; container location { presence true; uses geo:geo-location; } } The resulting data then contain an extra level of nesting. I think that this is suboptimal. I have two questions: - Is that perhaps a bug in libyang? - If libyang is correct, is there a way of making the location info optional without that one more level of nesting? Also, the example does not work as-is because it's importing the module using a wrong name. Here's a tiny patch: index 7bd8622c..088621a1 100644 --- a/experimental/ietf-extracted-YANG-modules/[email protected] +++ b/experimental/ietf-extracted-YANG-modules/[email protected] @@ -2,7 +2,7 @@ module ietf-uses-geo-location { namespace "urn:ietf:params:xml:ns:yang:ietf-uses-geo-location"; prefix ugeo; - import geo-location { prefix geo; } + import ietf-geo-location { prefix geo; } organization "Empty Org"; contact "Example Author <[email protected]>"; description "Example use of geo-location"; The -00 version was correct in this, BTW. With kind regards, Jan _______________________________________________ netmod mailing list [email protected] https://www.ietf.org/mailman/listinfo/netmod

--
Ladislav Lhotka Head, CZ.NIC Labs PGP Key ID: 0xB8F92B08A9F76C67

_______________________________________________
netmod mailing list
[email protected]
https://www.ietf.org/mailman/listinfo/netmod

Reply via email to