| 36 | === 2.5 Complete OEDL script === |
| 37 | |
| 38 | {{{ |
| 39 | defProperty('source1', "client-lwtest6", "ID of a resource") |
| 40 | defProperty('thelistener', "server-lwtest6", "ID of a resource") |
| 41 | defProperty('thesender', "client-lwtest6", "ID of a resource") |
| 42 | defProperty('thesender2', "client-lwtest6", "ID of a resource") |
| 43 | defProperty('interfaceServer', "eth3", 'server interface to modify') |
| 44 | defProperty('capacity', 10000000, 'in bits per second') |
| 45 | |
| 46 | defProperty('sinkaddr11', '10.0.5.102', "Ping destination address") |
| 47 | defProperty('sinkaddr12', '10.0.5.101', "Ping destination address") |
| 48 | |
| 49 | defApplication('iperf') do |app| |
| 50 | app.description = 'Iperf traffic generator and bandwidth measurement tool' |
| 51 | app.binary_path = "/usr/bin/iperf-oml2" |
| 52 | |
| 53 | app.defProperty('server', 'run in server mode', '-s', |
| 54 | :type => :boolean) |
| 55 | |
| 56 | app.defProperty('client', 'run in client mode, connecting to <host>', '-c', |
| 57 | :type => :string, |
| 58 | :order => 1) |
| 59 | |
| 60 | app.defMeasurement("transfer"){ |m| |
| 61 | m.defMetric('pid', :integer, 'Main process identifier') |
| 62 | m.defMetric('connection_id', :integer, 'Connection identifier (socket)') |
| 63 | m.defMetric('begin_interval', :double, 'Start of the averaging interval (Iperf timestamp)') |
| 64 | m.defMetric('end_interval', :double, 'End of the averaging interval (Iperf timestamp)') |
| 65 | m.defMetric('size', :uint64, 'Amount of transmitted data [Bytes]') |
| 66 | } |
| 67 | app.defMeasurement("connection"){ |m| |
| 68 | m.defMetric('pid', :integer, 'Main process identifier') |
| 69 | m.defMetric('connection_id', :integer, 'Connection identifier (socket)') |
| 70 | m.defMetric('local_address', :string, 'Local network address') |
| 71 | m.defMetric('local_port', :integer, 'Local port') |
| 72 | m.defMetric('remote_address', :string, 'Remote network address') |
| 73 | m.defMetric('remote_port', :integer, 'Remote port') |
| 74 | } |
| 75 | |
| 76 | end |
| 77 | |
| 78 | |
| 79 | defApplication('ping') do |app| |
| 80 | app.description = 'Simple Definition for the ping-oml2 application' |
| 81 | # Define the path to the binary executable for this application |
| 82 | app.binary_path = '/usr/local/bin/ping-oml2' |
| 83 | # Define the configurable parameters for this application |
| 84 | # For example if target is set to foo.com and count is set to 2, then the |
| 85 | # application will be started with the command line: |
| 86 | # /usr/bin/ping-oml2 -a foo.com -c 2 |
| 87 | app.defProperty('target', 'Address to ping', '-a', {:type => :string}) |
| 88 | app.defProperty('count', 'Number of times to ping', '-c', {:type => :integer}) |
| 89 | # Define the OML2 measurement point that this application provides. |
| 90 | # Here we have only one measurement point (MP) named 'ping'. Each measurement |
| 91 | # sample from this MP will be composed of a 4-tuples (addr,ttl,rtt,rtt_unit) |
| 92 | app.defMeasurement('ping') do |m| |
| 93 | m.defMetric('dest_addr',:string) |
| 94 | m.defMetric('ttl',:uint32) |
| 95 | m.defMetric('rtt',:double) |
| 96 | m.defMetric('rtt_unit',:string) |
| 97 | end |
| 98 | end |
| 99 | defGroup('Source1', property.source1) do |node| |
| 100 | node.addApplication("ping") do |app| |
| 101 | app.setProperty('target', property.sinkaddr12) |
| 102 | app.setProperty('count', 40) |
| 103 | #app.setProperty('interval', 1) |
| 104 | app.measure('ping', :samples => 1) |
| 105 | end |
| 106 | end |
| 107 | defGroup('theReceiver', property.thelistener) do |node| |
| 108 | node.addApplication("iperf") do |app| |
| 109 | app.setProperty('server', true) |
| 110 | app.measure('transfer', :samples => 1) |
| 111 | app.measure('connection', :samples => 1) |
| 112 | end |
| 113 | end |
| 114 | |
| 115 | defGroup('theSender', property.thesender) do |node| |
| 116 | node.addApplication("iperf") do |app| |
| 117 | app.setProperty('client', property.sinkaddr12) |
| 118 | #app.measure('transfer', :samples => 1) |
| 119 | end |
| 120 | end |
| 121 | defGroup('theSender2', property.thesender2) do |node| |
| 122 | node.addApplication("iperf") do |app| |
| 123 | app.setProperty('client', property.sinkaddr12) |
| 124 | #app.measure('transfer', :samples => 1) |
| 125 | end |
| 126 | end |
| 127 | |
| 128 | |
| 129 | |
| 130 | onEvent(:ALL_UP_AND_INSTALLED) do |event| |
| 131 | info(" ------ Setup Traffic Shaping") |
| 132 | group("theReceiver").exec("/sbin/modprobe sch_netem") |
| 133 | group("theReceiver").exec("/sbin/modprobe ifb numifbs=10") |
| 134 | group("theReceiver").exec("/sbin/sysctl -w net.core.rmem_max=8388608") |
| 135 | group("theReceiver").exec("/sbin/sysctl -w net.core.wmem_max=8388608") |
| 136 | group("theReceiver").exec("/sbin/sysctl -w net.core.netdev_max_backlog=2048") |
| 137 | #group("theReceiver").exec("/sbin/ifconfig #{prop.interfaceServer} txqueuelen") |
| 138 | group("theReceiver").exec("/sbin/tc qdisc del dev #{prop.interfaceServer} root") |
| 139 | group("theReceiver").exec("/sbin/tc qdisc del dev #{prop.interfaceServer} ingress") |
| 140 | group("theReceiver").exec("/sbin/tc qdisc add dev #{prop.interfaceServer} handle 130 root htb default 1") |
| 141 | group("theReceiver").exec("/sbin/tc class add dev #{prop.interfaceServer} classid 130:1 parent 130 htb rate #{prop.capacity.to_s} ceil #{prop.capacity.to_s}") |
| 142 | group("theReceiver").exec("/sbin/tc qdisc add dev #{prop.interfaceServer} handle 120 parent 130:1 netem drop 0 delay 0us") |
| 143 | after 2 do |
| 144 | group('theReceiver').startApplications |
| 145 | end |
| 146 | after 5 do |
| 147 | group('theSender').startApplications |
| 148 | info "Starting the ping" |
| 149 | group('Source1').startApplications |
| 150 | end |
| 151 | after 15 do |
| 152 | group('theSender2').startApplications |
| 153 | end |
| 154 | after 70 do |
| 155 | info "Stopping the ping" |
| 156 | group('theSender').stopApplications |
| 157 | end |
| 158 | after 72 do |
| 159 | allGroups.stopApplications |
| 160 | Experiment.done |
| 161 | end |
| 162 | end |
| 163 | |
| 164 | defGraph 'RTT' do |g| |
| 165 | g.ms('ping').select(:oml_seq, :dest_addr, :rtt) |
| 166 | g.caption "RTT of received packets." |
| 167 | g.type 'line_chart3' |
| 168 | g.mapping :x_axis => :oml_seq, :y_axis => :rtt, :group_by => :dest_addr |
| 169 | g.xaxis :legend => 'oml_seq' |
| 170 | g.yaxis :legend => 'rtt', :ticks => {:format => 's'} |
| 171 | end |
| 172 | defGraph 'Iperf' do |g| |
| 173 | g.ms('transfer').select(:oml_seq, :size, :connection_id) |
| 174 | g.caption "Size of received packets." |
| 175 | g.type 'line_chart3' |
| 176 | g.mapping :x_axis => :oml_seq, :y_axis => :size, :group_by => :connection_id |
| 177 | g.xaxis :legend => 'oml_ts [s]' |
| 178 | g.yaxis :legend => 'size [Bytes]', :ticks => {:format => 's'} |
| 179 | end |
| 180 | |
| 181 | |
| 182 | }}} |
| 183 | |