Skip to content
This repository has been archived by the owner on Nov 2, 2023. It is now read-only.


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time
May 31, 2019 16:27
May 31, 2019 16:27
October 6, 2019 06:24
October 6, 2019 06:24
May 31, 2019 16:27
January 16, 2019 09:43
October 6, 2019 06:24
December 19, 2017 19:34
December 2, 2016 10:47
April 12, 2019 13:43
February 5, 2016 19:49
November 2, 2023 15:01
October 6, 2019 06:24 Docker Automated build

## This project has been archived and the repository will no longer be updated.

YANG Development Kit (Python)


The YANG Development Kit (YDK) is a Software Development Kit that provides API's that are modeled in YANG. The main goal of YDK is to reduce the learning curve of YANG data models by expressing the model semantics in an API and abstracting protocol/encoding details. YDK is composed of a core package that defines services and providers, plus one or more module bundles that are based on YANG models.

Backward Compatibility

The Python YDK-0.8.4 core package is compatible with all model bundles generated previously with ydk-gen releases starting from 0.7.3. Please see the release notes for details.


A docker image is automatically built with the latest ydk-py installed. This be used to run ydk-py without installing anything natively on your machine.

To use the docker image, install docker on your system and run the below command. See the docker documentation for more details:

docker run -it ydkdev/ydk-py

System Requirements


Ubuntu (Debian-based)

The following packages must be present in your system before installing YDK-Py:

# Install Third-party software
sudo apt-get install gdebi-core python3-dev python-dev libtool-bin
sudo apt-get install libcurl4-openssl-dev libpcre3-dev libssh-dev libxml2-dev libxslt1-dev cmake

Download and install YDK core library libydk. You can install the library using prebuilt debian packages for Xenial and Bionic LTS distributions. For other Ubuntu distributions it is recommended to build core library from source.

For Xenial (Ubuntu 16.04.4):

# Upgrade compiler to gcc 5.*
sudo apt-get install gcc-5 g++-5 -y > /dev/null
sudo ln -sf /usr/bin/gcc-5 /usr/bin/cc
sudo ln -sf /usr/bin/g++-5 /usr/bin/c++

sudo gdebi libydk-0.8.4-1.amd64.deb

For Bionic (Ubuntu 18.04.1):

sudo gdebi libydk-0.8.4-1.amd64.deb

Centos (Fedora-based)

The following packages must be present in your system before installing YDK-Py. Currently, only Centos7/RHEL7 are known to work:

# Install Third-party software
sudo yum install epel-release
sudo yum install libssh-devel gcc-c++ python-devel python3-devel

# Upgrade compiler to gcc 5.*
sudo yum install centos-release-scl -y > /dev/null
sudo yum install devtoolset-4-gcc* -y > /dev/null
sudo ln -sf /opt/rh/devtoolset-4/root/usr/bin/gcc /usr/bin/cc
sudo ln -sf /opt/rh/devtoolset-4/root/usr/bin/g++ /usr/bin/c++

# Install YDK core library
sudo yum install


It is required to install Xcode command line tools, homebrew and the following homebrew packages on your system before installing YDK-Py:

xcode-select --install
/usr/bin/ruby -e "$(curl -fsSL"
brew install pkg-config libssh xml2 libxml2 curl pcre cmake pybind11 doxygen libgcrypt

curl -O
sudo installer -pkg libydk-0.8.4-Darwin.pkg -target /

Libssh Installation

The libssh-0.8.0 does not support separate threading library, which is required for YDK. If after installation of libssh package the libssh_threads.a is missing, please downgrade the installation to libssh-0.7.6, or upgrade to libssh-0.8.1 or higher.

Note for MacOS Before installing libssh make sure the environment for openssl is setup:

brew reinstall openssl
export OPENSSL_ROOT_DIR=/usr/local/opt/openssl

Download libssh-0.7.6 source code, compile it and install:

