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