TokenBucketMeter¶
Package: inet.networklayer.diffserv
simple module TokenBucketMeter
Simple token bucket meter.
IP packets are classified according to two parameters, Committed Information Rate (cir), Committed Burst Size (cbs), to be either green or red.
Green traffic is guaranteed to be under (in bits)
cir * (t1 - t0) + 8 * cbs
in every [t0, t1] interval.
When operating in color-aware mode, the meter does not classify a packet to be green if it was marked with a higher color by a previous meter.
Usage diagram¶
Inheritance diagram¶
Used in compound modules¶
Name |
Type |
Description |
|---|---|---|
compound module |
This is an example queue that can be used in interfaces of DS core and edge nodes to support the AFxy (RFC 2597) and EF (RFC 3246) PHBs. |
Extends¶
Name |
Type |
Description |
|---|---|---|
simple module |
Base module for all INET simple modules. |
Parameters¶
Name |
Type |
Default value |
Description |
|---|---|---|---|
displayStringTextFormat |
string |
“{meterStatus}” |
Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information |
interfaceTableModule |
string |
The path to the InterfaceTable module |
|
cir |
string |
Committed information rate, either absolute bitrate (e.g. “100kbps”) or relative to the link’s datarate (e.g. “20%”) |
|
cbs |
int |
Committed burst size |
|
colorAwareMode |
bool |
false |
Enables color-aware mode |
Properties¶
Name |
Value |
Description |
|---|---|---|
class |
TokenBucketMeter |
|
display |
i=block/timer |
Gates¶
Name |
Direction |
Size |
Description |
|---|---|---|---|
in |
input |
||
greenOut |
output |
||
redOut |
output |
Source code¶
//
// Simple token bucket meter.
//
// IP packets are classified according to two parameters,
// Committed Information Rate (cir), Committed Burst Size (cbs),
// to be either green or red.
//
// Green traffic is guaranteed to be under (in bits)
// <pre>
// cir * (t1 - t0) + 8 * cbs
// </pre>
// in every [t0, t1] interval.
//
// When operating in color-aware mode, the meter does not classify
// a packet to be green if it was marked with a higher color
// by a previous meter.
//
simple TokenBucketMeter extends SimpleModule
{
parameters:
@class(TokenBucketMeter);
displayStringTextFormat = default("{meterStatus}");
@display("i=block/timer");
string interfaceTableModule; // The path to the InterfaceTable module
string cir; // Committed information rate, either absolute bitrate (e.g. "100kbps") or relative to the link's datarate (e.g. "20%")
int cbs @unit(B); // Committed burst size
bool colorAwareMode = default(false); // Enables color-aware mode
gates:
input in;
output greenOut;
output redOut;
}