Sign inSign up

ydkdev/ydk-go

By ydkdev

•Updated almost 7 years ago

YDK-Go on Ubuntu

Image
1

2.3K

ydkdev/ydk-go repository overview

Build Status GoDoc Docker Automated build

ydk-logo-128

⁠YANG Development Kit (Go)

Table of Contents

⁠Overview

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.

⁠Docker

A docker image⁠ is automatically built with the latest ydk-go installed. This be used to run ydk-go 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-go

⁠How to Install

You can install YDK-Go on macOS or Linux. It is not currently supported on Windows.

⁠System Requirements
⁠Linux
⁠Ubuntu (Debian-based)

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

Install third-party dependency software:

$ sudo apt-get install libcurl4-openssl-dev libpcre3-dev libssh-dev libxml2-dev libxslt1-dev libtool-bin cmake

# Install gcc-5 and g++-5
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
sudo apt-get update > /dev/null
sudo apt-get install gcc-5 g++-5 -y > /dev/null
sudo ln -f -s /usr/bin/g++-5 /usr/bin/c++
sudo ln -f -s /usr/bin/gcc-5 /usr/bin/cc

Install YDK core library:

For Xenial (Ubuntu 16.04.4):

$ wget https://devhub.cisco.com/artifactory/debian-ydk/0.8.0/xenial/libydk_0.8.0-1_amd64.deb
$ sudo gdebi libydk_0.8.0-1_amd64.deb

For Bionic (Ubuntu 18.04.1):

$ wget https://devhub.cisco.com/artifactory/debian-ydk/0.8.0/bionic/libydk_0.8.0-1_amd64.deb
$ sudo gdebi libydk_0.8.0-1_amd64.deb
⁠Centos (Fedora-based)

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

$ sudo yum install epel-release
$ sudo yum install libxml2-devel libxslt-devel libssh-devel libtool gcc-c++ pcre-devel cmake libstdc++-static git

# Install gcc-5 and g++-5
$ yum install centos-release-scl -y > /dev/null
$ yum install devtoolset-4-gcc* -y > /dev/null
$ ln -sf /opt/rh/devtoolset-4/root/usr/bin/gcc /usr/bin/gcc
$ ln -sf /opt/rh/devtoolset-4/root/usr/bin/g++ /usr/bin/g++

# Install YDK core library
$ sudo yum install https://devhub.cisco.com/artifactory/rpm-ydk/0.8.0/libydk-0.8.0-1.x86_64.rpm

# Install libydk_gnmi library (optional)
$ ./test/dependencies_linux_gnmi.sh
$ sudo yum install https://devhub.cisco.com/artifactory/rpm-ydk/0.8.0/libydk_gnmi-0.4.0-1.x86_64.rpm
⁠Mac OS

It is recommended to install homebrew⁠ and Xcode command line tools on your system before installing YDK-Go:

$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
$ brew install pkg-config libssh libxml2 xml2 curl pcre cmake
$ xcode-select --install

# Install YDK core library
$ curl -O https://devhub.cisco.com/artifactory/osx-ydk/0.8.0/libydk-0.8.0-Darwin.pkg
$ sudo installer -pkg libydk-0.8.0-Darwin.pkg -target /

Note. The libssh-0.8.0 and following versions do not support multi-threading feature, which is required by YDK. Therefore it is required to install or reinstall libssh-0.7.x

$ brew reinstall openssl
$ export OPENSSL_ROOT_DIR=/usr/local/opt/openssl
$ wget https://git.libssh.org/projects/libssh.git/snapshot/libssh-0.7.6.tar.gz
$ 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
⁠Golang

The YDK requires Go version 1.9 or higher. If this is not the case, follow below installation steps. Make sure that environment variables GOROOT and GOPATH are properly set.

⁠Linux
$ sudo wget https://storage.googleapis.com/golang/go1.9.2.linux-amd64.tar.gz &> /dev/null
$ sudo tar -zxf  go1.9.2.linux-amd64.tar.gz -C /usr/local/
$ export GOROOT="/usr/local/go"
$ export PATH=$GOROOT/bin:$PATH
⁠Mac OS
$ export CGO_ENABLED=0
$ export GOROOT_BOOTSTRAP=$GOROOT
$ gvm install go1.9.2
⁠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
    wget https://github.com/google/protobuf/releases/download/v3.5.0/protobuf-cpp-3.5.0.zip
    unzip protobuf-cpp-3.5.0.zip
    cd protobuf-3.5.0
    ./configure
    make
    make check
    sudo make install
    sudo ldconfig
⁠Install gRPC
    git clone -b v1.9.1 https://github.com/grpc/grpc
    cd grpc
    git submodule update --init
    make
    sudo make install
    sudo ldconfig
⁠Install gNMI library

For Xenial:

$ wget https://devhub.cisco.com/artifactory/debian-ydk/0.8.0/xenial/libydk_gnmi_0.4.0-1_amd64.deb
$ sudo gdebi libydk_gnmi_0.4.0-1_amd64.deb

For Bionic:

$ wget https://devhub.cisco.com/artifactory/debian-ydk/0.8.0/bionic/libydk_gnmi_0.4.0-1_amd64.deb
$ sudo gdebi libydk_gnmi_0.4.0-1_amd64.deb
⁠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:

    PROTO="/Your-Protobuf-and-Grpc-installation-directory"
    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PROTO/grpc/libs/opt:$PROTO/protobuf-3.5.0/src/.libs:/usr/local/lib64
⁠YDK Go Source

You can download the latest YDK Go source code, which include core, and model bundles, from GitHub:

$ go get github.com/CiscoDevNet/ydk-go/ydk

⁠Documentation and Support

⁠Release Notes

The current YDK release version is 0.8.0. YDK-Go is licensed under the Apache 2.0 License.

Tag summary

Content type

Image

Digest

Size

702.5 MB

Last updated

over 7 years ago

docker pull ydkdev/ydk-go