20 | | At the top of that window is a text field which you can use to search for existing OEDL scripts. Type "GEC20" in the field and then select "GEC20-learningswitch.oedl" from the list of files that are offered. |
| 20 | At the top of that window is a text field which you can use to search for existing OEDL scripts. Type "GEC20" in the field and then select "GEC20-learningswitch.oedl" from the list of files that are offered. This list the experiment script in the field below. |
| 21 | |
| 22 | For reference, we show the experiment script here: |
| 23 | {{{ |
| 24 | defProperty('source1', "nodea-gimitest1", "ID of a resource") |
| 25 | defProperty('source2', "switch-gimitest1", "ID of a resource") |
| 26 | |
| 27 | |
| 28 | defProperty('sinkaddr12', '192.168.1.7', "Ping destination address") |
| 29 | defProperty('sinkaddr13', '192.168.1.8', "Ping destination address") |
| 30 | |
| 31 | defProperty('sinkaddr21', '192.168.1.9', "Ping destination address") |
| 32 | defProperty('sinkaddr23', '192.168.1.10', "Ping destination address") |
| 33 | |
| 34 | defApplication('ping') do |app| |
| 35 | app.description = 'Simple Definition for the ping-oml2 application' |
| 36 | # Define the path to the binary executable for this application |
| 37 | app.binary_path = '/usr/local/bin/ping-oml2' |
| 38 | # Define the configurable parameters for this application |
| 39 | # For example if target is set to foo.com and count is set to 2, then the |
| 40 | # application will be started with the command line: |
| 41 | # /usr/bin/ping-oml2 -a foo.com -c 2 |
| 42 | app.defProperty('target', 'Address to ping', '-a', {:type => :string}) |
| 43 | app.defProperty('count', 'Number of times to ping', '-c', {:type => :integer}) |
| 44 | # Define the OML2 measurement point that this application provides. |
| 45 | # Here we have only one measurement point (MP) named 'ping'. Each measurement |
| 46 | # sample from this MP will be composed of a 4-tuples (addr,ttl,rtt,rtt_unit) |
| 47 | app.defMeasurement('ping') do |m| |
| 48 | m.defMetric('dest_addr',:string) |
| 49 | m.defMetric('ttl',:uint32) |
| 50 | m.defMetric('rtt',:double) |
| 51 | m.defMetric('rtt_unit',:string) |
| 52 | end |
| 53 | end |
| 54 | |
| 55 | defApplication('trema') do |app| |
| 56 | app.description = 'This app runs trema from command line' |
| 57 | app.binary_path = '/usr/bin/trema run /root/learning-switch.rb' |
| 58 | end |
| 59 | |
| 60 | defGroup('Source2', property.source2) do |node| |
| 61 | node.addApplication("trema") |
| 62 | end |
| 63 | |
| 64 | defGroup('Source1', property.source1) do |node| |
| 65 | node.addApplication("ping") do |app| |
| 66 | app.setProperty('target', property.sinkaddr12) |
| 67 | app.setProperty('count', 30) |
| 68 | #app.setProperty('interval', 1) |
| 69 | app.measure('ping', :samples => 1) |
| 70 | end |
| 71 | node.addApplication("ping") do |app| |
| 72 | app.setProperty('target', property.sinkaddr13) |
| 73 | app.setProperty('count', 30) |
| 74 | #app.setProperty('interval', 1) |
| 75 | app.measure('ping', :samples => 1) |
| 76 | end |
| 77 | node.addApplication("ping") do |app| |
| 78 | app.setProperty('target', property.sinkaddr21) |
| 79 | app.setProperty('count', 30) |
| 80 | #app.setProperty('interval', 1) |
| 81 | app.measure('ping', :samples => 1) |
| 82 | end |
| 83 | node.addApplication("ping") do |app| |
| 84 | app.setProperty('target', property.sinkaddr23) |
| 85 | app.setProperty('count', 30) |
| 86 | #app.setProperty('interval', 1) |
| 87 | app.measure('ping', :samples => 1) |
| 88 | end |
| 89 | end |
| 90 | |
| 91 | onEvent(:ALL_UP_AND_INSTALLED) do |event| |
| 92 | info "Starting the ping" |
| 93 | after 2 do |
| 94 | group('Source2').startApplications |
| 95 | end |
| 96 | after 10 do |
| 97 | group('Source1').startApplications |
| 98 | end |
| 99 | after 80 do |
| 100 | info "Stopping the ping" |
| 101 | allGroups.stopApplications |
| 102 | Experiment.done |
| 103 | end |
| 104 | end |
| 105 | |
| 106 | defGraph 'RTT' do |g| |
| 107 | g.ms('ping').select(:oml_seq, :dest_addr, :rtt) |
| 108 | g.caption "RTT of received packets." |
| 109 | g.type 'line_chart3' |
| 110 | g.mapping :x_axis => :oml_seq, :y_axis => :rtt, :group_by => :dest_addr |
| 111 | g.xaxis :legend => 'oml_seq' |
| 112 | g.yaxis :legend => 'rtt', :ticks => {:format => 's'} |
| 113 | end |
| 114 | }}} |
| 115 | |