Search in sources :

Example 6 with SwitchPropertiesDto

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

the class SwitchOperationsServiceTest method shouldValidateMultiTableFlagWhenUpdatingSwitchPropertiesWithArp.

@Test(expected = IllegalSwitchPropertiesException.class)
public void shouldValidateMultiTableFlagWhenUpdatingSwitchPropertiesWithArp() {
    Switch sw = Switch.builder().switchId(TEST_SWITCH_ID).status(SwitchStatus.ACTIVE).build();
    switchRepository.add(sw);
    createSwitchProperties(sw, Collections.singleton(FlowEncapsulationType.TRANSIT_VLAN), true, false, true);
    // user can't disable multiTable without disabling ARP
    SwitchPropertiesDto update = new SwitchPropertiesDto();
    update.setSupportedTransitEncapsulation(Collections.singleton(org.openkilda.messaging.payload.flow.FlowEncapsulationType.TRANSIT_VLAN));
    update.setMultiTable(false);
    update.setSwitchArp(true);
    switchOperationsService.updateSwitchProperties(TEST_SWITCH_ID, update);
}
Also used : SwitchPropertiesDto(org.openkilda.messaging.model.SwitchPropertiesDto) Switch(org.openkilda.model.Switch) InMemoryGraphBasedTest(org.openkilda.persistence.inmemory.InMemoryGraphBasedTest) Test(org.junit.Test)

Example 7 with SwitchPropertiesDto

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

the class SwitchOperationsServiceTest method shouldValidateFlowWhenUpdatingServer42PortSwitchProperties.

@Test(expected = IllegalSwitchPropertiesException.class)
public void shouldValidateFlowWhenUpdatingServer42PortSwitchProperties() {
    Switch firstSwitch = Switch.builder().switchId(TEST_SWITCH_ID).status(SwitchStatus.ACTIVE).build();
    Switch secondSwitch = Switch.builder().switchId(TEST_SWITCH_ID_2).status(SwitchStatus.ACTIVE).build();
    switchRepository.add(firstSwitch);
    switchRepository.add(secondSwitch);
    Flow flow = Flow.builder().flowId(TEST_FLOW_ID_1).srcSwitch(firstSwitch).srcPort(TEST_FLOW_SRC_PORT).destSwitch(secondSwitch).detectConnectedDevices(new DetectConnectedDevices(false, true, false, true, false, false, false, false)).build();
    flowRepository.add(flow);
    createSwitchProperties(firstSwitch, Collections.singleton(FlowEncapsulationType.TRANSIT_VLAN), true, false, false);
    SwitchPropertiesDto update = new SwitchPropertiesDto();
    update.setSupportedTransitEncapsulation(Collections.singleton(org.openkilda.messaging.payload.flow.FlowEncapsulationType.TRANSIT_VLAN));
    update.setServer42Port(TEST_FLOW_SRC_PORT);
    switchOperationsService.updateSwitchProperties(TEST_SWITCH_ID, update);
}
Also used : SwitchPropertiesDto(org.openkilda.messaging.model.SwitchPropertiesDto) Switch(org.openkilda.model.Switch) DetectConnectedDevices(org.openkilda.model.DetectConnectedDevices) Flow(org.openkilda.model.Flow) InMemoryGraphBasedTest(org.openkilda.persistence.inmemory.InMemoryGraphBasedTest) Test(org.junit.Test)

Example 8 with SwitchPropertiesDto

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

the class SwitchOperationsServiceTest method shouldValidateServer42PortWhenEnableIslRttInSwitchProperties.

@Test(expected = IllegalSwitchPropertiesException.class)
public void shouldValidateServer42PortWhenEnableIslRttInSwitchProperties() {
    // user can't enable server42FlowRtt and do not specify server42Port
    SwitchPropertiesDto properties = new SwitchPropertiesDto();
    properties.setServer42IslRtt(SwitchPropertiesDto.RttState.ENABLED);
    properties.setServer42Port(null);
    properties.setServer42Vlan(SERVER_42_VLAN_2);
    properties.setServer42MacAddress(SERVER_42_MAC_ADDRESS_2);
    runInvalidServer42PropsTest(properties);
}
Also used : SwitchPropertiesDto(org.openkilda.messaging.model.SwitchPropertiesDto) InMemoryGraphBasedTest(org.openkilda.persistence.inmemory.InMemoryGraphBasedTest) Test(org.junit.Test)

Example 9 with SwitchPropertiesDto

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

the class SwitchOperationsServiceTest method shouldValidateFlowWithArpFlagWhenUpdatingSwitchProperties.

