use of org.openkilda.messaging.payload.flow.FlowPathPayload in project open-kilda by telstra.
the class FlowSteps method verifyFlowPath.
@And("^(.*) flow's path equals to '(.*)'$")
public void verifyFlowPath(String flowAlias, String pathAlias) {
FlowPayload flow = topologyUnderTest.getAliasedObject(flowAlias);
FlowPathPayload expectedPath = topologyUnderTest.getAliasedObject(pathAlias);
FlowPathPayload actualPath = northboundService.getFlowPath(flow.getId());
assertThat(actualPath, equalTo(expectedPath));
}
use of org.openkilda.messaging.payload.flow.FlowPathPayload in project open-kilda by telstra.
the class FlowServiceImpl method buildFlowPathPayload.
private FlowPathPayload buildFlowPathPayload(List<FlowPathDto> paths, String flowId) {
FlowPathDto askedPathDto = paths.stream().filter(e -> e.getId().equals(flowId)).findAny().orElseThrow(() -> new IllegalStateException(format("Path for flow %s is not found.", flowId)));
// fill primary flow path
FlowPathPayload payload = new FlowPathPayload();
payload.setId(askedPathDto.getId());
payload.setForwardPath(askedPathDto.getForwardPath());
payload.setReversePath(askedPathDto.getReversePath());
if (askedPathDto.getProtectedPath() != null) {
FlowProtectedPathDto protectedPath = askedPathDto.getProtectedPath();
payload.setProtectedPath(FlowProtectedPath.builder().forwardPath(protectedPath.getForwardPath()).reversePath(protectedPath.getReversePath()).build());
}
// fill group paths
if (paths.size() > 1) {
payload.setDiverseGroupPayload(DiverseGroupPayload.builder().overlappingSegments(askedPathDto.getSegmentsStats()).otherFlows(mapGroupPaths(paths, flowId, FlowPathDto::isPrimaryPathCorrespondStat)).build());
if (askedPathDto.getProtectedPath() != null) {
payload.setDiverseGroupProtectedPayload(DiverseGroupPayload.builder().overlappingSegments(askedPathDto.getProtectedPath().getSegmentsStats()).otherFlows(mapGroupPaths(paths, flowId, e -> !e.isPrimaryPathCorrespondStat())).build());
}
}
return payload;
}
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