UHTutorial: step2-routing.rb

File step2-routing.rb, 2.6 KB (added by divyashri.bhat@gmail.com, 6 years ago)
Line 
1#defProperty('source1', 'omf.nicta.node11', 'ID of a resource')
2#defProperty('source2', 'omf.nicta.node13', 'ID of a resource')
3#defProperty('target', 'emmy9.casa.umass.edu/expect_wget_script.sh', 'download target1')
4#defProperty('target1', 'emmy9.casa.umass.edu/expect_script.sh', 'download target2')
5
6defGroup('Node1', "nodeA-testexogimi")
7defGroup('Node2', "nodeB-testexogimi")
8defGroup('Node3', "nodeC-testexogimi")
9defGroup('Node4', "nodeD-testexogimi")
10defGroup('Node5', "nodeE-testexogimi")
11
12
13onEvent(:ALL_UP) do |event|
14  after 1 do
15#  group('All').startApplications
16  info 'Changing routing setup'
17
18  group('Node1').exec("/sbin/route add -net 192.168.1.0/24 gw 192.168.4.10")
19  group('Node1').exec("/sbin/route add -net 192.168.2.0/24 gw 192.168.4.10")
20  group('Node1').exec("/sbin/route add -net 192.168.3.0/24 gw 192.168.5.12")
21  group('Node1').exec("/sbin/route add -net 192.168.6.0/24 gw 192.168.5.12")
22  group('Node1').exec("echo 1 >  /proc/sys/net/ipv4/ip_forward")
23
24  group('Node2').exec("/sbin/route add -net 192.168.3.0/24 gw 192.168.1.13")
25  group('Node2').exec("/sbin/route add -net 192.168.5.0/24 gw 192.168.4.11")
26  group('Node2').exec("/sbin/route add -net 192.168.6.0/24 gw 192.168.2.12")
27  group('Node2').exec("echo 1 >  /proc/sys/net/ipv4/ip_forward")
28
29  group('Node3').exec("/sbin/route add -net 192.168.1.0/24 gw 192.168.3.13")
30  group('Node3').exec("/sbin/route add -net 192.168.4.0/24 gw 192.168.5.11")
31  group('Node3').exec("echo 1 >  /proc/sys/net/ipv4/ip_forward")
32
33  group('Node4').exec("/sbin/route add -net 192.168.2.0/24 gw 192.168.3.12")
34  group('Node4').exec("/sbin/route add -net 192.168.4.0/24 gw 192.168.1.10")
35  group('Node4').exec("/sbin/route add -net 192.168.5.0/24 gw 192.168.3.12")
36  group('Node4').exec("/sbin/route add -net 192.168.6.0/24 gw 192.168.3.12")
37  group('Node4').exec("echo 1 >  /proc/sys/net/ipv4/ip_forward")
38
39  group('Node5').exec("/sbin/route add -net 192.168.2.0/24 gw 192.168.6.12")
40  group('Node5').exec("/sbin/route add -net 192.168.1.0/24 gw 192.168.6.12")
41  group('Node5').exec("/sbin/route add -net 192.168.3.0/24 gw 192.168.6.12")
42  group('Node5').exec("/sbin/route add -net 192.168.4.0/24 gw 192.168.6.12")
43  group('Node5').exec("/sbin/route add -net 192.168.5.0/24 gw 192.168.6.12")
44
45  info 'Routing setup finished'
46  end
47#  puts "downloading experiment script"
48#  allGroups.exec("wget emmy9.casa.umass.edu/script.sh")
49#  puts "Execute command '/bin/sh expect_wget_script.sh' on all nodes"
50#  allGroups.exec("sh /root/script.sh")
51#  allGroups.startApplications
52  after 6 do
53  info 'Stopping applications'
54  allGroups.stopApplications
55  end
56  after 7 do
57  Experiment.done
58  end
59end