Fix to reinstall flow rules when they are missing in FlowRuleService.
Change-Id: I1e7e0d62e27012cd090f3a72eb92eadc85afafdf
(cherry picked from commit 5c7fe3acf43bf1304038a7be55a5fd45e5805396)
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 3801388..300b023 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
@@ -207,7 +207,7 @@
FlowRule rule = flowRule(hval, hval);
service.applyFlowRules(rule);
- assertNotNull("rule should be found", service.getFlowEntries(DID));
+ assertNotNull("rule should be found", service.getFlowEntry(rule));
return rule;
}
@@ -234,6 +234,24 @@
}
@Test
+ public void getFlowEntry() {
+ assertTrue("store should be empty",
+ Sets.newHashSet(service.getFlowEntries(DID)).isEmpty());
+ FlowRule f1 = addFlowRule(1);
+ FlowRule f2 = addFlowRule(2);
+
+ FlowEntry fe1 = new DefaultFlowEntry(f1);
+ FlowEntry fe2 = new DefaultFlowEntry(f2);
+ assertEquals("2 rules should exist", 2, flowCount());
+
+ FlowEntry actual1 = service.getFlowEntry(f1);
+ FlowEntry actual2 = service.getFlowEntry(f2);
+
+ assertEquals(fe1, actual1);
+ assertEquals(fe2, actual2);
+ }
+
+ @Test
public void getFlowEntries() {
assertTrue("store should be empty",
Sets.newHashSet(service.getFlowEntries(DID)).isEmpty());