Skip to main content

A pyang plugin to produce a JSON representation of module trees for use in graph libraries

Project description

# A pyang plugin to produce a JSON representation of module trees for use in graph libraries

This simplistic pyang plugin produces a JSON representation from YANG files. The output can be fed through a variety of libraries for data visualization. Development is mainly done for use with [D3](https://d3js.org/), e.g. using [Hierarchies (d3-hierarchy)](https://github.com/d3/d3/blob/master/API.md#hierarchies-d3-hierarchy).

Some libraries require certain objects, e.g. D3 expects `name` and `children` objects for structure. This may need to be adjusted in the plugin code for other libraries. Should likely be moved to options.

## Example
```
$ pyang -f jsontree ietf-interfaces\@2014-05-08.yang
{
"contact": "WG Web: <http://tools.ietf.org/wg/netmod/>\nWG List: <mailto:netmod@ietf.org>\n\nWG Chair: Thomas Nadeau\n <mailto:tnadeau@lucidvision.com>\n\nWG Chair: Juergen Schoenwaelder\n <mailto:j.schoenwaelder@jacobs-university.de>\n\nEditor: Martin Bjorklund\n <mailto:mbj@tail-f.com>",
"name": "ietf-interfaces",
"organization": "IETF NETMOD (NETCONF Data Modeling Language) Working Group",
"type": "module",
"children": [
{
"description": "Interface configuration parameters.",
"type": "container",
"name": "interfaces",
"children": [
{
"description": "The list of configured interfaces on the device.\n\nThe operational state of an interface is available in the\n/interfaces-state/interface list. If the configuration of a\nsystem-controlled interface cannot be used by the system\n(e.g., the interface hardware present does not match the\ninterface type), then the configuration is not applied to\nthe system-controlled interface shown in the\n/interfaces-state/interface list. If the configuration\nof a user-controlled interface cannot be used by the system,\nthe configured interface is not instantiated in the\n/interfaces-state/interface list.",
"type": "list",
"name": "interface",
"children": [
{
"description": "The name of the interface.\n\nA device MAY restrict the allowed values for this leaf,\npossibly depending on the type of the interface.\nFor system-controlled interfaces, this leaf is the\ndevice-specific name of the interface. The 'config false'\nlist /interfaces-state/interface contains the currently\nexisting interfaces on the device.\n\nIf a client tries to create configuration for a\nsystem-controlled interface that is not present in the\n/interfaces-state/interface list, the server MAY reject\nthe request if the implementation does not support\npre-provisioning of interfaces or if the name refers to\nan interface that can never exist in the system. A\nNETCONF server MUST reply with an rpc-error with the\nerror-tag 'invalid-value' in this case.\n\nIf the device supports pre-provisioning of interface\nconfiguration, the 'pre-provisioning' feature is\nadvertised.\n\nIf the device allows arbitrarily named user-controlled\ninterfaces, the 'arbitrary-names' feature is advertised.\n\nWhen a configured user-controlled interface is created by\nthe system, it is instantiated with the same name in the\n/interface-state/interface list.",
"type": "leaf",
"name": "name",
"children": []
}
]
}
]
}
[...]
]
}
```

Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyang-jsontree-plugin-0.1.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

pyang_jsontree_plugin-0.1-py2.py3-none-any.whl (6.2 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file pyang-jsontree-plugin-0.1.tar.gz.

File metadata

File hashes

Hashes for pyang-jsontree-plugin-0.1.tar.gz
Algorithm Hash digest
SHA256 89fb3216c61ec034f3fa6bc4a82fea457f41ac3b18cdf2b8987f361ff5031983
MD5 c661cff674a13b5836960a31cc6ca56a
BLAKE2b-256 c52011a6db5e958f91fac1cb7515a7668489db214e3b4bdc7b5880bee2ca7adf

See more details on using hashes here.

File details

Details for the file pyang_jsontree_plugin-0.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for pyang_jsontree_plugin-0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 91da3626d79185a06f85597729419a8375ebfa6fc4d705e5cc6128f8e7878fc6
MD5 a958df55b8975c033894dcfd087e70f5
BLAKE2b-256 624d5a8628aaba7e31586eeeca92f2fbd1adea1aee64a4857432e6e578ead822

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page