use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder in project openflowplugin by opendaylight.
the class LLDPPacketPuntEnforcer method createFlow.
static Flow createFlow() {
FlowBuilder flowBuilder = new FlowBuilder();
flowBuilder.setMatch(new MatchBuilder().build());
flowBuilder.setInstructions(createSendToControllerInstructions().build());
flowBuilder.setPriority(0);
FlowKey key = new FlowKey(new FlowId(DEFAULT_FLOW_ID));
flowBuilder.setBarrier(Boolean.FALSE);
flowBuilder.setBufferId(OFConstants.OFP_NO_BUFFER);
BigInteger value = BigInteger.valueOf(10L);
flowBuilder.setCookie(new FlowCookie(value));
flowBuilder.setCookieMask(new FlowCookie(value));
flowBuilder.setHardTimeout(0);
flowBuilder.setIdleTimeout(0);
flowBuilder.setInstallHw(false);
flowBuilder.setStrict(false);
flowBuilder.setContainerName(null);
flowBuilder.setFlags(new FlowModFlags(false, false, false, false, true));
flowBuilder.setId(new FlowId("12"));
flowBuilder.setTableId(TABLE_ID);
flowBuilder.setKey(key);
flowBuilder.setFlowName(LLDP_PUNT_WHOLE_PACKET_FLOW);
return flowBuilder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder in project openflowplugin by opendaylight.
the class OpenflowpluginTestCommandProvider method _testAllFlows.
/*
* usage testAllFlows <dp>
* ex: _perfFlowTest 1
*/
@SuppressWarnings("checkstyle:IllegalCatch")
public void _testAllFlows(final CommandInterpreter ci) {
String dataPathID = ci.nextArgument();
final int numberOfFlows = 82;
if (dataPathID == null || dataPathID.trim().equals("")) {
dataPathID = "1";
}
ci.println("* Test All Flows *");
ci.println("* dataPathID:::" + dataPathID + "");
final String dataPath = "openflow:" + dataPathID;
final String tableId = "0";
final NodeBuilder tn = createTestNode(dataPath);
FlowBuilder tf;
for (int flow = 1; flow < numberOfFlows; flow++) {
final String flowID = "f" + flow;
try {
tf = createTestFlow(tn, flowID, tableId);
writeFlow(ci, tf, tn);
} catch (RuntimeException e) {
ci.println("--Test Failed--Issue found while adding flow" + flow);
break;
}
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder in project openflowplugin by opendaylight.
the class OpenflowpluginTestCommandProvider method _perfFlowTest.
/*
* usage testSwitchFlows <numberOfSwitches> <numberOfFlows> <warmup iterations> <Number Of Threads>
* ex: _perfFlowTest 10 5 1 2
*/
public void _perfFlowTest(final CommandInterpreter ci) {
final String numberOfSwtichesStr = ci.nextArgument();
final String numberOfFlowsStr = ci.nextArgument();
final String warmupIterationsStr = ci.nextArgument();
final String threadCountStr = ci.nextArgument();
final String warmUpStr = ci.nextArgument();
int numberOfSwtiches = 0;
int numberOfFlows = 0;
int warmupIterations = 0;
boolean warmUpIterations = false;
int threadCount = 0;
if (numberOfSwtichesStr != null && !numberOfSwtichesStr.trim().equals("")) {
numberOfSwtiches = Integer.parseInt(numberOfSwtichesStr);
} else {
numberOfSwtiches = 2;
}
if (numberOfFlowsStr != null && !numberOfFlowsStr.trim().equals("")) {
numberOfFlows = Integer.parseInt(numberOfFlowsStr);
} else {
numberOfFlows = 2;
}
if (warmupIterationsStr != null && !warmupIterationsStr.trim().equals("")) {
warmupIterations = Integer.parseInt(warmupIterationsStr);
} else {
warmupIterations = 2;
}
if (threadCountStr != null && !threadCountStr.trim().equals("")) {
threadCount = Integer.parseInt(threadCountStr);
} else {
threadCount = 2;
}
if (warmUpStr != null && !warmUpStr.trim().equals("") && warmUpStr.trim().equals("true")) {
warmUpIterations = true;
} else {
warmUpIterations = false;
}
ci.println("* Test Configurations*");
ci.println("* numberOfSwtiches:::" + numberOfSwtiches + "");
ci.println("* numberOfFlows:::" + numberOfFlows + "");
ci.println("* warmupIterations:::" + warmupIterations + "");
ci.println("* Number of Threads :::" + threadCount + "");
ci.println("* Warmup Required? :::" + warmUpIterations + "");
String dataPath = "openflow:1";
NodeBuilder tn;
FlowBuilder tf;
final String tableId = "0";
if (warmUpIterations) {
ci.println("----Warmup Started-----");
for (int j = 1; j <= warmupIterations; j++) {
for (int i = 1; i <= numberOfSwtiches; i++) {
dataPath = "openflow:" + i;
tn = createTestNode(dataPath);
for (int flow = 1; flow < numberOfFlows; flow++) {
tf = createTestFlowPerfTest("f1", tableId, flow);
writeFlow(ci, tf, tn);
}
}
}
ci.println("----Warmup Done-----");
}
try {
final ExecutorService executor = Executors.newFixedThreadPool(threadCount);
int tableID = 0;
for (int t = 0; t < threadCount; t++) {
tableID = t + 1;
final Runnable tRunnable = new TestFlowThread(numberOfSwtiches, numberOfFlows, ci, t, tableID);
executor.execute(tRunnable);
}
executor.shutdown();
executor.awaitTermination(1, TimeUnit.SECONDS);
} catch (InterruptedException e) {
ci.println("Exception:" + e.getMessage());
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder in project openflowplugin by opendaylight.
the class OpenflowpluginTestCommandProvider method _modifyMDFlow.
public void _modifyMDFlow(final CommandInterpreter ci) {
final NodeBuilder tn = createTestNode(ci.nextArgument());
final FlowBuilder tf = createTestFlow(tn, ci.nextArgument(), ci.nextArgument());
tf.setFlowName(UPDATED_FLOW_NAME);
writeFlow(ci, tf, tn);
tf.setFlowName(ORIGINAL_FLOW_NAME);
writeFlow(ci, tf, tn);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder 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;
}
Aggregations