Class OfdpaGroupHandlerUtility


  • public final class OfdpaGroupHandlerUtility
    extends java.lang.Object
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean createUnfiltered​(org.onosproject.net.flow.TrafficTreatment treatment, org.onosproject.net.flow.TrafficSelector meta)
      Helper method to decide whether L2 Interface group or L2 Unfiltered group needs to be created.
      static int doubleVlanL3UnicastGroupId​(org.onlab.packet.VlanId vlanId, long portNum)  
      static int doubleVlanL3UnicastGroupKey​(org.onosproject.net.DeviceId deviceId, org.onlab.packet.VlanId vlanId, long portNumber)
      Returns a hash as the L3 Unicast Group Key.
      static java.util.List<java.lang.Integer> existingPortAndLabel​(java.util.List<java.util.Deque<org.onosproject.net.group.GroupKey>> allActiveKeys, org.onosproject.net.group.GroupService groupService, org.onosproject.net.DeviceId deviceId, org.onosproject.net.PortNumber portToMatch, int labelToMatch)
      Returns a list of all indices in the allActiveKeys list (that represents a group) if the list element (a bucket or group-chain) has treatments that match the given outport and label.
      static org.onlab.packet.VlanId extractVlanIdFromGroupId​(int groupId)
      Extracts VlanId from given group ID.
      static java.util.Set<org.onosproject.net.PortNumber> getExistingOutputPorts​(java.util.List<java.util.Deque<org.onosproject.net.group.GroupKey>> allActiveKeys, org.onosproject.net.group.GroupService groupService, org.onosproject.net.DeviceId deviceId)
      Returns the set of existing output ports in the group represented by allActiveKeys.
      static java.util.List<java.lang.Integer> indicesToRemoveFromNextGroup​(java.util.List<java.util.Deque<org.onosproject.net.group.GroupKey>> allActiveKeys, org.onosproject.net.flowobjective.NextObjective nextObjective, org.onosproject.net.group.GroupService groupService, org.onosproject.net.DeviceId deviceId)
      Get indices to remove comparing next group with next objective.
      static org.onosproject.net.group.GroupKey l2FloodGroupKey​(org.onlab.packet.VlanId vlanId, org.onosproject.net.DeviceId deviceId)  
      static int l2GroupId​(org.onlab.packet.VlanId vlanId, long portNum)  
      static int l2HashGroupKey​(org.onosproject.net.DeviceId deviceId, long portNumber)
      Returns a hash as the L2 Hash Group Key.
      static int l2InterfaceGroupKey​(org.onosproject.net.DeviceId deviceId, org.onlab.packet.VlanId vlanId, long portNumber)
      Returns a hash as the L2 Interface Group Key.
      static org.onosproject.net.group.GroupKey l2MulticastGroupKey​(org.onlab.packet.VlanId vlanId, org.onosproject.net.DeviceId deviceId)  
      static int l2UnfilteredGroupId​(long portNum)  
      static int l2UnfilteredGroupKey​(org.onosproject.net.DeviceId deviceId, long portNumber)
      Returns a hash as the L2 Unfiltered Interface Group Key.
      static java.lang.Integer makeMplsForwardingGroupId​(OfdpaGroupHandlerUtility.OfdpaMplsGroupSubType subType, int index)
      Creates MPLS Forwarding group id given a sub type and the index.
      static java.lang.Integer makeMplsLabelGroupId​(OfdpaGroupHandlerUtility.OfdpaMplsGroupSubType subType, int index)
      Creates MPLS Label group id given a sub type and the index.
      static boolean verifyHashedNextObjective​(org.onosproject.net.flowobjective.NextObjective nextObjective)
      The purpose of this function is to verify if the hashed next objective is supported by the current pipeline.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • makeMplsLabelGroupId

        public static java.lang.Integer makeMplsLabelGroupId​(OfdpaGroupHandlerUtility.OfdpaMplsGroupSubType subType,
                                                             int index)
        Creates MPLS Label group id given a sub type and the index.
        Parameters:
        subType - the MPLS Label group sub type
        index - the index of the group
        Returns:
        the OFDPA group id
      • makeMplsForwardingGroupId

        public static java.lang.Integer makeMplsForwardingGroupId​(OfdpaGroupHandlerUtility.OfdpaMplsGroupSubType subType,
                                                                  int index)
        Creates MPLS Forwarding group id given a sub type and the index.
        Parameters:
        subType - the MPLS forwarding group sub type
        index - the index of the group
        Returns:
        the OFDPA group id
      • getExistingOutputPorts

        public static java.util.Set<org.onosproject.net.PortNumber> getExistingOutputPorts​(java.util.List<java.util.Deque<org.onosproject.net.group.GroupKey>> allActiveKeys,
                                                                                           org.onosproject.net.group.GroupService groupService,
                                                                                           org.onosproject.net.DeviceId deviceId)
        Returns the set of existing output ports in the group represented by allActiveKeys.
        Parameters:
        allActiveKeys - list of group key chain
        groupService - the group service to get group information
        deviceId - the device id to get group
        Returns:
        a set of output port from the list of group key chain
      • existingPortAndLabel

        public static java.util.List<java.lang.Integer> existingPortAndLabel​(java.util.List<java.util.Deque<org.onosproject.net.group.GroupKey>> allActiveKeys,
                                                                             org.onosproject.net.group.GroupService groupService,
                                                                             org.onosproject.net.DeviceId deviceId,
                                                                             org.onosproject.net.PortNumber portToMatch,
                                                                             int labelToMatch)
        Returns a list of all indices in the allActiveKeys list (that represents a group) if the list element (a bucket or group-chain) has treatments that match the given outport and label.
        Parameters:
        allActiveKeys - the representation of the group
        groupService - groups service for querying group information
        deviceId - the device id for the device that contains the group
        portToMatch - the port to match in the group buckets
        labelToMatch - the MPLS label-id to match in the group buckets
        Returns:
        a list of indexes in the allActiveKeys list where the list element has treatments that match the given portToMatch and labelToMatch. Could be empty if no list elements were found to match the given port and label.
      • indicesToRemoveFromNextGroup

        public static java.util.List<java.lang.Integer> indicesToRemoveFromNextGroup​(java.util.List<java.util.Deque<org.onosproject.net.group.GroupKey>> allActiveKeys,
                                                                                     org.onosproject.net.flowobjective.NextObjective nextObjective,
                                                                                     org.onosproject.net.group.GroupService groupService,
                                                                                     org.onosproject.net.DeviceId deviceId)
        Get indices to remove comparing next group with next objective.
        Parameters:
        allActiveKeys - the representation of the group
        nextObjective - the next objective to verify
        groupService - groups service for querying group information
        deviceId - the device id for the device that contains the group
        Returns:
        a list of indexes in the allActiveKeys to remove.
      • verifyHashedNextObjective

        public static boolean verifyHashedNextObjective​(org.onosproject.net.flowobjective.NextObjective nextObjective)
        The purpose of this function is to verify if the hashed next objective is supported by the current pipeline.
        Parameters:
        nextObjective - the hashed objective to verify
        Returns:
        true if the hashed objective is supported. Otherwise false.
      • extractVlanIdFromGroupId

        public static org.onlab.packet.VlanId extractVlanIdFromGroupId​(int groupId)
        Extracts VlanId from given group ID.
        Parameters:
        groupId - the group ID
        Returns:
        vlan id of the group
      • l2FloodGroupKey

        public static org.onosproject.net.group.GroupKey l2FloodGroupKey​(org.onlab.packet.VlanId vlanId,
                                                                         org.onosproject.net.DeviceId deviceId)
      • l2MulticastGroupKey

        public static org.onosproject.net.group.GroupKey l2MulticastGroupKey​(org.onlab.packet.VlanId vlanId,
                                                                             org.onosproject.net.DeviceId deviceId)
      • l2GroupId

        public static int l2GroupId​(org.onlab.packet.VlanId vlanId,
                                    long portNum)
      • l2UnfilteredGroupId

        public static int l2UnfilteredGroupId​(long portNum)
      • l2InterfaceGroupKey

        public static int l2InterfaceGroupKey​(org.onosproject.net.DeviceId deviceId,
                                              org.onlab.packet.VlanId vlanId,
                                              long portNumber)
        Returns a hash as the L2 Interface Group Key. Keep the lower 6-bit for port since port number usually smaller than 64. Hash other information into remaining 22 bits.
        Parameters:
        deviceId - Device ID
        vlanId - VLAN ID
        portNumber - Port number
        Returns:
        L2 interface group key
      • l2UnfilteredGroupKey

        public static int l2UnfilteredGroupKey​(org.onosproject.net.DeviceId deviceId,
                                               long portNumber)
        Returns a hash as the L2 Unfiltered Interface Group Key. Keep the lower 6-bit for port since port number usually smaller than 64. Hash other information into remaining 22 bits.
        Parameters:
        deviceId - Device ID
        portNumber - Port number
        Returns:
        L2 unfiltered interface group key
      • l2HashGroupKey

        public static int l2HashGroupKey​(org.onosproject.net.DeviceId deviceId,
                                         long portNumber)
        Returns a hash as the L2 Hash Group Key. Keep the lower 6-bit for port since port number usually smaller than 64. Hash other information into remaining 28 bits.
        Parameters:
        deviceId - Device ID
        portNumber - Port number
        Returns:
        L2 hash group key
      • createUnfiltered

        public static boolean createUnfiltered​(org.onosproject.net.flow.TrafficTreatment treatment,
                                               org.onosproject.net.flow.TrafficSelector meta)
        Helper method to decide whether L2 Interface group or L2 Unfiltered group needs to be created. L2 Unfiltered group will be created if meta has VlanIdCriterion with VlanId.ANY, and treatment has set Vlan ID action.
        Parameters:
        treatment - treatment passed in by the application as part of the nextObjective
        meta - metadata passed in by the application as part of the nextObjective
        Returns:
        true if L2 Unfiltered group needs to be created, false otherwise.
      • doubleVlanL3UnicastGroupKey

        public static int doubleVlanL3UnicastGroupKey​(org.onosproject.net.DeviceId deviceId,
                                                      org.onlab.packet.VlanId vlanId,
                                                      long portNumber)
        Returns a hash as the L3 Unicast Group Key. Keep the lower 6-bit for port since port number usually smaller than 64. Hash other information into remaining 28 bits.
        Parameters:
        deviceId - Device ID
        vlanId - vlan ID
        portNumber - Port number
        Returns:
        L3 unicast group key
      • doubleVlanL3UnicastGroupId

        public static int doubleVlanL3UnicastGroupId​(org.onlab.packet.VlanId vlanId,
                                                     long portNum)