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


[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


Re: [netmod] Query about invalid XPATH paths in YANG

2017-01-23 Thread William Ivory
Hi Martin,

Thanks for the confirmation.

Regards,

William

-Original Message-
From: Martin Bjorklund [mailto:m...@tail-f.com] 
Sent: 23 January 2017 18:17
To: William Ivory <wiv...@brocade.com>
Cc: netmod@ietf.org
Subject: Re: [netmod] Query about invalid XPATH paths in YANG

William Ivory <wiv...@brocade.com> wrote:
> Hi,
> 
> I'd appreciate clarification on whether a YANG path in an XPATH 
> statement in a must or when statement must point to a valid YANG path 
> or not.  You might wonder why we'd have an invalid path (as opposed to 
> one that's simply not configured right now) but it is occasionally 
> helpful when sharing groupings.  (Possibly we should remodel the YANG 
> but that's another matter!).
> 
> As a simple example, is the following allowed?
> 
> Container foo {
> Leaf bar {
> Type string;
> Must "not(../nonExistentSiblingNode)";
> }
> }

Yes this is allowed.  Many YANG compilers give warnings for this kind of 
expression, but it is legal.

> I don't see that this should be any different to a must statement path 
> pointing to an unconfigured node, returning an empty nodeset in both 
> cases.
> 
> The reason I ask is that we are seeing a NETCONF client 
> differentiating between unconfigured (ok) and non-existent (error) 
> cases.  It would be useful to know one way or the other, ideally with 
> a pointer to the relevant part of the spec that makes this clear.

It follows from how XPath works, and the fact that there is no text in RFC 7950 
(or 6020) that limits XPath to something non-standard.


/martin

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


[netmod] Query about invalid XPATH paths in YANG

2017-01-23 Thread William Ivory
Hi,

I'd appreciate clarification on whether a YANG path in an XPATH statement in a 
must or when statement must point to a valid YANG path or not.  You might 
wonder why we'd have an invalid path (as opposed to one that's simply not 
configured right now) but it is occasionally helpful when sharing groupings.  
(Possibly we should remodel the YANG but that's another matter!).

As a simple example, is the following allowed?

Container foo {
Leaf bar {
Type string;
Must "not(../nonExistentSiblingNode)";
}
}

I don't see that this should be any different to a must statement path pointing 
to an unconfigured node, returning an empty nodeset in both cases.

The reason I ask is that we are seeing a NETCONF client differentiating between 
unconfigured (ok) and non-existent (error) cases.  It would be useful to know 
one way or the other, ideally with a pointer to the relevant part of the spec 
that makes this clear.

Thanks,

William

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


Re: [netmod] Does YANG allow forward references to groupings?

2016-10-27 Thread William Ivory
Thanks for confirming,

William

-Original Message-
From: Martin Bjorklund [mailto:m...@tail-f.com] 
Sent: 27 October 2016 12:09
To: William Ivory <wiv...@brocade.com>
Cc: netmod@ietf.org
Subject: Re: [netmod] Does YANG allow forward references to groupings?

William Ivory <wiv...@brocade.com> wrote:
> Hi,
> 
> I'd appreciate clarification on whether a YANG grouping defined and 
> used in the same file must have the grouping definition first, before 
> the 'uses' statement.
> 
> On the one hand, RFC 6020 section 7.11 states: 'Once a grouping is 
> defined, it can be referenced in a "uses" statement', suggesting a C /
> C++ -style which doesn't allow forward references.
> (https://urldefense.proofpoint.com/v2/url?u=https-3A__tools.ietf.org_h
> tml_rfc6020-23section-2D7.11=DQICAg=IL_XqQWOjubgfqINi2jTzg=GByLe
> g9jZvOv_AlgBo9uvdDrxizlOR7l_SnTXowyJU8=WaccLYiQTR3H0OaccbcvkoVdly-9B
> GDfTNinmMS_xB0=HWT6JMdt0mDXM1-aPiwzhZOp2qLAsYo2w4h9G2lnIP8= )
> 
> On the other hand, section 6.2 states 'Forward references are allowed 
> in YANG.' 
> (https://urldefense.proofpoint.com/v2/url?u=https-3A__tools.ietf.org_html_rfc6020-23section-2D6.2=DQICAg=IL_XqQWOjubgfqINi2jTzg=GByLeg9jZvOv_AlgBo9uvdDrxizlOR7l_SnTXowyJU8=WaccLYiQTR3H0OaccbcvkoVdly-9BGDfTNinmMS_xB0=AMlXnMqEUOMZ6Lb0HQ-Y97cHo7BR0n7xK7cewn51wq4=
>  ).
> 
> I am assuming that the second, more explicit, statement trumps the 
> first, but would appreciate confirmation.

Correct.  YANG allows forward references to groupings.


/martin

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


[netmod] Does YANG allow forward references to groupings?

2016-10-27 Thread William Ivory
Hi,

I'd appreciate clarification on whether a YANG grouping defined and used in the 
same file must have the grouping definition first, before the 'uses' statement.

On the one hand, RFC 6020 section 7.11 states: 'Once a grouping is defined, it 
can be referenced in a "uses" statement', suggesting a C / C++ -style which 
doesn't allow forward references.  
(https://tools.ietf.org/html/rfc6020#section-7.11)

On the other hand, section 6.2 states 'Forward references are allowed in YANG.' 
(https://tools.ietf.org/html/rfc6020#section-6.2).

I am assuming that the second, more explicit, statement trumps the first, but 
would appreciate confirmation.

Thanks,

William



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


Re: [netmod] Can you remove the "Identity acl-base" defined in draft-ietf-netmod-acl-model-07

2016-05-11 Thread William Ivory
Thanks - had forgotten those YANG 1.1 extensions.

William

-Original Message-
From: Juergen Schoenwaelder [mailto:j.schoenwael...@jacobs-university.de] 
Sent: 11 May 2016 09:28
To: William Ivory <wiv...@brocade.com>
Cc: Robert Wilton <rwil...@cisco.com>; Linda Dunbar <linda.dun...@huawei.com>; 
draft-ietf-netmod-acl-mo...@ietf.org; 'netmod@ietf.org' <netmod@ietf.org>
Subject: Re: [netmod] Can you remove the "Identity acl-base" defined in 
draft-ietf-netmod-acl-model-07

YANG 1.1 introduces special functions for identities such as
derived-from() or derived-from-or-self(), for more details see section
10.4 of draft-ietf-netmod-rfc6020bis-12.

/js

On Wed, May 11, 2016 at 08:19:01AM +, William Ivory wrote:
> Hi Rob,
> 
> Probably a stupid question but how would you write a 'when' statement that 
> checks identity type?  What XPATH function / expression would allow you to 
> access the YANG type?
> 
> Thanks,
> 
> William
> 
> -Original Message-
> From: netmod [mailto:netmod-boun...@ietf.org] On Behalf Of Robert Wilton
> Sent: 10 May 2016 18:27
> To: Linda Dunbar <linda.dun...@huawei.com>
> Cc: draft-ietf-netmod-acl-mo...@ietf.org; 'netmod@ietf.org' <netmod@ietf.org>
> Subject: Re: [netmod] Can you remove the "Identity acl-base" defined in 
> draft-ietf-netmod-acl-model-07
> 
> Hi Linda,
> 
> I think that having the base identity makes the model safer and more 
> extensible in future.  I think that the general idea of a base identity is 
> fairly standard and is perhaps a bit like defining an abstract base class in 
> an OO language.
> 
> So, in YANG, rather than a when statement having to explicitly check for 
> ipv4-acl or ipv6-acl it can just check for any type derived from acl-base, 
> which allows for new types of ACL to be defined in future (potentially in 
> different modules).
> 
> Conversely, it also helps prevent someone from using a completely 
> inappropriate identity, e.g. say trying to use an interface type identity 
> such as ift:ethernetCsmacd where a type of ACL identity is required.
> 
> Thanks,
> Rob
> 
> 
> On 10/05/2016 17:55, Linda Dunbar wrote:
> > Juergen,
> >
> > Of course, it is not confusing to you because you are in the box (vs. many 
> > of us are outside the box looking in).
> >
> > RFC 6020 doesn't say all identities have to have a sub-identity.
> >
> >
> > My opinion only.
> >
> >
> > Linda
> >   
> >
> > -Original Message-
> > From: Juergen Schoenwaelder 
> > [mailto:j.schoenwael...@jacobs-university.de]
> > Sent: Tuesday, May 10, 2016 10:38 AM
> > To: Linda Dunbar
> > Cc: draft-ietf-netmod-acl-mo...@ietf.org; 'netmod@ietf.org'; Thomas D. 
> > Nadeau
> > Subject: Re: Can you remove the "Identity acl-base" defined in 
> > draft-ietf-netmod-acl-model-07
> >
> > On Tue, May 10, 2016 at 03:07:30PM +, Linda Dunbar wrote:
> >> Juergen,
> >>
> >> If "acl-base" has some content more than the comment (i.e. the 
> >> description), then it makes sense.
> >>
> >> The comments in the "identity ipv4-acl" is enough to describe the 
> >> identity. Same with the identity ipv6-acl.
> >>
> >> I find it is very confusing to have the recursive reference of identity 
> >> (all of them are simply the description).
> >>
> > I fail to see anything confusing here. Did you read the relevant sections 
> > of RFC 6020? What is unclear about identities and how they work?
> >
> > /js
> >
> 
> ___
> netmod mailing list
> netmod@ietf.org
> https://urldefense.proofpoint.com/v2/url?u=https-3A__www.ietf.org_mailman_listinfo_netmod=CwICAg=IL_XqQWOjubgfqINi2jTzg=GByLeg9jZvOv_AlgBo9uvdDrxizlOR7l_SnTXowyJU8=MlQZEKdXoP4IwlPcElVo_hIsmcgPxkS1AvAc3uGRU_E=iht1ryWsM95ONkVXCHgLCn-rGgsZVjmO0P_Hnhg2llM=
>  
> 
> ___
> netmod mailing list
> netmod@ietf.org
> https://urldefense.proofpoint.com/v2/url?u=https-3A__www.ietf.org_mailman_listinfo_netmod=CwIBAg=IL_XqQWOjubgfqINi2jTzg=GByLeg9jZvOv_AlgBo9uvdDrxizlOR7l_SnTXowyJU8=9SqA4lSC3_C0sr1ZX9Wd7wI8KYym05LqlsRSMn9nS0k=VTDyjdlJ_E4CVhRCNWy3hNeKwtWozq2hfJn5IvnwR7g=
>  

-- 
Juergen Schoenwaelder   Jacobs University Bremen gGmbH
Phone: +49 421 200 3587 Campus Ring 1 | 28759 Bremen | Germany
Fax:   +49 421 200 3103 
<https://urldefense.proofpoint.com/v2/url?u=http-3A__www.jacobs-2Duniversity.de_=CwIBAg=IL_XqQWOjubgfqINi2jTzg=GByLeg9jZvOv_AlgBo9uvdDrxizlOR7l_SnTXowyJU8=9SqA4lSC3_C0sr1ZX9Wd7wI8KYym05LqlsRSMn9nS0k=7LK8I-xuJJL1uj0aFRdbOMusbTZca15C8vQj8wDcs0U=
 >

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


Re: [netmod] Question about updating YANG modules

2016-04-19 Thread William Ivory
So would it be a fair summary to say that it is allowed to change from a 
specific type to a union consisting only of those types, but that adding 
different types on top of the existing type is not recommended.

Which JSON document are you referring to?

Thanks,

William

-Original Message-
From: Juergen Schoenwaelder [mailto:j.schoenwael...@jacobs-university.de] 
Sent: 19 April 2016 09:12
To: William Ivory <wiv...@brocade.com>
Cc: netmod@ietf.org
Subject: Re: [netmod] Question about updating YANG modules

On Tue, Apr 19, 2016 at 08:02:24AM +, William Ivory wrote:

> OK - but changing from int8 to int16 still allows all previously 
> allowed values, and simply adds some more, making it less restrictive.  
> That isn't allowed though as noted in the bullet point from section 10 
> below.

Obviously, the set of allowed values changes when you replace int8 with int16.
 
> What about extending a union that previously included say just strings to 
> include int8 as well - is that allowed under section 10 rules?

This is an interesting question. Assuming you had

  leaf a { type string; }

and you change it to

  leaf a { type union { type int8; type string; } }

then for the XML encoding the set of values does not change however for the 
JSON encoding it does change. See the JSON document for subtleties associated 
with unions.

To prevent damage for encodings that carry some type information, we might need 
a stricter interpretation of YANG compatibility rules...

/js

-- 
Juergen Schoenwaelder   Jacobs University Bremen gGmbH
Phone: +49 421 200 3587 Campus Ring 1 | 28759 Bremen | Germany
Fax:   +49 421 200 3103 
<https://urldefense.proofpoint.com/v2/url?u=http-3A__www.jacobs-2Duniversity.de_=CwIBAg=IL_XqQWOjubgfqINi2jTzg=GByLeg9jZvOv_AlgBo9uvdDrxizlOR7l_SnTXowyJU8=wSZwDXcoblI354__Ryu63C-eCizA9MGZlpaNGr9oamA=zU0Z5HyUEKygBVYhh9EtdPH-AfQ7IeFuMllqL3wEWs0=
 >

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


Re: [netmod] Question about updating YANG modules

2016-04-19 Thread William Ivory
OK - but changing from int8 to int16 still allows all previously allowed 
values, and simply adds some more, making it less restrictive.  That isn't 
allowed though as noted in the bullet point from section 10 below.

What about extending a union that previously included say just strings to 
include int8 as well - is that allowed under section 10 rules?

Thanks,

William

-Original Message-
From: Juergen Schoenwaelder [mailto:j.schoenwael...@jacobs-university.de] 
Sent: 19 April 2016 08:41
To: William Ivory <wiv...@brocade.com>
Cc: netmod@ietf.org
Subject: Re: [netmod] Question about updating YANG modules

A type is essentially defining a set of allowed values.

If this set of values does not change (and the semantics associated with the 
values do not change), then you can change the type used in the type statement.

/js

On Tue, Apr 19, 2016 at 07:30:14AM +, William Ivory wrote:
> Hi,
> 
> Section 10 of the YANG RFC covers updating modules while maintaining 
> backwards-compatibiility.  I have a question about whether the following 
> statement allows for a string type to be replaced with a union comprising 
> solely of string types, so long as the overall set of strings accepted was no 
> more restrictive?  This would allow us to reuse some existing types.
> 
>o  A "type" statement may be replaced with another "type" statement
>   that does not change the syntax or semantics of the type.  For
>   example, an inline type definition may be replaced with a typedef,
>   but an int8 type cannot be replaced by an int16, since the syntax
>   would change.
> 
> I can see that changing int8 to int16 changes the syntax, but does changing 
> from string to a union of strings change the syntax according to this 
> definition?
> 
> Thanks,
> 
> William
> 

> ___
> netmod mailing list
> netmod@ietf.org
> https://urldefense.proofpoint.com/v2/url?u=https-3A__www.ietf.org_mail
> man_listinfo_netmod=CwIBAg=IL_XqQWOjubgfqINi2jTzg=GByLeg9jZvOv_A
> lgBo9uvdDrxizlOR7l_SnTXowyJU8=eNnaJYadAK0Fvw2MfBD-jQYKBdoeq28VUey6fK
> A5B6s=lzSZQBGv2Xz2LtMHfvwQmV0K6i7olWuSvPFW9XEkA8M=


-- 
Juergen Schoenwaelder   Jacobs University Bremen gGmbH
Phone: +49 421 200 3587 Campus Ring 1 | 28759 Bremen | Germany
Fax:   +49 421 200 3103 
<https://urldefense.proofpoint.com/v2/url?u=http-3A__www.jacobs-2Duniversity.de_=CwIBAg=IL_XqQWOjubgfqINi2jTzg=GByLeg9jZvOv_AlgBo9uvdDrxizlOR7l_SnTXowyJU8=eNnaJYadAK0Fvw2MfBD-jQYKBdoeq28VUey6fKA5B6s=Dkya3b9AFYKFTljkbVtJKVHNDqJ5HzrP5jMxydI1FB4=
 >

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


[netmod] Question about updating YANG modules

2016-04-19 Thread William Ivory
Hi,

Section 10 of the YANG RFC covers updating modules while maintaining 
backwards-compatibiility.  I have a question about whether the following 
statement allows for a string type to be replaced with a union comprising 
solely of string types, so long as the overall set of strings accepted was no 
more restrictive?  This would allow us to reuse some existing types.

   o  A "type" statement may be replaced with another "type" statement
  that does not change the syntax or semantics of the type.  For
  example, an inline type definition may be replaced with a typedef,
  but an int8 type cannot be replaced by an int16, since the syntax
  would change.

I can see that changing int8 to int16 changes the syntax, but does changing 
from string to a union of strings change the syntax according to this 
definition?

Thanks,

William

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


Re: [netmod] string in when and must statement in YANG ABNF Grammar

2016-03-29 Thread William Ivory
Hi Bart,

Maybe you need to use a different NETCONF server if your current one is 
crashing with badly formed XPATH expressions?  

Our YANG compiler validates XPATH expressions when we load in YANG files, and 
anything that slips through should certainly not cause a crash at runtime 
(unless there's a bug of course).  I had assumed others would do likewise - as 
far as I'm concerned XPATH is an 'extension' of YANG and we validate it with 
the same level of scrutiny as the YANG itself.

So, I don't think this is anything to do with the 'programming language' - it's 
all about individual implementations of the YANG / XPATH compiler.

I don't quite follow your point about prefixing a leaf - if you don't 
explicitly prefix a leaf in an XPATH statement then there are clear (well, 
after the third or fourth reading!) rules that specify what prefix will be 
used, depending on whether the must statement is inside a grouping or an 
augment statement, or in 'plain' YANG.  Is your NETCONF server doing something 
unexpected?

Regards,

William

-Original Message-
From: netmod [mailto:netmod-boun...@ietf.org] On Behalf Of Bogaert, Bart (Nokia 
- BE)
Sent: 29 March 2016 08:57
To: EXT Martin Bjorklund 
Cc: netmod@ietf.org
Subject: Re: [netmod] string in when and must statement in YANG ABNF Grammar

Martin,

Thanks for this feedback.  A run-time crash of the NETCONF server is a bad 
"outcome" of a typo like this...
I checked the W3C pages and there is grammar defined for an XPATH expression so 
ultimately the string could be parsed as an XPATH (I guess it is currently not 
done).

Any other programming language ensures to eliminate typing errors during the 
compilation phase allowing early detection of issues like this.  It is becoming 
a problem when the NETCONF server internally stores values (e.g.
identityref) in a format different from what is specified in the string of the 
when statement resulting in unexpected options when trying to use the CLI 
generated from the model.  In this specific case we were advised to prefix the 
leaf (as the leaf was stored in this way...) even though the leaf was in the 
local module itself.  This makes development even less transparent...  When we 
flagged this we received the following feedback:

Quote:
For YANG 1.1 that is underway it will be defined in the following way:
" The string value of a node of type identityref in a "must" or "when" XPath

expression is the referred identity's qualified name with the prefix present.  
If the referred identity is defined in an imported module, the prefix in the

string value is the prefix defined in the corresponding "import" statement.

Otherwise, the prefix in the string value is the prefix for the current 
module.""

But as this is within a string that is not parsed (depending on the
compiler) this is something that people need to do and if not done will still 
result in run-time problems.

Best regards - Vriendelijke groeten,
Bart Bogaert
System Architect Data-Centric SW Architectures Fixed Networks - Broadband 
Access BU,  Nokia Contact number +32 3 2408310 (+32 477 673952)

-Original Message-
From: EXT Martin Bjorklund [mailto:m...@tail-f.com]
Sent: 29 March 2016 09:23
To: Bogaert, Bart (Nokia - BE)
Cc: netmod@ietf.org
Subject: Re: [netmod] string in when and must statement in YANG ABNF Grammar

"Bogaert, Bart (Nokia - BE)"  wrote:
> Is there a reason why the ABNF for example the when and must statement 
> has been "restricted" to when-keyword sep string optsep
> 
> As "string"  can't be tokenized no errors are generated by YANG 
> compilers if this string contains an error, e.g. referred leaf does 
> not exit due to a typo.  This problem only exposes itself at run-time.
> I was wondering why this string was not broken down into a number of 
> specific parts that define the when statement so that these kind of 
> errors
can be trapped early in the
> development process?   I am rather new in this so I did not follow all
> discussions that led to the definition of YANG and hence have no idea 
> whether this was discussed and what were the reasons not to do it this
way.

The arguments to the "when" and "must" statements are XPath 1.0 expressions.
The syntax of XPath 1.0 is not defined by YANG, but by the XPath 1.0 spec.
This is the reason that the YANG grammar isn't more specific.

YANG compilers differ in their ability to detect errors in these XPath 
expressions.  Some perform more checks than others (unfortunately, pyang is 
pretty bad in this regard... (patches are always welcome:)).

[For your particular example, referencing a leaf that doesn't exist is not an 
error per se; it is perfectly valid XPath.  But it probably warrants a warning 
by the compiler.]


/martin

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


Re: [netmod] Query about usage of local-name() in YANG XPATH expressions

2016-03-28 Thread William Ivory
Hi Andy,

Thanks.  So if we have a tightly controlled set of YANG files, and restrict 
usage to a specific use case where we have a set of nodes across multiple 
modules with the same name, we should be fine.

William

From: Andy Bierman [mailto:a...@yumaworks.com]
Sent: 28 March 2016 20:51
To: William Ivory <wiv...@brocade.com>
Cc: netmod@ietf.org
Subject: Re: [netmod] Query about usage of local-name() in YANG XPATH 
expressions

Hi,

This was raised as a concern by Lada (see netmod WG email arourd July 2014)

The issue is that the expression breaks module containment and will match
depending on what other YANG modules are known to the YANG compiler.


Andy



On Sat, Mar 26, 2016 at 3:08 AM, William Ivory 
<wiv...@brocade.com<mailto:wiv...@brocade.com>> wrote:
Hi,

From RFC 6087 (YANG Usage Guidelines), section 5.6.2, the following is noted 
about the use of the XPATH local-name() function:

   The 'local-name' function SHOULD NOT be used to reference local names
   outside of the YANG module defining the must or when expression
   containing the 'local-name' function.  Example of a local-name
   function that should not be used:

  /*[local-name()='foo']

However, no explanation is given as to why this is a bad idea.  We have a 
specific use case where local-name() would appear to allow us to massively 
simplify some rather cumbersome must expressions, but I wanted to check I’m not 
missing some ‘gotcha’ here.  Is it simply that relying on a common node name 
across multiple modules is generally a bad design as it ties the modules 
together, or is there more to it?  If so, then in our case this is a reasonable 
restriction.

Thanks,

William


___
netmod mailing list
netmod@ietf.org<mailto:netmod@ietf.org>
https://www.ietf.org/mailman/listinfo/netmod<https://urldefense.proofpoint.com/v2/url?u=https-3A__www.ietf.org_mailman_listinfo_netmod=CwMFaQ=IL_XqQWOjubgfqINi2jTzg=GByLeg9jZvOv_AlgBo9uvdDrxizlOR7l_SnTXowyJU8=VZGB2NkaE9--68moPlgZM_ag1CgKvjJqSwwZ2iw1gio=7Ju95XbNKdlg4tPZG9ahSeMHUT_lqGFPtiZxcXevTxw=>

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


[netmod] Query about usage of local-name() in YANG XPATH expressions

2016-03-26 Thread William Ivory
Hi,

>From RFC 6087 (YANG Usage Guidelines), section 5.6.2, the following is noted 
>about the use of the XPATH local-name() function:

   The 'local-name' function SHOULD NOT be used to reference local names
   outside of the YANG module defining the must or when expression
   containing the 'local-name' function.  Example of a local-name
   function that should not be used:

  /*[local-name()='foo']

However, no explanation is given as to why this is a bad idea.  We have a 
specific use case where local-name() would appear to allow us to massively 
simplify some rather cumbersome must expressions, but I wanted to check I'm not 
missing some 'gotcha' here.  Is it simply that relying on a common node name 
across multiple modules is generally a bad design as it ties the modules 
together, or is there more to it?  If so, then in our case this is a reasonable 
restriction.

Thanks,

William

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


Re: [netmod] Clarification needed for YANG 1.1 XPATH context

2016-02-25 Thread William Ivory


-Original Message-
From: Martin Bjorklund [mailto:m...@tail-f.com] 
Sent: 25 February 2016 15:31
To: William Ivory <wiv...@brocade.com>
Cc: netmod@ietf.org
Subject: Re: [netmod] Clarification needed for YANG 1.1 XPATH context

William Ivory <wiv...@brocade.com> wrote:
> 
> 
> -Original Message-
> From: Martin Bjorklund [mailto:m...@tail-f.com]
> Sent: 25 February 2016 15:17
> To: William Ivory <wiv...@brocade.com>
> Cc: netmod@ietf.org
> Subject: Re: [netmod] Clarification needed for YANG 1.1 XPATH context
> 
> William Ivory <wiv...@brocade.com> wrote:
> > Hi,
> > 
> > I'm looking for clarification on the meaning of the following 
> > paragraph in section 6.4.1 (XPATH context) in RFC6020bis:
> > 
> >'If a node that exists in the accessible tree has a non-presence
> >container as a child, then the non-presence container also exists in
> >the tree.'
> > 
> > It's unclear to me what this is trying to say, and why - for 
> > example, does this mean that I need to validate any 'must' and 'when'
> > statements on the child container even when nothing within that 
> > child container is configured?
> 
> must expressions are always evaluated if the node where the must 
> expression is defined exists, regardless of the number of children 
> this node has.
> 
> [wivory] So in my example where the child container (non-presence) has 
> NO children, then it doesn't exist, and any must statement on it 
> should not be run.  Only when a non-presence container has a non-zero 
> number of children should any 'must' statements on that container be 
> run.
> 
> [wivory] If that's the case, then would it be correct to say that the 
> intention of this paragraph is as a reminder that one must evaluate 
> 'must' statements on nodes that have no inherent meaning and exist 
> only because they contain child nodes?

No; section 7.5.3 says:

   When a datastore is validated, all "must" constraints are
   conceptually evaluated once for each node in the accessible tree (see
   Section 6.4.1).

And the quoted paragraph of 6.4.1 says that the NP-container
(conceptually) exists if its parent exists - regardless of number of children.

So if the parent exists, any must expressions in the NP-container are evaluated.

[wivory] Is the intended use case top-level containers (directly under the root 
node) where you might wish to enforce that at least one such container existed? 
 In that case there would be no higher level node (as you can't add when/must 
to root) on which you could attach the 'must'.  At any other level in the tree 
you would always be able to attach the 'must' at a higher level.  Or am I 
missing some use case(s)?

Thanks,

William


/martin

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


Re: [netmod] Clarification needed for YANG 1.1 XPATH context

2016-02-25 Thread William Ivory


-Original Message-
From: Martin Bjorklund [mailto:m...@tail-f.com] 
Sent: 25 February 2016 15:17
To: William Ivory <wiv...@brocade.com>
Cc: netmod@ietf.org
Subject: Re: [netmod] Clarification needed for YANG 1.1 XPATH context

William Ivory <wiv...@brocade.com> wrote:
> Hi,
> 
> I'm looking for clarification on the meaning of the following 
> paragraph in section 6.4.1 (XPATH context) in RFC6020bis:
> 
>'If a node that exists in the accessible tree has a non-presence
>container as a child, then the non-presence container also exists in
>the tree.'
> 
> It's unclear to me what this is trying to say, and why - for example, 
> does this mean that I need to validate any 'must' and 'when'
> statements on the child container even when nothing within that child 
> container is configured?

must expressions are always evaluated if the node where the must expression is 
defined exists, regardless of the number of children this node has.

[wivory] So in my example where the child container (non-presence) has NO 
children, then it doesn't exist, and any must statement on it should not be 
run.  Only when a non-presence container has a non-zero number of children 
should any 'must' statements on that container be run.

[wivory] If that's the case, then would it be correct to say that the intention 
of this paragraph is as a reminder that one must evaluate 'must' statements on 
nodes that have no inherent meaning and exist only because they contain child 
nodes?

Thanks,

William


/martin

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


[netmod] Clarification needed for YANG 1.1 XPATH context

2016-02-25 Thread William Ivory
Hi,

I'm looking for clarification on the meaning of the following paragraph in 
section 6.4.1 (XPATH context) in RFC6020bis:

   'If a node that exists in the accessible tree has a non-presence
   container as a child, then the non-presence container also exists in
   the tree.'

It's unclear to me what this is trying to say, and why - for example, does this 
mean that I need to validate any 'must' and 'when' statements on the child 
container even when nothing within that child container is configured?

Thanks,

William

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


[netmod] Where can I insert new YANG substatements?

2016-02-03 Thread William Ivory
Hi,

My colleagues and I are looking for clarification of the last point in Section 
10 of YANG 1.0:

'   In statements that have any data definition statements as
   substatements, those data definition substatements MUST NOT be
   reordered.'

We understand that existing statements must not be reordered in a new revision 
of a YANG module, but we're not clear if new statements may be inserted between 
existing statements, or must always come at the 'end' of a list or container 
definition.  A specific example we're concerned with is where a grouping is 
used, and then later that grouping has an extra element added, but the new node 
could also be added directly.  Eg:

Container foo {
Leaf A
Uses grouping B;
Leaf C
Leaf D
}

Is it valid in a new revision of the module to do the following, or must the 
order be A, B, C, D, E?  What if grouping B has gained a new statement?

Container foo {
Leaf A
Uses grouping B;
Leaf C
Leaf E <  ADDED
Leaf D
}

Thanks,

William


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


Re: [netmod] Where can I insert new YANG substatements?

2016-02-03 Thread William Ivory
Hi Martin,

Thanks - that looks good to me.

William

-Original Message-
From: Martin Bjorklund [mailto:m...@tail-f.com] 
Sent: 03 February 2016 17:06
To: William Ivory <wiv...@brocade.com>
Cc: netmod@ietf.org
Subject: Re: [netmod] Where can I insert new YANG substatements?

Hi,

William Ivory <wiv...@brocade.com> wrote:
> Hi,
> 
> My colleagues and I are looking for clarification of the last point in 
> Section 10 of YANG 1.0:
> 
> '   In statements that have any data definition statements as
>substatements, those data definition substatements MUST NOT be
>reordered.'
> 
> We understand that existing statements must not be reordered in a new 
> revision of a YANG module, but we're not clear if new statements may 
> be inserted between existing statements, or must always come at the 
> 'end' of a list or container definition.

They can be inserted anywhere.

As Lada pointed out, this should be clarified in 6020bis.  I will do:

OLD:

  In statements that have any data definition statements as
  substatements, those data definition substatements MUST NOT be
  reordered.

NEW:

  In statements that have any data definition statements as
  substatements, those data definition substatements MUST NOT be
  reordered.  If new data definition statements are added, they can be
  added anywhere between these substatement.


> A specific example we're
> concerned with is where a grouping is used, and then later that 
> grouping has an extra element added, but the new node could also be 
> added directly.  Eg:
> 
> Container foo {
> Leaf A
> Uses grouping B;
> Leaf C
> Leaf D
> }
> 
> Is it valid in a new revision of the module to do the following, or 
> must the order be A, B, C, D, E?  What if grouping B has gained a new 
> statement?
> 
> Container foo {
> Leaf A
> Uses grouping B;
> Leaf C
> Leaf E <  ADDED
> Leaf D
> }

This is valid.


/martin


> 
> Thanks,
> 
> William
> 
> 

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