use of org.onosproject.net.flow.FlowRuleOperation in project onos by opennetworkinglab.
the class OpenstackFlowRuleManagerTest method validateFlowRule.
private void validateFlowRule(FlowRule ref) {
assertEquals("Flow Rule size was not match", 1, fros.size());
List<FlowRuleOperation> froList = Lists.newArrayList();
froList.addAll(fros);
FlowRuleOperation fro = froList.get(0);
FlowRule fr = fro.rule();
assertEquals("Application ID did not match", ref.appId(), fr.appId());
assertEquals("Device ID did not match", ref.deviceId(), fr.deviceId());
assertEquals("Selector did not match", ref.selector(), fr.selector());
assertEquals("Treatment did not match", ref.treatment(), fr.treatment());
assertEquals("Priority did not match", ref.priority(), fr.priority());
assertEquals("Table ID did not match", ref.table(), fr.table());
assertEquals("Permanent did not match", ref.isPermanent(), fr.isPermanent());
}
use of org.onosproject.net.flow.FlowRuleOperation in project onos by opennetworkinglab.
the class ECFlowRuleStoreTest method testStoreBatch.
/**
* Tests initial state of flowrule.
*/
@Test
public void testStoreBatch() {
FlowRuleOperation op = new FlowRuleOperation(flowRule, FlowRuleOperation.Type.ADD);
Multimap<DeviceId, FlowRuleBatchEntry> perDeviceBatches = ArrayListMultimap.create();
perDeviceBatches.put(op.rule().deviceId(), new FlowRuleBatchEntry(FlowRuleBatchEntry.FlowRuleOperation.ADD, op.rule()));
FlowRuleBatchOperation b = new FlowRuleBatchOperation(perDeviceBatches.get(deviceId), deviceId, 1);
flowStoreImpl.storeBatch(b);
FlowEntry flowEntry1 = flowStoreImpl.getFlowEntry(flowRule);
assertEquals("PENDING_ADD", flowEntry1.state().toString());
}
use of org.onosproject.net.flow.FlowRuleOperation in project onos by opennetworkinglab.
the class ECFlowRuleStoreTest method testAddFlow.
/**
* Tests adding a flowrule.
*/
@Test
public void testAddFlow() {
FlowEntry flowEntry = new DefaultFlowEntry(flowRule);
FlowRuleOperation op = new FlowRuleOperation(flowRule, FlowRuleOperation.Type.ADD);
Multimap<DeviceId, FlowRuleBatchEntry> perDeviceBatches = ArrayListMultimap.create();
perDeviceBatches.put(op.rule().deviceId(), new FlowRuleBatchEntry(FlowRuleBatchEntry.FlowRuleOperation.ADD, op.rule()));
FlowRuleBatchOperation b = new FlowRuleBatchOperation(perDeviceBatches.get(deviceId), deviceId, 1);
flowStoreImpl.storeBatch(b);
FlowEntry flowEntry1 = flowStoreImpl.getFlowEntry(flowRule);
assertEquals("PENDING_ADD", flowEntry1.state().toString());
flowStoreImpl.addOrUpdateFlowRule(flowEntry);
assertFlowsOnDevice(deviceId, 1);
FlowEntry flowEntry2 = flowStoreImpl.getFlowEntry(flowRule);
assertEquals("ADDED", flowEntry2.state().toString());
assertThat(flowStoreImpl.getTableStatistics(deviceId), notNullValue());
}
Aggregations