|   | 1 | [wiki:WikiStart Orbit] > [wiki:Documentation/OtherApps Other Applications] > ITG Scripts | 
          
          
            |   | 2 |  | 
          
          
            |   | 3 | = Application Definition Schema =  | 
          
          
            |   | 4 | The application definition schema for the ITG application is as follows | 
          
          
            |   | 5 | {{{ | 
          
          
            |   | 6 | <?xml version="1.0" encoding="UTF-8"?> | 
          
          
            |   | 7 | <orbit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="H:\Orbit\Oml\docs\definitions\application\app_def.xsd"> | 
          
          
            |   | 8 |         <application id="orbit_winlab_itg"> | 
          
          
            |   | 9 |                 <name>ITG</name> | 
          
          
            |   | 10 |                 <id>ITG</id> | 
          
          
            |   | 11 |                 <version major="0" minor="1" revision="0"/> | 
          
          
            |   | 12 |                 <organization> | 
          
          
            |   | 13 |                         <name>WINLAB, Rutgers University</name> | 
          
          
            |   | 14 |                         <url>http://www.winlab.rutgers.edu/</url> | 
          
          
            |   | 15 |                 </organization> | 
          
          
            |   | 16 |                 <shortDescription>Receive network traffic</shortDescription> | 
          
          
            |   | 17 |                 <description> | 
          
          
            |   | 18 | Receive network traffic on the specified interface | 
          
          
            |   | 19 |        </description> | 
          
          
            |   | 20 |                 <url>http://apps.orbit-lab.org/itg</url> | 
          
          
            |   | 21 |                 <properties> | 
          
          
            |   | 22 |                         <property> | 
          
          
            |   | 23 |                                 <name>network_interface</name> | 
          
          
            |   | 24 |                                 <mnemonic>i</mnemonic> | 
          
          
            |   | 25 |                                 <type>xsd:string</type> | 
          
          
            |   | 26 |                                 <dynamic>no</dynamic> | 
          
          
            |   | 27 |                                 <description>Device name for sending network traffic</description> | 
          
          
            |   | 28 |                         </property> | 
          
          
            |   | 29 |                         <property> | 
          
          
            |   | 30 |                                 <name>pipe name</name> | 
          
          
            |   | 31 |                                 <mnemonic>p</mnemonic> | 
          
          
            |   | 32 |                                 <type>xsd:string</type> | 
          
          
            |   | 33 |                                 <dynamic>no</dynamic> | 
          
          
            |   | 34 |                                 <description>iinterface for changing generator properties</description> | 
          
          
            |   | 35 |                         </property> | 
          
          
            |   | 36 |                 </properties> | 
          
          
            |   | 37 |                 <measurement-points> | 
          
          
            |   | 38 |                         <measurement-point id="decoderport"> | 
          
          
            |   | 39 |                                 <metric id="flow_no" type="int"> | 
          
          
            |   | 40 |                                         <description>id of the stream</description> | 
          
          
            |   | 41 |                                 </metric> | 
          
          
            |   | 42 |                                 <metric id="src_port" type="int"> | 
          
          
            |   | 43 |                                         <description>source port</description> | 
          
          
            |   | 44 |                                 </metric> | 
          
          
            |   | 45 |                                 <metric id="dst_port" type="int"> | 
          
          
            |   | 46 |                                         <description>Destination port</description> | 
          
          
            |   | 47 |                                 </metric> | 
          
          
            |   | 48 |                                 <metric id="throughput" type="float"> | 
          
          
            |   | 49 |                                         <description>Flow Throughput</description> | 
          
          
            |   | 50 |                                 </metric> | 
          
          
            |   | 51 |                                 <metric id="jitter" type ="float"> | 
          
          
            |   | 52 |                                      <description>Flow jitter</description>  | 
          
          
            |   | 53 |                                 </metric> | 
          
          
            |   | 54 |                                 <metric id="delay" type="float"> | 
          
          
            |   | 55 |                                         <description>flow delay</description> | 
          
          
            |   | 56 |                                 </metric> | 
          
          
            |   | 57 |                                 <metric id="pkt_loss" type="float"> | 
          
          
            |   | 58 |                                         <description>Pkt loss for flow</description> | 
          
          
            |   | 59 |                                 </metric>    | 
          
          
            |   | 60 |                         </measurement-point> | 
          
          
            |   | 61 |                 </measurement-points> | 
          
          
            |   | 62 |                 <issueTrackingUrl> | 
          
          
            |   | 63 |           http://apps.orbit-lab.org/issues/winlab/renny | 
          
          
            |   | 64 |        </issueTrackingUrl> | 
          
          
            |   | 65 |                 <repository> | 
          
          
            |   | 66 |                         <development>scm:cvs:pserver:anoncvs@cvs.orbit-lab.org:/trafficgenerator/renny</development> | 
          
          
            |   | 67 |                         <binary>apt:repository.orbit-lab.org/orbit/binary:???</binary> | 
          
          
            |   | 68 |                 </repository> | 
          
          
            |   | 69 |                 <mailingLists/> | 
          
          
            |   | 70 |                 <developers> | 
          
          
            |   | 71 |                         <developer> | 
          
          
            |   | 72 |                                 <name>John Doe</name> | 
          
          
            |   | 73 |                                 <id>jdoe</id> | 
          
          
            |   | 74 |                                 <email>jdoe@winlab.rutgers.edu</email> | 
          
          
            |   | 75 |                                 <organization> | 
          
          
            |   | 76 |                                         <name>WINLAB, Rutgers University</name> | 
          
          
            |   | 77 |                                 </organization> | 
          
          
            |   | 78 |                         </developer> | 
          
          
            |   | 79 |                 </developers> | 
          
          
            |   | 80 |                 <dependencies> | 
          
          
            |   | 81 |                         <dependency> | 
          
          
            |   | 82 |                                 <id>libmac</id> | 
          
          
            |   | 83 |                                 <version>>= 0.4</version> | 
          
          
            |   | 84 |                                 <url>apt:repository.orbit-lab.org/debian/binary:libmac</url> | 
          
          
            |   | 85 |                         </dependency> | 
          
          
            |   | 86 |                 </dependencies> | 
          
          
            |   | 87 |         </application> | 
          
          
            |   | 88 | </orbit> | 
          
          
            |   | 89 |  | 
          
          
            |   | 90 |  | 
          
          
            |   | 91 | }}} | 
          
          
            |   | 92 |  | 
          
          
            |   | 93 | = Application definition script for Iperf sender and Receiver = | 
          
          
            |   | 94 |  | 
          
          
            |   | 95 | == ITG Sender == | 
          
          
            |   | 96 | {{{ | 
          
          
            |   | 97 |  | 
          
          
            |   | 98 | # | 
          
          
            |   | 99 | # Create an application representation from scratch | 
          
          
            |   | 100 | # | 
          
          
            |   | 101 | require 'appDefinition' | 
          
          
            |   | 102 |  | 
          
          
            |   | 103 | a = AppDefinition.create('test:app:itgs') | 
          
          
            |   | 104 | a.name = "itgs" | 
          
          
            |   | 105 | a.version(0, 0, 1) | 
          
          
            |   | 106 | a.shortDescription = "D-ITG Sender" | 
          
          
            |   | 107 | a.description = <<TEXT | 
          
          
            |   | 108 | ITGSend is a traffic generator for TCP and UDP traffic. It contains generators producing various forms of packet streams and port for sending these packets via various transports, such as TCP and UDP. | 
          
          
            |   | 109 | TEXT | 
          
          
            |   | 110 |  | 
          
          
            |   | 111 | # addProperty(name, description, mnemonic, type, isDynamic = false, constraints = nil) | 
          
          
            |   | 112 |  | 
          
          
            |   | 113 | #Flow options | 
          
          
            |   | 114 | a.addProperty('m', 'Measurement type: either onewaydelay or RTT', ?m, String, false) | 
          
          
            |   | 115 | a.addProperty('a', 'Destination address', ?a, String, false) | 
          
          
            |   | 116 | a.addProperty('r', 'Remote port', ?r, Integer, false) | 
          
          
            |   | 117 | a.addProperty('T', 'Protocol type TCP or UDP', ?T, Integer, false) | 
          
          
            |   | 118 | a.addProperty('f', 'TTL',?f, Integer, false) | 
          
          
            |   | 119 | a.addProperty('d', 'Gen_Delay',?d, Integer, false) | 
          
          
            |   | 120 | a.addProperty('t', "Duration of traffic generation(millisecs)", ?t, Integer, false) | 
          
          
            |   | 121 |  | 
          
          
            |   | 122 | #Interdeparture time options | 
          
          
            |   | 123 | a.addProperty('C', 'Constant interdeparture time b/w packets (pkts_per_s)', ?C, Integer, false) | 
          
          
            |   | 124 | a.addProperty('E', '(Exponential) Average packets per sec', ?E, Integer, false) | 
          
          
            |   | 125 | a.addProperty('O', '(Poisson) Average pkts per sec', ?O, Integer, false) | 
          
          
            |   | 126 |  | 
          
          
            |   | 127 | #Note that Pareto, Cauchy, UNiform, Normal and Gamma distributions will # be added | 
          
          
            |   | 128 |  | 
          
          
            |   | 129 | #Log file options | 
          
          
            |   | 130 | a.addProperty('l', 'Log file', ?l, String, false) | 
          
          
            |   | 131 |  | 
          
          
            |   | 132 | #Packet size options | 
          
          
            |   | 133 | a.addProperty('c', 'Constant payload size', ?c, Integer, false) | 
          
          
            |   | 134 | a.addProperty('e', "Average pkt size (exponential)", ?e, Integer, false) | 
          
          
            |   | 135 | a.addProperty('o', "Poisson distributed avg. pkt size", ?o, Integer, false) | 
          
          
            |   | 136 |  | 
          
          
            |   | 137 | #Note that Pareto, Cauchy, UNiform, Normal and Gamma distributions will # be added | 
          
          
            |   | 138 |  | 
          
          
            |   | 139 | # Applications (note that no other interdeparture or packet size can be #chosen if an application is chosen | 
          
          
            |   | 140 | a.addProperty('App', 'VoIP traffic', ?Z, Integer, false) | 
          
          
            |   | 141 | a.addProperty('codec', 'VoIP codec: G.711.1, G.711.2, G.723.1, G.729.2, G.729.3', ?i, Integer, false) | 
          
          
            |   | 142 | a.addProperty('voip_control', 'protocol_type RTP or CRTP',?h, String, false) | 
          
          
            |   | 143 |  | 
          
          
            |   | 144 | a.addProperty('Telnet', 'Telnet traffic', nil, Integer, false) | 
          
          
            |   | 145 | a.addProperty('DNS', 'DNS traffic', nil, Integer, false) | 
          
          
            |   | 146 |  | 
          
          
            |   | 147 | a.path = "/usr/local/bin/ITGSend" | 
          
          
            |   | 148 |  | 
          
          
            |   | 149 | if $0 == __FILE__ | 
          
          
            |   | 150 |   require 'stringio' | 
          
          
            |   | 151 |   require 'rexml/document' | 
          
          
            |   | 152 |   include REXML | 
          
          
            |   | 153 |      | 
          
          
            |   | 154 |   sio = StringIO.new() | 
          
          
            |   | 155 |   a.to_xml.write(sio, 2) | 
          
          
            |   | 156 |   sio.rewind | 
          
          
            |   | 157 |   puts sio.read | 
          
          
            |   | 158 |    | 
          
          
            |   | 159 |   sio.rewind | 
          
          
            |   | 160 |   doc = Document.new(sio) | 
          
          
            |   | 161 |   t = AppDefinition.from_xml(doc.root) | 
          
          
            |   | 162 |    | 
          
          
            |   | 163 |   puts | 
          
          
            |   | 164 |   puts "-------------------------" | 
          
          
            |   | 165 |   puts | 
          
          
            |   | 166 |   t.to_xml.write($stdout, 2) | 
          
          
            |   | 167 |    | 
          
          
            |   | 168 | end | 
          
          
            |   | 169 |  | 
          
          
            |   | 170 |  | 
          
          
            |   | 171 | }}} | 
          
          
            |   | 172 | == ITG Receiver == | 
          
          
            |   | 173 | {{{ | 
          
          
            |   | 174 | # | 
          
          
            |   | 175 | # Create an application representation from scratch | 
          
          
            |   | 176 | # | 
          
          
            |   | 177 | require 'appDefinition' | 
          
          
            |   | 178 |  | 
          
          
            |   | 179 | a = AppDefinition.create('test:app:itgr') | 
          
          
            |   | 180 | a.name = "itgr" | 
          
          
            |   | 181 | a.version(0, 0, 1) | 
          
          
            |   | 182 | a.shortDescription = "D-ITG Receiver" | 
          
          
            |   | 183 | a.description = <<TEXT | 
          
          
            |   | 184 | D-ITG is a traffic generator for TCP and UDP traffic. It contains generators  | 
          
          
            |   | 185 | producing various forms of packet streams and port for sending | 
          
          
            |   | 186 | these packets via various transports, such as TCP and UDP. | 
          
          
            |   | 187 | TEXT | 
          
          
            |   | 188 |  | 
          
          
            |   | 189 | # addProperty(name, description, mnemonic, type, isDynamic = false, constraints = nil) | 
          
          
            |   | 190 | #Flow options | 
          
          
            |   | 191 | a.addProperty('l', 'Log file', ?l, String, false) | 
          
          
            |   | 192 |  | 
          
          
            |   | 193 | a.path = "/usr/local/bin/ITGRecv" | 
          
          
            |   | 194 |  | 
          
          
            |   | 195 | if $0 == __FILE__ | 
          
          
            |   | 196 |   require 'stringio' | 
          
          
            |   | 197 |   require 'rexml/document' | 
          
          
            |   | 198 |   include REXML | 
          
          
            |   | 199 |      | 
          
          
            |   | 200 |   sio = StringIO.new() | 
          
          
            |   | 201 |   a.to_xml.write(sio, 2) | 
          
          
            |   | 202 |   sio.rewind | 
          
          
            |   | 203 |   puts sio.read | 
          
          
            |   | 204 |    | 
          
          
            |   | 205 |   sio.rewind | 
          
          
            |   | 206 |   doc = Document.new(sio) | 
          
          
            |   | 207 |   t = AppDefinition.from_xml(doc.root) | 
          
          
            |   | 208 |    | 
          
          
            |   | 209 |   puts | 
          
          
            |   | 210 |   puts "-------------------------" | 
          
          
            |   | 211 |   puts | 
          
          
            |   | 212 |   t.to_xml.write($stdout, 2) | 
          
          
            |   | 213 |    | 
          
          
            |   | 214 | end | 
          
          
            |   | 215 |  | 
          
          
            |   | 216 | }}} | 
          
          
            |   | 217 |  | 
          
          
            |   | 218 | == ITG Decoder == | 
          
          
            |   | 219 | {{{ | 
          
          
            |   | 220 | # | 
          
          
            |   | 221 | # Create an application representation from scratch | 
          
          
            |   | 222 | # | 
          
          
            |   | 223 | require 'appDefinition' | 
          
          
            |   | 224 |  | 
          
          
            |   | 225 | a = AppDefinition.create('test:app:itgdec') | 
          
          
            |   | 226 | a.name = "itgdec" | 
          
          
            |   | 227 | a.version(0, 0, 1) | 
          
          
            |   | 228 | a.shortDescription = "D-ITG Decoder" | 
          
          
            |   | 229 | a.description = <<TEXT | 
          
          
            |   | 230 | This program decodes the output of the experiment | 
          
          
            |   | 231 | TEXT | 
          
          
            |   | 232 |  | 
          
          
            |   | 233 | # addProperty(name, description, mnemonic, type, isDynamic = false, constraints = nil) | 
          
          
            |   | 234 | a.addProperty('logfile', 'Log file', ?x , String, false) | 
          
          
            |   | 235 | a.addProperty('d', 'Delay interval size (msec)', ?d, Integer, false) | 
          
          
            |   | 236 | a.addProperty('j', 'Jitter Interval size (msec)', ?j, Integer, false) | 
          
          
            |   | 237 | a.addProperty('b', 'Bitrate interval size (msec)', ?b, Integer, false) | 
          
          
            |   | 238 | a.addProperty('p', 'Packet loss interval size(msec)', ?p, Integer, false) | 
          
          
            |   | 239 |  | 
          
          
            |   | 240 | a.addMeasurement("decoderport", nil, [ | 
          
          
            |   | 241 |     ['flow_no', 'int'], | 
          
          
            |   | 242 |     ['src_port', 'int'], | 
          
          
            |   | 243 |     ['dst_port', 'int'], | 
          
          
            |   | 244 |     ['throughput', Float], | 
          
          
            |   | 245 |     ['jitter', Float], | 
          
          
            |   | 246 |     ['delay', Float], | 
          
          
            |   | 247 |     ['pkt_loss', Float] | 
          
          
            |   | 248 |  ]) | 
          
          
            |   | 249 |  | 
          
          
            |   | 250 | a.path = "/usr/local/bin/ITGDec" | 
          
          
            |   | 251 |  | 
          
          
            |   | 252 | if $0 == __FILE__ | 
          
          
            |   | 253 |   require 'stringio' | 
          
          
            |   | 254 |   require 'rexml/document' | 
          
          
            |   | 255 |   include REXML | 
          
          
            |   | 256 |      | 
          
          
            |   | 257 |   sio = StringIO.new() | 
          
          
            |   | 258 |   a.to_xml.write(sio, 2) | 
          
          
            |   | 259 |   sio.rewind | 
          
          
            |   | 260 |   puts sio.read | 
          
          
            |   | 261 |    | 
          
          
            |   | 262 |   sio.rewind | 
          
          
            |   | 263 |   doc = Document.new(sio) | 
          
          
            |   | 264 |   t = AppDefinition.from_xml(doc.root) | 
          
          
            |   | 265 |    | 
          
          
            |   | 266 |   puts | 
          
          
            |   | 267 |   puts "-------------------------" | 
          
          
            |   | 268 |   puts | 
          
          
            |   | 269 |   t.to_xml.write($stdout, 2) | 
          
          
            |   | 270 |    | 
          
          
            |   | 271 | end | 
          
          
            |   | 272 | }}} | 
          
          
            |   | 273 | = Sample prototype definitions script for ITG UDP CBR(sender and Receiver) = | 
          
          
            |   | 274 |  | 
          
          
            |   | 275 | == ITG CBR UDP Sender == | 
          
          
            |   | 276 | {{{ | 
          
          
            |   | 277 | # | 
          
          
            |   | 278 | # Define a prototype | 
          
          
            |   | 279 | # | 
          
          
            |   | 280 | require 'prototype' | 
          
          
            |   | 281 | require 'filter' | 
          
          
            |   | 282 | require 'appDefinition' | 
          
          
            |   | 283 |  | 
          
          
            |   | 284 | p = Prototype.create("test:proto:itgcbrsender") | 
          
          
            |   | 285 | p.name = "ITG Sender" | 
          
          
            |   | 286 | p.description = "Nodes which send a stream of packets" | 
          
          
            |   | 287 | p.defProperty('meter', 'one way delay or RTT', 'owdm') | 
          
          
            |   | 288 | p.defProperty('protocol', 'Protocol to use', 'udp') | 
          
          
            |   | 289 | p.defProperty('destinationHost', 'Host to send packets to') | 
          
          
            |   | 290 | p.defProperty('constsize', 'Size of packets', 1000) | 
          
          
            |   | 291 | p.defProperty('constrate', 'Number of bits per second', 1000) | 
          
          
            |   | 292 | p.defProperty('duration', 'Time for sending (millisec)', 1000) | 
          
          
            |   | 293 | p.defProperty('gen_delay', 'Generation delay (millisec)', 10000) | 
          
          
            |   | 294 | p.defProperty('recv_port', 'Receiver_port', 8000) | 
          
          
            |   | 295 |  | 
          
          
            |   | 296 | itgs = p.addApplication(:itgs, "test:app:itgs") | 
          
          
            |   | 297 | itgs.bindProperty('m','meter') | 
          
          
            |   | 298 | itgs.bindProperty('T','protocol') | 
          
          
            |   | 299 | itgs.bindProperty('a', 'destinationHost') | 
          
          
            |   | 300 | itgs.bindProperty('c', 'constsize') | 
          
          
            |   | 301 | itgs.bindProperty('C', 'constrate') | 
          
          
            |   | 302 | itgs.bindProperty('t', 'duration') | 
          
          
            |   | 303 | itgs.bindProperty('d', 'gen_delay') | 
          
          
            |   | 304 | itgs.bindProperty('r', 'recv_port') | 
          
          
            |   | 305 |  | 
          
          
            |   | 306 | if $0 == __FILE__ | 
          
          
            |   | 307 |   p.to_xml.write($stdout, 2) | 
          
          
            |   | 308 |   puts | 
          
          
            |   | 309 | end | 
          
          
            |   | 310 |  | 
          
          
            |   | 311 |  | 
          
          
            |   | 312 | }}} | 
          
          
            |   | 313 | == ITG CBR UDP Receiver == | 
          
          
            |   | 314 | {{{ | 
          
          
            |   | 315 | # | 
          
          
            |   | 316 | # Define a prototype | 
          
          
            |   | 317 | # | 
          
          
            |   | 318 |  | 
          
          
            |   | 319 | require 'prototype' | 
          
          
            |   | 320 | require 'filter' | 
          
          
            |   | 321 | require 'appDefinition' | 
          
          
            |   | 322 |  | 
          
          
            |   | 323 | p = Prototype.create("test:proto:itgreceiver") | 
          
          
            |   | 324 | p.name = "ITG Receiver" | 
          
          
            |   | 325 | p.description = "Nodes which receive packets" | 
          
          
            |   | 326 | p.defProperty('logfile', 'Logfile') | 
          
          
            |   | 327 |  | 
          
          
            |   | 328 | itgr = p.addApplication('itgr', "test:app:itgr") | 
          
          
            |   | 329 | itgr.bindProperty('l','logfile') | 
          
          
            |   | 330 |  | 
          
          
            |   | 331 | if $0 == __FILE__ | 
          
          
            |   | 332 |   p.to_xml.write($stdout, 2) | 
          
          
            |   | 333 |   puts | 
          
          
            |   | 334 | end | 
          
          
            |   | 335 |  | 
          
          
            |   | 336 |  | 
          
          
            |   | 337 |  | 
          
          
            |   | 338 | }}} | 
          
          
            |   | 339 | == ITG CBR UDP Decoder == | 
          
          
            |   | 340 | {{{ | 
          
          
            |   | 341 | # | 
          
          
            |   | 342 | # Define a prototype | 
          
          
            |   | 343 | # | 
          
          
            |   | 344 |  | 
          
          
            |   | 345 | require 'prototype' | 
          
          
            |   | 346 | require 'filter' | 
          
          
            |   | 347 | require 'appDefinition' | 
          
          
            |   | 348 |  | 
          
          
            |   | 349 | p = Prototype.create("test:proto:itgdecoder") | 
          
          
            |   | 350 | p.name = "ITG Decoder" | 
          
          
            |   | 351 | p.description = "Decodes output and prints results" | 
          
          
            |   | 352 | p.defProperty('logfile', 'Logfile') | 
          
          
            |   | 353 | p.defProperty('tput_report_interval', 'Report interval for throughput') | 
          
          
            |   | 354 | p.defProperty('delay_report_interval', 'Report interval for Delay') | 
          
          
            |   | 355 | p.defProperty('jitter_report_interval', 'Report interval for Jitter') | 
          
          
            |   | 356 | p.defProperty('loss_report_interval', 'Report interval for Packet loss') | 
          
          
            |   | 357 |  | 
          
          
            |   | 358 | itgd = p.addApplication('itgdec', "test:app:itgdec") | 
          
          
            |   | 359 | itgd.bindProperty('logfile') | 
          
          
            |   | 360 | itgd.bindProperty('d', 'delay_report_interval') | 
          
          
            |   | 361 | itgd.bindProperty('j', 'jitter_report_interval') | 
          
          
            |   | 362 | itgd.bindProperty('b', 'tput_report_interval') | 
          
          
            |   | 363 | itgd.bindProperty('p', 'loss_report_interval') | 
          
          
            |   | 364 |  | 
          
          
            |   | 365 | itgd.addMeasurement('decoderport',  Filter::SAMPLE,  | 
          
          
            |   | 366 |   {Filter::SAMPLE_SIZE => 1}, | 
          
          
            |   | 367 |   [ | 
          
          
            |   | 368 |     ['flow_no'], | 
          
          
            |   | 369 |     ['src_port'], | 
          
          
            |   | 370 |     ['dst_port'], | 
          
          
            |   | 371 |     ['throughput'], | 
          
          
            |   | 372 |     ['jitter'], | 
          
          
            |   | 373 |     ['delay'], | 
          
          
            |   | 374 |     ['pkt_loss'] | 
          
          
            |   | 375 |   ] | 
          
          
            |   | 376 | ) | 
          
          
            |   | 377 |  | 
          
          
            |   | 378 | if $0 == __FILE__ | 
          
          
            |   | 379 |   p.to_xml.write($stdout, 2) | 
          
          
            |   | 380 |   puts | 
          
          
            |   | 381 | end | 
          
          
            |   | 382 | }}} | 
          
          
            |   | 383 |  | 
          
          
            |   | 384 |  | 
          
          
            |   | 385 | = Experiment script for Iperf = | 
          
          
            |   | 386 |  | 
          
          
            |   | 387 | == UDP CBR Experiment == | 
          
          
            |   | 388 | {{{ | 
          
          
            |   | 389 | ############# Tutorial1 ################################## | 
          
          
            |   | 390 | # This script defines the experiment | 
          
          
            |   | 391 | # that has two senders and one receiver using Iperf | 
          
          
            |   | 392 | # 802.11b  | 
          
          
            |   | 393 | # UDP flow of 500 packet/sec of 1024 byte payload | 
          
          
            |   | 394 | # Decoder reports throughput, delay, packet loss and jitter ############################################################ | 
          
          
            |   | 395 |  | 
          
          
            |   | 396 | Experiment.name = "tutorial-itg" | 
          
          
            |   | 397 | Experiment.project = "orbit:tutorial" | 
          
          
            |   | 398 |  | 
          
          
            |   | 399 | ########################################### | 
          
          
            |   | 400 | # Receiver definition and configuration | 
          
          
            |   | 401 | ########################################## | 
          
          
            |   | 402 |  | 
          
          
            |   | 403 | defNodes('receiver',[3,1]) {|node| | 
          
          
            |   | 404 |   node.image = nil  # assume the right image to be on disk | 
          
          
            |   | 405 |   node.prototype("test:proto:itgreceiver", {  | 
          
          
            |   | 406 |     'logfile' => "/tmp/results.txt" | 
          
          
            |   | 407 |     } | 
          
          
            |   | 408 | ) | 
          
          
            |   | 409 |   node.net.w0.ip = "%192.168.%x.%y" | 
          
          
            |   | 410 |   node.net.w0.mode = "master" | 
          
          
            |   | 411 |   node.net.w0.type = 'b' | 
          
          
            |   | 412 |   node.net.w0.essid = "helloworld"       | 
          
          
            |   | 413 | } | 
          
          
            |   | 414 | ########################################### | 
          
          
            |   | 415 | # Decoder definition and configuration | 
          
          
            |   | 416 | ########################################## | 
          
          
            |   | 417 |  | 
          
          
            |   | 418 | defNodes('decoder',[3,1]) {|node| | 
          
          
            |   | 419 |   node.image = nil  # assume the right image to be on disk | 
          
          
            |   | 420 |   node.prototype("test:proto:itgdecoder", {  | 
          
          
            |   | 421 |     'logfile' => "/tmp/results.txt", | 
          
          
            |   | 422 |     'tput_report_interval' => 1000, | 
          
          
            |   | 423 |     'delay_report_interval' => 1000, | 
          
          
            |   | 424 |     'loss_report_interval' => 1000, | 
          
          
            |   | 425 |     'jitter_report_interval' => 1000 | 
          
          
            |   | 426 |     } | 
          
          
            |   | 427 | ) | 
          
          
            |   | 428 | } | 
          
          
            |   | 429 | ########################################### | 
          
          
            |   | 430 | # Sender definition and configuration | 
          
          
            |   | 431 | ########################################### | 
          
          
            |   | 432 | defNodes('sender',[1,2]) {|node| | 
          
          
            |   | 433 |   node.image = nil  # assume the right image to be on disk | 
          
          
            |   | 434 |   node.prototype("test:proto:itgcbrsender", { | 
          
          
            |   | 435 |     'destinationHost' => '192.168.3.1', | 
          
          
            |   | 436 |     'meter' => 'owdm',          #One way delay | 
          
          
            |   | 437 |     'protocol' => 'udp',        #UDP client | 
          
          
            |   | 438 |     'constsize' => 1024,        #Const payload size (bytes) | 
          
          
            |   | 439 |     'constrate' => 500,         #packets per second | 
          
          
            |   | 440 |     'duration' => 60000,        #Expt duration (msec) | 
          
          
            |   | 441 |     'recv_port' => 8000         #Receiver port | 
          
          
            |   | 442 |   }) | 
          
          
            |   | 443 |   node.net.w0.ip = "%192.168.%x.%y" | 
          
          
            |   | 444 |   node.net.w0.mode = "managed" | 
          
          
            |   | 445 |   node.net.w0.type = 'b' | 
          
          
            |   | 446 |   node.net.w0.essid = "helloworld" | 
          
          
            |   | 447 | } | 
          
          
            |   | 448 | ########################################### | 
          
          
            |   | 449 | # Sender definition and configuration | 
          
          
            |   | 450 | ########################################### | 
          
          
            |   | 451 | defNodes('sender',[2,2]) {|node| | 
          
          
            |   | 452 |   node.image = nil  # assume the right image to be on disk | 
          
          
            |   | 453 |   # use prototype "sender"  | 
          
          
            |   | 454 |   # and set it's property "destinationHost" to  | 
          
          
            |   | 455 |   # the receiver node | 
          
          
            |   | 456 |   # and bind the remaining properties to the  | 
          
          
            |   | 457 |   # experiment property space | 
          
          
            |   | 458 |   node.prototype("test:proto:itgcbrsender", { | 
          
          
            |   | 459 |     'destinationHost' => '192.168.3.1', | 
          
          
            |   | 460 |     'meter' => 'owdm',          #One way delay | 
          
          
            |   | 461 |     'protocol' => 'udp',        #UDP client | 
          
          
            |   | 462 |     'constsize' => 1024,        #Const payload size (bytes) | 
          
          
            |   | 463 |     'constrate' => 500,         #packets per second | 
          
          
            |   | 464 |     'duration' => 60000,        #Expt duration (msec) | 
          
          
            |   | 465 |     'recv_port' => 8001         #Receiver port | 
          
          
            |   | 466 |   }) | 
          
          
            |   | 467 |   node.net.w0.ip = "%192.168.%x.%y" | 
          
          
            |   | 468 |   node.net.w0.mode = "managed" | 
          
          
            |   | 469 |   node.net.w0.type = 'b' | 
          
          
            |   | 470 |   node.net.w0.essid = "helloworld" | 
          
          
            |   | 471 | } | 
          
          
            |   | 472 |  | 
          
          
            |   | 473 | ########################################### | 
          
          
            |   | 474 | #  When nodeAgents have reported "OK" to  | 
          
          
            |   | 475 | # the nodeHandler start the application | 
          
          
            |   | 476 | ########################################### | 
          
          
            |   | 477 | whenAllInstalled {|node| | 
          
          
            |   | 478 |   NodeSet['receiver'].startApplications | 
          
          
            |   | 479 |   ###Need to separate receiver and sender start | 
          
          
            |   | 480 |   wait  15  | 
          
          
            |   | 481 |   ### | 
          
          
            |   | 482 |   NodeSet['sender'].startApplications | 
          
          
            |   | 483 |   NodeSet['sender1'].startApplications | 
          
          
            |   | 484 |  | 
          
          
            |   | 485 |   wait 60 | 
          
          
            |   | 486 |  | 
          
          
            |   | 487 | ############################################### | 
          
          
            |   | 488 | Launch the decoder application to report results | 
          
          
            |   | 489 | ################################################ | 
          
          
            |   | 490 |   NodeSet['decoder'].startApplications | 
          
          
            |   | 491 |   | 
          
          
            |   | 492 |  | 
          
          
            |   | 493 |  | 
          
          
            |   | 494 | ########################################### | 
          
          
            |   | 495 | # Shutdown nodes | 
          
          
            |   | 496 | ########################################### | 
          
          
            |   | 497 |  Experiment.done | 
          
          
            |   | 498 |  | 
          
          
            |   | 499 | } | 
          
          
            |   | 500 | }}} | 
          
          
            |   | 501 | == VoIP Experiment == | 
          
          
            |   | 502 | {{{ | 
          
          
            |   | 503 | ############# Tutorial2 ################################## | 
          
          
            |   | 504 | # This script defines the experiment | 
          
          
            |   | 505 | # that has one sender and one receiver and VoIP session | 
          
          
            |   | 506 | # Sender, Receiver - 802.11a channel 36 | 
          
          
            |   | 507 | # Receiver reports throughput, packet loss, avg. delay and jitter | 
          
          
            |   | 508 | ############################################################ | 
          
          
            |   | 509 |  | 
          
          
            |   | 510 |  | 
          
          
            |   | 511 | Experiment.name = "tutorial-itg" | 
          
          
            |   | 512 | Experiment.project = "orbit:tutorial" | 
          
          
            |   | 513 |  | 
          
          
            |   | 514 | # | 
          
          
            |   | 515 | # Define nodes used in experiment | 
          
          
            |   | 516 | ########################################### | 
          
          
            |   | 517 | # Receiver definition and configuration | 
          
          
            |   | 518 | ########################################## | 
          
          
            |   | 519 |  | 
          
          
            |   | 520 | defNodes('receiver',[3,1]) {|node| | 
          
          
            |   | 521 |   node.image = nil  # assume the right image to be on disk | 
          
          
            |   | 522 |   node.prototype("test:proto:itgreceiver", {  | 
          
          
            |   | 523 |     'logfile' => "/tmp/results.txt" | 
          
          
            |   | 524 |     } | 
          
          
            |   | 525 | ) | 
          
          
            |   | 526 |   node.net.w0.ip = "%192.168.%x.%y" | 
          
          
            |   | 527 |   node.net.w0.mode = "master" | 
          
          
            |   | 528 |   node.net.w0.type = 'a' | 
          
          
            |   | 529 |   node.net.w0.essid = "helloworld"       | 
          
          
            |   | 530 | } | 
          
          
            |   | 531 | ########################################### | 
          
          
            |   | 532 | # Decoder definition and configuration | 
          
          
            |   | 533 | ########################################## | 
          
          
            |   | 534 |  | 
          
          
            |   | 535 | defNodes('decoder',[3,1]) {|node| | 
          
          
            |   | 536 |   node.image = nil  # assume the right image to be on disk | 
          
          
            |   | 537 |   node.prototype("test:proto:itgdecoder", {  | 
          
          
            |   | 538 |     'logfile' => "/tmp/results.txt", | 
          
          
            |   | 539 |     'tput_report_interval' => 1000, | 
          
          
            |   | 540 |     'delay_report_interval' => 1000, | 
          
          
            |   | 541 |     'loss_report_interval' => 1000, | 
          
          
            |   | 542 |     'jitter_report_interval' => 1000 | 
          
          
            |   | 543 |     } | 
          
          
            |   | 544 | )} | 
          
          
            |   | 545 | ########################################### | 
          
          
            |   | 546 | # Sender definition and configuration | 
          
          
            |   | 547 | ########################################### | 
          
          
            |   | 548 | defNodes('sender',[2,2]) {|node| | 
          
          
            |   | 549 |   node.image = nil  # assume the right image to be on disk | 
          
          
            |   | 550 |   node.prototype("test:proto:itgvoipsender", { | 
          
          
            |   | 551 |     'destinationHost' => '192.168.3.1', | 
          
          
            |   | 552 |     'meter' => 'owdm',          #One way delay | 
          
          
            |   | 553 |     'duration' => 20000,        #Run for 20 seconds | 
          
          
            |   | 554 |     'recv_port' => 8000,        #Recv port | 
          
          
            |   | 555 |     'App' => 'VoIP',            #Use VoIP | 
          
          
            |   | 556 |     'codec' => 'G.711.1',       #Codec type | 
          
          
            |   | 557 |     'voip_control' => 'RTP'     #VoIP control | 
          
          
            |   | 558 |   }) | 
          
          
            |   | 559 |   node.net.w0.ip = "%192.168.%x.%y" | 
          
          
            |   | 560 |   node.net.w0.mode = "managed" | 
          
          
            |   | 561 |   node.net.w0.type = 'a' | 
          
          
            |   | 562 |   node.net.w0.essid = "helloworld" | 
          
          
            |   | 563 |  | 
          
          
            |   | 564 | } | 
          
          
            |   | 565 |  | 
          
          
            |   | 566 | ########################################### | 
          
          
            |   | 567 | #  When nodeAgents have reported "OK" to  | 
          
          
            |   | 568 | # the nodeHandler start the application | 
          
          
            |   | 569 | ########################################### | 
          
          
            |   | 570 | whenAllInstalled {|node| | 
          
          
            |   | 571 |   NodeSet['receiver'].startApplications | 
          
          
            |   | 572 |   ###Need to separate receiver and sender start | 
          
          
            |   | 573 |   wait 15  | 
          
          
            |   | 574 |   ### | 
          
          
            |   | 575 |   NodeSet['sender'].startApplications | 
          
          
            |   | 576 |   | 
          
          
            |   | 577 |  | 
          
          
            |   | 578 |  | 
          
          
            |   | 579 |   wait 60 | 
          
          
            |   | 580 |  | 
          
          
            |   | 581 | ############################################### | 
          
          
            |   | 582 | Launch the decoder application to report results | 
          
          
            |   | 583 | ################################################ | 
          
          
            |   | 584 |  | 
          
          
            |   | 585 |   NodeSet['decoder'].startApplications | 
          
          
            |   | 586 |   | 
          
          
            |   | 587 |  | 
          
          
            |   | 588 | ########################################### | 
          
          
            |   | 589 | # Shutdown nodes | 
          
          
            |   | 590 | ########################################### | 
          
          
            |   | 591 |  Experiment.done | 
          
          
            |   | 592 |  | 
          
          
            |   | 593 | } | 
          
          
            |   | 594 |  | 
          
          
            |   | 595 |  | 
          
          
            |   | 596 | }}} |