[VOL-2404] : RW-Core changes for handling OLT Reboot Scenario
- When the OLT's connection status goes from REACHABLE to UNREACHABLE
in ENABLED/DISABLED admin state, delete all the logical ports,
child devices, logical device and device flows.
- When OLT's connection status becomes reachable again, child devices,
ports will be re-discovered again. The logical device will be recreated
again.
- Will not handle the case where OLT goes UNREACHABLE when OLT is disabled
as part of voltha2.3 release
Change-Id: I34c0c538b44afa19e889e9631f0a738060a58fef
diff --git a/rw_core/core/device_manager.go b/rw_core/core/device_manager.go
index 0f68432..1df2051 100755
--- a/rw_core/core/device_manager.go
+++ b/rw_core/core/device_manager.go
@@ -1297,6 +1297,28 @@
return nil
}
+//DeleteAllLogicalPorts is invoked as a callback when the parent device's connection status moves to UNREACHABLE
+func (dMgr *DeviceManager) DeleteAllLogicalPorts(ctx context.Context, parentDevice *voltha.Device, prev *voltha.Device) error {
+ log.Debugw("delete-all-logical-ports", log.Fields{"parent-device-id": parentDevice.Id})
+ if err := dMgr.logicalDeviceMgr.deleteAllLogicalPorts(ctx, parentDevice); err != nil {
+ return err
+ }
+ return nil
+}
+
+//DeleteAllDeviceFlows is invoked as a callback when the parent device's connection status moves to UNREACHABLE
+func (dMgr *DeviceManager) DeleteAllDeviceFlows(ctx context.Context, parentDevice *voltha.Device, prev *voltha.Device) error {
+ log.Debugw("delete-all-device-flows", log.Fields{"parent-device-id": parentDevice.Id})
+ if agent := dMgr.getDeviceAgent(ctx, parentDevice.Id); agent != nil {
+ if err := agent.deleteAllFlows(ctx); err != nil {
+ log.Errorw("error-deleting-all-device-flows", log.Fields{"parent-device-id": parentDevice.Id})
+ return err
+ }
+ return nil
+ }
+ return status.Errorf(codes.NotFound, "%s", parentDevice.Id)
+}
+
//getAllChildDeviceIds is a helper method to get all the child device IDs from the device passed as parameter
func (dMgr *DeviceManager) getAllChildDeviceIds(parentDevice *voltha.Device) ([]string, error) {
log.Debugw("getAllChildDeviceIds", log.Fields{"parentDeviceId": parentDevice.Id})