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:

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

Reply via email to