use of org.openkilda.model.SwitchFeature in project open-kilda by telstra.
the class TransitIslVxlanRuleGenerator 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 = buildTransitIslVxlanRuleMatch();
Instructions instructions = Instructions.builder().goToTable(OfTable.TRANSIT).build();
return Collections.singletonList(FlowSpeakerData.builder().switchId(sw.getSwitchId()).ofVersion(OfVersion.of(sw.getOfVersion())).cookie(new PortColourCookie(CookieType.MULTI_TABLE_ISL_VXLAN_TRANSIT_RULES, islPort)).table(OfTable.INPUT).priority(ISL_TRANSIT_VXLAN_RULE_PRIORITY_MULTITABLE).match(match).instructions(instructions).build());
}
use of org.openkilda.model.SwitchFeature in project open-kilda by telstra.
the class PktpsFlagFeature method discover.
@Override
public Optional<SwitchFeature> discover(IOFSwitch sw) {
Optional<SwitchFeature> empty = Optional.empty();
SwitchDescription description = sw.getSwitchDescription();
if (description.getHardwareDescription() == null) {
return empty;
}
if (containsIgnoreCase(description.getManufacturerDescription(), CENTEC_MANUFACTURED)) {
return empty;
}
if (E_SWITCH_MANUFACTURER_DESCRIPTION.equalsIgnoreCase(description.getManufacturerDescription()) || E_SWITCH_HARDWARE_DESCRIPTION_REGEX.matcher(description.getHardwareDescription()).matches() || NOVIFLOW_VIRTUAL_SWITCH_HARDWARE_DESCRIPTION_REGEX.matcher(description.getHardwareDescription()).matches()) {
// burst size). That is why we will assume that E switches don't support PKTPS flag.
return empty;
}
return Optional.of(SwitchFeature.PKTPS_FLAG);
}
use of org.openkilda.model.SwitchFeature in project open-kilda by telstra.
the class BfdFeature method discover.
@Override
public Optional<SwitchFeature> discover(IOFSwitch sw) {
Optional<SwitchFeature> empty = Optional.empty();
SwitchDescription description = sw.getSwitchDescription();
if (description == null || description.getSoftwareDescription() == null) {
return empty;
}
if (!NOVIFLOW_SOFTWARE_DESCRIPTION_REGEX.matcher(description.getSoftwareDescription()).matches()) {
return empty;
}
return Optional.of(SwitchFeature.BFD);
}
use of org.openkilda.model.SwitchFeature in project open-kilda by telstra.
the class Server42FlowRttOutputVxlanRuleGenerator 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();
}
List<Action> actions = new ArrayList<>();
actions.add(buildPopVxlanAction(features));
if (server42Vlan > 0) {
actions.add(new PushVlanAction());
actions.add(SetFieldAction.builder().field(Field.VLAN_VID).value(server42Vlan).build());
}
actions.add(SetFieldAction.builder().field(Field.ETH_SRC).value(sw.getSwitchId().toLong()).build());
actions.add(SetFieldAction.builder().field(Field.ETH_DST).value(server42MacAddress.toLong()).build());
actions.add(SetFieldAction.builder().field(Field.UDP_SRC).value(SERVER_42_FLOW_RTT_REVERSE_UDP_PORT).build());
if (sw.getFeatures().contains(NOVIFLOW_COPY_FIELD)) {
// NOTE: We must call copy field action after all set field actions. All set actions called after copy field
// actions will be ignored. It's Noviflow bug.
actions.add(buildCopyTimestamp());
}
actions.add(new PortOutAction(new PortNumber(server42Port)));
Instructions instructions = Instructions.builder().applyActions(actions).build();
return Collections.singletonList(FlowSpeakerData.builder().switchId(sw.getSwitchId()).ofVersion(OfVersion.of(sw.getOfVersion())).cookie(new Cookie(SERVER_42_FLOW_RTT_OUTPUT_VXLAN_COOKIE)).table(OfTable.INPUT).priority(SERVER_42_FLOW_RTT_OUTPUT_VXLAN_PRIORITY).match(buildMatch(sw.getSwitchId())).instructions(instructions).build());
}
use of org.openkilda.model.SwitchFeature in project open-kilda by telstra.
the class Server42FlowRttVxlanTurningRuleGenerator 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());
match.add(FieldMatch.builder().field(Field.UDP_DST).value(VXLAN_UDP_DST).build());
Instructions instructions = buildInstructions(sw, SERVER_42_FLOW_RTT_REVERSE_UDP_VXLAN_PORT);
return Collections.singletonList(FlowSpeakerData.builder().switchId(sw.getSwitchId()).ofVersion(OfVersion.of(sw.getOfVersion())).cookie(new Cookie(SERVER_42_FLOW_RTT_VXLAN_TURNING_COOKIE)).table(OfTable.INPUT).priority(SERVER_42_FLOW_RTT_VXLAN_TURNING_PRIORITY).match(match).instructions(instructions).build());
}
Aggregations