Search in sources :

Example 1 with DetectConnectedDevices

use of org.openkilda.wfm.topology.flowhs.model.DetectConnectedDevices in project open-kilda by telstra.

the class RequestedFlowMapperTest method mapFlowRequestToRequestedFlowTest.

@Test
public void mapFlowRequestToRequestedFlowTest() {
    RequestedFlow requestedFlow = RequestedFlowMapper.INSTANCE.toRequestedFlow(flowRequest);
    assertEquals(FLOW_ID, requestedFlow.getFlowId());
    assertEquals(SRC_SWITCH_ID, requestedFlow.getSrcSwitch());
    assertEquals(SRC_PORT, requestedFlow.getSrcPort());
    assertEquals(SRC_VLAN, requestedFlow.getSrcVlan());
    assertEquals(SRC_INNER_VLAN, requestedFlow.getSrcInnerVlan());
    assertEquals(DST_SWITCH_ID, requestedFlow.getDestSwitch());
    assertEquals(DST_PORT, requestedFlow.getDestPort());
    assertEquals(DST_VLAN, requestedFlow.getDestVlan());
    assertEquals(DST_INNER_VLAN, requestedFlow.getDestInnerVlan());
    assertEquals(PRIORITY, requestedFlow.getPriority());
    assertEquals(DIVERSE_FLOW_ID, requestedFlow.getDiverseFlowId());
    assertEquals(DESCRIPTION, requestedFlow.getDescription());
    assertEquals(BANDWIDTH, requestedFlow.getBandwidth());
    assertEquals(MAX_LATENCY, requestedFlow.getMaxLatency());
    assertEquals(ENCAPSULATION_TYPE, requestedFlow.getFlowEncapsulationType());
    assertTrue(requestedFlow.isPinned());
    assertTrue(requestedFlow.isAllocateProtectedPath());
    assertTrue(requestedFlow.isIgnoreBandwidth());
    assertTrue(requestedFlow.isPeriodicPings());
    assertEquals(new DetectConnectedDevices(true, true, true, true, true, true, true, true), requestedFlow.getDetectConnectedDevices());
}
Also used : DetectConnectedDevices(org.openkilda.wfm.topology.flowhs.model.DetectConnectedDevices) RequestedFlow(org.openkilda.wfm.topology.flowhs.model.RequestedFlow) Test(org.junit.Test)

Example 2 with DetectConnectedDevices

use of org.openkilda.wfm.topology.flowhs.model.DetectConnectedDevices in project open-kilda by telstra.

the class RequestedFlowMapperTest method mapFlowToRequestedFlowTest.

@Test
public void mapFlowToRequestedFlowTest() {
    RequestedFlow requestedFlow = RequestedFlowMapper.INSTANCE.toRequestedFlow(flow);
    assertEquals(FLOW_ID, requestedFlow.getFlowId());
    assertEquals(SRC_SWITCH_ID, requestedFlow.getSrcSwitch());
    assertEquals(SRC_PORT, requestedFlow.getSrcPort());
    assertEquals(SRC_VLAN, requestedFlow.getSrcVlan());
    assertEquals(SRC_INNER_VLAN, requestedFlow.getSrcInnerVlan());
    assertEquals(DST_SWITCH_ID, requestedFlow.getDestSwitch());
    assertEquals(DST_PORT, requestedFlow.getDestPort());
    assertEquals(DST_VLAN, requestedFlow.getDestVlan());
    assertEquals(DST_INNER_VLAN, requestedFlow.getDestInnerVlan());
    assertEquals(PRIORITY, requestedFlow.getPriority());
    assertEquals(DESCRIPTION, requestedFlow.getDescription());
    assertEquals(BANDWIDTH, requestedFlow.getBandwidth());
    assertEquals(MAX_LATENCY, requestedFlow.getMaxLatency());
    assertEquals(ENCAPSULATION_TYPE, requestedFlow.getFlowEncapsulationType());
    assertTrue(requestedFlow.isPinned());
    assertTrue(requestedFlow.isAllocateProtectedPath());
    assertTrue(requestedFlow.isIgnoreBandwidth());
    assertTrue(requestedFlow.isPeriodicPings());
    assertEquals(new DetectConnectedDevices(true, true, true, true, true, true, true, true), requestedFlow.getDetectConnectedDevices());
    Flow mappedFlow = RequestedFlowMapper.INSTANCE.toFlow(requestedFlow);
    assertEquals(flow, mappedFlow);
}
Also used : DetectConnectedDevices(org.openkilda.wfm.topology.flowhs.model.DetectConnectedDevices) RequestedFlow(org.openkilda.wfm.topology.flowhs.model.RequestedFlow) Flow(org.openkilda.model.Flow) RequestedFlow(org.openkilda.wfm.topology.flowhs.model.RequestedFlow) Test(org.junit.Test)

Example 3 with DetectConnectedDevices

use of org.openkilda.wfm.topology.flowhs.model.DetectConnectedDevices in project open-kilda by telstra.

