use of org.openkilda.model.FlowEndpoint in project open-kilda by telstra.
the class SingleTableServer42IngressRuleGenerator method buildServer42IngressCommand.
private FlowSpeakerData buildServer42IngressCommand(Switch sw, FlowEndpoint ingressEndpoint) {
int priority = isVlanIdSet(ingressEndpoint.getOuterVlanId()) ? SERVER_42_INGRESS_SINGLE_VLAN_FLOW_PRIORITY : SERVER_42_INGRESS_DEFAULT_FLOW_PRIORITY;
FlowSegmentCookie cookie = new FlowSegmentCookie(flowPath.getCookie().getValue()).toBuilder().type(CookieType.SERVER_42_FLOW_RTT_INGRESS).build();
FlowSpeakerDataBuilder<?, ?> builder = FlowSpeakerData.builder().switchId(ingressEndpoint.getSwitchId()).ofVersion(OfVersion.of(sw.getOfVersion())).cookie(cookie).table(OfTable.INPUT).priority(priority).match(buildMatch(ingressEndpoint)).instructions(buildIngressInstructions(sw, ingressEndpoint.getOuterVlanId()));
if (sw.getFeatures().contains(SwitchFeature.RESET_COUNTS_FLAG)) {
builder.flags(Sets.newHashSet(OfFlowFlag.RESET_COUNTERS));
}
return builder.build();
}
use of org.openkilda.model.FlowEndpoint in project open-kilda by telstra.
the class SingleTableIngressYRuleGenerator method generateCommands.
@Override
public List<SpeakerData> generateCommands(Switch sw) {
if (flow.isOneSwitchFlow()) {
throw new IllegalStateException("Y-Flow rules can't be created for one switch flow");
}
List<SpeakerData> result = new ArrayList<>();
FlowEndpoint ingressEndpoint = FlowSideAdapter.makeIngressAdapter(flow, flowPath).getEndpoint();
FlowSpeakerData command = buildFlowIngressCommand(sw, ingressEndpoint);
if (command == null) {
return Collections.emptyList();
}
result.add(command);
if (generateMeterCommand) {
SpeakerData meterCommand = buildMeter(externalMeterCommandUuid, flowPath, config, sharedMeterId, sw);
if (meterCommand != null) {
result.add(meterCommand);
command.getDependsOn().add(externalMeterCommandUuid);
}
} else if (sw.getFeatures().contains(METERS) && sharedMeterId != null) {
command.getDependsOn().add(externalMeterCommandUuid);
}
return result;
}
use of org.openkilda.model.FlowEndpoint in project open-kilda by telstra.
the class FlowLoopIngressRuleGenerator method buildIngressLoopCommand.
private SpeakerData buildIngressLoopCommand(Switch sw) {
FlowEndpoint ingressEndpoint = checkAndBuildIngressEndpoint(flow, flowPath, sw.getSwitchId());
FlowSpeakerDataBuilder<?, ?> builder = FlowSpeakerData.builder().switchId(sw.getSwitchId()).ofVersion(OfVersion.of(sw.getOfVersion())).cookie(flowPath.getCookie().toBuilder().looped(true).build()).table(multiTable ? OfTable.INGRESS : OfTable.INPUT).priority(getPriority(ingressEndpoint)).match(makeIngressMatch(ingressEndpoint, multiTable, sw.getFeatures())).instructions(makeIngressFlowLoopInstructions(ingressEndpoint));
// todo add RESET_COUNTERS flag
return builder.build();
}
use of org.openkilda.model.FlowEndpoint in project open-kilda by telstra.
the class MultiTableIngressRuleGenerator method generateCommands.
@Override
public List<SpeakerData> generateCommands(Switch sw) {
List<SpeakerData> result = new ArrayList<>();
FlowEndpoint ingressEndpoint = checkAndBuildIngressEndpoint(flow, flowPath, sw.getSwitchId());
FlowSpeakerData command = buildFlowIngressCommand(sw, ingressEndpoint);
if (command == null) {
return Collections.emptyList();
}
result.add(command);
if (needToBuildFlowPreIngressRule(ingressEndpoint)) {
result.add(buildFlowPreIngressCommand(sw, ingressEndpoint));
}
if (overlappingIngressAdapters.isEmpty()) {
result.add(buildCustomerPortSharedCatchCommand(sw, ingressEndpoint));
}
SpeakerData meterCommand = buildMeter(flowPath, config, flowPath.getMeterId(), sw);
if (meterCommand != null) {
result.add(meterCommand);
command.getDependsOn().add(meterCommand.getUuid());
}
return result;
}
use of org.openkilda.model.FlowEndpoint in project open-kilda by telstra.
the class RuleManagerImpl method getOverlappingMultiTableIngressAdapters.
private Set<FlowSideAdapter> getOverlappingMultiTableIngressAdapters(FlowPath path, DataAdapter adapter) {
FlowEndpoint endpoint = makeIngressAdapter(adapter.getFlow(path.getPathId()), path).getEndpoint();
Set<FlowSideAdapter> result = new HashSet<>();
if (!path.isSrcWithMultiTable()) {
// we do not care about overlapping for single table paths
return result;
}
for (FlowPath overlappingPath : adapter.getFlowPaths().values()) {
if (overlappingPath.isSrcWithMultiTable() && path.getSrcSwitchId().equals(overlappingPath.getSrcSwitchId())) {
Flow overlappingFlow = adapter.getFlow(overlappingPath.getPathId());
FlowSideAdapter flowAdapter = makeIngressAdapter(overlappingFlow, overlappingPath);
if (endpoint.getPortNumber().equals(flowAdapter.getEndpoint().getPortNumber())) {
result.add(flowAdapter);
}
}
}
return result;
}
Aggregations