Table of Contents
- Overview
- Backward Compatibility
- Docker
- System Requirements
- Core Installation
- Adding gNMI service
- Documentation and Support
- Release Notes
YDK is a developer tool that allows generate YANG model API's in multiple languages and provides services to apply generated API over multiple communication protocols. Currently supported languages are: Python, Go and C++. Currently implemented protocols are: Netconf, Restconf, OpenDaylight and gNMI. YDK provides CRUD and protocol specific service over above protocols. YDK also provides Codec service to translate API models to/from XML and JSON encoded strings.
The YDK-0.8.6 core is backward compatible with all previously generated model bundles starting from release of YDK-0.7.3. However the YDK-0.8.6 generates different code and model API comparing to YDK-0.8.4. The 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.
NOTE. Starting from release 0.8.6 the YDK does not support Python2 interpreter as it was deprecated.
Currently the docker image for ydk-cpp is not been generated. Please use ydk-gen docker image, which has complete environment for ydk-cpp based development.
The docker image is automatically built with the latest ydk-gen commit. This docker can be used to run ydk-gen without installing anything natively on your platform.
To use the docker image, install docker on your system, run the below command. See the docker documentation for more details.
docker run -it ydksolutions/ydk-gen:0.8.6.6
The YDK is currently supported on the following platforms including native installations, virtual machines, and docker images:
- Linux Ubuntu Xenial (16.04 LTS), Bionic (18.04 LTS), Focal (20.04 LTS), Jammy (22.04 LTS) and Noble (24.04 LTS)
- Linux CentOS versions 7 and Centos Stream 8 (Centos 8.x has been EOL as of December 31 of 2021)
- Linux RHEL version 7.x and 8.x
- MacOS up to 11.7.2 (Big Sur)
On Windows 10 the Linux virtual machine can run using Windows Subsystem for Linux (WSL); check this for virtual machine installation procedure. The YDK has been tested in such environment on Ubuntu Bionic (18.04 LTS) and Focal (20.04 LTS) images obtained from Microsoft Store.
On supported platforms the YDK can be installed using installation script.
On other platforms the YDK should be installed manually from source.
For both the methods the user must install git
package prior to the installation procedure.
All YDK core components are based on C and C++ code. These components compiled using default compilers for the supported platform.
Corresponding binaries, libraries, and header files are installed in default locations,
which are /usr/local/bin
, /usr/local/lib
, and /usr/local/include
.
The user must have sudo access in order to install YDK core components to these locations.
Make sure the sudo
package is installed on your platform prior to the YDK installation procedure.
For YDK installation it is recommended to use script install_ydk.sh
from ydk-gen
git repository.
The script detects platform OS, installs all the dependencies and builds complete set of YDK components for specified language.
The user must have sudo access to these locations.
The YDK extensively uses Python scripts for building its components and model API packages (bundles).
In order to isolate YDK Python environment from system installation, the script can build Python3 virtual environment.
If built, the user must manually activate virtual environment when generating model bundles and/or running YDK based application.
By default the Python virtual environment is installed under $HOME/venv
directory.
For different location the PYTHON_VENV environment variable should be set to that location.
NOTE. It is strongly recommended to use Python virtual environment on Centos/RHEL and Mac platforms.
Here is simple example of core YDK installation for C++ programming language and Python virtual environment:
git clone https://github.com/CiscoDevNet/ydk-gen.git
cd ydk-gen
export YDKGEN_HOME=`pwd` # optional
export PYTHON_VENV=$HOME/ydk_vne # optional
./install_ydk.sh --cpp --core --venv
The script also allows to install individual components like dependencies, core, and service packages for specified programming language or for all supported languages. Full set of script capabilities could be viewed like this:
./install_ydk.sh --help
usage: install_ydk [ {--cpp|--py|--go|--all} ] [-c] [-s gnmi] [-h] [-n] [-v]
Options and arguments:
--cpp install YDK for C++ programming language;
requires sudo access for dependencies and libraries installation
--go install YDK for Go programming language
--py|--python install YDK for Python programming language
--all install YDK for all available programming languages;
requires sudo access for dependencies and libraries installation
-v|--venv create python virtual environment
-c|--core install YDK core package
-s|--service gnmi install gNMI service package
-n|--no-deps skip installation of dependencies;
applicable only with --cpp and --all options
-h|--help print this help message and exit
Environment variables:
YDKGEN_HOME specifies location of ydk-gen git repository;
if not set, $HOME/ydk-gen is assumed
PYTHON_VENV specifies location of python virtual environment;
if not set, $HOME/venv is assumed
GOROOT specifies installation directory of go software;
if not set, /usr/local/go is assumed
GOPATH specifies location of go source directory;
if not set, $HOME/go is assumed
C_INCLUDE_PATH location of C include files;
if not set, /usr/local/include is assumed
CPLUS_INCLUDE_PATH location of C++ include files;
if not set, /usr/local/include is assumed
CMAKE_LIBRARY_PATH Location of Python shared libraries;
if not set, default system library location is assumed
If user environment is different from the default one (different Python installation or different location of libraries) then building from source method should be used.
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
When non-standard Python installation is used or there are multiple installations of Python on the platform, the PATH and CMAKE_LIBRARY_PATH environment variables must be set accordingly in order for the installation scripts to pick up correct Python binaries and shared libraries.
If user platform is supported one, it is recommended to use ydk-gen/install_ydk.sh
script.
The script will also install Python virtual environment in default or specified location, when '--venv' is specified.
# Clone ydk-gen from GitHub
git clone https://github.com/CiscoDevNet/ydk-gen.git
cd ydk-gen
# Define optional environment variables and install dependencies
export YDKGEN_HOME=`pwd`
export PYTHON_VENV=$HOME/ydk_venv
./install_ydk.sh # also builds Python virtual environment
For unsupported platforms it is recommended to follow logic of ydk-gen/test/dependencies-*
scripts.
# If created, activate Python virtual environment
source $PYTHON_VENV/bin/activate
# Generate and install YDK core library
python3 generate.py -is --core --cpp
In order to enable YDK support for gNMI protocol, which is optional, the user need install third party software and YDK gNMI service package.
Here is simple example how gNMI service package and Python virtual environment could be added:
cd ydk-gen
./install_ydk.sh --cpp --service gnmi -v
There is an open issue with gRPC on Centos/RHEL, 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:/usr/local/lib:/usr/local/lib64
- Read the API documentation (release 0.8.3) for details on how to use the API and specific models
- Samples can be found under the samples directory
- Additional samples can be found in the YDK-Cpp samples repository (coming soon)
- Join the YDK community to connect with YDK users and developers
The current YDK release version is 0.8.6.6.
YDK is licensed under the Apache 2.0 License.