use of org.openkilda.model.FlowEndpoint in project open-kilda by telstra.
the class FlowCommandFactory method buildInstallTransitLoopFlow.
/**
* Generate install transit flow loop command.
*
* @param flowPath flow path with segments to be used for building of install rules.
* @param inputPortNo the number of input port.
* @param encapsulationResources the encapsulation resources.
* @param multiTable use multi table.
* @return install egress flow command
*/
public InstallEgressFlow buildInstallTransitLoopFlow(Flow flow, FlowPath flowPath, int inputPortNo, EncapsulationResources encapsulationResources, boolean multiTable) {
FlowEndpoint ingressEndpoint = FlowSideAdapter.makeIngressAdapter(flow, flowPath).getEndpoint();
FlowEndpoint egressEndpoint = FlowSideAdapter.makeEgressAdapter(flow, flowPath).getEndpoint();
return new InstallTransitLoopFlow(transactionIdGenerator.generate(), flow.getFlowId(), flowPath.getCookie().toBuilder().looped(true).build().getValue(), egressEndpoint.getSwitchId(), inputPortNo, egressEndpoint.getPortNumber(), encapsulationResources.getTransitEncapsulationId(), encapsulationResources.getEncapsulationType(), egressEndpoint.getOuterVlanId(), egressEndpoint.getInnerVlanId(), getOutputVlanType(flow, flowPath), multiTable, ingressEndpoint, null);
}
use of org.openkilda.model.FlowEndpoint in project open-kilda by telstra.
the class FlowCommandFactory method makeOneSwitchMirrorRule.
/**
* Generate install one switch mirror flow command.
*
* @param flow the flow.
* @param flowPath flow path with segments to be used for building of install rules.
* @return install one switch flow command
*/
public InstallOneSwitchMirrorFlow makeOneSwitchMirrorRule(Flow flow, FlowPath flowPath, MirrorConfig mirrorConfig) {
boolean enableLldp = needToInstallOrRemoveLldpFlow(flowPath);
boolean enableArp = needToInstallOrRemoveArpFlow(flowPath);
boolean multiTable = flowPath.isSrcWithMultiTable();
FlowEndpoint ingressEndpoint = FlowSideAdapter.makeIngressAdapter(flow, flowPath).getEndpoint();
FlowEndpoint egressEndpoint = FlowSideAdapter.makeEgressAdapter(flow, flowPath).getEndpoint();
Long meterId = Optional.ofNullable(flowPath.getMeterId()).map(MeterId::getValue).orElse(null);
return new InstallOneSwitchMirrorFlow(transactionIdGenerator.generate(), flow.getFlowId(), flowPath.getCookie().toBuilder().mirror(true).build().getValue(), ingressEndpoint.getSwitchId(), ingressEndpoint.getPortNumber(), egressEndpoint.getPortNumber(), ingressEndpoint.getOuterVlanId(), ingressEndpoint.getInnerVlanId(), egressEndpoint.getOuterVlanId(), egressEndpoint.getInnerVlanId(), getOutputVlanType(flow, flowPath), flow.getBandwidth(), meterId, multiTable, enableLldp, enableArp, mirrorConfig);
}
use of org.openkilda.model.FlowEndpoint in project open-kilda by telstra.
the class FlowCommandFactory method buildInstallIngressFlow.
/**
* Generate install ingress flow command.
*
* @param flow the flow.
* @param flowPath flow path with segments to be used for building of install rules.
* @param outputPortNo the number of output port.
* @param encapsulationResources the encapsulation resources.
* @param multiTable \
* @return install ingress flow command
*/
public InstallIngressFlow buildInstallIngressFlow(Flow flow, FlowPath flowPath, int outputPortNo, EncapsulationResources encapsulationResources, boolean multiTable) {
boolean enableLldp = needToInstallOrRemoveLldpFlow(flowPath);
boolean enableArp = needToInstallOrRemoveArpFlow(flowPath);
Long meterId = Optional.ofNullable(flowPath.getMeterId()).map(MeterId::getValue).orElse(null);
FlowEndpoint ingressEndpoint = FlowSideAdapter.makeIngressAdapter(flow, flowPath).getEndpoint();
FlowEndpoint egressEndpoint = FlowSideAdapter.makeEgressAdapter(flow, flowPath).getEndpoint();
return new InstallIngressFlow(transactionIdGenerator.generate(), flow.getFlowId(), flowPath.getCookie().getValue(), ingressEndpoint.getSwitchId(), ingressEndpoint.getPortNumber(), outputPortNo, ingressEndpoint.getOuterVlanId(), ingressEndpoint.getInnerVlanId(), encapsulationResources.getTransitEncapsulationId(), encapsulationResources.getEncapsulationType(), getOutputVlanType(flow, flowPath), flow.getBandwidth(), meterId, egressEndpoint.getSwitchId(), multiTable, enableLldp, enableArp, null);
}
use of org.openkilda.model.FlowEndpoint in project open-kilda by telstra.
the class RecordHandler method makeFlowSegmentWrappedCommand.
private FlowSegmentWrapperCommand makeFlowSegmentWrappedCommand(InstallEgressFlow request, MessageContext messageContext, FlowSegmentResponseFactory responseFactory) {
FlowEndpoint endpoint = new FlowEndpoint(request.getSwitchId(), request.getOutputPort(), request.getOutputVlanId(), request.getOutputInnerVlanId());
EgressFlowSegmentInstallCommand command = new EgressFlowSegmentInstallCommand(messageContext, EMPTY_COMMAND_ID, makeSegmentMetadata(request), endpoint, request.getIngressEndpoint(), request.getInputPort(), makeTransitEncapsulation(request), request.getMirrorConfig());
return new FlowSegmentWrapperCommand(command, responseFactory);
}
use of org.openkilda.model.FlowEndpoint in project open-kilda by telstra.
the class RecordHandler method makeFlowSegmentWrappedCommand.
private FlowSegmentWrapperCommand makeFlowSegmentWrappedCommand(InstallOneSwitchFlow request, MessageContext messageContext, FlowSegmentResponseFactory responseFactory) {
FlowEndpoint endpoint = new FlowEndpoint(request.getSwitchId(), request.getInputPort(), request.getInputVlanId(), request.getInputInnerVlanId(), request.isEnableLldp(), request.isEnableArp());
FlowEndpoint egressEndpoint = new FlowEndpoint(request.getSwitchId(), request.getOutputPort(), request.getOutputVlanId(), request.getOutputInnerVlanId());
MeterConfig meterConfig = makeMeterConfig(request.getMeterId(), request.getBandwidth());
OneSwitchFlowInstallCommand command = new OneSwitchFlowInstallCommand(messageContext, EMPTY_COMMAND_ID, makeSegmentMetadata(request), endpoint, meterConfig, egressEndpoint, new RulesContext(), request.getMirrorConfig());
return new FlowSegmentWrapperCommand(command, responseFactory);
}
Aggregations