Adding nemo engine.
[nemo.git] / nemo-renderers / openflow-renderer / src / test / resources / network-up-bod.sh
1 #!/bin/bash
2
3 ########## sw1 ##########
4 ip link add name sw1-eth1 type veth peer name server1-eth0
5 ip link add name sw1-eth2 type veth peer name vm1-eth0
6 ip link add name sw1-eth3 type veth peer name sw3-eth1
7
8 ########## sw2 ##########
9 ip link add name sw2-eth1 type veth peer name vm2-eth0
10 ip link add name sw2-eth3 type veth peer name sw3-eth2
11
12 ########## sw3 ##########
13 #ip link add name sw3-eth1 type veth peer name sw1-eth3
14 #ip link add name sw3-eth2 type veth peer name sw2-eth3
15 ip link add name sw3-eth3 type veth peer name sw4-eth1
16
17 ########## sw4 ##########
18 #ip link add name sw4-eth1 type veth peer name sw3-eth3
19
20 ########## server1 ##########
21 ip netns add server1
22 ip link set server1-eth0 netns server1
23
24 ########## vm1 ##########
25 ip netns add vm1
26 ip link set vm1-eth0 netns vm1
27
28 ########## vm2 ##########
29 ip netns add vm2
30 ip link set vm2-eth0 netns vm2
31
32 ########## sw1 ##########
33 ofdatapath -i sw1-eth1,sw1-eth2,sw1-eth3 punix:/tmp/sw1 -d 000000000001 1> /tmp/sw1-ofd.log 2> /tmp/sw1-ofd.log &
34 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 &
35
36 ########## sw2 ##########
37 ofdatapath -i sw2-eth1,eth1,sw2-eth3 punix:/tmp/sw2 -d 000000000002 1> /tmp/sw2-ofd.log 2> /tmp/sw2-ofd.log &
38 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 &
39
40 ########## sw3 ##########
41 ofdatapath -i sw3-eth1,sw3-eth2,sw3-eth3,eth2 punix:/tmp/sw3 -d 000000000003 1> /tmp/sw3-ofd.log 2> /tmp/sw3-ofd.log &
42 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 &
43
44 ########## sw4 ##########
45 ofdatapath -i sw4-eth1,eth3 punix:/tmp/sw4 -d 000000000004 1> /tmp/sw4-ofd.log 2> /tmp/sw4-ofd.log &
46 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 &
47
48 sleep 5
49
50 ########## lldp ##########
51 dpctl unix:/tmp/sw1 flow-mod cmd=add,table=0 eth_type=0x88cc apply:output=ctrl:0xff
52 dpctl unix:/tmp/sw2 flow-mod cmd=add,table=0 eth_type=0x88cc apply:output=ctrl:0xff
53 dpctl unix:/tmp/sw3 flow-mod cmd=add,table=0 eth_type=0x88cc apply:output=ctrl:0xff
54 dpctl unix:/tmp/sw4 flow-mod cmd=add,table=0 eth_type=0x88cc apply:output=ctrl:0xff
55
56 exit 0
57
58
59
60 ip netns exec server1 bash
61 ifconfig server1-eth0 down
62 ifconfig server1-eth0 hw ether 00:00:00:00:00:03
63 ifconfig server1-eth0 192.168.11.2/24
64 ifconfig server1-eth0 up
65 ifconfig server1-eth0
66 route add default gw 192.168.11.1
67 route -n
68 arp -s 192.168.11.1 00:00:0a:0b:0c:01
69 exit
70
71 ip netns exec vm1 bash
72 ifconfig vm1-eth0 down
73 ifconfig vm1-eth0 hw ether 00:00:00:00:00:01
74 ifconfig vm1-eth0 192.168.12.2/24
75 ifconfig vm1-eth0 up
76 ifconfig vm1-eth0
77 route add default gw 192.168.12.1
78 route -n
79 arp -s 192.168.12.1 00:00:0a:0b:0c:02
80 arp -s 192.168.12.3 00:00:00:00:00:02
81 arp -s 192.168.12.4 08:00:27:a0:a9:b3
82 exit
83
84 ip netns exec vm2 bash
85 ifconfig vm2-eth0 down
86 ifconfig vm2-eth0 hw ether 00:00:00:00:00:02
87 ifconfig vm2-eth0 192.168.12.3/24
88 ifconfig vm2-eth0 up
89 ifconfig vm2-eth0
90 route add default gw 192.168.12.1
91 route -n
92 arp -s 192.168.12.1 00:00:0a:0b:0c:02
93 arp -s 192.168.12.2 00:00:00:00:00:01
94 arp -s 192.168.12.4 08:00:27:a0:a9:b3
95 exit
96
97
98
99 ip netns exec server1 bash
100 ping -c 3 192.168.12.4
101 ping -c 3 192.168.13.2
102 ping -c 3 172.168.1.2
103 exit
104
105 ip netns exec vm1 bash
106 ping -c 3 192.168.12.3
107 ping -c 3 192.168.12.4
108 ping -c 3 192.168.11.2
109 ping -c 3 192.168.13.2
110 ping -c 3 172.168.1.2
111 exit
112
113 ip netns exec vm2 bash
114 ping -c 3 192.168.12.2
115 ping -c 3 192.168.12.4
116 ping -c 3 192.168.11.2
117 ping -c 3 192.168.13.2
118 ping -c 3 172.168.1.2
119 exit