Skip to content

This tool allows to generate a CLI from a YANG model. The configured data can be transformed into other format (e.g. RESTCONF calls).

Notifications You must be signed in to change notification settings

alexaguado/yang_cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Yang CLI

This tool allows to automatically generate a CLI based on a set of Yang models.

It also permits to generate RESTCONF calls based on the filled data using the CLI.

The pyang plugin "navigator" in the plugin folder generates as an output a "data.txt" file, which is used by the yang_cli.py python script.

How to use

Example for pyang navigator plugin.

pyang -f navigator ietf-l3vpn-svc.yang -p . -o out.tree

Example for yang_cli.py:

python yang_cli.py data.txt

The data.txt provided as an example is based on the L3SM YANG model from IETF (RFC 8299).

Commands

  • save: it allows to save the data in the JSON format used by the tool to store and explore the YANG files.
  • saverc: similar as the previous one, but the JSON complies with RFC 7951. If the data configured does not comply with the standard (e.g. a key is not configured) this command may not succeed.
  • load: it allows to load the data in the JSON format used by the tool to store and explore the YANG files.
  • loadrc: similar as the previous one, but the JSON shall comply with RFC 7951. If the data to be loaded does not comply with the standard (e.g. a given key is not in the file) this command may not succeed.
  • pwd: it displays the path on which the user is.
  • show-config: displays the config done by the user so far.
  • delete: deletes the element on the path where the user is, moving the current path to one step lower in the configuration hierarchy.
  • rc: command to generate RESTCONF calls, following the format shown in IETF RFCs. It asks for the operation to be implemented (POST, PUT, PATCH, DELETE, GET).
  • back: moves the current path to one step lower in the configuration hierarchy.
  • exit: goes out of the yang_cli. Any configuration not saved will disappear.

Dependencies

Pyang

Prompt toolkit: sudo pip install -U prompt-toolkit==2.0.7

About

This tool allows to generate a CLI from a YANG model. The configured data can be transformed into other format (e.g. RESTCONF calls).

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages