use of org.openkilda.northbound.dto.v2.flows.FlowLoopResponse in project open-kilda by telstra.
the class NorthboundServiceV2Impl method getFlowLoop.
@Override
public List<FlowLoopResponse> getFlowLoop(String flowId, SwitchId switchId) {
UriComponentsBuilder uriBuilder = UriComponentsBuilder.fromUriString("/api/v2/flows/loops");
if (flowId != null) {
uriBuilder.queryParam("flow_id", flowId);
}
if (switchId != null) {
uriBuilder.queryParam("switch_id", switchId);
}
FlowLoopResponse[] flowLoopResponse = restTemplate.exchange(uriBuilder.build().toString(), HttpMethod.GET, new HttpEntity(buildHeadersWithCorrelationId()), FlowLoopResponse[].class).getBody();
return Arrays.asList(flowLoopResponse);
}
use of org.openkilda.northbound.dto.v2.flows.FlowLoopResponse in project open-kilda by telstra.
the class FlowServiceTest method createFlowLoop.
@Test
public void createFlowLoop() throws Exception {
String correlationId = "correlation-id";
RequestCorrelationId.create(correlationId);
String flowId = "flow-id";
SwitchId switchId = new SwitchId("1");
FlowDto dto = FlowDto.builder().flowId(flowId).loopSwitchId(switchId).build();
FlowResponse response = new FlowResponse(dto);
messageExchanger.mockResponse(correlationId, response);
FlowLoopResponse result = flowService.createFlowLoop(flowId, switchId).get();
assertEquals(flowId, result.getFlowId());
assertEquals(switchId, result.getSwitchId());
}
Aggregations