Search in sources :

Example 1 with WatchGroup

use of org.openkilda.rulemanager.group.WatchGroup in project open-kilda by telstra.

the class Utils method buildMirrorBuckets.

/**
 * Builds group buckets for flow mirror points (only for sink endpoints. Flow bucket must be build separately).
 */
public static List<Bucket> buildMirrorBuckets(FlowMirrorPoints flowMirrorPoints) {
    List<Bucket> buckets = new ArrayList<>();
    Set<MirrorConfigData> mirrorConfigDataSet = flowMirrorPoints.getMirrorPaths().stream().map(mirrorPath -> new MirrorConfigData(mirrorPath.getEgressPort(), mirrorPath.getEgressOuterVlan())).collect(Collectors.toSet());
    for (MirrorConfigData mirrorConfig : mirrorConfigDataSet) {
        Set<Action> actions = new HashSet<>(makeVlanReplaceActions(new ArrayList<>(), makeVlanStack(mirrorConfig.getMirrorVlan())));
        actions.add(new PortOutAction(new PortNumber(mirrorConfig.getMirrorPort())));
        buckets.add(Bucket.builder().writeActions(actions).watchGroup(WatchGroup.ANY).watchPort(WatchPort.ANY).build());
    }
    return buckets;
}
Also used : VXLAN_SRC_IPV4_ADDRESS(org.openkilda.rulemanager.Constants.VXLAN_SRC_IPV4_ADDRESS) FlowPath(org.openkilda.model.FlowPath) SwitchFeature(org.openkilda.model.SwitchFeature) FieldMatch(org.openkilda.rulemanager.match.FieldMatch) Action(org.openkilda.rulemanager.action.Action) SpecialPortType(org.openkilda.rulemanager.ProtoConstants.PortNumber.SpecialPortType) KILDA_OVS_PUSH_POP_MATCH_VXLAN(org.openkilda.model.SwitchFeature.KILDA_OVS_PUSH_POP_MATCH_VXLAN) OfMetadata(org.openkilda.rulemanager.OfMetadata) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) PushVxlanAction(org.openkilda.rulemanager.action.PushVxlanAction) VXLAN_DST_IPV4_ADDRESS(org.openkilda.rulemanager.Constants.VXLAN_DST_IPV4_ADDRESS) Flow(org.openkilda.model.Flow) FlowEndpoint.makeVlanStack(org.openkilda.model.FlowEndpoint.makeVlanStack) PushVlanAction(org.openkilda.rulemanager.action.PushVlanAction) Sets.newHashSet(com.google.common.collect.Sets.newHashSet) PopVlanAction(org.openkilda.rulemanager.action.PopVlanAction) PortNumber(org.openkilda.rulemanager.ProtoConstants.PortNumber) ActionType(org.openkilda.rulemanager.action.ActionType) FlowSideAdapter(org.openkilda.adapter.FlowSideAdapter) WatchGroup(org.openkilda.rulemanager.group.WatchGroup) FlowEndpoint(org.openkilda.model.FlowEndpoint) Iterator(java.util.Iterator) FlowMirrorPoints(org.openkilda.model.FlowMirrorPoints) WatchPort(org.openkilda.rulemanager.group.WatchPort) Set(java.util.Set) SpeakerData(org.openkilda.rulemanager.SpeakerData) NOVIFLOW_PUSH_POP_VXLAN(org.openkilda.model.SwitchFeature.NOVIFLOW_PUSH_POP_VXLAN) Collectors(java.util.stream.Collectors) String.format(java.lang.String.format) Bucket(org.openkilda.rulemanager.group.Bucket) MacAddress(org.openkilda.model.MacAddress) List(java.util.List) FlowEndpoint.isVlanIdSet(org.openkilda.model.FlowEndpoint.isVlanIdSet) SwitchId(org.openkilda.model.SwitchId) MirrorConfigData(org.openkilda.model.MirrorConfig.MirrorConfigData) Optional(java.util.Optional) Field(org.openkilda.rulemanager.Field) PortOutAction(org.openkilda.rulemanager.action.PortOutAction) SetFieldAction(org.openkilda.rulemanager.action.SetFieldAction) Action(org.openkilda.rulemanager.action.Action) PushVxlanAction(org.openkilda.rulemanager.action.PushVxlanAction) PushVlanAction(org.openkilda.rulemanager.action.PushVlanAction) PopVlanAction(org.openkilda.rulemanager.action.PopVlanAction) PortOutAction(org.openkilda.rulemanager.action.PortOutAction) SetFieldAction(org.openkilda.rulemanager.action.SetFieldAction) Bucket(org.openkilda.rulemanager.group.Bucket) PortOutAction(org.openkilda.rulemanager.action.PortOutAction) ArrayList(java.util.ArrayList) MirrorConfigData(org.openkilda.model.MirrorConfig.MirrorConfigData) PortNumber(org.openkilda.rulemanager.ProtoConstants.PortNumber) HashSet(java.util.HashSet) Sets.newHashSet(com.google.common.collect.Sets.newHashSet)

Example 2 with WatchGroup

use of org.openkilda.rulemanager.group.WatchGroup in project open-kilda by telstra.

the class OfGroupConverter method fromOfBucket.

private Bucket fromOfBucket(OFBucket ofBucket) {
    WatchGroup watchGroup = fromOfGroup(ofBucket.getWatchGroup());
    WatchPort watchPort = fromOfPort(ofBucket.getWatchPort());
    Set<Action> actions = new HashSet<>();
    for (OFAction ofAction : ofBucket.getActions()) {
        actions.add(OfInstructionsConverter.INSTANCE.convertToRuleManagerAction(ofAction));
    }
    return Bucket.builder().watchGroup(watchGroup).watchPort(watchPort).writeActions(actions).build();
}
Also used : Action(org.openkilda.rulemanager.action.Action) OFAction(org.projectfloodlight.openflow.protocol.action.OFAction) WatchPort(org.openkilda.rulemanager.group.WatchPort) OFAction(org.projectfloodlight.openflow.protocol.action.OFAction) WatchGroup(org.openkilda.rulemanager.group.WatchGroup) HashSet(java.util.HashSet)

Aggregations

HashSet (java.util.HashSet)2 Action (org.openkilda.rulemanager.action.Action)2 WatchGroup (org.openkilda.rulemanager.group.WatchGroup)2 WatchPort (org.openkilda.rulemanager.group.WatchPort)2 Sets.newHashSet (com.google.common.collect.Sets.newHashSet)1 String.format (java.lang.String.format)1 ArrayList (java.util.ArrayList)1 Iterator (java.util.Iterator)1 List (java.util.List)1 Optional (java.util.Optional)1 Set (java.util.Set)1 Collectors (java.util.stream.Collectors)1 FlowSideAdapter (org.openkilda.adapter.FlowSideAdapter)1 Flow (org.openkilda.model.Flow)1 FlowEndpoint (org.openkilda.model.FlowEndpoint)1 FlowEndpoint.isVlanIdSet (org.openkilda.model.FlowEndpoint.isVlanIdSet)1 FlowEndpoint.makeVlanStack (org.openkilda.model.FlowEndpoint.makeVlanStack)1 FlowMirrorPoints (org.openkilda.model.FlowMirrorPoints)1 FlowPath (org.openkilda.model.FlowPath)1 MacAddress (org.openkilda.model.MacAddress)1