Search in sources :

Example 1 with FlowMirrorPointPayload

use of org.openkilda.northbound.dto.v2.flows.FlowMirrorPointPayload 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)

Example 2 with FlowMirrorPointPayload

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

the class FlowMapperTest method testFlowMirrorPointCreatePayloadToFlowMirrorPointCreateRequest.

@Test
public void testFlowMirrorPointCreatePayloadToFlowMirrorPointCreateRequest() {
    FlowMirrorPointPayload payload = FlowMirrorPointPayload.builder().mirrorPointId(MIRROR_POINT_ID_A).mirrorPointDirection(MIRROR_POINT_DIRECTION_A).mirrorPointSwitchId(SRC_SWITCH_ID).sinkEndpoint(new FlowEndpointV2(DST_SWITCH_ID, DST_PORT, DST_VLAN, DST_INNER_VLAN)).build();
    FlowMirrorPointCreateRequest request = flowMapper.toFlowMirrorPointCreateRequest(FLOW_ID, payload);
    assertEquals(FLOW_ID, request.getFlowId());
    assertEquals(payload.getMirrorPointId(), request.getMirrorPointId());
    assertEquals(payload.getMirrorPointDirection(), request.getMirrorPointDirection().toString().toLowerCase());
    assertEquals(payload.getMirrorPointSwitchId(), request.getMirrorPointSwitchId());
    assertEquals(payload.getSinkEndpoint().getSwitchId(), request.getSinkEndpoint().getSwitchId());
    assertEquals(payload.getSinkEndpoint().getPortNumber(), request.getSinkEndpoint().getPortNumber());
    assertEquals(payload.getSinkEndpoint().getVlanId(), request.getSinkEndpoint().getOuterVlanId());
    assertEquals(payload.getSinkEndpoint().getInnerVlanId(), request.getSinkEndpoint().getInnerVlanId());
}
Also used : FlowEndpointV2(org.openkilda.northbound.dto.v2.flows.FlowEndpointV2) FlowMirrorPointPayload(org.openkilda.northbound.dto.v2.flows.FlowMirrorPointPayload) FlowMirrorPointCreateRequest(org.openkilda.messaging.command.flow.FlowMirrorPointCreateRequest) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 FlowMirrorPointPayload (org.openkilda.northbound.dto.v2.flows.FlowMirrorPointPayload)2 FlowMirrorPointCreateRequest (org.openkilda.messaging.command.flow.FlowMirrorPointCreateRequest)1 FlowMirrorPointsDumpResponse (org.openkilda.messaging.nbtopology.response.FlowMirrorPointsDumpResponse)1 FlowMirrorPoint (org.openkilda.messaging.nbtopology.response.FlowMirrorPointsDumpResponse.FlowMirrorPoint)1 FlowEndpointV2 (org.openkilda.northbound.dto.v2.flows.FlowEndpointV2)1 FlowMirrorPointsResponseV2 (org.openkilda.northbound.dto.v2.flows.FlowMirrorPointsResponseV2)1