Class DefaultPolicer
- java.lang.Object
-
- org.onosproject.net.behaviour.trafficcontrol.DefaultPolicer
-
- All Implemented Interfaces:
Policer
,PolicerEntry
@Beta public final class DefaultPolicer extends java.lang.Object implements Policer, PolicerEntry
Default implementation of the policer interface.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
DefaultPolicer.Builder
Implementation of the policer builder interface.-
Nested classes/interfaces inherited from interface org.onosproject.net.behaviour.trafficcontrol.Policer
Policer.Unit
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ApplicationId
applicationId()
The id of the application which created this policer.static DefaultPolicer.Builder
builder()
Returns a new builder reference.java.lang.String
description()
Brief description of this policer.DeviceId
deviceId()
The device of this policer, where policing is applied.boolean
equals(java.lang.Object o)
int
hashCode()
boolean
isColorAware()
Indicates if this policer is aware of the marking indication in the ethernet frames.long
life()
The lifetime in seconds of this policer.PolicerId
policerId()
The id of this policer.long
processedBytes()
Stats which reports how many bytes have been processed so far.long
processedPackets()
Stats which reports how many packets have been processed so far.long
referenceCount()
Returns how many are referencing this policer.void
setLife(long l)
Set the amount of time the policer has existed in seconds.void
setProcessedBytes(long bytes)
Updates the number of bytes seen by the policer.void
setProcessedPackets(long packets)
Updates the number of packets seen by this policer.void
setReferenceCount(long count)
Sets how many are using this policer.java.util.Collection<TokenBucket>
tokenBuckets()
The token buckets used within this policer.java.lang.String
toString()
Policer.Unit
unit()
The unit used within this policer.
-
-
-
Method Detail
-
deviceId
public DeviceId deviceId()
Description copied from interface:Policer
The device of this policer, where policing is applied.
-
applicationId
public ApplicationId applicationId()
Description copied from interface:Policer
The id of the application which created this policer.- Specified by:
applicationId
in interfacePolicer
- Returns:
- the identifier of the application
-
policerId
public PolicerId policerId()
Description copied from interface:Policer
The id of this policer.
-
isColorAware
public boolean isColorAware()
Description copied from interface:Policer
Indicates if this policer is aware of the marking indication in the ethernet frames. TODO Understand for the future how it is implemented by the vendors- Specified by:
isColorAware
in interfacePolicer
- Returns:
- true if this policer is color aware.
-
unit
public Policer.Unit unit()
Description copied from interface:Policer
The unit used within this policer.
-
tokenBuckets
public java.util.Collection<TokenBucket> tokenBuckets()
Description copied from interface:Policer
The token buckets used within this policer.- Specified by:
tokenBuckets
in interfacePolicer
- Returns:
- the list of the token buckets
-
description
public java.lang.String description()
Description copied from interface:Policer
Brief description of this policer.- Specified by:
description
in interfacePolicer
- Returns:
- human readable description
-
referenceCount
public long referenceCount()
Description copied from interface:Policer
Returns how many are referencing this policer. Availability of this information depends on the technology used for the implementation of this policer.- Specified by:
referenceCount
in interfacePolicer
- Returns:
- the reference count
-
setReferenceCount
public void setReferenceCount(long count)
Description copied from interface:PolicerEntry
Sets how many are using this policer.- Specified by:
setReferenceCount
in interfacePolicerEntry
- Parameters:
count
- a reference count.
-
processedPackets
public long processedPackets()
Description copied from interface:Policer
Stats which reports how many packets have been processed so far. Availability of this information depends on the technology used for the implementation of this policer.- Specified by:
processedPackets
in interfacePolicer
- Returns:
- the processed packets
-
setProcessedPackets
public void setProcessedPackets(long packets)
Description copied from interface:PolicerEntry
Updates the number of packets seen by this policer.- Specified by:
setProcessedPackets
in interfacePolicerEntry
- Parameters:
packets
- a packet count.
-
processedBytes
public long processedBytes()
Description copied from interface:Policer
Stats which reports how many bytes have been processed so far. Availability of this information depends on the technology used for the implementation of this policer.- Specified by:
processedBytes
in interfacePolicer
- Returns:
- the processed bytes
-
setProcessedBytes
public void setProcessedBytes(long bytes)
Description copied from interface:PolicerEntry
Updates the number of bytes seen by the policer.- Specified by:
setProcessedBytes
in interfacePolicerEntry
- Parameters:
bytes
- a byte counter.
-
life
public long life()
Description copied from interface:Policer
The lifetime in seconds of this policer. Availability of this information depends on the technology used for the implementation of this policer.
-
setLife
public void setLife(long l)
Description copied from interface:PolicerEntry
Set the amount of time the policer has existed in seconds.- Specified by:
setLife
in interfacePolicerEntry
- Parameters:
l
- number of seconds
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
builder
public static DefaultPolicer.Builder builder()
Returns a new builder reference.- Returns:
- a new builder
-
-