tar zxf libssh-0.7.6.tar.gz && rm -f libssh-0.7.6.tar.gz
mkdir libssh-0.7.6/build && cd libssh-0.7.6/build
cmake ..
sudo make install

gNMI Requirements

In order to enable YDK support for gNMI protocol, which is optional, the following third party software must be installed prior to gNMI YDK component installation.

Install protobuf and protoc
cd protobuf-3.5.0
sudo make install
sudo ldconfig
Install gRPC
git clone -b v1.9.1
cd grpc
git submodule update --init
sudo make install
sudo ldconfig
Instal YDK gNMI library


For Xenial (Ubuntu 16.04.4):

sudo gdebi libydk_gnmi-0.4.0-4.amd64.deb

For Bionic (Ubuntu 18.04.1):

sudo gdebi libydk_gnmi-0.4.0-4.amd64.deb


sudo yum install


curl -O
sudo installer -pkg libydk_gnmi-0.4.0-4.Darwin.pkg -target /
Runtime environment

There is an open issue with gRPC on Centos/Fedora, which requires an extra step before running any YDK gNMI application. See this issue on GRPC GitHub for details. As a workaround, the YDK based application runtime environment must include setting of LD_LIBRARY_PATH variable:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PROTO/grpc/libs/opt:$PROTO/protobuf-3.5.0/src/.libs:/usr/local/lib64

Python Requirements

YDK supports both Python2 and Python3 versions. At least Python2.7 or Python3.4 must be installed on your system.

It is also required for Python installation to include corresponding shared library. As example:

python2.7  - /usr/lib/x86_64-linux-gnu/
python3.5m - /usr/lib/x86_64-linux-gnu/

Please follow System Requirements to assure presence of shared Python libraries.

If you choose to install Python from source (need specific version), please include --enable-shared flag in configure command to include build of shared library:

cd Python3.4.1
./configure --prefix=/opt/python --enable-shared
make install

Here the /opt/python is your Python installation directory. If installation directory is different from the system path, you need to configure CMAKE_LIBRARY_PATH environment variable to assure that cmake uses correct Python library:

export CMAKE_LIBRARY_PATH=/opt/python/lib

Run pip install ydk command with -v option and in the console output note location of found PythonLibs. Make sure it matches with your installed Pyton dynamic library location:

-- Found PythonLibs: /opt/python/lib/

In some OS configurations during YDK package installation the cmake fails to find C/C++ headers for previously installed YDK libraries. In this case the header location must be specified explicitly (in below commands the default location is shown):

export C_INCLUDE_PATH=/usr/local/include
export CPLUS_INCLUDE_PATH=/usr/local/include
Mac OS

The developers of Python2 on Mac OS might face an installation issue. This is well known and documented issue. Each developer might have different approaches for its resolution. One of them is to use Python2 virtual environment. See section Using Python virtual environment for details.

In addition it is required properly set CMAKE_LIBRARY_PATH environment variable to assure that cmake uses correct Python library. Follow these steps to find and set correct library path.

  1. Find installations of libpython2.7 library:
locate libpython2.7.dylib
  1. Choose non-system Python library installation and set CMAKE_LIBRARY_PATH before any YDK component installation. Example:
export CMAKE_LIBRARY_PATH=/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib
  1. Run YDK core package installation with '-v' flag to check that PythonLibs points to correct library path. Example:
$ ./ --core
$ pip install -v gen-api/python/ydk/dist/ydk*.tar.gz
  1. In 'cmake' log look for 'PythonLibs' and 'found version' settings line:
-- Found PythonLibs: /usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib (found version "2.7.15")
  1. Finally test you YDK core library installation from CLI, making sure there are no errors:
$ python -c "import ydk.types"

How to install

Using Python virtual environment

You may want to perform the installation under Python virtual environment (virtualenv/virtualenvwrapper). The virtual environment allows you to install multiple versions of YDK if needed. In addition, it prevents any potential conflicts between package dependencies in your system.

To install virtual environment support in your system, execute:

pip install virtualenv virtualenvwrapper
source /usr/local/bin/

