use of org.onosproject.net.flow.DefaultFlowEntry in project onos by opennetworkinglab.
the class FlowRuleManagerTest method flowRemoved.
@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);
providerService.flowRemoved(fe1);
validateEvents();
FlowRule f3 = flowRule(3, 3);
FlowEntry fe3 = new DefaultFlowEntry(f3);
service.applyFlowRules(f3);
providerService.pushFlowMetrics(DID, Collections.singletonList(fe3));
validateEvents(RULE_ADD_REQUESTED, RULE_ADDED, RULE_UPDATED);
providerService.flowRemoved(fe3);
validateEvents();
}
use of org.onosproject.net.flow.DefaultFlowEntry in project onos by opennetworkinglab.
the class FlowRuleManagerTest method extraneousFlow.
@Test
public void extraneousFlow() {
FlowRule f1 = flowRule(1, 1);
FlowRule f2 = flowRule(2, 2);
FlowRule f3 = flowRule(3, 3);
mgr.applyFlowRules(f1, f2);
// FlowRule updatedF1 = flowRule(f1, FlowRuleState.ADDED);
// FlowRule updatedF2 = flowRule(f2, FlowRuleState.ADDED);
// FlowRule updatedF3 = flowRule(f3, FlowRuleState.ADDED);
FlowEntry fe1 = new DefaultFlowEntry(f1);
FlowEntry fe2 = new DefaultFlowEntry(f2);
FlowEntry fe3 = new DefaultFlowEntry(f3);
providerService.pushFlowMetrics(DID, Lists.newArrayList(fe1, fe2, fe3));
validateEvents(RULE_ADD_REQUESTED, RULE_ADD_REQUESTED, RULE_ADDED, RULE_ADDED);
}
use of org.onosproject.net.flow.DefaultFlowEntry in project onos by opennetworkinglab.
the class FlowRuleManagerTest method removeFlowRules.
@Test
public void removeFlowRules() {
FlowRule f1 = addFlowRule(1);
FlowRule f2 = addFlowRule(2);
FlowRule f3 = addFlowRule(3);
assertEquals("3 rules should exist", 3, flowCount());
FlowEntry fe1 = new DefaultFlowEntry(f1);
FlowEntry fe2 = new DefaultFlowEntry(f2);
FlowEntry fe3 = new DefaultFlowEntry(f3);
providerService.pushFlowMetrics(DID, ImmutableList.of(fe1, fe2, fe3));
validateEvents(RULE_ADD_REQUESTED, RULE_ADD_REQUESTED, RULE_ADD_REQUESTED, RULE_ADDED, RULE_ADDED, RULE_ADDED);
mgr.removeFlowRules(f1, f2);
// removing from north, so no events generated
validateEvents(RULE_REMOVE_REQUESTED, RULE_REMOVE_REQUESTED);
assertEquals("3 rule should exist", 3, flowCount());
assertTrue("Entries should be pending remove.", validateState(ImmutableMap.of(f1, FlowEntryState.PENDING_REMOVE, f2, FlowEntryState.PENDING_REMOVE, f3, FlowEntryState.ADDED)));
mgr.removeFlowRules(f1);
assertEquals("3 rule should still exist", 3, flowCount());
}
use of org.onosproject.net.flow.DefaultFlowEntry in project onos by opennetworkinglab.
the class FlowRuleManagerTest method fallbackFlowRemoved.
@Test
public void fallbackFlowRemoved() {
FlowRule f1 = flowRule(FOO_DID, 1, 1);
mgr.applyFlowRules(f1);
flowRules.clear();
providerService.flowRemoved(new DefaultFlowEntry(f1));
assertTrue("flow rule not reapplied", flowRules.contains(f1));
}
use of org.onosproject.net.flow.DefaultFlowEntry in project onos by opennetworkinglab.
the class FlowRuleManagerTest method fallbackExtraFlow.
@Test
public void fallbackExtraFlow() {
FlowRule f1 = flowRule(FOO_DID, 1, 1);
flowRules.clear();
providerService.pushFlowMetrics(FOO_DID, ImmutableList.of(new DefaultFlowEntry(f1)));
assertTrue("flow rule not removed", flowRules.contains(f1));
}
Aggregations