use of org.openkilda.model.FlowPathDirection in project open-kilda by telstra.
the class SpeakerFlowSegmentRequestBuilder method makeLoopRequests.
private List<FlowSegmentRequestFactory> makeLoopRequests(CommandContext context, FlowPath path, FlowTransitEncapsulation encapsulation, FlowSideAdapter ingressSide, FlowSideAdapter egressSide, PathSegment segment) {
List<FlowSegmentRequestFactory> result = new ArrayList<>(2);
PathSegmentSide segmentSide = makePathSegmentSourceSide(segment);
UUID commandId = commandIdGenerator.generate();
MessageContext messageContext = new MessageContext(commandId.toString(), context.getCorrelationId());
FlowSegmentCookie cookie = path.getCookie().toBuilder().looped(true).build();
result.add(IngressFlowLoopSegmentRequestFactory.builder().messageContext(messageContext).metadata(makeMetadata(path.getFlow().getFlowId(), cookie, segmentSide.isMultiTable())).endpoint(ingressSide.getEndpoint()).build());
FlowPathDirection reverse = cookie.getDirection() == FlowPathDirection.FORWARD ? FlowPathDirection.REVERSE : FlowPathDirection.FORWARD;
Cookie transitCookie = path.getCookie().toBuilder().looped(true).direction(reverse).build();
result.add(TransitFlowLoopSegmentRequestFactory.builder().messageContext(messageContext).switchId(segment.getSrcSwitch().getSwitchId()).egressSwitchId(egressSide.getEndpoint().getSwitchId()).metadata(makeMetadata(path.getFlow().getFlowId(), transitCookie, segmentSide.isMultiTable())).port(segment.getSrcPort()).encapsulation(encapsulation).build());
return result;
}
use of org.openkilda.model.FlowPathDirection in project open-kilda by telstra.
the class MeterStatsHandler method handleFlowStats.
private void handleFlowStats(TagsFormatter tags, FlowSegmentCookie cookie, String flowId) {
tags.addFlowIdTag(flowId);
tags.addCookieTag(cookie);
FlowPathDirection direction = null;
if (cookie != null) {
direction = cookie.getDirection();
if (direction == null) {
log.warn("Unable to extract flow direction from cookie {} while processing stats of {}", cookie, flowId);
}
}
tags.addDirectionTag(direction);
emitFlowMeterPoints(tags);
}
Aggregations