Search in sources :

Example 6 with DetectConnectedDevices

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

the class FlowCommandFactory method needToInstallOrRemoveLldpFlow.

private boolean needToInstallOrRemoveLldpFlow(FlowPath path) {
    Flow flow = path.getFlow();
    boolean isForward = flow.isForward(path);
    DetectConnectedDevices detect = flow.getDetectConnectedDevices();
    return (isForward && (detect.isSrcLldp() || detect.isSrcSwitchLldp())) || (!isForward && (detect.isDstLldp() || detect.isDstSwitchLldp()));
}
Also used : DetectConnectedDevices(org.openkilda.model.DetectConnectedDevices) InstallTransitFlow(org.openkilda.messaging.command.flow.InstallTransitFlow) InstallServer42IngressFlow(org.openkilda.messaging.command.flow.InstallServer42IngressFlow) InstallOneSwitchMirrorFlow(org.openkilda.messaging.command.flow.InstallOneSwitchMirrorFlow) Flow(org.openkilda.model.Flow) InstallIngressLoopFlow(org.openkilda.messaging.command.flow.InstallIngressLoopFlow) InstallIngressMirrorFlow(org.openkilda.messaging.command.flow.InstallIngressMirrorFlow) InstallTransitLoopFlow(org.openkilda.messaging.command.flow.InstallTransitLoopFlow) InstallOneSwitchFlow(org.openkilda.messaging.command.flow.InstallOneSwitchFlow) InstallEgressFlow(org.openkilda.messaging.command.flow.InstallEgressFlow) InstallEgressMirrorFlow(org.openkilda.messaging.command.flow.InstallEgressMirrorFlow) InstallIngressFlow(org.openkilda.messaging.command.flow.InstallIngressFlow)

Example 7 with DetectConnectedDevices

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

the class BaseResourceAllocationAction method updateSwitchRelatedFlowProperties.

private void updateSwitchRelatedFlowProperties(Flow flow) {
    Map<SwitchId, SwitchProperties> switchProperties = LazyMap.lazyMap(new HashMap<>(), switchId -> switchPropertiesRepository.findBySwitchId(switchId).orElse(null));
    DetectConnectedDevices.DetectConnectedDevicesBuilder detectConnectedDevices = flow.getDetectConnectedDevices().toBuilder();
    SwitchProperties srcSwitchProps = switchProperties.get(flow.getSrcSwitchId());
    if (srcSwitchProps != null) {
        detectConnectedDevices.srcSwitchLldp(srcSwitchProps.isSwitchLldp());
        detectConnectedDevices.srcSwitchArp(srcSwitchProps.isSwitchArp());
    }
    SwitchProperties destSwitchProps = switchProperties.get(flow.getDestSwitchId());
    if (destSwitchProps != null) {
        switchProperties.put(flow.getDestSwitchId(), destSwitchProps);
        detectConnectedDevices.dstSwitchLldp(destSwitchProps.isSwitchLldp());
        detectConnectedDevices.dstSwitchArp(destSwitchProps.isSwitchArp());
    }
    flow.setDetectConnectedDevices(detectConnectedDevices.build());
}
Also used : SwitchId(org.openkilda.model.SwitchId) DetectConnectedDevices(org.openkilda.model.DetectConnectedDevices) SwitchProperties(org.openkilda.model.SwitchProperties)

Example 8 with DetectConnectedDevices

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

the class RequestedFlowMapperTest method mapFlowRequestToFlowTest.

