Class Ofdpa2GroupHandler
- java.lang.Object
-
- org.onosproject.driver.pipeline.ofdpa.Ofdpa2GroupHandler
-
- Direct Known Subclasses:
Ofdpa3GroupHandler,OvsOfdpaGroupHandler
public class Ofdpa2GroupHandler extends java.lang.ObjectGroup handler that emulates Broadcom OF-DPA TTP.
-
-
Field Summary
Fields Modifier and Type Field Description protected org.onosproject.net.DeviceIddeviceIdprotected org.onosproject.net.flowobjective.FlowObjectiveStoreflowObjectiveStoreprotected org.onosproject.net.group.GroupServicegroupServiceprotected org.slf4j.Loggerlogprotected java.util.concurrent.ConcurrentHashMap<java.lang.Integer,java.util.Set<org.onosproject.net.flowobjective.NextObjective>>pendingBucketsprotected org.onosproject.store.service.StorageServicestorageService
-
Constructor Summary
Constructors Constructor Description Ofdpa2GroupHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddBucketToGroup(org.onosproject.net.flowobjective.NextObjective nextObjective, org.onosproject.net.behaviour.NextGroup next)Adds a bucket to the top level group of a group-chain, and creates the chain.protected voidaddGroup(org.onosproject.net.flowobjective.NextObjective nextObjective)Adds a list of group chain by given NextObjective.protected voidaddPendingRemoveNextObjective(org.onosproject.net.flowobjective.NextObjective nextObjective, java.util.List<org.onosproject.net.group.GroupKey> groupKeys)protected voidaddPendingUpdateNextObjective(org.onosproject.net.group.GroupKey groupKey, org.onosproject.net.flowobjective.NextObjective nextObjective)protected voidcreateEcmpHashBucketChains(org.onosproject.net.flowobjective.NextObjective nextObj, java.util.List<java.util.Deque<org.onosproject.net.group.GroupKey>> allGroupKeys, java.util.List<OfdpaGroupHandlerUtility.GroupInfo> unsentGroups)Creates group chains for all buckets in a hashed group, and stores the GroupInfos and GroupKeys for all the groups in the lists passed in, which should be empty.protected OfdpaGroupHandlerUtility.GroupInfocreateL2L3Chain(org.onosproject.net.flow.TrafficTreatment treatment, int nextId, org.onosproject.core.ApplicationId appId, boolean mpls, org.onosproject.net.flow.TrafficSelector meta)Creates one of two possible group-chains from the treatment passed in.protected OfdpaGroupHandlerUtility.GroupInfocreateL2L3ChainInternal(org.onosproject.net.flow.TrafficTreatment treatment, int nextId, org.onosproject.core.ApplicationId appId, boolean mpls, org.onosproject.net.flow.TrafficSelector meta, boolean useSetVlanExtension)Internal implementation of createL2L3Chain.protected org.onosproject.net.group.GroupDescriptioncreateMplsSwap(int nextGroupId, OfdpaGroupHandlerUtility.OfdpaMplsGroupSubType subtype, int index, org.onlab.packet.MplsLabel mplsLabel, org.onosproject.core.ApplicationId applicationId)Creates an Mpls group of type swap.protected intgetNextAvailableIndex()voidinit(org.onosproject.net.DeviceId deviceId, org.onosproject.net.behaviour.PipelinerContext context)protected voidmodifyBucketFromGroup(org.onosproject.net.flowobjective.NextObjective nextObjective, org.onosproject.net.behaviour.NextGroup nextGroup)modifies group with next objective.protected voidmodifyBucketInL2Group(org.onosproject.net.flowobjective.NextObjective nextObjective, org.onosproject.net.behaviour.NextGroup next)Modify buckets in the L2 interface group.protected voidmodifyBucketInL3Group(org.onosproject.net.flowobjective.NextObjective nextObjective, org.onosproject.net.behaviour.NextGroup next)protected voidprocessEcmpHashedNextObjective(org.onosproject.net.flowobjective.NextObjective nextObj)As per the OFDPA 2.0 TTP, packets are sent out of ports by using a chain of groups.protected voidprocessPendingAddGroupsOrNextObjs(org.onosproject.net.group.GroupKey key, boolean added)protected voidprocessPendingRemoveNextObjs(org.onosproject.net.group.GroupKey key)protected voidprocessPendingUpdateNextObjs(org.onosproject.net.group.GroupKey groupKey)protected voidprocessPwNextObjective(org.onosproject.net.flowobjective.NextObjective nextObjective)Processes the pseudo wire related next objective.protected voidremoveBucket(java.util.List<java.util.Deque<org.onosproject.net.group.GroupKey>> chainsToRemove, org.onosproject.net.flowobjective.NextObjective nextObjective)Removes top-level buckets from a group that represents the given next objective.protected voidremoveBucketFromGroup(org.onosproject.net.flowobjective.NextObjective nextObjective, org.onosproject.net.behaviour.NextGroup next)Removes buckets in the top level group of a possible group-chain.protected voidremoveGroup(org.onosproject.net.flowobjective.NextObjective nextObjective, org.onosproject.net.behaviour.NextGroup next)Removes all groups in multiple possible group-chains that represent the next-obj.protected booleanrequireAllowVlanTransition()Determines whether this pipeline requires AllowVlanTransition in L2 unfiltered group.protected booleanrequireVlanPopBeforeMplsPush()Determines whether this pipeline requires popping VLAN before pushing MPLS.protected booleansupportCopyTtl()Determines whether this pipeline support copy ttl instructions or not.protected booleansupportSetMplsBos()Determines whether this pipeline support set mpls bos instruction or not.voidterminate()protected voidupdatePendingGroups(org.onosproject.net.group.GroupKey groupKey, OfdpaGroupHandlerUtility.GroupChainElem gce)protected voidupdatePendingNextObjective(org.onosproject.net.group.GroupKey groupKey, OfdpaGroupHandlerUtility.OfdpaNextGroup nextGrp)protected voidverifyGroup(org.onosproject.net.flowobjective.NextObjective nextObjective, org.onosproject.net.behaviour.NextGroup next)Checks existing buckets inNextGroupto verify if they match the buckets in the givenNextObjective.
-
-
-
Field Detail
-
log
protected final org.slf4j.Logger log
-
groupService
protected org.onosproject.net.group.GroupService groupService
-
storageService
protected org.onosproject.store.service.StorageService storageService
-
flowObjectiveStore
protected org.onosproject.net.flowobjective.FlowObjectiveStore flowObjectiveStore
-
deviceId
protected org.onosproject.net.DeviceId deviceId
-
pendingBuckets
protected java.util.concurrent.ConcurrentHashMap<java.lang.Integer,java.util.Set<org.onosproject.net.flowobjective.NextObjective>> pendingBuckets
-
-
Method Detail
-
supportCopyTtl
protected boolean supportCopyTtl()
Determines whether this pipeline support copy ttl instructions or not.- Returns:
- true if copy ttl instructions are supported
-
supportSetMplsBos
protected boolean supportSetMplsBos()
Determines whether this pipeline support set mpls bos instruction or not.- Returns:
- true if set mpls bos instruction is supported
-
requireVlanPopBeforeMplsPush
protected boolean requireVlanPopBeforeMplsPush()
Determines whether this pipeline requires popping VLAN before pushing MPLS.If required, pop vlan before push mpls and add an arbitrary vlan back afterward. MPLS interface group will substitute the arbitrary VLAN with expected VLAN later on.
- Returns:
- true if this pipeline requires popping VLAN before pushing MPLS
-
requireAllowVlanTransition
protected boolean requireAllowVlanTransition()
Determines whether this pipeline requires AllowVlanTransition in L2 unfiltered group.- Returns:
- true if the AllowVlanTransition action is required
-
init
public void init(org.onosproject.net.DeviceId deviceId, org.onosproject.net.behaviour.PipelinerContext context)
-
terminate
public void terminate()
-
addGroup
protected void addGroup(org.onosproject.net.flowobjective.NextObjective nextObjective)
Adds a list of group chain by given NextObjective.- Parameters:
nextObjective- the NextObjective
-
createMplsSwap
protected org.onosproject.net.group.GroupDescription createMplsSwap(int nextGroupId, OfdpaGroupHandlerUtility.OfdpaMplsGroupSubType subtype, int index, org.onlab.packet.MplsLabel mplsLabel, org.onosproject.core.ApplicationId applicationId)Creates an Mpls group of type swap.- Parameters:
nextGroupId- the next group in the chainsubtype- the mpls swap label group subtypeindex- the index of the groupmplsLabel- the mpls label to swapapplicationId- the application id- Returns:
- the group description
-
createL2L3Chain
protected OfdpaGroupHandlerUtility.GroupInfo createL2L3Chain(org.onosproject.net.flow.TrafficTreatment treatment, int nextId, org.onosproject.core.ApplicationId appId, boolean mpls, org.onosproject.net.flow.TrafficSelector meta)
Creates one of two possible group-chains from the treatment passed in. Depending on the MPLS boolean, this method either creates an L3Unicast Group --> L2Interface Group, if mpls is false; or MPLSInterface Group --> L2Interface Group, if mpls is true; The returned 'inner' group description is always the L2 Interface group.- Parameters:
treatment- that needs to be broken up to create the group chainnextId- of the next objective that needs this group chainappId- of the application that sent this next objectivempls- determines if L3Unicast or MPLSInterface group is createdmeta- metadata passed in by the application as part of the nextObjective- Returns:
- GroupInfo containing the GroupDescription of the L2Interface group(inner) and the GroupDescription of the (outer) L3Unicast/MPLSInterface group. May return null if there is an error in processing the chain
-
createL2L3ChainInternal
protected OfdpaGroupHandlerUtility.GroupInfo createL2L3ChainInternal(org.onosproject.net.flow.TrafficTreatment treatment, int nextId, org.onosproject.core.ApplicationId appId, boolean mpls, org.onosproject.net.flow.TrafficSelector meta, boolean useSetVlanExtension)
Internal implementation of createL2L3Chain.The is_present bit in set_vlan_vid action is required to be 0 in OFDPA i12. Since it is non-OF spec, we need an extension treatment for that. The useSetVlanExtension must be set to false for OFDPA i12.
- Parameters:
treatment- that needs to be broken up to create the group chainnextId- of the next objective that needs this group chainappId- of the application that sent this next objectivempls- determines if L3Unicast or MPLSInterface group is createdmeta- metadata passed in by the application as part of the nextObjectiveuseSetVlanExtension- use the setVlanVid extension that has is_present bit set to 0.- Returns:
- GroupInfo containing the GroupDescription of the L2Interface group(inner) and the GroupDescription of the (outer) L3Unicast/MPLSInterface group. May return null if there is an error in processing the chain
-
processEcmpHashedNextObjective
protected void processEcmpHashedNextObjective(org.onosproject.net.flowobjective.NextObjective nextObj)
As per the OFDPA 2.0 TTP, packets are sent out of ports by using a chain of groups. The hashed Next Objective passed in by the application has to be broken up into a group chain comprising of an L3 ECMP group as the top level group. Buckets of this group can point to a variety of groups in a group chain, depending on the whether MPLS labels are being pushed or not.NOTE: We do not create MPLS ECMP groups as they are unimplemented in OF-DPA 2.0 (even though it is in the spec). Therefore we do not check the nextObjective meta to see what is matching before being sent to this nextObjective.
- Parameters:
nextObj- the nextObjective of type HASHED
-
createEcmpHashBucketChains
protected void createEcmpHashBucketChains(org.onosproject.net.flowobjective.NextObjective nextObj, java.util.List<java.util.Deque<org.onosproject.net.group.GroupKey>> allGroupKeys, java.util.List<OfdpaGroupHandlerUtility.GroupInfo> unsentGroups)Creates group chains for all buckets in a hashed group, and stores the GroupInfos and GroupKeys for all the groups in the lists passed in, which should be empty.Does not create the top level ECMP group. Does not actually send the groups to the groupService.
- Parameters:
nextObj- the Next Objective with buckets that need to be converted to group chainsallGroupKeys- a list to store groupKey for each bucket-group-chainunsentGroups- a list to store GroupInfo for each bucket-group-chain
-
processPwNextObjective
protected void processPwNextObjective(org.onosproject.net.flowobjective.NextObjective nextObjective)
Processes the pseudo wire related next objective. This procedure try to reuse the mpls label groups, the mpls interface group and the l2 interface group.- Parameters:
nextObjective- the objective to process.
-
addBucketToGroup
protected void addBucketToGroup(org.onosproject.net.flowobjective.NextObjective nextObjective, org.onosproject.net.behaviour.NextGroup next)Adds a bucket to the top level group of a group-chain, and creates the chain. Ensures that bucket being added is not a duplicate, by checking existing buckets for the same output port.- Parameters:
nextObjective- the bucket information for a next groupnext- the representation of the existing group-chain for this next objective
-
removeBucketFromGroup
protected void removeBucketFromGroup(org.onosproject.net.flowobjective.NextObjective nextObjective, org.onosproject.net.behaviour.NextGroup next)Removes buckets in the top level group of a possible group-chain. Does not remove the groups in the group-chain pointed to by this bucket, as they may be in use (referenced by other groups) elsewhere.- Parameters:
nextObjective- a next objective that contains information for the buckets to be removed from the groupnext- the representation of the existing group-chains for this next objective, from which the top-level buckets to remove are determined
-
removeBucket
protected void removeBucket(java.util.List<java.util.Deque<org.onosproject.net.group.GroupKey>> chainsToRemove, org.onosproject.net.flowobjective.NextObjective nextObjective)Removes top-level buckets from a group that represents the given next objective.- Parameters:
chainsToRemove- a list of group bucket chains to removenextObjective- the next objective that contains information for the buckets to be removed from the group
-
removeGroup
protected void removeGroup(org.onosproject.net.flowobjective.NextObjective nextObjective, org.onosproject.net.behaviour.NextGroup next)Removes all groups in multiple possible group-chains that represent the next-obj.- Parameters:
nextObjective- the next objective to removenext- the NextGroup that represents the existing group-chain for this next objective
-
modifyBucketFromGroup
protected void modifyBucketFromGroup(org.onosproject.net.flowobjective.NextObjective nextObjective, org.onosproject.net.behaviour.NextGroup nextGroup)modifies group with next objective.- Parameters:
nextObjective- the NextObjectivenextGroup- the NextGroup
-
modifyBucketInL2Group
protected void modifyBucketInL2Group(org.onosproject.net.flowobjective.NextObjective nextObjective, org.onosproject.net.behaviour.NextGroup next)Modify buckets in the L2 interface group.- Parameters:
nextObjective- a next objective that contains information for the buckets to be modified in the groupnext- the representation of the existing group-chains for this next objective, from which the innermost group buckets to remove are determined
-
modifyBucketInL3Group
protected void modifyBucketInL3Group(org.onosproject.net.flowobjective.NextObjective nextObjective, org.onosproject.net.behaviour.NextGroup next)
-
verifyGroup
protected void verifyGroup(org.onosproject.net.flowobjective.NextObjective nextObjective, org.onosproject.net.behaviour.NextGroup next)Checks existing buckets inNextGroupto verify if they match the buckets in the givenNextObjective. Adds or removes buckets to ensure that the buckets match up.- Parameters:
nextObjective- the next objective to verifynext- the representation of the existing group which has to be modified to match the given next objective
-
updatePendingNextObjective
protected void updatePendingNextObjective(org.onosproject.net.group.GroupKey groupKey, OfdpaGroupHandlerUtility.OfdpaNextGroup nextGrp)
-
updatePendingGroups
protected void updatePendingGroups(org.onosproject.net.group.GroupKey groupKey, OfdpaGroupHandlerUtility.GroupChainElem gce)
-
addPendingUpdateNextObjective
protected void addPendingUpdateNextObjective(org.onosproject.net.group.GroupKey groupKey, org.onosproject.net.flowobjective.NextObjective nextObjective)
-
addPendingRemoveNextObjective
protected void addPendingRemoveNextObjective(org.onosproject.net.flowobjective.NextObjective nextObjective, java.util.List<org.onosproject.net.group.GroupKey> groupKeys)
-
getNextAvailableIndex
protected int getNextAvailableIndex()
-
processPendingUpdateNextObjs
protected void processPendingUpdateNextObjs(org.onosproject.net.group.GroupKey groupKey)
-
processPendingRemoveNextObjs
protected void processPendingRemoveNextObjs(org.onosproject.net.group.GroupKey key)
-
processPendingAddGroupsOrNextObjs
protected void processPendingAddGroupsOrNextObjs(org.onosproject.net.group.GroupKey key, boolean added)
-
-