Skip to content

Commit

Permalink
doc BUGFIX yanglint examples
Browse files Browse the repository at this point in the history
reflect previous changes in yanglint (no need for extra top-level
element) to the yanglint examples.

Fixes #23
  • Loading branch information
rkrejci committed Feb 11, 2016
1 parent b9f6ba9 commit 726cda6
Show file tree
Hide file tree
Showing 10 changed files with 213 additions and 234 deletions.
21 changes: 9 additions & 12 deletions tools/lint/examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,23 +81,22 @@ add ietf-netconf-acm.yin

**Malformed XML data**

Comand and its output:
Command and its output:

```
> data -x edit config-missing-key.xml
libyang[0]: Parser fails around the line 20.
libyang[0]: Parser fails around the line 19.
libyang[0]: Mixed opening (nam) and closing (name) element tags.
libyang[0]: lyd_parse_xml: Invalid parameter.
Failed to parse data.
```

**State information in config XML**
**State information in edit-config XML**

Comand and its output:

```
> data -x edit config-unknown-element.xml
libyang[0]: Parser fails around the line 25.
libyang[0]: Parser fails around the line 24.
libyang[0]: Unknown element "denied-operations".
Failed to parse data.
```
Expand All @@ -108,7 +107,7 @@ Comand and its output:

```
> data data-missing-key.xml
libyang[0]: Parser fails around the line 7.
libyang[0]: Parser fails around the line 6.
libyang[0]: Missing required element "name" in "rule".
Failed to parse data.
```
Expand All @@ -119,19 +118,17 @@ Comand and its output:

```
> data data-malformed-xml.xml
libyang[0]: Parser fails around the line 12.
libyang[0]: Parser fails around the line 13.
libyang[0]: Mixed opening (nam) and closing (rule) element tags.
libyang[0]: lyd_parse_xml: Invalid parameter.
Failed to parse data.
```

Comand and its output:

```
> data data-malformed-xml2.xml
libyang[0]: Parser fails around the line 8.
libyang[0]: Parser fails around the line 7.
libyang[0]: Mixed opening (module-name) and closing (name) element tags.
libyang[0]: lyd_parse_xml: Invalid parameter.
Failed to parse data.
```

Expand All @@ -141,7 +138,7 @@ Comand and its output:

```
> data data-out-of-range-value.xml
libyang[0]: Parser fails around the line 25.
libyang[0]: Parser fails around the line 24.
libyang[0]: Value "-1" is out of range or length.
Failed to parse data.
```
Expand All @@ -161,7 +158,7 @@ Comand and its output:

