use of org.openkilda.northbound.dto.BatchResults 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());
}
use of org.openkilda.northbound.dto.BatchResults in project open-kilda by telstra.
the class LinkServiceTest method putLinkProps.
@Test
public void putLinkProps() {
final String correlationId = getClass().getCanonicalName();
HashMap<String, String> requestProps = new HashMap<>();
requestProps.put("test", "value");
org.openkilda.messaging.model.LinkPropsDto linkProps = new org.openkilda.messaging.model.LinkPropsDto(new NetworkEndpoint(new SwitchId("ff:fe:00:00:00:00:00:01"), 8), new NetworkEndpoint(new SwitchId("ff:fe:00:00:00:00:00:02"), 9), requestProps);
LinkPropsRequest request = new LinkPropsPut(linkProps);
LinkPropsResponse payload = new LinkPropsResponse(request, linkProps, null);
String subCorrelationId = idFactory.produceChained(String.valueOf(requestIdIndex++), correlationId);
messageExchanger.mockResponse(subCorrelationId, payload);
LinkPropsDto inputItem = new LinkPropsDto(linkProps.getSource().getDatapath().toString(), linkProps.getSource().getPortNumber(), linkProps.getDest().getDatapath().toString(), linkProps.getDest().getPortNumber(), requestProps);
RequestCorrelationId.create(correlationId);
BatchResults result = linkService.setLinkProps(Collections.singletonList(inputItem)).join();
assertThat(result.getFailures(), is(0));
assertThat(result.getSuccesses(), is(1));
assertTrue(result.getMessages().isEmpty());
}
Aggregations