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 int
age()
Obtains the age of a group.long
bytes()
Returns the number of bytes processed by this group.boolean
equals(Object obj)
int
failedRetryCount()
Returns the count for the number of attempts at programming a failed group.int
hashCode()
GroupId
id()
Returns group identifier associated with a group object.void
incrFailedRetryCount()
Increments the count for the number of failed attempts in programming this group.boolean
isGroupStateAddedFirstTime()
Returns the isGroupStateAddedFirstTime value.long
life()
Returns the number of milliseconds this group has been alive.long
packets()
Returns the number of packets processed by this group.long
referenceCount()
Returns the number of flow rules or other groups reference this group.void
setBytes(long bytes)
Sets number of bytes processed by this group entry.void
setFailedRetryCount(int failedRetryCount)
Sets the count for the number of failed attempts in programming this group.void
setIsGroupStateAddedFirstTime(boolean isGroupStateAddedFirstTime)
Sets if group has transitioned to ADDED state for the first time.void
setLife(long life)
Sets how long this entry has been entered in the system.void
setPackets(long packets)
Sets number of packets processed by this group entry.void
setReferenceCount(long referenceCount)
Sets number of flow rules or groups referencing this group entry.void
setState(Group.GroupState newState)
Sets the new state for this entry.Group.GroupState
state()
Returns current state of a group object.String
toString()
-
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:Group
Obtains 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:Group
Returns the count for the number of attempts at programming a failed group.- Specified by:
failedRetryCount
in 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:
setState
in 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:
setLife
in interfaceStoredGroupEntry
- Parameters:
life
- epoch time
-
setPackets
public void setPackets(long packets)
Sets number of packets processed by this group entry.- Specified by:
setPackets
in interfaceStoredGroupEntry
- Parameters:
packets
- a long value
-
setBytes
public void setBytes(long bytes)
Sets number of bytes processed by this group entry.- Specified by:
setBytes
in interfaceStoredGroupEntry
- Parameters:
bytes
- a long value
-
setReferenceCount
public void setReferenceCount(long referenceCount)
Description copied from interface:StoredGroupEntry
Sets number of flow rules or groups referencing this group entry.- Specified by:
setReferenceCount
in interfaceStoredGroupEntry
- Parameters:
referenceCount
- reference count
-
referenceCount
public long referenceCount()
Description copied from interface:Group
Returns the number of flow rules or other groups reference this group.- Specified by:
referenceCount
in interfaceGroup
- Returns:
- number of flow rules or other groups pointing to this group
-
incrFailedRetryCount
public void incrFailedRetryCount()
Description copied from interface:StoredGroupEntry
Increments the count for the number of failed attempts in programming this group.- Specified by:
incrFailedRetryCount
in interfaceStoredGroupEntry
-
setFailedRetryCount
public void setFailedRetryCount(int failedRetryCount)
Description copied from interface:StoredGroupEntry
Sets the count for the number of failed attempts in programming this group.- Specified by:
setFailedRetryCount
in interfaceStoredGroupEntry
- Parameters:
failedRetryCount
- count for number of failed attempts in programming this group
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classDefaultGroupDescription
-
equals
public boolean equals(Object obj)
- Overrides:
equals
in classDefaultGroupDescription
-
toString
public String toString()
- Overrides:
toString
in classDefaultGroupDescription
-
setIsGroupStateAddedFirstTime
public void setIsGroupStateAddedFirstTime(boolean isGroupStateAddedFirstTime)
Description copied from interface:StoredGroupEntry
Sets 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:
setIsGroupStateAddedFirstTime
in interfaceStoredGroupEntry
- Parameters:
isGroupStateAddedFirstTime
- true if group moves to ADDED state for the first time.
-
isGroupStateAddedFirstTime
public boolean isGroupStateAddedFirstTime()
Description copied from interface:StoredGroupEntry
Returns the isGroupStateAddedFirstTime value. For internal use only.- Specified by:
isGroupStateAddedFirstTime
in interfaceStoredGroupEntry
- Returns:
- isGroupStateAddedFirstTime value
-
-