[VOL-4291] OfAgent changes for gRPC migration
Change-Id: I8da1db6df49d478ef24ec8f9bd719e9692f48a7f
diff --git a/internal/pkg/ofagent/changeEvent.go b/internal/pkg/ofagent/changeEvent.go
index f9fa98e..6ea7f12 100644
--- a/internal/pkg/ofagent/changeEvent.go
+++ b/internal/pkg/ofagent/changeEvent.go
@@ -24,7 +24,7 @@
"github.com/golang/protobuf/ptypes/empty"
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-lib-go/v7/pkg/log"
"google.golang.org/grpc"
)
@@ -45,7 +45,12 @@
opt := grpc.EmptyCallOption{}
streamCtx, streamDone := context.WithCancel(log.WithSpanFromContext(context.Background(), ctx))
defer streamDone()
- stream, err := ofa.volthaClient.Get().ReceiveChangeEvents(streamCtx, &empty.Empty{}, opt)
+ vc := ofa.volthaClient.Get()
+ if vc == nil {
+ logger.Error(ctx, "No client found to establish Receive Change Event Stream")
+ return
+ }
+ stream, err := vc.ReceiveChangeEvents(streamCtx, &empty.Empty{}, opt)
if err != nil {
logger.Errorw(ctx, "Unable to establish Receive Change Event Stream",
log.Fields{"error": err})