Search in sources :

Example 1 with Field

use of org.openkilda.rulemanager.Field 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();
}
Also used : MeterAction(org.openkilda.rulemanager.action.MeterAction) Arrays(java.util.Arrays) MeterFlag(org.openkilda.rulemanager.MeterFlag) GroupType(org.openkilda.rulemanager.group.GroupType) OfMetadata(org.openkilda.rulemanager.OfMetadata) Sets.newHashSet(com.google.common.collect.Sets.newHashSet) RuleManagerHelper.sortCommandsByDependencies(org.openkilda.rulemanager.utils.RuleManagerHelper.sortCommandsByDependencies) WatchGroup(org.openkilda.rulemanager.group.WatchGroup) Instructions(org.openkilda.rulemanager.Instructions) Set(java.util.Set) SpeakerData(org.openkilda.rulemanager.SpeakerData) UUID(java.util.UUID) Collectors(java.util.stream.Collectors) Sets(com.google.common.collect.Sets) MacAddress(org.openkilda.model.MacAddress) OfFlowFlag(org.openkilda.rulemanager.OfFlowFlag) List(java.util.List) Lists.newArrayList(com.google.common.collect.Lists.newArrayList) GroupAction(org.openkilda.rulemanager.action.GroupAction) CopyFieldAction(org.openkilda.rulemanager.action.noviflow.CopyFieldAction) RuleManagerHelper.checkCircularDependencies(org.openkilda.rulemanager.utils.RuleManagerHelper.checkCircularDependencies) SetFieldAction(org.openkilda.rulemanager.action.SetFieldAction) IPv4Address(org.openkilda.model.IPv4Address) FieldMatch(org.openkilda.rulemanager.match.FieldMatch) Action(org.openkilda.rulemanager.action.Action) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) PushVxlanAction(org.openkilda.rulemanager.action.PushVxlanAction) RuleManagerHelper.removeDuplicateCommands(org.openkilda.rulemanager.utils.RuleManagerHelper.removeDuplicateCommands) PopVxlanAction(org.openkilda.rulemanager.action.PopVxlanAction) Cookie(org.openkilda.model.cookie.Cookie) PushVlanAction(org.openkilda.rulemanager.action.PushVlanAction) PopVlanAction(org.openkilda.rulemanager.action.PopVlanAction) PortNumber(org.openkilda.rulemanager.ProtoConstants.PortNumber) ActionType(org.openkilda.rulemanager.action.ActionType) OpenFlowOxms(org.openkilda.rulemanager.action.noviflow.OpenFlowOxms) MeterSpeakerData(org.openkilda.rulemanager.MeterSpeakerData) OfVersion(org.openkilda.rulemanager.OfVersion) WatchPort(org.openkilda.rulemanager.group.WatchPort) Assert.assertTrue(org.junit.Assert.assertTrue) Test(org.junit.Test) FlowSpeakerData(org.openkilda.rulemanager.FlowSpeakerData) MeterId(org.openkilda.model.MeterId) Bucket(org.openkilda.rulemanager.group.Bucket) SwitchId(org.openkilda.model.SwitchId) GroupSpeakerData(org.openkilda.rulemanager.GroupSpeakerData) OfTable(org.openkilda.rulemanager.OfTable) GroupId(org.openkilda.model.GroupId) Assert.assertEquals(org.junit.Assert.assertEquals) Field(org.openkilda.rulemanager.Field) PortOutAction(org.openkilda.rulemanager.action.PortOutAction) OfMetadata(org.openkilda.rulemanager.OfMetadata) Cookie(org.openkilda.model.cookie.Cookie) MeterAction(org.openkilda.rulemanager.action.MeterAction) GroupAction(org.openkilda.rulemanager.action.GroupAction) CopyFieldAction(org.openkilda.rulemanager.action.noviflow.CopyFieldAction) SetFieldAction(org.openkilda.rulemanager.action.SetFieldAction) Action(org.openkilda.rulemanager.action.Action) PushVxlanAction(org.openkilda.rulemanager.action.PushVxlanAction) PopVxlanAction(org.openkilda.rulemanager.action.PopVxlanAction) PushVlanAction(org.openkilda.rulemanager.action.PushVlanAction) PopVlanAction(org.openkilda.rulemanager.action.PopVlanAction) PortOutAction(org.openkilda.rulemanager.action.PortOutAction) FieldMatch(org.openkilda.rulemanager.match.FieldMatch) OfFlowFlag(org.openkilda.rulemanager.OfFlowFlag) Lists.newArrayList(com.google.common.collect.Lists.newArrayList) ArrayList(java.util.ArrayList) Instructions(org.openkilda.rulemanager.Instructions)

Aggregations

Lists.newArrayList (com.google.common.collect.Lists.newArrayList)1 Sets (com.google.common.collect.Sets)1 Sets.newHashSet (com.google.common.collect.Sets.newHashSet)1 ArrayList (java.util.ArrayList)1 Arrays (java.util.Arrays)1 HashSet (java.util.HashSet)1 List (java.util.List)1 Set (java.util.Set)1 UUID (java.util.UUID)1 Collectors (java.util.stream.Collectors)1 Assert.assertEquals (org.junit.Assert.assertEquals)1 Assert.assertTrue (org.junit.Assert.assertTrue)1 Test (org.junit.Test)1 GroupId (org.openkilda.model.GroupId)1 IPv4Address (org.openkilda.model.IPv4Address)1 MacAddress (org.openkilda.model.MacAddress)1 MeterId (org.openkilda.model.MeterId)1 SwitchId (org.openkilda.model.SwitchId)1 Cookie (org.openkilda.model.cookie.Cookie)1 Field (org.openkilda.rulemanager.Field)1