Search in sources :

Example 1 with InstallServer42IngressFlow

use of org.openkilda.messaging.command.flow.InstallServer42IngressFlow in project open-kilda by telstra.

the class FlowCommandFactory method buildInstallServer42IngressFlow.

/**
 * Generate install server 42 ingress flow command.
 *
 * @param flow the flow.
 * @param flowPath flow path with segments to be used for building of install rules.
 * @param outputPort the number of output port.
 * @param resources the encapsulation resources.
 * @return install server 42 ingress flow command
 */
public InstallServer42IngressFlow buildInstallServer42IngressFlow(Flow flow, FlowPath flowPath, int outputPort, int server42Port, MacAddress server42MacAddress, EncapsulationResources resources, boolean multiTable) {
    boolean isForward = flow.isForward(flowPath);
    SwitchId switchId = isForward ? flow.getSrcSwitchId() : flow.getDestSwitchId();
    SwitchId egressSwitchId = isForward ? flow.getDestSwitchId() : flow.getSrcSwitchId();
    int customerPort = isForward ? flow.getSrcPort() : flow.getDestPort();
    int inputOuterVlan = isForward ? flow.getSrcVlan() : flow.getDestVlan();
    int inputInnerVlan = isForward ? flow.getSrcInnerVlan() : flow.getDestInnerVlan();
    long cookie = new FlowSegmentCookie(flowPath.getCookie().getValue()).toBuilder().type(CookieType.SERVER_42_FLOW_RTT_INGRESS).build().getValue();
    return new InstallServer42IngressFlow(transactionIdGenerator.generate(), flow.getFlowId(), cookie, switchId, server42Port, outputPort, customerPort, inputOuterVlan, inputInnerVlan, resources.getTransitEncapsulationId(), resources.getEncapsulationType(), egressSwitchId, server42MacAddress, multiTable);
}
Also used : FlowSegmentCookie(org.openkilda.model.cookie.FlowSegmentCookie) InstallServer42IngressFlow(org.openkilda.messaging.command.flow.InstallServer42IngressFlow) SwitchId(org.openkilda.model.SwitchId) FlowEndpoint(org.openkilda.model.FlowEndpoint)

Aggregations

InstallServer42IngressFlow (org.openkilda.messaging.command.flow.InstallServer42IngressFlow)1 FlowEndpoint (org.openkilda.model.FlowEndpoint)1 SwitchId (org.openkilda.model.SwitchId)1 FlowSegmentCookie (org.openkilda.model.cookie.FlowSegmentCookie)1