{"id":16963931,"url":"https://github.com/hellt/pyang-docker","last_synced_at":"2025-03-21T16:27:43.577Z","repository":{"id":53127940,"uuid":"226300615","full_name":"hellt/pyang-docker","owner":"hellt","description":"PYANG inside Docker","archived":false,"fork":false,"pushed_at":"2023-12-19T19:53:20.000Z","size":19,"stargazers_count":5,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-26T11:45:08.052Z","etag":null,"topics":["network-automation","pyang","pyang-docker","xml-skeleton","yang"],"latest_commit_sha":null,"homepage":"","language":"Dockerfile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hellt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2019-12-06T10:12:14.000Z","updated_at":"2024-02-28T17:36:57.000Z","dependencies_parsed_at":"2023-12-20T11:51:46.421Z","dependency_job_id":"c1b2d9d6-b680-40e4-ac19-250330efe982","html_url":"https://github.com/hellt/pyang-docker","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hellt%2Fpyang-docker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hellt%2Fpyang-docker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hellt%2Fpyang-docker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hellt%2Fpyang-docker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hellt","download_url":"https://codeload.github.com/hellt/pyang-docker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244828220,"owners_count":20517078,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["network-automation","pyang","pyang-docker","xml-skeleton","yang"],"created_at":"2024-10-13T23:26:37.765Z","updated_at":"2025-03-21T16:27:43.545Z","avatar_url":"https://github.com/hellt.png","language":"Dockerfile","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PYANG docker image\n\nThis repo contains the [dockerfile](Dockerfile) to build an image with the [PyYANG](https://github.com/mbj4668/pyang) tool installed inside.\n\nAs well as the following plugins are included:\n\n* [Openconfig plugins](https://github.com/openconfig/oc-pyang) - installed at `/opt/pyang-oc-plugin`\n\n## How to install\n\nPull the `hellt/pyang` image from GitHub container registry with `docker pull ghcr.io/hellt/pyang`.\n\nTo locally build the image, clone the repo and use `docker build -t \u003cyour_repo\u003e/\u003cproject\u003e:\u003ctag\u003e -f \u003cDockerfile\u003e .` command.\n\n## Image tags\n\nThe repo contains two Dockerfiles, one is based on Alpine Linux and has a smaller size, the other one is based on PyPy and has faster execution time.\n\nStarting from pyang 2.5.3, we tag with `latest` tag the PyPy image, and with `alpine` tag the Alpine Linux image.\n\nCheck available tags here - \u003chttps://github.com/hellt/pyang-docker/pkgs/container/pyang/versions\u003e\n\n## Usage\n\n`hellt/pyang` image expects you to mount a directory with YANG models (aka working directory) by the path `/yang/`. The following example demonstrates how to use the tools that are part of the PyYANG project with this configuration in mind:\n\n```bash\n# pyang tool example\n\n# navigate to a dir with the YANG model(s) and run the container\n# assuming the nokia-conf-combined.yang model is in the current directory\n## create a tree representation of a yang model\ndocker run --rm -v $(pwd):/yang ghcr.io/hellt/pyang pyang -f tree nokia-conf-combined.yang\n```\n\nAlong with `pyang`, the following tools are part of the image:\n\n* json2xml\n* pyang\n* yang2dsdl\n* yang2html\n\n### Additional enhancements\n\n#### XML skeleton wrapper\n\nTo simplify the process of getting the XML skeleton for the data modelled in YANG and referenced by its model path the `xmlsk.sh` wrapper has been created. The sole purpose of this wrapper is to remove the prefix from the path string, since pyang's XML_SKELETON does not digest them.\n\nWith `xmlsk.sh` wrapper the workflow of getting the XML skeleton boils down to the following steps:\n\n1. Take a YANG module's `M.yang` jstree (HTML) representation and get the node path (`P`) from the column named `Path`. To make an example: `/state:state/state:users/state:session/state:session-id`;\n2. run the `xmlsk.sh` wrapper with the both the node path and the YANG module referenced as follows:\n\n    ```bash\n    # using the node path and the model from step 1\n    docker run --rm -v $(pwd):/yang hellt/pyang xmlsk.sh \"/state:state/state:users/state:session/state:session-id\" nokia-state-combined.yang\n    ```\n\n3. As a result, you will be presented with an XML skeleton that you can use in your subtree filters.\n\nUnder the hood, the following command is executed inside the container:\n\n```\npyang -f sample-xml-skeleton --sample-xml-skeleton-path \"/state/users/session/session-id\" nokia-state-combined.yang\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhellt%2Fpyang-docker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhellt%2Fpyang-docker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhellt%2Fpyang-docker/lists"}