public icon indicating copy to clipboard operation
public copied to clipboard

when-statements from config to state (https://tools.ietf.org/html/rfc6020#section-7.19.5)

Open fnchooft opened this issue 8 years ago • 6 comments

Good Afternoon,

A question which came up recently is the fact that some config-containers are constrained by must-expression where the conditions points from a config-container to a non-config-container. As per:

https://tools.ietf.org/html/rfc6020#section-7.19.5:

   o  If the context node represents configuration, the tree is the data
      in the NETCONF datastore where the context node exists.  The XPath
      root node has all top-level configuration data nodes in all
      modules as children.

Thus this construct where config-containers only exist if a state container has a certain condition seems not to be allowed.

A quick grep in the repository shows the following models which are at least affected by this condition:

$ grep -rni 'when "' | grep state | cut -d':' -f1,1 | sort -u
models/interfaces/openconfig-if-ethernet.yang
models/isis/openconfig-isis-lsp.yang
models/ospf/openconfig-ospfv2-lsdb.yang
models/platform/openconfig-platform-linecard.yang
models/platform/openconfig-platform-port.yang
models/platform/openconfig-platform-transceiver.yang

In the FAQ i could not find any reference to this type of modelling.

Kind regards,

Fabian

fnchooft avatar Nov 08 '17 17:11 fnchooft

@robshakir : Hi Rob, appreciate all the work you guys are doing, would be great to get some feedback on this issue from the architects. I have modified some models to fit our needs where config-containers are not conditioned anymore on non-config-elements.

Thanks, Fabian

fnchooft avatar Dec 15 '17 11:12 fnchooft

I am facing the same issue. The third-party YANG datastore I am using complains because the "when" XPATH expression in openconfig-if-ethernet.yang refers to state data in a data node.

antoninbas avatar Jan 02 '18 17:01 antoninbas

We're running into this as well with model validation in the ntc-rosetta project. Is this still in active development?

dgjustice avatar Feb 26 '20 14:02 dgjustice

This is an unfortunate limitation of the YANG language -- there are use cases, for example, where some configuration is only applicable/valid when some other read-only property has a certain value. A canonical example is Ethernet configuration on an interface only being valid when the interface is of type IF_ETHERNET (or another valid type).

As validation tools like pyang have added more complete support for XPATH validation, there are more reports of this, but the original issue with the language is unchanged. You didn't provide any info about the validation you're doing so not sure what tools you're using. In particular, tying these constraints to assumptions about the layout of datastores in NETCONF is problematic.

The workaround at this time is to remove these validation conditions from the models. (we have to go back and check if this arises in cases other than validation). There is an argument that such validation should be done on the server (device) only, but when writing these models, we felt that a priori validation on the client side would be valuable. We can bring it up again in the working group to see if we want to revisit.

aashaikh avatar Feb 26 '20 15:02 aashaikh

Sounds good, thanks for the update!!!

dgjustice avatar Feb 26 '20 15:02 dgjustice

This issue is stale because it has been open 180 days with no activity. If you wish to keep this issue active, please remove the stale label or add a comment, otherwise will be closed in 14 days.

github-actions[bot] avatar Jun 28 '24 02:06 github-actions[bot]