Search in sources :

Example 1 with LogicalPortsValidationEntry

use of org.openkilda.messaging.info.switches.LogicalPortsValidationEntry 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());
}
Also used : LogicalPortInfoEntry(org.openkilda.messaging.info.switches.LogicalPortInfoEntry) LogicalPortMisconfiguredInfoEntry(org.openkilda.messaging.info.switches.LogicalPortMisconfiguredInfoEntry) LogicalPortsValidationDto(org.openkilda.northbound.dto.v1.switches.LogicalPortsValidationDto) LogicalPortsValidationEntry(org.openkilda.messaging.info.switches.LogicalPortsValidationEntry) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 LogicalPortInfoEntry (org.openkilda.messaging.info.switches.LogicalPortInfoEntry)1 LogicalPortMisconfiguredInfoEntry (org.openkilda.messaging.info.switches.LogicalPortMisconfiguredInfoEntry)1 LogicalPortsValidationEntry (org.openkilda.messaging.info.switches.LogicalPortsValidationEntry)1 LogicalPortsValidationDto (org.openkilda.northbound.dto.v1.switches.LogicalPortsValidationDto)1