@Test(expected = IllegalSwitchPropertiesException.class)
public void shouldValidateFlowWithArpFlagWhenUpdatingSwitchProperties() {
    Switch firstSwitch = Switch.builder().switchId(TEST_SWITCH_ID).status(SwitchStatus.ACTIVE).build();
    Switch secondSwitch = Switch.builder().switchId(TEST_SWITCH_ID_2).status(SwitchStatus.ACTIVE).build();
    switchRepository.add(firstSwitch);
    switchRepository.add(secondSwitch);
    Flow flow = Flow.builder().flowId(TEST_FLOW_ID_1).srcSwitch(firstSwitch).destSwitch(secondSwitch).detectConnectedDevices(new DetectConnectedDevices(false, true, false, true, false, false, false, false)).build();
    flowRepository.add(flow);
    createSwitchProperties(firstSwitch, Collections.singleton(FlowEncapsulationType.TRANSIT_VLAN), true, false, false);
    // user can't disable multiTable if some flows has enabled detect connected devices via ARP
    SwitchPropertiesDto update = new SwitchPropertiesDto();
    update.setSupportedTransitEncapsulation(Collections.singleton(org.openkilda.messaging.payload.flow.FlowEncapsulationType.TRANSIT_VLAN));
    update.setMultiTable(false);
    update.setSwitchArp(false);
    switchOperationsService.updateSwitchProperties(TEST_SWITCH_ID, update);
}
Also used : SwitchPropertiesDto(org.openkilda.messaging.model.SwitchPropertiesDto) Switch(org.openkilda.model.Switch) DetectConnectedDevices(org.openkilda.model.DetectConnectedDevices) Flow(org.openkilda.model.Flow) InMemoryGraphBasedTest(org.openkilda.persistence.inmemory.InMemoryGraphBasedTest) Test(org.junit.Test)

Example 10 with SwitchPropertiesDto

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

the class SwitchOperationsServiceTest method shouldValidateFlowMirrorPointsWhenUpdatingSwitchLldpProperties.

@Test(expected = IllegalSwitchPropertiesException.class)
public void shouldValidateFlowMirrorPointsWhenUpdatingSwitchLldpProperties() {
    Switch mirrorSwitch = Switch.builder().switchId(TEST_SWITCH_ID).status(SwitchStatus.ACTIVE).build();
    switchRepository.add(mirrorSwitch);
    MirrorGroup mirrorGroup = MirrorGroup.builder().switchId(TEST_SWITCH_ID).groupId(new GroupId(12L)).pathId(new PathId("test_path_id")).flowId(TEST_FLOW_ID_1).mirrorGroupType(MirrorGroupType.TRAFFIC_INTEGRITY).mirrorDirection(MirrorDirection.INGRESS).build();
    mirrorGroupRepository.add(mirrorGroup);
    FlowMirrorPoints flowMirrorPoints = FlowMirrorPoints.builder().mirrorGroup(mirrorGroup).mirrorSwitch(mirrorSwitch).build();
    flowMirrorPointsRepository.add(flowMirrorPoints);
    createSwitchProperties(mirrorSwitch, Collections.singleton(FlowEncapsulationType.TRANSIT_VLAN), true, false, false);
    SwitchPropertiesDto update = new SwitchPropertiesDto();
    update.setSupportedTransitEncapsulation(Collections.singleton(org.openkilda.messaging.payload.flow.FlowEncapsulationType.TRANSIT_VLAN));
    update.setMultiTable(true);
    update.setSwitchLldp(true);
    switchOperationsService.updateSwitchProperties(TEST_SWITCH_ID, update);
}
Also used : PathId(org.openkilda.model.PathId) SwitchPropertiesDto(org.openkilda.messaging.model.SwitchPropertiesDto) MirrorGroup(org.openkilda.model.MirrorGroup) Switch(org.openkilda.model.Switch) FlowMirrorPoints(org.openkilda.model.FlowMirrorPoints) GroupId(org.openkilda.model.GroupId) InMemoryGraphBasedTest(org.openkilda.persistence.inmemory.InMemoryGraphBasedTest) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)18 SwitchPropertiesDto (org.openkilda.messaging.model.SwitchPropertiesDto)18 InMemoryGraphBasedTest (org.openkilda.persistence.inmemory.InMemoryGraphBasedTest)18 Switch (org.openkilda.model.Switch)12 DetectConnectedDevices (org.openkilda.model.DetectConnectedDevices)3 Flow (org.openkilda.model.Flow)3 PathId (org.openkilda.model.PathId)3 SwitchProperties (org.openkilda.model.SwitchProperties)3 FlowMirrorPoints (org.openkilda.model.FlowMirrorPoints)2 GroupId (org.openkilda.model.GroupId)2 MirrorGroup (org.openkilda.model.MirrorGroup)2 FlowMirrorPath (org.openkilda.model.FlowMirrorPath)1