Subject: Re: [Yang-multicast] draft-ietf-pim-igmp-mld-yang-02.txt: YANG compilation isuse

From: Radek Krejčí <[email-masked]>
Date: Tue, 28 Feb 2017 09:20:37 +0100

Hi,
the schema is ok - these warnings are printed because in yanglint, until explicitly stated, the imported modules (such as ietf-interfaces and ietf-ip), are supposed to be only imported, not implemented. The data nodes in imported schemas are not available, which is the reason of these warnings.

Note, that if the ietf-ip schema is explicitly loaded by yanglint, then it is marked as implemented schema from the YANG perspective, there is no warning:

$ yanglint [email-masked] [email-masked] -V
$

Regards,
Radek

Dne 28.2.2017 v 08:54 Benoit Claise napsal(a):
> Dear authors,
>
> Have a look at http://www.claise.be/IETFYANGPageCompilation.html
>
>     warn: Schema node "ietf-ip:ipv4" not found (/ietf-interfaces:interfaces/ietf-interfaces:interface[ietf-interfaces:name = current()]/ietf-ip:ipv4).
>     warn: Resolving must restriction "/ietf-interfaces:interfaces/ietf-interfaces:interface[ietf-interfaces:name = current()]/ietf-ip:ipv4" failed. (/ietf-routing:routing/control-plane-protocols/ietf-igmp-mld:igmp/interfaces/interface/interface)
>     warn: Schema node "ietf-ip:ipv6" not found (/ietf-interfaces:interfaces/ietf-interfaces:interface[ietf-interfaces:name = current()]/ietf-ip:ipv6).
>     warn: Resolving must restriction "/ietf-interfaces:interfaces/ietf-interfaces:interface[ietf-interfaces:name = current()]/ietf-ip:ipv6" failed. (/ietf-routing:routing/control-plane-protocols/ietf-igmp-mld:mld/interfaces/interface/interface)
>     warn: Schema node "ietf-ip:ipv4" not found (/ietf-interfaces:interfaces/ietf-interfaces:interface[ietf-interfaces:name = current()]/ietf-ip:ipv4).
>     warn: Resolving must restriction "/ietf-interfaces:interfaces/ietf-interfaces:interface[ietf-interfaces:name = current()]/ietf-ip:ipv4" failed. (/ietf-routing:routing-state/control-plane-protocols/ietf-igmp-mld:igmp/interfaces/interface/interface)
>     warn: Schema node "ietf-ip:ipv6" not found (/ietf-interfaces:interfaces/ietf-interfaces:interface[ietf-interfaces:name = current()]/ietf-ip:ipv6).
>     warn: Resolving must restriction "/ietf-interfaces:interfaces/ietf-interfaces:interface[ietf-interfaces:name = current()]/ietf-ip:ipv6" failed. (/ietf-routing:routing-state/control-plane-protocols/ietf-igmp-mld:mld/interfaces/interface/interface)
>
> Regards, Benoit

---

From: William Lupton <[email-masked]>
Date: Thu, 2 Mar 2017 10:49:18 +0000

Radek,

Some questions about this:
I note that the warnings are only output if the -V option is present. Are XPath expressions only validated in verbose mode (if so, that’s not obvious from the yanglint -h output)?
Why are the complaints only about ip:ipv4 (etc) and not about if:interfaces (etc), which are also referenced in the must statements?

And a comment:
This makes it hard for an automated tool (such as Benoit’s) because it needs to know which other YANG files to process in addition to the “file of interest”.

Thanks,
William

> On 28 Feb 2017, at 08:20, Radek Krejčí <[email-masked]> wrote:
> 
> Hi,
> _______________________________________________
> Yang-multicast mailing list
> [email-masked]
> https://www.ietf.org/mailman/listinfo/yang-multicast
>

---

From: William Lupton <[email-masked]>
Date: Thu, 2 Mar 2017 14:31:05 +0000

Thanks. Deep thought has obviously gone into this! I’d quite like to follow up a couple of points, but feel that this would be better done on the NETMOD list. Unless I hear otherwise (perhaps offline from you or Benoit?) I will kick off a NETMOD discussion within a few days. W.

> On 2 Mar 2017, at 12:31, Radek Krejčí <[email-masked]> wrote:
> 
> Hi,
> 
> 1) yes and no - by default, yanglint prints only errors, to see warnings, you need to add -V (to see verbose messages, you need -VV). But XPath is parsed no matter what the verbose level is, so even without -V option.
> 2) your module augments ietf-interfaces, right? Or some other module augmented by your module augments ietf-interfaces. Because, according to RFC 7950, sec 5.6.6 (3rd paragraph), when an implemented module augments another module (ietf-interfaces), the augmented module MUST be also implemented. So libyang automatically changes the augmented module from imported to the implemented. The same rule applies also in case of referring a module in path (leafref) and by deviating a module. But it does not apply when a module data is used in must or when conditions. That's the reason why it complains just about ietf-ip and not about ietf-interfaces.
> 
> Actually, YANG allows you to refer even non-existing (not defined) nodes in must and when conditions. That is why libyang prints it as warnings and not as errors - it is not prohibited, but usually it is not intended by the module authors, because the expression will be always false.
> 
> Regarding the comment - yes, we know, but YANG actually does not provide a way to specify that a particular import is also expected to be implemented. Therefore, libyang needs some help with setting modules implemented - all the explicitly loaded modules are supposed to be implemented, if the module is just implicitly loaded from the search directory and user did not expressed that it is supposed to be implemented, it is kept only imported to provide groupings or type definitions.
> 
> Regards,
> Radek
> 
> Dne 2.3.2017 v 11:49 William Lupton napsal(a):
>> Radek,
>> 
>>  * I note that the warnings are only output if the -V option is present. Are XPath expressions only validated in verbose mode (if so, that’s not obvious from the yanglint -h output)?
>>  * Why are the complaints only about ip:ipv4 (etc) and not about if:interfaces (etc), which are also referenced in the must statements?
>> 
>> 
>> And a comment:
>> 
>>  * This makes it hard for an automated tool (such as Benoit’s) because it needs to know which other YANG files to process in addition to the “file of interest”.
>> 
>> 
>> Thanks,
>> William
>> 
>>> On 28 Feb 2017, at 08:20, Radek Krejčí <[email-masked] <mailto:[email-masked]>> wrote:
>>> 
>>> Hi,
>>> $ yanglint [email-masked] <mailto:[email-masked]> [email-masked] <mailto:[email-masked]> -V
>>> $
>>> 
>>> Regards,
>>> Radek
>>> 
>>> 
>>> [email-masked] <mailto:[email-masked]>

---

From: Benoit Claise <[email-masked]>
Date: Mon, 6 Mar 2017 14:44:51 +0100

Thanks Radek for the warning explanation.
Coming back to "This makes it hard for an automated tool (such as 
Benoit’s) because it needs to know which other YANG files to process in 
addition to the “file of interest”, I wonder what can be done?
- do nothing? We will keep having the question, I'm sure.
- removing the warnings? Not sure it's ideal
- would it be possible to improve the warning (and the related test, by 
testing implemented instead of import), basically telling that the 
module itself is fine?

Regards, Benoit

> .

---

From: Radek Krejčí <[email-masked]>
Date: Thu, 2 Mar 2017 13:31:03 +0100

Hi,

Regards,
Radek