Search in sources :

Example 1 with FlowMirrorPointsResponseV2

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

the class FlowMapperTest method testFlowMirrorPointsDumpResponseToFlowMirrorPointsResponseV2.

@Test
public void testFlowMirrorPointsDumpResponseToFlowMirrorPointsResponseV2() {
    FlowMirrorPoint firstPoint = FlowMirrorPoint.builder().mirrorPointId(MIRROR_POINT_ID_A).mirrorPointDirection(MIRROR_POINT_DIRECTION_A).mirrorPointSwitchId(SRC_SWITCH_ID).sinkEndpoint(FlowEndpoint.builder().switchId(SRC_SWITCH_ID).portNumber(SRC_PORT).outerVlanId(SRC_VLAN).innerVlanId(SRC_INNER_VLAN).build()).build();
    FlowMirrorPoint secondPoint = FlowMirrorPoint.builder().mirrorPointId(MIRROR_POINT_ID_B).mirrorPointDirection(MIRROR_POINT_DIRECTION_B).mirrorPointSwitchId(SRC_SWITCH_ID).sinkEndpoint(FlowEndpoint.builder().switchId(DST_SWITCH_ID).portNumber(DST_PORT).outerVlanId(DST_VLAN).innerVlanId(DST_INNER_VLAN).build()).build();
    List<FlowMirrorPoint> points = Lists.newArrayList(firstPoint, secondPoint);
    FlowMirrorPointsDumpResponse response = FlowMirrorPointsDumpResponse.builder().flowId(FLOW_ID).points(points).build();
    FlowMirrorPointsResponseV2 apiResponse = flowMapper.toFlowMirrorPointsResponseV2(response);
    assertEquals(response.getFlowId(), apiResponse.getFlowId());
    assertEquals(2, apiResponse.getPoints().size());
    FlowMirrorPointPayload firstPayload = apiResponse.getPoints().get(0);
    assertEquals(firstPoint.getMirrorPointId(), firstPayload.getMirrorPointId());
    assertEquals(firstPoint.getMirrorPointDirection(), firstPayload.getMirrorPointDirection());
    assertEquals(firstPoint.getMirrorPointSwitchId(), firstPayload.getMirrorPointSwitchId());
    assertEquals(firstPoint.getSinkEndpoint().getSwitchId(), firstPayload.getSinkEndpoint().getSwitchId());
    assertEquals(firstPoint.getSinkEndpoint().getPortNumber(), firstPayload.getSinkEndpoint().getPortNumber());
    assertEquals(firstPoint.getSinkEndpoint().getOuterVlanId(), firstPayload.getSinkEndpoint().getVlanId());
    assertEquals(firstPoint.getSinkEndpoint().getInnerVlanId(), firstPayload.getSinkEndpoint().getInnerVlanId());
    FlowMirrorPointPayload secondPayload = apiResponse.getPoints().get(1);
    assertEquals(secondPoint.getMirrorPointId(), secondPayload.getMirrorPointId());
    assertEquals(secondPoint.getMirrorPointDirection(), secondPayload.getMirrorPointDirection());
    assertEquals(secondPoint.getMirrorPointSwitchId(), secondPayload.getMirrorPointSwitchId());
    assertEquals(secondPoint.getSinkEndpoint().getSwitchId(), secondPayload.getSinkEndpoint().getSwitchId());
    assertEquals(secondPoint.getSinkEndpoint().getPortNumber(), secondPayload.getSinkEndpoint().getPortNumber());
    assertEquals(secondPoint.getSinkEndpoint().getOuterVlanId(), secondPayload.getSinkEndpoint().getVlanId());
    assertEquals(secondPoint.getSinkEndpoint().getInnerVlanId(), secondPayload.getSinkEndpoint().getInnerVlanId());
}
Also used : FlowMirrorPoint(org.openkilda.messaging.nbtopology.response.FlowMirrorPointsDumpResponse.FlowMirrorPoint) FlowMirrorPointsDumpResponse(org.openkilda.messaging.nbtopology.response.FlowMirrorPointsDumpResponse) FlowMirrorPointPayload(org.openkilda.northbound.dto.v2.flows.FlowMirrorPointPayload) FlowMirrorPointsResponseV2(org.openkilda.northbound.dto.v2.flows.FlowMirrorPointsResponseV2) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 FlowMirrorPointsDumpResponse (org.openkilda.messaging.nbtopology.response.FlowMirrorPointsDumpResponse)1 FlowMirrorPoint (org.openkilda.messaging.nbtopology.response.FlowMirrorPointsDumpResponse.FlowMirrorPoint)1 FlowMirrorPointPayload (org.openkilda.northbound.dto.v2.flows.FlowMirrorPointPayload)1 FlowMirrorPointsResponseV2 (org.openkilda.northbound.dto.v2.flows.FlowMirrorPointsResponseV2)1