ONOS-3023 Changing flowTable sets to map so that we can compare
stored vs. new rule when adding and removing
Change-Id: Ibd885023d550af3b2220056fbdf44ad8ec7fefda
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 63ee03e..269d6b4 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
@@ -311,6 +311,7 @@
} catch (UnsupportedOperationException e) {
log.warn(e.getMessage());
if (flowRule instanceof DefaultFlowEntry) {
+ //FIXME modification of "stored" flow entry outside of store
((DefaultFlowEntry) flowRule).setState(FlowEntry.FlowEntryState.FAILED);
}
}
@@ -323,10 +324,8 @@
log.debug("Flow {} removed", flowRule);
post(event);
}
-
}
-
private void extraneousFlow(FlowRule flowRule) {
checkNotNull(flowRule, FLOW_RULE_NULL);
checkValidity();
@@ -335,13 +334,11 @@
log.debug("Flow {} is on switch but not in store.", flowRule);
}
-
private void flowAdded(FlowEntry flowEntry) {
checkNotNull(flowEntry, FLOW_RULE_NULL);
checkValidity();
if (checkRuleLiveness(flowEntry, store.getFlowEntry(flowEntry))) {
-
FlowRuleEvent event = store.addOrUpdateFlowRule(flowEntry);
if (event == null) {
log.debug("No flow store event generated.");
@@ -353,7 +350,6 @@
log.debug("Removing flow rules....");
removeFlowRules(flowEntry);
}
-
}
private boolean checkRuleLiveness(FlowEntry swRule, FlowEntry storedRule) {
diff --git a/core/net/src/test/java/org/onosproject/net/flow/impl/FlowRuleManagerTest.java b/core/net/src/test/java/org/onosproject/net/flow/impl/FlowRuleManagerTest.java
index 7ef8762..553745b 100644
--- a/core/net/src/test/java/org/onosproject/net/flow/impl/FlowRuleManagerTest.java
+++ b/core/net/src/test/java/org/onosproject/net/flow/impl/FlowRuleManagerTest.java
@@ -269,23 +269,19 @@
@Test
public void flowRemoved() {
-
FlowRule f1 = addFlowRule(1);
FlowRule f2 = addFlowRule(2);
StoredFlowEntry fe1 = new DefaultFlowEntry(f1);
FlowEntry fe2 = new DefaultFlowEntry(f2);
-
providerService.pushFlowMetrics(DID, ImmutableList.of(fe1, fe2));
service.removeFlowRules(f1);
+ //FIXME modification of "stored" flow entry outside of store
fe1.setState(FlowEntryState.REMOVED);
-
-
providerService.flowRemoved(fe1);
-
validateEvents(RULE_ADD_REQUESTED, RULE_ADD_REQUESTED, RULE_ADDED,
RULE_ADDED, RULE_REMOVE_REQUESTED, RULE_REMOVED);
@@ -301,7 +297,6 @@
providerService.flowRemoved(fe3);
validateEvents();
-
}
@Test