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());
}
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());
}
Aggregations