[ONOS-8151] Re-send request for flow removal in case the flow is in PENDING_REMOVE and the stats report it.
Change-Id: I4e46f102a0a1a341ccfaff968207378ce30b9144
(cherry picked from commit 321f75a794dd8d8524209172c980f172a35d547f)
diff --git a/core/net/src/main/java/org/onosproject/net/flow/impl/FlowRuleManager.java b/core/net/src/main/java/org/onosproject/net/flow/impl/FlowRuleManager.java
index 9dc92d1..833a40c 100644
--- a/core/net/src/main/java/org/onosproject/net/flow/impl/FlowRuleManager.java
+++ b/core/net/src/main/java/org/onosproject/net/flow/impl/FlowRuleManager.java
@@ -522,11 +522,12 @@
log.debug("Flow {} is on switch but not in store.", flowRule);
}
- private boolean flowAdded(FlowEntry flowEntry) {
+ private boolean handleExistingFlow(FlowEntry flowEntry) {
checkNotNull(flowEntry, FLOW_RULE_NULL);
checkValidity();
-
- if (checkRuleLiveness(flowEntry, store.getFlowEntry(flowEntry))) {
+ FlowEntry storedEntry = store.getFlowEntry(flowEntry);
+ if ((storedEntry != null && storedEntry.state() != FlowEntry.FlowEntryState.PENDING_REMOVE)
+ && checkRuleLiveness(flowEntry, storedEntry)) {
FlowRuleEvent event = store.addOrUpdateFlowRule(flowEntry);
if (event == null) {
log.debug("No flow store event generated.");
@@ -607,7 +608,7 @@
if (storedRule != null) {
if (storedRule.exactMatch(rule)) {
// we both have the rule, let's update some info then.
- done = flowAdded(rule);
+ done = handleExistingFlow(rule);
if (!done) {
// Mastership change can occur during this iteration
master = mastershipService.getMasterFor(deviceId);