201 | | |
| 201 | defGroup('Node1', "nodeA") |
| 202 | defGroup('Node2', "nodeB") |
| 203 | defGroup('Node3', "nodeC") |
| 204 | defGroup('Node4', "nodeD") |
| 205 | defGroup('Node5', "nodeE") |
| 206 | |
| 207 | onEvent(:ALL_UP) do |event| |
| 208 | wait 1 |
| 209 | info 'Changing routing setup' |
| 210 | |
| 211 | group('Node1').exec("route add -net 192.168.1.0/24 gw 192.168.4.10") |
| 212 | group('Node1').exec("route add -net 192.168.2.0/24 gw 192.168.4.10") |
| 213 | group('Node1').exec("route add -net 192.168.3.0/24 gw 192.168.5.12") |
| 214 | group('Node1').exec("route add -net 192.168.6.0/24 gw 192.168.5.12") |
| 215 | group('Node1').exec("echo 1 > /proc/sys/net/ipv4/ip_forward") |
| 216 | |
| 217 | group('Node2').exec("route add -net 192.168.3.0/24 gw 192.168.1.13") |
| 218 | group('Node2').exec("route add -net 192.168.5.0/24 gw 192.168.4.11") |
| 219 | group('Node2').exec("route add -net 192.168.6.0/24 gw 192.168.2.12") |
| 220 | group('Node2').exec("echo 1 > /proc/sys/net/ipv4/ip_forward") |
| 221 | |
| 222 | group('Node3').exec("route add -net 192.168.1.0/24 gw 192.168.3.13") |
| 223 | group('Node3').exec("route add -net 192.168.4.0/24 gw 192.168.5.11") |
| 224 | group('Node3').exec("echo 1 > /proc/sys/net/ipv4/ip_forward") |
| 225 | |
| 226 | group('Node4').exec("route add -net 192.168.2.0/24 gw 192.168.3.12") |
| 227 | group('Node4').exec("route add -net 192.168.4.0/24 gw 192.168.1.10") |
| 228 | group('Node4').exec("route add -net 192.168.5.0/24 gw 192.168.3.12") |
| 229 | group('Node4').exec("route add -net 192.168.6.0/24 gw 192.168.3.12") |
| 230 | group('Node4').exec("echo 1 > /proc/sys/net/ipv4/ip_forward") |
| 231 | |
| 232 | group('Node5').exec("route add -net 192.168.2.0/24 gw 192.168.6.12") |
| 233 | group('Node5').exec("route add -net 192.168.1.0/24 gw 192.168.6.12") |
| 234 | group('Node5').exec("route add -net 192.168.3.0/24 gw 192.168.6.12") |
| 235 | group('Node5').exec("route add -net 192.168.4.0/24 gw 192.168.6.12") |
| 236 | group('Node5').exec("route add -net 192.168.5.0/24 gw 192.168.6.12") |
| 237 | |
| 238 | info 'Routing setup finished' |
| 239 | wait 5 |
| 240 | info 'Stopping applications' |
| 241 | allGroups.stopApplications |
| 242 | wait 1 |
| 243 | Experiment.done |
| 244 | end |