|
|
27 Nov 2016 8 min read 9 Comments SDN
E3 l a" H3 v+ ~# GVanilla 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). M" l: ?: H- T/ C
6 ]% C2 `, @7 Z3 f! U/ LOVN quick introduction
" z" ?) `, ~* ^/ J8 ^OVN 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:
9 v0 S- n4 E. F) Y, n9 b) k( g8 g G* c2 O9 E/ M/ A
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.( W& X$ b+ B5 b
Routing and DHCP agents required dedicated network namespaces.% {2 d- K2 n8 @4 _/ p N% y
NAT was implemented using a combination of network namespaces, iptables and proxy-ARP.
/ F+ \6 E' w9 `OVN 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.
# B# v5 p/ h5 @; N' Y- o
, h/ y6 C( O* u. B: Z7 pAt a high level, OVN consists of 3 main components:
9 B$ w, R% b0 b) ^* t8 _' B. r) U& K6 T" }# r6 R
OVN ML2 Plugin - performs translation between Neutron data model and OVN logical data model stored in Northbound DB.
# i0 t! s- D" v, U0 o9 u* EOVN 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./ m! R, \' d/ G5 D& j
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." W% |- x0 W3 [' h
( ]" I4 O; X6 S1 ^/ V2 {/ q
0 ^8 I& ]& r2 l7 |
If you want to learn more about OVN architecture and use cases, OpenStack OVN page has an excellent collection of resources for further reading.
* _! s+ ~% n! X1 P0 W3 W2 O3 C& {9 ]- {; x4 u. z
OpenStack installation
& O: D/ U) \; ^: I8 mI’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.
9 G5 S/ @. \0 n) Q u/ ^7 b1 Q5 [/ c( F
cd /etc/yum.repos.d/* b+ B; p" s; O1 B( K
wget http://trunk.rdoproject.org/centos7/delorean-deps.repo
( W3 E2 n6 l9 xwget https://trunk.rdoproject.org/centos7-master/current/delorean.repo
% D6 n4 R! l8 T( x ?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.
0 \ a3 o6 Q6 U4 K+ x" a( y/ y. |
2 q' T6 W9 u9 F' L; k& Kyum install -y openstack-packstack crudini
$ l/ j' g+ D# K; A( @, g( `packstack --gen-answer-file=/root/packstack.answer) D5 A1 u M% Z
crudini --set --existing defautl CONFIG_COMPUTE_HOSTS 169.254.0.12,169.254.0.133 [9 A* b! Z" L
crudini --set --existing defautl CONFIG_CONTROLLER_HOST 169.254.0.11/ C+ U! `- S; B: L8 ]9 m3 W
crudini --set --existing defautl CONFIG_NETWORK_HOSTS 169.254.0.11# q6 T, h# ^* q" N+ p1 w$ x
packstack --answer-file=/root/packstack.answer
" P! u" p% v7 P2 s9 s k9 xAfter 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.; a! `# P# r: S3 X( k1 _
2 Z+ `, M1 Z$ S! q% R9 m+ w3 T5 E, u+ j E( h
3 s' S' z1 c* s" l# Q: eOVN Build
9 I% ?( m* o7 @" A( N! X6 ^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.
" H8 ]8 L" z, Q5 f+ d' M, M1 D/ V( |: G- k) r
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.8 L A0 S# [6 U1 U
* u/ P0 b$ x% ~+ W
yum -y update kernel
! H* c/ O& n' C, W: }' Kreboot
; m8 a" b) V, lThe 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.% A6 }: M6 E3 b' ]5 Y a
( s2 F3 a2 H& i6 k- Y
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
% k1 w; c1 F6 s$ Z1 C" K( ]& F# Y T" \3 y
yum install selinux-policy-devel kernel-devel-`uname -r` git& i' P+ a7 _4 Q
]) e0 E" @' m* p
git clone https://github.com/openvswitch/ovs.git && cd ovs0 V! [! H) i6 N$ U7 T( T* p+ f W0 b
./boot.sh
: D5 R- f W7 y7 a4 H./configure
8 o) e5 M9 y4 y* Jmake rpm-fedora RPMBUILD_OPT="--without check"
, b. G, D! `5 {8 K0 ]. Bmake rpm-fedora-kmod
- p7 x3 D$ V3 n" n2 i3 MAt the end of the process we should have a set of rpms inside the ovs/rpm/rpmbuild/RPMS/ directory.
' |8 ~7 U) ~ W" b
# c4 i. r" Q9 K" VOVN Install/ E t0 X/ E! N, ]6 b
Before 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.
4 U1 | t/ v P& t# Q' W \. V" @" B, W
OpenStack preparation
2 ^- l6 X8 u/ n' @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. d; N' y% R# t
# C0 p* z# _, E+ C2 TDEVICE=eth17 h( C* s* R- X7 w, h2 p) J
NAME=eth1
l/ t4 z! a( C3 @ t7 K# I1 bDEVICETYPE=ovs
; o% ~; o6 @4 D. f9 {& uTYPE=OVSPort9 |2 u2 v0 O/ i S" \
OVS_BRIDGE=br-ex) C( G; v. i! {* x( C3 G8 O) U! A7 h) G
ONBOOT=yes
2 F- f: a h1 I3 ^: u/ Z: K6 UBOOTPROTO=none7 k: D! j, r! c9 E5 o
IP address needs to be moved to br-ex interface. Below example is for Compute node #2:
' P# n W( a+ \/ w0 [/ D! ?9 Q- x
R! i6 _) l7 V0 P1 GONBOOT=yes
/ i Y0 Q1 V% C3 WDEFROUTE=yes* q/ ?% b. ?! l( t& d! Y$ }1 A
IPADDR=169.254.0.122 [8 }/ M% R1 O1 [% J: k
PREFIX=242 Q1 m1 [3 ]- {* l; W4 y
GATEWAY=169.254.0.1
/ o% s) X5 b9 z! m! {7 I4 zDNS1=8.8.8.8" V; A! i. H4 I
DEVICE=br-ex
% s) C1 P( m! f+ }5 ZNAME=br-ex+ M: m0 i7 k( B9 H
DEVICETYPE=ovs, V4 n& z- p# T$ ^: Y$ C/ W
OVSBOOTPROTO=none
! C& |0 f/ w1 ?, q" pTYPE=OVSBridge
. k5 T+ E8 I& C- o+ mAt 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. [4 v/ ?4 K: l2 `" a2 |* k" `- h
2 \9 K6 [1 V! ?yum remove openstack-neutron-openvswitch l8 d; }4 D' L5 W9 m- |: I
OVS packages installation
( W5 [, p9 z5 L) l' u" DNow 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.: ?: |0 A! |0 K% u4 s
. y4 H- X! I/ U& ]rpm -i openvswitch-kmod-2.6.90-1.el7.centos.x86_64.rpm1 F6 Q0 i% U2 z, Z# `7 }. q$ H
rpm -U openvswitch-2.6.90-1.el7.centos.x86_64.rpm. }6 Z1 c, f0 |" m. n- P3 v) U
reboot
\- a: b9 Q0 s( p$ c6 g1 v2 Q- rNow we can install OVN. Controllers will be running the ovn-northd process which can be installed as follows:
; a; E4 V' q* T* R! X1 o
5 [7 S; O) u" p& ?rpm -i openvswitch-ovn-common-*.x86_64.rpm1 E4 K+ G, |0 p2 }9 c! S
rpm -i openvswitch-ovn-central-*.x86_64.rpm8 n8 ~+ A( U5 D5 v3 Y* v( N
systemctl start ovn-northd
0 c2 Z& ?% }! a6 b, OThe following packages install the ovn-controller on all Compute nodes:' l9 z3 S" E! n4 s4 \+ {
4 A2 [/ j) Q8 ?( T# |* Z
rpm -i openvswitch-ovn-common-*.x86_64.rpm
2 r- g. n+ K4 wrpm -i openvswitch-ovn-host-*.x86_64.rpm
3 f0 D* r. J. v* j1 |systemctl start ovn-controller
# K9 g0 `) o( \9 ]& h# tThe last thing is to install the OVN ML2 plugin, a python library that allows Neutron server to talk to OVN Northbound database.# b' @* g2 T2 h! y& G1 F/ N
4 i, s& y% e9 b2 |* n \yum install python-networking-ovn; C4 X; e5 O$ s: @# q( |2 p9 `
OVN Configuration
2 }2 Q7 K. K; v: z7 ^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:! V. J; C h6 i1 K- U
" V" J8 ]- P' T' x1 W
$ ovs-sbctl show
& Z. R' [* l* lChassis "d03bdd51-e687-4078-aa54-0ff8007db0b5"
/ T V4 {) T- {/ Y+ U hostname: "compute-3"/ |+ m6 o& Z( _8 D: P
Encap geneve
8 l8 v S4 V+ B' q/ ?1 i+ t ip: "10.0.0.4"6 _* i. w* K1 ~9 ?
options: {csum="true"}
( ?& N- T& b1 ~6 P6 z% O5 B Encap vxlan1 \: C2 o8 E# f a9 u5 K
ip: "10.0.0.4": R0 u* F+ A& Q( G6 n+ t9 V5 C( {! R
options: {csum="true"}; u$ X4 W. u. h4 g- v! _8 ~
Chassis "b89b8683-7c74-43df-8ac6-1d57ddefec77"
5 c; a ?; d& G" Z hostname: "compute-2"% M% s2 H3 z* r. R$ d" [. c( [
Encap vxlan$ f7 i/ {* b/ n
ip: "10.0.0.2") v5 ]6 O* t2 G+ b" J, c" j1 F8 m
options: {csum="true"}
% a7 ^2 z/ k, Q: w1 Z Encap geneve
- l+ v, ]$ [" t; J5 Q% m ip: "10.0.0.2"# L- C' }& ?" R( {9 C' X' z9 J
options: {csum="true"}* d. j' s) V) d5 y }
This 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.
- A( [4 p" Z3 @* l* r- T4 h5 C/ i& O6 ^+ T
(Optional) Automating everything with Chef, t# G+ L" P5 q% Y/ z
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:
, }; J5 N/ U: f' D& s3 h$ c& y2 P+ f/ w A) g! h. G
git clone https://github.com/networkop/chef-unl-os.git
* e& Z* i9 D3 u' Z/ d8 G0 E! Ucd chef-unl-os
, F6 Y1 c3 ]2 N) xchef-client -z -E lab ovn.rb
' u! M a8 K" i& KTest topology setup; b6 z$ p' G5 \7 [' r$ O
Now we should be able to create a test topology with two tenant subnets and an external network interconnected by a virtual router.
+ e; ]! h8 P8 y8 g% R; F' t; [3 W9 F. V
neutron net-create NET-RED
: R4 J% t. D+ Lneutron net-create NET-BLUE1 L J% f% j. d3 D
neutron subnet-create --name SUB-BLUE NET-BLUE 10.0.0.0/24
, F1 M3 l/ C7 v) h: A6 }neutron subnet-create --name SUB-RED NET-RED 20.0.0.0/24
# P$ e0 t( X9 w/ aneutron net-create NET-EXT --provider:network_type flat \; e: ^% p: E* A* K# Z( |$ k
--provider:physical_network extnet \
' z g* w. s; T/ M --router:external --shared
% @4 {4 u/ Y, x+ R- C) N6 \+ rneutron subnet-create --name SUB-EXT --enable_dhcp=False \
# ?5 {1 L$ U. a% \ ?+ p --allocation-pool=start=169.254.0.50,end=169.254.0.99 \* ~/ W% `; D7 z b5 ~
--gateway=169.254.0.1 NET-EXT 169.254.0.0/24# y0 s- j8 e3 j" L" I, F3 i
neutron router-create R1
( _1 C1 m) y) @6 i& i3 _7 Tneutron router-interface-add R1 SUB-BLUE
! q i _. Q9 _. b' cneutron router-interface-add R1 SUB-RED2 e( u- p5 |8 c* r6 Y
neutron router-gateway-set R1 NET-EXT& H3 G( R1 {$ K* Q
When 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.
6 _, y( |& X/ g+ J6 v
! `$ M; w9 _$ D* A1 ] G+ Lcurl http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img | glance \* F3 C3 s9 Y U1 z4 Z3 h7 ?! u
image-create --name='IMG-CIRROS' \& n$ w# o7 e7 |# a& P6 y
--visibility=public \
5 @1 N1 e) n0 Y --container-format=bare \. m0 \0 g' A+ v& ^
--disk-format=qcow2
4 |- f2 Q+ F4 `1 R1 n" ^nova aggregate-create AGG-RED AZ-RED
7 d" k! O+ T7 E" u5 v9 Jnova aggregate-create AGG-BLUE AZ-BLUE
2 I: k1 ~# z( A+ H3 y) anova aggregate-add-host AGG-BLUE compute-2
6 e1 [4 A+ z% |9 s/ i( Snova aggregate-add-host AGG-RED compute-37 A5 x7 i. o2 R, v
nova boot --flavor m1.tiny --image 'IMG-CIRROS' \( s4 b" w+ Z T4 X7 e
--nic net-name=NET-BLUE \0 G/ j1 G/ S8 K
--availability-zone AZ-BLUE \: T, @, {5 A; S# b7 ?! r
VM1
5 i; N$ H; \- V0 {; n- w" \& `1 S0 {( }, V0 k8 q/ A- X
nova boot --flavor m1.tiny --image 'IMG-CIRROS' \9 B# W9 R& p) h) E3 v" I
--nic net-name=NET-RED \) a/ S" l9 |. i8 l+ _0 N
--availability-zone AZ-RED \; v: y q4 O/ | t6 I3 F
VM24 q% R }. O8 x3 a$ Y$ r% a
nova boot --flavor m1.tiny --image 'IMG-CIRROS' \
& g8 m( c8 ]8 W7 }, p, D+ X --nic net-name=NET-BLUE \$ s, p3 g2 A& c# c1 I
--availability-zone AZ-RED \/ N! Q6 r( W5 ]# i* Y/ ^
VM3" S0 u" W7 t7 x7 u& M$ f
openstack floating ip create NET-EXT
% A: H0 S z& y( k7 O& T5 oopenstack server add floating ip VM3 169.254.0.53
# v2 \. X3 s7 ?0 W' T) K. X! |) s8 |' ? q9 Y! g( X+ {- E
6 K0 f. x3 R3 x; u
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.& O4 C& J4 t& _9 G! b/ D
# [4 C I, f+ v6 Y* YOpenStack-SDN OVN3 V% l6 I2 B k# R, C# t
Related# U+ w6 x6 T6 X; s0 }! i
OpenStack SDN - Distributed Virtual Routing
% i! O: {1 F# O; L: ~Automating the Build of OpenStack Lab (Part 2)
( M$ w" E$ v% f( R: x$ ~+ ZAutomating the Build of OpenStack Lab (Part 1)$ y: Y9 [$ J- x3 H2 n5 c, n
OpenStack SDN - Interconnecting VMs and Physical Devices With Cumulus VX L2 Gateway
) P6 C2 G) R1 k3 M7 lOpenStack SDN - Extending a L2 Provider Network Over a L3 Fabric |
|