Skip to content

Commit

Permalink
Resolved GitHub issue CiscoDevNet#1064
Browse files Browse the repository at this point in the history
  • Loading branch information
ygorelik committed Jun 11, 2022
1 parent dacd421 commit d82a781
Show file tree
Hide file tree
Showing 13 changed files with 82 additions and 39 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
* IndexError on decoding empty string value in JSON payload ([#1061](https://github.com/CiscoDevNet/ydk-gen/issues/1061))
* gNMI service installation on Centos 8.2 fails due to C++ compiler error
([#1062](https://github.com/CiscoDevNet/ydk-gen/issues/1062))
* The installation script fails on fresh new CentOS 7 docker container ([#1064](https://github.com/CiscoDevNet/ydk-gen/issues/1064))

#### Bundle improvements
* Updated cisco-ios-xr bundle (profile cisco-ios-xr_6_7_3.json) to support Cisco IOS XR 6.7.3
Expand Down
29 changes: 18 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@ YANG Development Kit
- [C++ requirements](#c-requirements)
- [Directory structure](#directory-structure)
- [Troubleshooting](#troubleshooting)
- [Running Unit Tests](#running-unit-tests)
- [Running Unit Tests](#running-unit-tests)
- [Python](#python)
- [C++](#c)
- [Go](#go)
- [Documentation and Support](#documentation-and-support)
- [Release Notes](#release-notes)

Expand Down Expand Up @@ -100,8 +103,7 @@ Hence all model bundles located in [Python Package Index](https://pypi.org/searc

The C++ generated model API 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

Expand All @@ -119,7 +121,8 @@ docker run -it ydksolutions/ydk:0.9.1.1

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), and Focal (20.04 LTS)
- Linux CentOS/RHEL versions 7 and 8.2
- 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.6.2 (Big Sur)

On Windows 10 the Linux virtual machine can run using Windows Subsystem for Linux (WSL);
Expand All @@ -135,6 +138,7 @@ All YDK core components are based on C and C++ code. These components compiled u
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.

# Core Installation

Expand All @@ -153,9 +157,9 @@ source .env
```

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, it is recommended to use Python virtual environment,
which is created by the installation script as part of default behavior. However the user can alter the default behavior
and force the YDK to use system or customer Python installation.
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.
For different location the PYTHON_VENV environment variable should be set to that location.

Expand Down Expand Up @@ -425,14 +429,16 @@ YDK runtime environment must be activated prior to these procedures.

### For Python

If applicable, the Python virtual environment must be activated prior to these procedures

```
./generate.py --python --bundle profiles/bundles/<name-of-profile>.json -is
./generate.py --python --bundle profiles/bundles/<name-of-profile>.json -i
```

Check Python packages installed:

```
$ pip list | grep ydk
pip list | grep ydk
ydk (0.9.1.1)
ydk-models-<name-of-bundle> (0.5.1)
...
Expand All @@ -441,7 +447,7 @@ ydk-models-<name-of-bundle> (0.5.1)
### For Go

```
./generate.py --go --bundle profiles/bundles/<name-of-profile>.json -is
./generate.py --go --bundle profiles/bundles/<name-of-profile>.json -i
```

### For C++
Expand Down Expand Up @@ -606,8 +612,9 @@ The script will install core and bundle packages and then perform the unit tests

# Documentation and Support

- 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
<!--- - 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 -->
<!--- - Check [GitHub Pages](https://ygorelik.github.io/ydk-gen/) for the latest YDK release documentation -->
- Complete YDK documentation is available locally from the ydk-gen repository by opening web page _docs/index.html_ from any available internet browser
- Find hundreds of sample apps in the [YDK-PY samples repository](https://github.com/CiscoDevNet/ydk-py-samples)
- Join the [YDK community](https://communities.cisco.com/community/developer/ydk) to connect with YDK users and developers

Expand Down
20 changes: 16 additions & 4 deletions install_ydk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,9 @@ function init_go_env {
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
Expand Down Expand Up @@ -196,15 +199,15 @@ function install_cpp_core {
print_msg "Installing C++ core library"
cd $YDKGEN_HOME
local cpp_sudo_flag
if [ $USER != "root" ]; then cpp_sudo_flag="s"; fi
if [ $(id -u -n) != "root" ]; then cpp_sudo_flag="s"; fi
run_cmd $PYTHON_BIN generate.py --core --cpp -i$cpp_sudo_flag
}

function install_cpp_gnmi {
print_msg "Building C++ core gnmi library"
cd $YDKGEN_HOME
local cpp_sudo_flag
if [ $USER != "root" ]; then cpp_sudo_flag="s"; fi
if [ $(id -u -n) != "root" ]; then cpp_sudo_flag="s"; fi
run_cmd $PYTHON_BIN generate.py --service profiles/services/gnmi-0.4.0.json --cpp -i$cpp_sudo_flag
}

Expand Down Expand Up @@ -300,6 +303,7 @@ function install_ydk_go {
}

function write_env_file {
print_msg "Writing .env file"
cd ${YDKGEN_HOME}
rm -f .env
echo "# ------------------------------------------------------------------
Expand Down Expand Up @@ -342,9 +346,11 @@ fi"
if [ -z \$GOPATH ]; then
export GOPATH=$HOME/go
fi
export CXX=/usr/bin/c++
export CC=/usr/bin/cc
" >> .env
fi
if [ $service_pkg == "gnmi" ]; then
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
Expand Down Expand Up @@ -497,10 +503,16 @@ if [[ ${os_type} == "Linux" ]]; then
print_msg "WARNING! Unsupported Ubuntu distribution found. Will try the best efforts."
fi
elif [[ ${os_info} == *"fedora"* ]]; then
rhel_version=$(echo `lsb_release -r` | awk '{ print $2 }' | cut -d '.' -f 1)
rhel_version=$(echo "${os_info}" | grep -w VERSION_ID | awk -F[\"] '{print $2}')
if [[ $rhel_version != 7 && $rhel_version != 8 ]]; then
print_msg "WARNING! Unsupported Centos/RHEL version. Will try the best efforts."
fi
if [[ $rhel_version == 8 && ${os_info} == *"CentOS"* ]]; then
os_name=$(echo "${os_info}" | grep -w NAME | awk -F[\"] '{print $2}')
if [[ $os_name != *"Stream" ]]; then
print_msg "Unsupported CentOS version 8 (EOL). Will try the best efforts."
fi
fi
else
MSG_COLOR=${RED}
print_msg "Unsupported Linux distribution detected"
Expand Down
11 changes: 8 additions & 3 deletions sdk/cpp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,9 @@ docker run -it ydksolutions/ydk:0.9.1.1

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), and Focal (20.04 LTS)
- Linux CentOS/RHEL versions 7 and 8
- MacOS up to 10.14.6 (Mojave)
- 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.6.2 (Big Sur)

On Windows 10 the Linux virtual machine can run using Windows Subsystem for Linux (WSL);
check [this](https://www.windowscentral.com/install-windows-subsystem-linux-windows-10) for virtual machine installation procedure.
Expand All @@ -103,6 +104,7 @@ All YDK core components are based on C and C++ code. These components compiled u
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.

## Core Installation

Expand All @@ -111,6 +113,7 @@ The user must have sudo access in order to install YDK core components to these
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.
Make sure the `sudo` package is installed on your platform prior to the YDK installation procedure.

The YDK extensively uses Python scripts for building its components and model API packages (bundles).
By default the YDK uses Python system installation.
Expand All @@ -119,6 +122,8 @@ If built, the user must manually activate virtual environment when generating mo
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:

```
Expand All @@ -140,7 +145,7 @@ Options and arguments:
--cpp install YDK for C++ programming language
--go install YDK for Go programming language
--py|--python install YDK for Python programming language (default)
--all install YDK for all available programming languages
--all install YDK for all supported programming languages
-v|--venv create python virtual environment
-c|--core install YDK core packages
-s|--service gnmi install gNMI service package
Expand Down
9 changes: 6 additions & 3 deletions sdk/cpp/core/docsgen/getting_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,9 @@ System Requirements
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), and Focal (20.04 LTS)
- Linux CentOS/RHEL versions 7 and 8
- MacOS up to 10.14.6 (Mojave)
- 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.6.2 (Big Sur)

On Windows 10 the Linux virtual machine can run using Windows Subsystem for Linux (WSL);
check `this <https://www.windowscentral.com/install-windows-subsystem-linux-windows-10>`_ for virtual machine installation procedure.
Expand All @@ -79,6 +80,7 @@ All YDK core components are based on C and C++ code. These components compiled u
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.

**NOTE.** Due to GitHub issue `#1050 <https://github.com/CiscoDevNet/ydk-gen/issues/1050>`_ YDK is not supported with Python 3.9.x.

Expand All @@ -93,6 +95,7 @@ Installation Script
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.
Make sure the `sudo` package is installed on your platform prior to the YDK installation procedure.

The YDK extensively uses Python scripts for building its components and model API packages (bundles).
By default the YDK uses Python system installation.
Expand Down Expand Up @@ -122,7 +125,7 @@ Full set of script capabilities could be viewed like this::
--cpp install YDK for C++ programming language
--go install YDK for Go programming language
--py|--python install YDK for Python programming language (default)
--all install YDK for all available programming languages
--all install YDK for all supported programming languages
-v|--venv create python virtual environment
-c|--core install YDK core package
-s|--service gnmi install gNMI service package
Expand Down
11 changes: 8 additions & 3 deletions sdk/go/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,9 @@ See the [docker documentation](https://docs.docker.com/engine/reference/run/) fo

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), and Focal (20.04 LTS)
- Linux CentOS/RHEL versions 7 and 8
- MacOS up to 10.14.6 (Mojave)
- 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.6.2 (Big Sur)

On Windows 10 the Linux virtual machine can run using Windows Subsystem for Linux (WSL);
check [this](https://www.windowscentral.com/install-windows-subsystem-linux-windows-10) for virtual machine installation procedure.
Expand All @@ -102,6 +103,7 @@ All YDK core components are based on C and C++ code. These components compiled u
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.

## Core Installation

Expand All @@ -110,6 +112,7 @@ The user must have sudo access in order to install YDK core components to these
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.
Make sure the `sudo` package is installed on your platform prior to the YDK installation procedure.

The YDK extensively uses Python scripts for building its components and model API packages (bundles).
By default the YDK uses Python system installation.
Expand All @@ -118,6 +121,8 @@ If built, the user must manually activate virtual environment when generating mo
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 Go programming language:

```
Expand All @@ -139,7 +144,7 @@ Options and arguments:
--cpp install YDK for C++ programming language
--go install YDK for Go programming language
--py|--python install YDK for Python programming language (default)
--all install YDK for all available programming languages
--all install YDK for all supported programming languages
-v|--venv create python virtual environment
-c|--core install YDK core packages
-s|--service gnmi install gNMI service package
Expand Down
2 changes: 1 addition & 1 deletion sdk/go/core/docsgen/api/path/netconf_session.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Netconf Session
.. attribute:: Repo

An instance of :go:struct:`Repository<ydk/types/Repository>`. This attribute represents the repository of YANG models.
When not specified, the model repository path is set to `$USER/.ydk`.
When not specified, the model repository path is set to `$HOME/.ydk`.

.. attribute:: Address

Expand Down
9 changes: 6 additions & 3 deletions sdk/go/core/docsgen/getting_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,9 @@ System Requirements
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), and Focal (20.04 LTS)
- Linux CentOS/RHEL versions 7 and 8
- MacOS up to 10.14.6 (Mojave)
- 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.6.2 (Big Sur)

On Windows 10 the Linux virtual machine can run using Windows Subsystem for Linux (WSL);
check `this <https://www.windowscentral.com/install-windows-subsystem-linux-windows-10>`_ for virtual machine installation procedure.
Expand All @@ -80,6 +81,7 @@ All YDK core components are based on C and C++ code. These components compiled u
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.

**NOTE.** Due to GitHub issue `#1050 <https://github.com/CiscoDevNet/ydk-gen/issues/1050>`_ YDK is not supported with Python 3.9.x.

Expand All @@ -94,6 +96,7 @@ Installation Script
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.
Make sure the `sudo` package is installed on your platform prior to the YDK installation procedure.

The YDK extensively uses Python scripts for building its components and model API packages (bundles).
By default the YDK uses Python system installation.
Expand Down Expand Up @@ -123,7 +126,7 @@ Full set of script capabilities could be viewed like this::
--cpp install YDK for C++ programming language
--go install YDK for Go programming language
--py|--python install YDK for Python programming language (default)
--all install YDK for all available programming languages
--all install YDK for all supported programming languages
-v|--venv create python virtual environment
-c|--core install YDK core package
-s|--service gnmi install gNMI service package
Expand Down
Loading

0 comments on commit d82a781

Please sign in to comment.