use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey in project openflowplugin by opendaylight.
the class OpenflowpluginTestCommandProvider method createtablemiss.
private FlowBuilder createtablemiss() {
final FlowBuilder flow = new FlowBuilder();
final long id = 456;
final MatchBuilder matchBuilder = new MatchBuilder();
flow.setMatch(matchBuilder.build());
flow.setInstructions(createSentToControllerInstructions().build());
flow.setPriority(0);
flow.setTableId((short) 0);
final FlowKey key = new FlowKey(new FlowId(Long.toString(id)));
flow.setKey(key);
return flow;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey in project openflowplugin by opendaylight.
the class OpenflowpluginTestCommandProvider method createTestFlowPerfTest.
private FlowBuilder createTestFlowPerfTest(final String flowTypeArg, final String tableId, final int id) {
final FlowBuilder flow = new FlowBuilder();
String flowType = flowTypeArg;
int flowId = id;
if (flowType == null) {
flowType = "f1";
}
flow.setPriority(flowId);
switch(flowType) {
case "f1":
flowId += 1;
flow.setMatch(createMatch1().build());
flow.setInstructions(createDecNwTtlInstructions().build());
break;
default:
LOG.warn("flow type not understood: {}", flowType);
}
final FlowKey key = new FlowKey(new FlowId(Long.toString(flowId)));
if (null == flow.isBarrier()) {
flow.setBarrier(Boolean.FALSE);
}
final BigInteger value = BigInteger.valueOf(10);
flow.setCookie(new FlowCookie(value));
flow.setCookieMask(new FlowCookie(value));
flow.setHardTimeout(0);
flow.setIdleTimeout(0);
flow.setInstallHw(false);
flow.setStrict(false);
flow.setContainerName(null);
flow.setFlags(new FlowModFlags(false, false, false, false, true));
flow.setId(new FlowId("12"));
flow.setTableId(getTableId(tableId));
flow.setKey(key);
flow.setFlowName(ORIGINAL_FLOW_NAME + "X" + flowType);
return flow;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey in project openflowplugin by opendaylight.
the class OpenflowPluginBulkGroupTransactionProvider method createTestFlow.
private FlowBuilder createTestFlow(NodeBuilder nodeBuilder, String flowTypeArg, String tableId) {
FlowBuilder flow = new FlowBuilder();
long id = 123;
String flowType = flowTypeArg;
if (flowType == null) {
flowType = "f1";
}
switch(flowType) {
case "f1":
id += 1;
flow.setMatch(createMatch1().build());
flow.setInstructions(createDecNwTtlInstructions().build());
break;
case "f2":
id += 2;
flow.setMatch(createMatch2().build());
flow.setInstructions(createDropInstructions().build());
break;
case "f3":
id += 3;
flow.setMatch(createMatch3().build());
flow.setInstructions(createDropInstructions().build());
break;
case "f4":
id += 4;
flow.setMatch(createEthernetMatch().build());
flow.setInstructions(createDropInstructions().build());
break;
case "f82":
id += 1;
flow.setMatch(createMatch1().build());
flow.setInstructions(createDropInstructions().build());
break;
case "f5":
id += 5;
flow.setMatch(createMatch1().build());
flow.setInstructions(createAppyActionInstruction().build());
break;
case "f6":
id += 6;
flow.setMatch(createMatch1().build());
flow.setInstructions(createGotoTableInstructions().build());
break;
case "f7":
id += 7;
flow.setMatch(createMatch1().build());
flow.setInstructions(createMeterInstructions().build());
break;
case "f8":
id += 8;
flow.setMatch(createMatch1().build());
flow.setInstructions(createAppyActionInstruction7().build());
break;
case "f9":
id += 9;
flow.setMatch(createMatch1().build());
flow.setInstructions(createAppyActionInstruction2().build());
break;
case "f10":
id += 10;
flow.setMatch(createMatch1().build());
flow.setInstructions(createAppyActionInstruction3().build());
break;
case "f14":
id += 14;
flow.setMatch(createMatch1().build());
flow.setInstructions(createAppyActionInstruction7().build());
break;
case "f29":
id += 29;
flow.setMatch(createMatch1().build());
flow.setInstructions(createAppyActionInstruction21().build());
break;
default:
LOG.warn("flow type not understood: {}", flowType);
}
final FlowKey key = new FlowKey(new FlowId(Long.toString(id)));
if (null == flow.isBarrier()) {
flow.setBarrier(Boolean.FALSE);
}
// flow.setBufferId(12L);
BigInteger value = BigInteger.valueOf(10);
BigInteger outputPort = BigInteger.valueOf(4294967295L);
flow.setCookie(new FlowCookie(value));
flow.setCookieMask(new FlowCookie(value));
flow.setHardTimeout(0);
flow.setIdleTimeout(0);
flow.setInstallHw(false);
flow.setStrict(false);
flow.setContainerName(null);
flow.setFlags(new FlowModFlags(false, false, false, false, true));
flow.setId(new FlowId("12"));
flow.setTableId(getTableId(tableId));
flow.setOutGroup(4294967295L);
// set outport to OFPP_NONE (65535) to disable remove restriction for
// flow
flow.setOutPort(outputPort);
flow.setKey(key);
flow.setPriority(2);
flow.setFlowName(originalFlowName + "X" + flowType);
return flow;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey in project openflowplugin by opendaylight.
the class OpenflowpluginStatsTestCommandProvider method _flowStats.
public void _flowStats(CommandInterpreter ci) {
int flowCount = 0;
int flowStatsCount = 0;
List<Node> nodes = getNodes();
for (Node node2 : nodes) {
NodeKey nodeKey = node2.getKey();
InstanceIdentifier<FlowCapableNode> nodeRef = InstanceIdentifier.create(Nodes.class).child(Node.class, nodeKey).augmentation(FlowCapableNode.class);
ReadOnlyTransaction readOnlyTransaction = dataProviderService.newReadOnlyTransaction();
FlowCapableNode node = TestProviderTransactionUtil.getDataObject(readOnlyTransaction, nodeRef);
if (node != null) {
List<Table> tables = node.getTable();
for (Table table2 : tables) {
TableKey tableKey = table2.getKey();
InstanceIdentifier<Table> tableRef = InstanceIdentifier.create(Nodes.class).child(Node.class, nodeKey).augmentation(FlowCapableNode.class).child(Table.class, tableKey);
Table table = TestProviderTransactionUtil.getDataObject(readOnlyTransaction, tableRef);
if (table != null) {
if (table.getFlow() != null) {
List<Flow> flows = table.getFlow();
for (Flow flow2 : flows) {
flowCount++;
FlowKey flowKey = flow2.getKey();
InstanceIdentifier<Flow> flowRef = InstanceIdentifier.create(Nodes.class).child(Node.class, nodeKey).augmentation(FlowCapableNode.class).child(Table.class, tableKey).child(Flow.class, flowKey);
Flow flow = TestProviderTransactionUtil.getDataObject(readOnlyTransaction, flowRef);
if (flow != null) {
FlowStatisticsData data = flow.getAugmentation(FlowStatisticsData.class);
if (null != data) {
flowStatsCount++;
LOG.debug("--------------------------------------------");
ci.print(data);
}
}
}
}
}
}
}
}
if (flowCount == flowStatsCount) {
LOG.debug("flowStats - Success");
} else {
LOG.debug("flowStats - Failed");
LOG.debug("System fetchs stats data in 50 seconds interval, so pls wait and try again.");
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey in project openflowplugin by opendaylight.
the class SalFlowServiceImplTest method updateFlow.
private void updateFlow(short version) throws Exception {
UpdateFlowInput mockedUpdateFlowInput = mock(UpdateFlowInput.class);
UpdateFlowInput mockedUpdateFlowInput1 = mock(UpdateFlowInput.class);
UpdatedFlow mockedUpdateFlow = new UpdatedFlowBuilder().setMatch(match).setTableId((short) 1).build();
UpdatedFlow mockedUpdateFlow1 = new UpdatedFlowBuilder().setMatch(match).setTableId((short) 1).setPriority(1).build();
when(mockedUpdateFlowInput.getUpdatedFlow()).thenReturn(mockedUpdateFlow);
when(mockedUpdateFlowInput1.getUpdatedFlow()).thenReturn(mockedUpdateFlow1);
FlowRef mockedFlowRef = mock(FlowRef.class);
Mockito.doReturn(TABLE_II.child(Flow.class, new FlowKey(new FlowId(DUMMY_FLOW_ID)))).when(mockedFlowRef).getValue();
when(mockedUpdateFlowInput.getFlowRef()).thenReturn(mockedFlowRef);
when(mockedUpdateFlowInput1.getFlowRef()).thenReturn(mockedFlowRef);
OriginalFlow mockedOriginalFlow = new OriginalFlowBuilder().setMatch(match).setTableId((short) 1).build();
OriginalFlow mockedOriginalFlow1 = new OriginalFlowBuilder().setMatch(match).setTableId((short) 1).setPriority(2).build();
when(mockedUpdateFlowInput.getOriginalFlow()).thenReturn(mockedOriginalFlow);
when(mockedUpdateFlowInput1.getOriginalFlow()).thenReturn(mockedOriginalFlow1);
SalFlowServiceImpl salFlowService = mockSalFlowService(version);
verifyOutput(salFlowService.updateFlow(mockedUpdateFlowInput));
verifyOutput(salFlowService.updateFlow(mockedUpdateFlowInput1));
}
Aggregations