[VOL-5322]-proper state updated adapter to fix logice device id creation
Change-Id: I26a36e15d0f3ba5cec466500969fea298948cbcb
Signed-off-by: Akash Soni <akash.soni@radisys.com>
diff --git a/internal/pkg/core/device_handler.go b/internal/pkg/core/device_handler.go
index 22c7852..908fb57 100755
--- a/internal/pkg/core/device_handler.go
+++ b/internal/pkg/core/device_handler.go
@@ -1083,6 +1083,28 @@
"device-id": dh.device.Id,
"host-and-port": dh.device.GetHostAndPort()}, err)
}
+ //Setting oper and connection state to RECONCILING and conn state to reachable
+ cgClient, err := dh.coreClient.GetCoreServiceClient()
+ if err != nil {
+ return err
+ }
+
+ if dh.device.OperStatus == voltha.OperStatus_RECONCILING {
+ subCtx, cancel := context.WithTimeout(log.WithSpanFromContext(context.Background(), ctx), dh.openOLT.rpcTimeout)
+ defer cancel()
+ if _, err := cgClient.DeviceStateUpdate(subCtx, &ca.DeviceStateFilter{
+ DeviceId: dh.device.Id,
+ OperStatus: voltha.OperStatus_RECONCILING,
+ ConnStatus: voltha.ConnectStatus_REACHABLE,
+ }); err != nil {
+ return olterrors.NewErrAdapter("device-update-failed", log.Fields{"device-id": dh.device.Id}, err)
+ }
+ // The OperState and connection state of the device is set to RECONCILING and REACHABLE in the previous section. This also needs to be set on the
+ // locally cached copy of the device struct.
+ dh.device.OperStatus = voltha.OperStatus_RECONCILING
+ dh.device.ConnectStatus = voltha.ConnectStatus_REACHABLE
+ }
+
return nil
}