| 3 | |
| 4 | {{{ |
| 5 | |
| 6 | defProperty('source1', "nodea-testGIMI", "ID of a resource") |
| 7 | defProperty('source2', "switch1-testGIMI", "ID of a resource") |
| 8 | defProperty('source3', "switch2-testGIMI", "ID of a resource") |
| 9 | |
| 10 | |
| 11 | defProperty('sinkaddr12', '192.168.1.7', "Ping destination address") |
| 12 | defProperty('sinkaddr13', '192.168.1.8', "Ping destination address") |
| 13 | |
| 14 | defProperty('sinkaddr21', '192.168.1.13', "Ping destination address") |
| 15 | defProperty('sinkaddr23', '192.168.1.14', "Ping destination address") |
| 16 | defProperty('sinkaddr24', '192.168.1.15', "Ping destination address") |
| 17 | |
| 18 | |
| 19 | defApplication('ping') do |app| |
| 20 | app.description = 'Simple Definition for the ping-oml2 application' |
| 21 | # Define the path to the binary executable for this application |
| 22 | app.binary_path = '/usr/local/bin/ping-oml2' |
| 23 | # Define the configurable parameters for this application |
| 24 | # For example if target is set to foo.com and count is set to 2, then the |
| 25 | # application will be started with the command line: |
| 26 | # /usr/bin/ping-oml2 -a foo.com -c 2 |
| 27 | app.defProperty('target', 'Address to ping', '-a', {:type => :string}) |
| 28 | app.defProperty('count', 'Number of times to ping', '-c', {:type => :integer}) |
| 29 | # Define the OML2 measurement point that this application provides. |
| 30 | # Here we have only one measurement point (MP) named 'ping'. Each measurement |
| 31 | # sample from this MP will be composed of a 4-tuples (addr,ttl,rtt,rtt_unit) |
| 32 | app.defMeasurement('ping') do |m| |
| 33 | m.defMetric('dest_addr',:string) |
| 34 | m.defMetric('ttl',:uint32) |
| 35 | m.defMetric('rtt',:double) |
| 36 | m.defMetric('rtt_unit',:string) |
| 37 | end |
| 38 | end |
| 39 | |
| 40 | defApplication('trema') do |app| |
| 41 | app.description = 'This app runs trema from command line' |
| 42 | app.binary_path = '/usr/local/bin/rubydir/bin/trema run /root/learning-switch.rb' |
| 43 | end |
| 44 | defGroup('Source2', property.source2, property.source3) do |node| |
| 45 | node.addApplication("trema") |
| 46 | end |
| 47 | defGroup('Source1', property.source1) do |node| |
| 48 | node.addApplication("ping") do |app| |
| 49 | app.setProperty('target', property.sinkaddr12) |
| 50 | app.setProperty('count', 30) |
| 51 | #app.setProperty('interval', 1) |
| 52 | app.measure('ping', :samples => 1) |
| 53 | end |
| 54 | node.addApplication("ping") do |app| |
| 55 | app.setProperty('target', property.sinkaddr13) |
| 56 | app.setProperty('count', 30) |
| 57 | #app.setProperty('interval', 1) |
| 58 | app.measure('ping', :samples => 1) |
| 59 | end |
| 60 | node.addApplication("ping") do |app| |
| 61 | app.setProperty('target', property.sinkaddr21) |
| 62 | app.setProperty('count', 30) |
| 63 | #app.setProperty('interval', 1) |
| 64 | app.measure('ping', :samples => 1) |
| 65 | end |
| 66 | node.addApplication("ping") do |app| |
| 67 | app.setProperty('target', property.sinkaddr23) |
| 68 | app.setProperty('count', 30) |
| 69 | #app.setProperty('interval', 1) |
| 70 | app.measure('ping', :samples => 1) |
| 71 | end |
| 72 | node.addApplication("ping") do |app| |
| 73 | app.setProperty('target', property.sinkaddr24) |
| 74 | app.setProperty('count', 30) |
| 75 | #app.setProperty('interval', 1) |
| 76 | app.measure('ping', :samples => 1) |
| 77 | end |
| 78 | end |
| 79 | |
| 80 | |
| 81 | |
| 82 | |
| 83 | |
| 84 | #defGroup('Sink1', property.sink1) do |node| |
| 85 | #end |
| 86 | |
| 87 | #defGroup('Sink2', property.sink2) do |node| |
| 88 | #end |
| 89 | |
| 90 | #defGroup('Sink3', property.sink3) do |node| |
| 91 | #end |
| 92 | |
| 93 | #defGroup('Sink4', property.sink4) do |node| |
| 94 | #end |
| 95 | |
| 96 | #defGroup('Sink5', property.sink5) do |node| |
| 97 | #end |
| 98 | |
| 99 | onEvent(:ALL_UP_AND_INSTALLED) do |event| |
| 100 | info "Starting the ping" |
| 101 | after 2 do |
| 102 | group('Source2').startApplications |
| 103 | end |
| 104 | after 10 do |
| 105 | group('Source1').startApplications |
| 106 | end |
| 107 | after 80 do |
| 108 | info "Stopping the ping" |
| 109 | allGroups.stopApplications |
| 110 | Experiment.done |
| 111 | end |
| 112 | end |
| 113 | |
| 114 | defGraph 'RTT' do |g| |
| 115 | g.ms('ping').select(:oml_seq, :dest_addr, :rtt) |
| 116 | g.caption "RTT of received packets." |
| 117 | g.type 'line_chart3' |
| 118 | g.mapping :x_axis => :oml_seq, :y_axis => :rtt, :group_by => :dest_addr |
| 119 | g.xaxis :legend => 'oml_seq' |
| 120 | g.yaxis :legend => 'rtt', :ticks => {:format => 's'} |
| 121 | end |
| 122 | }}} |
| 123 | |