Re: [netmod] Interaction of 'when' and 'default' statements

2017-03-24 Thread t . petch

- Original Message -
From: "Phil Shafer" 
Sent: Thursday, March 23, 2017 8:24 PM

> William Ivory writes:
> >Yes, I'd noticed that.  Does this make the behaviour 'undefined' in
YANG 1.0?
>
> No, this was a clarification.  The text in 6020 was reasonably clear:
>
>The "when" statement makes its parent data definition statement
>conditional.  The node defined by the parent data definition
>statement is only valid when the condition specified by the "when"
>statement is satisfied.
>
> And no default should be provided for any invalid node.  If the node
> can't exist, the default can't either.

William

Having tracked the discussions that led to RFC7950, the sense I got was
that if you can avoid using 'when' then avoid using it.  If you cannot
avoid using 'when' avoid using it.  Not something that is ever likely to
appear in an I-D but the 'when' statement does have complex interactions
that may not be intuitive and although RFC7950 does spell them out, yet
they may not be apparent; which this thread also spells out to me:-)

I would not say this of any other YANG statement.

Tom Petch

> Thanks,
>  Phil
>
> ___
> netmod mailing list
> netmod@ietf.org
> https://www.ietf.org/mailman/listinfo/netmod

___
netmod mailing list
netmod@ietf.org
https://www.ietf.org/mailman/listinfo/netmod


Re: [netmod] Interaction of 'when' and 'default' statements

2017-03-23 Thread Phil Shafer
William Ivory writes:
>Yes, I'd noticed that.  Does this make the behaviour 'undefined' in YANG 1.0?

No, this was a clarification.  The text in 6020 was reasonably clear:

   The "when" statement makes its parent data definition statement
   conditional.  The node defined by the parent data definition
   statement is only valid when the condition specified by the "when"
   statement is satisfied.

And no default should be provided for any invalid node.  If the node
can't exist, the default can't either.

Thanks,
 Phil

___
netmod mailing list
netmod@ietf.org
https://www.ietf.org/mailman/listinfo/netmod


Re: [netmod] Interaction of 'when' and 'default' statements

2017-03-23 Thread Dale R. Worley
Martin Bjorklund  writes:
> William Ivory  wrote:
>> Thanks.  Can you point me at the part of RFC 6020 that explicitly
>> states that 'when' wins over 'default'?
>
> Section 7.6.1 of RFC 7950 says:
>
>Note that if the leaf or any of its ancestors has a "when" condition
>or "if-feature" expression that evaluates to "false", then the
>default value is not in use.

Or perhaps more to the point, beware that RFC 6020 does *not* have that
paragraph.

Dale

___
netmod mailing list
netmod@ietf.org
https://www.ietf.org/mailman/listinfo/netmod


Re: [netmod] Interaction of 'when' and 'default' statements

2017-03-22 Thread Martin Bjorklund
William Ivory <wiv...@brocade.com> wrote:
> Hi Martin,
> 
> Thanks.  Can you point me at the part of RFC 6020 that explicitly
> states that 'when' wins over 'default'?

Section 7.6.1 of RFC 7950 says:

   Note that if the leaf or any of its ancestors has a "when" condition
   or "if-feature" expression that evaluates to "false", then the
   default value is not in use.


/martin


> 
> William
> 
> -Original Message-
> From: Martin Bjorklund [mailto:m...@tail-f.com] 
> Sent: 22 March 2017 17:53
> To: William Ivory <wiv...@brocade.com>
> Cc: netmod@ietf.org; Nick Brown <bro...@brocade.com>
> Subject: Re: [netmod] Interaction of 'when' and 'default' statements
> 
> William Ivory <wiv...@brocade.com> wrote:
> > Hi,
> > 
> > I'm looking for clarification of the 'when' and 'default' statements 
> > on a leaf.  For example, if a leaf has a 'default', can it also have a 
> > 'when' statement that could cause it to disappear if the 'when'
> > condition evaluates to false?
> 
> Yes, and in that case the default doesn't apply.
> 
> > Section 8.3 or RFC 6020 isn't clear on how evaluation of constraints 
> > should be done here, and neither the section on the 'when' statement 
> > nor the 'default' section have any cross-references.
> 
> If the "when" expression evaluates to false, it's like if the whole node 
> doesn't exist.  A client can't set it etc.
> 
> 
> /martin
> 

___
netmod mailing list
netmod@ietf.org
https://www.ietf.org/mailman/listinfo/netmod


Re: [netmod] Interaction of 'when' and 'default' statements

2017-03-22 Thread Bogaert, Bart (Nokia - BE/Antwerp)
William,