the class FlowValidatorTest method shouldFailOnSwapWhenEqualsEndpointsOnSecondFlow.

@Test(expected = InvalidFlowException.class)
public void shouldFailOnSwapWhenEqualsEndpointsOnSecondFlow() throws InvalidFlowException {
    RequestedFlow firstFlow = RequestedFlow.builder().flowId("firstFlow").srcSwitch(SWITCH_ID_2).srcPort(10).srcVlan(11).destSwitch(SWITCH_ID_2).destPort(12).detectConnectedDevices(new DetectConnectedDevices()).build();
    RequestedFlow secondFlow = RequestedFlow.builder().flowId("secondFlow").srcSwitch(SWITCH_ID_1).srcPort(10).srcVlan(11).destSwitch(SWITCH_ID_1).destPort(10).destVlan(11).detectConnectedDevices(new DetectConnectedDevices()).build();
    flowValidator.checkForEqualsEndpoints(firstFlow, secondFlow);
}
Also used : DetectConnectedDevices(org.openkilda.wfm.topology.flowhs.model.DetectConnectedDevices) RequestedFlow(org.openkilda.wfm.topology.flowhs.model.RequestedFlow) Test(org.junit.Test)

Example 4 with DetectConnectedDevices

use of org.openkilda.wfm.topology.flowhs.model.DetectConnectedDevices in project open-kilda by telstra.

the class FlowValidatorTest method shouldFailOnSwapWhenEqualsEndpointsOnFirstFlow.

@Test(expected = InvalidFlowException.class)
public void shouldFailOnSwapWhenEqualsEndpointsOnFirstFlow() throws InvalidFlowException {
    RequestedFlow firstFlow = RequestedFlow.builder().flowId("firstFlow").srcSwitch(SWITCH_ID_1).srcPort(10).srcVlan(11).destSwitch(SWITCH_ID_2).destPort(10).destVlan(11).detectConnectedDevices(new DetectConnectedDevices()).build();
    RequestedFlow secondFlow = RequestedFlow.builder().flowId("secondFlow").srcSwitch(SWITCH_ID_2).destSwitch(SWITCH_ID_2).detectConnectedDevices(new DetectConnectedDevices()).build();
    flowValidator.checkForEqualsEndpoints(firstFlow, secondFlow);
}
Also used : DetectConnectedDevices(org.openkilda.wfm.topology.flowhs.model.DetectConnectedDevices) RequestedFlow(org.openkilda.wfm.topology.flowhs.model.RequestedFlow) Test(org.junit.Test)

Example 5 with DetectConnectedDevices

use of org.openkilda.wfm.topology.flowhs.model.DetectConnectedDevices in project open-kilda by telstra.

the class RequestedFlowMapperTest method mapFlowRequestToRequestedFlow.

@Test
public void mapFlowRequestToRequestedFlow() {
    RequestedFlow result = RequestedFlowMapper.INSTANCE.toRequestedFlow(flowRequest);
    assertEquals(FLOW_ID, result.getFlowId());
    assertEquals(SRC_SWITCH_ID, result.getSrcSwitch());
    assertEquals(SRC_PORT, result.getSrcPort());
    assertEquals(SRC_VLAN, result.getSrcVlan());
    assertEquals(SRC_INNER_VLAN, result.getSrcInnerVlan());
    assertEquals(DST_SWITCH_ID, result.getDestSwitch());
    assertEquals(DST_PORT, result.getDestPort());
    assertEquals(DST_VLAN, result.getDestVlan());
    assertEquals(DST_INNER_VLAN, result.getDestInnerVlan());
    assertEquals(PRIORITY, result.getPriority());
    assertTrue(result.isPinned());
    assertTrue(result.isAllocateProtectedPath());
    assertEquals(DIVERSE_FLOW_ID, result.getDiverseFlowId());
    assertEquals(DESCRIPTION, result.getDescription());
    assertEquals(BANDWIDTH, result.getBandwidth());
    assertTrue(result.isIgnoreBandwidth());
    assertTrue(result.isPeriodicPings());
    assertEquals(MAX_LATENCY, result.getMaxLatency());
    assertEquals(ENCAPSULATION_TYPE, result.getFlowEncapsulationType());
    assertEquals(PATH_COMPUTATION_STRATEGY, result.getPathComputationStrategy());
    assertEquals(new DetectConnectedDevices(true, true, true, true, true, true, true, true), result.getDetectConnectedDevices());
}
Also used : DetectConnectedDevices(org.openkilda.wfm.topology.flowhs.model.DetectConnectedDevices) RequestedFlow(org.openkilda.wfm.topology.flowhs.model.RequestedFlow) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)8 DetectConnectedDevices (org.openkilda.wfm.topology.flowhs.model.DetectConnectedDevices)8 RequestedFlow (org.openkilda.wfm.topology.flowhs.model.RequestedFlow)8 Flow (org.openkilda.model.Flow)1