VOL-2518 - reconnect to voltha on disconnect
Change-Id: Ia497bb6a83312f15e54de0d7556753e1d9ef58b0
diff --git a/internal/pkg/ofagent/refresh.go b/internal/pkg/ofagent/refresh.go
index 275ba2e..d50b3ec 100644
--- a/internal/pkg/ofagent/refresh.go
+++ b/internal/pkg/ofagent/refresh.go
@@ -42,10 +42,17 @@
}
func (ofa *OFAgent) refreshDeviceList() {
+ // If we exit, assume disconnected
+ if ofa.volthaClient == nil {
+ logger.Error("no-voltha-connection")
+ ofa.events <- ofaEventVolthaDisconnected
+ return
+ }
deviceList, err := ofa.volthaClient.ListLogicalDevices(context.Background(), &empty.Empty{})
if err != nil {
logger.Errorw("ofagent failed to query device list from voltha",
log.Fields{"error": err})
+ ofa.events <- ofaEventVolthaDisconnected
return
}
devices := deviceList.GetItems()