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.3.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.3-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for yangson_inventory_builder-0.1.3.tar.gz
Algorithm Hash digest
SHA256 295354b7ab8e9e3cca2a8c5ee0e7ceb8176a047a652c9eca8cfd8af43f612fca
MD5 7b080fcd43e237eaa77defae2da31db6
BLAKE2b-256 62e4fbc9f4e8401a98d437e87fd23f17c8e8584c8bc79cc16a2f075a4be7c490

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for yangson_inventory_builder-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 3909c4e032b19a43b92e4519c11d12f121ee7cc65d08eb7525bda7d012ff2e4f
MD5 20370e262ca831937b091dfe1754c1d9
BLAKE2b-256 72961cff38a27a52ae4da98fd062dedb6372d62c21a678da094670b54a9a3edb

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