Building inventory for the Yangson Python tool
Project description
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file yangson_inventory_builder-0.1.2.tar.gz.
File metadata
- Download URL: yangson_inventory_builder-0.1.2.tar.gz
- Upload date:
- Size: 6.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
373cea53d9858c5d593334202e61e7b68a2b2972aa586b61937d57a1aeebaddd
|
|
| MD5 |
6325267bf4d2fd8f81f586f89d915702
|
|
| BLAKE2b-256 |
c1233c30943eeeaa9404423876f7ded7b7c3c56e24ce1dfbcf04df3e8d2c2d47
|
File details
Details for the file yangson_inventory_builder-0.1.2-py3-none-any.whl.
File metadata
- Download URL: yangson_inventory_builder-0.1.2-py3-none-any.whl
- Upload date:
- Size: 6.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aa9de3bb47d5a25763d5c632a084760e40cce92147e25d89d80f49777186323c
|
|
| MD5 |
badedfa8231e63c4607afab4164f8150
|
|
| BLAKE2b-256 |
e6c6f35bb21d4833d0f0f3979fa0862dbaf23e9599bf08f8b2314a953e6822cf
|