VOL-5172 check olt state before adding flows
Change-Id: Ibc0b832ae504974fd975ed33fccddff308b321ee
diff --git a/VERSION b/VERSION
index 1d068c6..9e3a933 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-4.4.2
+4.4.3
diff --git a/internal/pkg/core/device_handler.go b/internal/pkg/core/device_handler.go
index 0382f71..23ba459 100755
--- a/internal/pkg/core/device_handler.go
+++ b/internal/pkg/core/device_handler.go
@@ -2211,7 +2211,10 @@
logger.Infow(ctx, "device-deletion-in-progress--not-handling-flows-or-groups", log.Fields{"device-id": device.Id})
return nil
}
-
+ if dh.transitionMap.currentDeviceState != deviceStateUp {
+ logger.Error(ctx, "device-is-not-up--not-handling-flows-or-groups", log.Fields{"device-id": device.Id, "current-device-state": dh.transitionMap.currentDeviceState})
+ return fmt.Errorf("device-is-not-up--not-handling-flows-or-groups")
+ }
logger.Debugw(ctx, "received-incremental-flowupdate-in-device-handler", log.Fields{"device-id": device.Id, "flows": flows, "groups": groups, "flowMetadata": flowMetadata})
errorsList = append(errorsList, dh.handleFlows(ctx, device, flows, flowMetadata)...)
errorsList = append(errorsList, dh.handleGroups(ctx, groups)...)
diff --git a/internal/pkg/core/device_handler_test.go b/internal/pkg/core/device_handler_test.go
index 8c41952..a03f794 100644
--- a/internal/pkg/core/device_handler_test.go
+++ b/internal/pkg/core/device_handler_test.go
@@ -257,7 +257,7 @@
dh.eventMgr = &OpenOltEventMgr{eventProxy: &mocks.MockEventProxy{}, handler: dh}
dh.transitionMap = &TransitionMap{}
dh.portStats = &OpenOltStatisticsMgr{}
-
+ dh.transitionMap.currentDeviceState = 3
var pmNames = []string{
"rx_bytes",
"rx_packets",