| 16 | |
| 17 | = How to use OML4R to write your OML application = |
| 18 | == 1. Setup your Application == |
| 19 | |
| 20 | === 1.1 Download the tar file of your application === |
| 21 | |
| 22 | {{{ |
| 23 | |
| 24 | sudo su |
| 25 | wget http://www.gpolab.bbn.com/experiment-support/gec17/pingPlus/pingPlus_v3.tar.gz |
| 26 | tar xvzf pingPlus_v3.tar.gz |
| 27 | cd pingPlus_v3 |
| 28 | make |
| 29 | |
| 30 | }}} |
| 31 | === 1.2 Test connectivity === |
| 32 | |
| 33 | On the receiver |
| 34 | {{{ |
| 35 | |
| 36 | chmod +x pingPlusListener |
| 37 | ping -c 5 10.10.10.1 |
| 38 | ifconfig eth1 0.0.0.0 |
| 39 | ping -c 5 10.10.10.1 |
| 40 | # ./pingPlusListener 10002 |
| 41 | |
| 42 | |
| 43 | }}} |
| 44 | On the sender |
| 45 | |
| 46 | {{{ |
| 47 | |
| 48 | ping -c 5 10.10.10.2 |
| 49 | ifconfig eth1 0.0.0.0 |
| 50 | ping -c 5 10.10.10.2 |
| 51 | chmod +x pingPlus |
| 52 | ./pingPlus 02:26:ae:0e:9b:3e eth1 10002 |
| 53 | }}} |
| 54 | |
| 55 | |
| 56 | == 1. Observe your Output == |
| 57 | |
| 58 | |
| 59 | |
| 60 | {{{ |
| 61 | |
| 62 | root@sender:/users/dbhat/pingPlus_v3# ./pingPlus 02:26:ae:0e:9b:3e eth1 10002 5 |
| 63 | RQ:'9641+4173' to 2:26:ae:e:9b:3e. |
| 64 | RL:9641+4173=13814 from 2:26:ae:e:9b:3e. |
| 65 | RTT = 0.920166 |
| 66 | RQ:'2271+7533' to 2:26:ae:e:9b:3e. |
| 67 | RL:2271+7533=9804 from 2:26:ae:e:9b:3e. |
| 68 | RTT = 0.654053 |
| 69 | RQ:'8858+353' to 2:26:ae:e:9b:3e. |
| 70 | RL:8858+353=9211 from 2:26:ae:e:9b:3e. |
| 71 | RTT = 0.489014 |
| 72 | RQ:'447+5696' to 2:26:ae:e:9b:3e. |
| 73 | RL:447+5696=6143 from 2:26:ae:e:9b:3e. |
| 74 | RTT = 0.290039 |
| 75 | RQ:'7238+5082' to 2:26:ae:e:9b:3e. |
| 76 | RL:7238+5082=12320 from 2:26:ae:e:9b:3e. |
| 77 | RTT = 0.252930 |
| 78 | |
| 79 | }}} |
| 80 | |
| 81 | == 2. Write your Parser == |
| 82 | |
| 83 | {{{ |
| 84 | |
| 85 | }}} |
| 86 | |
| 87 | |
| 88 | |
| 89 | == 3. Instrument your Application using LabWiki == |
| 90 | |
| 91 | |
| 92 | {{{ |
| 93 | defProperty('source1', "sender-gimiinsta", "ID of a resource") |
| 94 | |
| 95 | defProperty('sinkaddr11', '02:ee:1a:a2:51:11', "Ping destination address") |
| 96 | defProperty('eth11','eth1',"Output Eth interface") |
| 97 | |
| 98 | |
| 99 | defApplication('pingl2') do |app| |
| 100 | app.description = 'Simple Definition for the pingl2 application' |
| 101 | # Define the path to the binary executable for this application |
| 102 | app.binary_path = '/usr/local/bin/pingl2.rb' |
| 103 | # Define the configurable parameters for this application |
| 104 | # For example if target is set to foo.com and count is set to 2, then the |
| 105 | # application will be started with the command line: |
| 106 | # /usr/bin/ping-oml2 -a foo.com -c 2 |
| 107 | app.defProperty('target', 'Address to ping', '-a', {:type => :string}) |
| 108 | app.defProperty('count', 'Number of times to ping', '-c', {:type => :integer}) |
| 109 | app.defProperty('if_num', 'interface number', '-i', {:type => :integer}) |
| 110 | app.defProperty('eth', 'Ethernet Type', '-e', {:type => :string}) |
| 111 | # Define the OML2 measurement point that this application provides. |
| 112 | # Here we have only one measurement point (MP) named 'ping'. Each measurement |
| 113 | # sample from this MP will be composed of a 4-tuples (addr,ttl,rtt,rtt_unit) |
| 114 | app.defMeasurement('pingrl') do |m| |
| 115 | m.defMetric('dest_hw_addr',:string) |
| 116 | end |
| 117 | app.defMeasurement('pingrtt') do |m| |
| 118 | m.defMetric('rtt',:double) |
| 119 | end |
| 120 | end |
| 121 | defGroup('Source1', property.source1) do |node| |
| 122 | node.addApplication("pingl2") do |app| |
| 123 | app.setProperty('target', property.sinkaddr11) |
| 124 | app.setProperty('count', 30) |
| 125 | app.setProperty('if_num', 10002) |
| 126 | app.setProperty('eth',property.eth11) |
| 127 | app.measure('pingrl', :samples => 1) |
| 128 | app.measure('pingrtt', :samples => 1) |
| 129 | end |
| 130 | end |
| 131 | |
| 132 | |
| 133 | |
| 134 | onEvent(:ALL_UP_AND_INSTALLED) do |event| |
| 135 | info "Starting the ping" |
| 136 | after 5 do |
| 137 | allGroups.startApplications |
| 138 | end |
| 139 | after 70 do |
| 140 | info "Stopping the ping" |
| 141 | allGroups.stopApplications |
| 142 | Experiment.done |
| 143 | end |
| 144 | end |
| 145 | |
| 146 | defGraph 'RTT' do |g| |
| 147 | g.ms('pingrtt').select(:rtt__oml_seq, :rtt__rtt, :rl__dest_hw_addr)\ |
| 148 | .from(:pingl2_pingrtt___rtt, :pingl2_pingrl___rl)\ |
| 149 | .where(:rtt__oml_seq => :rl__oml_seq) |
| 150 | g.caption "RTT of received packets." |
| 151 | g.type 'line_chart3' |
| 152 | g.mapping :x_axis => :oml_seq, :y_axis => :rtt, :group_by => :dest_hw_addr |
| 153 | g.xaxis :legend => 'oml_seq' |
| 154 | g.yaxis :legend => 'rtt', :ticks => {:format => 's'} |
| 155 | end |
| 156 | }}} |