| 49 | |
| 50 | For running Iperf from node "Outside" to node "Inside", add the script below to a new file, udp-iperf.rb and click on save at the top of the Prepare Column. |
| 51 | |
| 52 | '''Note''': You should change the slice name in the first two lines of the script to represent your slice name. |
| 53 | |
| 54 | {{{ |
| 55 | defProperty('theSender', "outside-debloadbal", "ID of sender node") |
| 56 | defProperty('theReceiver', "inside-debloadbal", "ID of receiver node") |
| 57 | defProperty('setinterval','1.0',"Time between iperf") |
| 58 | defProperty('serverip', "10.10.10.2","Server interface IP") |
| 59 | #defProperty('clientip', "192.168.4.1","Client interface IP") |
| 60 | defProperty('setbandwidth', "100m", "Throughput of Sender") |
| 61 | defApplication('iperf') do |app| |
| 62 | app.description = "Iperf is a traffic generator and bandwidth measurement |
| 63 | tool. It provides generators producing various forms of packet streams and port |
| 64 | for sending these packets via various transports, such as TCP and UDP." |
| 65 | app.binary_path = "/usr/bin/iperf_oml2" |
| 66 | |
| 67 | #app.defProperty('interval', 'pause n seconds between periodic bandwidth reports', '-i', |
| 68 | # :type => :double, :unit => "seconds", :default => '1.') |
| 69 | app.defProperty('len', 'set length read/write buffer to n (default 8 KB)', '-l', |
| 70 | :type => :integer, :unit => "KiBytes") |
| 71 | app.defProperty('print_mss', 'print TCP maximum segment size (MTU - TCP/IP header)', '-m', |
| 72 | :type => :boolean) |
| 73 | app.defProperty('output', 'output the report or error message to this specified file', '-o', |
| 74 | :type => :string) |
| 75 | app.defProperty('port', 'set server port to listen on/connect to to n (default 5001)', '-p', |
| 76 | :type => :integer) |
| 77 | app.defProperty('udp', 'use UDP rather than TCP', '-u', |
| 78 | :type => :boolean, |
| 79 | :order => 2) |
| 80 | app.defProperty('window', 'TCP window size (socket buffer size)', '-w', |
| 81 | :type => :integer, :unit => "Bytes") |
| 82 | app.defProperty('bind', 'bind to <host>, an interface or multicast address', '-B', |
| 83 | :type => :string) |
| 84 | app.defProperty('compatibility', 'for use with older versions does not sent extra msgs', '-C', |
| 85 | :type => :boolean) |
| 86 | app.defProperty('mss', 'set TCP maximum segment size (MTU - 40 bytes)', '-M', |
| 87 | :type => :integer, :unit => "Bytes") |
| 88 | app.defProperty('nodelay', 'set TCP no delay, disabling Nagle\'s Algorithm', '-N', |
| 89 | :type => :boolean) |
| 90 | app.defProperty('IPv6Version', 'set the domain to IPv6', '-V', |
| 91 | :type => :boolean) |
| 92 | app.defProperty('reportexclude', 'exclude C(connection) D(data) M(multicast) S(settings) V(server) reports', '-x', |
| 93 | :type => :string, :unit => "[CDMSV]") |
| 94 | app.defProperty('reportstyle', 'C or c for CSV report, O or o for OML', '-y', |
| 95 | :type => :string, :unit => "[CcOo]", :default => "o") # Use OML reporting by default |
| 96 | |
| 97 | app.defProperty('server', 'run in server mode', '-s', |
| 98 | :type => :boolean) |
| 99 | |
| 100 | app.defProperty('bandwidth', 'set target bandwidth to n bits/sec (default 1 Mbit/sec)', '-b', |
| 101 | :type => :string, :unit => "Mbps") |
| 102 | app.defProperty('client', 'run in client mode, connecting to <host>', '-c', |
| 103 | :type => :string, |
| 104 | :order => 1) |
| 105 | app.defProperty('dualtest', 'do a bidirectional test simultaneously', '-d', |
| 106 | :type => :boolean) |
| 107 | app.defProperty('num', 'number of bytes to transmit (instead of -t)', '-n', |
| 108 | :type => :integer, :unit => "Bytes") |
| 109 | app.defProperty('tradeoff', 'do a bidirectional test individually', '-r', |
| 110 | :type => :boolean) |
| 111 | app.defProperty('time', 'time in seconds to transmit for (default 10 secs)', '-t', |
| 112 | :type => :integer, :unit => "seconds") |
| 113 | app.defProperty('fileinput', 'input the data to be transmitted from a file', '-F', |
| 114 | :type => :string) |
| 115 | app.defProperty('stdin', 'input the data to be transmitted from stdin', '-I', |
| 116 | :type => :boolean) |
| 117 | app.defProperty('listenport', 'port to recieve bidirectional tests back on', '-L', |
| 118 | :type => :integer) |
| 119 | app.defProperty('parallel', 'number of parallel client threads to run', '-P', |
| 120 | :type => :integer) |
| 121 | app.defProperty('ttl', 'time-to-live, for multicast (default 1)', '-T', |
| 122 | :type => :integer, |
| 123 | :default => 1) |
| 124 | app.defProperty('linux_congestion', 'set TCP congestion control algorithm (Linux only)', '-Z', |
| 125 | :type => :boolean) |
| 126 | |
| 127 | app.defMeasurement("application"){ |m| |
| 128 | m.defMetric('pid', :integer) |
| 129 | m.defMetric('version', :string) |
| 130 | m.defMetric('cmdline', :string) |
| 131 | m.defMetric('starttime_s', :integer) |
| 132 | m.defMetric('starttime_us', :integer) |
| 133 | } |
| 134 | |
| 135 | app.defMeasurement("settings"){ |m| |
| 136 | m.defMetric('pid', :integer) |
| 137 | m.defMetric('server_mode', :integer) |
| 138 | m.defMetric('bind_address', :string) |
| 139 | m.defMetric('multicast', :integer) |
| 140 | m.defMetric('multicast_ttl', :integer) |
| 141 | m.defMetric('transport_protocol', :integer) |
| 142 | m.defMetric('window_size', :integer) |
| 143 | m.defMetric('buffer_size', :integer) |
| 144 | } |
| 145 | |
| 146 | app.defMeasurement("connection"){ |m| |
| 147 | m.defMetric('pid', :integer) |
| 148 | m.defMetric('connection_id', :integer) |
| 149 | m.defMetric('local_address', :string) |
| 150 | m.defMetric('local_port', :integer) |
| 151 | m.defMetric('remote_address', :string) |
| 152 | m.defMetric('remote_port', :integer) |
| 153 | } |
| 154 | |
| 155 | app.defMeasurement("transfer"){ |m| |
| 156 | m.defMetric('pid', :integer) |
| 157 | m.defMetric('connection_id', :integer) |
| 158 | m.defMetric('begin_interval', :double) |
| 159 | m.defMetric('end_interval', :double) |
| 160 | m.defMetric('size', :uint64) |
| 161 | } |
| 162 | |
| 163 | app.defMeasurement("losses"){ |m| |
| 164 | m.defMetric('pid', :integer) |
| 165 | m.defMetric('connection_id', :integer) |
| 166 | m.defMetric('begin_interval', :double) |
| 167 | m.defMetric('end_interval', :double) |
| 168 | m.defMetric('total_datagrams', :integer) |
| 169 | m.defMetric('lost_datagrams', :integer) |
| 170 | } |
| 171 | |
| 172 | app.defMeasurement("jitter"){ |m| |
| 173 | m.defMetric('pid', :integer) |
| 174 | m.defMetric('connection_id', :integer) |
| 175 | m.defMetric('begin_interval', :double) |
| 176 | m.defMetric('end_interval', :double) |
| 177 | m.defMetric('jitter', :double) |
| 178 | } |
| 179 | |
| 180 | app.defMeasurement("packets"){ |m| |
| 181 | m.defMetric('pid', :integer) |
| 182 | m.defMetric('connection_id', :integer) |
| 183 | m.defMetric('packet_id', :integer) |
| 184 | m.defMetric('packet_size', :integer) |
| 185 | m.defMetric('packet_time_s', :integer) |
| 186 | m.defMetric('packet_time_us', :integer) |
| 187 | m.defMetric('packet_sent_time_s', :integer) |
| 188 | m.defMetric('packet_sent_time_us', :integer) |
| 189 | } |
| 190 | |
| 191 | end |
| 192 | defApplication('nmetrics') do |app| |
| 193 | app.description = 'Measure nmetrics parameters' |
| 194 | app.binary_path = '/usr/bin/nmetrics-oml2' |
| 195 | app.defProperty('interface', 'interface at which to measure', '-i', {:type => :string}) |
| 196 | app.defProperty('cpu', 'cpu usage', '-c', {:type => :boolean}) |
| 197 | app.defProperty('memory', 'memory usage', '-m', {:type => :boolean}) |
| 198 | app.defMeasurement('memory') do |m| |
| 199 | m.defMetric('ram', :uint64) |
| 200 | m.defMetric('total', :uint64) |
| 201 | m.defMetric('used', :uint64) |
| 202 | m.defMetric('free', :uint64) |
| 203 | m.defMetric('actual_used', :uint64) |
| 204 | m.defMetric('actual_free', :uint64) |
| 205 | end |
| 206 | app.defMeasurement('cpu') do |m| |
| 207 | m.defMetric('user', :uint64) |
| 208 | m.defMetric('sys', :uint64) |
| 209 | m.defMetric('nice', :uint64) |
| 210 | m.defMetric('idle', :uint64) |
| 211 | m.defMetric('wait', :uint64) |
| 212 | m.defMetric('irq', :uint64) |
| 213 | m.defMetric('soft_irq', :uint64) |
| 214 | m.defMetric('stolen', :uint64) |
| 215 | m.defMetric('total', :uint64) |
| 216 | end |
| 217 | app.defMeasurement('network') do |m| |
| 218 | m.defMetric('name', :string) |
| 219 | m.defMetric('rx_packets', :uint64) |
| 220 | m.defMetric('rx_bytes', :uint64) |
| 221 | m.defMetric('rx_errors', :uint64) |
| 222 | m.defMetric('rx_dropped', :uint64) |
| 223 | m.defMetric('rx_overruns', :uint64) |
| 224 | m.defMetric('rx_frame', :uint64) |
| 225 | m.defMetric('tx_packets', :uint64) |
| 226 | m.defMetric('tx_bytes', :uint64) |
| 227 | m.defMetric('tx_errors', :uint64) |
| 228 | m.defMetric('tx_dropped', :uint64) |
| 229 | m.defMetric('tx_overruns', :uint64) |
| 230 | m.defMetric('tx_collisions', :uint64) |
| 231 | m.defMetric('tx_carrier', :uint64) |
| 232 | m.defMetric('speed', :uint64) |
| 233 | end |
| 234 | end |
| 235 | defGroup('Receiver',property.theReceiver) do |node| |
| 236 | node.addApplication("iperf") do |app| |
| 237 | #app.setProperty('interval', property.setinterval) |
| 238 | app.setProperty('server',true) |
| 239 | app.setProperty('port',6001) |
| 240 | app.measure('transfer', :samples => 1) |
| 241 | app.measure('jitter', :samples => 1) |
| 242 | app.measure('losses', :samples => 1) |
| 243 | end |
| 244 | #node.addApplication("nmetrics") do |app| |
| 245 | # app.setProperty('interface','eth3') |
| 246 | # app.setProperty('cpu',true) |
| 247 | # app.setProperty('memory',true) |
| 248 | # app.measure('cpu', :samples => 1) |
| 249 | # app.measure('memory', :samples => 1) |
| 250 | # app.measure('network', :samples => 1) |
| 251 | #end |
| 252 | end |
| 253 | |
| 254 | defGroup('Sender',property.theSender) do |node| |
| 255 | node.addApplication("iperf") do |app| |
| 256 | #app.setProperty('interval',property.setinterval) |
| 257 | app.setProperty('client',property.serverip) |
| 258 | app.setProperty('tradeoff',true) |
| 259 | app.setProperty('parallel', 20) |
| 260 | app.setProperty('time',30) |
| 261 | app.setProperty('port',6001) |
| 262 | #app.setProperty('bandwidth',property.setbandwidth) |
| 263 | app.measure('transfer', :samples => 1) |
| 264 | app.measure('jitter', :samples => 1) |
| 265 | app.measure('losses', :samples => 1) |
| 266 | end |
| 267 | #node.addApplication("nmetrics") do |app| |
| 268 | # app.setProperty('interface','eth2') |
| 269 | # app.setProperty('cpu',true) |
| 270 | # app.setProperty('memory',true) |
| 271 | # app.measure('cpu', :samples => 1) |
| 272 | # app.measure('memory', :samples => 1) |
| 273 | #app.measure('network', :samples => 1) |
| 274 | #end |
| 275 | end |
| 276 | |
| 277 | onEvent(:ALL_UP_AND_INSTALLED) do |event| |
| 278 | info "starting" |
| 279 | group('Receiver').startApplications |
| 280 | info "Server application started..." |
| 281 | wait 1 |
| 282 | group('Sender').startApplications |
| 283 | info "Client application started..." |
| 284 | wait 100 |
| 285 | group('Sender').stopApplications |
| 286 | wait 2 |
| 287 | group('Receiver').stopApplications |
| 288 | info "All applications stopped." |
| 289 | Experiment.done |
| 290 | end |
| 291 | defGraph 'Received bytes' do |g| |
| 292 | g.ms('transfer').select {[ oml_ts_client.as(:ts), :size , :oml_sender_id]} |
| 293 | g.caption "Packet length measurement." |
| 294 | g.type 'line_chart3' |
| 295 | g.mapping :x_axis => :ts, :y_axis => :size, :group_by => :oml_sender_id |
| 296 | g.xaxis :legend => 'time [s]' |
| 297 | g.yaxis :legend => 'packet size', :ticks => {:format => 's'} |
| 298 | end |
| 299 | |
| 300 | }}} |