Amend topology creation script in openflow renderer.
[nemo.git] / nemo-renderers / openflow-renderer / src / test / resources / network-up-servicechain.sh
1 #!/bin/bash
2
3 ########## sw1 ##########
4 ip link add name sw1-eth2 type veth peer name fw2-eth0
5 ip link add name sw1-eth3 type veth peer name sw3-eth1
6
7 ########## sw2 ##########
8 ip link add name sw2-eth1 type veth peer name cache1-eth0
9 ip link add name sw2-eth3 type veth peer name sw3-eth2
10
11 ########## sw3 ##########
12 #ip link add name sw3-eth1 type veth peer name sw1-eth3
13 #ip link add name sw3-eth2 type veth peer name sw2-eth3
14 ip link add name sw3-eth3 type veth peer name sw4-eth1
15
16 ########## sw4 ##########
17 #ip link add name sw4-eth1 type veth peer name sw3-eth3
18
19 ########## fw2 ##########
20 ip netns add fw2
21 ip link set fw2-eth0 netns fw2
22
23 ########## cache1 ##########
24 ip netns add cache1
25 ip link set cache1-eth0 netns cache1
26
27 ########## sw1 ##########
28 ofdatapath -i eth0,sw1-eth2,sw1-eth3 punix:/tmp/sw1 -d 000000000001 1> /tmp/sw1-ofd.log 2> /tmp/sw1-ofd.log &
29 ofprotocol unix:/tmp/sw1 tcp:127.0.0.1:6633 --fail=closed --listen=ptcp:6661 1> /tmp/sw1-ofp.log 2> /tmp/sw1-ofp.log &
30
31 ########## sw2 ##########
32 ofdatapath -i sw2-eth1,eth1,sw2-eth3 punix:/tmp/sw2 -d 000000000002 1> /tmp/sw2-ofd.log 2> /tmp/sw2-ofd.log &
33 ofprotocol unix:/tmp/sw2 tcp:127.0.0.1:6633 --fail=closed --listen=ptcp:6662 1> /tmp/sw2-ofp.log 2> /tmp/sw2-ofp.log &
34
35 ########## sw3 ##########
36 ofdatapath -i sw3-eth1,sw3-eth2,sw3-eth3,eth2 punix:/tmp/sw3 -d 000000000003 1> /tmp/sw3-ofd.log 2> /tmp/sw3-ofd.log &
37 ofprotocol unix:/tmp/sw3 tcp:127.0.0.1:6633 --fail=closed --listen=ptcp:6663 1> /tmp/sw3-ofp.log 2> /tmp/sw3-ofp.log &
38
39 ########## sw4 ##########
40 ofdatapath -i sw4-eth1,eth3 punix:/tmp/sw4 -d 000000000004 1> /tmp/sw4-ofd.log 2> /tmp/sw4-ofd.log &
41 ofprotocol unix:/tmp/sw4 tcp:127.0.0.1:6633 --fail=closed --listen=ptcp:6664 1> /tmp/sw4-ofp.log 2> /tmp/sw4-ofp.log &
42
43 sleep 5
44
45 exit 0
46
47
48
49 ip netns exec fw2 bash
50 ifconfig fw2-eth0 down
51 ifconfig fw2-eth0 hw ether 00:00:00:00:00:01
52 ifconfig fw2-eth0 up
53 ifconfig fw2-eth0
54 exit
55
56 ip netns exec cache1 bash
57 ifconfig cache1-eth0 down
58 ifconfig cache1-eth0 hw ether 00:00:00:00:00:02
59 ifconfig cache1-eth0 up
60 ifconfig cache1-eth0
61 exit
62
63
64
65 echo 1 > /proc/sys/net/ipv4/ip_forward
66 cat /proc/sys/net/ipv4/ip_forward
67
68 iptables -A FORWARD -i eth0 -j DROP
69 iptables -vxnL FORWARD
70
71 iptables -D FORWARD -i eth0 -j DROP
72 iptables -vxnL FORWARD