9.3 Configuration

The number of physical and virtual queues can be configured as:

$dsredq set numQueues_ 1

$dsredq setNumPrec 2

Variable numQueues_ in class dsREDQueue specifies the number of physical queues. It has a default value as 4 defined in ~ns/tcl/lib/ns-default.tcl and can be changed as shown in the example above. Variable setNumPrec sets the number of virtual queues within one physical queue.

RED parameters can be configured for each virtual queue as follows:

$dsredq configQ 0 1 10 20 0.10

The mean packet size (in bytes) is also needed for the average RED queue length calculation.

$dsredq meanPktSize 1500

The variant of MRED used to calculate queue sizes can be configured.

$dsredq setMREDMode RIO-C 0

The above command sets the MRED mode of physical queue 0 to RIO-C. If the second argument was not included, all queues would be set to RIO-C which is the default.

The various MRED modes supported in DiffServ module are:

RIO-C (RIO Coupled):
The probability of dropping an out-of-profile packet is based on the weighted average lengths of all virtual queues; while the probability of dropping an in-profile packet is based solely on the weighted average length of its virtual queue.

RIO-D (RIO De-coupled):
Similar to RIO-C; except the probability of dropping an out-of-profile packet is based on the size of its virtual queue.

WRED (Weighted RED):
All probabilities are based on a single queue length.

DROP:
Same as a drop tail queue with queue limit set by RED minimum threshold: when the queue size reaches the minimum threshold, all packets are dropped regardless of marking.

The following command adds an entry to the PHB Table and maps code point 11 to physical queue 0 and virtual queue 1.

$dsredq addPHBEntry 11 0 1

In ns, packets are defaulted to a code point of zero. Therefore, user must add a PHB entry for the zero code point in order to handle best effort traffic.

In addition, commands are available to allow the user to choose the scheduling mode between physical queues. For example:

$dsredq setSchedularMode WRR

$dsredq addQueueWeights 1 5

The above pair of commands sets the scheduling mode to Weighted Round Robin and the weight for queue 1 to 5. Other scheduling modes supported are Weighted Interleaved Round Robin (WIRR), Round Robin (RR), and Priority (PRI). The default scheduling mode is Round Robin.

For Priority scheduling, priority is arranged in sequential order with queue 0 having the highest priority. Also, one can set the a limit on the maximum bandwidth a particular queue can get using as follows:

$dsredq setSchedularMode PRI

$dsredq addQueueRate 0 5000000

These commands specify the maximum bandwidth that queue 0 can consume is 5Mb.

The addPolicyEntry command is used to add an entry to the Policy Table. It takes different parameters depending on what policer type is used. The first two parameters after the command name are always the source and destination node IDs, and the next parameter is the policer type. Following the policer type are the parameters needed by that policer as summarized below:

Null Initial code point        
TSW2CM Initial code point CIR      
TSW3CM Initial code point CIR PIR    
TokenBucket Initial code point CIR CBS    
srTCM Initial code point CIR CBS EBS  
trTCM Initial code point CIR CBS PIR PBS

Note that the Null policer requires only the initial code point. Since this policer does not downgrade packets, other information is not necessary. Consider a Tcl script for which $q is a variable for an edge queue, and $s and $d are source and destination nodes. The following command adds a TSW2CM policer for traffic going from the source to the destination:

$q addPolicyEntry [$s id] [$d id] TSW2CM 10 2000000

Other parameters could be used for different policers in place of "TSW2CM":

Null 10        
TSW3CM 10 2000000 3000000    
TokenBucket 10 2000000 10000    
srTCM 10 2000000 10000 20000  
trTCM 10 2000000 10000 3000000 10000

Note, however, that only one policy can be applied to any source destination pair.

The following command adds an entry to the Policer Table, specifying that the trTCM has initial (green) code point 10, downgraded (yellow) code point 11 and further downgraded (red) code point 12:

$dsredq addPolicerEntry trTCM 10 11 12

There must be a Policer Table entry in place for every policer type and initial code point pair. It should be noticed that the Null policer is added in the following way:

$dsredq addPolicerEntry Null 10

Downgrade code points are not specified because the Null policy does not meter traffic characteristics.

Queries supported:

Output entires in Policy Table, one line at a time:

$dsredq printPolicyTable

Output entires in Policer Table, one line at a time:

$dsredq printPolicerTable

Output entries in PHB table, one line at a time:

$dsredq printPHBTable

Packets statistic results:

$dsredq printStats

Sample output:

Packets Statistics
CP TotPkts TxPkts ldrops edrops
All 249126 249090 21 15
10 150305 150300 0 5
20 98821 98790 21 10

CP: code point

TotPkts: packets received

TxPkts: packets sent

ldrops: packets are dropped due to link overflow

edrops: RED early dropping).

Returns the RED weighted average size of the specified physical queue:

$dsredq getAverage 0

Returns the current size of the C Bucket (in bytes):

$dsredq getCBucket

Tom Henderson 2011-11-05