To create and activate new virtual environment:

mkvirtualenv -p python2.7 ydk-py

To activate existing virtual environment:

source ~/.virtualenvs/py2/bin/activate

To exit virtual environment:


Once Python virtual environment is activated, you can perform quick installation or installation from source described above. Take into consideration that you must not attempt to install YDK as root user under virtual environment.

Quick Install

You can install the latest model packages from the Python package index. Note that, in some systems, you need to install the new package as root. You get a fully operational YDK environment by installing the cisco-ios-xr and/or cisco-ios-xe bundle(s) (depending on whether you're developing for an IOS XR or IOS XE platform), which automatically installs all other YDK-related packages (ydk, openconfig and ietf packages):

pip install ydk-models-cisco-ios-xr
pip install ydk-models-cisco-ios-xe

Alternatively, you can perform a partial installation. If you only want to install the openconfig bundle and its dependencies (ydk and ietf packages), execute:

pip install ydk-models-openconfig

If you only want to install the ietf bundle and its dependencies (ydk package), execute:

pip install ydk-models-ietf

To installation of model bundles on CentOS/RedHat platforms require special handling; please follow the below steps.


pip install ydk
pip install --install-option="--install-purelib=/usr/lib64/python2.7/site-packages" --no-deps ydk-models-ietf
pip install --install-option="--install-purelib=/usr/lib64/python2.7/site-packages" --no-deps ydk-models-openconfig
pip install --install-option="--install-purelib=/usr/lib64/python2.7/site-packages" --no-deps ydk-models-cisco-ios-xr
pip install --install-option="--install-purelib=/usr/lib64/python2.7/site-packages" --no-deps ydk-models-cisco-ios-xe


pip install ydk
pip install --install-option="--install-purelib=/usr/lib64/python3.4/site-packages" --no-deps ydk-models-ietf
pip install --install-option="--install-purelib=/usr/lib64/python3.4/site-packages" --no-deps ydk-models-openconfig
pip install --install-option="--install-purelib=/usr/lib64/python3.4/site-packages" --no-deps ydk-models-cisco-ios-xr
pip install --install-option="--install-purelib=/usr/lib64/python3.4/site-packages" --no-deps ydk-models-cisco-ios-xe


pip install ydk
pip install --install-option="--install-purelib=/usr/lib64/python3.6/site-packages" --no-deps ydk-models-ietf
pip install --install-option="--install-purelib=/usr/lib64/python3.6/site-packages" --no-deps ydk-models-openconfig
pip install --install-option="--install-purelib=/usr/lib64/python3.6/site-packages" --no-deps ydk-models-cisco-ios-xr
pip install --install-option="--install-purelib=/usr/lib64/python3.6/site-packages" --no-deps ydk-models-cisco-ios-xe

Installing from Source

If you prefer not to use the YDK packages in the Python package index, you need to install manually the ydk core package and then the model bundles you plan to use. To install the ydk core package, execute:

$ cd core
core$ python sdist
core$ pip install dist/ydk*.gz

Once you have installed the ydk core package, you can install one more model bundles. Note that some bundles have dependencies on other bundles. Those dependencies are already captured in the bundle package. Make sure you install the desired bundles in the order below. To install the ietf bundle, execute:

core$ cd ../ietf
ietf$ python sdist
ietf$ pip install dist/ydk*.gz

To install the openconfig bundle, execute:

ietf$ cd ../openconfig
openconfig$ python sdist
openconfig$ pip install dist/ydk*.gz

To install the cisco-ios-xr bundle, execute:

openconfig$ cd ../cisco-ios-xr
cisco-ios-xr$ python sdist
cisco-ios-xr$ pip install dist/ydk*.gz
cisco-ios-xr$ cd ..

Documentation and Support

Release Notes

The current YDK release version is 0.8.4. YDK-Py is licensed under the Apache 2.0 License.


This project has been archived and the repository will no longer be updated. Python SDK generated from YANG data models.




Code of conduct

Security policy





No packages published