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