use of org.openkilda.messaging.model.Flow in project open-kilda by telstra.
the class FlowCrudBasicRunTest method getFlowCount.
/**
* @param expectedFlowsCount -1 if unknown
* @return the count, based on dumpFlows()
* @throws Exception
*/
private int getFlowCount(int expectedFlowsCount) throws Exception {
List<Flow> flows = FlowUtils.dumpFlows();
// pass in -1 if the count is unknown
if (expectedFlowsCount >= 0) {
int arbitraryCount = 3;
for (int i = 0; i < arbitraryCount; i++) {
System.out.println(String.format("\n=====> Flow Count is %d, expecting %d", flows.size(), expectedFlowsCount));
if (expectedFlowsCount == flows.size()) {
break;
}
TimeUnit.SECONDS.sleep(2);
flows = FlowUtils.dumpFlows();
}
if (expectedFlowsCount != flows.size()) {
System.out.println(String.format("\n=====> FLOW COUNT doesn't match, flows: %s", flows.toString()));
}
}
return flows.size();
}
use of org.openkilda.messaging.model.Flow in project open-kilda by telstra.
the class FlowCrudBasicRunTest method checkFlowCreation.
@Then("^flow (.*) with (.*) (\\d+) (\\d+) and (.*) (\\d+) (\\d+) and (\\d+) could be created$")
public void checkFlowCreation(final String flowId, final String sourceSwitch, final int sourcePort, final int sourceVlan, final String destinationSwitch, final int destinationPort, final int destinationVlan, final int bandwidth) throws Exception {
Flow expectedFlow = new Flow(FlowUtils.getFlowName(flowId), bandwidth, false, 0, flowId, null, sourceSwitch, destinationSwitch, sourcePort, destinationPort, sourceVlan, destinationVlan, 0, 0, null, null);
List<Flow> flows = validateFlowStored(expectedFlow);
assertFalse(flows.isEmpty());
assertTrue(flows.contains(expectedFlow));
}
use of org.openkilda.messaging.model.Flow in project open-kilda by telstra.
the class FlowPathTest method flowRestoredHasValidLastUpdatedTimestamp.
@Then("^flow (.*) has updated timestamp$")
public void flowRestoredHasValidLastUpdatedTimestamp(String flowId) throws Throwable {
List<Flow> flows = dumpFlows();
if (flows == null || flows.isEmpty()) {
TimeUnit.SECONDS.sleep(2);
flows = dumpFlows();
}
assertNotNull(flows);
assertEquals(2, flows.size());
Flow flow = flows.get(0);
String currentLastUpdated = flow.getLastUpdated();
System.out.println(format("=====> Flow %s previous timestamp = %s", flowId, previousLastUpdated));
System.out.println(format("=====> Flow %s current timestamp = %s", flowId, currentLastUpdated));
assertNotEquals(previousLastUpdated, currentLastUpdated);
previousLastUpdated = currentLastUpdated;
}
use of org.openkilda.messaging.model.Flow in project open-kilda by telstra.
the class FlowPathTest method flowPathCorrect.
@Then("^flow (.*) with (.*) (\\d+) (\\d+) and (.*) (\\d+) (\\d+) and (\\d+) path correct$")
public void flowPathCorrect(String flowId, String sourceSwitch, int sourcePort, int sourceVlan, String destinationSwitch, int destinationPort, int destinationVlan, int bandwidth) throws UnroutablePathException, InterruptedException {
Flow flow = new Flow(FlowUtils.getFlowName(flowId), bandwidth, false, flowId, sourceSwitch, sourcePort, sourceVlan, destinationSwitch, destinationPort, destinationVlan);
ImmutablePair<PathInfoData, PathInfoData> path = FlowUtils.getFlowPath(flow);
System.out.println(path);
assertEquals(expectedShortestPath, path);
}
Aggregations