use of org.openkilda.northbound.dto.v1.switches.LogicalPortsValidationDto in project open-kilda by telstra.
the class JsonSerializationTest method switchValidateResultTest.
@Test
public void switchValidateResultTest() throws IOException {
RulesValidationDto rules = new RulesValidationDto(singletonList(0L), singletonList(1L), singletonList(2L), singletonList(3L));
MetersValidationDto meters = new MetersValidationDto(emptyList(), emptyList(), emptyList(), emptyList());
GroupsValidationDto groups = new GroupsValidationDto(emptyList(), emptyList(), emptyList(), emptyList());
LogicalPortsValidationDto logicalPorts = new LogicalPortsValidationDto(emptyList(), emptyList(), emptyList(), emptyList());
SwitchValidationResult dto = new SwitchValidationResult(rules, meters, groups, logicalPorts);
assertEquals(dto, pass(dto, SwitchValidationResult.class));
}
use of org.openkilda.northbound.dto.v1.switches.LogicalPortsValidationDto in project open-kilda by telstra.
the class SwitchMapperTest method testToLogicalPortsValidationDto.
@Test
public void testToLogicalPortsValidationDto() {
LogicalPortInfoEntry missing = LogicalPortInfoEntry.builder().logicalPortNumber(LOGICAL_PORT_NUMBER_1).type(LAG).physicalPorts(newArrayList(PHYSICAL_PORT_1, PHYSICAL_PORT_2)).build();
LogicalPortInfoEntry excess = LogicalPortInfoEntry.builder().logicalPortNumber(LOGICAL_PORT_NUMBER_2).type(LAG).physicalPorts(newArrayList(PHYSICAL_PORT_3)).build();
LogicalPortInfoEntry misconfigured = LogicalPortInfoEntry.builder().logicalPortNumber(LOGICAL_PORT_NUMBER_3).type(BFD).physicalPorts(newArrayList(PHYSICAL_PORT_4)).actual(new LogicalPortMisconfiguredInfoEntry(BFD, newArrayList(PHYSICAL_PORT_4))).expected(new LogicalPortMisconfiguredInfoEntry(LAG, newArrayList(PHYSICAL_PORT_4, PHYSICAL_PORT_5))).build();
LogicalPortInfoEntry proper = LogicalPortInfoEntry.builder().logicalPortNumber(LOGICAL_PORT_NUMBER_4).type(LAG).physicalPorts(newArrayList(PHYSICAL_PORT_6)).build();
LogicalPortsValidationEntry validationEntry = LogicalPortsValidationEntry.builder().missing(newArrayList(missing)).misconfigured(newArrayList(misconfigured)).proper(newArrayList(proper)).excess(newArrayList(excess)).build();
LogicalPortsValidationDto validationDto = switchMapper.toLogicalPortsValidationDto(validationEntry);
assertEquals(1, validationDto.getProper().size());
assertEquals(1, validationDto.getMissing().size());
assertEquals(1, validationDto.getMisconfigured().size());
assertEquals(1, validationDto.getExcess().size());
assertEqualsLogicalPortInfoDto(validationDto.getMissing().get(0), LOGICAL_PORT_NUMBER_1, LAG.toString(), PHYSICAL_PORT_1, PHYSICAL_PORT_2);
assertEqualsLogicalPortInfoDto(validationDto.getExcess().get(0), LOGICAL_PORT_NUMBER_2, LAG.toString(), PHYSICAL_PORT_3);
assertEqualsLogicalPortInfoDto(validationDto.getMisconfigured().get(0), LOGICAL_PORT_NUMBER_3, BFD.toString(), PHYSICAL_PORT_4);
assertEqualsLogicalPortInfoDto(validationDto.getProper().get(0), LOGICAL_PORT_NUMBER_4, LAG.toString(), PHYSICAL_PORT_6);
assertEquals(BFD.toString(), validationDto.getMisconfigured().get(0).getActual().getType());
assertEquals(newArrayList(PHYSICAL_PORT_4), validationDto.getMisconfigured().get(0).getActual().getPhysicalPorts());
assertEquals(LAG.toString(), validationDto.getMisconfigured().get(0).getExpected().getType());
assertEquals(newArrayList(PHYSICAL_PORT_4, PHYSICAL_PORT_5), validationDto.getMisconfigured().get(0).getExpected().getPhysicalPorts());
}
Aggregations