On Mon, 2017-12-04 at 17:29 +0000, Robert Wilton wrote:
> Hi Lada,
> 
> 
> On 04/12/2017 17:05, Ladislav Lhotka wrote:
> > On Mon, 2017-12-04 at 17:34 +0100, Martin Bjorklund wrote:
> > > Ladislav Lhotka <[email protected]> wrote:
> > > > Hi,
> > > > 
> > > > if we have
> > > > 
> > > > augment "/target/node" {
> > > >    when "...";
> > > >    ...
> > > > }
> > > > 
> > > > is the "when" expression supposed to be evaluated separately in each
> > > 
> > > datastore,
> > > > and the augment applied only in those datastores where the result is
> > > > true?
> > > 
> > > Yes.
> > 
> > But then it cannot be guaranteed that the schema for <operational> is a
> > superset
> > of the schema of configuration datastores - the when expression can evaluate
> > to
> > false in <operational> but true in <intended>.
> 
> I think that comes down to terminology, RFC 7950 section 7.21.5 on when 
> statements just talks about making data definition statements 
> conditional.  I don't really think that when statements (or choice 
> statements) change the schema associated with a datastore, they just 
> make parts of it inactive based on the current data.  I.e. you wouldn't 
> expect different information to be returned via YANG library depending 
> on how particular when statements in the implemented modules get evaluated.
> 
> Is seems to me that the when processing falls out quite naturally. Is 
> there a scenario where you think that this could cause a problem?

IMO it comes down to the distinction between syntactic (schema) and semantic
constraints. An important syntactic constraint for a container are the children
that a container instance (i) must, and (ii) may contain. Whenever "when" comes
into play, this cannot be determined upfront, we first have to see a particular
(complete) data tree and evaluate an XPath expression on it.

It may seem that this is an academic issue and that the borderline between
syntactic and semantic constraints is arbitrary, but it isn't: it is determined
by the need for having a robust and efficient algorithm for syntactic analysis.
Such an algorithm exists for regular and context-free grammars, as well as for
XSD and RELAX NG, but not for YANG.

As for problems caused by "when", it is by far the trickiest part in YANG and
most complicated implementation-wise. 

Lada 

> 
> Thanks,
> Rob
> 
> > 
> > Lada
> > 
> > > > RFC 7950 says in sec. 7.21.5 that the context node for XPath evaluation
> > > > is
> > > 
> > > "the
> > > > augment's target node in the data tree", but with NMDA we have multiple
> > > > data
> > > > trees, hence multiple target nodes.
> > > 
> > > We had multiple datastores even before NMDA.  The when expression
> > > could be true in candidate but false in running.
> > > 
> > > /martin
> 
> 
-- 
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