The ns Manual (formerly ns Notes and Documentation)1 - NM Lab at ...
The ns Manual (formerly ns Notes and Documentation)1 - NM Lab at ... The ns Manual (formerly ns Notes and Documentation)1 - NM Lab at ...
9.2.3 PolicyClass Policy and its sub-classes (see dsPolicy.{cc, h}) define the policies used by edge routers to mark incomingpackets. A policy is established between a source and destination node. All flows matching that source-destination pair aretreated as a single traffic aggregate. Policy for each different traffic aggregate has an associated policer type, meter type, andinitial code point. The meter type specifies the method for measuring the state variables needed by the policer. For example,the TSW Tagger is a meter that measures the average traffic rate, using a specified time window.When a packet arrives at an edge router, it is examined to determine to which aggregate it belongs. The meter specified bythe corresponding policy is invoked to update all state variables. The policer is invoked to determine how to mark the packetdepending on the aggregate’s state variables: the specified initial code point or a downgraded code point. Then the packet isenqueued accordingly.Currently, six different policy models are defined:1. Time Sliding Window with 2 Color Marking (TSW2CMPolicer): uses a CIR and two drop precedences. The lowerprecedence is used probabilistically when the CIR is exceeded.2. Time Sliding Window with 3 Color Marking (TSW3CMPolicer): uses a CIR, a PIR, and three drop precedences. Themedium drop precedence is used probabilistically when the CIR is exceeded and the lowest drop precedence is usedprobabilistic ally when the PIR is exceeded.3. Token Bucket (tokenBucketPolicer): uses a CIR and a CBS and two drop precedences. An arriving packet is markedwith the lower precedence if and only if it is larger than the token bucket.4. Single Rate Three Color Marker (srTCMPolicer): uses a CIR, CBS, and an EBS to choose from three drop precedences.5. Two Rate Three Color Marker (trTCMPolicer): uses a CIR, CBS, PIR, and a PBS to choose from three drop precedences.6. NullPolicer: does not downgrade any packetsThe policies above are defined as a sub-classes of dsPolicy. The specific meter and policer are implemented in functionsapplyMeter and applyPolicer, which are defined as virtual functions in class dsPolicy. User specified policy canbe added in the similar way. Please refer to NullPolicy as the simplest example.All policies are stored in the policy table in class PolicyClassifier. This table is an array that includes fields for thesource and destination nodes, a policer type, a meter type, an initial code point, and various state information as shown below:The rates CIR and PIR are specified in bits per second:CIR: committed information ratePIR: peak information rateThe buckets CBS, EBS, and PBS are specified in bytes:CBS: committed burst sizeEBS: excess burst sizePBS: peak burst sizeC bucket: current size of the committed bucketE bucket: current size of the excess bucketP bucket: current size of the peak bucketArrival time of last packet89
Average sending rateTSW window lengthClass PolicyClassifier also contains a Policer Table to store the mappings from a policy type and initial code pointpair to its associated downgraded code point(s).9.3 ConfigurationThe number of physical and virtual queues can be configured as:$dsredq set numQueues_ 1$dsredq setNumPrec 2Variable numQueues_ in class dsREDQueue specifies the number of physical queues. It has a default value as 4 definedin ~ns/tcl/lib/ns-default.tcl and can be changed as shown in the example above. Variable setNumPrec sets the number ofvirtual queues within one physical queue.RED parameters can be configured for each virtual queue as follows:$dsredq configQ 0 1 10 20 0.10The mean packet size (in bytes) is also needed for the average RED queue length calculation.$dsredq meanPktSize 1500The variant of MRED used to calculate queue sizes can be configured.$dsredq setMREDMode RIO-C 0The above command sets the MRED mode of physical queue 0 to RIO-C. If the second argument was not included, all queueswould 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 allvirtual queues; while the probability of dropping an in-profile packet is based solely on the weighted average length ofits virtual queue.RIO-D (RIO De-coupled): Similar to RIO-C; except the probability of dropping an out-of-profile packet is based on thesize 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 theminimum 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 190
- Page 39 and 40: Chapter 4The Class SimulatorThe ove
- Page 41 and 42: 4.2.2 the heap schedulerThe heap sc
- Page 43 and 44: 4.4 Commands at a glanceSynopsis:ns
- Page 45 and 46: $ns_ dumpqCommand for dumping event
- Page 47 and 48: NODEPortClassifierAgentAgentAddrCla
- Page 49 and 50: The Node instance variable, entry_,
- Page 51 and 52: The default values for all the abov
- Page 53 and 54: The classify() method is pure virtu
- Page 55 and 56: };The class imposes no direct seman
- Page 57 and 58: flow-specific queuing disciplines a
- Page 59 and 60: 5.5 Routing Module and Classifier O
- Page 61 and 62: Module NameRtModule/BaseRtModule/Mc
- Page 63 and 64: $node neighborsThis returns the lis
- Page 65 and 66: Linkhead_enqT_queue_ deqT_ link_ tt
- Page 67 and 68: 6.2 ConnectorsConnectors, unlink cl
- Page 69 and 70: $ns_ link-lossmodel This function
- Page 71 and 72: Chapter 7Queue Management and Packe
- Page 73 and 74: }}}void Queue::resume(){Packet* p =
- Page 75 and 76: 7.3 Different types of Queue object
- Page 77 and 78: maxidle_ is the maximum amount of t
- Page 79 and 80: dst_ The destination address of pac
- Page 81 and 82: 7.5.2 ConfigurationRunning a JoBS s
- Page 83 and 84: mean_pkt_size_ Used to set the expe
- Page 85 and 86: Demarker objects$q trace-file This
- Page 87 and 88: The recv() method overrides the bas
- Page 89: 9.2 ImplementationThe procedures an
- Page 93 and 94: The following command adds an entry
- Page 95 and 96: $qCE configQ 0 1 10 20 0.10Note tha
- Page 97 and 98: Chapter 10AgentsAgents represent en
- Page 99 and 100: CtrMcast/EncapCtrMcast/DecapMessage
- Page 101 and 102: }bind("windowOption_", &wnd_option_
- Page 103 and 104: hdr_flags* nf = (hdr_flags*)npkt->a
- Page 105 and 106: public:ECHO_Timer(ECHO_Agent *a) :
- Page 107 and 108: 10.6.4 Using the agent through OTcl
- Page 109 and 110: State Variables are:dupacks_ Number
- Page 111 and 112: $agent attach-tbf Attaches a token
- Page 113 and 114: (void)Scheduler::instance().schedul
- Page 115 and 116: * outstanding, cancel it.*/void Tcp
- Page 117 and 118: Chapter 12Packet Headers and Format
- Page 119 and 120: method is now obsolete; its usage i
- Page 121 and 122: Packethdrsize_next_bits()points to
- Page 123 and 124: the system’s memory allocator. In
- Page 125 and 126: }incr hdrlen_ $incrreturn $baseFrom
- Page 127 and 128: Chapter 13Error ModelThis chapter d
- Page 129 and 130: SimpleLink::errormodule argsSimulat
- Page 131 and 132: This is a simple example of how to
- Page 133 and 134: Higher LayersNode 1Node 2. . .Node
- Page 135 and 136: };void recv(Packet* p, Handler*);vi
- Page 137 and 138: and the frame type. It then passes
- Page 139 and 140: $ll_ set delay_ $delay$ll_ set band
9.2.3 PolicyClass Policy <strong>and</strong> its sub-classes (see dsPolicy.{cc, h}) define the policies used by edge routers to mark incomingpackets. A policy is established between a source <strong>and</strong> destin<strong>at</strong>ion node. All flows m<strong>at</strong>ching th<strong>at</strong> source-destin<strong>at</strong>ion pair aretre<strong>at</strong>ed as a single traffic aggreg<strong>at</strong>e. Policy for each different traffic aggreg<strong>at</strong>e has an associ<strong>at</strong>ed policer type, meter type, <strong>and</strong>initial code point. <strong>The</strong> meter type specifies the method for measuring the st<strong>at</strong>e variables needed by the policer. For example,the TSW Tagger is a meter th<strong>at</strong> measures the average traffic r<strong>at</strong>e, using a specified time window.When a packet arrives <strong>at</strong> an edge router, it is examined to determine to which aggreg<strong>at</strong>e it belongs. <strong>The</strong> meter specified bythe corresponding policy is invoked to upd<strong>at</strong>e all st<strong>at</strong>e variables. <strong>The</strong> policer is invoked to determine how to mark the packetdepending on the aggreg<strong>at</strong>e’s st<strong>at</strong>e variables: the specified initial code point or a downgraded code point. <strong>The</strong>n the packet isenqueued accordingly.Currently, six different policy models are defined:1. Time Sliding Window with 2 Color Marking (TSW2CMPolicer): uses a CIR <strong>and</strong> two drop precedences. <strong>The</strong> lowerprecedence is used probabilistically when the CIR is exceeded.2. Time Sliding Window with 3 Color Marking (TSW3CMPolicer): uses a CIR, a PIR, <strong>and</strong> three drop precedences. <strong>The</strong>medium drop precedence is used probabilistically when the CIR is exceeded <strong>and</strong> the lowest drop precedence is usedprobabilistic ally when the PIR is exceeded.3. Token Bucket (tokenBucketPolicer): uses a CIR <strong>and</strong> a CBS <strong>and</strong> two drop precedences. An arriving packet is markedwith the lower precedence if <strong>and</strong> only if it is larger than the token bucket.4. Single R<strong>at</strong>e Three Color Marker (srTCMPolicer): uses a CIR, CBS, <strong>and</strong> an EBS to choose from three drop precedences.5. Two R<strong>at</strong>e Three Color Marker (trTCMPolicer): uses a CIR, CBS, PIR, <strong>and</strong> a PBS to choose from three drop precedences.6. NullPolicer: does not downgrade any packets<strong>The</strong> policies above are defined as a sub-classes of dsPolicy. <strong>The</strong> specific meter <strong>and</strong> policer are implemented in functio<strong>ns</strong>applyMeter <strong>and</strong> applyPolicer, which are defined as virtual functio<strong>ns</strong> in class dsPolicy. User specified policy canbe added in the similar way. Please refer to NullPolicy as the simplest example.All policies are stored in the policy table in class PolicyClassifier. This table is an array th<strong>at</strong> includes fields for thesource <strong>and</strong> destin<strong>at</strong>ion nodes, a policer type, a meter type, an initial code point, <strong>and</strong> various st<strong>at</strong>e inform<strong>at</strong>ion as shown below:<strong>The</strong> r<strong>at</strong>es CIR <strong>and</strong> PIR are specified in bits per second:CIR: committed inform<strong>at</strong>ion r<strong>at</strong>ePIR: peak inform<strong>at</strong>ion r<strong>at</strong>e<strong>The</strong> buckets CBS, EBS, <strong>and</strong> PBS are specified in bytes:CBS: committed burst sizeEBS: excess burst sizePBS: peak burst sizeC bucket: current size of the committed bucketE bucket: current size of the excess bucketP bucket: current size of the peak bucketArrival time of last packet89