Skip to main content

Building inventory for the Yangson Python tool

Project description

Python Version

Yangson inventory builder

This tool generates the inventory file, which is used by the Yangson python library to create a python object representation of an YANG model.

Installation and usage

To install the tool:

pip install yangson-inventory-builder

At the moment only Nokia YANG models are processed. For example, 7x50 YANG Model version 20.10.

To prepare an inventory file:

from yangson_inventory_builder.inventory_builder import NokiaYangsonInventory
from yangson_inventory_builder.inventory_classes import YangsonInventoryRequest

inventory_request: YangsonInventoryRequest = YangsonInventoryRequest(
    yang_directory=Path("7x50_YangModels-sros_20.10/YANG/"),
    root_config_module=Path("7x50_YangModels-sros_20.10/YANG/nokia-conf.yang"),
    target_inventory_file_name=Path("nokia_20_10_yangson_library.json")
)

yangson_inventory: NokiaYangsonInventory = NokiaYangsonInventory(inventory_request)
yangson_inventory.create_inventory_file()

Then use it in a Yangson to get a root container:

from yangson.datamodel import DataModel
yangson_data_model: DataModel = DataModel.from_file(name=inventory_request.target_inventory_file_name.__str__(),
                                                        mod_path=(inventory_request.yang_directory.__str__(),))
root_container: list = yangson_data_model.schema.children[0].children

Project details


Download files

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

Source Distribution

yangson_inventory_builder-0.1.2.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

yangson_inventory_builder-0.1.2-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

Details for the file yangson_inventory_builder-0.1.2.tar.gz.

File metadata

File hashes

Hashes for yangson_inventory_builder-0.1.2.tar.gz
Algorithm Hash digest
SHA256 373cea53d9858c5d593334202e61e7b68a2b2972aa586b61937d57a1aeebaddd
MD5 6325267bf4d2fd8f81f586f89d915702
BLAKE2b-256 c1233c30943eeeaa9404423876f7ded7b7c3c56e24ce1dfbcf04df3e8d2c2d47

See more details on using hashes here.

File details

Details for the file yangson_inventory_builder-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for yangson_inventory_builder-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 aa9de3bb47d5a25763d5c632a084760e40cce92147e25d89d80f49777186323c
MD5 badedfa8231e63c4607afab4164f8150
BLAKE2b-256 e6c6f35bb21d4833d0f0f3979fa0862dbaf23e9599bf08f8b2314a953e6822cf

See more details on using hashes here.

Supported by

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