use of org.openkilda.messaging.payload.flow.FlowPayload in project open-kilda by telstra.
the class FlowCrudSteps method eachFlowIsInUPState.
@And("^each flow is in UP state$")
public void eachFlowIsInUPState() {
for (FlowPayload flow : flows) {
FlowIdStatusPayload status = Failsafe.with(retryPolicy.abortIf(p -> p != null && FlowState.UP == ((FlowIdStatusPayload) p).getStatus())).get(() -> northboundService.getFlowStatus(flow.getId()));
assertNotNull(status);
assertThat(format("The flow status for '%s' can't be retrived.", flow.getId()), status, hasProperty("id", equalTo(flow.getId())));
assertThat(format("The flow '%s' has wrong status.", flow.getId()), status, hasProperty("status", equalTo(FlowState.UP)));
}
}
use of org.openkilda.messaging.payload.flow.FlowPayload in project open-kilda by telstra.
the class FlowCrudSteps method eachFlowCanNotBeReadFromNorthbound.
@And("^each flow can not be read from Northbound$")
public void eachFlowCanNotBeReadFromNorthbound() {
for (FlowPayload flow : flows) {
FlowPayload result = Failsafe.with(retryPolicy.abortIf(Objects::isNull)).get(() -> northboundService.getFlow(flow.getId()));
assertNull(format("The flow '%s' exists.", flow.getId()), result);
}
}
use of org.openkilda.messaging.payload.flow.FlowPayload in project open-kilda by telstra.
the class FlowCrudSteps method eachFlowCanBeDeleted.
@Then("^each flow can be deleted$")
public void eachFlowCanBeDeleted() {
for (FlowPayload flow : flows) {
FlowPayload result = northboundService.deleteFlow(flow.getId());
assertNotNull(result);
}
}
use of org.openkilda.messaging.payload.flow.FlowPayload in project open-kilda by telstra.
the class FlowCrudSteps method creationRequestForEachFlowIsSuccessful.
@When("^creation request for each flow is successful$")
public void creationRequestForEachFlowIsSuccessful() {
for (FlowPayload flow : flows) {
FlowPayload result = northboundService.addFlow(flow);
assertThat(result, reflectEquals(flow, "lastUpdated"));
assertThat(result, hasProperty("lastUpdated", notNullValue()));
}
}
use of org.openkilda.messaging.payload.flow.FlowPayload in project open-kilda by telstra.
the class FlowCrudStepsTest method shouldDefineFlowsOver3Switches.
@Test
public void shouldDefineFlowsOver3Switches() {
// given
when(topologyEngineService.getPaths(eq("00:00:00:00:00:01"), eq("00:00:00:00:00:02"))).thenReturn(singletonList(new PathInfoData()));
when(topologyEngineService.getPaths(eq("00:00:00:00:00:02"), eq("00:00:00:00:00:03"))).thenReturn(singletonList(new PathInfoData()));
// when
flowCrudSteps.defineFlowsOverAllSwitches();
// then
assertEquals(2, flowCrudSteps.flows.size());
final FlowPayload sw1sw2Flow = flowCrudSteps.flows.get(0);
assertEquals(20, (int) sw1sw2Flow.getSource().getPortId());
assertEquals(1, (int) sw1sw2Flow.getSource().getVlanId());
assertEquals(20, (int) sw1sw2Flow.getDestination().getPortId());
assertEquals(1, (int) sw1sw2Flow.getDestination().getVlanId());
final FlowPayload sw2sw3Flow = flowCrudSteps.flows.get(1);
assertEquals(20, (int) sw2sw3Flow.getSource().getPortId());
assertEquals(2, (int) sw2sw3Flow.getSource().getVlanId());
assertEquals(20, (int) sw2sw3Flow.getDestination().getPortId());
assertEquals(2, (int) sw2sw3Flow.getDestination().getVlanId());
}
Aggregations