use of org.openkilda.messaging.model.FlowPairDto in project open-kilda by telstra.
the class FlowMapperTest method testFlowPairToDto.
@Test
public void testFlowPairToDto() {
PathInfoData pathInfoData = new PathInfoData();
pathInfoData.setLatency(1L);
pathInfoData.setPath(asList(new PathNode(SRC_SWITCH_ID, 1, 1, 1L, 1L), new PathNode(DST_SWITCH_ID, 2, 2, 2L, 2L)));
FlowDto forwardFlow = new FlowDto();
forwardFlow.setSourceSwitch(SRC_SWITCH_ID);
forwardFlow.setDestinationSwitch(DST_SWITCH_ID);
forwardFlow.setFlowId("12");
forwardFlow.setCookie(11);
forwardFlow.setSourcePort(113);
forwardFlow.setSourceVlan(1112);
forwardFlow.setDestinationPort(113);
forwardFlow.setDestinationVlan(1112);
forwardFlow.setBandwidth(23);
forwardFlow.setDescription("SOME FLOW");
forwardFlow.setLastUpdated("2011-12-03T10:15:30Z");
forwardFlow.setTransitEncapsulationId(87);
forwardFlow.setMeterId(65);
forwardFlow.setIgnoreBandwidth(true);
forwardFlow.setPeriodicPings(true);
forwardFlow.setEncapsulationType(FlowEncapsulationType.TRANSIT_VLAN);
forwardFlow.setDetectConnectedDevices(new DetectConnectedDevicesDto(false, true, true, false, false, false, true, true));
PathInfoData reversePathInfoData = new PathInfoData();
reversePathInfoData.setLatency(1L);
reversePathInfoData.setPath(asList(new PathNode(DST_SWITCH_ID, 2, 2, 2L, 2L), new PathNode(SRC_SWITCH_ID, 1, 1, 1L, 1L)));
FlowDto reverseFlow = new FlowDto();
reverseFlow.setSourceSwitch(forwardFlow.getDestinationSwitch());
reverseFlow.setDestinationSwitch(SRC_SWITCH_ID);
reverseFlow.setFlowId("12");
reverseFlow.setCookie(12);
reverseFlow.setSourcePort(113);
reverseFlow.setSourceVlan(1112);
reverseFlow.setDestinationPort(113);
reverseFlow.setDestinationVlan(1112);
reverseFlow.setBandwidth(23);
reverseFlow.setDescription("SOME FLOW");
reverseFlow.setLastUpdated("2011-12-03T10:15:30Z");
reverseFlow.setTransitEncapsulationId(88);
reverseFlow.setMeterId(66);
reverseFlow.setIgnoreBandwidth(true);
reverseFlow.setPeriodicPings(true);
reverseFlow.setEncapsulationType(FlowEncapsulationType.TRANSIT_VLAN);
reverseFlow.setDetectConnectedDevices(new DetectConnectedDevicesDto(true, false, false, true, false, false, true, true));
FlowPairDto<FlowDto, FlowDto> pair = new FlowPairDto<>(forwardFlow, reverseFlow);
Flow p = FlowMapper.INSTANCE.map(pair, () -> KildaConfiguration.DEFAULTS);
assertEquals(p.getFlowId(), pair.getLeft().getFlowId());
assertDetectConnectedDevices(forwardFlow.getDetectConnectedDevices(), p.getDetectConnectedDevices());
}
Aggregations