Search in sources :

Example 1 with LinkPropsData

use of org.openkilda.messaging.nbtopology.response.LinkPropsData in project open-kilda by telstra.

the class LinkServiceTest method shouldGetPropsList.

@Test
public void shouldGetPropsList() {
    final String correlationId = "non-empty-link-props";
    org.openkilda.messaging.model.LinkPropsDto linkProps = new org.openkilda.messaging.model.LinkPropsDto(new NetworkEndpoint(new SwitchId("00:00:00:00:00:00:00:01"), 1), new NetworkEndpoint(new SwitchId("00:00:00:00:00:00:00:02"), 2), Collections.singletonMap("cost", "2"));
    LinkPropsData linkPropsData = new LinkPropsData(linkProps);
    messageExchanger.mockChunkedResponse(correlationId, Collections.singletonList(linkPropsData));
    RequestCorrelationId.create(correlationId);
    List<LinkPropsDto> result = linkService.getLinkProps(null, 0, null, 0).join();
    assertFalse("List of link props shouldn't be empty", result.isEmpty());
    LinkPropsDto dto = result.get(0);
    assertThat(dto.getSrcSwitch(), is(linkPropsData.getLinkProps().getSource().getDatapath().toString()));
    assertThat(dto.getSrcPort(), is(linkPropsData.getLinkProps().getSource().getPortNumber()));
    assertThat(dto.getDstSwitch(), is(linkPropsData.getLinkProps().getDest().getDatapath().toString()));
    assertThat(dto.getDstPort(), is(linkPropsData.getLinkProps().getDest().getPortNumber()));
}
Also used : NetworkEndpoint(org.openkilda.messaging.model.NetworkEndpoint) LinkPropsDto(org.openkilda.northbound.dto.v1.links.LinkPropsDto) LinkPropsData(org.openkilda.messaging.nbtopology.response.LinkPropsData) SwitchId(org.openkilda.model.SwitchId) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 NetworkEndpoint (org.openkilda.messaging.model.NetworkEndpoint)1 LinkPropsData (org.openkilda.messaging.nbtopology.response.LinkPropsData)1 SwitchId (org.openkilda.model.SwitchId)1 LinkPropsDto (org.openkilda.northbound.dto.v1.links.LinkPropsDto)1