GIMIv2tasks/TestCases: step4-otg_nmetrics-new.rb

File step4-otg_nmetrics-new.rb, 2.2 KB (added by koneil@bbn.com, 6 years ago)
Line 
1defProperty('theSender','nodeB','ID of sender node')
2defProperty('theReceiver1', 'nodeA', "ID of receiver node")
3defProperty('packetsize', 128, "Packet size (byte) from the sender node")
4defProperty('bitrate', 2048, "Bitrate (bit/s) from the sender node")
5defProperty('runtime', 40, "Time in second for the experiment is to run")
6defProperty('graph', true, "Display graph or not")
7
8defGroup('Sender',property.theSender) do |node|
9    options = { 'sample-interval' => 2, 'monitor_interface' => 'eth1 -i eth2 -i eth3' }
10    node.addPrototype("system_monitor", options)
11
12    node.addApplication("test:app:otg2") do |app|
13        app.setProperty('udp:local_host', '192.168.4.10')
14        app.setProperty('udp:dst_host', '192.168.4.11')
15        app.setProperty('udp:dst_port', 3000)
16        app.setProperty('cbr:size', property.packetsize)
17        app.setProperty('cbr:rate', property.bitrate * 2)
18        app.measure('udp_out', :samples => 1)
19    end
20   
21end
22
23defGroup('Receiver1',property.theReceiver1) do |node|
24    options = { 'sample-interval' => 2 }
25    node.addPrototype("system_monitor", options)
26    node.addApplication("test:app:otr2") do |app|
27        app.setProperty('udp:local_host', '192.168.4.11')
28        app.setProperty('udp:local_port', 3000)
29        app.measure('udp_in', :samples => 1)
30    end
31end
32
33
34onEvent(:ALL_UP_AND_INSTALLED) do |event|
35    info "starting"
36    wait 5
37    allGroups.exec("ln -s /usr/local/bin/otr2 /usr/bin/otr2")
38    allGroups.exec("ln -s /usr/local/bin/otg2 /usr/bin/otg2")
39    allGroups.exec("ln -s /usr/local/bin/oml2-nmetrics /usr/bin/oml2-nmetrics")
40    allGroups.startApplications
41    info "All applications started..."
42    wait property.runtime / 4
43    property.packetsize = 256
44    wait property.runtime / 4
45    property.packetsize = 512
46    wait property.runtime / 4
47    property.packetsize = 1024
48    wait property.runtime / 4
49    allGroups.stopApplications
50    info "All applications stopped."
51    Experiment.done
52end
53
54defGraph 'Throughput' do |g|
55  g.ms('udp_in').select {[ oml_ts_client.as(:ts), :pkt_length ]}
56  g.caption "Packet length measurement."
57  g.type 'line_chart3'
58  g.mapping :x_axis => :ts, :y_axis => :pkt_length
59  g.xaxis :legend => 'time [s]'
60  g.yaxis :legend => 'packet length', :ticks => {:format => 's'}
61end