Vladimir Vassilev <[email protected]> wrote:
> On 08/23/2016 10:15 AM, Martin Bjorklund wrote:
> > They are evaluated.  See Section 7.5.3:
> >
> >     When a datastore is validated, all "must" constraints are
> >     conceptually evaluated once for each node in the accessible tree (see
> >     Section 6.4.1).
> >
> >
> > /martin
> Then we have the case I objected to and the example:
> 
> YANG 1.0:
> 
> augment "/if:interfaces/if:interface" {
>     container inet {
>         must "../name = 'me0'" {

This should have been a 'when' expression, not 'must'.  Alternatively,
it should have been a P-container, since obviously the container has
some semantics.  Or alternatively, the must expression should have
been on the address leaf, since this is what you really checked.



/martin


>             description
>                  "The inet container is only valid for the management ('me0')
>                  interface.";
>         }
>         leaf address {
>             type inet:ip-prefix;
>         }
>     }
> }
> 
> YANG 1.1 (replace "../name = 'me0'" with "../name='me0' or not
> (./address)" and process 95 unnecessary Xpath evaluations).
> 
> I think this proves the argument that there will be more unnecessary
> Xpath processing.  In addition it illustrates how a simple task
> requires ugly patch (the ".. or not (./address)" added to the must
> expression) just to ensure the expression does not fail in the default
> case where the interface is not named "me0" and the user has not even
> attempted to create empty /interfaces/interface/inet container in YANG
> 1.1.
> 
> Vladimir
> 

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

Reply via email to