9.4 Commands at a glance

The following is a list of related commands commonly used in simulation scripts:

\\$ns simplex-link \\$edge \\$core 10Mb 5ms dsRED/edge
\\$ns simplex-link \\$core \\$edge 10Mb 5ms dsRED/core

These two commands create the queues along the link between an edge router and a core router.

set qEC [[\\$ns link \\$edge \\$core] queue]

# Set DS RED parameters from Edge to Core:
\\$qEC meanPktSize \\$packetSize
\\$qEC set numQueues\_ 1
\\$qEC setNumPrec 2
\\$qEC addPolicyEntry [\$s1 id] [\$dest id] TokenBucket 10 \$cir0 \$cbs0
\\$qEC addPolicyEntry [\$s2 id] [\$dest id] TokenBucket 10 \$cir1 \$cbs1
\\$qEC addPolicerEntry TokenBucket 10 11
\\$qEC addPHBEntry 10 0 0
\\$qEC addPHBEntry 11 0 1
\\$qEC configQ 0 0 20 40 0.02
\\$qEC configQ 0 1 10 20 0.10

This block of code obtains handle to the DiffServ queue from an edge router to a core router and configures all of the parameters for it.

The meanPktSize command is required for the RED state variables to be calculated accurately. Setting the number of physical queues and precedence levels is optional, but it aids efficiency. Because neither the scheduling or MRED mode type are set, they default to Round Robin scheduling and RIO-C Active Queue Management.

The addPolicyEntry commands establish two policies at the edge queue: one between nodes S1 and Dest and one between nodes S2 and Dest. Note that the [$s1 id] command returns the ID value needed by addPolicyEntry. The CIR and CBS values used in the policies are the ones set at the beginning of the script.

The addPolicerEntry line is required because each policer type and initial code point pair requires an entry in the Policer Table. Each of the policies uses the same policer and initial code point, so only one entry is needed.

The addPHBEntry commands map each code point to a combination of physical and virtual queue. Although each code point in this example maps to a unique combination of physical and virtual queue, multiple code points could receive identical treatment.

Finally, the configQ commands set the RED parameters for each virtual queue. It specifies the virtual queue by first two parameters, for example, 0 and 1. The next three parameters are the minimum threshold, maximum threshold, and the maximum dropping probability. Note that as the precedence value increases, the RED parameters become harsher.


set qCE [[\\$ns link \\$core \\$e1] queue]

# Set DS RED parameters from Core to Edge:
\\$qCE meanPktSize \\$packetSize
\\$qCE set numQueues\_ 1
\\$qCE setNumPrec 2
\\$qCE addPHBEntry 10 0 0
\\$qCE addPHBEntry 11 0 1
\\$qCE configQ 0 0 20 40 0.02
\\$qCE configQ 0 1 10 20 0.10

Note that the configuration of a core queue matches that of an edge queue, except that there is no Policy Table or Policer Table to configure at a core router. A core router's chief requirement is that it has a PHB entry for all code points that it will see.

\\$qE1C printPolicyTable
\\$qCE2 printCoreStats

These methods output the policy or policer tables on link and different statistics.

For further information, please refer to the example scripts under ~ns/tcl/ex/diffserv. %

Tom Henderson 2011-11-05