google / google/gnxi

Why gnmi_get work, but py_gnmicli.py NOT work ?

Open
#91 9 comments 0 reactions 0 assignees View on GitHub
gnmi py
Dominant language
Python
Stars
289
Forks
131
Avg merge
1d 28m
Merged PRs (30d)
1

Description

Hi all,

I write gnmi server follow [SONiC/TELEMETRY](https://github.com/Azure/sonic-telemetry/tree/master/telemetry). The server side start command use '--insecure', which is:
```
/usr/sbin/telemetry -logtostderr --log_to_syslog=true --insecure --port 8080 --allow_no_client_auth -v=2
```
And server side is written by GO, using "google.golang.org/grpc"

And I use [gnmi_get](https://github.com/google/gnxi/tree/master/gnmi_get) as gnmi client, and it works, like this:
```
gyw@sonic107:~/go/src/github.com/google/gnxi/gnmi_get$ gnmi_get -xpath_target "MTNOS" -xpath "/interfaces/interface[name=Ethernet16]" -target_addr 172.18.8.241:8080 -alsologtostderr -insecure true
== getRequest:
prefix: <
target: "MTNOS"
>
path: <
elem: <
name: "interfaces"
>
elem: <
name: "interface"
key: <
key: "name"
value: "Ethernet16"
>
>
>
encoding: JSON_IETF

== getResponse:
notification: <
prefix: <
target: "MTNOS"
>
update: <
path: <
elem: <
name: "interfaces"
>
elem: <
name: "interface"
key: <
key: "name"
value: "Ethernet16"
>
>
>
val: <
json_ietf_val: "{\"admin_status\":2,\"enabled\":{},\"oper_status\":3}"
>
>
>
```
And this is written by GO, using "google.golang.org/grpc"

But when I change to [py_gnmicli.py](https://github.com/google/gnxi/blob/master/gnmi_cli_py/py_gnmicli.py), it NOT work, like this, WHY ???
```
gyw@sonic107:~/go/src/github.com/google/gnxi/gnmi_cli_py$ python3 py_gnmicli.py -m get -t 172.18.8.241 -p 8080 -x "/interfaces/interface[name=Ethernet16]" -n
Performing GetRequest, encoding=JSON_IETF to 172.18.8.241 with the following gNMI Path
-------------------------
elem {
name: "interfaces"
}
elem {
name: "interface"
key {
key: "name"
value: "Ethernet16"
}
}

Traceback (most recent call last):
File "py_gnmicli.py", line 415, in
main()
File "py_gnmicli.py", line 384, in main
response = _get(stub, paths, user, password)
File "py_gnmicli.py", line 277, in _get
return stub.Get(gnmi_pb2.GetRequest(path=[paths], encoding='JSON_IETF'))
File "/usr/local/lib/python3.5/dist-packages/grpc/_channel.py", line 550, in __call__
return _end_unary_response_blocking(state, call, False, None)
File "/usr/local/lib/python3.5/dist-packages/grpc/_channel.py", line 467, in _end_unary_response_blocking
raise _Rendezvous(state, None, None, deadline)
grpc._channel._Rendezvous: <_Rendezvous of RPC that terminated with:
status = StatusCode.UNAVAILABLE
details = "Socket closed"
debug_error_string = "{"created":"@1590563380.688673642","description":"Error received from peer","file":"src/core/lib/surface/call.cc","file_line":1036,"grpc_message":"Socket closed","grpc_status":14}"
>
```
And this is written by PYTHON, using "grpc"

Then I capture TCP message using tcpdump, I found:
1) It's TCP message, NOT GRPC message (this is show by wireshark, maybe wireshark is wrong?), when I use gnmi_get as client to send gRPC request.
2) It's GRPC message(this is show by wireshark), when I use py_gnmicli.py as client to send gRPC request.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.