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 java.lang.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 longbytes()Returns the number of bytes processed by this group bucket.static GroupBucketcreateAllGroupBucket(TrafficTreatment treatment)Creates all group bucket.static GroupBucketcreateCloneGroupBucket(TrafficTreatment treatment)Creates clone group bucket.static GroupBucketcreateFailoverGroupBucket(TrafficTreatment treatment, PortNumber watchPort, GroupId watchGroup)Creates failover group bucket with watchport or watchgroup.static GroupBucketcreateIndirectGroupBucket(TrafficTreatment treatment)Creates indirect group bucket.static GroupBucketcreateSelectGroupBucket(TrafficTreatment treatment)Creates select group bucket with weight as 1.static GroupBucketcreateSelectGroupBucket(TrafficTreatment treatment, short weight)Creates select group bucket with specified weight.booleanequals(java.lang.Object obj)inthashCode()booleanhasSameParameters(GroupBucket other)Returns whether the given group bucket has the same parameters (weight, watchPort and watchGroup) as this.longpackets()Returns the number of packets processed by this group bucket.voidsetBytes(long bytes)Sets number of bytes processed by this group bucket entry.voidsetPackets(long packets)Sets number of packets processed by this group bucket entry.java.lang.StringtoString()TrafficTreatmenttreatment()Returns list of Traffic instructions that are part of the bucket.GroupDescription.Typetype()Returns group type of the bucket.GroupIdwatchGroup()Returns group identifier used for liveness detection for a failover bucket.PortNumberwatchPort()Returns port number used for liveness detection for a failover bucket.shortweight()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:GroupBucketReturns group type of the bucket.- Specified by:
typein interfaceGroupBucket- Returns:
- GroupType group type
-
treatment
public TrafficTreatment treatment()
Returns list of Traffic instructions that are part of the bucket.- Specified by:
treatmentin interfaceGroupBucket- Returns:
- TrafficTreatment Traffic instruction list
-
weight
public short weight()
Returns weight of select group bucket.- Specified by:
weightin 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:
watchPortin 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:
watchGroupin interfaceGroupBucket- Returns:
- GroupId group identifier to be used for liveness detection
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
hasSameParameters
public boolean hasSameParameters(GroupBucket other)
Description copied from interface:GroupBucketReturns whether the given group bucket has the same parameters (weight, watchPort and watchGroup) as this.- Specified by:
hasSameParametersin interfaceGroupBucket- Parameters:
other- group bucket to compare- Returns:
- true if this bucket has the same parameters as other, false otherwise
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
packets
public long packets()
Description copied from interface:GroupBucketReturns the number of packets processed by this group bucket.- Specified by:
packetsin interfaceGroupBucket- Returns:
- number of packets
-
bytes
public long bytes()
Description copied from interface:GroupBucketReturns the number of bytes processed by this group bucket.- Specified by:
bytesin interfaceGroupBucket- Returns:
- number of bytes
-
setPackets
public void setPackets(long packets)
Description copied from interface:StoredGroupBucketEntrySets number of packets processed by this group bucket entry.- Specified by:
setPacketsin interfaceStoredGroupBucketEntry- Parameters:
packets- a long value
-
setBytes
public void setBytes(long bytes)
Description copied from interface:StoredGroupBucketEntrySets number of bytes processed by this group bucket entry.- Specified by:
setBytesin interfaceStoredGroupBucketEntry- Parameters:
bytes- a long value
-
-