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