[VOL-4291] OfAgent changes for gRPC migration
Change-Id: I8da1db6df49d478ef24ec8f9bd719e9692f48a7f
diff --git a/internal/pkg/ofagent/packetIn.go b/internal/pkg/ofagent/packetIn.go
index 0b5b604..375e84f 100644
--- a/internal/pkg/ofagent/packetIn.go
+++ b/internal/pkg/ofagent/packetIn.go
@@ -24,9 +24,9 @@
"github.com/opencord/goloxi"
ofp "github.com/opencord/goloxi/of13"
"github.com/opencord/ofagent-go/internal/pkg/openflow"
- "github.com/opencord/voltha-lib-go/v5/pkg/log"
- "github.com/opencord/voltha-protos/v4/go/openflow_13"
- "github.com/opencord/voltha-protos/v4/go/voltha"
+ "github.com/opencord/voltha-lib-go/v7/pkg/log"
+ "github.com/opencord/voltha-protos/v5/go/openflow_13"
+ "github.com/opencord/voltha-protos/v5/go/voltha"
"google.golang.org/grpc"
)
@@ -47,7 +47,12 @@
opt := grpc.EmptyCallOption{}
streamCtx, streamDone := context.WithCancel(log.WithSpanFromContext(context.Background(), ctx))
defer streamDone()
- stream, err := ofa.volthaClient.Get().ReceivePacketsIn(streamCtx, &empty.Empty{}, opt)
+ vc := ofa.volthaClient.Get()
+ if vc == nil {
+ logger.Error(ctx, "No client found to establish Receive PacketIn Stream")
+ return
+ }
+ stream, err := vc.ReceivePacketsIn(streamCtx, &empty.Empty{}, opt)
if err != nil {
logger.Errorw(ctx, "Unable to establish Receive PacketIn Stream",
log.Fields{"error": err})