[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_agent.go b/rw_core/core/device_agent.go
index 5f946ba..ee8e731 100755
--- a/rw_core/core/device_agent.go
+++ b/rw_core/core/device_agent.go
@@ -741,6 +741,24 @@
return nil
}
+//deleteAllFlows deletes all flows in the device table
+func (agent *DeviceAgent) deleteAllFlows(ctx context.Context) error {
+ log.Debugw("deleteAllFlows", log.Fields{"deviceId": agent.deviceID})
+ if err := agent.requestQueue.WaitForGreenLight(ctx); err != nil {
+ return err
+ }
+ defer agent.requestQueue.RequestComplete()
+
+ device := agent.getDeviceWithoutLock()
+ // purge all flows on the device by setting it to nil
+ device.Flows = &ofp.Flows{Items: nil}
+ if err := agent.updateDeviceWithoutLock(ctx, device); err != nil {
+ // The caller logs the error
+ return err
+ }
+ return nil
+}
+
//disableDevice disable a device
func (agent *DeviceAgent) disableDevice(ctx context.Context) error {
if err := agent.requestQueue.WaitForGreenLight(ctx); err != nil {