```
> data data-acm.xml
libyang[0]: Parser fails around the line 26.
libyang[0]: Parser fails around the line 25.
libyang[0]: When condition "../denied-operations > 0" not satisfied.
libyang[0]: There are unresolved data items left.
Failed to parse data.
Expand Down
46 changes: 22 additions & 24 deletions tools/lint/examples/config-acm.xml
Original file line number Diff line number Diff line change
@@ -1,26 +1,24 @@
<config xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<nacm xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-acm" xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">
<rule-list>
<rule-list>
<name>almighty</name>
<group>almighty</group>
<group nc:operation="create">test</group>
<rule>
<name>almighty</name>
<group>almighty</group>
<group nc:operation="create">test</group>
<rule>
<name>almighty</name>
<module-name>*</module-name>
<access-operations>*</access-operations>
<action>permit</action>
</rule>
</rule-list>
<groups>
<group>
<name>test</name>
<user-name>smith</user-name>
</group>
<group>
<name>almighty</name>
<user-name>smith</user-name>
<user-name>doe</user-name>
</group>
</groups>
</nacm>
</config>
<module-name>*</module-name>
<access-operations>*</access-operations>
<action>permit</action>
</rule>
</rule-list>
<groups>
<group>
<name>test</name>
<user-name>smith</user-name>
</group>
<group>
<name>almighty</name>
<user-name>smith</user-name>
<user-name>doe</user-name>
</group>
</groups>
</nacm>
46 changes: 22 additions & 24 deletions tools/lint/examples/config-missing-key.xml
Original file line number Diff line number Diff line change
@@ -1,26 +1,24 @@
<config xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<nacm xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-acm" xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">
<rule-list>
<rule-list>
<name>almighty</name>
<group>almighty</group>
<group nc:operation="create">test</group>
<rule>
<name>almighty</name>
<group>almighty</group>
<group nc:operation="create">test</group>
<rule>
<name>almighty</name>
<module-name>*</module-name>
<access-operations>*</access-operations>
<action>permit</action>
</rule>
</rule-list>
<groups>
<group>
<name>test</name>
<user-name>smith</user-name>
</group>
<group>
<nam>almighty</name>
<user-name>smith</user-name>
<user-name>doe</user-name>
</group>
</groups>
</nacm>
</config>
<module-name>*</module-name>
<access-operations>*</access-operations>
<action>permit</action>
</rule>
</rule-list>
<groups>
<group>
<name>test</name>
<user-name>smith</user-name>
</group>
<group>
<nam>almighty</name>
<user-name>smith</user-name>
<user-name>doe</user-name>
</group>
</groups>
</nacm>
52 changes: 25 additions & 27 deletions tools/lint/examples/config-unknown-element.xml
Original file line number Diff line number Diff line change
@@ -1,29 +1,27 @@
<data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<nacm xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-acm" xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">
<rule-list>
<rule-list>
<name>almighty</name>
<group>almighty</group>
<group nc:operation="create">test</group>
<rule>
<name>almighty</name>
<group>almighty</group>
<group nc:operation="create">test</group>
<rule>
<name>almighty</name>
<module-name>*</module-name>
<access-operations>*</access-operations>
<action>permit</action>
</rule>
</rule-list>
<groups>
<group>
<name>test</name>
<user-name>smith</user-name>
</group>
<group>
<name>almighty</name>
<user-name>smith</user-name>
<user-name>doe</user-name>
</group>
</groups>
<denied-operations>0</denied-operations>
<denied-data-writes>0</denied-data-writes>
<denied-notifications>0</denied-notifications>
</nacm>
</data>
<module-name>*</module-name>
<access-operations>*</access-operations>
<action>permit</action>
</rule>
</rule-list>
<groups>
<group>
<name>test</name>
<user-name>smith</user-name>
</group>
<group>
<name>almighty</name>
<user-name>smith</user-name>
<user-name>doe</user-name>
</group>
</groups>
<denied-operations>0</denied-operations>
<denied-data-writes>0</denied-data-writes>
<denied-notifications>0</denied-notifications>
</nacm>
52 changes: 25 additions & 27 deletions tools/lint/examples/data-acm.xml
Original file line number Diff line number Diff line change
@@ -1,29 +1,27 @@
<data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<nacm xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-acm" xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">
<rule-list>
<rule-list>
<name>almighty</name>
<group>almighty</group>
<group nc:operation="create">test</group>
<rule>
<name>almighty</name>
<group>almighty</group>
<group nc:operation="create">test</group>
<rule>
<name>almighty</name>
<module-name>*</module-name>
<access-operations>*</access-operations>
<action>permit</action>
</rule>
</rule-list>
<groups>
<group>
<name>test</name>
<user-name>smith</user-name>
</group>
<group>
<name>almighty</name>
<user-name>smith</user-name>
<user-name>doe</user-name>
</group>
</groups>
<denied-operations>0</denied-operations>
<denied-data-writes>0</denied-data-writes>
<denied-notifications>0</denied-notifications>
</nacm>
</data>
<module-name>*</module-name>
<access-operations>*</access-operations>
<action>permit</action>
</rule>
</rule-list>
<groups>
<group>
<name>test</name>
<user-name>smith</user-name>
</group>
<group>
<name>almighty</name>
<user-name>smith</user-name>
<user-name>doe</user-name>
</group>
</groups>
<denied-operations>0</denied-operations>
<denied-data-writes>0</denied-data-writes>
<denied-notifications>0</denied-notifications>
</nacm>
26 changes: 12 additions & 14 deletions tools/lint/examples/data-ip.xml
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
<data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces">
<interface>
<name>eth0</name>
<description>Wire Connection</description>
<type xmlns:ift="urn:ietf:params:xml:ns:yang:iana-if-type">ift:ethernetCsmacd</type>
<enabled>true</enabled>
<ipv4 xmlns="urn:ietf:params:xml:ns:yang:ietf-ip">
<address><ip>192.168.1.15</ip><netmask>255.255.255.0</netmask></address>
<address><ip>192.168.1.10</ip><netmask>255.255.255.0</netmask></address>
</ipv4>
</interface>
</interfaces>
</data>
<interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces">
<interface>
<name>eth0</name>
<description>Wire Connection</description>
<type xmlns:ift="urn:ietf:params:xml:ns:yang:iana-if-type">ift:ethernetCsmacd</type>
<enabled>true</enabled>
<ipv4 xmlns="urn:ietf:params:xml:ns:yang:ietf-ip">
<address><ip>192.168.1.15</ip><netmask>255.255.255.0</netmask></address>
<address><ip>192.168.1.10</ip><netmask>255.255.255.0</netmask></address>
</ipv4>
</interface>
</interfaces>
52 changes: 25 additions & 27 deletions tools/lint/examples/data-malformed-xml.xml
Original file line number Diff line number Diff line change
@@ -1,29 +1,27 @@
<data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<nacm xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-acm" xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">
<rule-list>
<rule-list>
<name>almighty</name>
<group>almighty</group>
<group nc:operation="create">test</group>
<rule>
<nam>almighty
<module-name>*</module-name>
<access-operations>*</access-operations>
<action>permit</action>
</rule>
</rule-list>
<groups>
<group>
<name>test</name>
<user-name>smith</user-name>
</group>
<group>
<name>almighty</name>
<group>almighty</group>
<group nc:operation="create">test</group>
<rule>
<nam>almighty
<module-name>*</module-name>
<access-operations>*</access-operations>
<action>permit</action>
</rule>
</rule-list>
<groups>
<group>
<name>test</name>
<user-name>smith</user-name>
</group>
<group>
<name>almighty</name>
<user-name>smith</user-name>
<user-name>doe</user-name>
</group>
</groups>
<denied-operations>0</denied-operations>
<denied-data-writes>0</denied-data-writes>
<denied-notifications>0</denied-notifications>
</nacm>
</data>
<user-name>smith</user-name>
<user-name>doe</user-name>
</group>
</groups>
<denied-operations>0</denied-operations>
<denied-data-writes>0</denied-data-writes>
<denied-notifications>0</denied-notifications>
</nacm>
Loading

0 comments on commit 726cda6

Please sign in to comment.