aristanetworks / goarista

Fairly general building blocks used in Arista Go code and open-sourced for the benefit of all.
Apache License 2.0
213 stars 68 forks source link

gnmireverse client fails to run #61

Closed Gaurav-Pande closed 3 years ago

Gaurav-Pande commented 3 years ago

Hi,

I am trying to run gnmireverse client on my linux machine(ubuntu 18.04). I am running go version go1.10.4 linux/amd64. When I am running the client I am getting the bellow error:

:~/work/src$ go install gnmireverse/client
# github.com/aristanetworks/goarista/dscp
github.com/aristanetworks/goarista/dscp/dial.go:20:10: unknown field 'Control' in struct literal of type net.Dialer
github.com/aristanetworks/goarista/dscp/dial.go:38:10: unknown field 'Control' in struct literal of type net.Dialer
github.com/aristanetworks/goarista/dscp/dial.go:56:10: unknown field 'Control' in struct literal of type net.Dialer
github.com/aristanetworks/goarista/dscp/dscp_unix.go:25:9: undefined: net.ListenConfig
# golang.org/x/net/http2
golang.org/x/net/http2/client_conn_pool.go:305:6: undefined: errors.Is
golang.org/x/net/http2/server.go:234:72: undefined: tls.VersionTLS13

am I doing something wrong here?

aaronbee commented 3 years ago

The errors are due to using too old of a version of Go. Only go1.15 and go1.16 are currently supported. I'd recommend the latest go1.16.

Gaurav-Pande commented 3 years ago

Thanks @aaronbee !

Gaurav-Pande commented 3 years ago

Hi @aaronbee,

Apologies for reopening the issue and being naïve here. I am trying to understand the design followed in this code and the Openconfig design. I have few follow up questions regarding the design from the client/ server perspective.

Design Question:

  1. Based on my understanding(Please correct me if I am wrong here), Openconfig design for reverse GNMI is based on grpctunnel project, but this implementation doesn't consider that design right(as I think this design will work only when the client and server are network reachable but grpctunnel consider the possibilities when the client is not reachable from server by using TCP over grpc tunnel)?

  2. Also, I see that the service defined from the server side in the gnmireverse.proto defined as:

     service gNMIReverse {
        rpc Publish(stream gnmi.SubscribeResponse) returns (Empty);
     }

    Does the purpose of this rpc Publish is to subscribe for the data we want to subscribe from the client or something else? Because the way I would think is once using reverse GNMI the client dials out to the collector(here the server), and then collector needs to subscribe for the data it wants to get from the client. Once that is done then the data should be streamed from the client to server. But in this implementation it looks like we subscribe for the data at the router/client side right using below config at the client side?

    daemon gnmireverse
    exec /mnt/flash/gnmireverse_client -username USER -password PASS # authenticate locally
    -target_addr=mgmt/127.0.0.1:6030 # default address of gNMI server, listening in mgmt VRF
    -collector_addr=mgmt/1.2.3.4:6000 # address of gNMIReverse server, connecting through mgmt VRF
    -target_value=device1 # Include a name for this device
    -sample interfaces/interface/state/counters@30s # stream interface counters sampled every 30 seconds
    -subscribe network-instances # stream changes as they happen to network-instances config and state
    no shutdown

Debug Question:

I am experimenting with this code to do a small POC. I am running the client on Arista vEOS, and I am running server on my dev machine(linux based). I want to see all the messages I have subscribed in the client(vEOS), but right now when I run the server I see no messages coming through, though I can see using tcpdump that packets are coming from the vEOS to the server.

Do I need to call any other function to print the messages here?

go run server/main.go -addr 127.0.0.1:50052 -tls false 
aaronbee commented 3 years ago
  1. gnmireverse is unrelated to grpctunnel and its use to implement dial-out gNMI. gnmireverse is a very simple service, where the client subscribes to one gNMI server and sends the data it receives to a gNMIReverse server.
  2. Correct. The gnmireverse client defines the paths to subscribe to.

The server should print out any data it receives. No additional flags necessary. If you aren't seeing data, I'd suggest looking at the logs of the client which should be at /var/log/agents/gnmireverse-####. Just looking at the configs you have posted, perhaps you need to pass '-collector_tls false` to the client if tls is disabled on the server.

Gaurav-Pande commented 3 years ago

thanks Aaron for all the help.