ypgnmi-app Installation
The following sections describe the steps to install and test ypgnmi-app application.
gNMI Prerequisites
Install the Go programming language.
Version 'go1.19' or higher is required. To verify the installation and to verify the version of the installed GO run the following:
mydir> go version
go version go1.19 linux/amd64
gNMI Source Code Installation
If you have installed the YumaPro from the source code then you need to build and install using EVERYTHING=1 or use the WITH_RESTCONF=1 and WITH_YCONTROL=1 flags must be used. In addition, the WITH_GNMI=1 make variable must be used.
Example: Build the netconfd-pro server with gNMI support:
make DEBUG=1 DEBUG2=1 EVERYTHING=1 WITH_GNMI=1 USE_WERROR=1
sudo make DEBUG=1 DEBUG2=1 EVERYTHING=1 WITH_GNMI=1 USE_WERROR=1 install
Additional custom and optional parameters can be added with the GO_PATH=$CUSTOM_GOPATH and GO_BIN=$CUSTOM_GOBIN flags if needed.
Setting up a Custom GO Workspace
To install ypgnmi-app in a custom location
set the custom $GOPATH and $GOBIN Variables.
Otherwise, the default $HOME/go
GO workspace will be used
and ypgnmi-app application dependencies will be installed there.
Follow these steps
to setup a custom workspace and Variables.
The Build Variables GO_PATH=$CUSTOM_GOPATH and GO_BIN=$CUSTOM_GOBIN are needed if a custom workspace is used.
GO_BIN=<dirspec>
This specifies the $GOBIN variable dirspec to use when building ypgnmi-app application. The default is $HOME/go/bin. Ignored if PACKAGE_BUILD=1 is also used.
GO_PATH=<dirspec>
Specifies the $GOPATH variable dirspec to use when building ypgnmi-app application. The default is $HOME/go. Ignored if PACKAGE_BUILD=1 is also used.
In this case, the ypgnmi-app will be installed into your custom
$GOBIN location. By default, the application is installed in the
/usr/bin/
.
yumapro-gnmi Binary Package Installation
If you do not have source code and need to install the YumaPro with a
binary package then the application will be installed in the default
/usr/bin
location. If you'd like to use a different directory move
the binary to your desired location.
You will have to create your workspace directory
Setup $GOBIN and $GOPATH variables and install all dependencies
Create your workspace directory,
$HOME/go
.Set the $GOPATH environment variable
mydir> mkdir -p ~/go
The $GOPATH can be any directory on your system. $HOME/go
is
the default $GOPATH on Unix-like systems since Go 1.8.
Note
The $GOPATH must not be on the same path as your Go installation.
Edit ~/.bash_profile
(or ~/.bashrc
if that is present instead)
to add the following lines:
export GOPATH=$HOME/go
export GOBIN=$GOPATH/bin
Save and exit your editor. Then, source this file
mydir> source ~/.bash_profile
Upgrade to the latest go version.
If you get an error similar to:
mydir> go get github.com/aws/aws-sdk-go/aws
go: go.mod file not found in the current directory or any parent directory.
'go get' is no longer supported outside a module.
To build and install a command, use 'go install' with a version,
like 'go install example.com/cmd@latest'
For more information, see https://golang.org/doc/go-get-install-deprecation
or run 'go help get' or 'go help install'.
Follow the instructions provided in the error or re-run the command as follows:
mydir> GO111MODULE=off go get github.com/aws/aws-sdk-go/aws
Repeat the same steps for go install.
Generate the CA Certificates
Generate the client and server certificates. If you have already installed the certificates required for TLS as described in the section Configure TLS of the YumaPro SDK Installation Guide make sure copies of the client and server keys and certs are in ~/certs and also the ca.crt is available.
-rw-rw-r-- 1 john john 956 Aug 9 10:41 ca.crt
-rw-rw-r-- 1 john john 969 Aug 2 11:00 client.crt
-rw-rw-r-- 1 john john 1704 Aug 2 11:00 client.key
-rw-rw-r-- 1 john john 964 Aug 2 11:01 server.crt
-rw-rw-r-- 1 john john 1704 Aug 2 11:01 server.key
Then you can skip to the next section.
If you have not installed TLS certificates follow these steps:
mydir> mkdir ~/certs
mydir> cp /usr/share/yumapro/util/generate-keys.sh ~/certs
or
mydir> cp netconfd/util/generate-keys.sh ~/certs
mydir> cd ~/certs
certs> ./generate-keys.sh
The 'generate-keys.sh' script contains one line where it configures the server's Common Name and other parameters:
SUBJ="/C=/ST=/L=/O=/CN=your_target_name"
Change it to your target name. By default, the value is restconf
. You
may keep it for testing, but during the gNMI client requests make sure
to specify this target name.
In case your gNMI client requires certificates that do not rely on legacy Common Name field and use a Subject Alternative Name (SAN) instead, then refer to Generating Certificates with a SAN