Search in sources :

Example 61 with Switch

use of org.openkilda.model.Switch in project open-kilda by telstra.

the class FlowOperationsServiceTest method getFlowsForEndpointNotReturnFlowsForOrphanedPaths.

@Test
public void getFlowsForEndpointNotReturnFlowsForOrphanedPaths() throws SwitchNotFoundException {
    Switch switchA = createSwitch(SWITCH_ID_1);
    Switch switchB = createSwitch(SWITCH_ID_2);
    Switch switchC = createSwitch(SWITCH_ID_3);
    Switch switchD = createSwitch(SWITCH_ID_4);
    Flow flow = createFlow(FLOW_ID_1, switchA, 1, switchC, 2, FORWARD_PATH_1, REVERSE_PATH_1, switchB);
    createOrphanFlowPaths(flow, switchA, 1, switchC, 2, FORWARD_PATH_3, REVERSE_PATH_3, switchD);
    assertEquals(0, flowOperationsService.getFlowsForEndpoint(switchD.getSwitchId(), null).size());
}
Also used : Switch(org.openkilda.model.Switch) Flow(org.openkilda.model.Flow) InMemoryGraphBasedTest(org.openkilda.persistence.inmemory.InMemoryGraphBasedTest) Test(org.junit.Test)

Example 62 with Switch

use of org.openkilda.model.Switch in project open-kilda by telstra.

the class FlowOperationsServiceTest method getFlowsForEndpointMultiSwitchFlowNoPortTest.

@Test
public void getFlowsForEndpointMultiSwitchFlowNoPortTest() throws SwitchNotFoundException {
    Switch switchA = createSwitch(SWITCH_ID_1);
    Switch switchB = createSwitch(SWITCH_ID_2);
    createFlow(FLOW_ID_1, switchA, 1, switchB, 2, FORWARD_PATH_1, REVERSE_PATH_1, null);
    assertFlows(flowOperationsService.getFlowsForEndpoint(SWITCH_ID_1, null), FLOW_ID_1);
    createFlow(FLOW_ID_2, switchB, 3, switchA, 4, FORWARD_PATH_2, REVERSE_PATH_2, null);
    assertFlows(flowOperationsService.getFlowsForEndpoint(SWITCH_ID_1, null), FLOW_ID_1, FLOW_ID_2);
}
Also used : Switch(org.openkilda.model.Switch) InMemoryGraphBasedTest(org.openkilda.persistence.inmemory.InMemoryGraphBasedTest) Test(org.junit.Test)

Example 63 with Switch

use of org.openkilda.model.Switch in project open-kilda by telstra.

the class FlowOperationsServiceTest method getFlowsForEndpointMultiSwitchFlowWithPortTest.

@Test
public void getFlowsForEndpointMultiSwitchFlowWithPortTest() throws SwitchNotFoundException {
    Switch switchA = createSwitch(SWITCH_ID_1);
    Switch switchB = createSwitch(SWITCH_ID_2);
    createFlow(FLOW_ID_1, switchA, 1, switchB, 2, FORWARD_PATH_1, REVERSE_PATH_1, null);
    assertFlows(flowOperationsService.getFlowsForEndpoint(SWITCH_ID_1, 1), FLOW_ID_1);
    createFlow(FLOW_ID_2, switchB, 3, switchA, 1, FORWARD_PATH_2, REVERSE_PATH_2, null);
    assertFlows(flowOperationsService.getFlowsForEndpoint(SWITCH_ID_1, 1), FLOW_ID_1, FLOW_ID_2);
}
Also used : Switch(org.openkilda.model.Switch) InMemoryGraphBasedTest(org.openkilda.persistence.inmemory.InMemoryGraphBasedTest) Test(org.junit.Test)

Example 64 with Switch

use of org.openkilda.model.Switch in project open-kilda by telstra.

the class FlowOperationsServiceTest method getFlowsForEndpointOneSwitchFlowWithPortTest.

