30 | | # A) Define the 'sender' group, which has the unique node [1,1] |
31 | | # Nodes in this group will execute the application 'test:proto:sender' |
32 | | # |
33 | | defGroup('sender', [1,1]) {|node| |
34 | | |
35 | | node.prototype("test:proto:sender", { |
36 | | 'destinationHost' => '192.168.1.2', |
37 | | 'packetSize' => 1024, |
38 | | 'rate' => 300, |
39 | | 'protocol' => 'udp' |
40 | | }) |
41 | | |
42 | | node.net.w0.mode = "managed" |
43 | | } |
44 | | |
45 | | # |
46 | | # B) Define the 'receiver' group, which has the unique node [1,2] |
47 | | # Nodes in this group will execute the application 'test:proto:receiver' |
48 | | # |
49 | | defGroup('receiver', [1,2]) {|node| |
50 | | |
51 | | node.prototype("test:proto:receiver" , { |
52 | | 'protocol' => 'udp' |
53 | | }) |
54 | | |
55 | | node.net.w0.mode = "master" |
56 | | } |
57 | | |
58 | | # |
59 | | # C) Configure the wireless interfaces of all the nodes involved in |
60 | | # this experiment |
61 | | # |
62 | | allGroups.net.w0 { |w| |
63 | | w.type = 'b' |
64 | | w.channel = "6" |
65 | | w.essid = "helloworld" |
66 | | w.ip = "%192.168.%x.%y" |
67 | | } |
68 | | |
69 | | # |
70 | | # D) When all the nodes are turned On and the all the applications |
71 | | # are installed and ready, we can start to perform the experiment |
72 | | # |
73 | | whenAllInstalled() {|node| |
74 | | |
75 | | wait 30 |
76 | | |
| 30 | # Tutorial experiment |
| 31 | # |
| 32 | defProperty('duration', 60, "Duration of the experiment") |
| 33 | defProperty('graph', false, "Display graph or not") |
| 34 | |
| 35 | baseTopo = Topology['system:topo:imaged'] |
| 36 | |
| 37 | st = defTopology("sender") do |t| |
| 38 | t.addNode(baseTopo.getNodeByIndex(0)) |
| 39 | end |
| 40 | |
| 41 | rt = defTopology("receiver") do |t| |
| 42 | t.addNode(baseTopo.getNodeByIndex(1)) |
| 43 | end |
| 44 | |
| 45 | defGroup('Sender', "sender") do |node| |
| 46 | node.addApplication("test:app:otg2") do |app| |
| 47 | app.setProperty('udp:local_host', '192.168.0.2') |
| 48 | app.setProperty('udp:dst_host', '192.168.0.3') |
| 49 | app.setProperty('udp:dst_port', 3000) |
| 50 | app.measure('udp_out', :samples => 1) |
| 51 | end |
| 52 | node.net.w1.mode = "adhoc" |
| 53 | node.net.w1.type = 'g' |
| 54 | node.net.w1.channel = "6" |
| 55 | node.net.w1.essid = "helloworld" |
| 56 | node.net.w1.ip = "192.168.0.2" |
| 57 | end |
| 58 | |
| 59 | defGroup('Receiver', "receiver") do |node| |
| 60 | node.addApplication("test:app:otr2") do |app| |
| 61 | app.setProperty('udp:local_host', '192.168.0.3') |
| 62 | app.setProperty('udp:local_port', 3000) |
| 63 | app.measure('udp_in', :samples => 1) |
| 64 | end |
| 65 | node.net.w1.mode = "adhoc" |
| 66 | node.net.w1.type = 'g' |
| 67 | node.net.w1.channel = "6" |
| 68 | node.net.w1.essid = "helloworld" |
| 69 | node.net.w1.ip = "192.168.0.3" |
| 70 | end |
| 71 | |
| 72 | onEvent(:ALL_UP_AND_INSTALLED) do |event| |
| 73 | info "This is my first OMF experiment" |
| 74 | wait 15 |