Skip to content

Why gnmi_get work, but py_gnmicli.py NOT work ? #91

Open

Description

Hi all,

I write gnmi server follow SONiC/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 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, 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 <module>
    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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions