Search in sources :

Example 1 with LinkUnderMaintenanceDto

use of org.openkilda.northbound.dto.v1.links.LinkUnderMaintenanceDto in project open-kilda by telstra.

the class LinkServiceTest method testLinkUnderMaintenance.

@Test
public void testLinkUnderMaintenance() {
    String correlationId = "links-list";
    SwitchId switchId = new SwitchId(1L);
    boolean underMaintenance = true;
    boolean evacuate = false;
    IslInfoData islInfoData = new IslInfoData(new PathNode(switchId, 1, 0), new PathNode(switchId, 2, 1), IslChangeType.DISCOVERED, true);
    messageExchanger.mockChunkedResponse(correlationId, Collections.singletonList(islInfoData));
    RequestCorrelationId.create(correlationId);
    LinkUnderMaintenanceDto linkUnderMaintenanceDto = new LinkUnderMaintenanceDto(islInfoData.getSource().getSwitchId().toString(), islInfoData.getSource().getPortNo(), islInfoData.getDestination().getSwitchId().toString(), islInfoData.getDestination().getPortNo(), underMaintenance, evacuate);
    List<LinkDto> result = linkService.updateLinkUnderMaintenance(linkUnderMaintenanceDto).join();
    assertFalse("List of link shouldn't be empty", result.isEmpty());
    LinkDto link = result.get(0);
    assertThat(link.isUnderMaintenance(), is(true));
    assertThat(link.getState(), is(LinkStatus.DISCOVERED));
    assertFalse(link.getPath().isEmpty());
    PathDto path = link.getPath().get(0);
    assertThat(path.getSwitchId(), is(switchId.toString()));
    assertThat(path.getPortNo(), is(1));
}
Also used : PathDto(org.openkilda.northbound.dto.v1.links.PathDto) LinkDto(org.openkilda.northbound.dto.v1.links.LinkDto) SwitchId(org.openkilda.model.SwitchId) IslInfoData(org.openkilda.messaging.info.event.IslInfoData) PathNode(org.openkilda.messaging.info.event.PathNode) LinkUnderMaintenanceDto(org.openkilda.northbound.dto.v1.links.LinkUnderMaintenanceDto) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 IslInfoData (org.openkilda.messaging.info.event.IslInfoData)1 PathNode (org.openkilda.messaging.info.event.PathNode)1 SwitchId (org.openkilda.model.SwitchId)1 LinkDto (org.openkilda.northbound.dto.v1.links.LinkDto)1 LinkUnderMaintenanceDto (org.openkilda.northbound.dto.v1.links.LinkUnderMaintenanceDto)1 PathDto (org.openkilda.northbound.dto.v1.links.PathDto)1