Search in sources :

Example 36 with PathInfoData

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

the class FlowCrudStepsTest method shouldDefineFlowCrossVlan.

@Test
public void shouldDefineFlowCrossVlan() {
    // given
    when(topologyEngineService.getPaths(eq("00:00:00:00:00:01"), eq("00:00:00:00:00:04"))).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(20, (int) flowPayload.getDestination().getPortId());
    assertEquals(50, (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 37 with PathInfoData

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

the class FlowCrudStepsTest method shouldDefineFlowsOver2Switches.

@Test
public void shouldDefineFlowsOver2Switches() {
    // given
    when(topologyEngineService.getPaths(eq("00:00:00:00:00:01"), eq("00:00:00:00:00:02"))).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(20, (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 38 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 39 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)39 Test (org.junit.Test)15 Flow (org.openkilda.messaging.model.Flow)13 InfoMessage (org.openkilda.messaging.info.InfoMessage)10 PathNode (org.openkilda.messaging.info.event.PathNode)10 ArrayList (java.util.ArrayList)9 FlowPayload (org.openkilda.messaging.payload.flow.FlowPayload)9 List (java.util.List)6 PathSegment (org.openkilda.model.PathSegment)5 SwitchId (org.openkilda.model.SwitchId)5 Set (java.util.Set)4 Collectors (java.util.stream.Collectors)4 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 FlowPath (org.openkilda.model.FlowPath)4 UnroutablePathException (org.openkilda.pce.provider.UnroutablePathException)4 HashMap (java.util.HashMap)3 CommandMessage (org.openkilda.messaging.command.CommandMessage)3