@Test
public void mapFlowRequestToFlowTest() {
    Flow flow = RequestedFlowMapper.INSTANCE.toFlow(FLOW_REQUEST);
    assertEquals(FLOW_ID, flow.getFlowId());
    assertEquals(SRC_SWITCH_ID, flow.getSrcSwitchId());
    assertEquals(SRC_PORT.intValue(), flow.getSrcPort());
    assertEquals(SRC_VLAN, flow.getSrcVlan());
    assertEquals(SRC_INNER_VLAN, flow.getSrcInnerVlan());
    assertEquals(DST_SWITCH_ID, flow.getDestSwitchId());
    assertEquals(DST_PORT.intValue(), flow.getDestPort());
    assertEquals(DST_VLAN, flow.getDestVlan());
    assertEquals(DST_INNER_VLAN, flow.getDestInnerVlan());
    assertEquals(PRIORITY, flow.getPriority());
    assertEquals(DESCRIPTION, flow.getDescription());
    assertEquals(BANDWIDTH, flow.getBandwidth());
    assertEquals(MAX_LATENCY, flow.getMaxLatency());
    assertEquals(MAX_LATENCY_TIER_2, flow.getMaxLatencyTier2());
    assertEquals(FlowEncapsulationType.VXLAN, flow.getEncapsulationType());
    assertEquals(PathComputationStrategy.COST, flow.getPathComputationStrategy());
    assertEquals(LOOP_SWITCH_ID, flow.getLoopSwitchId());
    assertTrue(flow.isPinned());
    assertTrue(flow.isAllocateProtectedPath());
    assertTrue(flow.isIgnoreBandwidth());
    assertTrue(flow.isPeriodicPings());
    assertEquals(new DetectConnectedDevices(true, true, true, true, true, true, true, true), flow.getDetectConnectedDevices());
}
Also used : DetectConnectedDevices(org.openkilda.model.DetectConnectedDevices) Flow(org.openkilda.model.Flow) Test(org.junit.Test)

Example 9 with DetectConnectedDevices

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

the class SwitchOperationsServiceTest method shouldValidateFlowWithLldpFlagWhenUpdatingSwitchProperties.

@Test(expected = IllegalSwitchPropertiesException.class)
public void shouldValidateFlowWithLldpFlagWhenUpdatingSwitchProperties() {
    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(true, false, true, false, 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 LLDP
    SwitchPropertiesDto update = new SwitchPropertiesDto();
    update.setSupportedTransitEncapsulation(Collections.singleton(org.openkilda.messaging.payload.flow.FlowEncapsulationType.TRANSIT_VLAN));
    update.setMultiTable(false);
    update.setSwitchLldp(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)

Aggregations

DetectConnectedDevices (org.openkilda.model.DetectConnectedDevices)9 Flow (org.openkilda.model.Flow)6 Test (org.junit.Test)4 Switch (org.openkilda.model.Switch)4 SwitchPropertiesDto (org.openkilda.messaging.model.SwitchPropertiesDto)3 InMemoryGraphBasedTest (org.openkilda.persistence.inmemory.InMemoryGraphBasedTest)3 InstallEgressFlow (org.openkilda.messaging.command.flow.InstallEgressFlow)2 InstallEgressMirrorFlow (org.openkilda.messaging.command.flow.InstallEgressMirrorFlow)2 InstallIngressFlow (org.openkilda.messaging.command.flow.InstallIngressFlow)2 InstallIngressLoopFlow (org.openkilda.messaging.command.flow.InstallIngressLoopFlow)2 InstallIngressMirrorFlow (org.openkilda.messaging.command.flow.InstallIngressMirrorFlow)2 InstallOneSwitchFlow (org.openkilda.messaging.command.flow.InstallOneSwitchFlow)2 InstallOneSwitchMirrorFlow (org.openkilda.messaging.command.flow.InstallOneSwitchMirrorFlow)2 InstallServer42IngressFlow (org.openkilda.messaging.command.flow.InstallServer42IngressFlow)2 InstallTransitFlow (org.openkilda.messaging.command.flow.InstallTransitFlow)2 InstallTransitLoopFlow (org.openkilda.messaging.command.flow.InstallTransitLoopFlow)2 SwitchId (org.openkilda.model.SwitchId)2 SwitchProperties (org.openkilda.model.SwitchProperties)2 FlowProcessingException (org.openkilda.wfm.topology.flowhs.exception.FlowProcessingException)1