use of org.openkilda.northbound.dto.v1.links.PathDto in project open-kilda by telstra.
the class JsonSerializationTest method linksDtoTest.
@Test
public void linksDtoTest() throws IOException {
LinkDto dto = new LinkDto(-1, 1, 0, 0, 0, LinkStatus.DISCOVERED, LinkStatus.DISCOVERED, LinkStatus.FAILED, 0, false, false, "bfd-session-status", singletonList(new PathDto(SWITCH_ID, 1, 0, 10L)));
assertEquals(dto, pass(dto, LinkDto.class));
}
use of org.openkilda.northbound.dto.v1.links.PathDto in project open-kilda by telstra.
the class JsonSerializationTest method pathDtoTest.
@Test
public void pathDtoTest() throws IOException {
PathDto dto = new PathDto(SWITCH_ID, 1, 0, 10L);
assertEquals(dto, pass(dto, PathDto.class));
}
use of org.openkilda.northbound.dto.v1.links.PathDto in project open-kilda by telstra.
the class LinkServiceTest method shouldGetLinksList.
@Test
public void shouldGetLinksList() {
String correlationId = "links-list";
SwitchId switchId = new SwitchId(1L);
IslInfoData islInfoData = new IslInfoData(new PathNode(switchId, 1, 0), new PathNode(switchId, 2, 1), IslChangeType.DISCOVERED, false);
messageExchanger.mockChunkedResponse(correlationId, Collections.singletonList(islInfoData));
RequestCorrelationId.create(correlationId);
List<LinkDto> result = linkService.getLinks(islInfoData.getSource().getSwitchId(), islInfoData.getSource().getPortNo(), islInfoData.getDestination().getSwitchId(), islInfoData.getDestination().getPortNo()).join();
assertFalse("List of link shouldn't be empty", result.isEmpty());
LinkDto link = result.get(0);
assertThat(link.getSpeed(), is(0L));
assertThat(link.getMaxBandwidth(), is(0L));
assertThat(link.getAvailableBandwidth(), is(0L));
assertThat(link.getCost(), is(0));
assertThat(link.isUnderMaintenance(), is(false));
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));
path = link.getPath().get(1);
assertThat(path.getSwitchId(), is(switchId.toString()));
assertThat(path.getPortNo(), is(2));
}
use of org.openkilda.northbound.dto.v1.links.PathDto 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