diff --git a/go.mod b/go.mod index 6b79691d..5e79b1a6 100644 --- a/go.mod +++ b/go.mod @@ -12,7 +12,7 @@ require ( github.com/openconfig/gribi v1.0.0 github.com/openconfig/lemming v0.3.2-0.20230914210403-c6484d12af0a github.com/openconfig/testt v0.0.0-20220311054427-efbb1a32ec07 - github.com/openconfig/ygot v0.29.11-0.20230922074452-052ed885651c + github.com/openconfig/ygot v0.29.11-0.20230922181344-6c3af4108a57 go.uber.org/atomic v1.10.0 google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d google.golang.org/grpc v1.58.0-dev diff --git a/go.sum b/go.sum index 76702c28..c50f78af 100644 --- a/go.sum +++ b/go.sum @@ -215,6 +215,8 @@ github.com/openconfig/ygot v0.29.10 h1:FRZXxyeCdiJXz6uat5uOm3Hlg+PUu2N0mY+eiva12 github.com/openconfig/ygot v0.29.10/go.mod h1:RNnn1ytQ8GZV5LPts36l0cyoRjsYYpruiruJEvmU2sg= github.com/openconfig/ygot v0.29.11-0.20230922074452-052ed885651c h1:0rE/tRnck61Guj+zkButSrb1VMWtDP0xX4cmanEDHL4= github.com/openconfig/ygot v0.29.11-0.20230922074452-052ed885651c/go.mod h1:RNnn1ytQ8GZV5LPts36l0cyoRjsYYpruiruJEvmU2sg= +github.com/openconfig/ygot v0.29.11-0.20230922181344-6c3af4108a57 h1:z7bNYTNR1HzxYQNVwBUaf0veA4j4vuTBW7mTLRW4M1w= +github.com/openconfig/ygot v0.29.11-0.20230922181344-6c3af4108a57/go.mod h1:RNnn1ytQ8GZV5LPts36l0cyoRjsYYpruiruJEvmU2sg= github.com/p4lang/p4runtime v1.4.0-rc.5.0.20220728214547-13f0d02a521e h1:AfZKoikDXbZ7zWvO/lvCRzLo7i6lM+gNleYVMxPiWyQ= github.com/p4lang/p4runtime v1.4.0-rc.5.0.20220728214547-13f0d02a521e/go.mod h1:m9laObIMXM9N1ElGXijc66/MSM5eheZJLRLxg/TG+fU= github.com/pborman/getopt v0.0.0-20190409184431-ee0cd42419d3/go.mod h1:85jBQOZwpVEaDAr341tbn15RS4fCAsIst0qp7i8ex1o= diff --git a/rib/reconciler/remote.go b/rib/reconciler/remote.go index bb03fbb9..cdce9643 100644 --- a/rib/reconciler/remote.go +++ b/rib/reconciler/remote.go @@ -6,7 +6,6 @@ import ( "github.com/openconfig/gribigo/client" "github.com/openconfig/gribigo/rib" - "google.golang.org/protobuf/encoding/prototext" spb "github.com/openconfig/gribi/v1/proto/service" ) @@ -57,8 +56,6 @@ func (r *RemoteRIB) Get(ctx context.Context) (*rib.RIB, error) { return nil, fmt.Errorf("cannot get remote RIB, %v", err) } - fmt.Printf("%s\n", prototext.Format(resp)) - // We always disable the RIB checking function because we want to see entries that have // not got valid references so that we can reconcile them. remRIB, err := rib.FromGetResponses(r.defaultName, []*spb.GetResponse{resp}, rib.DisableRIBCheckFn()) diff --git a/rib/reconciler/remote_test.go b/rib/reconciler/remote_test.go index 1346ec5b..468fa52b 100644 --- a/rib/reconciler/remote_test.go +++ b/rib/reconciler/remote_test.go @@ -2,7 +2,6 @@ package reconciler import ( "context" - "fmt" "net" "testing" "time" @@ -175,8 +174,6 @@ func TestGet(t *testing.T) { if err != nil { t.Fatalf("(*RemoteRIB).Get(ctx).RIBContents(): can't introspect RIB, err: %v", err) } - fmt.Printf("%s\n", got.String()) - fmt.Printf("%s\n", tt.inInjectedRIB) if diff := cmp.Diff(gotContents, tt.wantRIBContents); diff != "" { t.Fatalf("(*RemoteRIB).Get(ctx): did not get expected contents, diff(-got,+want):\n%s", diff) diff --git a/rib/rib.go b/rib/rib.go index b1bafd6a..d0fc5808 100644 --- a/rib/rib.go +++ b/rib/rib.go @@ -24,7 +24,6 @@ import ( "time" log "github.com/golang/glog" - "github.com/kr/pretty" "github.com/openconfig/gnmi/value" "github.com/openconfig/goyang/pkg/yang" "github.com/openconfig/gribigo/aft" @@ -34,7 +33,6 @@ import ( "github.com/openconfig/ygot/ytypes" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" - "google.golang.org/protobuf/encoding/prototext" "google.golang.org/protobuf/proto" gpb "github.com/openconfig/gnmi/proto/gnmi" @@ -1820,8 +1818,6 @@ func concreteNextHopProto(e *aft.Afts_NextHop) (*aftpb.Afts_NextHopKey, error) { // concreteNextHopGroupProto takes the input NextHopGroup GoStruct and returns it as a gRIBI // NextHopGroupEntryKey protobuf. It returns an error if the protobuf cannot be marshalled. func concreteNextHopGroupProto(e *aft.Afts_NextHopGroup) (*aftpb.Afts_NextHopGroupKey, error) { - fmt.Printf("input: %v\n", e) - fmt.Printf("val: %d\n", *e.Id) nhgproto := &aftpb.Afts_NextHopGroup{} if err := protoFromGoStruct(e, &gpb.Path{ Elem: []*gpb.PathElem{{ @@ -1834,7 +1830,6 @@ func concreteNextHopGroupProto(e *aft.Afts_NextHopGroup) (*aftpb.Afts_NextHopGro }, nhgproto); err != nil { return nil, fmt.Errorf("cannot marshal next-hop index %d, %v", e.GetId(), err) } - fmt.Printf("concrete nhg: %s\n", prototext.Format(nhgproto)) return &aftpb.Afts_NextHopGroupKey{ Id: *e.Id, NextHopGroup: nhgproto, @@ -1858,7 +1853,6 @@ func protoFromGoStruct(s ygot.ValidatedGoStruct, prefix *gpb.Path, pb proto.Mess vals[u.Path] = u.Val } } - pretty.Printf("vals: %s\n", vals) if err := protomap.ProtoFromPaths(pb, vals, protomap.ProtobufMessagePrefix(prefix), @@ -1868,8 +1862,6 @@ func protoFromGoStruct(s ygot.ValidatedGoStruct, prefix *gpb.Path, pb proto.Mess return fmt.Errorf("cannot unmarshal gNMI paths, %v", err) } - fmt.Printf("unmarshalled: %s\n", prototext.Format(pb)) - return nil } diff --git a/rib/rib_test.go b/rib/rib_test.go index 25cca315..817785ab 100644 --- a/rib/rib_test.go +++ b/rib/rib_test.go @@ -865,6 +865,17 @@ func TestConcreteNHGProto(t *testing.T) { a.GetOrCreateNextHop(1).Weight = ygot.Uint64(1) return a }(), + want: &aftpb.Afts_NextHopGroupKey{ + Id: 1, + NextHopGroup: &aftpb.Afts_NextHopGroup{ + NextHop: []*aftpb.Afts_NextHopGroup_NextHopKey{{ + Index: 1, + NextHop: &aftpb.Afts_NextHopGroup_NextHop{ + Weight: &wpb.UintValue{Value: 1}, + }, + }}, + }, + }, }} for _, tt := range tests { @@ -3205,8 +3216,15 @@ func TestGetRIB(t *testing.T) { NetworkInstance: "VRF-42", Entry: &spb.AFTEntry_NextHopGroup{ NextHopGroup: &aftpb.Afts_NextHopGroupKey{ - Id: 42, - NextHopGroup: &aftpb.Afts_NextHopGroup{}, + Id: 42, + NextHopGroup: &aftpb.Afts_NextHopGroup{ + NextHop: []*aftpb.Afts_NextHopGroup_NextHopKey{{ + Index: 1, + NextHop: &aftpb.Afts_NextHopGroup_NextHop{ + Weight: &wpb.UintValue{Value: 1}, + }, + }}, + }, }, }, }},