openBackhaul / ethernetContainer

Technology specific interface definition for an Ethernet Container
Apache License 2.0
1 stars 0 forks source link

pyang warning for must statement #32

Closed alexandrustancu closed 2 years ago

alexandrustancu commented 4 years ago

The pyang tool reports warning with regards to the must statements defined in the model (the issue is the same for all other models):

└─ $ ▶ pyang --lint ethernet-container-2-0.yang 
ethernet-container-2-0.yang:68 (at ethernet-container-2-0.yang:655): warning: node "ethernet-container-2-0::ethernet-container-capability" is config false and is not part of the accessible tree

RFC 7950 defines the accessible tree like this:

The accessible tree depends on where the statement with the XPath
   expression is defined:

   o  If the XPath expression is defined in a substatement to a data
      node that represents configuration, the accessible tree is the
      data in the datastore where the context node exists.  The root
      node has all top-level configuration data nodes in all modules as
      children.

   o  If the XPath expression is defined in a substatement to a data
      node that represents state data, the accessible tree is all state
      data in the server, and the running configuration datastore.  The
      root node has all top-level data nodes in all modules as children.

Also, the current "must" statement does not enforce pointing to the capabilities of the same LTP instance.

alexandrustancu commented 4 years ago

Possible solution:

leaf header-compression-kind {
      type leafref {
        path "/core-model:control-construct/core-model:logical-termination-point[core-model:uuid = current()/../../../../core-model:uuid]/core-model:layer-protocol[core-model:local-id = current()/../../../core-model:local-id]/ethernet-container:ethernet-container-pac/ethernet-container:ethernet-container-capability/ethernet-container:supported-header-compression-kind-list/ethernet-container:header-compression-name";
        require-instance false;
      }
      must 'deref(.) = current()';
      description
        "Defines the kind of header compression to be used.";
    }
openBackhaul commented 4 years ago

Regarding the concern on the 'header-compression-kind' 'path' and 'must' changes , please find the below details.

Must : In a leaf ref , if the path string is not having uuid included, then we are constructing the 'must' parameter from the already available 'path' statement using the following formula ,
"must boolean( <<complete 'path' till the last occurrence before '/'>> [ <<suffix of the 'path' based on ':'>> =current()]) So if we are planning to apply this change(deref(.) = current()) globally for all the must statement then we can replace this logic as per the new requirement.

Path: Based on the xmi aggregation=shared , we are constructing the path string for the associated constrain's hierarchy(using a recursive logic). So to including the string "[core-model:uuid = current()/../../../../core-model:uuid]" for logical-termination-point and the string "[core-model:local-id = current()/../../../core-model:local-id]" to the layer-protocol we needs some logical change. This is to be applied for all the 'path' statements associated with a 'must' statement.

openBackhaul commented 2 years ago

Fixed with EthernetContainer_2.0.0-tsp.220405.1755.