Search in sources :

Example 1 with LinkPropsMask

use of org.openkilda.messaging.model.LinkPropsMask in project open-kilda by telstra.

the class LinkPropsMapper method toLinkPropsMask.

/**
 * Converts {@link org.openkilda.northbound.dto.v1.links.LinkPropsDto} into {@link LinkPropsMask}.
 */
default LinkPropsMask toLinkPropsMask(org.openkilda.northbound.dto.v1.links.LinkPropsDto input) {
    NetworkEndpointMask source = new NetworkEndpointMask(new SwitchId(input.getSrcSwitch()), input.getSrcPort());
    NetworkEndpointMask dest = new NetworkEndpointMask(new SwitchId(input.getDstSwitch()), input.getDstPort());
    return new LinkPropsMask(source, dest);
}
Also used : NetworkEndpointMask(org.openkilda.messaging.model.NetworkEndpointMask) SwitchId(org.openkilda.model.SwitchId) LinkPropsMask(org.openkilda.messaging.model.LinkPropsMask)

Example 2 with LinkPropsMask

use of org.openkilda.messaging.model.LinkPropsMask in project open-kilda by telstra.

the class LinkServiceTest method dropLinkProps.

@Test
public void dropLinkProps() {
    final String correlationId = getClass().getCanonicalName();
    LinkPropsDto input = new LinkPropsDto("ff:fe:00:00:00:00:00:01", 8, "ff:fe:00:00:00:00:00:05", null, null);
    LinkPropsDrop request = new LinkPropsDrop(new LinkPropsMask(new NetworkEndpointMask(new SwitchId(input.getSrcSwitch()), input.getSrcPort()), new NetworkEndpointMask(new SwitchId(input.getDstSwitch()), input.getDstPort())));
    org.openkilda.messaging.model.LinkPropsDto linkProps = new org.openkilda.messaging.model.LinkPropsDto(new NetworkEndpoint(new SwitchId(input.getSrcSwitch()), input.getSrcPort()), new NetworkEndpoint(new SwitchId("ff:fe:00:00:00:00:00:02"), 9), new HashMap<>());
    LinkPropsResponse payload = new LinkPropsResponse(request, linkProps, null);
    String requestIdBatch = idFactory.produceChained(String.valueOf(requestIdIndex++), correlationId);
    messageExchanger.mockChunkedResponse(requestIdBatch, Collections.singletonList(payload));
    RequestCorrelationId.create(correlationId);
    BatchResults result = linkService.delLinkProps(Collections.singletonList(input)).join();
    assertThat(result.getFailures(), is(0));
    assertThat(result.getSuccesses(), is(1));
    assertTrue(result.getMessages().isEmpty());
}
Also used : NetworkEndpoint(org.openkilda.messaging.model.NetworkEndpoint) LinkPropsDto(org.openkilda.northbound.dto.v1.links.LinkPropsDto) SwitchId(org.openkilda.model.SwitchId) LinkPropsMask(org.openkilda.messaging.model.LinkPropsMask) BatchResults(org.openkilda.northbound.dto.BatchResults) LinkPropsDrop(org.openkilda.messaging.nbtopology.request.LinkPropsDrop) NetworkEndpointMask(org.openkilda.messaging.model.NetworkEndpointMask) LinkPropsResponse(org.openkilda.messaging.nbtopology.response.LinkPropsResponse) Test(org.junit.Test)

Aggregations

LinkPropsMask (org.openkilda.messaging.model.LinkPropsMask)2 NetworkEndpointMask (org.openkilda.messaging.model.NetworkEndpointMask)2 SwitchId (org.openkilda.model.SwitchId)2 Test (org.junit.Test)1 NetworkEndpoint (org.openkilda.messaging.model.NetworkEndpoint)1 LinkPropsDrop (org.openkilda.messaging.nbtopology.request.LinkPropsDrop)1 LinkPropsResponse (org.openkilda.messaging.nbtopology.response.LinkPropsResponse)1 BatchResults (org.openkilda.northbound.dto.BatchResults)1 LinkPropsDto (org.openkilda.northbound.dto.v1.links.LinkPropsDto)1