@Test
public void getFlowsForEndpointOneSwitchFlowWithPortTest() throws SwitchNotFoundException {
    Switch switchA = createSwitch(SWITCH_ID_1);
    createFlow(FLOW_ID_1, switchA, 1, switchA, 2, FORWARD_PATH_1, REVERSE_PATH_1, null);
    assertFlows(flowOperationsService.getFlowsForEndpoint(SWITCH_ID_1, 1), FLOW_ID_1);
    // flow on different port
    createFlow(FLOW_ID_2, switchA, 3, switchA, 4, FORWARD_PATH_2, REVERSE_PATH_2, null);
    assertFlows(flowOperationsService.getFlowsForEndpoint(SWITCH_ID_1, 1), FLOW_ID_1);
}
Also used : Switch(org.openkilda.model.Switch) InMemoryGraphBasedTest(org.openkilda.persistence.inmemory.InMemoryGraphBasedTest) Test(org.junit.Test)

Example 65 with Switch

use of org.openkilda.model.Switch in project open-kilda by telstra.

the class PathsServiceTest method init.

@Before
public void init() {
    /* Topology:
         *
         *  +------3------+
         *  |             |
         *  1------4------2
         *  |             |
         *  +------5------+
         *  |             |
         *  ...          ...
         *  |             |
         *  +-----550-----+
         */
    Switch switchA = Switch.builder().switchId(SWITCH_ID_1).status(SwitchStatus.ACTIVE).build();
    Switch switchB = Switch.builder().switchId(SWITCH_ID_2).status(SwitchStatus.ACTIVE).build();
    switchRepository.add(switchA);
    switchRepository.add(switchB);
    createSwitchProperties(switchA, TRANSIT_VLAN, VXLAN);
    createSwitchProperties(switchB, TRANSIT_VLAN, VXLAN);
    for (int i = 3; i <= SWITCH_COUNT; i++) {
        Switch transitSwitch = Switch.builder().switchId(new SwitchId(i)).status(SwitchStatus.ACTIVE).build();
        switchRepository.add(transitSwitch);
        // last half of switches supports TRANSIT_VLAN and VXLAN
        if (SWITCH_COUNT - i < VXLAN_SWITCH_COUNT) {
            createSwitchProperties(transitSwitch, TRANSIT_VLAN, VXLAN);
        } else {
            createSwitchProperties(transitSwitch, TRANSIT_VLAN);
        }
        createIsl(switchA, i * 2, transitSwitch, i * 2, i, BASE_LATENCY - i, 1000 + i);
        createIsl(transitSwitch, i * 2 + 1, switchB, i * 2 + 1, i, BASE_LATENCY - i, 1000 + i);
    }
    kildaConfigurationRepository.add(KildaConfiguration.builder().flowEncapsulationType(TRANSIT_VLAN).pathComputationStrategy(PathComputationStrategy.COST_AND_AVAILABLE_BANDWIDTH).build());
}
Also used : Switch(org.openkilda.model.Switch) SwitchId(org.openkilda.model.SwitchId) Before(org.junit.Before)

Aggregations

Switch (org.openkilda.model.Switch)230 Test (org.junit.Test)126 Flow (org.openkilda.model.Flow)68 SwitchId (org.openkilda.model.SwitchId)67 InMemoryGraphBasedTest (org.openkilda.persistence.inmemory.InMemoryGraphBasedTest)46 FlowPath (org.openkilda.model.FlowPath)34 PathId (org.openkilda.model.PathId)32 Utils.buildSwitch (org.openkilda.rulemanager.Utils.buildSwitch)32 PathComputer (org.openkilda.pce.PathComputer)28 GetPathsResult (org.openkilda.pce.GetPathsResult)23 List (java.util.List)22 SwitchProperties (org.openkilda.model.SwitchProperties)21 FlowSpeakerData (org.openkilda.rulemanager.FlowSpeakerData)20 SpeakerData (org.openkilda.rulemanager.SpeakerData)19 String.format (java.lang.String.format)17 Set (java.util.Set)17 Isl (org.openkilda.model.Isl)15 HashSet (java.util.HashSet)14 ArrayList (java.util.ArrayList)13 Collections (java.util.Collections)13