Class DefaultGroupBucket

  • All Implemented Interfaces:
    GroupBucket, StoredGroupBucketEntry

    public final class DefaultGroupBucket
    extends Object
    implements GroupBucket, StoredGroupBucketEntry
    Group bucket implementation. A group bucket is collection of instructions that can be performed on a traffic flow. A select Group can have one or more Buckets where traffic will be processed by a single bucket in the group, based on device specific selection algorithm (e.g. hash on some fields of the incoming traffic flows or round robin) and hence can contains optional weight field to define the weights among the buckets in the group. A failover group bucket is associated with a specific port or group that controls its liveness.
    • Method Detail

      • createIndirectGroupBucket

        public static GroupBucket createIndirectGroupBucket​(TrafficTreatment treatment)
        Creates indirect group bucket.
        Parameters:
        treatment - traffic treatment associated with group bucket
        Returns:
        indirect group bucket object
      • createSelectGroupBucket

        public static GroupBucket createSelectGroupBucket​(TrafficTreatment treatment)
        Creates select group bucket with weight as 1.
        Parameters:
        treatment - traffic treatment associated with group bucket
        Returns:
        select group bucket object
      • createSelectGroupBucket

        public static GroupBucket createSelectGroupBucket​(TrafficTreatment treatment,
                                                          short weight)
        Creates select group bucket with specified weight.
        Parameters:
        treatment - traffic treatment associated with group bucket
        weight - weight associated with group bucket
        Returns:
        select group bucket object
      • createFailoverGroupBucket

        public static GroupBucket createFailoverGroupBucket​(TrafficTreatment treatment,
                                                            PortNumber watchPort,
                                                            GroupId watchGroup)
        Creates failover group bucket with watchport or watchgroup.
        Parameters:
        treatment - traffic treatment associated with group bucket
        watchPort - port that determines the liveness of group bucket
        watchGroup - group that determines the liveness of group bucket
        Returns:
        failover group bucket object
      • createAllGroupBucket

        public static GroupBucket createAllGroupBucket​(TrafficTreatment treatment)
        Creates all group bucket.
        Parameters:
        treatment - traffic treatment associated with group bucket
        Returns:
        all group bucket object
      • createCloneGroupBucket

        public static GroupBucket createCloneGroupBucket​(TrafficTreatment treatment)
        Creates clone group bucket.
        Parameters:
        treatment - traffic treatment associated with group bucket
        Returns:
        clone group bucket object
      • treatment

        public TrafficTreatment treatment()
        Returns list of Traffic instructions that are part of the bucket.
        Specified by:
        treatment in interface GroupBucket
        Returns:
        TrafficTreatment Traffic instruction list
      • weight

        public short weight()
        Returns weight of select group bucket.
        Specified by:
        weight in interface GroupBucket
        Returns:
        short weight associated with a bucket
      • watchPort

        public PortNumber watchPort()
        Returns port number used for liveness detection for a failover bucket.
        Specified by:
        watchPort in interface GroupBucket
        Returns:
        PortNumber port number used for liveness detection
      • watchGroup

        public GroupId watchGroup()
        Returns group identifier used for liveness detection for a failover bucket.
        Specified by:
        watchGroup in interface GroupBucket
        Returns:
        GroupId group identifier to be used for liveness detection
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • hasSameParameters

        public boolean hasSameParameters​(GroupBucket other)
        Description copied from interface: GroupBucket
        Returns whether the given group bucket has the same parameters (weight, watchPort and watchGroup) as this.
        Specified by:
        hasSameParameters in interface GroupBucket
        Parameters:
        other - group bucket to compare
        Returns:
        true if this bucket has the same parameters as other, false otherwise
      • packets

        public long packets()
        Description copied from interface: GroupBucket
        Returns the number of packets processed by this group bucket.
        Specified by:
        packets in interface GroupBucket
        Returns:
        number of packets
      • bytes

        public long bytes()
        Description copied from interface: GroupBucket
        Returns the number of bytes processed by this group bucket.
        Specified by:
        bytes in interface GroupBucket
        Returns:
        number of bytes
      • setPackets

        public void setPackets​(long packets)
        Description copied from interface: StoredGroupBucketEntry
        Sets number of packets processed by this group bucket entry.
        Specified by:
        setPackets in interface StoredGroupBucketEntry
        Parameters:
        packets - a long value
      • setBytes

        public void setBytes​(long bytes)
        Description copied from interface: StoredGroupBucketEntry
        Sets number of bytes processed by this group bucket entry.
        Specified by:
        setBytes in interface StoredGroupBucketEntry
        Parameters:
        bytes - a long value