omf_ec 6.0.0.pre.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. data/.gitignore +4 -0
  2. data/Gemfile +4 -0
  3. data/Rakefile +7 -0
  4. data/bin/omf_test +161 -0
  5. data/config/ec.yml +164 -0
  6. data/exp_repo/system/exp/eventlib.rb +96 -0
  7. data/exp_repo/system/exp/imageNode.rb +283 -0
  8. data/exp_repo/system/exp/reset.rb +21 -0
  9. data/exp_repo/system/exp/saveNode.rb +99 -0
  10. data/exp_repo/system/exp/stat.rb +49 -0
  11. data/exp_repo/system/exp/stdlib.rb +122 -0
  12. data/exp_repo/system/exp/tell.rb +53 -0
  13. data/exp_repo/system/exp/testlib.rb +12 -0
  14. data/exp_repo/system/exp/winlib.rb +154 -0
  15. data/exp_repo/system/topo/active.rb +9 -0
  16. data/exp_repo/system/topo/all.rb +10 -0
  17. data/exp_repo/system/topo/circle.rb +23 -0
  18. data/exp_repo/test/app/aodvd.rb +73 -0
  19. data/exp_repo/test/app/appDef1.rb +102 -0
  20. data/exp_repo/test/app/athstats.rb +76 -0
  21. data/exp_repo/test/app/echo.rb +36 -0
  22. data/exp_repo/test/app/gennyReceiverAppDef.rb +100 -0
  23. data/exp_repo/test/app/gennySenderAppDef.rb +106 -0
  24. data/exp_repo/test/app/itgdec.rb +79 -0
  25. data/exp_repo/test/app/itgr.rb +77 -0
  26. data/exp_repo/test/app/itgs.rb +105 -0
  27. data/exp_repo/test/app/nop.rb +36 -0
  28. data/exp_repo/test/app/otg2.rb +68 -0
  29. data/exp_repo/test/app/otg2_mp.rb +56 -0
  30. data/exp_repo/test/app/otr2.rb +56 -0
  31. data/exp_repo/test/app/otr2_mp.rb +51 -0
  32. data/exp_repo/test/app/trace_oml2.rb +62 -0
  33. data/exp_repo/test/app/wlanconfig_oml2.rb +42 -0
  34. data/exp_repo/test/exp/conf-room-demo.rb +118 -0
  35. data/exp_repo/test/exp/planetlab.rb +82 -0
  36. data/exp_repo/test/exp/test01.rb +42 -0
  37. data/exp_repo/test/exp/test02.rb +60 -0
  38. data/exp_repo/test/exp/test03.rb +95 -0
  39. data/exp_repo/test/exp/test04.rb +105 -0
  40. data/exp_repo/test/exp/test05.rb +87 -0
  41. data/exp_repo/test/exp/test06.rb +71 -0
  42. data/exp_repo/test/exp/tutorial/hello-world-wired.rb +79 -0
  43. data/exp_repo/test/exp/tutorial/hello-world-wireless.rb +87 -0
  44. data/exp_repo/test/exp/tutorial/using-filters.rb +69 -0
  45. data/exp_repo/test/exp/tutorial/using-groups.rb +64 -0
  46. data/exp_repo/test/exp/tutorial/using-properties.rb +93 -0
  47. data/exp_repo/test/exp/tutorial/using-prototypes.rb +111 -0
  48. data/exp_repo/test/proto/aodvrouter.rb +55 -0
  49. data/exp_repo/test/proto/driverqueryapp.rb +59 -0
  50. data/exp_repo/test/proto/forwarder.rb +73 -0
  51. data/exp_repo/test/proto/itgcbrsender.rb +70 -0
  52. data/exp_repo/test/proto/itgdecoder.rb +64 -0
  53. data/exp_repo/test/proto/itgreceiver.rb +55 -0
  54. data/exp_repo/test/proto/itgvoipsender.rb +64 -0
  55. data/exp_repo/test/proto/listener2.rb +62 -0
  56. data/exp_repo/test/proto/nop.rb +47 -0
  57. data/exp_repo/test/proto/probelink.rb +48 -0
  58. data/exp_repo/test/proto/raw_receiver.rb +64 -0
  59. data/exp_repo/test/proto/receiver2_mp.rb +48 -0
  60. data/exp_repo/test/proto/sender2_mp.rb +54 -0
  61. data/exp_repo/test/proto/udp_receiver.rb +55 -0
  62. data/exp_repo/test/proto/udp_sender.rb +61 -0
  63. data/lib/omf_ec/version.rb +3 -0
  64. data/lib/omf_ec.rb +5 -0
  65. data/omf_ec.gemspec +24 -0
  66. metadata +145 -0
