{"id":20588735,"url":"https://github.com/ciscodevnet/ydk-gen","last_synced_at":"2025-04-04T01:09:23.944Z","repository":{"id":5803314,"uuid":"53680541","full_name":"CiscoDevNet/ydk-gen","owner":"CiscoDevNet","description":"Generate model-driven APIs from YANG models","archived":false,"fork":false,"pushed_at":"2024-11-30T20:53:54.000Z","size":171404,"stargazers_count":141,"open_issues_count":63,"forks_count":76,"subscribers_count":30,"default_branch":"master","last_synced_at":"2025-03-28T00:11:51.535Z","etag":null,"topics":["c-plus-plus","c-plus-plus-11","python","yang","ydk"],"latest_commit_sha":null,"homepage":"http://ciscodevnet.github.io/ydk-gen/","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CiscoDevNet.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-03-11T16:27:20.000Z","updated_at":"2025-03-06T19:25:41.000Z","dependencies_parsed_at":"2024-09-17T22:35:19.521Z","dependency_job_id":"e1dc5495-1a35-4532-8bdc-e2fce03653ee","html_url":"https://github.com/CiscoDevNet/ydk-gen","commit_stats":{"total_commits":1512,"total_committers":35,"mean_commits":43.2,"dds":0.6746031746031746,"last_synced_commit":"27dd7d85134a62aa9e9fa48edc0359d32b6a31ec"},"previous_names":[],"tags_count":29,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CiscoDevNet%2Fydk-gen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CiscoDevNet%2Fydk-gen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CiscoDevNet%2Fydk-gen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CiscoDevNet%2Fydk-gen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CiscoDevNet","download_url":"https://codeload.github.com/CiscoDevNet/ydk-gen/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247103307,"owners_count":20884023,"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":["c-plus-plus","c-plus-plus-11","python","yang","ydk"],"created_at":"2024-11-16T07:26:11.910Z","updated_at":"2025-04-04T01:09:18.933Z","avatar_url":"https://github.com/CiscoDevNet.png","language":"C++","readme":"\u003c!---\n# *************************************************************\n#  YDK-YANG Development Kit\n#  Copyright 2016-2019 Cisco Systems. All rights reserved\n# *************************************************************\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements.  See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership.  The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License.  You may obtain a copy of the License at\n#\n#   http:#www.apache.org/licenses/LICENSE-2.0\n#\n#  Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied.  See the License for the\n# specific language governing permissions and limitations\n# under the License.\n# *************************************************************\n# This file has been modified by Yan Gorelik, YDK Solutions.\n# All modifications in original under CiscoDevNet domain\n# introduced since October 2019 are copyrighted.\n# All rights reserved under Apache License, Version 2.0.\n# *************************************************************\n--\u003e\n[![Codacy Badge](https://api.codacy.com/project/badge/Grade/6e111527081b48e1b2252c3562e08a3b)](https://www.codacy.com/app/ydk/ydk-gen?utm_source=github.com\u0026utm_medium=referral\u0026utm_content=CiscoDevNet/ydk-gen\u0026utm_campaign=badger)\n[![License](https://cloud.githubusercontent.com/assets/17089095/19458582/dd626d2c-9481-11e6-8019-8227c5c66a06.png)](https://github.com/CiscoDevNet/ydk-gen/blob/master/LICENSE) [![Build Status](https://travis-ci.org/CiscoDevNet/ydk-gen.svg?branch=master)](https://travis-ci.org/CiscoDevNet/ydk-gen)\n[![codecov](https://codecov.io/gh/CiscoDevNet/ydk-gen/branch/master/graph/badge.svg)](https://codecov.io/gh/CiscoDevNet/ydk-gen)\n[![Docker Automated build](https://img.shields.io/docker/automated/jrottenberg/ffmpeg.svg)](https://hub.docker.com/r/ydkdev/ydk-gen/)\n\n![ydk-logo-128](https://cloud.githubusercontent.com/assets/16885441/24175899/2010f51e-0e56-11e7-8fb7-30a9f70fbb86.png)\n\nYANG Development Kit\n====================\n\n\u003c!-- START doctoc generated TOC please keep comment here to allow auto update --\u003e\n\u003c!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --\u003e\n**Table of Contents**\n\n- [Overview](#overview)\n- [Backward Compatibility](#backward-compatibility)\n- [Docker](#docker)\n- [System Requirements](#system-requirements)\n- [Core Installation](#core-installation)\n  - [Installation script](#installation-script)\n  - [Building from source](#building-from-source)\n  - [Adding gNMI service](#adding-gnmi-service)\n- [Generate YDK Components](#generate-ydk-components)\n  - [Build model bundle profile](#build-model-bundle-profile)\n  - [Generate and install model bundle](#generate-and-install-model-bundle)\n  - [Writing your first app](#writing-your-first-app)\n  - [Generating Documentation](#generating-documentation)\n  - [Generating an \"Adhoc\" Bundle](#generating-an-adhoc-bundle)\n- [Notes](#notes)\n  - [Python requirements](#python-requirements)\n  - [C++ requirements](#c-requirements)\n  - [Directory structure](#directory-structure)\n  - [Troubleshooting](#troubleshooting)\n- [Running Unit Tests](#running-unit-tests)\n  - [Python](#python)\n  - [C++](#c)\n  - [Go](#go)\n- [Documentation and Support](#documentation-and-support)\n- [Release Notes](#release-notes)\n\n\u003c!-- END doctoc generated TOC please keep comment here to allow auto update --\u003e\n\n# Overview\n\nThe YANG Development Kit (YDK) is a software development tool, which provides API for building applications based on YANG models.\nThe YDK allows generate YANG model API and provides services to apply generated API over various communication protocols.\nCurrently implemented protocols are: Netconf, Restconf, OpenDaylight and gNMI.\nYDK provides CRUD and protocol specific services over above protocols.\nYDK also provides codec services to translate API models to/from XML and JSON encoded strings.\n\nThe YDK is a multi-language software. Currently supported languages are Python, Go, and C++.\n\nOther tools and libraries are used to deliver `YDK` functionality:\n* YANG model analysis and code generation is implemented using APIs from the [pyang](https://github.com/mbj4668/pyang) library\n* Documentation is generated using [Sphinx](http://www.sphinx-doc.org/en/stable/)\n* Runtime YANG model analysis is done using [libyang](https://github.com/CESNET/libyang)\n* C++ to python bindings are created using [pybind11](https://github.com/pybind/pybind11)\n* C++ uses [catch](https://github.com/catchorg/Catch2) and [spdlog](https://github.com/gabime/spdlog) for tests and logging respectively\n\nThe output of ydk-gen is either a core package, that defines main services and providers,\nor add-on service package like gNMI Service, or a module bundle, consisting of programming language APIs derived from YANG models.\nEach module bundle is generated using a bundle profile and the ydk-gen tool.\nDevelopers can either use pre-packaged generated bundles,\nor define their own bundle, consisting of a set of YANG models, using a bundle profile\n(e.g. [`ietf_0_1_5.json`](profiles/bundles/ietf_0_1_5.json)).\nThis gives the developer an ability to customize scope of their bundle based on their requirements.\n\n\n# Backward Compatibility\n\nThe YDK-0.8.6 core is backward compatible with all previously generated model bundles starting from release of YDK-0.7.3.\nHowever the YDK-0.8.6 generates different code and model API comparing to YDK-0.8.4.\nThe YDK-0.8.6 generated code is not compatible with YDK-0.7.2 and earlier bundle packages due to changes in modeling and handling of YList objects.\n\n**NOTE.** Starting from release 0.8.6 the YDK does not support Python2 interpreter as it was deprecated.\n\n# Docker\n\nA [docker image](https://docs.docker.com/engine/reference/run/) is automatically built with the latest ydk-gen commit.\nThis docker can be used to run ydk-gen without installing anything natively on your platform.\n\nTo use the docker image, [install docker](https://docs.docker.com/install/) on your system and run the below command.\nSee the [docker documentation](https://docs.docker.com/engine/reference/run/) for more details.\n\n```\ndocker run -it ydksolutions/ydk-gen:0.8.6.6\n```\n\n# System Requirements\n\nThe YDK is currently supported on the following platforms including native installations, virtual machines, and docker images:\n - Linux Ubuntu Xenial (16.04 LTS), Bionic (18.04 LTS), Focal (20.04 LTS), Jammy (22.04 LTS) and Noble (24.04 LTS)\n - Linux CentOS versions 7 and Centos Stream 8 (Centos 8.x has been EOL as of December 31 of 2021)\n - Linux RHEL version 7.x and 8.x \n - MacOS up to 11.6.2 (Big Sur)\n\nOn Windows 10 the Linux virtual machine can run using Windows Subsystem for Linux (WSL);\ncheck [this](https://www.windowscentral.com/install-windows-subsystem-linux-windows-10) for virtual machine installation procedure.\nThe YDK has been tested in such environment on Ubuntu Bionic (18.04 LTS) and Focal (20.04 LTS) images obtained\nfrom Microsoft Store.\n\nOn supported platforms the YDK can be installed using [installation script](#installation-script).\nOn other platforms the YDK should be installed manually [from source](#building-from-source).\nFor both the methods the user must install `git` package prior to the installation procedure.\n\nAll YDK core components are based on C and C++ code. These components compiled using default compilers for the supported platform.\nCorresponding binaries, libraries, and header files are installed in default locations,\nwhich are `/usr/local/bin`, `/usr/local/lib`, and `/usr/local/include`.\nThe user must have sudo access in order to install YDK core components to these locations.\nMake sure the `sudo` package is installed on your platform prior to the YDK installation procedure.\n\n# Core Installation\n\n## Installation script\n\nFor YDK installation it is recommended to use script `install_ydk.sh` from `ydk-gen` git repository.\nThe script detects platform OS, installs all the dependencies and builds complete set of YDK components for specified language.\n\nIf the script installs any YDK component, it also creates an environment activation file '.env' in the 'ydk-gen'\ndirectory, which can be used to activate YDK runtime environment identical to the installation environment.\nTo activate YDK runtime environment simply run this command once in bash shell:\n\n```\ncd ydk-gen\nsource .env\n```\n\nThe YDK extensively uses Python scripts for building its components and model API packages (bundles).\nIn order to isolate YDK Python environment from system installation, the script can build Python3 virtual environment.\nIf built, the user must manually activate virtual environment when generating model bundles and/or running YDK based application.\nBy default the Python virtual environment is installed under `$HOME/venv` directory.\nFor different location the PYTHON_VENV environment variable should be set to that location.\n\n**NOTE.** It is strongly recommended to use Python virtual environment on Centos/RHEL and Mac platforms.\n\nWhen installing YDK for Python or Go programming languages, the third party dependencies and C++ packages must be installed first.\nThis step requires sudo/root access to the installation platform.\nHere is simple example of core YDK installation for Python programming language and Python virtual environment:\n\n```\ngit clone https://github.com/ygorelik/ydk-gen.git\ncd ydk-gen\nexport YDKGEN_HOME=`pwd`  # optional\nexport PYTHON_VENV=$HOME/ydk_vne  # optional\n./install_ydk.sh --cpp --core --venv   # This step requires sudo access!\n./install_ydk.sh --py --core --venv\n```\n\nThe script also allows installing individual components like dependencies, core, and service packages\nfor specified programming language or for all supported languages.\nFull set of script capabilities could be viewed like this:\n\n```\n./install_ydk.sh --help\nusage: install_ydk [ {--cpp|--py|--go|--all} ] [-c] [-s gnmi] [-h] [-n] [-v]\nOptions and arguments:\n  --cpp                 install YDK for C++ programming language;\n                        requires sudo access for dependencies and libraries installation\n  --go                  install YDK for Go programming language\n  --py|--python         install YDK for Python programming language\n  --all                 install YDK for all available programming languages;\n                        requires sudo access for dependencies and libraries installation\n  -v|--venv             create python virtual environment\n  -c|--core             install YDK core package\n  -s|--service gnmi     install gNMI service package\n  -n|--no-deps          skip installation of dependencies;\n                        applicable only with --cpp and --all options\n  -h|--help             print this help message and exit\n\nEnvironment variables:\nYDKGEN_HOME         specifies location of ydk-gen git repository;\n                    if not set, $HOME/ydk-gen is assumed\nPYTHON_VENV         specifies location of python virtual environment;\n                    if not set, $HOME/venv is assumed\nGOROOT              specifies installation directory of go software;\n                    if not set, /usr/local/go is assumed\nGOPATH              specifies location of go source directory;\n                    if not set, $HOME/go is assumed\nC_INCLUDE_PATH      location of C include files;\n                    if not set, /usr/local/include is assumed\nCPLUS_INCLUDE_PATH  location of C++ include files;\n                    if not set, /usr/local/include is assumed\nCMAKE_LIBRARY_PATH  Location of Python shared libraries;\n                    if not set, default system library location is assumed\n```\n\nIf user environment is different from the default one (different Python installation or different\nlocation of libraries) then building from source method should be used.\n\n## Building from source\n\n### Environment variables\n\nIn some OS configurations during YDK package installation the cmake fails to find C/C++ headers for previously installed YDK libraries.\nIn this case the header files location must be specified explicitly (in below commands the default location is shown):\n\n```\n  export C_INCLUDE_PATH=/usr/local/include\n  export CPLUS_INCLUDE_PATH=/usr/local/include\n```\n\nWhen non-standard Python installation is used or there are multiple installations of Python on the platform,\nthe PATH and CMAKE_LIBRARY_PATH environment variables must be set accordingly in order for the installation scripts\nto pick up correct Python binaries and shared libraries.\n\n### Installing third party dependencies\n\nIf user platform is supported one, it is recommended to use `ydk-gen/install_ydk.sh` script. \nThe script will also install Python virtual environment in default or specified location, when '--venv' is specified.\n\n```\n# Clone ydk-gen from GitHub\ngit clone https://github.com/ygorelik/ydk-gen.git\ncd ydk-gen\n\n# Define optional environment variables and install dependencies\nexport YDKGEN_HOME=`pwd`  \nexport PYTHON_VENV=$HOME/ydk_venv\n./install_ydk.sh -v   # also builds Python virtual environment\n```\n\nFor unsupported platforms it is recommended to follow logic of `ydk-gen/test/dependencies-*` scripts.\n \n### Installing core components\n\n```\n# If created, activate YDK runtime environment\nsource .env\n\n# Generate and install YDK core library\npython3 generate.py -is --core --cpp\n\n# For Python programming language add\npython3 generate.py -i --core --py\n\n# For Go programming language add\npython3 generate.py -i --core --go\n```\n\n## Adding gNMI service\n\nIn order to enable YDK support for gNMI protocol, which is optional, the user need install third party software\nand YDK gNMI service package. \n\n### gNMI service installation\n\nHere is simple example how gNMI service package for Python virtual environment could be added:\n\n```\ncd ydk-gen\n./install_ydk.sh --cpp --service gnmi -v  # requires sudo access\n./install_ydk.sh --py --service gnmi -v\n```\n\n### Runtime environment\n\nWhen YDK is installed using 'install_ydk.sh' script, the runtime environment is set by running 'source .env' in bash shell.\nThe below information is applicable only when YDK is installed manually, which is not recommended.\n\nThere is an open issue with gRPC on Centos/RHEL, which requires an extra step before running any YDK gNMI application.\nSee this issue on [GRPC GitHub](https://github.com/grpc/grpc/issues/10942#issuecomment-312565041) for details.\nAs a workaround, the YDK based application runtime environment must include setting of `LD_LIBRARY_PATH` variable:\n\n```\nexport LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib:/usr/local/lib64\n```\n\n# Generate YDK components\n\nAll the YDK components/packages can be generated by using Python script `generate.py`. To get all of its options run:\n\n```\ncd ydk-gen\nsource .env\npython3 generate.py --help\nusage: generate.py [-h] [-l] [--core] [--service SERVICE] [--bundle BUNDLE]\n                   [--adhoc-bundle-name ADHOC_BUNDLE_NAME]\n                   [--adhoc-bundle ADHOC_BUNDLE [ADHOC_BUNDLE ...]]\n                   [--generate-meta] [--generate-doc] [--generate-tests]\n                   [--output-directory OUTPUT_DIRECTORY] [--cached-output-dir]\n                   [-p] [-c] [-g] [-v] [-o]\n\nGenerate YDK artifacts:\n\noptional arguments:\n  -h, --help            show this help message and exit\n  -l, --libydk          Generate libydk core package\n  --core                Generate and/or install core library\n  --service SERVICE     Location of service profile JSON file\n  --bundle BUNDLE       Location of bundle profile JSON file\n  --adhoc-bundle-name ADHOC_BUNDLE_NAME\n                        Name of the adhoc bundle\n  --adhoc-bundle ADHOC_BUNDLE [ADHOC_BUNDLE ...]\n                        Generate an SDK from a specified list of files\n  --generate-meta       Generate meta-data for Python bundle\n  --generate-doc        Generate documentation\n  --generate-tests      Generate tests\n  --output-directory OUTPUT_DIRECTORY\n                        The output directory where the sdk will get created.\n  --cached-output-dir   The output directory specified with --output-directory\n                        includes a cache of previously generated gen-\n                        api/\u003clanguage\u003e files under a directory called 'cache'.\n                        To be used to generate docs for --core\n  -p, --python          Generate Python SDK\n  -c, --cpp             Generate C++ SDK\n  -g, --go              Generate Go SDK\n  -v, --verbose         Verbose mode\n  -o, --one-class-per-module\n                        Generate separate modules for each python class\n                        corresponding to YANG containers or lists.\n```\n\nThe below steps specify how to use `generate.py` to generate YDK core, model bundle, and service packages.\nIn all the examples the script is executed from `ydk-gen` directory. \nIt is assumed that Python virtual environment is activated.\n\n## Build model bundle profile\n\nThe first step in using ydk-gen is either using one of the already built \n[bundle profiles](https://github.com/ygorelik/ydk-gen/tree/master/profiles/bundles) or constructing your own \nbundle profile, consisting of the YANG models you are interested to include into the bundle:\n\nConstruct a bundle profile file, such as [```ietf_0_1_5.json```](profiles/bundles/ietf_0_1_5.json)\nand specify its dependencies.\n\nA sample bundle profile file is described below. The file is in a JSON format. The profile must define the `\"name\"`, \n`\"version\"` and `\"description\"` of the bundle, and then the `\"core_version\"`, which refers to \n[the version](https://github.com/CiscoDevNet/ydk-gen/releases) of the ydk core package that you want to use with this bundle.\nThe `\"name\"` of the bundle will form part of the installation path of the bundle.\nAll other attributes, like `\"author\"` and `\"copyright\"`, are optional and will not affect the bundle generation. \n\n```\n{\n    \"name\":\"cisco-ios-xr\",\n    \"version\": \"6.5.3\",\n    \"core_version\": \"0.8.6\",\n    \"author\": \"Cisco\",\n    \"copyright\": \"Cisco\",\n    \"description\": \"Cisco IOS-XR Native Models From Git\",\n```\n\nThe `\"models\"` section of the profile describes sources of YANG models. It could contain combination of elements:\n\n- `\"dir\"` - list of **relative** directory paths containing YANG files\n- `\"file\"` - list of **relative** YANG file paths\n- `\"git\"` - git repository, where YANG files are located\n\nThe sample below shows the use of git sources only. Other examples can be found in `profiles` directory README.md.\n\nEach `\"git\"` source must specify `\"url\"` - git repository URL, and `\"commits\"` list. The specified URL must allow the repository\nto be cloned without user intervention. Each element in `\"commits\"` list can specify:\n\n- `\"commitid\"` - optional specification of a commit ID in string format. If not specified the HEAD revision is assumed.\nThe further specified directories and files will be copied from the context of this commit.\n- `\"dir\"` - optional list of **relative** directory paths within the git repository.\nAll `*.yang` files in specified directory **and any sub-directories** will be pulled into the generated bundle.\n- `\"file\"` - optional list of **relative** `*.yang` file paths within the git repository.\n\nOnly directory examples are shown in this example.\n\n```\n    \"models\": {\n        \"git\": [\n            {\n                \"url\": \"https://github.com/YangModels/yang.git\",\n                \"commits\": [\n                  {\n                    \"dir\": [\n                        \"vendor/cisco/xr/653\"\n                    ]\n                  }\n                ]\n            },\n            {\n                \"url\": \"https://github.com/YangModels/yang.git\",\n                \"commits\": [\n                  {\n                    \"commitid\": \"f6b4e2d59d4eedf31ae8b2fa3119468e4c38259c\",\n                    \"dir\": [\n                        \"experimental/openconfig/bgp\",\n                        \"experimental/openconfig/policy\"\n                    ]\n                  }\n                ]\n            }\n        ]\n    },\n```\n\n## Generate and install model bundle\n\nGenerate model bundle using a bundle profile and install it.\nYDK runtime environment must be activated prior to these procedures.\n\n### For Python\n\nIf applicable, the Python virtual environment must be activated prior to these procedures\n\n```\npython3 generate.py --python --bundle profiles/bundles/\u003cname-of-profile\u003e.json -i\n```\n\nCheck Python packages installed:\n\n```\npip list | grep ydk\nydk (0.8.6.6)\nydk-models-\u003cname-of-bundle\u003e (0.5.1)\n...\n```\n\n### For Go\n\n```\npython3 generate.py --go --bundle profiles/bundles/\u003cname-of-profile\u003e.json -i\n```\n\n### For C++\n\n```\npython3 generate.py --cpp --bundle profiles/bundles/\u003cname-of-profile\u003e.json -is\n```\n\n## Writing your first app\n\nNow, you can start creating apps based on the models in your bundle.\nAssuming you have generated a python bundle, the models will be available for importing in your app under\n`ydk.models.\u003cname-of-your-bundle\u003e`.\nFor examples, see [C++ samples](sdk/cpp/samples).\nAlso refer to the [documentation for python](http://ydk.cisco.com/py/docs/developer_guide.html),\n[Go](http://ydk.cisco.com/go/docs/developer_guide.html) and\n[C++](http://ydk.cisco.com/cpp/docs/developer_guide.html).\n\n## Generating Documentation\n\nIn order to generate YDK core and bundles documentation, the `--generate-doc` option of `generate.py` script is used, \nwhile generating core package. Therefore the user should generate all the bundles without the `--generate-doc` \noption prior to the documentation generation.\nFor example, the below sequence of commands will generate the documentation for the three python bundles and the python core\n(for C++, use `--cpp`; for Go, use `--go`).\n\n```\npython3 generate.py --python --bundle profiles/bundles/ietf_0_1_1.json\npython3 generate.py --python --bundle profiles/bundles/openconfig_0_1_1.json\npython3 generate.py --python --bundle profiles/bundles/cisco_ios_xr_6_1_1.json\npython3 generate.py --python --core --generate-doc\n```\n\n**Note.** The documentation generation for bundles can take few hours due to their size. If you have previously \ngenerated documentation using the `--cached-output-dir --output-directory \u003cdir\u003e` option,\nthe add-on documentation generation time can be reduced. Adding cisco-ios-xr documentation as an example:\n\n```\nmkdir gen-api/cache\nmv gen-api/python gen-api/cache\n\npython3 generate.py --python --bundle profiles/bundles/cisco_ios_xr_6_6_3.json\npython3 generate.py --python --core --generate-doc --output-directory gen-api --cached-output-dir\n```\n\n## Generating an \"Adhoc\" Bundle\n\nWhen YANG models available on the hard drive, there is capability to generate small model bundles, which include\njust few models. It is called an \"adhoc\" bundle. Such a bundle generated without profile directly from command line.\nHere is simple example:\n\n```\npython3 generate.py -i --adhoc-bundle-name test --adhoc-bundle \\\n    /opt/git-repos/clean-yang/vendor/cisco/xr/621/Cisco-IOS-XR-ipv4-bgp-oper*.yang \\\n    /opt/git-repos/clean-yang/vendor/cisco/xr/621/Cisco-IOS-XR-types.yang\n    /opt/git-repos/clean-yang/vendor/cisco/xr/621/Cisco-IOS-XR-ipv4-bgp-datatypes.yang\n```\n\nThis will generate a bundle that contains files specified in the `--adhoc-bundle` option and\ncreate Python package `ydk-models-test-0.1.0.tar.gz`, which has dependency on the base IETF bundle.\nNote that **all** dependencies for the bundle must be listed. It is expected that this option will be typically used\nfor generating point model bundles for specific testing. The `--verbose` option is automatically enabled to quickly\nand easily let the user see if dependencies have been satisfied.\n\n# Notes\n\n## Python requirements\n\nStarting from release 0.8.5 YDK supports only Python3 version.  At least Python 3.5 along with corresponding pip3 utility \nmust be installed on your system. It is also required for Python installation to include corresponding shared \nlibrary. As example:\n\n - python3.6m - /usr/lib/x86_64-linux-gnu/libpython3.6m.so\n\nIt is recommended to follow [Core Installation](#core-installation) procedure to ensure presence of shared Python libraries.\n\n## C++ requirements\n\nIn some OS configurations during YDK package installation the `cmake` fails to find C/C++ headers for installed YDK libraries.\nIn this case the header location must be specified explicitly:\n\n```\nexport C_INCLUDE_PATH=/usr/local/include\nexport CPLUS_INCLUDE_PATH=/usr/local/include\n```\n\n## Directory structure\n\n```\ngen-api         - generated code and packages for core and bundles\n                    - python (Python SDK)\n                    - go (Go SDK)\n                    - cpp (C++ SDK)\n\n3d_party        - suplemental code for third party software\nprofiles        - profile files used during generation\nsdk             - sdk core and stubs for python, go and cpp\ntest            - dependencies and unit test shell scripts\nyang            - some YANG models used for testing\nydkgen          - python code to extend generate.py script \n\ncreate_ydk_sdk_for_github.sh - convenience script to generate language specific repositories\ngenerate_bundles.sh          - convinience script to generate core and bundle packages for deployment\n\ngenerate.py     - script used to generate SDK for YANG models\ninstall_ydk.sh  - YDK core components installation script\nrequirements.txt- python dependencies used during installation\nREADME.md       - installation and usage notes\n```\n\n## Troubleshooting\n\nSometimes, developers using ydk-gen may run across errors when generating a YDK bundle using generate.py with some yang models.\nIf there are issues with the profile file being used, such JSON formatting errors will be evident.\nOther times, when the problem is not so evident, it is recommended to try running the script with the\n`[--verbose|-v]` flag, which may reveal syntax problems with the YANG models being used. For example:\n\n```\npython3 generate.py --python --bundle profiles/bundles/ietf_0_1_1.json --verbose\n```\n\nAlso, it may be a good idea to obtain a local copy of the YANG models and compile them using `pyang` to ensure\nthe validity of the models and completeness of the model package:\n\n```\ncd /path/to/yang/models\npyang *.yang\n```\n\n## Running Unit Tests\n\nThe repository includes complete set of unit tests for all supported languages. To invoke the test for specific language,\nsimply get to 'ydk-gen' directory, activate runtime environment, if it was not done previously, and run language specific script.\nThe script will install core and bundle packages and then perform the unit tests.\n\n**C++**\n\n    ```\n    cd ydk-gen\n    source .env  # if previously not run\n    ./test/run_cpp_tests\n    ```\n\n**Python**\n\n    ```\n    cd ydk-gen\n    source .env  # if previously not run\n    ./test/run_py_tests\n    ```\n\n**Go**\n\n    ```\n    cd ydk-gen\n    source .env  # if previously not run\n    ./test/run_go_tests\n    ```\n\n# Documentation and Support\n\n\u003c!--- - Read the online [YDK documentation](http://ydk.cisco.com/py/docs) (release 0.8.3) for details on how to use the YDK and API for specific models --\u003e\n- Check [GitHub Pages](https://ygorelik.github.io/ydk-gen/) for the latest YDK release documentation\n- Find hundreds of sample apps in the [ydk-py-samples](https://github.com/CiscoDevNet/ydk-py-samples) repository\n- Join the [YDK community](https://communities.cisco.com/community/developer/ydk) to connect with YDK users and developers\n\n# Release Notes\n\nThe current YDK release version is 0.8.6.6.\n\nYDK-Gen is licensed under the Apache 2.0 License.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fciscodevnet%2Fydk-gen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fciscodevnet%2Fydk-gen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fciscodevnet%2Fydk-gen/lists"}