Search in sources :

Example 1 with FlowPatchEndpoint

use of org.openkilda.northbound.dto.v2.flows.FlowPatchEndpoint in project open-kilda by telstra.

the class FlowMapperTest method testFlowPatchV2ToFlowDto.

@Test
public void testFlowPatchV2ToFlowDto() {
    FlowPatchV2 flowPatchDto = new FlowPatchV2(new FlowPatchEndpoint(SRC_SWITCH_ID, SRC_PORT, SRC_VLAN, SRC_INNER_VLAN, SRC_DETECT_CONNECTED_DEVICES), new FlowPatchEndpoint(DST_SWITCH_ID, DST_PORT, DST_VLAN, DST_INNER_VLAN, DST_DETECT_CONNECTED_DEVICES), (long) BANDWIDTH, IGNORE_BANDWIDTH, STRICT_BANDWIDTH, PERIODIC_PINGS, DESCRIPTION, LATENCY, LATENCY_TIER2, PRIORITY, DIVERSE_FLOW_ID, AFFINITY_FLOW_ID, PINNED, ALLOCATE_PROTECTED_PATH, ENCAPSULATION_TYPE, PATH_COMPUTATION_STRATEGY, TARGET_PATH_COMPUTATION_STRATEGY);
    FlowPatch flowPatch = flowMapper.toFlowPatch(flowPatchDto);
    assertEquals(flowPatchDto.getSource().getSwitchId(), flowPatch.getSource().getSwitchId());
    assertEquals(flowPatchDto.getSource().getPortNumber(), flowPatch.getSource().getPortNumber());
    assertEquals(flowPatchDto.getSource().getVlanId(), flowPatch.getSource().getVlanId());
    assertEquals(flowPatchDto.getSource().getInnerVlanId(), flowPatch.getSource().getInnerVlanId());
    assertEquals(flowPatchDto.getSource().getDetectConnectedDevices().isLldp(), flowPatch.getSource().getTrackLldpConnectedDevices());
    assertEquals(flowPatchDto.getSource().getDetectConnectedDevices().isArp(), flowPatch.getSource().getTrackArpConnectedDevices());
    assertEquals(flowPatchDto.getDestination().getSwitchId(), flowPatch.getDestination().getSwitchId());
    assertEquals(flowPatchDto.getDestination().getPortNumber(), flowPatch.getDestination().getPortNumber());
    assertEquals(flowPatchDto.getDestination().getVlanId(), flowPatch.getDestination().getVlanId());
    assertEquals(flowPatchDto.getDestination().getInnerVlanId(), flowPatch.getDestination().getInnerVlanId());
    assertEquals(flowPatchDto.getDestination().getDetectConnectedDevices().isLldp(), flowPatch.getDestination().getTrackLldpConnectedDevices());
    assertEquals(flowPatchDto.getDestination().getDetectConnectedDevices().isArp(), flowPatch.getDestination().getTrackArpConnectedDevices());
    assertEquals(flowPatchDto.getMaxLatency() * MS_TO_NS_MULTIPLIER, (long) flowPatch.getMaxLatency());
    assertEquals(flowPatchDto.getMaxLatencyTier2() * MS_TO_NS_MULTIPLIER, (long) flowPatch.getMaxLatencyTier2());
    assertEquals(flowPatchDto.getPriority(), flowPatch.getPriority());
    assertEquals(flowPatchDto.getPeriodicPings(), flowPatch.getPeriodicPings());
    assertEquals(flowPatchDto.getTargetPathComputationStrategy(), flowPatch.getTargetPathComputationStrategy().name().toLowerCase());
    assertEquals(flowPatchDto.getDiverseFlowId(), flowPatch.getDiverseFlowId());
    assertEquals(flowPatchDto.getAffinityFlowId(), flowPatch.getAffinityFlowId());
    assertEquals(flowPatchDto.getMaximumBandwidth(), flowPatch.getBandwidth());
    assertEquals(flowPatchDto.getAllocateProtectedPath(), flowPatch.getAllocateProtectedPath());
    assertEquals(flowPatchDto.getPinned(), flowPatch.getPinned());
    assertEquals(flowPatchDto.getIgnoreBandwidth(), flowPatch.getIgnoreBandwidth());
    assertEquals(flowPatchDto.getStrictBandwidth(), flowPatch.getStrictBandwidth());
    assertEquals(flowPatchDto.getDescription(), flowPatch.getDescription());
    assertEquals(flowPatchDto.getEncapsulationType(), flowPatch.getEncapsulationType().name().toLowerCase());
    assertEquals(flowPatchDto.getPathComputationStrategy(), flowPatch.getPathComputationStrategy().name().toLowerCase());
}
Also used : FlowPatchV2(org.openkilda.northbound.dto.v2.flows.FlowPatchV2) FlowPatch(org.openkilda.messaging.model.FlowPatch) FlowPatchEndpoint(org.openkilda.northbound.dto.v2.flows.FlowPatchEndpoint) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 FlowPatch (org.openkilda.messaging.model.FlowPatch)1 FlowPatchEndpoint (org.openkilda.northbound.dto.v2.flows.FlowPatchEndpoint)1 FlowPatchV2 (org.openkilda.northbound.dto.v2.flows.FlowPatchV2)1