[VOL-4291] OfAgent changes for gRPC migration
Change-Id: I8da1db6df49d478ef24ec8f9bd719e9692f48a7f
diff --git a/internal/pkg/ofagent/refresh.go b/internal/pkg/ofagent/refresh.go
index 69ab0aa..d88d68b 100644
--- a/internal/pkg/ofagent/refresh.go
+++ b/internal/pkg/ofagent/refresh.go
@@ -22,7 +22,7 @@
"github.com/golang/protobuf/ptypes/empty"
"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"
)
func (ofa *OFAgent) synchronizeDeviceList(ctx context.Context) {
@@ -52,7 +52,13 @@
ofa.events <- ofaEventVolthaDisconnected
return
}
- deviceList, err := ofa.volthaClient.Get().ListLogicalDevices(log.WithSpanFromContext(context.Background(), ctx), &empty.Empty{})
+ vc := ofa.volthaClient.Get()
+ if vc == nil {
+ logger.Error(ctx, "No client found to query device list from voltha")
+ ofa.events <- ofaEventVolthaDisconnected
+ return
+ }
+ deviceList, err := vc.ListLogicalDevices(log.WithSpanFromContext(context.Background(), ctx), &empty.Empty{})
if err != nil {
logger.Errorw(ctx, "ofagent failed to query device list from voltha",
log.Fields{"error": err})