summaryrefslogtreecommitdiffstats
path: root/tools/lint/examples/README.md
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 04:23:18 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 04:23:18 +0000
commitb90161ccd3b318f3314a23cb10c387651ad35831 (patch)
treea47dc087160299ce02d728cbf031d84af6281537 /tools/lint/examples/README.md
parentAdding upstream version 2.1.30. (diff)
downloadlibyang2-upstream.tar.xz
libyang2-upstream.zip
Adding upstream version 2.1.148.upstream/2.1.148upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tools/lint/examples/README.md')
-rw-r--r--tools/lint/examples/README.md75
1 files changed, 70 insertions, 5 deletions
diff --git a/tools/lint/examples/README.md b/tools/lint/examples/README.md
index 604591c..93d3c2a 100644
--- a/tools/lint/examples/README.md
+++ b/tools/lint/examples/README.md
@@ -33,11 +33,11 @@ combination with the command name you are interested in:
```
> help searchpath
Usage: searchpath [--clear] [<modules-dir-path> ...]
- Set paths of directories where to search for imports and
- includes of the schema modules. The current working directory
- and the path of the module being added is used implicitly.
- The 'load' command uses these paths to search even for the
- schema modules to be loaded.
+ Set paths of directories where to search for imports and includes
+ of the schema modules. Subdirectories are also searched. The current
+ working directory and the path of the module being added is used implicitly.
+ The 'load' command uses these paths to search even for the schema modules
+ to be loaded.
```
The input files referred in this document are available together with this
@@ -469,3 +469,68 @@ ietf-ip features:
}
}
```
+
+## YANG modules with the Schema Mount extension
+
+In these examples the non-interactive `yanglint` is used to simplify creating the context, a `yang-library` data file is
+used. The working directory is `libyang/tools/lint/examples` and *libyang* must be installed.
+
+**Print tree output of a model with Schema Mount**
+
+Command and its output:
+
+```
+$ yanglint -f tree -p . -Y sm-context-main.xml -x sm-context-extension.xml sm-main.yang
+module: sm-main
+ +--mp root* [node]
+ | +--rw node string
+ +--mp root2
+ +--rw root3
+ +--mp my-list* [name]
+ +--rw things/* [name]
+ | +--rw name -> /if:interfaces/if:interface/if:name
+ | +--rw attribute? uint32
+ +--rw not-compiled/
+ | +--rw first? string
+ | +--rw second? string
+ +--rw interfaces@
+ | +--rw interface* [name]
+ | +--rw name string
+ | +--rw type identityref
+ +--rw name string
+```
+
+**Validating and printing mounted data**
+
+Command and its output:
+
+```
+$ yanglint -f json -t config -p . -Y sm-context-main.xml -x sm-context-extension.xml sm-data.xml
+{
+ "ietf-interfaces:interfaces": {
+ "interface": [
+ {
+ "name": "eth0",
+ "type": "iana-if-type:ethernetCsmacd"
+ },
+ {
+ "name": "eth1",
+ "type": "iana-if-type:ethernetCsmacd"
+ }
+ ]
+ },
+ "sm-main:root3": {
+ "my-list": [
+ {
+ "name": "list item 1",
+ "sm-extension:things": [
+ {
+ "name": "eth0",
+ "attribute": 1
+ }
+ ]
+ }
+ ]
+ }
+}
+```