Search in sources :

Example 26 with PathInfoData

use of org.openkilda.messaging.info.event.PathInfoData in project open-kilda by telstra.

the class FlowCrudStepsTest method shouldDefineFlowsOverTheSameSwitches.

@Test
public void shouldDefineFlowsOverTheSameSwitches() {
    // given
    when(topologyEngineService.getPaths(eq("00:00:00:00:00:01"), eq("00:00:00:00:00:01"))).thenReturn(singletonList(new PathInfoData()));
    // when
    flowCrudSteps.defineFlowsOverAllSwitches();
    // then
    assertEquals(1, flowCrudSteps.flows.size());
    final FlowPayload flowPayload = flowCrudSteps.flows.get(0);
    assertEquals(20, (int) flowPayload.getSource().getPortId());
    assertEquals(1, (int) flowPayload.getSource().getVlanId());
    assertEquals(21, (int) flowPayload.getDestination().getPortId());
    assertEquals(1, (int) flowPayload.getDestination().getVlanId());
}
Also used : PathInfoData(org.openkilda.messaging.info.event.PathInfoData) FlowPayload(org.openkilda.messaging.payload.flow.FlowPayload) Test(org.junit.Test)

Example 27 with PathInfoData

use of org.openkilda.messaging.info.event.PathInfoData 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);
}
Also used : PathInfoData(org.openkilda.messaging.info.event.PathInfoData) Flow(org.openkilda.messaging.model.Flow) Then(cucumber.api.java.en.Then)

Aggregations

PathInfoData (org.openkilda.messaging.info.event.PathInfoData)27 Flow (org.openkilda.messaging.model.Flow)13 Test (org.junit.Test)12 InfoMessage (org.openkilda.messaging.info.InfoMessage)8 PathNode (org.openkilda.messaging.info.event.PathNode)6 FlowPayload (org.openkilda.messaging.payload.flow.FlowPayload)5 Values (org.apache.storm.tuple.Values)4 Driver (org.neo4j.driver.v1.Driver)4 MessageException (org.openkilda.messaging.error.MessageException)4 ImmutablePair (org.openkilda.messaging.model.ImmutablePair)4 UnroutablePathException (org.openkilda.pce.provider.UnroutablePathException)4 AbstractStormTest (org.openkilda.wfm.AbstractStormTest)4 ArrayList (java.util.ArrayList)3 CommandMessage (org.openkilda.messaging.command.CommandMessage)3 FlowPathResponse (org.openkilda.messaging.info.flow.FlowPathResponse)3 HashSet (java.util.HashSet)2 Set (java.util.Set)2 FlowRerouteRequest (org.openkilda.messaging.command.flow.FlowRerouteRequest)2 SwitchInfoData (org.openkilda.messaging.info.event.SwitchInfoData)2 FlowValidationException (org.openkilda.wfm.topology.flow.validation.FlowValidationException)2