use of org.openkilda.rulemanager.OfVersion in project open-kilda by telstra.
the class RuleManagerHelperTest method buildFullFlowSpeakerCommandData.
private FlowSpeakerData buildFullFlowSpeakerCommandData(MeterId goToMeterId, UUID dependsOnUuid) {
Set<FieldMatch> match = Arrays.stream(Field.values()).map(f -> FieldMatch.builder().field(f).value(f.ordinal()).mask(f.ordinal() + 1L).build()).collect(Collectors.toSet());
Set<OfFlowFlag> flags = Sets.newHashSet(OfFlowFlag.values());
List<Action> applyActions = new ArrayList<>(buildAllActions());
applyActions.addAll(buildAllActions());
Instructions instructions = Instructions.builder().goToMeter(goToMeterId).goToTable(OfTable.INPUT).writeMetadata(new OfMetadata(15, 0xff)).writeActions(new HashSet<>(buildAllActions())).applyActions(applyActions).build();
return FlowSpeakerData.builder().uuid(UUID.randomUUID()).cookie(new Cookie(123)).priority(PRIORITY).table(OfTable.INPUT).match(match).instructions(instructions).flags(flags).switchId(SWITCH_ID).ofVersion(OfVersion.OF_13).dependsOn(dependsOnUuid == null ? newArrayList() : newArrayList(dependsOnUuid)).build();
}
use of org.openkilda.rulemanager.OfVersion in project open-kilda by telstra.
the class DropDiscoveryLoopRuleGenerator method generateCommands.
@Override
public List<SpeakerData> generateCommands(Switch sw) {
OfVersion ofVersion = OfVersion.of(sw.getOfVersion());
if (ofVersion == OF_12) {
return Collections.emptyList();
}
long ethDst = new SwitchId(config.getDiscoveryBcastPacketDst()).toLong();
Set<FieldMatch> match = Sets.newHashSet(FieldMatch.builder().field(Field.ETH_DST).value(ethDst).build(), FieldMatch.builder().field(Field.ETH_SRC).value(sw.getSwitchId().toLong()).build());
return Collections.singletonList(FlowSpeakerData.builder().switchId(sw.getSwitchId()).ofVersion(ofVersion).cookie(new Cookie(DROP_VERIFICATION_LOOP_RULE_COOKIE)).table(OfTable.INPUT).priority(DROP_DISCOVERY_LOOP_RULE_PRIORITY).match(match).instructions(Instructions.builder().build()).build());
}
use of org.openkilda.rulemanager.OfVersion in project open-kilda by telstra.
the class TableDefaultRuleGenerator method generateCommands.
@Override
public List<SpeakerData> generateCommands(Switch sw) {
OfVersion ofVersion = OfVersion.of(sw.getOfVersion());
SpeakerData command = FlowSpeakerData.builder().switchId(sw.getSwitchId()).ofVersion(ofVersion).cookie(cookie).table(ofTable).priority(Priority.MINIMAL_POSITIVE_PRIORITY).instructions(Instructions.builder().build()).build();
return Collections.singletonList(command);
}
Aggregations