Internal/Mapping/Topologies/Topo4: macfair.rb

File macfair.rb, 2.8 KB (added by zhibinwu, 13 years ago)
Line 
1
2Experiment.name = "macfair"
3Experiment.project = "orbit:tutorial"
4Experiment.defProperty('offerload', 2000, 'offered load of flow')
5Experiment.defProperty('packetsize',1024, 'size of flow')
6#
7# Define nodes used in experiment
8#
9defNodes('sender1', [3,3]) {|node|
10  node.image = nil  # assume the right image to be on disk
11
12  node.prototype("test:proto:sender", {
13    'destinationHost' => '192.168.2.2',
14    'packetSize' => 1024,
15    'rate' =>prop.offerload,
16    'protocol' => 'udp'
17   
18  })
19  node.net.w0.mode = "managed"
20  node.net.w0.essid = "one"
21}
22
23defNodes('receiver1',[2,2]) {|node|
24  node.image = nil  # assume the right image to be on disk
25  node.prototype("test:proto:receiver" , {
26    'protocol' => 'udp_libmac',
27    'hostname' => '192.168.2.2'
28  })
29  node.net.w0.mode = "master"
30  node.net.w0.essid = "one"
31}
32
33defNodes('sender2', [6,6]) {|node|
34  node.image = nil  # assume the right image to be on disk
35
36  node.prototype("test:proto:sender", {
37    'destinationHost' => '192.168.8.8',
38    'packetSize' => 1024,
39    'rate' => prop.offerload,
40    'protocol' => 'udp'
41  })
42  node.net.w0.mode = "master"
43  node.net.w0.essid = "two"
44}
45
46defNodes('receiver2', [8,8]) {|node|
47  node.image = nil  # assume the right image to be on disk
48  node.prototype("test:proto:receiver" , {
49    'protocol' => 'udp_libmac' ,
50    'hostname' => '192.168.8.8'
51  })
52  node.net.w0.mode = "managed"
53  node.net.w0.essid = "two"
54}
55
56defNodes('sender3', [11,11]) {|node|
57  node.image = nil  # assume the right image to be on disk
58
59  node.prototype("test:proto:sender", {
60    'destinationHost' => '192.168.12.12',
61    'packetSize' => 1024,
62    'rate' => prop.offerload  ,
63    'protocol' => 'udp',
64
65  })
66  node.net.w0.mode = "master"
67  node.net.w0.essid = "three"
68}
69
70defNodes('receiver3', [12,12]) {|node|
71  node.image = nil  # assume the right image to be on disk
72  node.prototype("test:proto:receiver" , {
73    'protocol' => 'udp_libmac',
74    'hostname' => '192.168.12.12'
75})
76  node.net.w0.mode = "managed"
77  node.net.w0.essid = "three"
78}
79
80defNodes('sender4', [13,13]) {|node|
81  node.image = nil  # assume the right image to be on disk
82
83  node.prototype("test:proto:sender", {
84    'destinationHost' => '192.168.16.16',
85    'packetSize' => 1024,
86    'rate' =>prop.offerload ,
87    'protocol' => 'udp',
88  })
89  node.net.w0.mode = "master"
90  node.net.w0.essid = "four"
91}
92
93defNodes('receiver4', [16,16]) {|node|
94  node.image = nil  # assume the right image to be on disk
95  node.prototype("test:proto:receiver" , {
96    'protocol' => 'udp_libmac',
97    'hostname' => '192.168.16.16'
98  })
99  node.net.w0.mode = "managed"
100  node.net.w0.essid = "four"
101}
102
103allNodes.net.w0 { |w|
104  w.type = 'b'
105  w.ip = "%192.168.%x.%y"
106}
107
108#
109# Now, start the application
110#
111whenAllInstalled() {|node|
112  wait 30
113
114  allNodes.startApplications
115  wait 60
116
117  Experiment.done
118}
119