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