The when clause determines whether the node will be instantiated or not.
Only when it is instantiated (when condition evaluates to true), the default
property comes into the picture.  At least, that is how I interpret it.

Best regards - Vriendelijke groeten,
Bart Bogaert

-Original Message-
From: netmod [mailto:netmod-boun...@ietf.org] On Behalf Of William Ivory
Sent: 22 March 2017 18:56
To: Martin Bjorklund <m...@tail-f.com>
Cc: Nick Brown <bro...@brocade.com>; netmod@ietf.org
Subject: Re: [netmod] Interaction of 'when' and 'default' statements

Hi Martin,

Thanks.  Can you point me at the part of RFC 6020 that explicitly states
that 'when' wins over 'default'?

William

-Original Message-
From: Martin Bjorklund [mailto:m...@tail-f.com]
Sent: 22 March 2017 17:53
To: William Ivory <wiv...@brocade.com>
Cc: netmod@ietf.org; Nick Brown <bro...@brocade.com>
Subject: Re: [netmod] Interaction of 'when' and 'default' statements

William Ivory <wiv...@brocade.com> wrote:
> Hi,
> 
> I'm looking for clarification of the 'when' and 'default' statements 
> on a leaf.  For example, if a leaf has a 'default', can it also have a 
> 'when' statement that could cause it to disappear if the 'when'
> condition evaluates to false?

Yes, and in that case the default doesn't apply.

> Section 8.3 or RFC 6020 isn't clear on how evaluation of constraints 
> should be done here, and neither the section on the 'when' statement 
> nor the 'default' section have any cross-references.

If the "when" expression evaluates to false, it's like if the whole node
doesn't exist.  A client can't set it etc.


/martin

___
netmod mailing list
netmod@ietf.org
https://www.ietf.org/mailman/listinfo/netmod


smime.p7s
Description: S/MIME cryptographic signature
___
netmod mailing list
netmod@ietf.org
https://www.ietf.org/mailman/listinfo/netmod


Re: [netmod] Interaction of 'when' and 'default' statements

2017-03-22 Thread William Ivory
Hi Martin,

Thanks.  Can you point me at the part of RFC 6020 that explicitly states that 
'when' wins over 'default'?

William

-Original Message-
From: Martin Bjorklund [mailto:m...@tail-f.com] 
Sent: 22 March 2017 17:53
To: William Ivory <wiv...@brocade.com>
Cc: netmod@ietf.org; Nick Brown <bro...@brocade.com>
Subject: Re: [netmod] Interaction of 'when' and 'default' statements

William Ivory <wiv...@brocade.com> wrote:
> Hi,
> 
> I'm looking for clarification of the 'when' and 'default' statements 
> on a leaf.  For example, if a leaf has a 'default', can it also have a 
> 'when' statement that could cause it to disappear if the 'when'
> condition evaluates to false?

Yes, and in that case the default doesn't apply.

> Section 8.3 or RFC 6020 isn't clear on how evaluation of constraints 
> should be done here, and neither the section on the 'when' statement 
> nor the 'default' section have any cross-references.

If the "when" expression evaluates to false, it's like if the whole node 
doesn't exist.  A client can't set it etc.


/martin

___
netmod mailing list
netmod@ietf.org
https://www.ietf.org/mailman/listinfo/netmod


Re: [netmod] Interaction of 'when' and 'default' statements

2017-03-22 Thread Martin Bjorklund
William Ivory  wrote:
> Hi,
> 
> I'm looking for clarification of the 'when' and 'default' statements
> on a leaf.  For example, if a leaf has a 'default', can it also have a
> 'when' statement that could cause it to disappear if the 'when'
> condition evaluates to false?

Yes, and in that case the default doesn't apply.

> Section 8.3 or RFC 6020 isn't clear on
> how evaluation of constraints should be done here, and neither the
> section on the 'when' statement nor the 'default' section have any
> cross-references.

If the "when" expression evaluates to false, it's like if the whole
node doesn't exist.  A client can't set it etc.


/martin

___
netmod mailing list
netmod@ietf.org
https://www.ietf.org/mailman/listinfo/netmod


[netmod] Interaction of 'when' and 'default' statements

2017-03-22 Thread William Ivory
Hi,

I'm looking for clarification of the 'when' and 'default' statements on a leaf. 
 For example, if a leaf has a 'default', can it also have a 'when' statement 
that could cause it to disappear if the 'when' condition evaluates to false?  
Section 8.3 or RFC 6020 isn't clear on how evaluation of constraints should be 
done here, and neither the section on the 'when' statement nor the 'default' 
section have any cross-references.

Thanks,

William

___
netmod mailing list
netmod@ietf.org
https://www.ietf.org/mailman/listinfo/netmod