Package org.onosproject.net.group
Class DefaultGroupBucket
- java.lang.Object
-
- org.onosproject.net.group.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 Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description long
bytes()
Returns the number of bytes processed by this group bucket.static GroupBucket
createAllGroupBucket(TrafficTreatment treatment)
Creates all group bucket.static GroupBucket
createCloneGroupBucket(TrafficTreatment treatment)
Creates clone group bucket.static GroupBucket
createFailoverGroupBucket(TrafficTreatment treatment, PortNumber watchPort, GroupId watchGroup)
Creates failover group bucket with watchport or watchgroup.static GroupBucket
createIndirectGroupBucket(TrafficTreatment treatment)
Creates indirect group bucket.static GroupBucket
createSelectGroupBucket(TrafficTreatment treatment)
Creates select group bucket with weight as 1.static GroupBucket
createSelectGroupBucket(TrafficTreatment treatment, short weight)
Creates select group bucket with specified weight.boolean
equals(Object obj)
int
hashCode()
boolean
hasSameParameters(GroupBucket other)
Returns whether the given group bucket has the same parameters (weight, watchPort and watchGroup) as this.long
packets()
Returns the number of packets processed by this group bucket.void
setBytes(long bytes)
Sets number of bytes processed by this group bucket entry.void
setPackets(long packets)
Sets number of packets processed by this group bucket entry.String
toString()
TrafficTreatment
treatment()
Returns list of Traffic instructions that are part of the bucket.GroupDescription.Type
type()
Returns group type of the bucket.GroupId
watchGroup()
Returns group identifier used for liveness detection for a failover bucket.PortNumber
watchPort()
Returns port number used for liveness detection for a failover bucket.short
weight()
Returns weight of select group bucket.
-
-
-
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 bucketweight
- 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 bucketwatchPort
- port that determines the liveness of group bucketwatchGroup
- 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
-
type
public GroupDescription.Type type()
Description copied from interface:GroupBucket
Returns group type of the bucket.- Specified by:
type
in interfaceGroupBucket
- Returns:
- GroupType group type
-
treatment
public TrafficTreatment treatment()
Returns list of Traffic instructions that are part of the bucket.- Specified by:
treatment
in interfaceGroupBucket
- Returns:
- TrafficTreatment Traffic instruction list
-
weight
public short weight()
Returns weight of select group bucket.- Specified by:
weight
in interfaceGroupBucket
- 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 interfaceGroupBucket
- 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 interfaceGroupBucket
- Returns:
- GroupId group identifier to be used for liveness detection
-
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 interfaceGroupBucket
- 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 interfaceGroupBucket
- 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 interfaceGroupBucket
- 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 interfaceStoredGroupBucketEntry
- 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 interfaceStoredGroupBucketEntry
- Parameters:
bytes
- a long value
-
-