Refine release note & Update scenario test results
[yardstick.git] / yardstick / benchmark / scenarios / networking / ping6_setup_with_odl.bash
1 #!/bin/bash
2
3 ##############################################################################
4 # Copyright (c) 2015 Huawei Technologies Co.,Ltd and others.
5 #
6 # All rights reserved. This program and the accompanying materials
7 # are made available under the terms of the Apache License, Version 2.0
8 # which accompanies this distribution, and is available at
9 # http://www.apache.org/licenses/LICENSE-2.0
10 ##############################################################################
11 # need to debug
12
13 # download and create image
14 source /opt/admin-openrc.sh
15 wget https://download.fedoraproject.org/pub/fedora/linux/releases/22/Cloud/x86_64/Images/Fedora-Cloud-Base-22-20150521.x86_64.qcow2
16 glance image-create --name 'Fedora22' --disk-format qcow2 \
17 --container-format bare --file ./Fedora-Cloud-Base-22-20150521.x86_64.qcow2
18
19 # create router
20 neutron router-create ipv4-router
21 neutron router-create ipv6-router
22
23 #  Associate the net04_ext to the Neutron routers
24 neutron router-gateway-set ipv6-router ext-net
25 neutron router-gateway-set ipv4-router ext-net
26
27 # create two ipv4 networks with associated subnets
28 neutron net-create ipv4-int-network1
29 neutron net-create ipv4-int-network2
30
31 # Create IPv4 subnet and associate it to ipv4-router
32 neutron subnet-create --name ipv4-int-subnet1 \
33 --dns-nameserver 8.8.8.8 ipv4-int-network1 20.0.0.0/24
34
35 # Associate the ipv4-int-subnet1 with ipv4-router
36 neutron router-interface-add ipv4-router ipv4-int-subnet1
37
38 # BIN-HU: Here, for scenario 2, ipv6-int-subnet2 cannot be created automatically because of a bug in ODL
39 # BIN-HU: we need to manually spawn a RADVD daemon in ipv6-router namespace
40
41 # Create an IPv4 subnet ipv4-int-subnet2 and associate it with ipv6-router
42 neutron subnet-create --name ipv4-int-subnet2 --dns-nameserver 8.8.8.8 ipv4-int-network2 10.0.0.0/24
43
44 neutron router-interface-add ipv6-router ipv4-int-subnet2
45
46 # BIN-HU: for the reason above in scenario 2, we need to remove the following command
47
48 # create key
49 nova keypair-add vRouterKey > ~/vRouterKey
50
51 # Create ports for vRouter
52 neutron port-create --name eth0-vRouter --mac-address fa:16:3e:11:11:11 ipv4-int-network2
53 neutron port-create --name eth1-vRouter --mac-address fa:16:3e:22:22:22 ipv4-int-network1
54
55 # Create ports for VM1 and VM2.
56 neutron port-create --name eth0-VM1 --mac-address fa:16:3e:33:33:33 ipv4-int-network1
57 neutron port-create --name eth0-VM2 --mac-address fa:16:3e:44:44:44 ipv4-int-network1
58
59
60 # Hope you are cloning the following repo for some files like radvd.conf and metadata.txt
61 # JFYI, metadata.txt is available at the following git repo. https://github.com/sridhargaddam/opnfv_os_ipv6_poc/blob/master/metadata.txt
62 # vRouter boot
63 nova boot --image Fedora22 --flavor m1.small \
64 --user-data ./metadata.txt \
65 --nic port-id=$(neutron port-list | grep -w eth0-vRouter | awk '{print $2}') \
66 --nic port-id=$(neutron port-list | grep -w eth1-vRouter | awk '{print $2}') \
67 --key-name vRouterKey vRouter
68
69 # BIN-HU: Note that some other parameters might be needed in Scenario 2, if it does not work
70 # BIN-HU: Refer to http://artifacts.opnfv.org/ipv6/docs/setupservicevm/4-ipv6-configguide-servicevm.html#boot-two-other-vms-in-ipv4-int-network1
71 # BIN-HU: Section 3.5.7
72 # VM create
73 nova boot --image Fedora22  --flavor m1.small \
74 --nic port-id=$(neutron port-list | grep -w eth0-VM1 | awk '{print $2}') \
75 --key-name vRouterKey VM1
76
77 nova boot --image Fedora22  --flavor m1.small \
78 --nic port-id=$(neutron port-list | grep -w eth0-VM2 | awk '{print $2}') \
79 --key-name vRouterKey VM2
80
81 nova list
82
83 # BIN-HU: Now we need to spawn a RADVD daemon inside ipv6-router namespace
84 # BIN-HU: The following is specific for Scenario 2 to spawn a RADVD daemon in ipv6-router namespace
85 # BIN-HU: Refer to http://artifacts.opnfv.org/ipv6/docs/setupservicevm/4-ipv6-configguide-servicevm.html#spawn-radvd-in-ipv6-router
86 # BIN-HU: Section 3.5.8, Steps SETUP-SVM-24 through SETUP-SVM-30
87 # BIN-HU: Also note that in case of HA deployment, ipv6-router created in previous step
88 # BIN-HU: could be in any of the controller node. Thus you need to identify in which controller node
89 # BIN-HU: ipv6-router is created in order to manually spawn RADVD daemon inside the ipv6-router
90 # BIN-HU: namespace in the following steps.
91 # BIN-HU: Just FYI: the following command in Neutron will display the controller on which the
92 # BIN-HU: ipv6-router is spawned.
93 neutron l3-agent-list-hosting-router ipv6-router
94
95 # find host which is located by ipv6-router, but need to debug
96 host_num=$(neutron l3-agent-list-hosting-router ipv6-router | grep True | awk -F [=\ ] '{printf $4}')
97 ssh $host_num
98
99 # BIN-HU: identify the ipv6-router namespace and move to the namespace
100 sudo ip netns exec qrouter-$(neutron router-list | grep -w ipv6-router | awk '{print $2}') bash
101
102 # BIN-HU: Inside ipv6-router namespace, configure the IPv6 address on the <qr-xxx> interface.
103 export router_interface=$(ip a s | grep -w "global qr-*" | awk '{print $7}')
104 ip -6 addr add 2001:db8:0:1::1 dev $router_interface
105
106 # BIN-HU: Update the sample file radvd.conf with $router_interface
107 sed -i 's/$router_interface/'$router_interface'/g' ~/br-ex.radvd.conf
108
109 # BIN-HU: Spawn a RADVD daemon to simulate an external router
110 radvd -C ~/br-ex.radvd.conf -p ~/br-ex.pid.radvd
111
112 # BIN-HU: Add an IPv6 downstream route pointing to the eth0 interface of vRouter.
113 ip -6 route add 2001:db8:0:2::/64 via 2001:db8:0:1:f816:3eff:fe11:1111
114
115 # BIN-HU: you can double check the routing table
116 ip -6 route show
117
118 exit
119 # BIN-HU: End of Scenario 2, and you can continue to SSH etc., the same as Scenario 1