openconfig / gribi

A gRPC Interface to a Network Element RIB.
Apache License 2.0
59 stars 14 forks source link

gRIBI grpcurl: Failed to resolve symbol "gribi.gRIBI" #37

Open liulk opened 2 years ago

liulk commented 2 years ago

Reported by @nandanarista:

I did some digging and found at least one problem with reflection[1] for gRIBI (in general, not specific to EOS, problem occurs in gribigo[2] as well)

Focussing on the error below, I suspected it had something to do with reflection.

Method name not found
Failed to find method gribi.Flush in proto files.

I used

./grpcurl -H 'username: admin' -plaintext 127.0.0.1:6040 describe
Failed to resolve symbol "gribi.gRIBI": Symbol not found: gribi.gRIBI
caused by: File not found: github.com/openconfig/ygot/proto/ywrapper/ywrapper.proto

Some googling led me to a very helpful post [3] which says that

What that means is that the name (and relative path) used to compile a proto with protoc must exactly match how all other files will import it.

ywrapper.proto itself is compiled [4] using just the relative // source: ywrapper.proto, but gribi_aft.proto is importing it as import "github.com/openconfig/ygot/proto/ywrapper/ywrapper.proto”;

If my understanding of [3] is correct, the fix is to either regenerate ywrapper's go bindings to use the full github… path or change gribi_aft.proto to import ywrapper without the full github... path and regenerate the go bindings.

I tried both the grpcurl describe and grpc_cli call on gribigo after adding reflection to it, and I see the same problem.

My suggestion is that you file a bug and someone (maybe Nathaniel or Rob) fix this so that reflection (grpcurl describe) works with gribigo , update the generated go bindings on GitHub, and when that’s done, I can rebuild EOS’s gribi server to fix it in EOS and have it included in a later code drop.

[1] https://github.com/grpc/grpc-go/blob/master/Documentation/server-reflection-tutorial.md#grpc-server-reflection-tutorial [2] https://github.com/openconfig/gribigo  [3] https://github.com/fullstorydev/grpcurl/issues/22#issuecomment-375274465  [4] https://github.com/openconfig/ygot/blob/master/proto/ywrapper/ywrapper.pb.go#L25 [5] https://github.com/openconfig/gribi/blob/master/v1/proto/gribi_aft/gribi_aft.proto#L13

dopufol commented 8 months ago

I am seeing this issue as well and reflection is important for us. can you take a look at this problem? Failed to list methods for service "gribi.gRIBI": file "v1/proto/gribi_aft/gribi_aft.proto" included an unresolvable reference to ".ywrapper.BytesValue"

the solution is suggested by @liulk above

this is similar to https://github.com/openconfig/gnmi/issues/95 https://github.com/openconfig/gnsi/issues/176

@xw-g @robshakir