Subject: [yang-doctors] Question about yang2dsdl error.

From: Christian Hopps <[email-masked]>
Date: Fri, 8 Nov 2019 06:29:38 -0500

Hi yang-doctors,

I've got an example which yang2dsdl complains about (in it's expected unhelpful way :) In trying to figure out what was wrong, I gave yanglint a try, and it said the example was fine (no errors no output with --strict). Can anyone shed some light on what might be the issue. I'd really like yang2dsdl to pass here as well.

Example:

(default) [06:23:07 dak:~/w/reverse-metric-yang]$ cat test-xml-example2.xml
<config xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
  <routing
      xmlns="urn:ietf:params:xml:ns:yang:ietf-routing">
    <control-plane-protocols>
      <control-plane-protocol>
        <type xmlns:isis="urn:ietf:params:xml:ns:yang:ietf-isis">
          isis:isis
        </type>
        <name>i0</name>
        <isis xmlns="urn:ietf:params:xml:ns:yang:ietf-isis">
          <area-address>00</area-address>
        </isis>
      </control-plane-protocol>
    </control-plane-protocols>
  </routing>
</config>

yang2dsdl Error:

(default) [06:23:05 dak:~/w/reverse-metric-yang]$ yang2dsdl -x -t config -d .validate -v test-xml-example2.xml [email-masked] [email-masked]
== Generating RELAX NG schema '.validate/ietf-routing_ietf-isis-config.rng'
Done.

== Generating Schematron schema '.validate/ietf-routing_ietf-isis-config.sch'
Done.

== Generating DSRL schema '.validate/ietf-routing_ietf-isis-config.dsrl'
Done.

== Validating grammar and datatypes ...
Relax-NG validity error : Extra element control-plane-protocols in interleave
test-xml-example2.xml:4: element control-plane-protocols: Relax-NG validity error : Element routing failed to validate content
test-xml-example2.xml fails to validate

Thanks,
Chris.

---

From: Ladislav Lhotka <[email-masked]>
Date: Fri, 08 Nov 2019 12:46:59 +0100

Hi Chris,

On Fri, 2019-11-08 at 06:29 -0500, Christian Hopps wrote:
> Hi yang-doctors,
> 
> I've got an example which yang2dsdl complains about (in it's expected
> unhelpful way :)

The error messages are produced by xmllint, and their unhelpfulness is
notorious.  Apart from that, xmllint RELAX NG validator is known to have other
bugs and gaps.

Have you tried to use Jing [1] for RELAX NG validation (the '-j' option to
yang2dsdl)?

Lada

[1] https://relaxng.org/jclark/jing.html

> In trying to figure out what was wrong, I gave yanglint a try, and it said the
> example was fine (no errors no output with --strict). Can anyone shed some
> light on what might be the issue. I'd really like yang2dsdl to pass here as
> well.
> 
> Example:
> 
> (default) [06:23:05 dak:~/w/reverse-metric-yang]$ yang2dsdl -x -t config -d
> .validate -v test-xml-example2.xml [email-masked] 
> [email-masked]
> test-xml-example2.xml:4: element control-plane-protocols: Relax-NG validity
> error : Element routing failed to validate content
> _______________________________________________
> yang-doctors mailing list
> [email-masked]
> https://www.ietf.org/mailman/listinfo/yang-doctors
-- 
Ladislav Lhotka
Head, CZ.NIC Labs
PGP Key ID: 0xB8F92B08A9F76C67

---

From: Christian Hopps <[email-masked]>
Date: Fri, 8 Nov 2019 07:36:35 -0500

> On Nov 8, 2019, at 6:46 AM, Ladislav Lhotka <[email-masked]> wrote:
> 
> Hi Chris,
> 

That doesn't seem to pick up the augmentation..

(default) [07:33:43 dak:~/w/reverse-metric-yang]$ yang2dsdl -x -j -t config -d .validate -v test-xml-example2.xml [email-masked] [email-masked]
== Generating RELAX NG schema '.validate/ietf-routing_ietf-isis-config.rng'
Done.

== Validating grammar and datatypes ...
[warning] /usr/bin/jing: Unable to locate avalon-framework in /usr/share/java
[warning] /usr/bin/jing: Unable to locate batik-all in /usr/share/java
/home/chopps/net/w/reverse-metric-yang/test-xml-example2.xml:8:16: error: character content of element "type" invalid; must be a QName equal to "direct", "routing-protocol" or "static"

Thanks,
Chris.

---

From: Ladislav Lhotka <[email-masked]>
Date: Tue, 12 Nov 2019 08:44:52 +0100

> That doesn't seem to pick up the augmentation..

There are actually two unrelated problems caused by fact that you use [email-masked] on the command line:

1. When performing the import from ietf-isis, pyang uses the latest revision of ietf-routing, i.e. 2018-03-13. This looks like a bug in pyang, a workaround is to remove the 2018-03-13 revision from the module path.

2. ietf-isis won't work with ietf-routing@2016-11-04 anyway: ietf-isis augments "/rt:routing/rt:ribs/rt:rib/rt:routes/rt:route" (around line 3492) but this schema node doesn't exist in the 2016-11-04 revision - it is under "routing-state" there.

Do you have any reason for not using the latest revision of ietf-routing?

Lada