Skip to content

[docker-ptf] Build and add gnmi_get#4720

Closed
pra-moh wants to merge 6 commits intosonic-net:masterfrom
pra-moh:add_gnmiget_toptfdocker
Closed

[docker-ptf] Build and add gnmi_get#4720
pra-moh wants to merge 6 commits intosonic-net:masterfrom
pra-moh:add_gnmiget_toptfdocker

Conversation

@pra-moh
Copy link
Copy Markdown
Contributor

@pra-moh pra-moh commented Jun 6, 2020

Download go package
set up required variables
go get gnmi_get to fetch gnmi_get

- Why I did it
For telemetry regression test we need gnmi_get(gnmi client) to be present on ptfdocker. Gnmi-server will be present on SONiC DuT. Further, we can access gnmi_get from ptfdocker inside pytest to verify gnmi server streaming data successfully or not.

- How I did it
Added changes to Dockerfile.j2 for ptfdocker
- How to verify it
Build logs under target/docker-ptf.gz.log. Logs show :

  1. wget has been success with go.tgz
  2. output of go env showing mandatory variables set up
  3. output of ls -l /$HOME/go shows gnmi_get present. This verified go get step has been sucessful
^[[0m^[[91m2020-06-06 01:47:33 (84.5 MB/s) - 'go.tgz' saved [127228112/127228112]

^[[0mgo version go1.12 linux/amd64
GOARCH="amd64"
GOBIN=""
GOCACHE="/root/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/root/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build618910343=/tmp/go-build -gno-record-gcc-switches"
total 14752
-rwxr-xr-x 1 root root 15105819 Jun 6 01:48 gnmi_get
Removing intermediate container b14979f76937
---> 3675ea45711a
Step 17/19 : EXPOSE 22 8009
---> Running in 9120160a690f

**- Description for the changelog**

- A picture of a cute animal (not mandatory but encouraged)

@jleveque jleveque changed the title [ptfdocker] Build and add gnmi_get on ptfdocker [docker-ptf] Build and add gnmi_get Jun 6, 2020
hui-ma
hui-ma previously approved these changes Jun 6, 2020
Copy link
Copy Markdown
Contributor

@hui-ma hui-ma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lGTM

&& mkdir $HOME/go \
&& export GOPATH=$HOME/go \
&& go env \
&& go get github.com/jipanyang/gnxi/gnmi_get \
Copy link
Copy Markdown
Collaborator

@lguohan lguohan Jun 7, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why from jipan? I do not think we can rely on his personal project for our testing.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gnmi_get
-xpath_target CONFIG_DB
-xpath "/system/openflow/agent/config/datapath-id"
-xpath "/system/openflow/controllers/controller[name=main]/connections/connection[aux-id=0]/state/address"
-target_addr localhost:10161
-target_name hostname.com
-key client.key
-cert client.crt
-ca ca.crt
-username foo
-password bar
-alsologtostderr

Sonic gnmi has special parameter "xpath_target" which is not available in official tool. SO the community has been using the private version so far. We can propose to back port to master, which will take time. I think before that, we can use this private branch instead of forking the source code to sonic telemetry repro.

daall
daall previously approved these changes Jun 8, 2020
Copy link
Copy Markdown
Contributor

@daall daall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM pending the discussion about which gnmi branch to use

hui-ma
hui-ma previously approved these changes Jun 30, 2020
&& mkdir /etc/go \
&& export GOPATH=/etc/go \
&& rm go$VERSION.linux-*.tar.gz \
&& go get github.com/jipanyang/gnxi/gnmi_get \
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added py_gnmi.py
^[[0m^[[91m2020-07-08 05:39:25 (1.80 MB/s) - 'py_gnmicli.py' saved [203888]

^[[0mtotal 300
-rw-r--r-- 1 root root 970 Jul 8 05:39 CONTRIBUTING.md
-rw-r--r-- 1 root root 11357 Jul 8 05:39 LICENSE
-rw-r--r-- 1 root root 2302 Jul 8 05:39 README.md
drwxr-xr-x 2 root root 4096 Jul 8 05:39 certs
-rw-r--r-- 1 root root 573 Jul 8 05:39 doc.go
drwxr-xr-x 3 root root 4096 Jul 8 05:39 gnmi
drwxr-xr-x 2 root root 4096 Jul 8 05:39 gnmi_capabilities
drwxr-xr-x 2 root root 4096 Jul 8 05:39 gnmi_cli_py

Copy link
Copy Markdown
Collaborator

@lguohan lguohan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pra-moh pra-moh dismissed stale reviews from hui-ma and daall via 7b0569c July 8, 2020 06:14
&& cd /etc/go \
&& git clone https://github.com/google/gnxi.git \
&& cd /etc/go/gnxi \
&& wget https://github.com/lguohan/gnxi/blob/master/gnmi_cli_py/py_gnmicli.py \
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is python, so you do not need to install go lang.

here is what you should do:

  1. git clone https://github.com/lguohan/gnxi/tree/master/gnmi_cli_py and check out specific commit id. d01b36e
  2. follow instructions https://github.com/lguohan/gnxi/tree/master/gnmi_cli_py to install required tools.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lguohan: Do you plan to open a PR to upstream your patch?

@hui-ma
Copy link
Copy Markdown
Contributor

hui-ma commented Jul 8, 2020

Suggest creating a new PR for add python tool

@pra-moh pra-moh closed this Jul 9, 2020
@pra-moh
Copy link
Copy Markdown
Contributor Author

pra-moh commented Jul 9, 2020

Creating a separate PR to build pyclient.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants