I have two options:
- gnmi_get / gnmi_set (less preferred for me)
- gnmic (preferred and much easier install)
gnmi_get / gnmi_set installation
Some notes how to quickly Install GNMI client (gnmi_get) in Centos or Red Hat Linux. You can get more info at https://github.com/google/gnxi
I ran into a couple of issues, check last section for troubleshooting ideas.
Install go
If you have go, skip this section
cd ~ curl -O https://storage.googleapis.com/golang/go1.16.5.linux-amd64.tar.gz tar -xvf go1.16.5.linux-amd64.tar.gz mv go /usr/local/.
Now, add GOPATH and GOBIN to your path in .bash_profile
[root ~]# cat .bash_profile # .bash_profile # Get the aliases and functions if [ -f ~/.bashrc ]; then . ~/.bashrc fi # User specific environment and startup programs PATH=$PATH:/usr/local/go/bin:$HOME/bin GOROOT=/usr/local/go GOBIN=/usr/local/go/bin export PATH export GOROOT export GOBIN [root ~]# source .bash_profile
Check it
[root ~]# go version go version go1.16.5 linux/amd64
Install GNMI client
go get github.com/google/gnxi cd /usr/local/go/src/github.com/google/gnxi go install ./... cd $GOPATH/bin chmod 755 ./../src/github.com/google/gnxi/certs/generate.sh ./../src/github.com/google/gnxi/certs/generate.sh
Test it
[root ~]# gnmi_get F0607 14:59:18.862111 125755 credentials.go:138] Please provide a -target_name
And you’re good to go!
Install gnmic
Also, you have the option of gnmic (preferred). The installation is very simple:
bash -c "$(curl -sL https://get-gnmic.kmrd.dev)"
Troubleshooting
I got some issues with the paths for go after executing ‘go get github.com/google/gnxi’. I couldn’t find the github src folder. Something wrong with my GOROOT and GOPATH env variables: “warning: GOPATH set to GOROOT (/usr/local/go) has no effect”
Then I went to the path were I called it and found this:
cd ~/go/pkg/mod/github.com/google/
What I did after to fix was:
mkdir -p /usr/local/go/src/github.com/google mv gnxi\@v0.0.0-20210423111716-4b504ef806a7 /usr/local/go/src/github.com/google/gnxi cd /usr/local/go/src/github.com/google/gnxi go install ./... ## and the rest stay the same like above...
See ya!