Hi,
'when' does not affect schema nodes, only data nodes.
The schema nodes is essentially the YANG itself, without reference to any
particular instance data.
Given an example YANG fragment:
list widgets {
key name;
leaf name {type string;}
leaf can-frob {type boolean;}
container frob-data {
when "../frob-data = 'true'";
leaf frob-count {type uint32; mandatory true;}
}
}
The schema could be written like this: (not in any real language)
widgets [list] [keys: name]
- name [name]
- can-frob [boolean]
- frob-data [container] [when ../frob-data = 'true']
- frob-count [uint32]
The when statement does not make schema nodes "valid" or "invalid". It only
indicates the conditions under which the nodes will be present in the data tree.
A data tree for this schema might look like this: (in the same
not-real-language)
widgets
- name: Widget1
- can-frob: false
widgets
- name: Widget2
- can-frob: true
- frob-data:
- frob-count: 5
Widget1 doesn't have any frob-data because its can-frob is false, while Widget2
does because its can-frob is true.
However that doesn't mean Widget1 and Widget2 have different schemas. They are
both instances of the same schema written above.
________________________________________
From: netmod <[email protected]> on behalf of Ladislav Lhotka
<[email protected]>
Sent: Tuesday, 5 December 2017 7:09 a.m.
To: Juergen Schoenwaelder
Cc: NETMOD WG
Subject: Re: [netmod] evaluation of "when" under NMDA
On Mon, 2017-12-04 at 18:22 +0100, Juergen Schoenwaelder wrote:
> On Mon, Dec 04, 2017 at 06:05:58PM +0100, 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>.
> >
>
> For me, its still the same schema - a when expression does not change
> my notion of 'schema'.
Well, according to draft-ietf-netmod-revised-datastores-07:
o datastore schema: The combined set of schema nodes for all modules
supported by a particular datastore, taking into consideration any
deviations and enabled features for that datastore.
And "when" determines whether a given schema node is valid or not. So if a
schema node is invalid in the schema of <operational> but valid in the schema of
<intended>, then the former can hardly be a superset of the latter.
Lada
>
> /js
>
--
Ladislav Lhotka
Head, CZ.NIC Labs
PGP Key ID: 0xB8F92B08A9F76C67
_______________________________________________
netmod mailing list
[email protected]
https://www.ietf.org/mailman/listinfo/netmod
_______________________________________________
netmod mailing list
[email protected]
https://www.ietf.org/mailman/listinfo/netmod