Created OpenStack VTN Support to OpenStack how to.
[docs.git] / manuals / howto-openstack / src / main / asciidoc / openstack-vtn.adoc
1 === OpenStack with Virtual Tenant Network
2 This section describes using OpenDaylight with the VTN manager feature providing network service for OpenStack. VTN manager utilizes the OVSDB southbound service and Neutron for this implementation. The below diagram depicts the communication of OpenDaylight and two virtual networks connected by an OpenFlow switch using this implementation.
3
4 .OpenStack Architecture
5 image::vtn/OpenStackDeveloperGuide.png["OpenStack Architecture",width=500]
6
7 ==== Configure OpenStack to work with OpenDaylight(VTN Feature) using PackStack
8
9 ===== Prerequisites to install OpenStack using PackStack
10 * Fresh CentOS 7.1 minimal install
11 * Use the below commands to disable and remove Network Manager in CentOS 7.1,
12 +
13 ....
14 # systemctl stop NetworkManager
15 # systemctl disable NetworkManager
16 ....
17 +
18 * To make SELINUX as permissive, please open the file "/etc/sysconfig/selinux" and change it as "SELINUX=permissive".
19 * After making selinux as permissive, please restart the CentOS 7.1 machine.
20
21 ===== Steps to install OpenStack PackStack in CentOS 7.1
22
23 * To install OpenStack juno, use the following command,
24 +
25 ....
26 # yum update -y
27 # yum -y install https://repos.fedorapeople.org/repos/openstack/openstack-juno/rdo-release-juno-1.noarch.rpm
28 ....
29 +
30 * To install the packstack installer, please use the below command,
31 +
32 ....
33 # yum -y install openstack-packstack
34 ....
35 +
36 * To create all-in-one setup, please use the below command,
37 +
38 ....
39 # packstack --allinone --provision-demo=n --provision-all-in-one-ovs-bridge=n
40 ....
41 +
42 * This will end up with Horizon started successfully message.
43
44 ===== Steps to install and deploy OpenDaylight in CentOS 7.1
45 * Download the latest lithium distribution code in the below link,
46 +
47 ....
48 # wget https://nexus.opendaylight.org/content/groups/public/org/opendaylight/integration/distribution-karaf/0.3.1-Lithium-SR1/distribution-karaf-0.3.1-Lithium-SR1.zip
49 ....
50 +
51 * Unzip the lithium distribution code by using the below command,
52 +
53 ....
54 # unzip distribution-karaf-0.3.1-Lithium-SR1.zip
55 ....
56 +
57 * Please do the below steps in the OpenDaylight to change jetty port,
58 ** Change the jetty port from 8080 to something else as swift proxy of OpenStack is using it.
59 ** Open the file "etc/jetty.xml" and change the jetty port from 8080 to 8910 (we have used 8910 as jetty port you can use any other number).
60 ** Start VTN Manager and install odl-vtn-manager-neutron in it.
61 ** Ensure all the required ports(6633/6653,6640 and 8910) are in the listen mode by using the command "netstat -tunpl" in OpenDaylight.
62
63 ===== Steps to reconfigure OpenStack in CentOS 7.1
64 * Steps to stop Open vSwitch Agent and clean up ovs
65 +
66 ....
67 # sudo systemctl stop neutron-openvswitch-agent
68 # sudo systemctl disable neutron-openvswitch-agent
69 # sudo systemctl stop openvswitch
70 # sudo rm -rf /var/log/openvswitch/*
71 # sudo rm -rf /etc/openvswitch/conf.db
72 # sudo systemctl start openvswitch
73 # sudo ovs-vsctl show
74 ....
75 +
76 * Stop Neutron Server
77 +
78 ....
79 # systemctl stop neutron-server
80 ....
81 +
82 * Verify that OpenDaylight's ML2 interface is working:
83 +
84 ....
85 curl -v admin:admin http://{CONTROL_HOST}:{PORT}/controller/nb/v2/neutron/networks
86
87 {
88    "networks" : [ ]
89 }
90 ....
91 +
92 If this does not work or gives an error, check Neutron's log file in
93 +/var/log/neutron/server.log+. Error messages here should give
94 some clue as to what the problem is in the connection with OpenDaylight
95 +
96 * Configure Neutron to use OpenDaylight's ML2 driver:
97 +
98 ....
99 # sudo crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 mechanism_drivers opendaylight
100 # sudo crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 tenant_network_types local
101 # sudo crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 type_drivers local
102 # sudo crudini --set /etc/neutron/dhcp_agent.ini DEFAULT ovs_use_veth True
103
104 # cat <<EOT | sudo tee -a /etc/neutron/plugins/ml2/ml2_conf.ini > /dev/null
105   [ml2_odl]
106   password = admin
107   username = admin
108   url = http://{CONTROL_HOST}:{PORT}/controller/nb/v2/neutron
109   EOT
110 ....
111 +
112 * Reset Neutron's ML2 database
113 +
114 ....
115 # sudo mysql -e "drop database if exists neutron_ml2;"
116 # sudo mysql -e "create database neutron_ml2 character set utf8;"
117 # sudo mysql -e "grant all on neutron_ml2.* to 'neutron'@'%';"
118 # sudo neutron-db-manage --config-file /usr/share/neutron/neutron-dist.conf --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugin.ini upgrade head
119 ....
120 +
121 * Start Neutron Server
122 +
123 ....
124 # sudo systemctl start neutron-server
125 ....
126 +
127 * Restart the Neutron DHCP service
128 +
129 ....
130 # system restart neutron-dhcp-agent.service
131 ....
132 +
133 * At this stage, your Open vSwitch configuration should be empty:
134 +
135 ....
136 [root@dneary-odl-compute2 ~]# ovs-vsctl show
137 686989e8-7113-4991-a066-1431e7277e1f
138     ovs_version: "2.3.1"
139 ....
140 +
141 * Set OpenDaylight as the manager on all nodes
142 +
143 ....
144 # ovs-vsctl set-manager  tcp:127.0.0.1:6640
145 ....
146 +
147 * You should now see a section in your Open vSwitch configuration
148   showing that you are connected to the OpenDaylight server, and OpenDaylight
149   will automatically create a br-int bridge:
150 +
151 ....
152 [root@dneary-odl-compute2 ~]# ovs-vsctl show
153 686989e8-7113-4991-a066-1431e7277e1f
154     Manager "tcp:127.0.0.1:6640"
155         is_connected: true
156     Bridge br-int
157         Controller "tcp:127.0.0.1:6633"
158             is_connected: true
159         fail_mode: secure
160         Port "ens33"
161             Interface "ens33"
162     ovs_version: "2.3.1"
163 ....
164 +
165 * Add the default flow to OVS to forward packets to controller when there is a table-miss,
166 +
167 ....
168 ovs-ofctl --protocols=OpenFlow13 add-flow br-int priority=0,actions=output:CONTROLLER
169 ....
170 +
171 * Please see the https://wiki.opendaylight.org/view/Release/Lithium/VTN/User_Guide/Openstack_Packstack_Support[VTN OpenStack PackStack support guide on the wiki] to create VM's from OpenStack Horizon GUI.
172
173 ==== Implementation details
174
175 ===== VTN Manager:
176 Install *odl-vtn-manager-neutron* feature which provides the integration with Neutron interface.
177
178  feature:install odl-vtn-manager-neutron
179
180 It subscribes to the events from Open vSwitch and also implements the Neutron requests received by OpenDaylight.
181
182 ===== Functional Behavior
183
184 .StartUp:
185 * The ML2 implementation for OpenDaylight will ensure that when Open vSwitch is started, the ODL_IP_ADDRESS configured will be set as manager.
186 * When OpenDaylight receives the update of the Open vSwitch on port 6640 (manager port), VTN Manager handles the event and adds a bridge with required port mappings to the Open vSwitch at the OpenStack node.
187 * When Neutron starts up, a new network create is POSTed to OpenDaylight, for which VTN Manager creates a Virtual Tenant Network.
188 * *Network and Sub-Network Create:* Whenever a new sub network is created, VTN Manager will handle the same and create a vbridge under the VTN.
189 * *VM Creation in OpenStack:* The interface mentioned as integration bridge in the configuration file will be added with more interfaces on creation of a new VM in OpenStack and the network is provisioned for it by the VTN Neutron feature. The addition of a new port is captured by the VTN Manager and it creates a vbridge interface with port mapping for the particular port. When the VM starts to communicate with other VMs, the VTN Manger will install flows in the Open vSwitch and other OpenFlow switches to facilitate communication between them.
190
191 NOTE:
192   To use this feature, VTN feature should be installed
193
194 ==== Reference
195
196 https://wiki.opendaylight.org/images/5/5c/Integration_of_vtn_and_ovsdb_for_helium.pdf