hellt / yangpath

YANG Paths exporter
https://yangpath.netdevops.me
Apache License 2.0
30 stars 2 forks source link
gnmi goyang netconf network openconfig restconf yang

github release Github all releases Go Report Doc build


yangpath is an XPATH/RESTCONF-styled schema paths exporter with superpowers.

The exported paths can be immediately used in your NETCONF/RESTCONF or gNMI applications.

Documentation available at https://yangpath.netdevops.me

XPATH paths

$ yangpath export --yang-dir ~/openconfig/public/ \
                    --module ~/openconfig/public/release/models/interfaces/openconfig-interfaces.yang
[rw]  /interfaces/interface[name=*]/config/description  string
[rw]  /interfaces/interface[name=*]/config/enabled  boolean
[rw]  /interfaces/interface[name=*]/config/loopback-mode  boolean
[rw]  /interfaces/interface[name=*]/config/mtu  uint16
[rw]  /interfaces/interface[name=*]/config/name  string
[rw]  /interfaces/interface[name=*]/config/type  identityref->ietf-if:interface-type
<SNIPPED>

RESTCONF paths

$ yangpath export --yang-dir ~/openconfig/public/ \
                    --module ~/openconfig/public/release/models/interfaces/openconfig-interfaces.yang
                    --style restconf
[rw]  /interfaces/interface=name/config/description  string
[rw]  /interfaces/interface=name/config/enabled  boolean
[rw]  /interfaces/interface=name/config/loopback-mode  boolean
[rw]  /interfaces/interface=name/config/mtu  uint16
[rw]  /interfaces/interface=name/config/name  string
[rw]  /interfaces/interface=name/config/type  identityref->ietf-if:interface-type

Features

Quick Start

Install

Use the following installation script to install the latest version.

sudo curl -sL https://github.com/hellt/yangpath/raw/master/install.sh | sudo bash

Alternatively, leverage the system packages or docker images.

Export paths

To export the paths from a given module:

# assuming cur working dir is the root of openconfig repo
yangpath export -m release/models/interfaces/openconfig-interfaces.yang

Generate HTML path browser

To create HTML with paths out of template, leverage templating capabilities of yangpath.