diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 04:23:18 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 04:23:18 +0000 |
commit | 16527d165de55f2727f55b752b30d44a7e61e927 (patch) | |
tree | 0840ee6e0e109a9e85f0d80ff36f92587c6a5538 /tools/lint/examples/README.md | |
parent | Releasing progress-linux version 2.1.30-2.1~progress7.99u1. (diff) | |
download | libyang2-16527d165de55f2727f55b752b30d44a7e61e927.tar.xz libyang2-16527d165de55f2727f55b752b30d44a7e61e927.zip |
Merging upstream version 2.1.148.
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.md | 75 |
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 + } + ] + } + ] + } +} +``` |