Package org.onosproject.net.group
Class DefaultGroup
- java.lang.Object
-
- org.onosproject.net.group.DefaultGroupDescription
-
- org.onosproject.net.group.DefaultGroup
-
- All Implemented Interfaces:
Group,GroupDescription,StoredGroupEntry,PiTranslatable
public class DefaultGroup extends DefaultGroupDescription implements Group, StoredGroupEntry
ONOS implementation of default group that is stored in the system.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.onosproject.net.group.Group
Group.GroupState
-
Nested classes/interfaces inherited from interface org.onosproject.net.group.GroupDescription
GroupDescription.Type
-
-
Constructor Summary
Constructors Constructor Description DefaultGroup(GroupId id, DeviceId deviceId, GroupDescription.Type type, GroupBuckets buckets)Default group object constructor with the available information from data plane.DefaultGroup(GroupId id, GroupDescription groupDesc)Default group object constructor with the parameters.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intage()Obtains the age of a group.longbytes()Returns the number of bytes processed by this group.booleanequals(java.lang.Object obj)intfailedRetryCount()Returns the count for the number of attempts at programming a failed group.inthashCode()GroupIdid()Returns group identifier associated with a group object.voidincrFailedRetryCount()Increments the count for the number of failed attempts in programming this group.booleanisGroupStateAddedFirstTime()Returns the isGroupStateAddedFirstTime value.longlife()Returns the number of milliseconds this group has been alive.longpackets()Returns the number of packets processed by this group.longreferenceCount()Returns the number of flow rules or other groups reference this group.voidsetBytes(long bytes)Sets number of bytes processed by this group entry.voidsetFailedRetryCount(int failedRetryCount)Sets the count for the number of failed attempts in programming this group.voidsetIsGroupStateAddedFirstTime(boolean isGroupStateAddedFirstTime)Sets if group has transitioned to ADDED state for the first time.voidsetLife(long life)Sets how long this entry has been entered in the system.voidsetPackets(long packets)Sets number of packets processed by this group entry.voidsetReferenceCount(long referenceCount)Sets number of flow rules or groups referencing this group entry.voidsetState(Group.GroupState newState)Sets the new state for this entry.Group.GroupStatestate()Returns current state of a group object.java.lang.StringtoString()-
Methods inherited from class org.onosproject.net.group.DefaultGroupDescription
appCookie, appId, buckets, deviceId, givenGroupId, type
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.onosproject.net.group.GroupDescription
appCookie, appId, buckets, deviceId, givenGroupId, type
-
-
-
-
Constructor Detail
-
DefaultGroup
public DefaultGroup(GroupId id, GroupDescription groupDesc)
Default group object constructor with the parameters.- Parameters:
id- group identifiergroupDesc- group description parameters
-
DefaultGroup
public DefaultGroup(GroupId id, DeviceId deviceId, GroupDescription.Type type, GroupBuckets buckets)
Default group object constructor with the available information from data plane.- Parameters:
id- group identifierdeviceId- device identifiertype- type of the groupbuckets- immutable list of group bucket
-
-
Method Detail
-
id
public GroupId id()
Returns group identifier associated with a group object.
-
state
public Group.GroupState state()
Returns current state of a group object.
-
life
public long life()
Returns the number of milliseconds this group has been alive.
-
packets
public long packets()
Returns the number of packets processed by this group.
-
bytes
public long bytes()
Returns the number of bytes processed by this group.
-
age
public int age()
Description copied from interface:GroupObtains the age of a group. The age reflects the number of polling rounds the group has had a reference count of zero.
-
failedRetryCount
public int failedRetryCount()
Description copied from interface:GroupReturns the count for the number of attempts at programming a failed group.- Specified by:
failedRetryCountin interfaceGroup- Returns:
- the count for the number of failed attempts at programming this group
-
setState
public void setState(Group.GroupState newState)
Sets the new state for this entry.- Specified by:
setStatein interfaceStoredGroupEntry- Parameters:
newState- new group entry state.
-
setLife
public void setLife(long life)
Sets how long this entry has been entered in the system.- Specified by:
setLifein interfaceStoredGroupEntry- Parameters:
life- epoch time
-
setPackets
public void setPackets(long packets)
Sets number of packets processed by this group entry.- Specified by:
setPacketsin interfaceStoredGroupEntry- Parameters:
packets- a long value
-
setBytes
public void setBytes(long bytes)
Sets number of bytes processed by this group entry.- Specified by:
setBytesin interfaceStoredGroupEntry- Parameters:
bytes- a long value
-
setReferenceCount
public void setReferenceCount(long referenceCount)
Description copied from interface:StoredGroupEntrySets number of flow rules or groups referencing this group entry.- Specified by:
setReferenceCountin interfaceStoredGroupEntry- Parameters:
referenceCount- reference count
-
referenceCount
public long referenceCount()
Description copied from interface:GroupReturns the number of flow rules or other groups reference this group.- Specified by:
referenceCountin interfaceGroup- Returns:
- number of flow rules or other groups pointing to this group
-
incrFailedRetryCount
public void incrFailedRetryCount()
Description copied from interface:StoredGroupEntryIncrements the count for the number of failed attempts in programming this group.- Specified by:
incrFailedRetryCountin interfaceStoredGroupEntry
-
setFailedRetryCount
public void setFailedRetryCount(int failedRetryCount)
Description copied from interface:StoredGroupEntrySets the count for the number of failed attempts in programming this group.- Specified by:
setFailedRetryCountin interfaceStoredGroupEntry- Parameters:
failedRetryCount- count for number of failed attempts in programming this group
-
hashCode
public int hashCode()
- Overrides:
hashCodein classDefaultGroupDescription
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classDefaultGroupDescription
-
toString
public java.lang.String toString()
- Overrides:
toStringin classDefaultGroupDescription
-
setIsGroupStateAddedFirstTime
public void setIsGroupStateAddedFirstTime(boolean isGroupStateAddedFirstTime)
Description copied from interface:StoredGroupEntrySets if group has transitioned to ADDED state for the first time. This is to differentiate state transitions "from PENDING_ADD to ADDED" and "from PENDING_UPDATE to ADDED". For internal use only.- Specified by:
setIsGroupStateAddedFirstTimein interfaceStoredGroupEntry- Parameters:
isGroupStateAddedFirstTime- true if group moves to ADDED state for the first time.
-
isGroupStateAddedFirstTime
public boolean isGroupStateAddedFirstTime()
Description copied from interface:StoredGroupEntryReturns the isGroupStateAddedFirstTime value. For internal use only.- Specified by:
isGroupStateAddedFirstTimein interfaceStoredGroupEntry- Returns:
- isGroupStateAddedFirstTime value
-
-