Search in sources :

Example 1 with FlowPathDirection

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;
}
Also used : Cookie(org.openkilda.model.cookie.Cookie) FlowSegmentCookie(org.openkilda.model.cookie.FlowSegmentCookie) IngressMirrorFlowSegmentRequestFactory(org.openkilda.floodlight.api.request.factory.IngressMirrorFlowSegmentRequestFactory) IngressFlowSegmentRequestFactory(org.openkilda.floodlight.api.request.factory.IngressFlowSegmentRequestFactory) EgressMirrorFlowSegmentRequestFactory(org.openkilda.floodlight.api.request.factory.EgressMirrorFlowSegmentRequestFactory) EgressFlowSegmentRequestFactory(org.openkilda.floodlight.api.request.factory.EgressFlowSegmentRequestFactory) TransitFlowSegmentRequestFactory(org.openkilda.floodlight.api.request.factory.TransitFlowSegmentRequestFactory) FlowSegmentRequestFactory(org.openkilda.floodlight.api.request.factory.FlowSegmentRequestFactory) FlowSegmentCookie(org.openkilda.model.cookie.FlowSegmentCookie) ArrayList(java.util.ArrayList) MessageContext(org.openkilda.messaging.MessageContext) UUID(java.util.UUID) FlowPathDirection(org.openkilda.model.FlowPathDirection)

Example 2 with FlowPathDirection

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);
}
Also used : FlowPathDirection(org.openkilda.model.FlowPathDirection)

Aggregations

FlowPathDirection (org.openkilda.model.FlowPathDirection)2 ArrayList (java.util.ArrayList)1 UUID (java.util.UUID)1 EgressFlowSegmentRequestFactory (org.openkilda.floodlight.api.request.factory.EgressFlowSegmentRequestFactory)1 EgressMirrorFlowSegmentRequestFactory (org.openkilda.floodlight.api.request.factory.EgressMirrorFlowSegmentRequestFactory)1 FlowSegmentRequestFactory (org.openkilda.floodlight.api.request.factory.FlowSegmentRequestFactory)1 IngressFlowSegmentRequestFactory (org.openkilda.floodlight.api.request.factory.IngressFlowSegmentRequestFactory)1 IngressMirrorFlowSegmentRequestFactory (org.openkilda.floodlight.api.request.factory.IngressMirrorFlowSegmentRequestFactory)1 TransitFlowSegmentRequestFactory (org.openkilda.floodlight.api.request.factory.TransitFlowSegmentRequestFactory)1 MessageContext (org.openkilda.messaging.MessageContext)1 Cookie (org.openkilda.model.cookie.Cookie)1 FlowSegmentCookie (org.openkilda.model.cookie.FlowSegmentCookie)1