Changes between Initial Version and Version 1 of GEC17Agenda/GettingStartedWithGENI_III_GIMI/Procedure/Execute


Ignore:
Timestamp:
06/21/13 22:53:33 (11 years ago)
Author:
divyashri.bhat@gmail.com
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • GEC17Agenda/GettingStartedWithGENI_III_GIMI/Procedure/Execute

    v1 v1  
     1= Execute =
     2=== C.1 Initial Setup ===
     3
     4=== C.1.1 Starting the OML Server (if needed) ===
     5For this tutorial we have an OML server running on emmy9.casa.umass.edu, which collects the measurement data in an sqlite3 database and at the end of the experiment it pushes the data to IRODS.
     6   * Here is how you would have to start an OML server if you wanted to run this on a different machine (OML2.8 is required.)
     7{{{
     8#!html
     9<span style="color:red">DO NOT perform this task in the tutorial.
     10</span>
     11}}}
     12
     13 This is explained the [OML installation file].
     14
     15{{{
     16$ /usr/bin/oml2-server -l 3003 --logfile=/var/log/oml2-server-2.9.log --user=oml2 --group=oml2 -H /usr/share/oml2-server/oml2-server-hook.sh
     17}}}
     18
     19The latest version of OML offers the capability of executing a script after the measurement has finished. In OML terminology this is called a "hook". The hook script we use is attached at the bottom of this wiki page [http://groups.geni.net/geni/attachment/wiki/GIMI-GEC16-Tutorials/GIMI-GEC16-TutorialB/Orchestrate/oml2-server-hook.sh (oml2-server-hook.sh)].
     20
     21{{{
     22#!/bin/bash
     23#
     24# Example event hook for the OML server, copying an Sqlite database elsewhere
     25# when the last client has exited.
     26# Copyright 2012-2013 National ICT Australia (NICTA), Australia
     27#
     28# Permission is hereby granted, free of charge, to any person obtaining a copy
     29# of this software and associated documentation files (the "Software"), to deal
     30# in the Software without restriction, including without limitation the rights
     31# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     32# copies of the Software, and to permit persons to whom the Software is
     33# furnished to do so, subject to the following conditions:
     34#
     35# The above copyright notice and this permission notice shall be included in
     36# all copies or substantial portions of the Software.
     37#
     38# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     39# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     40# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
     41# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     42# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     43# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
     44# THE SOFTWARE.
     45#
     46irodsUserName=rods
     47irodsHost=emmy9.casa.umass.edu
     48irodsPort=1247
     49irodsZone=geniRenci
     50HOME=/home/oml2
     51export irodsUserName irodsHost irodsPort irodsZone HOME
     52
     53LOGFILE=/tmp/oml2-server-hook.log
     54function log ()
     55{
     56        echo "$@" >&2
     57        echo "$@" >> ${LOGFILE}
     58}
     59
     60# XXX: You might need to initialise the iRODS password for the UNIX user
     61# running tho oml2-server by running 'iinit' to create ~/.irods/.irodsA on its
     62# behalf for iput to work
     63IPUT=/usr/bin/iput
     64SQLITE3=sqlite3
     65PGDUMP=pg_dump
     66
     67echo "OML HOOK READY"
     68log "OML HOOK READY"
     69
     70while read COMMAND ARGUMENTS; do
     71        # One report line must be printed in each control path;
     72        # this first one puts out a timestamp and a dump of the received command, but no newline
     73        log -n "`date`: ${COMMAND} ${ARGUMENTS}: "
     74        case "${COMMAND}" in
     75                "DBCLOSED")
     76                        case "${ARGUMENTS}" in
     77                                file:*)
     78                                        DBFILE=${ARGUMENTS/file:/}
     79                                        log "${IPUT} ${OPTION} ${DBFILE}"
     80                                        NAME=${DBFILE:14:6};
     81                                        FILE=${DBFILE:14};
     82                                        LENGTH=${#FILE}
     83                                        SLICE=${FILE:0:$LENGTH-4}
     84                                        DATE=`date`
     85                                        log "b db ${DBFILE} closed, pushing to iRODS..."
     86                                        ${IPUT} -f ${DBFILE} /geniRenci/home/$NAME/ #$FILE
     87                                        log "an iRODS operation finished"
     88                                        ;;
     89                                postgresql://*)
     90                                        # Separate the components of the URI by gradually eating them off the TMP variable
     91                                       
     92                                        DOMAIN=${ARGUMENTS//*\//}       # cut everything before the final '/'
     93                                        USERNAME=${DOMAIN/-*/}          # get the first part before the '-'
     94                                        REST=${DOMAIN/$USERNAME-/}      # remove the username from the rest
     95                                        EXPNAME=${REST/-*/}             # same as for the username
     96                                        TIMESTAMP=${REST//*-/}          # get the last part after the '-'
     97
     98                                               
     99                                        TMP="${ARGUMENTS/postgresql:\/\//}"
     100                                        USER=${TMP/@*/}
     101                                        TMP=${TMP/${USER}@/}
     102                                        HOST=${TMP/:*/}
     103                                        TMP=${TMP/${HOST}:/}
     104                                        PORT=${TMP/\/*/}
     105                                        TMP=${TMP/${PORT}\//}
     106                                        DBNAME=${TMP}
     107                                        DBFILE=${DBNAME}.`date +%Y-%m-%d_%H:%M:%S%z`.pg.sql
     108                                        log "PostgreSQL DB ${DBNAME} closed, dumping as ${DBFILE} and pushing to iRODS"
     109                                        log "User ${USER} Host ${HOST} Port ${PORT} DBNAME ${DBNAME} Home ${HOME}"
     110                                        ${PGDUMP} -U ${USER} -h ${HOST} -p ${PORT} ${DBNAME} > /tmp/${DBFILE}
     111                                        log "Before IPUT"
     112                                        log "${IPUT} -f /tmp/${DBFILE} /geniRenci/home/rods/"
     113                                        log `${IPUT} -V -f /tmp/${DBFILE} /geniRenci/home/rods/ 2>&1`
     114                                        # ${IPUT} -f /tmp/${DBFILE} /geniRenci/home/rods/
     115                                        ${IPUT} -f /tmp/${DBFILE} /geniRenci/home/${USERNAME}/experiments/${EXPNAME}-${TIMESTAMP}/measurements.sql
     116                                        log "After IPUT"
     117                                        ;;
     118                                *)
     119                                        log "DB ${ARGUMENTS} closed, but don't know how to handle it"
     120                                        ;;
     121                        esac
     122                        ;;
     123                "EXIT")
     124                        log "Exiting"
     125                        exit 0
     126                        ;;
     127                *)
     128                        log "Unknown command"
     129                        ;;
     130        esac
     131done
     132
     133}}}
     134
     135At the [http://groups.geni.net/geni/wiki/GIMI-GEC16-Tutorials/GIMI-GEC16-TutorialB/OmlServer following page] we give the interested experimenter additional information on how they can run their own OML server independent of the one offered by GIMI.
     136
     137----
     138
     139=== C.1.2 Verification of Topology ===
     140After establishing the slice on which the experiment will be executed, the experimenter will be most likely
     141be interested in verifying if the slice has been initiated correctly. In this tutorial, we use an [[http://emmy9.casa.umass.edu/GEC15-GIMI-Tutorial/step1-ping_all.rb OMF experiment script]] that executes pings between neighboring nodes.
     142[[BR]]
     143The following figure shows that a total of 12 (between each pair of nodes and in each direction) ping are performed.
     144
     145[[Image(ping.png)]]
     146
     147{{{
     148defProperty('source1', "nodeA", "ID of a resource")
     149defProperty('source2', "nodeB", "ID of a resource")
     150defProperty('source3', "nodeC", "ID of a resource")
     151defProperty('source4', "nodeD", "ID of a resource")
     152defProperty('source5', "nodeE", "ID of a resource")
     153
     154#defProperty('sink1', "nodeA", "ID of a sink")
     155#defProperty('sink2', "nodeB", "ID of a sink")
     156#defProperty('sink3', "nodeC", "ID of a sink")
     157#defProperty('sink4', "nodeD", "ID of a sink")
     158#defProperty('sink5', "nodeE", "ID of a sink")
     159
     160defProperty('sinkaddr11', '192.168.4.10', "Ping destination address")
     161defProperty('sinkaddr12', '192.168.5.12', "Ping destination address")
     162
     163defProperty('sinkaddr21', '192.168.4.11', "Ping destination address")
     164defProperty('sinkaddr22', '192.168.2.12', "Ping destination address")
     165defProperty('sinkaddr23', '192.168.1.13', "Ping destination address")
     166
     167defProperty('sinkaddr31', '192.168.5.11', "Ping destination address")
     168defProperty('sinkaddr32', '192.168.2.10', "Ping destination address")
     169defProperty('sinkaddr33', '192.168.3.13', "Ping destination address")
     170defProperty('sinkaddr34', '192.168.6.14', "Ping destination address")
     171
     172defProperty('sinkaddr41', '192.168.1.10', "Ping destination address")
     173defProperty('sinkaddr42', '192.168.3.12', "Ping destination address")
     174
     175defProperty('sinkaddr51', '192.168.6.12', "Ping destination address")
     176
     177defApplication('ping_app', 'pingmonitor') do |a|
     178    a.path = "/root/pingWrap.rb"
     179    a.version(1, 2, 0)
     180    a.shortDescription = "Wrapper around ping"
     181    a.description = "ping application"
     182    a.defProperty('dest_addr', 'Address to ping', '-a', {:type => :string, :dynamic => false})
     183    a.defProperty('count', 'Number of times to ping', '-c', {:type => :integer, :dynamic => false})
     184    a.defProperty('interval', 'Interval between pings in s', '-i', {:type => :integer, :dynamic => false})
     185
     186    a.defMeasurement('myping') do |m|
     187     m.defMetric('dest_addr',:string)
     188     m.defMetric('ttl',:int)
     189     m.defMetric('rtt',:float)
     190     m.defMetric('rtt_unit',:string)
     191   end
     192end
     193
     194defGroup('Source1', property.source1) do |node|
     195  node.addApplication("ping_app") do |app|
     196    app.setProperty('dest_addr', property.sinkaddr11)
     197    app.setProperty('count', 30)
     198    app.setProperty('interval', 1)
     199    app.measure('myping', :samples => 1)
     200  end
     201
     202  node.addApplication("ping_app") do |app|
     203    app.setProperty('dest_addr', property.sinkaddr12)
     204    app.setProperty('count', 30)
     205    app.setProperty('interval', 1)
     206    app.measure('myping', :samples => 1)
     207  end
     208end
     209
     210defGroup('Source2', property.source2) do |node|
     211  node.addApplication("ping_app") do |app|
     212    app.setProperty('dest_addr', property.sinkaddr21)
     213    app.setProperty('count', 30)
     214    app.setProperty('interval', 1)
     215    app.measure('myping', :samples => 1)
     216  end
     217
     218  node.addApplication("ping_app") do |app|
     219    app.setProperty('dest_addr', property.sinkaddr22)
     220    app.setProperty('count', 30)
     221    app.setProperty('interval', 1)
     222    app.measure('myping', :samples => 1)
     223  end
     224
     225  node.addApplication("ping_app") do |app|
     226    app.setProperty('dest_addr', property.sinkaddr23)
     227    app.setProperty('count', 30)
     228    app.setProperty('interval', 1)
     229    app.measure('myping', :samples => 1)
     230  end
     231end
     232
     233defGroup('Source3', property.source3) do |node|
     234  node.addApplication("ping_app") do |app|
     235    app.setProperty('dest_addr', property.sinkaddr31)
     236    app.setProperty('count', 30)
     237    app.setProperty('interval', 1)
     238    app.measure('myping', :samples => 1)
     239  end
     240
     241  node.addApplication("ping_app") do |app|
     242    app.setProperty('dest_addr', property.sinkaddr32)
     243    app.setProperty('count', 30)
     244    app.setProperty('interval', 1)
     245    app.measure('myping', :samples => 1)
     246  end
     247
     248  node.addApplication("ping_app") do |app|
     249    app.setProperty('dest_addr', property.sinkaddr33)
     250    app.setProperty('count', 30)
     251    app.setProperty('interval', 1)
     252    app.measure('myping', :samples => 1)
     253  end
     254
     255  node.addApplication("ping_app") do |app|
     256    app.setProperty('dest_addr', property.sinkaddr34)
     257    app.setProperty('count', 30)
     258    app.setProperty('interval', 1)
     259    app.measure('myping', :samples => 1)
     260  end
     261end
     262
     263defGroup('Source4', property.source4) do |node|
     264
     265  node.addApplication("ping_app") do |app|
     266    app.setProperty('dest_addr', property.sinkaddr41)
     267    app.setProperty('count', 30)
     268    app.setProperty('interval', 1)
     269    app.measure('myping', :samples => 1)
     270  end
     271
     272  node.addApplication("ping_app") do |app|
     273    app.setProperty('dest_addr', property.sinkaddr42)
     274    app.setProperty('count', 30)
     275    app.setProperty('interval', 1)
     276    app.measure('myping', :samples => 1)
     277  end
     278end
     279
     280defGroup('Source5', property.source5) do |node|
     281  node.addApplication("ping_app") do |app|
     282    app.setProperty('dest_addr', property.sinkaddr51)
     283    app.setProperty('count', 30)
     284    app.setProperty('interval', 1)
     285    app.measure('myping', :samples => 1)
     286  end
     287end
     288
     289onEvent(:ALL_UP_AND_INSTALLED) do |event|
     290  info "Starting the ping"
     291  allGroups.startApplications
     292  wait 5
     293  info "Stopping the ping"
     294  allGroups.stopApplications
     295  Experiment.done
     296end
     297}}}
     298
     299The script is executed from the user workspace as follows:
     300
     301{{{
     302$ cd ~/Tutorials/GIMI/common/
     303$ omf-5.4 exec --no-am -e gimiXX-ping_all -S gimiXX step1-ping_all.rb
     304}}}
     305
     306Where gimiXX has to be replaced by the slice name you are using for your experiment.
     307
     308You should see the following output after executing the omf command.
     309
     310{{{
     311 INFO NodeHandler: OMF Experiment Controller 5.4 (git e0eefcf)
     312 INFO NodeHandler: Slice ID: gimi20
     313 INFO NodeHandler: Experiment ID: gimi20-2012-10-18t14.03.42-04.00
     314 INFO NodeHandler: Message authentication is disabled
     315 WARN NodeHandler: AM support disabled - any service calls will fail!
     316 INFO Experiment: load system:exp:stdlib
     317 INFO property.resetDelay: resetDelay = 210 (Fixnum)
     318 INFO property.resetTries: resetTries = 1 (Fixnum)
     319 INFO Experiment: load system:exp:eventlib
     320 INFO Experiment: load ping_all.rb
     321 INFO property.source1: source1 = "nodeA" (String)
     322 INFO property.source2: source2 = "nodeB" (String)
     323 INFO property.source3: source3 = "nodeC" (String)
     324 INFO property.source4: source4 = "nodeD" (String)
     325 INFO property.source5: source5 = "nodeE" (String)
     326 INFO property.sinkaddr11: sinkaddr11 = "192.168.4.10" (String)
     327 INFO property.sinkaddr12: sinkaddr12 = "192.168.5.12" (String)
     328 INFO property.sinkaddr21: sinkaddr21 = "192.168.4.11" (String)
     329 INFO property.sinkaddr22: sinkaddr22 = "192.168.2.12" (String)
     330 INFO property.sinkaddr23: sinkaddr23 = "192.168.1.13" (String)
     331 INFO property.sinkaddr31: sinkaddr31 = "192.168.5.11" (String)
     332 INFO property.sinkaddr32: sinkaddr32 = "192.168.2.10" (String)
     333 INFO property.sinkaddr33: sinkaddr33 = "192.168.3.13" (String)
     334 INFO property.sinkaddr34: sinkaddr34 = "192.168.6.14" (String)
     335 INFO property.sinkaddr41: sinkaddr41 = "192.168.1.10" (String)
     336 INFO property.sinkaddr42: sinkaddr42 = "192.168.3.12" (String)
     337 INFO property.sinkaddr51: sinkaddr51 = "192.168.6.12" (String)
     338 INFO Topology: Loading topology 'nodeA'.
     339 INFO Topology: Loading topology 'nodeB'.
     340 INFO Topology: Loading topology 'nodeC'.
     341 INFO Topology: Loading topology 'nodeD'.
     342 INFO Topology: Loading topology 'nodeE'.
     343 INFO Experiment: Switching ON resources which are OFF
     344 INFO ALL_UP_AND_INSTALLED: Event triggered. Starting the associated tasks.
     345 INFO exp: Starting the ping
     346 INFO exp: Request from Experiment Script: Wait for 5s....
     347 INFO exp: Stopping the ping
     348 INFO EXPERIMENT_DONE: Event triggered. Starting the associated tasks.
     349 INFO NodeHandler:
     350 INFO NodeHandler: Shutting down experiment, please wait...
     351 INFO NodeHandler:
     352 INFO run: Experiment gimi20-2012-10-18t14.03.42-04.00 finished after 0:16
     353}}}
     354
     355----
     356
     357=== C.1.3 Setup Routing in Experiment Topology ===
     358In more complex topologies routing has to be set up. In our case, this is achieved with the aid of an [[http://emmy9.casa.umass.edu/GEC15-GIMI-Tutorial/step2-routing.rb OMF experiment script]]. The one we use for this tutorial is shown below.
     359
     360{{{
     361defGroup('Node1', "nodeA")
     362defGroup('Node2', "nodeB")
     363defGroup('Node3', "nodeC")
     364defGroup('Node4', "nodeD")
     365defGroup('Node5', "nodeE")
     366
     367
     368onEvent(:ALL_UP) do |event|
     369  wait 1
     370  info 'Changing routing setup'
     371
     372  group('Node1').exec("route add -net 192.168.1.0/24 gw 192.168.4.10")
     373  group('Node1').exec("route add -net 192.168.2.0/24 gw 192.168.4.10")
     374  group('Node1').exec("route add -net 192.168.3.0/24 gw 192.168.5.12")
     375  group('Node1').exec("route add -net 192.168.6.0/24 gw 192.168.5.12")
     376  group('Node1').exec("echo 1 >  /proc/sys/net/ipv4/ip_forward")
     377
     378  group('Node2').exec("route add -net 192.168.3.0/24 gw 192.168.1.13")
     379  group('Node2').exec("route add -net 192.168.5.0/24 gw 192.168.4.11")
     380  group('Node2').exec("route add -net 192.168.6.0/24 gw 192.168.2.12")
     381  group('Node2').exec("echo 1 >  /proc/sys/net/ipv4/ip_forward")
     382
     383  group('Node3').exec("route add -net 192.168.1.0/24 gw 192.168.3.13")
     384  group('Node3').exec("route add -net 192.168.4.0/24 gw 192.168.5.11")
     385  group('Node3').exec("echo 1 >  /proc/sys/net/ipv4/ip_forward")
     386
     387  group('Node4').exec("route add -net 192.168.2.0/24 gw 192.168.3.12")
     388  group('Node4').exec("route add -net 192.168.4.0/24 gw 192.168.1.10")
     389  group('Node4').exec("route add -net 192.168.5.0/24 gw 192.168.3.12")
     390  group('Node4').exec("route add -net 192.168.6.0/24 gw 192.168.3.12")
     391  group('Node4').exec("echo 1 >  /proc/sys/net/ipv4/ip_forward")
     392
     393  group('Node5').exec("route add -net 192.168.2.0/24 gw 192.168.6.12")
     394  group('Node5').exec("route add -net 192.168.1.0/24 gw 192.168.6.12")
     395  group('Node5').exec("route add -net 192.168.3.0/24 gw 192.168.6.12")
     396  group('Node5').exec("route add -net 192.168.4.0/24 gw 192.168.6.12")
     397  group('Node5').exec("route add -net 192.168.5.0/24 gw 192.168.6.12")
     398
     399  info 'Routing setup finished'
     400  wait 5
     401  info 'Stopping applications'
     402  allGroups.stopApplications
     403  wait 1
     404  Experiment.done
     405end
     406}}}
     407
     408This script can be easily adapted if the experimenter wishes to set up the routing between the nodes
     409differently.
     410
     411The script is executed from the user workspace as follows:
     412
     413{{{
     414$ cd ~/Tutorials/GIMI/common/
     415$ omf-5.4 exec --no-am -e gimiXX-routing -S gimiXX step2-routing.rb
     416}}}
     417
     418Where gimiXX has to be replaced by the slice name you are using for your experiment.
     419
     420You should see the following output after executing the omf command.
     421
     422{{{
     423 INFO NodeHandler: OMF Experiment Controller 5.4 (git e0eefcf)
     424 INFO NodeHandler: Slice ID: gimi20
     425 INFO NodeHandler: Experiment ID: gimi20-2012-10-18t14.14.10-04.00
     426 INFO NodeHandler: Message authentication is disabled
     427 WARN NodeHandler: AM support disabled - any service calls will fail!
     428 INFO Experiment: load system:exp:stdlib
     429 INFO property.resetDelay: resetDelay = 210 (Fixnum)
     430 INFO property.resetTries: resetTries = 1 (Fixnum)
     431 INFO Experiment: load system:exp:eventlib
     432 INFO Experiment: load routing.rb
     433 INFO Topology: Loading topology 'nodeA'.
     434 INFO Topology: Loading topology 'nodeB'.
     435 INFO Topology: Loading topology 'nodeC'.
     436 INFO Topology: Loading topology 'nodeD'.
     437 INFO Topology: Loading topology 'nodeE'.
     438 INFO Experiment: Switching ON resources which are OFF
     439 INFO ALL_UP: Event triggered. Starting the associated tasks.
     440 INFO exp: Request from Experiment Script: Wait for 1s....
     441 INFO exp: Changing routing setup
     442 INFO exp: Routing setup finished
     443 INFO exp: Request from Experiment Script: Wait for 5s....
     444 INFO exp: Stopping applications
     445 INFO exp: Request from Experiment Script: Wait for 1s....
     446 INFO EXPERIMENT_DONE: Event triggered. Starting the associated tasks.
     447 INFO NodeHandler:
     448 INFO NodeHandler: Shutting down experiment, please wait...
     449 INFO NodeHandler:
     450 INFO run: Experiment gimi20-2012-10-18t14.14.10-04.00 finished after 0:16
     451}}}
     452
     453----
     454
     455=== C.1.4 Verification of Routing ===
     456After establishing the routing, we use an [[http://emmy9.casa.umass.edu/GEC15-GIMI-Tutorial/step3-ping_e2e.rb OMF experiment script]] that executes pings between each pair of nodes that contains one hop, to verify the correctness of routing setup.
     457
     458[[Image(GIMIPing_e2e.png)]]
     459
     460{{{
     461defProperty('source1', "nodeA", "ID of a resource")
     462defProperty('source2', "nodeB", "ID of a resource")
     463defProperty('source3', "nodeC", "ID of a resource")
     464defProperty('source4', "nodeD", "ID of a resource")
     465defProperty('source5', "nodeE", "ID of a resource")
     466
     467defProperty('sinkaddr11', '192.168.1.13', "Ping destination address")
     468defProperty('sinkaddr12', '192.168.3.13', "Ping destination address")
     469defProperty('sinkaddr13', '192.168.6.14', "Ping destination address")
     470
     471defProperty('sinkaddr21', '192.168.6.14', "Ping destination address")
     472
     473defProperty('sinkaddr41', '192.168.4.11', "Ping destination address")
     474defProperty('sinkaddr42', '192.168.5.11', "Ping destination address")
     475defProperty('sinkaddr43', '192.168.6.14', "Ping destination address")
     476
     477defProperty('sinkaddr51', '192.168.5.11', "Ping destination address")
     478defProperty('sinkaddr52', '192.168.2.10', "Ping destination address")
     479defProperty('sinkaddr53', '192.168.3.13', "Ping destination address")
     480
     481defApplication('ping_app', 'pingmonitor') do |a|
     482        a.path = "/root/pingWrap.rb"
     483        a.version(1, 2, 0)
     484        a.shortDescription = "Wrapper around ping"
     485        a.description = "ping application"
     486        a.defProperty('dest_addr', 'Address to ping', '-a', {:type => :string, :dynamic => false})
     487        a.defProperty('count', 'Number of times to ping', '-c', {:type => :integer, :dynamic => false})
     488        a.defProperty('interval', 'Interval between pings in s', '-i', {:type => :integer, :dynamic => false})
     489       
     490        a.defMeasurement('myping') do |m|
     491            m.defMetric('dest_addr',:string)
     492            m.defMetric('ttl',:int)
     493            m.defMetric('rtt',:float)
     494            m.defMetric('rtt_unit',:string)
     495        end
     496end
     497
     498defGroup('Source1', property.source1) do |node|
     499      node.addApplication("ping_app") do |app|
     500          app.setProperty('dest_addr', property.sinkaddr11)
     501          app.setProperty('count', 30)
     502          app.setProperty('interval', 1)
     503          app.measure('myping', :samples => 1)
     504      end
     505     
     506      node.addApplication("ping_app") do |app|
     507          app.setProperty('dest_addr', property.sinkaddr12)
     508          app.setProperty('count', 30)
     509          app.setProperty('interval', 1)
     510          app.measure('myping', :samples => 1)
     511      end
     512
     513      node.addApplication("ping_app") do |app|         
     514          app.setProperty('dest_addr', property.sinkaddr13)
     515          app.setProperty('count', 30)             
     516          app.setProperty('interval', 1)                 
     517          app.measure('myping', :samples => 1)
     518      end
     519end
     520
     521defGroup('Source2', property.source1) do |node|
     522    node.addApplication("ping_app") do |app|             
     523        app.setProperty('dest_addr', property.sinkaddr21)       
     524        app.setProperty('count', 30)           
     525        app.setProperty('interval', 1)               
     526        app.measure('myping', :samples => 1)                 
     527    end               
     528end
     529
     530defGroup('Source4', property.source3) do |node|
     531      node.addApplication("ping_app") do |app|
     532          app.setProperty('dest_addr', property.sinkaddr41)
     533          app.setProperty('count', 30)
     534          app.setProperty('interval', 1)
     535          app.measure('myping', :samples => 1)
     536      end
     537
     538      node.addApplication("ping_app") do |app|
     539          app.setProperty('dest_addr', property.sinkaddr42)
     540          app.setProperty('count', 30)
     541          app.setProperty('interval', 1)
     542          app.measure('myping', :samples => 1)
     543      end
     544
     545      node.addApplication("ping_app") do |app|
     546          app.setProperty('dest_addr', property.sinkaddr43)
     547          app.setProperty('count', 30)
     548          app.setProperty('interval', 1)
     549          app.measure('myping', :samples => 1)
     550      end
     551end
     552
     553defGroup('Source5', property.source3) do |node|
     554          node.addApplication("ping_app") do |app|
     555              app.setProperty('dest_addr', property.sinkaddr51)
     556              app.setProperty('count', 30)
     557              app.setProperty('interval', 1)
     558              app.measure('myping', :samples => 1)
     559          end
     560
     561          node.addApplication("ping_app") do |app|
     562              app.setProperty('dest_addr', property.sinkaddr52)
     563              app.setProperty('count', 30)
     564              app.setProperty('interval', 1)
     565              app.measure('myping', :samples => 1)
     566          end
     567
     568          node.addApplication("ping_app") do |app|
     569              app.setProperty('dest_addr', property.sinkaddr53)
     570              app.setProperty('count', 30)
     571              app.setProperty('interval', 1)
     572              app.measure('myping', :samples => 1)
     573          end
     574end
     575
     576onEvent(:ALL_UP_AND_INSTALLED) do |event|
     577      info "Starting the ping"
     578      allGroups.startApplications
     579      wait 5
     580      info "Stopping the ping"
     581      allGroups.stopApplications
     582      Experiment.done
     583end
     584}}}
     585
     586The script is executed from the user workspace as follows:
     587
     588{{{
     589$ cd ~/Tutorials/GIMI/common/
     590$ omf-5.4 exec --no-am -e gimiXX-ping_e2e -S gimiXX step3-ping_e2e.rb
     591}}}
     592
     593Where gimiXX has to be replaced by the slice name you are using for your experiment.
     594
     595You should see the following output after executing the omf command.
     596
     597{{{
     598 INFO NodeHandler: OMF Experiment Controller 5.4 (git e0eefcf)
     599 INFO NodeHandler: Slice ID: gimi20
     600 INFO NodeHandler: Experiment ID: gimi20-2012-10-18t14.03.42-04.00
     601 INFO NodeHandler: Message authentication is disabled
     602 WARN NodeHandler: AM support disabled - any service calls will fail!
     603 INFO Experiment: load system:exp:stdlib
     604 INFO property.resetDelay: resetDelay = 210 (Fixnum)
     605 INFO property.resetTries: resetTries = 1 (Fixnum)
     606 INFO Experiment: load system:exp:eventlib
     607 INFO Experiment: load ping_all.rb
     608 INFO property.source1: source1 = "nodeA" (String)
     609 INFO property.source2: source2 = "nodeB" (String)
     610 INFO property.source3: source3 = "nodeC" (String)
     611 INFO property.source4: source4 = "nodeD" (String)
     612 INFO property.source5: source5 = "nodeE" (String)
     613 INFO property.sinkaddr11: sinkaddr11 = "192.168.4.10" (String)
     614 INFO property.sinkaddr12: sinkaddr12 = "192.168.5.12" (String)
     615 INFO property.sinkaddr21: sinkaddr21 = "192.168.4.11" (String)
     616 INFO property.sinkaddr22: sinkaddr22 = "192.168.2.12" (String)
     617 INFO property.sinkaddr23: sinkaddr23 = "192.168.1.13" (String)
     618 INFO property.sinkaddr31: sinkaddr31 = "192.168.5.11" (String)
     619 INFO property.sinkaddr32: sinkaddr32 = "192.168.2.10" (String)
     620 INFO property.sinkaddr33: sinkaddr33 = "192.168.3.13" (String)
     621 INFO property.sinkaddr34: sinkaddr34 = "192.168.6.14" (String)
     622 INFO property.sinkaddr41: sinkaddr41 = "192.168.1.10" (String)
     623 INFO property.sinkaddr42: sinkaddr42 = "192.168.3.12" (String)
     624 INFO property.sinkaddr51: sinkaddr51 = "192.168.6.12" (String)
     625 INFO Topology: Loading topology 'nodeA'.
     626 INFO Topology: Loading topology 'nodeB'.
     627 INFO Topology: Loading topology 'nodeC'.
     628 INFO Topology: Loading topology 'nodeD'.
     629 INFO Topology: Loading topology 'nodeE'.
     630 INFO Experiment: Switching ON resources which are OFF
     631 INFO ALL_UP_AND_INSTALLED: Event triggered. Starting the associated tasks.
     632 INFO exp: Starting the ping
     633 INFO exp: Request from Experiment Script: Wait for 5s....
     634 INFO exp: Stopping the ping
     635 INFO EXPERIMENT_DONE: Event triggered. Starting the associated tasks.
     636 INFO NodeHandler:
     637 INFO NodeHandler: Shutting down experiment, please wait...
     638 INFO NodeHandler:
     639 INFO run: Experiment gimi20-2012-10-18t14.03.42-04.00 finished after 0:16
     640}}}
     641
     642----
     643
     644=== C.2 Running Actual Experiment ===
     645
     646We will use an [[http://emmy9.casa.umass.edu/GEC15-GIMI-Tutorial/step4-otg_nmetrics.rb OMF experiment script]] to execute oml enabled traffic generator and receiver (otg and otr) to simulate network traffic, and use oml enabled nmetrics to measure the system usage (e.g., CUP, memory) and network interface usage on each of the participated ExoGENI nodes.
     647
     648[[Image(otg_nmetrics.png)]]
     649
     650
     651
     652The one we use for this tutorial is shown below.
     653
     654{{{
     655defProperty('theSender','nodeB','ID of sender node')
     656defProperty('theReceiver1', 'nodeE', "ID of receiver node")
     657defProperty('theReceiver2', 'nodeA', "ID of receiver node")
     658defProperty('theReceiver3', 'nodeD', "ID of receiver node")
     659defProperty('packetsize', 128, "Packet size (byte) from the sender node")
     660defProperty('bitrate', 2048, "Bitrate (bit/s) from the sender node")
     661defProperty('runtime', 40, "Time in second for the experiment is to run")
     662
     663defGroup('Sender',property.theSender) do |node|
     664    options = { 'sample-interval' => 2 }
     665    node.addPrototype("system_monitor", options)
     666    node.addApplication("test:app:otg2") do |app|
     667        app.setProperty('udp:local_host', '192.168.2.10')
     668        app.setProperty('udp:dst_host', '192.168.6.14')
     669        app.setProperty('udp:dst_port', 3000)
     670        app.setProperty('cbr:size', property.packetsize)
     671        app.setProperty('cbr:rate', property.bitrate * 2)
     672        app.measure('udp_out', :samples => 1)
     673    end
     674   
     675    node.addApplication("test:app:otg2") do |app|
     676        app.setProperty('udp:local_host', '192.168.4.10')
     677        app.setProperty('udp:dst_host', '192.168.4.11')
     678        app.setProperty('udp:dst_port', 3000)
     679        app.setProperty('cbr:size', property.packetsize)
     680        app.setProperty('cbr:rate', property.bitrate * 2)
     681        app.measure('udp_out', :samples => 1)
     682    end
     683   
     684    node.addApplication("test:app:otg2") do |app|
     685        app.setProperty('udp:local_host', '192.168.1.10')
     686        app.setProperty('udp:dst_host', '192.168.1.13')
     687        app.setProperty('udp:dst_port', 3000)                                   
     688        app.setProperty('cbr:size', property.packetsize)                                           
     689        app.setProperty('cbr:rate', property.bitrate * 2)                                                   
     690        app.measure('udp_out', :samples => 1)                                                       
     691    end
     692end
     693
     694defGroup('Receiver1',property.theReceiver1) do |node|
     695    options = { 'sample-interval' => 2 }
     696    node.addPrototype("system_monitor", options)
     697
     698    node.addApplication("test:app:otr2") do |app|
     699        app.setProperty('udp:local_host', '192.168.6.14')
     700        app.setProperty('udp:local_port', 3000)
     701        app.measure('udp_in', :samples => 1)
     702    end
     703end
     704
     705defGroup('Receiver2',property.theReceiver2) do |node|
     706    options = { 'sample-interval' => 2 }
     707    node.addPrototype("system_monitor", options)
     708    node.addApplication("test:app:otr2") do |app|
     709        app.setProperty('udp:local_host', '192.168.4.11')
     710        app.setProperty('udp:local_port', 3000)
     711        app.measure('udp_in', :samples => 1)
     712    end
     713end
     714
     715defGroup('Receiver3',property.theReceiver3) do |node|     
     716    options = { 'sample-interval' => 2 }
     717    node.addPrototype("system_monitor", options)
     718    node.addApplication("test:app:otr2") do |app|                   
     719        app.setProperty('udp:local_host', '192.168.1.13')
     720        app.setProperty('udp:local_port', 3000)                               
     721        app.measure('udp_in', :samples => 1)                                   
     722    end
     723end
     724
     725onEvent(:ALL_UP_AND_INSTALLED) do |event|
     726    info "starting"
     727    wait 5
     728    allGroups.exec("ln -s /usr/local/bin/otr2 /usr/bin/otr2")
     729    allGroups.exec("ln -s /usr/local/bin/otg2 /usr/bin/otg2")
     730    allGroups.exec("ln -s /usr/local/bin/oml2-nmetrics /usr/bin/oml2-nmetrics")
     731    allGroups.startApplications
     732    info "All applications started..."
     733    wait property.runtime / 4
     734    property.packetsize = 256
     735    wait property.runtime / 4
     736    property.packetsize = 512
     737    wait property.runtime / 4
     738    property.packetsize = 1024
     739    wait property.runtime / 4
     740    allGroups.stopApplications
     741    info "All applications stopped."
     742    Experiment.done
     743end
     744}}}
     745
     746The script is executed from the user workspace as follows:
     747
     748{{{
     749$ cd ~/Tutorials/GIMI/common/
     750$ omf-5.4 exec --no-am -e gimiXX-otg_nmetrics -S gimiXX step4-otg_nmetrics.rb
     751}}}
     752
     753Where gimiXX has to be replaced by the slice name you are using for your experiment.
     754
     755You should see the following output (or similar) after executing the omf command.
     756
     757{{{
     758 INFO NodeHandler: OMF Experiment Controller 5.4 (git e0eefcf)
     759 INFO NodeHandler: Slice ID: gimi20
     760 INFO NodeHandler: Experiment ID: gimi20-2012-10-18t13.51.41-04.00
     761 INFO NodeHandler: Message authentication is disabled
     762 WARN NodeHandler: AM support disabled - any service calls will fail!
     763 INFO Experiment: load system:exp:stdlib
     764 INFO property.resetDelay: resetDelay = 210 (Fixnum)
     765 INFO property.resetTries: resetTries = 1 (Fixnum)
     766 INFO Experiment: load system:exp:eventlib
     767 INFO Experiment: load otg_nmetrics.rb
     768 INFO property.theSender: theSender = "nodeB" (String)
     769 INFO property.theReceiver1: theReceiver1 = "nodeE" (String)
     770 INFO property.theReceiver2: theReceiver2 = "nodeA" (String)
     771 INFO property.theReceiver3: theReceiver3 = "nodeD" (String)
     772 INFO property.packetsize: packetsize = 128 (Fixnum)
     773 INFO property.bitrate: bitrate = 2048 (Fixnum)
     774 INFO property.runtime: runtime = 40 (Fixnum)
     775 INFO Topology: Loading topology 'nodeB'.
     776 INFO Topology: Loading topology 'nodeE'.
     777 INFO Topology: Loading topology 'nodeA'.
     778 INFO Topology: Loading topology 'nodeD'.
     779 INFO Experiment: Switching ON resources which are OFF
     780 INFO ALL_UP_AND_INSTALLED: Event triggered. Starting the associated tasks.
     781 INFO exp: starting
     782 INFO exp: Request from Experiment Script: Wait for 5s....
     783 INFO exp: All applications started...
     784 INFO exp: Request from Experiment Script: Wait for 10s....
     785 INFO property.packetsize: packetsize = 256 (Fixnum)
     786 INFO exp: Request from Experiment Script: Wait for 10s....
     787 INFO property.packetsize: packetsize = 512 (Fixnum)
     788 INFO exp: Request from Experiment Script: Wait for 10s....
     789 INFO property.packetsize: packetsize = 1024 (Fixnum)
     790 INFO exp: Request from Experiment Script: Wait for 10s....
     791 INFO exp: All applications stopped.
     792 INFO EXPERIMENT_DONE: Event triggered. Starting the associated tasks.
     793 INFO NodeHandler:
     794 INFO NodeHandler: Shutting down experiment, please wait...
     795 INFO NodeHandler:
     796 INFO run: Experiment gimi20-2012-10-18t13.51.41-04.00 finished after 0:56
     797}}}
     798----
     799
     800[[BR]]
     801[[BR]]