@@ -0,0 +1,118 @@
1
+ #
2
+ # Copyright (c) 2006-2010 National ICT Australia (NICTA), Australia
3
+ #
4
+ # Copyright (c) 2004-2010 WINLAB, Rutgers University, USA
5
+ #
6
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ # of this software and associated documentation files (the "Software"), to deal
8
+ # in the Software without restriction, including without limitation the rights
9
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ # copies of the Software, and to permit persons to whom the Software is
11
+ # furnished to do so, subject to the following conditions:
12
+ #
13
+ # The above copyright notice and this permission notice shall be included in
14
+ # all copies or substantial portions of the Software.
15
+ #
16
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
+ # THE SOFTWARE.
23
+ #
24
+ #
25
+
26
+ defProperty('hrnPrefix', "omf.nicta.node", "Prefix to use for the HRN of resources")
27
+ defProperty('resources', "[1,2,3,4,5,8,9,10,11,12,13]", "List of IDs for the resources to use as senders")
28
+ defProperty('receiver', "6", "ID for the resource to use as a receiver")
29
+ defProperty('groupSize', 4, "Number of resources to put in each group of senders")
30
+ defProperty('rate', 300, 'Bits per second sent from senders')
31
+ defProperty('packetSize', 256, 'Byte size of packets sent from senders')
32
+ defProperty('wifiType', "g", "The type of WIFI to use in this experiment")
33
+ defProperty('channel', '6', "The WIFI channel to use in this experiment")
34
+ defProperty('netid', "confroom", "The ESSID to use in this experiment")
35
+ defProperty('stepDuration', 60, "The duration of each step of this conf-room")
36
+
37
+ # Define the Receiver
38
+ defGroup('Receiver', "#{property.hrnPrefix}#{property.receiver}") do |node|
39
+ node.addApplication("test:app:otr2") do |app|
40
+ app.setProperty('udp:local_host', '%net.w0.ip%')
41
+ app.setProperty('udp:local_port', 3000)
42
+ app.measure('udp_in', :samples => 1)
43
+ end
44
+ node.net.w0.mode = "master"
45
+ node.net.w0.type = property.wifiType
46
+ node.net.w0.channel = property.channel
47
+ node.net.w0.essid = property.netid
48
+ node.net.w0.ip = "192.168.0.254"
49
+ end
50
+
51
+ # Define each Sender groups
52
+ groupList = []
53
+ res = eval(property.resources.value)
54
+ groupNumber = res.size >= property.groupSize ? (res.size.to_f / property.groupSize.value.to_f).ceil : 1
55
+ (1..groupNumber).each do |i|
56
+ list = []
57
+ (1..property.groupSize).each do |j| popped = res.pop ; list << popped if !popped.nil? end
58
+ senderNames = list.collect do |id| "#{property.hrnPrefix}#{id}" end
59
+ senders = senderNames.join(',')
60
+
61
+ info "Group Sender #{i}: '#{senders}'"
62
+ groupList << "Sender#{i}"
63
+ defGroup("Sender#{i}", senders) do |node|
64
+ node.addApplication("test:app:otg2") do |app|
65
+ app.setProperty('udp:local_host', '%net.w0.ip%')
66
+ app.setProperty('udp:dst_host', '192.168.0.254')
67
+ app.setProperty('udp:dst_port', 3000)
68
+ app.setProperty('cbr:size', property.packetSize)
69
+ app.setProperty('cbr:rate', property.rate)
70
+ app.measure('udp_out', :samples => 1)
71
+ end
72
+ node.net.w0.mode = "managed"
73
+ node.net.w0.type = property.wifiType
74
+ node.net.w0.channel = property.channel
75
+ node.net.w0.essid = property.netid
76
+ node.net.w0.ip = "192.168.0.%index%"
77
+ end
78
+ end
79
+
80
+ onEvent(:ALL_UP_AND_INSTALLED) do |event|
81
+ wait 10
82
+ group('Receiver').startApplications
83
+ wait 10
84
+ (1..groupNumber).each do |i|
85
+ group("Sender#{i}").startApplications
86
+ wait property.stepDuration
87
+ end
88
+ wait 60
89
+ (1..groupNumber).each do |i|
90
+ group("Sender#{i}").stopApplications
91
+ wait property.stepDuration
92
+ end
93
+ group('Receiver').stopApplications
94
+ Experiment.done
95
+ end
96
+
97
+
98
+ addTab(:defaults)
99
+ addTab(:graph2) do |tab|
100
+ opts = { :postfix => %{Sender index for incoming UDP traffic = F(time)}, :updateEvery => 1 }
101
+ tab.addGraph("Incoming UDP", opts) do |g|
102
+ data = Hash.new
103
+ index = 1
104
+ mpIn = ms('udp_in')
105
+ mpIn.project(:oml_ts_server, :src_host, :seq_no).each do |sample|
106
+ time, src, seq = sample.tuple
107
+ if data[src].nil?
108
+ data[src] = [index,[]]
109
+ index += 1
110
+ end
111
+ data[src][1] << [time, data[src][0]]
112
+ end
113
+ data.each do |src,value|
114
+ g.addLine(value[1], :label => "Node #{value[0]}")
115
+ end
116
+ end
117
+ end
118
+
@@ -0,0 +1,82 @@
1
+ #
2
+ # Copyright (c) 2006-2009 National ICT Australia (NICTA), Australia
3
+ #
4
+ # Copyright (c) 2004-2009 WINLAB, Rutgers University, USA
5
+ #
6
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ # of this software and associated documentation files (the "Software"), to deal
8
+ # in the Software without restriction, including without limitation the rights
9
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ # copies of the Software, and to permit persons to whom the Software is
11
+ # furnished to do so, subject to the following conditions:
12
+ #
13
+ # The above copyright notice and this permission notice shall be included in
14
+ # all copies or substantial portions of the Software.
15
+ #
16
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
+ # THE SOFTWARE.
23
+ #
24
+ #
25
+ Experiment.name = "planetlab"
26
+ Experiment.project = "orbit-planetlab:tutorial"
27
+
28
+ #Backup PlanetLab nodes
29
+ #ssh -v -l orbit_pkamat -i ~/.ssh/identity alice.cs.princeton.edu
30
+ #ssh -v -l orbit_pkamat -i ~/.ssh/identity pli2-pa-1.hpl.hp.com
31
+ #ssh -v -l orbit_pkamat -i ~/.ssh/identity planetlab2.rutgers.edu
32
+ #ssh -v -l orbit_pkamat -i ~/.ssh/identity pli2-pa-1.hpl.hp.com
33
+ #ssh -v -l orbit_pkamat -i ~/.ssh/identity pli2-pa-2.hpl.hp.com
34
+ #ssh -v -l orbit_pkamat -i ~/.ssh/identity pli2-pa-3.hpl.hp.com
35
+
36
+ #Launch http server on the Planetlab node
37
+ #runCmd("ssh -v -l orbit_pkamat -i ~/.ssh/identity alice.cs.princeton.edu \"sudo /etc/init.d/httpd start\"")
38
+ runCmd(" #{LAUNCH_ON_PLANETLAB} \"sudo /etc/init.d/httpd start\"")
39
+
40
+ #
41
+ # Define nodes used in experiment
42
+ #
43
+ # node 1,2 is the media proxy fetching the stream from PlanetLab
44
+ # and relaying to node8-7
45
+
46
+ defGroup('vlcrelay', [1,2]) {|node|
47
+ node.image = nil # assume the right image to be on disk
48
+
49
+ node.prototype("test:proto:vlcrelay", {
50
+ })
51
+ node.net.w0.mode = "master" #802.11 Master Mode
52
+ }
53
+
54
+ defGroup('vlcdest', [8,7]) {|node|
55
+ node.image = nil # assume the right image to be on disk
56
+
57
+ node.prototype("test:proto:vlcdest", {
58
+ })
59
+ node.net.w0.mode = "managed" #802.11 Master Mode
60
+ }
61
+
62
+ allGroups.net.w0 { |w|
63
+ w.type = 'b' #Set all nodes to use 802.11b
64
+ w.essid = "helloworld" #essid = helloworld
65
+ w.ip = "%192.168.%x.%y" #IP address = 192.168.x.y
66
+ }
67
+ #
68
+ # Now, start the application
69
+ #
70
+ whenAllInstalled() {|node|
71
+
72
+ #Start the relaying application on the wireless side
73
+ allNodes.startApplications
74
+
75
+ #Run the experiment for 60 seconds
76
+ wait 60
77
+
78
+ #Stop the Planetlab media service
79
+ runCmd("ssh -v -l orbit_pkamat -i ~/.ssh/identity alice.cs.princeton.edu \"sudo /etc/init.d/httpd stop\"")
80
+
81
+ Experiment.done
82
+ }
@@ -0,0 +1,42 @@
1
+ #
2
+ # Test 1
3
+ #
4
+ # Testing one node in one group running one exec command for an already installed app
5
+ #
6
+
7
+ defProperty('res1', "unconfigured-node-1", "ID of a node")
8
+ defProperty('res2', "unconfigured-node-2", "ID of a node")
9
+
10
+ defGroup('Actor', property.res1)
11
+
12
+ onEvent(:ALL_UP) do |event|
13
+ wait 3
14
+ info "TEST - allGroups"
15
+ allGroups.exec("/bin/date")
16
+ wait 3
17
+ info "TEST - group"
18
+ group("Actor").exec("/bin/hostname -f")
19
+ wait 3
20
+ Experiment.done
21
+ end
22
+
23
+ #
24
+ # Checking the Execution
25
+ # Here you do whatever is required to check that the above experiment went well
26
+ # Then return true if you decided that it did, or false otherwise
27
+ #
28
+ # Experiment log file is at: property.logpath
29
+ # Also you may want to look at system:exp:testlib
30
+ #
31
+
32
+ def check_outcome
33
+
34
+ # Test 01 is successfull if for each of the 2 exec commands above, the log
35
+ # file has a message from the AgentCommands module containing "DONE.OK"
36
+ logfile = "#{property.logpath}/#{Experiment.ID}.log"
37
+ lines = IO.readlines("#{logfile}")
38
+ match1 = lines.grep(/DONE\.OK/)
39
+ match2 = match1.grep(/AgentCommands/)
40
+ result = (match2.length == 2) ? true : false
41
+ return result
42
+ end
@@ -0,0 +1,60 @@
1
+ #
2
+ # Test 2
3
+ #
4
+ # Testing 2 nodes in multiple groups running exec commandis for already installed apps
5
+ #
6
+
7
+ defProperty('res1', "node1", "ID of a node")
8
+ defProperty('res2', "node2", "ID of a node")
9
+
10
+ defGroup('Alice', property.res1)
11
+ defGroup('Bob', property.res2)
12
+ defGroup('Couple', "#{property.res1},#{property.res2}")
13
+ defGroup('GroupOfGroup', ["Alice", "Bob"])
14
+
15
+ onEvent(:ALL_UP) do |event|
16
+ wait 5
17
+ info "-------------"
18
+ info "TEST - Group of 2 (res1,res2)"
19
+ group("Couple").exec("/bin/hostname")
20
+ wait 5
21
+ info "---------------------"
22
+ info "TEST - Group of Group ( (res1) and (res2) )"
23
+ group("GroupOfGroup").exec("/bin/hostname")
24
+ wait 5
25
+ info "---------------"
26
+ info "TEST - allGroup"
27
+ allGroups.exec("/bin/hostname")
28
+ wait 5
29
+ Experiment.done
30
+ end
31
+
32
+ #
33
+ # Checking the Execution
34
+ # Here you do whatever is required to check that the above experiment went well
35
+ # Then return true if you decided that it did, or false otherwise
36
+ #
37
+ # Experiment log file is at: property.logpath
38
+ # Also you may want to look at system:exp:testlib
39
+ #
40
+
41
+ def check_outcome
42
+
43
+ # Test 02 is successfull if:
44
+ # 1) each resource has been enrolled in all its groups as defined above
45
+ # AND
46
+ # 2) for each of the exec commands above, the log file has a message from
47
+ # the AgentCommands module containing "DONE.OK"
48
+ logfile = "#{property.logpath}/#{Experiment.ID}.log"
49
+ lines = IO.readlines("#{logfile}")
50
+ # 1)
51
+ match1 = lines.grep(/is\ Enrolled/)
52
+ result1 = (match1.length == 8) ? true : false
53
+ # 2)
54
+ match1 = lines.grep(/DONE\.OK/)
55
+ match2 = match1.grep(/AgentCommands/)
56
+ result2 = (match2.length == 6) ? true : false
57
+
58
+ return true if result1 && result2
59
+ return false
60
+ end
@@ -0,0 +1,95 @@
1
+ #
2
+ # Test 3
3
+ #
4
+ # Testing 2 nodes in 2 groups running already installed OTG/OTR
5
+ # Also testing static experiment properties
6
+ # Also testing wireless interface configuration
7
+ #
8
+
9
+ defProperty('res1', "unconfigured-node-1", "ID of a node")
10
+ defProperty('res2', "unconfigured-node-2", "ID of a node")
11
+ defProperty('mode1', "adhoc", "wifi mode for 1st node")
12
+ defProperty('mode2', "adhoc", "wifi mode for 2nd node")
13
+ defProperty('wifi', "g", "wifi type to use")
14
+ defProperty('channel', "6", "wifi channel to use")
15
+
16
+ defGroup('Sender', property.res1) {|node|
17
+ node.addApplication("test:app:otg2") {|app|
18
+ app.setProperty('udp:local_host', '192.168.0.2')
19
+ app.setProperty('udp:dst_host', '192.168.0.3')
20
+ app.setProperty('udp:dst_port', 3000)
21
+ app.measure('udp_out', :interval => 3)
22
+ }
23
+ node.net.w0.mode = property.mode1
24
+ node.net.w0.type = property.wifi
25
+ node.net.w0.channel = property.channel
26
+ node.net.w0.essid = "testing"
27
+ node.net.w0.ip = "192.168.0.2"
28
+ }
29
+
30
+ defGroup('Receiver', property.res2) {|node|
31
+ node.addApplication("test:app:otr2") {|app|
32
+ app.setProperty('udp:local_host', '192.168.0.3')
33
+ app.setProperty('udp:local_port', 3000)
34
+ app.measure('udp_in', :samples => 3)
35
+ }
36
+ node.net.w0.mode = property.mode2
37
+ node.net.w0.type = property.wifi
38
+ node.net.w0.channel = property.channel
39
+ node.net.w0.essid = "testing"
40
+ node.net.w0.ip = "192.168.0.3"
41
+ }
42
+
43
+ onEvent(:ALL_UP_AND_INSTALLED) do |event|
44
+ wait 10
45
+ allGroups.startApplications
46
+ wait 10
47
+ info "TEST - Running ifconfig on Sender"
48
+ group('Sender').exec("ifconfig")
49
+ wait 15
50
+ info "TEST - Running ifconfig on Receiver"
51
+ group('Receiver').exec("ifconfig")
52
+ wait 15
53
+ allGroups.stopApplications
54
+ Experiment.done
55
+ end
56
+
57
+
58
+ #
59
+ # Checking the Execution
60
+ # Here you do whatever is required to check that the above experiment went well
61
+ # Then return true if you decided that it did, or false otherwise
62
+ #
63
+ # Experiment log file is at: property.logpath
64
+ # Also you may want to look at system:exp:testlib
65
+ #
66
+
67
+ def check_outcome
68
+
69
+ # Test 03 is successfull if all of the following are true:
70
+ # 1) each resource reports that all its wireless property were configured OK
71
+ # 2) the applications (OTG,OTR,execs) started and finished properly
72
+ # file has a message from the AgentCommands module containing "DONE.OK"
73
+ # 3) a SQ3 database is produced with some entries in the OTG and OTR tables
74
+ logfile = "#{property.logpath}/#{Experiment.ID}.log"
75
+ lines = IO.readlines("#{logfile}")
76
+ # 1)
77
+ match1 = lines.grep(/CONFIGURED\.OK/)
78
+ r1 = (match1.length >= 10) ? true : false
79
+ # 2)
80
+ match1 = lines.grep(/APP_EVENT\ STARTED/)
81
+ r2 = (match1.length == 4) ? true : false
82
+ match1 = lines.grep(/APP_EVENT DONE\.OK/)
83
+ match2 = match1.grep(/AgentCommands/)
84
+ r3 = (match2.length == 4) ? true : false
85
+ # 3)
86
+ cnt1 = cnt2 = 0
87
+ ms('udp_out').project(:oml_ts_server).each { |x| cnt1 =+1 }
88
+ ms('udp_in').project(:oml_ts_server).each { |x| cnt2 =+1 }
89
+ r4 = (cnt1 >= 1) ? true : false
90
+ r5 = (cnt2 >= 1) ? true : false
91
+
92
+ puts "Check Outcome [r1:#{r1} - r2:#{r2} - r3:#{r3} - r4:#{r4} - r5:#{r5}]"
93
+ return true if r1 && r2 && r3 && r4 && r5
94
+ return false
95
+ end
@@ -0,0 +1,105 @@
1
+ #
2
+ # Test 4
3
+ #
4
+ # Testing 2 nodes in 2 groups running already installed OTG/OTR
5
+ # Also testing dynamic experiment properties
6
+ #
7
+
8
+ PKTSIZE = 256
9
+
10
+ defProperty('res1', "unconfigured-node-1", "ID of a node")
11
+ defProperty('res2', "unconfigured-node-2", "ID of a node")
12
+ defProperty('bitrate', 2048, "Bitrate (bit/s) from the sender node")
13
+ defProperty('packetsize', PKTSIZE, "Packet size (byte) from the sender node")
14
+
15
+ defGroup('Sender', property.res1) {|node|
16
+ node.addApplication("test:app:otg2") {|app|
17
+ app.setProperty('udp:local_host', '192.168.0.2')
18
+ app.setProperty('udp:dst_host', '192.168.0.3')
19
+ app.setProperty('udp:dst_port', 3000)
20
+ app.setProperty('cbr:rate', property.bitrate * 2)
21
+ app.setProperty('cbr:size', property.packetsize)
22
+ app.measure('udp_out', :interval => 3)
23
+ }
24
+ node.net.w0.mode = "adhoc"
25
+ node.net.w0.type = 'g'
26
+ node.net.w0.channel = '6'
27
+ node.net.w0.essid = "testing"
28
+ node.net.w0.ip = "192.168.0.2"
29
+ }
30
+
31
+ defGroup('Receiver', property.res2) {|node|
32
+ node.addApplication("test:app:otr2") {|app|
33
+ app.setProperty('udp:local_host', '192.168.0.3')
34
+ app.setProperty('udp:local_port', 3000)
35
+ app.measure('udp_in', :samples => 3)
36
+ }
37
+ node.net.w0.mode = "adhoc"
38
+ node.net.w0.type = 'g'
39
+ node.net.w0.channel = '6'
40
+ node.net.w0.essid = "testing"
41
+ node.net.w0.ip = "192.168.0.3"
42
+ }
43
+
44
+ onEvent(:ALL_UP_AND_INSTALLED) do |event|
45
+ wait 10
46
+ allGroups.startApplications
47
+ wait 15
48
+ info "------------------------------"
49
+ info "TEST - Dynamic property change"
50
+ info "TEST - Value before: #{property.packetsize}"
51
+ property.packetsize = 512
52
+ info "TEST - Value after: #{property.packetsize}"
53
+ wait 15
54
+ allGroups.stopApplications
55
+ Experiment.done
56
+ end
57
+
58
+
59
+
60
+ #
61
+ # Checking the Execution
62
+ # Here you do whatever is required to check that the above experiment went well
63
+ # Then return true if you decided that it did, or false otherwise
64
+ #
65
+ # Experiment log file is at: property.logpath
66
+ # Also you may want to look at system:exp:testlib
67
+ #
68
+
69
+ def check_outcome
70
+
71
+ # Test 04 is successfull if all of the following are true:
72
+ # 1) each resource reports that all its wireless property were configured OK
73
+ # 2) the applications (OTG,OTR,execs) started and finished properly
74
+ # file has a message from the AgentCommands module containing "DONE.OK"
75
+ # 3) a SQ3 database is produced with some entries in the OTG and OTR tables
76
+ # 4) the receiver table of the database has the packetsize value increasing
77
+ logfile = "#{property.logpath}/#{Experiment.ID}.log"
78
+ lines = IO.readlines("#{logfile}")
79
+ # 1)
80
+ match1 = lines.grep(/CONFIGURED\.OK/)
81
+ r1 = (match1.length >= 10) ? true : false
82
+ # 2)
83
+ match1 = lines.grep(/APP_EVENT\ STARTED/)
84
+ r2 = (match1.length == 2) ? true : false
85
+ match1 = lines.grep(/APP_EVENT DONE\.OK/)
86
+ match2 = match1.grep(/AgentCommands/)
87
+ r3 = (match2.length == 2) ? true : false
88
+ # 3)
89
+ cnt1 = cnt2 = 0
90
+ ms('udp_out').project(:oml_ts_server).each { |r| cnt1 =+1 }
91
+ ms('udp_in').project(:oml_ts_server).each { |r| cnt2 =+1 }
92
+ r4 = (cnt1 >= 1) ? true : false
93
+ r5 = (cnt2 >= 1) ? true : false
94
+ # 4)
95
+ max = PKTSIZE
96
+ ms('udp_in').project(:pkt_length_max).each do |r|
97
+ value = r.tuple
98
+ max = value[0]
99
+ end
100
+ r6 = (max > PKTSIZE) ? true : false
101
+
102
+ puts "Check Outcome [r1:#{r1} - r2:#{r2} - r3:#{r3} - r4:#{r4} - r5:#{r5} - r6:#{r6}]"
103
+ return true if r1 && r2 && r3 && r4 && r5 && r6
104
+ return false
105
+ end
@@ -0,0 +1,87 @@
1
+ #
2
+ # Test 5
3
+ #
4
+ # Testing one nodes in one group running a custom app
5
+ # Also testing all the possible bindings between app arguments and OMF
6
+ # Also testing app installation via TAR archive (containing the app and a payload data)
7
+ #
8
+
9
+ defProperty('res1', "unconfigured-node-1", "ID of a node")
10
+ defProperty('res2', "unconfigured-node-2", "ID of a node")
11
+ defProperty('pstring', "ABC", "1st string argument")
12
+ defProperty('pboolean', true, "1st boolean argument")
13
+ defProperty('pinteger', 123, "1st integer argument")
14
+
15
+ defApplication('myAppURI', 'myAppName') { |app|
16
+ app.path = "/usr/bin/myApp"
17
+ app.appPackage = "http://omf.mytestbed.net/myApp.tar"
18
+
19
+ app.defProperty('arg1','Argument 1', '-s', {:order => 1, :type => :string, :dynamic => true})
20
+ app.defProperty('arg2','Argument 2', '--arg2', {:type => :string, :dynamic => false})
21
+ app.defProperty('arg3','Argument 3', '-b', {:type => :boolean, :dynamic => false})
22
+ app.defProperty('arg4','Argument 4', '--arg4', {:type => :boolean, :dynamic => true})
23
+ app.defProperty('arg5','Argument 5', '--arg5', {:type => :boolean, :dynamic => false})
24
+ app.defProperty('arg6','Argument 6', '-i', {:order => 2, :type => :integer, :dynamic => false})
25
+ app.defProperty('arg7','Argument 7', '--arg7', {:type => :integer, :dynamic => true})
26
+ app.defProperty('arg8','Argument 8', nil, {:type => :string, :dynamic => true})
27
+ app.defProperty('arg9','Argument 9', nil, {:type => :integer, :dynamic => false})
28
+ }
29
+
30
+ defGroup('Actor', property.res1) {|n|
31
+ n.addApplication("myAppURI") {|app|
32
+ app.setProperty('arg1', property.pstring) # Displays "-s ABC" in first position!
33
+ app.setProperty('arg2', 'DEF') # Displays "--arg2 DEF"
34
+ app.setProperty('arg3', property.pboolean) # Displays "-b"
35
+ app.setProperty('arg4', true) # Displays "--arg4"
36
+ app.setProperty('arg5', false) # Displays nothing
37
+ app.setProperty('arg6', property.pinteger) # Displays "-i 123" in second position!
38
+ app.setProperty('arg7', 456) # Displays "--arg7 456"
39
+ app.setProperty('arg8', "ZZZ") # Displays "ZZZ"
40
+ app.setProperty('arg9', 000) # Displays "0"
41
+ }
42
+ }
43
+
44
+ onEvent(:ALL_UP_AND_INSTALLED) do |event|
45
+ wait 5
46
+ allGroups.startApplications
47
+ wait 5
48
+ Experiment.done
49
+ end
50
+
51
+
52
+ #
53
+ # Checking the Execution
54
+ # Here you do whatever is required to check that the above experiment went well
55
+ # Then return true if you decided that it did, or false otherwise
56
+ #
57
+ # Experiment log file is at: property.logpath
58
+ # Also you may want to look at system:exp:testlib
59
+ #
60
+
61
+ def check_outcome
62
+
63
+ # Test 03 is successfull if all of the following are true:
64
+ # 1) the tarball is installed OK AND the application runs OK
65
+ # 2) the application outputs the correct payload from the tarball
66
+ # 3) the application accepts and outputs the correct arguments
67
+ logfile = "#{property.logpath}/#{Experiment.ID}.log"
68
+ lines = IO.readlines("#{logfile}")
69
+ # 1)
70
+ match1 = lines.grep(/APP_EVENT\ STARTED/)
71
+ r1 = (match1.length == 2) ? true : false
72
+ match1 = lines.grep(/APP_EVENT DONE\.OK/)
73
+ match2 = match1.grep(/AgentCommands/)
74
+ r2 = (match2.length == 2) ? true : false
75
+ # 2)
76
+ match1 = lines.grep(/PAYLOAD\-1234567890\-PAYLOAD/)
77
+ match2 = match1.grep(/AgentCommands/)
78
+ r3 = (match2.length == 1) ? true : false
79
+ match1 = lines.grep(/\-s\ ABC\ \-i\ 123\ \-\-arg7\ 456\ \-b\ ZZZ\ 0\ \-\-arg4\ \-\-arg2\ DEF/)
80
+ match2 = match1.grep(/AgentCommands/)
81
+ r4 = (match2.length == 1) ? true : false
82
+
83
+ puts "Check Outcome [r1:#{r1} - r2:#{r2} - r3:#{r3} - r4:#{r4}]"
84
+ return true if r1 && r2 && r3 && r4
85
+ return false
86
+
87
+ end
@@ -0,0 +1,71 @@
1
+ #
2
+ # Test 6
3
+ #
4
+ # Testing one nodes in one group running a third party app
5
+ # Also testing app installation via APT-GET
6
+ #
7
+
8
+ defProperty('res1', "unconfigured-node-1", "ID of a node")
9
+ defProperty('res2', "unconfigured-node-2", "ID of a node")
10
+
11
+ defApplication('nmapURI', 'nmap') { |app|
12
+ app.path = "/usr/bin/nmap"
13
+ app.debPackage = "nmap"
14
+
15
+ app.defProperty('target','Host to scan', '--target', {:order => 1, :use_name => false, :type => :string, :dynamic => false})
16
+ app.defProperty('port','Port to scan', '-p', {:order => 2, :type => :string, :dynamic => false})
17
+ }
18
+
19
+ defGroup('Actor', property.res1) {|n|
20
+ n.addApplication("nmapURI") {|app|
21
+ app.setProperty('target', "127.0.0.1")
22
+ app.setProperty('port', '101-200')
23
+ }
24
+ }
25
+
26
+ onEvent(:ALL_UP_AND_INSTALLED) do |event|
27
+ wait 5
28
+ allGroups.startApplications
29
+ wait 10
30
+ # clean:
31
+ rm = "LANGUAGE='C' LANG='C' LC_ALL='C' DEBIAN_FRONTEND='noninteractive' "+
32
+ "apt-get remove nmap -qq -y"
33
+ allGroups.exec(rm)
34
+ wait 10
35
+ Experiment.done
36
+ end
37
+
38
+ #
39
+ # Checking the Execution
40
+ # Here you do whatever is required to check that the above experiment went well
41
+ # Then return true if you decided that it did, or false otherwise
42
+ #
43
+ # Experiment log file is at: property.logpath
44
+ # Also you may want to look at system:exp:testlib
45
+ #
46
+
47
+ def check_outcome
48
+
49
+ # Test 06 is successfull if:
50
+ # 1) the application nmap has been unpacked on the resource
51
+ # AND
52
+ # 2) for the Actor group, the log file has a message from the AgentCommands
53
+ # module containing "DONE.OK" for the install of the app, and for the app
54
+ # execution
55
+
56
+ # Test 06 is successfull if for each of the 2 exec commands above, the log
57
+ # file has a message from the AgentCommands module containing "DONE.OK"
58
+ logfile = "#{property.logpath}/#{Experiment.ID}.log"
59
+ lines = IO.readlines("#{logfile}")
60
+ # 1)
61
+ match1 = lines.grep(/Unpacking\ nmap/)
62
+ match2 = match1.grep(/AgentCommands/)
63
+ result1 = (match2.length == 1) ? true : false
64
+ # 2)
65
+ match1 = lines.grep(/DONE\.OK/)
66
+ match2 = match1.grep(/AgentCommands/)
67
+ result2 = (match2.length >= 2) ? true : false
68
+
69
+ return true if result1 && result2
70
+ return false
71
+ end