Class Ofdpa2GroupHandler

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected org.onosproject.net.DeviceId deviceId  
      protected org.onosproject.net.flowobjective.FlowObjectiveStore flowObjectiveStore  
      protected org.onosproject.net.group.GroupService groupService  
      protected org.slf4j.Logger log  
      protected java.util.concurrent.ConcurrentHashMap<java.lang.Integer,​java.util.Set<org.onosproject.net.flowobjective.NextObjective>> pendingBuckets  
      protected org.onosproject.store.service.StorageService storageService  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      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.
      protected void addGroup​(org.onosproject.net.flowobjective.NextObjective nextObjective)
      Adds a list of group chain by given NextObjective.
      protected void addPendingRemoveNextObjective​(org.onosproject.net.flowobjective.NextObjective nextObjective, java.util.List<org.onosproject.net.group.GroupKey> groupKeys)  
      protected void addPendingUpdateNextObjective​(org.onosproject.net.group.GroupKey groupKey, org.onosproject.net.flowobjective.NextObjective nextObjective)  
      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.
      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.
      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.
      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.
      protected int getNextAvailableIndex()  
      void init​(org.onosproject.net.DeviceId deviceId, org.onosproject.net.behaviour.PipelinerContext context)  
      protected void modifyBucketFromGroup​(org.onosproject.net.flowobjective.NextObjective nextObjective, org.onosproject.net.behaviour.NextGroup nextGroup)
      modifies group with next objective.
      protected void modifyBucketInL2Group​(org.onosproject.net.flowobjective.NextObjective nextObjective, org.onosproject.net.behaviour.NextGroup next)
      Modify buckets in the L2 interface group.
      protected void modifyBucketInL3Group​(org.onosproject.net.flowobjective.NextObjective nextObjective, org.onosproject.net.behaviour.NextGroup next)  
      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.
      protected void processPendingAddGroupsOrNextObjs​(org.onosproject.net.group.GroupKey key, boolean added)  
      protected void processPendingRemoveNextObjs​(org.onosproject.net.group.GroupKey key)  
      protected void processPendingUpdateNextObjs​(org.onosproject.net.group.GroupKey groupKey)  
      protected void processPwNextObjective​(org.onosproject.net.flowobjective.NextObjective nextObjective)
      Processes the pseudo wire related next objective.
      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.
      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.
      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.
      protected boolean requireAllowVlanTransition()
      Determines whether this pipeline requires AllowVlanTransition in L2 unfiltered group.
      protected boolean requireVlanPopBeforeMplsPush()
      Determines whether this pipeline requires popping VLAN before pushing MPLS.
      protected boolean supportCopyTtl()
      Determines whether this pipeline support copy ttl instructions or not.
      protected boolean supportSetMplsBos()
      Determines whether this pipeline support set mpls bos instruction or not.
      void terminate()  
      protected void updatePendingGroups​(org.onosproject.net.group.GroupKey groupKey, OfdpaGroupHandlerUtility.GroupChainElem gce)  
      protected void updatePendingNextObjective​(org.onosproject.net.group.GroupKey groupKey, OfdpaGroupHandlerUtility.OfdpaNextGroup nextGrp)  
      protected void verifyGroup​(org.onosproject.net.flowobjective.NextObjective nextObjective, org.onosproject.net.behaviour.NextGroup next)
      Checks existing buckets in NextGroup to verify if they match the buckets in the given NextObjective.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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
    • Constructor Detail

      • Ofdpa2GroupHandler

        public Ofdpa2GroupHandler()
    • 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 chain
        subtype - the mpls swap label group subtype
        index - the index of the group
        mplsLabel - the mpls label to swap
        applicationId - 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 chain
        nextId - of the next objective that needs this group chain
        appId - of the application that sent this next objective
        mpls - determines if L3Unicast or MPLSInterface group is created
        meta - 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 chain
        nextId - of the next objective that needs this group chain
        appId - of the application that sent this next objective
        mpls - determines if L3Unicast or MPLSInterface group is created
        meta - metadata passed in by the application as part of the nextObjective
        useSetVlanExtension - 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 chains
        allGroupKeys - a list to store groupKey for each bucket-group-chain
        unsentGroups - 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 group
        next - 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 group
        next - 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 remove
        nextObjective - 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 remove
        next - 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 NextObjective
        nextGroup - 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 group
        next - 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 in NextGroup to verify if they match the buckets in the given NextObjective. Adds or removes buckets to ensure that the buckets match up.
        Parameters:
        nextObjective - the next objective to verify
        next - the representation of the existing group which has to be modified to match the given next objective
      • 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)