- 积分
- 16840
在线时间 小时
最后登录1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?开始注册
x
27 Nov 2016 8 min read 9 Comments SDN. ^, S6 t9 [7 n1 L7 v4 `/ {
Vanilla openstack networking has many functional, performance and scaling limitations. Projects like L2 population, local ARP responder, L2 Gateway and DVR were conceived to address those issues. However good a job these projects do, they still remain a collection of separate projects, each with its own limitations, configuration options and sets of dependencies. That led to an effort outside of OpenStack to develop a special-purpose OVS-only SDN controller that would address those issues in a centralised and consistent manner. This post will be about one such SDN controller, coming directly from the people responsible for OpenvSwitch, Open Virtual Network (OVN).- b% t4 F) Q* k& A% g
# w4 G/ D; r# y- s0 n/ ]! H g" |# XOVN quick introduction
$ R1 m [* Q$ qOVN is a distributed SDN controller implementing virtual networks with the help OVS. Even though it is positioned as a CMS-independent controller, the main use case is still OpenStack. OVN was designed to address the following limitations of vanilla OpenStack networking:
- O j, p0 q3 n7 O
% Y* U9 }% B! Q+ ]Security groups could not be implemented directly on OVS ports and, therefore, required a dedicated Linux bridge between the VM and the OVS integration bridge.
+ T% [) P3 z3 }; ?2 N$ _Routing and DHCP agents required dedicated network namespaces.0 G" v, U. h0 G z+ Y
NAT was implemented using a combination of network namespaces, iptables and proxy-ARP.
6 _. s4 R8 r/ K- T$ OOVN implements security groups, distributed virtual routing, NAT and distributed DHCP server all inside a single OVS bridge. This dramatically improves performance by reducing the number of inter-process packet handling and ensures that all flows can benefit from kernel fast-path switching.
1 r Q1 B7 G5 k* A8 U8 f% I$ L
: w( \ E8 Z. b: t4 y* Q: d4 q' w7 CAt a high level, OVN consists of 3 main components:, k' z6 O& w! _# s2 [- Q, b
: F; ~/ M+ t) u# w* COVN ML2 Plugin - performs translation between Neutron data model and OVN logical data model stored in Northbound DB.; F: Y& f, W( P, Q
OVN northd - the brains of OVN, translates the high level networking abstractions (logical switches, routers and ports) into logical flows. These logical flows are not yet OpenFlow flows but similar in concept and a very powerful abstraction. All translated information is stored in Southbound DB.* V W9 `( d1 i
OVN controllers - located on each compute node, receive identical copies of logical flows (centralised network view) and exchange logical port to overlay IP binding information via the central Southbound DB. This information is used to perform logical flow translation into OpenFlow which are then programmed into the local OVS instance.
\) _6 Y: t) t& `
; I+ _5 x, f/ ^6 g+ o
1 F" {. z h3 m* D. [If you want to learn more about OVN architecture and use cases, OpenStack OVN page has an excellent collection of resources for further reading.1 U& `* s7 i$ L5 m
" I# x% A/ K% ? z# i# X; JOpenStack installation2 O4 n4 R" @/ j; N
I’ll use RDO packstack to help me build a 1 controller and 2 compute nodes OpenStack lab on CentOS7. I’ll use the master trunk to deploy the latest OpenStack Ocata packages. This is required since at the time of writing (Nov 2016) some of the OVN features were not available in OpenStack Newton.
3 h* M3 a. M% r, n6 y6 N2 [; c. p0 J' Q' b4 \5 B( ?
cd /etc/yum.repos.d/
|$ j/ Z0 J8 A! B o! K9 ^wget http://trunk.rdoproject.org/centos7/delorean-deps.repo+ m f( L! r. b7 ?2 c/ H: v. ]* O, S
wget https://trunk.rdoproject.org/centos7-master/current/delorean.repo" q' x* V+ c1 k
On the controller node, generate a sample answer file and modify settings to match the IPs of individual nodes. Optionally, you can disable some of the unused components like Nagios and Ceilometer similar to how I did it in my earlier post.! g6 L8 V9 J1 v9 ?/ a5 W
# \, h y/ T; ]6 Qyum install -y openstack-packstack crudini
5 z$ U3 _% l) ^2 i. j1 r9 N; n2 e, Q& Spackstack --gen-answer-file=/root/packstack.answer& K0 e- ?% A: N5 J/ e& @
crudini --set --existing defautl CONFIG_COMPUTE_HOSTS 169.254.0.12,169.254.0.13
3 l: N l% n3 |5 ?crudini --set --existing defautl CONFIG_CONTROLLER_HOST 169.254.0.11
) w' y8 r7 G! {4 tcrudini --set --existing defautl CONFIG_NETWORK_HOSTS 169.254.0.11
; w6 T1 e& m: i! H% xpackstack --answer-file=/root/packstack.answer7 a0 b# r: b3 p' C8 h
After the last step we should have a working 3-node OpenStack lab, similar to the one depicted below. If you want to learn about how to automate this process, refer to my older posts about OpenStack and underlay Leaf-Spine fabric build using Chef.. N" p$ W& c( J! A) J1 b
1 d$ f7 w2 _" C- T: o
) ~4 U$ m; `3 C8 |, J+ e) D( U8 ^" v8 c+ f
OVN Build* N' I9 y5 n7 b$ \7 N
OVN can be built directly from OVS source code. Instead of building and installing OVS on each of the OpenStack nodes individually, I’ll build a set of RPM’s on the Controller and will use them to install and upgrade OVS/OVN components on the remaining nodes.
: |, X& [; |5 i: }1 L/ `+ [3 J3 v# Y
Part of OVN build process includes building an OVS kernel module. In order to be able to use kmod RPM on all nodes we need to make sure all nodes use the same version of Linux kernel. The easiest way would be to fetch the latest updates from CentOS repos and reboot the nodes. This step should result in same kernel version on all nodes, which can be checked with uname -r command.
2 Q7 _% d) H' q2 N" M* w
7 ]; M8 p; z0 j. F8 R! E% nyum -y update kernel) h$ V' X' a4 r2 g
reboot
2 \: y9 |+ N$ @% s5 J' _The official OVS installation procedure for CentOS7 is pretty accurate and requires only a few modifications to account for the packages missing in the minimal CentOS image I’ve used as a base OS.0 N& ]6 \% K7 d) z
9 I( K! S/ a' E5 t( c
yum install rpm-build autoconf automake libtool systemd-units openssl openssl-devel python python-twisted-core python-zope-interface python-six desktop-file-utils groff graphviz procps-ng libcap-ng libcap-ng-devel
7 R! j R, j) H
+ Y( W& I8 |% j* p8 j' s( E( l- vyum install selinux-policy-devel kernel-devel-`uname -r` git
! A2 N6 C. v9 ?7 Y" ?; ]( R3 z7 `& A ^* }7 R# o5 ?5 l8 s% A
git clone https://github.com/openvswitch/ovs.git && cd ovs- [- [* E1 _6 n! h7 I. H- Z
./boot.sh
) s" e& P+ |. E. J, r* L./configure9 Q1 x& t& B5 O
make rpm-fedora RPMBUILD_OPT="--without check"& U9 A6 N' O9 v, s z
make rpm-fedora-kmod
6 I- |0 Y$ b; a0 x+ T. o3 YAt the end of the process we should have a set of rpms inside the ovs/rpm/rpmbuild/RPMS/ directory.
' e1 U7 M3 x1 O# C
/ @ S2 t; a4 `4 K9 }OVN Install
# b; p1 W+ K4 ]/ SBefore we can begin installing OVN, we need to prepare the existing OpenStack environment by disabling and removing legacy Neutron OpenvSwitch agents. Since OVN natively implements L2 and L3 forwarding, DHCP and NAT, we won’t need L3 and DHCP agents on any of the Compute nodes. Network node that used to provide North-South connectivity will no longer be needed./ Z" ]1 g& y% `+ h4 x
" Y0 b& I; u" K# e# W7 L. g( DOpenStack preparation1 B) J3 y& f- }5 @% M4 s
First, we need to make sure all Compute nodes have a bridge that would provide access to external provider networks. In my case, I’ll move the eth1 interface under the OVS br-ex on all Compute nodes.4 e( u9 y6 V4 L _
6 J+ B6 L* N8 c' R# s8 |DEVICE=eth1
: t' F, e! X3 M! }) kNAME=eth10 R6 y. b/ F2 E5 b. }0 t
DEVICETYPE=ovs
( _% T3 d+ g& v9 \! xTYPE=OVSPort
" e' Y6 E$ J- N0 W7 }5 ^2 q; `OVS_BRIDGE=br-ex
" s! G2 U$ u RONBOOT=yes
6 G3 C: v- G3 h. R0 r6 I, O% RBOOTPROTO=none) {* P. r( a; d
IP address needs to be moved to br-ex interface. Below example is for Compute node #2:
V9 l' u# K4 E2 s7 Y0 ?: T) W- ]; O9 h4 h: z% P
ONBOOT=yes
# e! o& m2 u7 k0 RDEFROUTE=yes* j; c/ ?' A; S9 r* g0 i6 y
IPADDR=169.254.0.12
2 H; e: c. ]5 K9 R6 l' ZPREFIX=24
/ P( W3 g5 ^8 s- lGATEWAY=169.254.0.1
0 d; ]7 |; ^: v6 p( p+ ^DNS1=8.8.8.8
# z7 g- ^+ ? b4 C2 v1 ZDEVICE=br-ex- Y& `9 e! u' F/ S' O' `9 o9 l
NAME=br-ex9 I( Z( D8 }- I: v
DEVICETYPE=ovs; @( _! V, D* i7 _3 i7 R2 w3 j
OVSBOOTPROTO=none
6 w" j7 S" u; ^" c* {$ lTYPE=OVSBridge7 b- {3 p! E1 [0 H
At the same time OVS configuration on Network/Controller node will need to be completely wiped out. Once that’s done, we can remove the Neutron OVS package from all nodes.
/ b5 }+ Y7 p) u! y! F z. h4 R3 n
9 c5 u1 p3 l* _yum remove openstack-neutron-openvswitch) s1 \+ Q: U! J$ W% ^6 c* O; z
OVS packages installation: i$ Q% a, b% J5 p, s. V( W
Now everything is ready for OVN installation. First step is to install the kernel module and upgrade the existing OVS package. Reboot may be needed in order for the correct kernel module to be loaded.
' X" ^9 s% A- T: I5 T* P
8 ^7 Z' t) X" L# q- Y* B k, Wrpm -i openvswitch-kmod-2.6.90-1.el7.centos.x86_64.rpm
! U5 x$ L9 s! X( X. l( D' nrpm -U openvswitch-2.6.90-1.el7.centos.x86_64.rpm
, |' ^8 Z f/ L) j: m, T5 g: Yreboot y- `# q& J1 x! N
Now we can install OVN. Controllers will be running the ovn-northd process which can be installed as follows:
: g. Y, r; S+ y3 C" t& O9 r |+ b7 O- ~
rpm -i openvswitch-ovn-common-*.x86_64.rpm) f- M2 a! a9 ]2 \
rpm -i openvswitch-ovn-central-*.x86_64.rpm4 z2 `6 R: e" Z$ m+ j
systemctl start ovn-northd* G8 i+ l8 E3 A& M& Y! [# X/ m
The following packages install the ovn-controller on all Compute nodes:- x) _' G3 P, _1 T6 q
( ^$ y2 x' j$ a. Krpm -i openvswitch-ovn-common-*.x86_64.rpm
# E9 B% c2 W# i7 Urpm -i openvswitch-ovn-host-*.x86_64.rpm9 N9 _0 Z% C" Z# y5 M- v0 K
systemctl start ovn-controller
' V4 |+ m0 a9 uThe last thing is to install the OVN ML2 plugin, a python library that allows Neutron server to talk to OVN Northbound database./ Y7 V' J0 U9 H0 l3 t3 Y( L
. Q4 a4 D' S) {+ U7 i) \5 {* myum install python-networking-ovn
! x$ E- p2 ]2 @# {OVN Configuration8 f/ v2 [3 G+ C$ n9 x" d; N8 J
Now that we have all the required packages in place, it’s time to reconfigure Neutron to start using OVN instead of a default openvswitch plugin. The installation procedure is described in the official Neutron integration guide. At the end, once we’ve restarted ovn-northd on the controller and ovn-controller on the compute nodes, we should see the following output on the controller node:
/ K- d+ H" f: t0 y' s
/ O+ ` Q) q# d( x$ ovs-sbctl show! s8 i ?: O# s7 e* Q6 {, |
Chassis "d03bdd51-e687-4078-aa54-0ff8007db0b5"# O2 R6 v. T7 G$ w! o
hostname: "compute-3"
$ R3 w6 C0 f. o Encap geneve
6 N6 O' `$ z K' E2 }* a* R ip: "10.0.0.4"
; ~( G, k- H! {2 g# p8 [ options: {csum="true"}2 e" Y! o5 K' m# I( G) ^
Encap vxlan
U @9 l2 p( v3 n5 }, c) R ip: "10.0.0.4"- `0 d% W7 i- ~; D# W
options: {csum="true"}
! a1 v Q. Z7 Y, L! |, T IChassis "b89b8683-7c74-43df-8ac6-1d57ddefec77"4 i% S1 W# Y" x& X, B" K; {$ R
hostname: "compute-2"
/ ]' u! }- I# H! m Encap vxlan6 F( p% f0 @: V. \+ P$ g! v
ip: "10.0.0.2"
% H4 T5 {! t" ^+ E" t! Q options: {csum="true"}
" @/ J$ I2 P$ k9 A: M$ c Encap geneve
9 a5 x# X8 F$ f' m" s8 @ ip: "10.0.0.2"
4 m! D0 O: A6 V" b options: {csum="true"}
- e' i0 K- o5 p# CThis means that all instances of a distributed OVN controller located on each compute node have successfully registered with Southbound OVSDB and provided information about their physical overlay addresses and supported encapsulation types.
# p9 Y# o: ^/ M" g/ U5 O) q# M% w4 Z9 V: V3 M# T' e& G
(Optional) Automating everything with Chef$ R3 E9 ?0 C* I
At this point of time there’s no way to automate OVN deployment with Packstack (TripleO already has OVN integration templates). For those who want to bypass the manual build process I have created a new Chef cookbook, automating all steps described above. This Chef playbook assumes that OpenStack environment has been built as described in my earlier post. Optionally, you can automate the build of underlay network as well by following my other post. Once you’ve got both OpenStack and underlay built, you can use the following scripts to build, install and configure OVN:: f, a& J2 ]7 p& J' ]
# ~! _5 g6 S! B% u: Qgit clone https://github.com/networkop/chef-unl-os.git4 |. N- E P% N2 L6 H; S
cd chef-unl-os
: k1 {* _+ b- y+ A* _chef-client -z -E lab ovn.rb
% Z$ V" B5 k, G5 {8 ZTest topology setup
& i+ p6 o9 X. j* r1 w0 eNow we should be able to create a test topology with two tenant subnets and an external network interconnected by a virtual router.- [) l& D+ o) H o! ?# L0 J9 C. `
( N: {( e0 L8 [! X- p5 |neutron net-create NET-RED5 k# B, W8 N6 E0 l
neutron net-create NET-BLUE8 v3 c. q. i% w4 K$ P
neutron subnet-create --name SUB-BLUE NET-BLUE 10.0.0.0/24 H- s) z3 ]8 z8 i
neutron subnet-create --name SUB-RED NET-RED 20.0.0.0/24
6 E3 W9 t3 d! t B8 c7 q r- Z7 Sneutron net-create NET-EXT --provider:network_type flat \! Y! p/ I$ n8 ?7 \) a# ^
--provider:physical_network extnet \9 V# f# `# _# E: u8 ~: V' B
--router:external --shared
6 C8 D1 V2 V; r" D6 n7 e; wneutron subnet-create --name SUB-EXT --enable_dhcp=False \0 Q7 V5 j) g& t/ c
--allocation-pool=start=169.254.0.50,end=169.254.0.99 \: J# A" F* P5 V% |$ a
--gateway=169.254.0.1 NET-EXT 169.254.0.0/24
7 Q4 }. s7 L+ Uneutron router-create R12 B6 F2 ^9 K5 c7 Q
neutron router-interface-add R1 SUB-BLUE' Z% ]; ~" a: a
neutron router-interface-add R1 SUB-RED
) d% A: m, y; C5 J2 b9 hneutron router-gateway-set R1 NET-EXT
0 f/ S2 G5 W1 N9 kWhen we attach a few test VMs to each subnet we should be able to successfully ping between the VMs, assuming the security groups are setup to allow ICMP/ND.
2 U3 x2 z4 c3 L; v, p
# f. I( V# W9 V N$ n [curl http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img | glance \' w0 F7 l G: p. F0 n
image-create --name='IMG-CIRROS' \; p4 n; n( N7 l( A6 c
--visibility=public \
3 G# S2 ~, p4 t& @# z2 L --container-format=bare \
8 J/ I- |# p* I1 ]1 m --disk-format=qcow2' F, z2 }; n" F" g) }; H
nova aggregate-create AGG-RED AZ-RED: n$ A" d6 ^+ I
nova aggregate-create AGG-BLUE AZ-BLUE
& U! C/ f4 X* U/ O2 Pnova aggregate-add-host AGG-BLUE compute-2/ ^2 v/ y7 d1 K; w' p- Z( X
nova aggregate-add-host AGG-RED compute-3
- N* E2 H+ p$ U& I, Knova boot --flavor m1.tiny --image 'IMG-CIRROS' \* L ^% l# Z" p, \
--nic net-name=NET-BLUE \( f1 c+ j$ }' t- J9 r$ @
--availability-zone AZ-BLUE \4 v; k$ ^* m7 r
VM1
1 y( I# o! g8 r
9 o A% X. e0 xnova boot --flavor m1.tiny --image 'IMG-CIRROS' \
4 ?; `- q7 v; u+ A --nic net-name=NET-RED \# B+ l; D' i, A& W/ a* D
--availability-zone AZ-RED \
0 P9 m; w+ q: u! K, t+ P VM2
}; i# w% @3 F8 @nova boot --flavor m1.tiny --image 'IMG-CIRROS' \/ U6 ]9 y' A, [
--nic net-name=NET-BLUE \
C, ?- T/ Q, j; N4 [6 N1 ~9 W --availability-zone AZ-RED \
5 R# Z: W1 p) B1 V8 |+ a, t2 c5 z VM38 O2 c# G. J, Q
openstack floating ip create NET-EXT$ k9 D. u0 |9 T0 H. w2 e0 z
openstack server add floating ip VM3 169.254.0.53
+ b& i' W2 S9 R& @8 H' C' p! p; c% K9 U H x2 [9 x
0 I$ {1 [7 t/ ^+ y: A% {
In the next post we will use the above virtual topology to explore the dataplane packet flow inside an OVN-managed OpenvSwitch and how it uses the new encapsulation protocol GENEVE to optimise egress forwarding lookups on remote compute nodes.
# U9 _; T7 A% e9 ^6 C
2 D5 h% _9 e, c; ~5 M$ V7 jOpenStack-SDN OVN. [ g1 { n% q/ v$ M2 c: D* ^
Related
/ ]5 Z. |* t7 Q# t* L" dOpenStack SDN - Distributed Virtual Routing* N& |$ R% @. V+ G8 E$ D5 H" v
Automating the Build of OpenStack Lab (Part 2)
+ ~; d3 T; c+ Q- r& Y* iAutomating the Build of OpenStack Lab (Part 1)$ n F5 |7 o( U m6 |0 L
OpenStack SDN - Interconnecting VMs and Physical Devices With Cumulus VX L2 Gateway
$ [$ M& N7 s7 ~3 b' o; ~! EOpenStack SDN - Extending a L2 Provider Network Over a L3 Fabric |
|