- 积分
- 16840
在线时间 小时
最后登录1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?开始注册
x
27 Nov 2016 8 min read 9 Comments SDN
! K2 J3 I1 L3 q" h6 U- h# iVanilla 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).7 `. c. V; j/ {6 a5 u
; M+ _8 t0 Q# P7 LOVN quick introduction" G$ c' t' U; Q, A5 o
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:
1 W! Z- _& v; \- ?7 U$ a
, b0 @) C6 }! p* JSecurity groups could not be implemented directly on OVS ports and, therefore, required a dedicated Linux bridge between the VM and the OVS integration bridge.
- S+ N; E2 m" m. Z! u3 nRouting and DHCP agents required dedicated network namespaces.# D( f5 Y! `$ Q5 m$ a5 ^) B5 e2 ~
NAT was implemented using a combination of network namespaces, iptables and proxy-ARP.9 S; ~+ d. R2 t$ J6 H
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.6 n6 r7 k/ y: W
5 I I' t' A0 x: Z' S
At a high level, OVN consists of 3 main components:; d' x7 s7 E1 f; r8 k% \& K$ ?7 O
Z/ q0 o: M1 l
OVN ML2 Plugin - performs translation between Neutron data model and OVN logical data model stored in Northbound DB.
- ?/ k0 l7 {& |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.8 d; p2 ~; |3 W4 _# [
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.
* k6 A, x7 {- }1 K" n0 F/ y( `
; k" b1 _, c5 g4 A% v
u7 A, R( ~4 z+ j; xIf you want to learn more about OVN architecture and use cases, OpenStack OVN page has an excellent collection of resources for further reading.- A8 m6 K! g4 p) e+ S
# j& t+ `. K/ `$ s9 x0 WOpenStack installation/ t; h e! T8 s) r( {0 n, u
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.# h; E, A+ m( |% r" ^- ]
' N# ?* |% F6 ~, a/ Wcd /etc/yum.repos.d/
; A! N' S B/ [; X# wwget http://trunk.rdoproject.org/centos7/delorean-deps.repo
; v* m- o# c1 q8 Kwget https://trunk.rdoproject.org/centos7-master/current/delorean.repo
0 i% O+ v& k1 K* C/ m" IOn 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.& y/ l, k9 k2 X1 N9 c% ]- ]3 Z \
' K) G: q6 m: |, N/ G# Jyum install -y openstack-packstack crudini
6 |9 M3 p/ L9 \' `4 n2 \packstack --gen-answer-file=/root/packstack.answer
! ~0 g7 S- b+ V' a4 ?! @crudini --set --existing defautl CONFIG_COMPUTE_HOSTS 169.254.0.12,169.254.0.134 p5 m7 z/ V0 V
crudini --set --existing defautl CONFIG_CONTROLLER_HOST 169.254.0.11
4 D* k( F; L2 I5 f( X4 o0 |crudini --set --existing defautl CONFIG_NETWORK_HOSTS 169.254.0.117 o( @; L5 i5 B5 G8 E! ?, H; i
packstack --answer-file=/root/packstack.answer
6 D, E5 R5 n$ ?& 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.+ m s( J* w# G/ D: M+ \
. `0 Z$ h. J+ J E$ u; p2 W+ J* ~ J0 ?1 F) K
8 W( g( K v# T) @1 Z& X% ]
OVN Build0 w! l: j( F! Z! w4 ^2 x% D
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.
- E# I t: j( w, B, ^
/ p7 n5 N/ c2 P) O' E+ r4 z$ vPart 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.; t0 f; [# v& C: V
0 l( ?1 h: P( O$ S1 \- ]yum -y update kernel& a! t' G. q2 H
reboot
2 r5 B% g+ H' d7 hThe 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.4 K9 A4 E8 j" I' T' r
0 T7 I9 I4 W6 [; L7 F
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-devel4 p0 _" e4 L' G, |. e5 x
! k, T/ B* U; q" s; \) R, G
yum install selinux-policy-devel kernel-devel-`uname -r` git: x8 P) O" C& i( o% |# U+ p1 G- r
c+ A1 T g- G: l0 lgit clone https://github.com/openvswitch/ovs.git && cd ovs5 p/ }: ~+ n! @* W, p& q
./boot.sh
z0 o' f+ {+ z* `2 G./configure
6 z& w, U( m0 |" emake rpm-fedora RPMBUILD_OPT="--without check"
3 c$ j" V0 r* J8 y# ymake rpm-fedora-kmod) m5 W# p/ G% ?
At the end of the process we should have a set of rpms inside the ovs/rpm/rpmbuild/RPMS/ directory.
, R" C) Y" T6 g9 a7 }% L8 l$ n5 [7 a d
OVN Install
+ R% }* d/ {5 |, {5 ?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.
! _5 E8 |) Q3 h; o7 |& F
9 b5 c q" w. H4 UOpenStack preparation
$ g' c+ L: L. a0 `! P* a+ XFirst, 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.
3 f3 j r8 ~5 ]% k6 {3 Z1 Z9 r0 P+ S( c6 [, W3 d/ Q
DEVICE=eth1/ @9 L& A! ~. `& B$ v! t" b
NAME=eth1
/ W% y3 I L1 V6 v' QDEVICETYPE=ovs
; t2 R7 e7 z, A4 I! VTYPE=OVSPort: N* g/ q: z( R4 x; Q6 k
OVS_BRIDGE=br-ex5 i1 Y; G$ p5 b! R( s$ \
ONBOOT=yes
+ y9 A( q6 L: T+ ^. ~3 b- Z6 F. NBOOTPROTO=none
' b6 i6 v% J8 S+ O$ bIP address needs to be moved to br-ex interface. Below example is for Compute node #2:
! P3 y' \4 W: s$ }2 K. F3 I7 ?7 e3 ]% [1 n! m% o0 N3 A% X
ONBOOT=yes
6 M0 e0 n3 A+ R% X4 N- u+ BDEFROUTE=yes$ q! I& G- [8 y3 l7 d
IPADDR=169.254.0.12- A- \' a% x3 O# \7 @
PREFIX=248 a8 o5 b5 m$ C: y
GATEWAY=169.254.0.1% u; p" J: q5 D& i0 {$ s
DNS1=8.8.8.8
$ a! o& z( T9 p6 _$ V: JDEVICE=br-ex" v0 ]- x7 E t4 z
NAME=br-ex
; q) ]$ ?6 k! R" `$ _3 K5 Y, C0 sDEVICETYPE=ovs
% D% q. l* T. Y+ E; M) [. o0 JOVSBOOTPROTO=none: ~- `! f; R) V. s! u0 z
TYPE=OVSBridge
; Q) d6 X) ^9 ~7 AAt 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.
3 l; j3 Q. k0 k( t# }: z' v4 i- d5 e. J* ^8 o
yum remove openstack-neutron-openvswitch' z6 u7 I6 ^! B1 r5 i! N
OVS packages installation5 {$ q3 q; H j# Y# f- R* m& c
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.* l5 F2 R& k: d+ C9 |6 W L
- U- j5 ~) w" ^1 y2 m" arpm -i openvswitch-kmod-2.6.90-1.el7.centos.x86_64.rpm8 M" @( A* t Q' h$ |; l
rpm -U openvswitch-2.6.90-1.el7.centos.x86_64.rpm( P( o$ R. F' z
reboot
8 d- C6 g9 J3 s8 e, [6 w/ K+ FNow we can install OVN. Controllers will be running the ovn-northd process which can be installed as follows:7 s' X9 J- i( k2 @4 G
; s9 H( U" n1 r/ P
rpm -i openvswitch-ovn-common-*.x86_64.rpm
# j* y: K% V8 v2 @5 p& r( M' O! Grpm -i openvswitch-ovn-central-*.x86_64.rpm* ~' n4 t) B0 k3 ~; W0 w
systemctl start ovn-northd) U1 @; u- I% Y0 o: s* o) l3 N: Y
The following packages install the ovn-controller on all Compute nodes:( |! S! W A* _( Z
' _7 r- v" I, S! E: |
rpm -i openvswitch-ovn-common-*.x86_64.rpm
# S5 b$ [. A+ c4 d0 ~3 Z, erpm -i openvswitch-ovn-host-*.x86_64.rpm( e4 b Z9 D2 l1 H5 ?. V& N
systemctl start ovn-controller
7 w9 U" J0 d/ G8 Z5 h4 DThe last thing is to install the OVN ML2 plugin, a python library that allows Neutron server to talk to OVN Northbound database.# K5 }5 X/ Q# ]: T4 e: M" A7 D
) t6 d8 l: w0 G) E
yum install python-networking-ovn
$ Y9 c6 w1 P' V$ Z8 ~6 `/ J$ s- nOVN Configuration, ?. z$ t. h" l% V0 ~2 g. \
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:
$ [ |" w; ~1 r f [6 @* Q# G! s( [) b; }
$ ovs-sbctl show* [6 L) E5 ?$ } O1 x
Chassis "d03bdd51-e687-4078-aa54-0ff8007db0b5"
H7 Y. U& V; W! Y' t hostname: "compute-3"" \; q( @0 d2 r: G3 e/ {" i
Encap geneve. M" j: w- z5 C
ip: "10.0.0.4") X# M% P6 i1 }8 ^% r+ ]! i
options: {csum="true"}
) |; F7 ~, I2 E) q9 d& s- S Encap vxlan( S4 h7 X9 h4 w; @. T3 w; m
ip: "10.0.0.4"! u( D( ~7 D8 W- C
options: {csum="true"}! G. d* N5 k" U! T# r6 Y
Chassis "b89b8683-7c74-43df-8ac6-1d57ddefec77"9 h2 j1 c w3 `1 Y. J
hostname: "compute-2"4 h; D. `, D1 S
Encap vxlan
8 P0 A+ [7 y7 U5 W# J ip: "10.0.0.2"0 Z' M8 c. w) I1 W# t. t7 }% |
options: {csum="true"}
- ~0 J3 I1 N$ Q! C Encap geneve) k: m! `; J3 z+ e: [/ B
ip: "10.0.0.2"
$ Q- H" h/ C; L0 Q options: {csum="true"}8 z# A# c4 v w: R3 p! V& X; h# O5 t o
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.
, B$ S( B, i! R ~
, | U X: c) O& R+ F9 \ |(Optional) Automating everything with Chef4 l3 b4 {+ i6 i. _- g
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:# J& t, ]2 a2 }' e% g. Q. F" r9 W
, l# ~ F! P# ^! c' T" o9 f I# r
git clone https://github.com/networkop/chef-unl-os.git8 C* t; T. {8 r) Y; T* v
cd chef-unl-os; h' t$ c# F; }2 l+ c" t5 D
chef-client -z -E lab ovn.rb
4 K j. J0 ~+ ^$ F9 r8 S; z5 tTest topology setup: S7 M$ v, q7 G* l
Now we should be able to create a test topology with two tenant subnets and an external network interconnected by a virtual router.2 ? L0 i1 I% M3 c7 @% U
7 ~1 U0 \9 h) \neutron net-create NET-RED
0 d: w* R' b7 A+ i+ b7 `8 fneutron net-create NET-BLUE
6 s# ?' q/ q0 M" J( {neutron subnet-create --name SUB-BLUE NET-BLUE 10.0.0.0/24! r/ h& k9 G9 _4 f2 X8 `
neutron subnet-create --name SUB-RED NET-RED 20.0.0.0/24
& H0 C! W5 g5 z6 [% vneutron net-create NET-EXT --provider:network_type flat \
5 U! \1 Y7 t0 q5 W3 A( o --provider:physical_network extnet \5 p; `; c3 `! v- I+ `4 `( H
--router:external --shared
$ l, b' o5 k6 Oneutron subnet-create --name SUB-EXT --enable_dhcp=False \
9 H3 o2 T9 {4 E' Z5 _ --allocation-pool=start=169.254.0.50,end=169.254.0.99 \
1 O: m; e' Q' y --gateway=169.254.0.1 NET-EXT 169.254.0.0/24
( q0 N1 i; q/ W7 z4 C* n Hneutron router-create R1
' o9 _ V( d9 Fneutron router-interface-add R1 SUB-BLUE
; x1 P1 Z4 N y& e4 ?neutron router-interface-add R1 SUB-RED
4 T; ]* P3 T; wneutron router-gateway-set R1 NET-EXT: g! n. R$ f+ M8 o
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 x* j+ b3 w9 X# O# R/ z
3 U" P/ u* J$ Z. Bcurl http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img | glance \' D0 k- i- m$ x3 w
image-create --name='IMG-CIRROS' \( M9 g. a3 V5 R+ R4 B) o/ g, V
--visibility=public \
9 |% h+ ?4 G) b- C, T9 o2 _ --container-format=bare \
) ? r- d h' Z/ S$ i! a9 \ --disk-format=qcow2+ w+ e7 ~5 y7 Y" N9 i _
nova aggregate-create AGG-RED AZ-RED* Z; L" G/ ]: Q- O+ g
nova aggregate-create AGG-BLUE AZ-BLUE. w# ~: q9 t' u- X7 m
nova aggregate-add-host AGG-BLUE compute-2
# _. d9 V6 g% fnova aggregate-add-host AGG-RED compute-3
; c- Z+ o8 S/ T" b3 R' Xnova boot --flavor m1.tiny --image 'IMG-CIRROS' \
" R) L/ K! E7 n' V8 Z# {& { --nic net-name=NET-BLUE \
$ r/ J# S4 H( B* i" ~0 k- p& \0 ` --availability-zone AZ-BLUE \
9 l- ~9 z8 D. u% |/ D1 T VM1
3 R3 N$ I/ [, c1 Q2 Y. ?) C0 V4 z: K/ v
nova boot --flavor m1.tiny --image 'IMG-CIRROS' \5 C- _. s3 w5 J+ U; L
--nic net-name=NET-RED \
/ m" y2 C( Y3 u6 T4 v --availability-zone AZ-RED \
+ f0 y" ?5 ^2 i. f6 ? VM2# \- s# {; T' V7 |/ `& U
nova boot --flavor m1.tiny --image 'IMG-CIRROS' \
! X5 r- E9 P& B; W --nic net-name=NET-BLUE \
* b9 B: O0 s) \+ C$ e --availability-zone AZ-RED \
- @7 Q9 j# b1 S& ]( n( r VM3
1 H0 {0 x Q. R: `$ }* aopenstack floating ip create NET-EXT
9 @2 C2 \$ h1 E& p$ o5 B8 uopenstack server add floating ip VM3 169.254.0.53
5 J* Q5 J% k6 ~; A8 m0 k7 ^$ l3 B) S; Q e8 D& I* z
2 m- ?5 {# S: r/ b0 Z; i
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.- ~4 r7 S, J5 x* d: \
7 U A$ J$ ~3 s2 l6 f/ |OpenStack-SDN OVN: k! E4 ^2 J' r, f" B% i
Related: b; F* ~. M5 p
OpenStack SDN - Distributed Virtual Routing& t( d( G. [% {
Automating the Build of OpenStack Lab (Part 2)
/ E8 V" ]9 I# K& f3 q( t6 g+ QAutomating the Build of OpenStack Lab (Part 1)! k; E" E: w1 y& n8 b: q- ?
OpenStack SDN - Interconnecting VMs and Physical Devices With Cumulus VX L2 Gateway r" A/ C" U+ `6 R% @, l. r; }
OpenStack SDN - Extending a L2 Provider Network Over a L3 Fabric |
|