use of org.openkilda.northbound.dto.v1.links.LinkMaxBandwidthDto in project open-kilda by telstra.
the class LinkServiceTest method updateMaxBandwidth.
@Test
public void updateMaxBandwidth() {
final String correlationId = "update-max-bw-corrId";
Long maxBandwidth = 1000L;
SwitchId srcSwitch = new SwitchId("ff:fe:00:00:00:00:00:01");
Integer srcPort = 8;
SwitchId dstSwitch = new SwitchId("ff:fe:00:00:00:00:00:02");
Integer dstPort = 9;
LinkMaxBandwidthRequest inputRequest = new LinkMaxBandwidthRequest();
inputRequest.setMaxBandwidth(maxBandwidth);
HashMap<String, String> requestProps = new HashMap<>();
requestProps.put(LinkProps.MAX_BANDWIDTH_PROP_NAME, String.valueOf(maxBandwidth));
org.openkilda.messaging.model.LinkPropsDto linkProps = new org.openkilda.messaging.model.LinkPropsDto(new NetworkEndpoint(srcSwitch, srcPort), new NetworkEndpoint(dstSwitch, dstPort), requestProps);
LinkPropsRequest request = new LinkPropsPut(linkProps);
LinkPropsResponse payload = new LinkPropsResponse(request, linkProps, null);
messageExchanger.mockResponse(correlationId, payload);
RequestCorrelationId.create(correlationId);
LinkMaxBandwidthDto result = linkService.updateLinkBandwidth(srcSwitch, srcPort, dstSwitch, dstPort, inputRequest).join();
assertEquals(srcSwitch.toString(), result.getSrcSwitch());
assertEquals(dstSwitch.toString(), result.getDstSwitch());
assertEquals(srcPort, result.getSrcPort());
assertEquals(dstPort, result.getDstPort());
assertEquals(maxBandwidth, result.getMaxBandwidth());
}
use of org.openkilda.northbound.dto.v1.links.LinkMaxBandwidthDto in project open-kilda by telstra.
the class LinkPropsMapper method toLinkMaxBandwidth.
/**
* Converts {@link LinkPropsDto} to {@link LinkMaxBandwidthDto}.
*/
default LinkMaxBandwidthDto toLinkMaxBandwidth(LinkPropsDto input) {
NetworkEndpoint source = input.getSource();
NetworkEndpoint dest = input.getDest();
Long maxBandwidth = Long.valueOf(input.getProps().get(LinkProps.MAX_BANDWIDTH_PROP_NAME));
return new LinkMaxBandwidthDto(source.getDatapath().toString(), source.getPortNumber(), dest.getDatapath().toString(), dest.getPortNumber(), maxBandwidth);
}
Aggregations