use of org.openkilda.messaging.payload.flow.FlowPathPayload in project open-kilda by telstra.
the class NorthboundRunTest method checkFlowPath.
@Then("^path of flow (.*) could be read$")
public void checkFlowPath(final String flowId) {
String flowName = FlowUtils.getFlowName(flowId);
FlowPathPayload payload = FlowUtils.getFlowPath(flowName);
assertNotNull(payload);
assertEquals(flowName, payload.getId());
assertEquals(expectedFlowPath, payload.getPath());
}
use of org.openkilda.messaging.payload.flow.FlowPathPayload in project open-kilda by telstra.
the class FlowController method pathFlow.
/**
* Gets flow path.
*
* @param flowId flow id
* @param correlationId correlation ID header value
* @return list of flow
*/
@ApiOperation(value = "Gets flow path", response = FlowPathPayload.class)
@ApiResponses(value = { @ApiResponse(code = 200, response = FlowPathPayload.class, message = "Operation is successful"), @ApiResponse(code = 400, response = MessageError.class, message = "Invalid input data"), @ApiResponse(code = 401, response = MessageError.class, message = "Unauthorized"), @ApiResponse(code = 403, response = MessageError.class, message = "Forbidden"), @ApiResponse(code = 404, response = MessageError.class, message = "Not found"), @ApiResponse(code = 500, response = MessageError.class, message = "General error"), @ApiResponse(code = 503, response = MessageError.class, message = "Service unavailable") })
@RequestMapping(value = "/flows/path/{flow-id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public ResponseEntity<FlowPathPayload> pathFlow(@PathVariable(name = "flow-id") String flowId, @RequestHeader(value = CORRELATION_ID, defaultValue = DEFAULT_CORRELATION_ID) String correlationId) {
logger.debug("Flow path: {}={}, {}={}", CORRELATION_ID, correlationId, FLOW_ID, flowId);
FlowPathPayload response = flowService.pathFlow(flowId, correlationId);
return new ResponseEntity<>(response, new HttpHeaders(), HttpStatus.OK);
}
use of org.openkilda.messaging.payload.flow.FlowPathPayload in project open-kilda by telstra.
the class FlowControllerTest method pathFlow.
@Test
@WithMockUser(username = USERNAME, password = PASSWORD, roles = ROLE)
public void pathFlow() throws Exception {
MvcResult result = mockMvc.perform(get("/flows/path/{flow-id}", TestMessageMock.FLOW_ID).header(CORRELATION_ID, testCorrelationId()).contentType(APPLICATION_JSON_VALUE)).andExpect(status().isOk()).andExpect(content().contentType(APPLICATION_JSON_UTF8_VALUE)).andReturn();
FlowPathPayload response = MAPPER.readValue(result.getResponse().getContentAsString(), FlowPathPayload.class);
assertEquals(TestMessageMock.flowPath, response);
}
use of org.openkilda.messaging.payload.flow.FlowPathPayload in project open-kilda by telstra.
the class FlowFFRTest method flowPathIsShortest.
@When("^flow (.+) path is shortest$")
public void flowPathIsShortest(String flowId) throws Throwable {
String flowName = FlowUtils.getFlowName(flowId);
FlowPathPayload payload = getFlowPath(flowName, FlowPathTest.expectedShortestPath.getLeft());
assertNotNull(payload);
assertEquals(flowName, payload.getId());
assertEquals(FlowPathTest.expectedShortestPath.getLeft(), payload.getPath());
}
Aggregations