From bf17e1844ac320bab462683a1b6130a241edf79f Mon Sep 17 00:00:00 2001 From: ygorelik Date: Sun, 16 Oct 2022 17:50:48 -0700 Subject: [PATCH] Resolved GitHub issue #1069 Signed-off-by: ygorelik --- CHANGES.md | 10 ++ README.md | 51 +++--- install_ydk.sh | 177 ++++++++++++-------- requirements.txt | 16 +- sdk/cpp/README.md | 32 ++-- sdk/cpp/core/CMakeLists.txt | 37 ++-- sdk/cpp/core/docsgen/getting_started.rst | 18 +- sdk/cpp/core/samples/CMakeLists.txt | 2 +- sdk/cpp/core/tests/CMakeLists.txt | 4 +- sdk/cpp/gnmi/CMakeLists.txt | 32 ++-- sdk/go/README.md | 22 ++- sdk/go/core/docsgen/getting_started.rst | 20 ++- sdk/go/gnmi/README.md | 4 +- sdk/python/README.rst | 28 ++-- sdk/python/core/docsgen/getting_started.rst | 26 +-- sdk/version.json | 7 +- 16 files changed, 290 insertions(+), 196 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 47babfe06..a4f4b63cf 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -7,6 +7,8 @@ * Added SSL support for NetconfServiceProvider in Go * Improved installation script to allow use Python system installation * Allow custom Python installation in YDK installation script + * install_ydk.sh: Installation of Python YDK packages should not require root access ([#1069](https://github.com/CiscoDevNet/ydk-gen/issues/1069)) + #### Resolved GitHub issues * Go function EntityEqual result depends on parameters order ([#1053](https://github.com/CiscoDevNet/ydk-gen/issues/1053)) @@ -21,6 +23,14 @@ * The installation script fails on fresh new CentOS 7 docker container ([#1064](https://github.com/CiscoDevNet/ydk-gen/issues/1064)) * ExecutorService fails on non-ietf RPC with Libyang error ([#1067](https://github.com/CiscoDevNet/ydk-gen/issues/1067)) +### Resolved non-GitHub issues + * Upgraded third party packages Sphinx (1.5.6) and wheel (0.37.1) due to documentation +generation issues on Mac Big Sur + * Fixed installation script for the case, when virtual environment is not used + +#### Documentation improvements + * Fixed documentation issue [#1066](https://github.com/CiscoDevNet/ydk-gen/issues/1066) + #### Bundle improvements * Updated cisco-ios-xr bundle (profile cisco-ios-xr_6_7_3.json) to support Cisco IOS XR 6.7.3 * Updated openconfig bundle (profile openconfig_0_1_9.json) to support YANG models of revision "2020-05-06" diff --git a/README.md b/README.md index df37fb373..ad2b19f1f 100644 --- a/README.md +++ b/README.md @@ -157,7 +157,6 @@ source .env ``` The YDK extensively uses Python scripts for building its components and model API packages (bundles). -By default the YDK uses Python system installation. 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. @@ -165,18 +164,20 @@ For different location the PYTHON_VENV environment variable should be set to tha **NOTE.** It is strongly recommended to use Python virtual environment on Centos/RHEL and Mac platforms. +When installing YDK for Python or Go programming languages, the third party dependencies and C++ packages must be installed first. +This step requires sudo/root access to the installation platform. Here is simple example of core YDK installation for Python programming language and Python virtual environment: ``` git clone https://gitlab.com/yangorelik/ydk-gen.git cd ydk-gen -git checkout tags/0.9.1.1 -b master export YDKGEN_HOME=`pwd` # optional export PYTHON_VENV=$HOME/ydk_vne # optional -./install_ydk.sh --core --venv +./install_ydk.sh --cpp --core --venv # This step requires sudo access! +./install_ydk.sh --py --core --venv ``` -The script also allows to install individual components like dependencies, core, and service packages +The script also allows installing 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: @@ -184,18 +185,21 @@ 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] [-p path] Options and arguments: - --cpp install YDK for C++ programming language + --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 (default) - --all install YDK for all supported programming languages + --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 packages -s|--service gnmi install gNMI service package - -n|--no-deps skip installation of dependencies + -n|--no-deps skip installation of dependencies; + applicable only with --cpp and --all options -p|--python-dir path set Python3 installation root directory; if not specified, system installation assumed -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 @@ -273,10 +277,11 @@ and YDK gNMI service package. ### gNMI service installation -Here is simple example how gNMI service package for Python could be added: +Here is simple example how gNMI service package for Python virtual environment could be added: ``` cd ydk-gen +./install_ydk.sh --cpp --service gnmi -v # requires sudo access ./install_ydk.sh --py --service gnmi -v ``` @@ -301,7 +306,7 @@ All the YDK components/packages can be generated by using Python script `generat ``` cd ydk-gen source .env -./generate.py --help +python3 generate.py --help usage: generate.py [-h] [-l] [--core] [--service SERVICE] [--bundle BUNDLE] [--adhoc-bundle-name ADHOC_BUNDLE_NAME] [--adhoc-bundle ADHOC_BUNDLE [ADHOC_BUNDLE ...]] @@ -368,7 +373,7 @@ All other attributes, like `"author"` and `"copyright"`, are optional and will n { "name":"cisco-ios-xr", "version": "6.5.3", - "core_version": "0.9.0", + "core_version": "0.9.1", "author": "Cisco", "copyright": "Cisco", "description": "Cisco IOS-XR Native Models From Git", @@ -432,7 +437,7 @@ YDK runtime environment must be activated prior to these procedures. If applicable, the Python virtual environment must be activated prior to these procedures ``` -./generate.py --python --bundle profiles/bundles/.json -i +python3 generate.py --python --bundle profiles/bundles/.json -i ``` Check Python packages installed: @@ -447,13 +452,13 @@ ydk-models- (0.5.1) ### For Go ``` -./generate.py --go --bundle profiles/bundles/.json -i +python3 generate.py --go --bundle profiles/bundles/.json -i ``` ### For C++ ``` -./generate.py --cpp --bundle profiles/bundles/.json -is +python3 generate.py --cpp --bundle profiles/bundles/.json -is ``` ## Writing your first app @@ -476,10 +481,10 @@ For example, the below sequence of commands will generate the documentation for (for C++, use `--cpp`; for Go, use `--go`). ``` -./generate.py --python --bundle profiles/bundles/ietf_0_1_1.json -./generate.py --python --bundle profiles/bundles/openconfig_0_1_1.json -./generate.py --python --bundle profiles/bundles/cisco_ios_xr_6_1_1.json -./generate.py --python --core --generate-doc +python3 generate.py --python --bundle profiles/bundles/ietf_0_1_1.json +python3 generate.py --python --bundle profiles/bundles/openconfig_0_1_1.json +python3 generate.py --python --bundle profiles/bundles/cisco_ios_xr_6_1_1.json +python3 generate.py --python --core --generate-doc ``` **Note.** The documentation generation for bundles can take few hours due to their size. If you have previously @@ -490,8 +495,8 @@ the add-on documentation generation time can be reduced. Adding cisco-ios-xr doc mkdir gen-api/cache mv gen-api/python gen-api/cache -./generate.py --python --bundle profiles/bundles/cisco_ios_xr_6_6_3.json -./generate.py --python --core --generate-doc --output-directory gen-api --cached-output-dir +python3 generate.py --python --bundle profiles/bundles/cisco_ios_xr_6_6_3.json +python3 generate.py --python --core --generate-doc --output-directory gen-api --cached-output-dir ``` ## Generating an "Adhoc" YDK-Py Bundle @@ -501,7 +506,7 @@ just few models. It is called an "adhoc" bundle. Such a bundle generated without Here is simple example: ``` -./generate.py -i --adhoc-bundle-name test --adhoc-bundle \ +python3 generate.py -i --adhoc-bundle-name test --adhoc-bundle \ /opt/git-repos/clean-yang/vendor/cisco/xr/621/Cisco-IOS-XR-ipv4-bgp-oper*.yang \ /opt/git-repos/clean-yang/vendor/cisco/xr/621/Cisco-IOS-XR-types.yang /opt/git-repos/clean-yang/vendor/cisco/xr/621/Cisco-IOS-XR-ipv4-bgp-datatypes.yang @@ -569,7 +574,7 @@ Other times, when the problem is not so evident, it is recommended to try runnin `[--verbose|-v]` flag, which may reveal syntax problems with the YANG models being used. For example: ``` -./generate.py --python --bundle profiles/bundles/ietf_0_1_1.json --verbose +python3 generate.py --python --bundle profiles/bundles/ietf_0_1_1.json --verbose ``` Also, it may be a good idea to obtain a local copy of the YANG models and compile them using `pyang` to ensure diff --git a/install_ydk.sh b/install_ydk.sh index 63cb9515b..983872d56 100755 --- a/install_ydk.sh +++ b/install_ydk.sh @@ -39,35 +39,38 @@ function run_cmd { function usage { MSG_COLOR=$NOCOLOR - echo "usage: install_ydk [ {--cpp|--py|--go|--all} ] [-c] [-s gnmi] [-h] [-n] [-v] [-p path]" - echo "Options and arguments:" - echo " --cpp install YDK for C++ programming language" - echo " --go install YDK for Go programming language" - echo " --py|--python install YDK for Python programming language (default)" - echo " --all install YDK for all available programming languages" - echo " -v|--venv create python virtual environment" - echo " -c|--core install YDK core packages" - echo " -s|--service gnmi install gNMI service package" - echo " -n|--no-deps skip installation of dependencies" - echo " -p|--python-dir path set Python3 installation root directory;" - echo " if not specified, system installation assumed" - echo " -h|--help print this help message and exit" - echo " " - echo "Environment variables:" - echo "YDKGEN_HOME specifies location of ydk-gen git repository;" - echo " if not set, \$HOME/ydk-gen is assumed" - echo "PYTHON_VENV specifies location of python virtual environment;" - echo " if not set, \$HOME/venv is assumed" - echo "GOROOT specifies installation directory of go software;" - echo " if not set, /usr/local/go is assumed" - echo "GOPATH specifies location of golang directory;" - echo " if not set, \$HOME/go is assumed" - echo "C_INCLUDE_PATH location of C include files;" - echo " if not set, /usr/local/include is assumed" - echo "CPLUS_INCLUDE_PATH location of C++ include files;" - echo " if not set, /usr/local/include is assumed" - echo "CMAKE_LIBRARY_PATH Location of Python shared libraries;" - echo " if not set, default system library location is assumed" + echo "usage: install_ydk [ {--cpp|--py|--go|--all} ] [-c] [-s gnmi] [-h] [-n] [-v] [-p path] +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 packages + -s|--service gnmi install gNMI service package + -n|--no-deps skip installation of dependencies; + applicable only with --cpp and --all options + -p|--python-dir path set Python3 installation root directory; + if not specified, system installation assumed + -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 golang 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" } function activate_python_venv() { @@ -77,13 +80,13 @@ function activate_python_venv() { fi if [[ ! -d ${PYTHON_VENV} ]]; then print_msg "Creating Python3 virtual environment in ${PYTHON_VENV}" - run_cmd $PYTHON_BIN -m venv ${PYTHON_VENV} + run_cmd $PYTHON_BIN -m venv "${PYTHON_VENV}" fi - run_cmd source ${PYTHON_VENV}/bin/activate + run_cmd source "${PYTHON_VENV}"/bin/activate } -function check_python_installation { - if [ ${install_venv} == "yes" ]; then +function init_py_env { + if [ $install_venv == "yes" ]; then activate_python_venv fi print_msg "Checking python3 version and installation" @@ -103,6 +106,7 @@ function check_python_installation { print_msg "Could not locate $PIP_BIN" exit $status fi + export PIP_DISABLE_PIP_VERSION_CHECK=1 if [[ $ydk_lang == "py" || $ydk_lang == "all" ]]; then print_msg "Checking installation of python shared libraries" @@ -134,12 +138,8 @@ function check_python_installation { exit 1 fi fi -} - -function init_py_env { - check_python_installation - print_msg "Initializing Python requirements" - $PIP_BIN install wheel==0.34.2 + print_msg "Checking and installing Python requirements" + $PIP_BIN install wheel>=0.37.1 status=$? if [ $status -ne 0 ]; then print_msg "Enabling sudo for Python components installation" @@ -155,14 +155,10 @@ function init_go_env { print_msg "Initializing Go environment" if [[ $(uname) == "Darwin" ]]; then - if [[ $GOPATH. == "." ]]; then - export GOPATH=$HOME/go - fi if [[ $GOROOT. == "." ]]; then export GOROOT=/usr/local/go fi print_msg "GOROOT: $GOROOT" - print_msg "GOPATH: $GOPATH" else if [[ $GOROOT. == "." ]]; then export GOROOT=/usr/local/go @@ -171,14 +167,13 @@ function init_go_env { print_msg "GOROOT: $GOROOT" fi export PATH=$GOROOT/bin:$PATH - - if [[ $GOPATH. == "." ]]; then - export GOPATH=$HOME/go - mkdir -p $GOPATH - print_msg "Setting GOPATH to $GOPATH" - else - print_msg "GOPATH: $GOPATH" - fi + fi + if [[ -z $GOPATH ]]; then + export GOPATH=$HOME/go + mkdir -p $GOPATH + print_msg "Setting GOPATH to $GOPATH" + else + print_msg "GOPATH: $GOPATH" fi go_version=$(echo `go version` | awk '{ print $3 }' | cut -d 'o' -f 2) print_msg "Current Go version is $go_version" @@ -218,7 +213,7 @@ function install_go_core { } function install_go_gnmi { - print_msg "Installing Go gNMI package" + print_msg "Installing Go gNMI service package" cd $YDKGEN_HOME run_cmd $PYTHON_BIN generate.py -i --service profiles/services/gnmi-0.4.0.json --go } @@ -271,40 +266,68 @@ function instal_dependencies { fi } +function test_libydk { + [ -f "/usr/local/lib/$libydk_path" ] && [[ "$(readlink /usr/local/lib/libydk.a)" == "$libydk_path" ]] && return 0 + + MSG_COLOR=$RED + print_msg "Missing C++ core library '$libydk_path'. Install it first!" + exit 1 +} + +function test_libydk_gnmi { + [ -f "/usr/local/lib/$libydk_gnmi_path" ] && [[ "$(readlink /usr/local/lib/libydk_gnmi.a)" == "$libydk_gnmi_path" ]] && return 0 + + MSG_COLOR=$RED + print_msg "Missing C++ gNMI service library '$libydk_gnmi_path'. Install it first!" + exit 1 +} + function install_ydk_cpp { + if [[ ${ydk_lang} == "cpp" || ${ydk_lang} == "all" ]]; then if [[ ${core_package} == "yes" ]]; then install_cpp_core fi if [[ ${service_pkg} == "gnmi" ]]; then + if test_libydk; then install_cpp_gnmi + fi fi + fi } function install_ydk_py { if [[ ${ydk_lang} == "py" || ${ydk_lang} == "all" ]]; then + if test_libydk; then if [[ ${core_package} == "yes" ]]; then install_py_core fi if [[ ${service_pkg} == "gnmi" ]]; then + if test_libydk_gnmi; then install_py_gnmi + fi fi + fi fi } function install_ydk_go { if [[ ${ydk_lang} == "go" || ${ydk_lang} == "all" ]]; then + if test_libydk; then if [[ ${core_package} == "yes" ]]; then install_go_core fi if [[ ${service_pkg} == "gnmi" ]]; then + if test_libydk_gnmi; then install_go_gnmi + fi fi + fi fi } function write_env_file { print_msg "Writing .env file" - cd ${YDKGEN_HOME} + cd "${YDKGEN_HOME}" rm -f .env echo "# ------------------------------------------------------------------ # This file has been auto-generated during YDK-$ydk_version installation. @@ -314,18 +337,21 @@ function write_env_file { # source .env # ------------------------------------------------------------------ -YDKGEN_HOME=${YDKGEN_HOME} -export YDKGEN_HOME +export YDKGEN_HOME=\"${YDKGEN_HOME}\" -export C_INCLUDE_PATH=$C_INCLUDE_PATH -export CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH +export C_INCLUDE_PATH=\"$C_INCLUDE_PATH\" +export CPLUS_INCLUDE_PATH=\"$CPLUS_INCLUDE_PATH\" +export PIP_DISABLE_PIP_VERSION_CHECK=1 " > .env + if [[ -n $LD_LIBRARY_PATH ]]; then + echo "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH +" >> .env + fi if [ $install_venv == "yes" ]; then echo "export PYTHON_VENV=$PYTHON_VENV" >> .env echo "source $PYTHON_VENV/bin/activate" >> .env elif [[ -n $python_location ]]; then - echo "PATH=$python_location/bin:$PATH -export PATH + echo "export PATH=$python_location/bin:\$PATH alias python=$PYTHON_BIN alias pip=$PIP_BIN " >> .env @@ -335,12 +361,14 @@ alias pip=$PIP_BIN fi if [[ $ydk_lang == "go" || $ydk_lang == "all" ]]; then if [[ ${os_type} == "Linux" ]]; then - echo "if [ -z \$GOROOT ]; then + echo " +if [ -z \$GOROOT ]; then export GOROOT=$GOROOT - PATH=$GOROOT/bin:$PATH - export PATH -fi" ->> .env + if [[ $PATH != *\"$GOROOT/bin\"* ]]; then + export PATH=$GOROOT/bin:\$PATH + fi +fi +" >> .env fi echo " if [ -z \$GOPATH ]; then @@ -348,10 +376,6 @@ if [ -z \$GOPATH ]; then fi export CXX=/usr/bin/c++ export CC=/usr/bin/cc -" >> .env - fi - if [[ $service_pkg == "gnmi" && $LD_LIBRARY_PATH != *"protobuf"* ]]; then - echo "export LD_LIBRARY_PATH=\$HOME/grpc/libs/opt:\$HOME/protobuf-3.5.0/src/.libs:\$LD_LIBRARY_PATH " >> .env fi if [[ -n $CMAKE_LIBRARY_PATH ]]; then @@ -402,9 +426,11 @@ while [[ $# -gt 0 ]]; do ;; --go) ydk_lang="go" + dependencies="no" ;; --py|--python) ydk_lang="py" + dependencies="no" ;; --all) ydk_lang="all" @@ -463,6 +489,9 @@ fi cd ${YDKGEN_HOME} ydk_version=$(grep core sdk/version.json | awk '{print($2)'} | tr -d '"' | tr -d ',') +gnmi_version=$(grep gnmi-service sdk/version.json | awk '{print($2)'} | tr -d '"' | tr -d ',') +libydk_path="libydk-$ydk_version.a" +libydk_gnmi_path="libydk_gnmi-$gnmi_version.a" echo "YDK-$ydk_version installation options:" if [ ${install_venv} == "no" ]; then if [[ -n $python_location ]]; then @@ -528,11 +557,13 @@ if [[ -z ${CPLUS_INCLUDE_PATH} ]]; then fi if [[ $(uname) == "Linux" && ${os_info} == *"fedora"* ]]; then - export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib:/usr/local/lib64:/usr/lib64 - if [ ${service_pkg} == "gnmi" ]; then - export LD_LIBRARY_PATH=$HOME/grpc/libs/opt:$HOME/protobuf-3.5.0/src/.libs:$LD_LIBRARY_PATH - fi - print_msg "LD_LIBRARY_PATH is set to: $LD_LIBRARY_PATH" + if [[ $LD_LIBRARY_PATH != *"/usr/local/lib"* ]]; then + export LD_LIBRARY_PATH="/usr/local/lib$LD_LIBRARY_PATH" + fi + if [[ $LD_LIBRARY_PATH != *"/lib64"* ]]; then + export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib64:/usr/lib64 + fi + print_msg "LD_LIBRARY_PATH is set to: $LD_LIBRARY_PATH" fi if [ ${dependencies} == "yes" ]; then diff --git a/requirements.txt b/requirements.txt index 81d074c1e..1426dda4e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,9 +1,9 @@ -wheel==0.34.2 -MarkupSafe==1.1.1 -Jinja2==2.11.3 +wheel>=0.37.1 +MarkupSafe>=1.1.1 +Jinja2>=2.11.3 pybind11==2.6.2 -Sphinx==1.4a1 -sphinx-rtd-theme==0.1.9 -GitPython==2.1.15 -rstr==2.2.6 -packaging==20.8 +Sphinx>=1.5.6 +sphinx-rtd-theme>=0.1.9 +GitPython>=2.1.15 +rstr>=2.2.6 +packaging>=20.8 diff --git a/sdk/cpp/README.md b/sdk/cpp/README.md index b03c253c8..da950fb03 100644 --- a/sdk/cpp/README.md +++ b/sdk/cpp/README.md @@ -65,15 +65,15 @@ YDK also provides Codec service to translate API models to/from XML and JSON enc The YDK-0.9.0 C++ code got significant changes, which broke backward compatibility with YDK-0.8.5 and earlier releases. -**NOTE.** Starting from release 0.8.5 the YDK does not support Python2 interpreter as it was deprecated. +**NOTE.** Starting from release 0.8.6 the YDK does not support Python2 interpreter as it was deprecated. ## Docker Currently the [docker image](https://docs.docker.com/engine/reference/run/) for ydk-cpp is not been generated. -Please use [ydk-gen](https://github.com/ygorelik/ydk-gen/tree/0.8.5#docker>) docker image, which has complete +Please use [ydk-gen](https://gitlab.com/yangorelik/ydk-gen#docker>) docker image, which has complete environment for ydk-cpp based development. -A [docker image](https://docs.docker.com/engine/reference/run/) is automatically built with the latest ydk-gen commit. +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](https://docs.docker.com/install/) on your system and run the below command. @@ -115,7 +115,6 @@ The script detects platform OS, installs all the dependencies and builds complet The user must have sudo access to these locations. The YDK extensively uses Python scripts for building its components and model API packages (bundles). -By default the YDK uses Python system installation. 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. @@ -126,7 +125,7 @@ For different location the PYTHON_VENV environment variable should be set to tha Here is simple example of core YDK installation for C++ programming language and Python virtual environment: ``` -git clone https://github.com/ygorelik/ydk-gen.git +git clone https://gitlab.com/yangorelik/ydk-gen.git cd ydk-gen export YDKGEN_HOME=`pwd` # optional export PYTHON_VENV=$HOME/ydk_vne # optional @@ -141,23 +140,26 @@ 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] [-p path] Options and arguments: - --cpp install YDK for C++ programming language + --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 (default) - --all install YDK for all supported programming languages + --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 packages -s|--service gnmi install gNMI service package - -n|--no-deps skip installation of dependencies + -n|--no-deps skip installation of dependencies; + applicable only with --cpp and --all options -p|--python-dir path set Python3 installation root directory; if not specified, system installation assumed -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/ygorelik/venv is assumed + 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; @@ -194,7 +196,7 @@ The script will also install Python virtual environment in default or specified ``` # Clone ydk-gen from GitHub -git clone https://github.com/ygorelik/ydk-gen.git -b yang11 +git clone https://gitlab.com/yangorelik/ydk-gen.git cd ydk-gen # Define optional environment variables and install dependencies @@ -212,7 +214,7 @@ For unsupported platforms it is recommended to follow logic of `ydk-gen/test/dep source $PYTHON_VENV/bin/activate # Generate and install YDK core library -./generate.py -is --core --cpp +python3 generate.py -is --core --cpp ``` ## Adding gNMI Service @@ -222,11 +224,11 @@ and YDK gNMI service package. ### gNMI service installation -Here is simple example how gNMI service package for Python could be added: +Here is simple example how gNMI service package and Python virtual environment could be added: ``` cd ydk-gen -./install_ydk.sh --cpp --service gnmi +./install_ydk.sh --cpp --service gnmi -v ``` ### Runtime environment diff --git a/sdk/cpp/core/CMakeLists.txt b/sdk/cpp/core/CMakeLists.txt index a8ff977dd..48f14d20f 100644 --- a/sdk/cpp/core/CMakeLists.txt +++ b/sdk/cpp/core/CMakeLists.txt @@ -1,15 +1,16 @@ cmake_minimum_required(VERSION 3.0.0) cmake_policy(SET CMP0048 NEW) -project(ydk VERSION 0.9.0 LANGUAGES C CXX) +project(ydk VERSION 0.9.1 LANGUAGES C CXX) set(YDK_DESCRIPTION "YANG Development Kit Library. The library for YDK API.") # CPack Dynamic Settings set (CPACK_PACKAGE_NAME "libydk") -set (CPACK_PACKAGE_VERSION "${PROJECT_VERSION}") -set (CPACK_PACKAGE_RELEASE "1") -set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "YDK Core Library") -# set (CPACK_PACKAGE_DESCRIPTION_SUMMARY ${YDK_DESCRIPTION}) +set (CPACK_PACKAGE_BUILD "1") +set (CPACK_PACKAGE_VERSION "${PROJECT_VERSION}.${CPACK_PACKAGE_BUILD}") +set (CPACK_LIBRARY_NAME "ydk-${CPACK_PACKAGE_VERSION}") +set (CPACK_LIBRARY_TARGET "lib${CPACK_LIBRARY_NAME}.a") +set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "YDK C++ Core Library") # CPack Static Settings set (CPACK_PACKAGE_DESCRIPTION "An SDK that provides API's that are modeled in YANG. @@ -64,7 +65,7 @@ elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux") # _-_.deb # libydk_0.6.0-0.1.alpha_amd64.deb // Debian set (CPACK_PACKAGE_FILE_NAME - "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_PACKAGE_RELEASE}.${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}") + "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}.${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}") # Linux Fedora elseif(${LSB_RELEASE_ID_SHORT} MATCHES "CentOS") @@ -74,7 +75,7 @@ elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux") set (CPACK_RPM_PACKAGE_NAME ${CPACK_PACKAGE_NAME}) set (CPACK_RPM_PACKAGE_VERSION ${CPACK_PACKAGE_VERSION}) - set (CPACK_RPM_PACKAGE_RELEASE ${CPACK_PACKAGE_RELEASE}) + set (CPACK_RPM_PACKAGE_RELEASE ${CPACK_PACKAGE_BUILD}) set (CPACK_RPM_PACKAGE_ARCHITECTURE "x86_64") set (CPACK_RPM_PACKAGE_SUMMARY ${CPACK_PACKAGE_DESCRIPTION_SUMMARY}) set (CPACK_RPM_PACKAGE_DESCRIPTION ${CPACK_PACKAGE_DESCRIPTION}) @@ -88,7 +89,7 @@ elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux") # --..(src).rpm # libydk-0.6.0-0.1.alpha.x86_64.rpm // RPM set (CPACK_PACKAGE_FILE_NAME - "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_PACKAGE_RELEASE}.${CPACK_RPM_PACKAGE_ARCHITECTURE}") + "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}.${CPACK_RPM_PACKAGE_ARCHITECTURE}") endif() endif() @@ -466,9 +467,9 @@ include_directories( set(CMAKE_POSITION_INDEPENDENT_CODE ON) -add_library(ydk STATIC ${libydk_src} ${libnetconf_inc_objs} ${libyang_inc_objs}) +add_library(${CPACK_LIBRARY_NAME} STATIC ${libydk_src} ${libnetconf_inc_objs} ${libyang_inc_objs}) -target_link_libraries(ydk +target_link_libraries(${CPACK_LIBRARY_NAME} ${LIBXML2_LIBRARIES} ${LIBSSH_LIBRARIES} ${curl_location} @@ -482,10 +483,10 @@ target_link_libraries(ydk ${dl_location} ) -set_property(TARGET ydk PROPERTY CXX_STANDARD 11) -set_property(TARGET ydk PROPERTY CXX_STANDARD_REQUIRED ON) +set_property(TARGET ${CPACK_LIBRARY_NAME} PROPERTY CXX_STANDARD 11) +set_property(TARGET ${CPACK_LIBRARY_NAME} PROPERTY CXX_STANDARD_REQUIRED ON) -install(TARGETS ydk DESTINATION ${LIB_INSTALL_DIR}) +install(TARGETS ${CPACK_LIBRARY_NAME} DESTINATION ${LIB_INSTALL_DIR}) install(FILES ${libydk_install_headers} DESTINATION ${INCLUDE_INSTALL_DIR}) install(FILES ${SPDLOG_HEADERS} DESTINATION ${spdlog_include_location}) install(FILES ${SPDLOG_DETAILS_HEADERS} DESTINATION ${spdlog_details_include_location}) @@ -493,6 +494,16 @@ install(FILES ${SPDLOG_FMT_HEADERS} DESTINATION ${spdlog_fmt_include_location}) install(FILES ${SPDLOG_FMT_BUNDLED_HEADERS} DESTINATION ${spdlog_fmt_bundled_include_location}) install(FILES ${SPDLOG_SINKS_HEADERS} DESTINATION ${spdlog_sinks_include_location}) +SET( legacy_link ${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR}/libydk.a) +SET( legacy_target ${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR}/${CPACK_LIBRARY_TARGET}) +ADD_CUSTOM_COMMAND( TARGET ${CPACK_LIBRARY_NAME} + COMMAND echo "Creating symbolic link ${legacy_link}" + COMMAND rm -f ${legacy_link} + COMMAND ln -s ${CPACK_LIBRARY_TARGET} ${legacy_link} + DEPENDS install ${CPACK_LIBRARY_NAME} + ) +ADD_CUSTOM_TARGET( install_legacy DEPENDS ${legacy_target} ) + # generate doxygen documentation for ydk_core API find_package(Doxygen) if(DOXYGEN_FOUND) diff --git a/sdk/cpp/core/docsgen/getting_started.rst b/sdk/cpp/core/docsgen/getting_started.rst index b8b78da6c..babd9c702 100644 --- a/sdk/cpp/core/docsgen/getting_started.rst +++ b/sdk/cpp/core/docsgen/getting_started.rst @@ -97,7 +97,6 @@ The script detects platform OS, installs all the dependencies and builds complet The user must have sudo access to these locations. The YDK extensively uses Python scripts for building its components and model API packages (bundles). -By default the YDK uses Python system installation. 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. @@ -121,14 +120,17 @@ 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] [-p path] Options and arguments: - --cpp install YDK for C++ programming language + --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 (default) - --all install YDK for all supported programming languages + --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 + -n|--no-deps skip installation of dependencies; + applicable only with --cpp and --all options -p|--python-dir path set Python3 installation root directory; if not specified, system installation assumed -h|--help print this help message and exit @@ -137,7 +139,7 @@ Full set of script capabilities could be viewed like this:: 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/ygorelik/venv is assumed + 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; @@ -205,10 +207,10 @@ and YDK gNMI service package. gNMI Service installation ~~~~~~~~~~~~~~~~~~~~~~~~~ -Here is simple example, how gNMI service package for Python could be added:: +Here is simple example, how gNMI service package with Python virtual environment could be added:: cd ydk-gen - ./install_ydk.sh --cpp --service gnmi + ./install_ydk.sh --cpp --service gnmi --venv gNMI runtime environment diff --git a/sdk/cpp/core/samples/CMakeLists.txt b/sdk/cpp/core/samples/CMakeLists.txt index 9d1a6cc26..18f54a991 100644 --- a/sdk/cpp/core/samples/CMakeLists.txt +++ b/sdk/cpp/core/samples/CMakeLists.txt @@ -9,6 +9,6 @@ foreach(sample IN LISTS samples) add_executable(${sample} ${sample}.cpp) set_property(TARGET ${sample} PROPERTY CXX_STANDARD 11) set_property(TARGET ${sample} PROPERTY CXX_STANDARD_REQUIRED ON) - target_link_libraries(${sample} ydk) + target_link_libraries(${sample} ${CPACK_LIBRARY_NAME}) endforeach(sample) diff --git a/sdk/cpp/core/tests/CMakeLists.txt b/sdk/cpp/core/tests/CMakeLists.txt index c72668de4..6e124af8c 100644 --- a/sdk/cpp/core/tests/CMakeLists.txt +++ b/sdk/cpp/core/tests/CMakeLists.txt @@ -24,7 +24,7 @@ foreach(test_name IN LISTS core_tests) add_executable(${test_name} ${test_name}.cpp) set_property(TARGET ${test_name} PROPERTY CXX_STANDARD 11) set_property(TARGET ${test_name} PROPERTY CXX_STANDARD_REQUIRED ON) - target_link_libraries(${test_name} ydk + target_link_libraries(${test_name} ${CPACK_LIBRARY_NAME} curl xslt pcre @@ -39,7 +39,7 @@ endforeach(test_name) add_executable(${YDK_UNITTEST_TARGET_NAME} ${core_tests_src}) set_property(TARGET ${YDK_UNITTEST_TARGET_NAME} PROPERTY CXX_STANDARD 11) set_property(TARGET ${YDK_UNITTEST_TARGET_NAME} PROPERTY CXX_STANDARD_REQUIRED ON) -target_link_libraries(${YDK_UNITTEST_TARGET_NAME} ydk) +target_link_libraries(${YDK_UNITTEST_TARGET_NAME} ${CPACK_LIBRARY_NAME}) add_test(NAME ${YDK_UNITTEST_TARGET_NAME} COMMAND $) configure_file("${PROJECT_SOURCE_DIR}/tests/main.cpp.in" "${PROJECT_SOURCE_DIR}/tests/main.cpp" ESCAPE_QUOTES @ONLY) diff --git a/sdk/cpp/gnmi/CMakeLists.txt b/sdk/cpp/gnmi/CMakeLists.txt index d329a8a66..3087c7453 100644 --- a/sdk/cpp/gnmi/CMakeLists.txt +++ b/sdk/cpp/gnmi/CMakeLists.txt @@ -6,9 +6,11 @@ set(YDK_DESCRIPTION "YANG Development Kit Library. The gNMI library for YDK API. # CPack Dynamic Settings set (CPACK_PACKAGE_NAME "libydk_gnmi") -set (CPACK_PACKAGE_VERSION "${PROJECT_VERSION}") set (CPACK_PACKAGE_RELEASE "5") -set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "YDK gNMI Library") +set (CPACK_PACKAGE_VERSION "${PROJECT_VERSION}.${CPACK_PACKAGE_RELEASE}") +set (CPACK_LIBRARY_NAME "ydk_gnmi-${CPACK_PACKAGE_VERSION}") +set (CPACK_LIBRARY_TARGET "lib${CPACK_LIBRARY_NAME}.a") +set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "YDK gNMI service Library") # CPack Static Settings set (CPACK_PACKAGE_DESCRIPTION "YDK library to support gNMI services. @@ -56,7 +58,7 @@ elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux") # _-_.deb # libydk_0.6.0-0.1.alpha_amd64.deb // Debian set (CPACK_PACKAGE_FILE_NAME - "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_PACKAGE_RELEASE}.${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}") + "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}.${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}") # Linux Fedora elseif(${LSB_RELEASE_ID_SHORT} MATCHES "CentOS") @@ -80,7 +82,7 @@ elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux") # --..(src).rpm # libydk-0.6.0-0.1.alpha.x86_64.rpm // RPM set (CPACK_PACKAGE_FILE_NAME - "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_PACKAGE_RELEASE}.${CPACK_RPM_PACKAGE_ARCHITECTURE}") + "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}.${CPACK_RPM_PACKAGE_ARCHITECTURE}") endif() endif() @@ -199,21 +201,31 @@ include_directories( set(CMAKE_POSITION_INDEPENDENT_CODE ON) -add_library(ydk_gnmi STATIC ${libydk_gnmi_src} ${pb_grpc_sources}) +add_library(${CPACK_LIBRARY_NAME} STATIC ${libydk_gnmi_src} ${pb_grpc_sources}) -target_link_libraries(ydk_gnmi -# ydk +target_link_libraries( + ${CPACK_LIBRARY_NAME} ${GRPC_GRPC++_LIBRARY} ${PROTOBUF_LIBRARY} ) -set_property(TARGET ydk_gnmi PROPERTY CXX_STANDARD 11) -set_property(TARGET ydk_gnmi PROPERTY CXX_STANDARD_REQUIRED ON) +set_property(TARGET ${CPACK_LIBRARY_NAME} PROPERTY CXX_STANDARD 11) +set_property(TARGET ${CPACK_LIBRARY_NAME} PROPERTY CXX_STANDARD_REQUIRED ON) -install(TARGETS ydk_gnmi DESTINATION ${LIB_INSTALL_DIR}) +install(TARGETS ${CPACK_LIBRARY_NAME} DESTINATION ${LIB_INSTALL_DIR}) install(FILES ${libydk_gnmi_install_headers} DESTINATION ${INCLUDE_INSTALL_DIR}) install(FILES ${pb_grpc_headers} DESTINATION ${INCLUDE_INSTALL_DIR}) +SET( legacy_link ${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR}/libydk_gnmi.a) +SET( legacy_target ${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR}/${CPACK_LIBRARY_TARGET}) +ADD_CUSTOM_COMMAND( TARGET ${CPACK_LIBRARY_NAME} + COMMAND echo "Creating symbolic link ${legacy_link}" + COMMAND rm -f ${legacy_link} + COMMAND ln -s ${CPACK_LIBRARY_TARGET} ${legacy_link} + DEPENDS install ${CPACK_LIBRARY_NAME} + ) +ADD_CUSTOM_TARGET( install_legacy DEPENDS ${legacy_target} ) + # generate doxygen documentation for ydk_gnmi API find_package(Doxygen) if(DOXYGEN_FOUND) diff --git a/sdk/go/README.md b/sdk/go/README.md index 4e7e82a12..ab2bad8fc 100644 --- a/sdk/go/README.md +++ b/sdk/go/README.md @@ -114,7 +114,6 @@ The script detects platform OS, installs all the dependencies and builds complet The user must have sudo access to these locations. The YDK extensively uses Python scripts for building its components and model API packages (bundles). -By default the YDK uses Python system installation. 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. @@ -122,6 +121,8 @@ For different location the PYTHON_VENV environment variable should be set to tha **NOTE.** It is strongly recommended to use Python virtual environment on Centos/RHEL and Mac platforms. +When installing YDK for Go programming language, the third party dependencies and C++ packages must be installed first. +These steps require sudo/root access to the installation platform. Here is simple example of core YDK installation for Go programming language and Python virtual environment: ``` @@ -129,6 +130,7 @@ git clone https://gitlab.com/yangorelik/ydk-gen.git cd ydk-gen export YDKGEN_HOME=`pwd` # optional export PYTHON_VENV=$HOME/ydk_vne # optional +./install_ydk.sh --cpp --core --venv ./install_ydk.sh --go --core --venv ``` @@ -140,18 +142,21 @@ 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] [-p path] Options and arguments: - --cpp install YDK for C++ programming language + --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 (default) - --all install YDK for all supported programming languages + --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 packages -s|--service gnmi install gNMI service package - -n|--no-deps skip installation of dependencies + -n|--no-deps skip installation of dependencies; + applicable only with --cpp and --all options -p|--python-dir path set Python3 installation root directory; if not specified, system installation assumed -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 @@ -229,11 +234,12 @@ and YDK gNMI service package. ### gNMI service installation -Here is simple example how gNMI service package for Go programming language could be added: +Here is simple example how gNMI service package for Go programming language and Python virtual environment could be added: ``` cd ydk-gen -./install_ydk.sh --go --service gnmi +./install_ydk.sh --cpp --service gnmi --venv # requires sudo access +./install_ydk.sh --go --service gnmi --venv ``` ### Runtime environment diff --git a/sdk/go/core/docsgen/getting_started.rst b/sdk/go/core/docsgen/getting_started.rst index 060422dee..57f3038fc 100644 --- a/sdk/go/core/docsgen/getting_started.rst +++ b/sdk/go/core/docsgen/getting_started.rst @@ -98,7 +98,6 @@ The script detects platform OS, installs all the dependencies and builds complet The user must have sudo access to these locations. The YDK extensively uses Python scripts for building its components and model API packages (bundles). -By default the YDK uses Python system installation. 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. @@ -112,6 +111,7 @@ Here is simple example of core YDK installation for Go programming language and cd ydk-gen export YDKGEN_HOME=`pwd` # optional export PYTHON_VENV=$HOME/ydk_vne # optional + ./install_ydk.sh --core --cpp --venv # requires sudo access ./install_ydk.sh --core --go --venv @@ -122,14 +122,17 @@ 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] [-p path] Options and arguments: - --cpp install YDK for C++ programming language + --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 (default) - --all install YDK for all supported programming languages + --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 + -n|--no-deps skip installation of dependencies; + applicable only with --cpp and --all options -p|--python-dir path set Python3 installation root directory; if not specified, system installation assumed -h|--help print this help message and exit @@ -138,7 +141,7 @@ Full set of script capabilities could be viewed like this:: 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/ygorelik/venv is assumed + 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; @@ -209,10 +212,11 @@ and YDK gNMI service package. gNMI Service installation ~~~~~~~~~~~~~~~~~~~~~~~~~ -Here is simple example, how gNMI service package for Go could be added:: +Here is simple example, how gNMI service package for Go and Python virtual environment could be added:: cd ydk-gen - ./install_ydk.sh --go --service gnmi + ./install_ydk.sh --cpp --service gnmi --venv # requires sudo access + ./install_ydk.sh --go --service gnmi --venv gNMI runtime environment diff --git a/sdk/go/gnmi/README.md b/sdk/go/gnmi/README.md index 80e7e32b2..b5a614fb0 100644 --- a/sdk/go/gnmi/README.md +++ b/sdk/go/gnmi/README.md @@ -30,11 +30,11 @@ In order to enable YDK support for gNMI protocol, which is optional, the followi ### gNMI package installation -For gNMI Go package installation, which is optional, perform this steps. +For gNMI Go package installation, which is optional, perform these steps. ``` $ cd /your-path-to-ydk-gen -$ ./generate.py -i --service profiles/services/gnmi-0.4.0.json --go +$ python3 generate.py -i --service profiles/services/gnmi-0.4.0.json --go ``` #### Runtime environment diff --git a/sdk/python/README.rst b/sdk/python/README.rst index 6891d2611..74e1d1be5 100644 --- a/sdk/python/README.rst +++ b/sdk/python/README.rst @@ -76,7 +76,7 @@ See the `docker documentation `_ 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 + docker run -it ydksolutions/ydk-gen:0.8.6.3 System Requirements @@ -128,12 +128,13 @@ To activate YDK runtime environment simply run this command once in bash shell: source .env The YDK extensively uses Python scripts for building its components and model API packages (bundles). -By default the YDK uses Python system installation. 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. If user has different location, the PYTHON_VENV environment variable should be set to that location. +When installing YDK for Python programming language, the third party dependencies and C++ packages must be installed first. +These steps require sudo/root access to the installation platform. Here is simple example of core YDK installation for Python programming language and Python virtual environment: .. code-block:: sh @@ -142,7 +143,8 @@ Here is simple example of core YDK installation for Python programming language cd ydk-gen export YDKGEN_HOME=`pwd` # optional export PYTHON_VENV=$HOME/ydk_vne # optional - ./install_ydk.sh --core --venv + ./install_ydk.sh --cpp --core --venv # requires sudo access + ./install_ydk.sh --py --core --venv The script also allows to install individual components like dependencies, core, and service packages @@ -152,14 +154,17 @@ 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] [-p path] Options and arguments: - --cpp install YDK for C++ programming language + --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 (default) - --all install YDK for all supported programming languages + --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 + -n|--no-deps skip installation of dependencies; + applicable only with --cpp and --all options -p|--python-dir path set Python3 installation root directory; if not specified, system installation assumed -h|--help print this help message and exit @@ -168,7 +173,7 @@ Full set of script capabilities could be viewed like this:: 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/ygorelik/venv is assumed + 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; @@ -242,7 +247,8 @@ gNMI service installation Here is simple example, how gNMI service package for Python could be added:: cd ydk-gen - ./install_ydk.sh --py --service gnmi -v + ./install_ydk.sh --cpp --service gnmi --venv # requires sudo access + ./install_ydk.sh --py --service gnmi --venv gNMI runtime environment @@ -255,8 +261,7 @@ There is an open issue with gRPC on Centos/RHEL, which requires an extra step be 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=$HOME # Default location defined during installation - export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PROTO/grpc/libs/opt:$PROTO/protobuf-3.5.0/src/.libs:/usr/local/lib:/usr/local/lib64 + export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib:/usr/local/lib64 Bundle Installation @@ -298,7 +303,6 @@ Documentation and Support Available resources: -- Read the `API documentation `_ (release 0.8.3) for details on how to use the API and specific models - Find some app samples in the `samples directory `_ - Find hundreds of additional samples in the `YDK-PY samples repository `_ - Join the `YDK community `_ to connect with YDK users and developers diff --git a/sdk/python/core/docsgen/getting_started.rst b/sdk/python/core/docsgen/getting_started.rst index bf78525f1..65ce2350b 100644 --- a/sdk/python/core/docsgen/getting_started.rst +++ b/sdk/python/core/docsgen/getting_started.rst @@ -109,12 +109,13 @@ To activate YDK runtime environment simply run this command once in bash shell: source .env The YDK extensively uses Python scripts for building its components and model API packages (bundles). -By default the YDK uses Python system installation. 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. If user has different location, the PYTHON_VENV environment variable should be set to that location. +When installing YDK for Python programming language, the third party dependencies and C++ packages must be installed first. +This step requires sudo/root access to the installation platform. Here is simple example of core YDK installation for Python programming language with virtual environment: .. code-block:: sh @@ -123,7 +124,8 @@ Here is simple example of core YDK installation for Python programming language cd ydk-gen export YDKGEN_HOME=`pwd` # optional export PYTHON_VENV=$HOME/ydk_vne # optional - ./install_ydk.sh --core --venv + ./install_ydk.sh --cpp --core --venv + ./install_ydk.sh --py --core --venv The script also allows to install individual components like dependencies, core, and service packages @@ -133,14 +135,17 @@ 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] [-p path] Options and arguments: - --cpp install YDK for C++ programming language + --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 (default) - --all install YDK for all supported programming languages + --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 + -n|--no-deps skip installation of dependencies; + applicable only with --cpp and --all options -p|--python-dir path set Python3 installation root directory; if not specified, system installation assumed -h|--help print this help message and exit @@ -149,7 +154,7 @@ Full set of script capabilities could be viewed like this:: 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/ygorelik/venv is assumed + 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; @@ -224,7 +229,8 @@ gNMI Service installation Here is simple example, how gNMI service package for Python could be added:: cd ydk-gen - ./install_ydk.sh --service gnmi -v + ./install_ydk.sh --cpp --service gnmi --venv # requires sudo access + ./install_ydk.sh --py --service gnmi --venv gNMI runtime environment @@ -237,7 +243,7 @@ There is an open issue with gRPC on Centos/RHEL, which requires an extra step be 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:~/grpc/libs/opt:~/protobuf-3.5.0/src/.libs:/usr/local/lib:/usr/local/lib64 + export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib:/usr/local/lib64 Bundle Installation @@ -283,7 +289,7 @@ Generation script All the YDK components/packages can be generated by using Python script `generate.py`. To get all of its options run:: cd ydk-gen - ./generate.py --help + python3 generate.py --help usage: generate.py [-h] [-l] [--core] [--service SERVICE] [--bundle BUNDLE] [--adhoc-bundle-name ADHOC_BUNDLE_NAME] [--adhoc-bundle ADHOC_BUNDLE [ADHOC_BUNDLE ...]] diff --git a/sdk/version.json b/sdk/version.json index 12c64ec70..3ee2412ca 100644 --- a/sdk/version.json +++ b/sdk/version.json @@ -1,9 +1,10 @@ { "core": "0.9.1.1", "version": "0.9.1.1", - "ietf": "0.1.5-post2", - "openconfig": "0.1.8", - "cisco_ios_xr": "6.6.2", + "gnmi-service": "0.4.0.5", + "ietf": "0.1.6", + "openconfig": "0.1.9", + "cisco_ios_xr": "7.0.2", "cisco_ios_xe": "16.9.3", "cisco_nx_os": "9.3.1" }