Class DefaultPolicer

  • All Implemented Interfaces:
    Policer, PolicerEntry

    @Beta
    public final class DefaultPolicer
    extends java.lang.Object
    implements Policer, PolicerEntry
    Default implementation of the policer interface.
    • Method Detail

      • deviceId

        public DeviceId deviceId()
        Description copied from interface: Policer
        The device of this policer, where policing is applied.
        Specified by:
        deviceId in interface Policer
        Returns:
        the device id
      • applicationId

        public ApplicationId applicationId()
        Description copied from interface: Policer
        The id of the application which created this policer.
        Specified by:
        applicationId in interface Policer
        Returns:
        the identifier of the application
      • policerId

        public PolicerId policerId()
        Description copied from interface: Policer
        The id of this policer.
        Specified by:
        policerId in interface Policer
        Returns:
        the policer id
      • 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 interface Policer
        Returns:
        true if this policer is color aware.
      • unit

        public Policer.Unit unit()
        Description copied from interface: Policer
        The unit used within this policer.
        Specified by:
        unit in interface Policer
        Returns:
        the unit
      • tokenBuckets

        public java.util.Collection<TokenBucket> tokenBuckets()
        Description copied from interface: Policer
        The token buckets used within this policer.
        Specified by:
        tokenBuckets in interface Policer
        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 interface Policer
        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 interface Policer
        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 interface PolicerEntry
        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 interface Policer
        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 interface PolicerEntry
        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 interface Policer
        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 interface PolicerEntry
        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.
        Specified by:
        life in interface Policer
        Returns:
        number of seconds
      • 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 interface PolicerEntry
        Parameters:
        l - number of seconds
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • builder

        public static DefaultPolicer.Builder builder()
        Returns a new builder reference.
        Returns:
        a new builder