use of org.openkilda.model.SwitchFeature in project open-kilda by telstra.
the class EgressIslVxlanRuleGenerator method generateCommands.
@Override
public List<SpeakerData> generateCommands(Switch sw) {
Set<SwitchFeature> features = sw.getFeatures();
if (!(features.contains(NOVIFLOW_PUSH_POP_VXLAN) || features.contains(KILDA_OVS_PUSH_POP_MATCH_VXLAN))) {
return Collections.emptyList();
}
Set<FieldMatch> match = buildEgressIslVxlanRuleMatch(sw.getSwitchId());
Instructions instructions = Instructions.builder().goToTable(OfTable.EGRESS).build();
return Collections.singletonList(FlowSpeakerData.builder().switchId(sw.getSwitchId()).ofVersion(OfVersion.of(sw.getOfVersion())).cookie(new PortColourCookie(CookieType.MULTI_TABLE_ISL_VXLAN_EGRESS_RULES, islPort)).table(OfTable.INPUT).priority(ISL_EGRESS_VXLAN_RULE_PRIORITY_MULTITABLE).match(match).instructions(instructions).build());
}
use of org.openkilda.model.SwitchFeature in project open-kilda by telstra.
the class Server42FlowRttTurningRuleGenerator method generateCommands.
@Override
public List<SpeakerData> generateCommands(Switch sw) {
Set<SwitchFeature> features = sw.getFeatures();
if (!features.contains(NOVIFLOW_SWAP_ETH_SRC_ETH_DST) && !features.contains(KILDA_OVS_SWAP_FIELD)) {
return Collections.emptyList();
}
Set<FieldMatch> match = buildMatch(sw.getSwitchId());
Instructions instructions = buildInstructions(sw, SERVER_42_FLOW_RTT_REVERSE_UDP_PORT);
return Collections.singletonList(FlowSpeakerData.builder().switchId(sw.getSwitchId()).ofVersion(OfVersion.of(sw.getOfVersion())).cookie(new Cookie(SERVER_42_FLOW_RTT_TURNING_COOKIE)).table(OfTable.INPUT).priority(SERVER_42_FLOW_RTT_TURNING_PRIORITY).match(match).instructions(instructions).build());
}
use of org.openkilda.model.SwitchFeature in project open-kilda by telstra.
the class SwitchManager method getExpectedIslFlowsForPort.
@Override
public List<OFFlowMod> getExpectedIslFlowsForPort(DatapathId dpid, int port) throws SwitchOperationException {
List<OFFlowMod> flows = new ArrayList<>();
IOFSwitch sw = lookupSwitch(dpid);
OFFactory ofFactory = sw.getOFFactory();
Set<SwitchFeature> features = featureDetectorService.detectSwitch(sw);
if (features.contains(NOVIFLOW_PUSH_POP_VXLAN) || features.contains(KILDA_OVS_PUSH_POP_MATCH_VXLAN)) {
flows.add(buildEgressIslVxlanRule(ofFactory, dpid, port));
flows.add(buildTransitIslVxlanRule(ofFactory, port));
}
flows.add(buildEgressIslVlanRule(ofFactory, port));
return flows;
}
use of org.openkilda.model.SwitchFeature in project open-kilda by telstra.
the class NetworkIntegrationTest method switchAdd.
@Test
@Ignore
public void switchAdd() {
Set<SwitchFeature> features = new HashSet<>();
features.add(SwitchFeature.BFD);
Integer bfdLocalPortOffset = options.getBfdLogicalPortOffset();
List<SpeakerSwitchPortView> ports = ImmutableList.of(new SpeakerSwitchPortView(1, SpeakerSwitchPortView.State.UP), new SpeakerSwitchPortView(1 + bfdLocalPortOffset, SpeakerSwitchPortView.State.UP), new SpeakerSwitchPortView(2, SpeakerSwitchPortView.State.DOWN), new SpeakerSwitchPortView(2 + bfdLocalPortOffset, SpeakerSwitchPortView.State.DOWN));
SpeakerSwitchView speakerSwitchView = new SpeakerSwitchView(alphaDatapath, new IpSocketAddress(alphaInetAddress.getHostString(), alphaInetAddress.getPort()), new IpSocketAddress(speakerInetAddress.getHostString(), speakerInetAddress.getPort()), alphaInetAddress.getHostString(), "OF_13", switchDescription, features, ports);
NetworkSwitchService switchService = integrationCarrier.getSwitchService();
SwitchInfoData switchAddEvent = new SwitchInfoData(alphaDatapath, SwitchChangeType.ADDED, alphaInetAddress.toString(), alphaDescription, speakerInetAddress.toString(), false, speakerSwitchView);
switchService.switchEvent(switchAddEvent);
SwitchInfoData switchActivateEvent = new SwitchInfoData(alphaDatapath, SwitchChangeType.ACTIVATED, alphaInetAddress.toString(), alphaDescription, speakerInetAddress.toString(), false, speakerSwitchView);
switchService.switchEvent(switchActivateEvent);
}
use of org.openkilda.model.SwitchFeature in project open-kilda by telstra.
the class LagPortOperationService method createTransaction.
private LagLogicalPort createTransaction(SwitchId switchId, Set<Integer> targetPorts) {
// locate switch first to produce correct error if switch is missing
Switch sw = querySwitch(switchId);
if (!isSwitchLagCapable(sw)) {
throw new InvalidDataException(format("Switch %s doesn't support LAG.", sw.getSwitchId()));
}
Set<SwitchFeature> features = sw.getFeatures();
for (Integer portNumber : targetPorts) {
validatePhysicalPort(switchId, features, portNumber);
}
ensureNoLagCollisions(switchId, targetPorts);
LagLogicalPort port = queryPoolManager(switchId).allocate();
port.setPhysicalPorts(targetPorts.stream().map(portNumber -> new PhysicalPort(switchId, portNumber, port)).collect(Collectors.toList()));
log.info("Adding new LAG logical port entry into DB: {}", port);
lagLogicalPortRepository.add(port);
return port;
}
Aggregations