Sie sind auf Seite 1von 8

6/4/2014 Openvswitch and ovsdb | Sreenivas Makam' s Blog

http://sreeninet.wordpress.com/2014/01/02/openvswitch-and-ovsdb/ 1/8
Sreenivas Makam's Blog
Openvswitch and ovsdb

January 2, 2014

Opendaylight, ovsdb
In this blog, I will provide an overview of ovsdb, this is mainly a collection of information from various
locations.
Openvswitch is a virtual switch targeted for virtualized environments to switch traffic between VMs. Its
integrated into the latest Linux kernel.
Following are the critical components of Openvswitch.
ovs-vswitchd, a daemon that implements the switch, along with a companion Linux kernel
module for flow-based switching. We can talk to ovs-switchd using Openflow protocol.
ovsdb-server, a lightweight database server that ovs-vswitchd queries to obtain its configuration.
External clients can talk to ovsdb-server using ovsdb management protocol.
control and management cluster contains client tools to talk to ovsdb-server and ovs-vswitchd.
+----------------------+
| Control & |
| Management |
| Cluster |
+----------------------+
| \
| OVSDB \ OpenFlow
| Mgmt \
| \
+============================================+
| +--------------+ +--------------+ |
| | | | | |
| | ovsdb-server |-------| ovs-vswitchd | |
| | | | | |
| +--------------+ +--------------+ |
| | |
| +----------------+ |
| | Forwarding Path| |
| +----------------+ |
Follow
6/4/2014 Openvswitch and ovsdb | Sreenivas Makam' s Blog
http://sreeninet.wordpress.com/2014/01/02/openvswitch-and-ovsdb/ 2/8
+============================================+
Following are some notes on the internals:
ovsdb-server maintains the switch table database and external clients can talk to ovsdb-server
using json rpc and json being the data format.
ovsdb database currently contains around 13 tables and these can be extended further.
Bridge Bridge conguration.
Port Port conguration.
Interface One physical network device in a Port.
Flow_Table OpenFlow table conguration
QoS Quality of Service conguration
Queue QoS output queue.
Mirror Port mirroring.
Controller OpenFlow controller conguration.
Manager OVSDB management connection.
NetFlow NetFlow conguration.
SSL SSL conguration.
sFlow sFlow conguration.
IPFIX IPFIX conguration
ovsdb clients can use the ovsdb management protocol can manipulate the above tables.
Following are the different json rpc methods specified by the protocol.
list_dbs List databases
get_schema Get schema
transact operations on database
cancel cancel transact request
monitor monitor certain table columns
update sent by server to client for tables that are monitored
monitor_cancel cancelling monitor request
lock, steal, unlock locking, unlocking operations on database
echo to check liveliness
Using the transact rpc method, different database operations like select, insert, delete can be
done.
Following are some client tools that Open vswitch provides:
ovs-dpctl, a tool for configuring the switch kernel module.
ovs-ofctl, to list implemented flows in the OVS kernel module
ovs-vsctl, a utility for querying and updating the configuration of ovs-vswitchd.
ovs-appctl, a utility that sends commands to running Open vSwitch daemons.
ovsdb-client, a command line utility to ovsdb server.
Mininet uses openvswitch and ovsdb internally.
Follow Sreenivas
Makam's Blog
Get every new post
delivered to your Inbox.
Enter your email address
Sign me up
Powered by WordPress.com
6/4/2014 Openvswitch and ovsdb | Sreenivas Makam' s Blog
http://sreeninet.wordpress.com/2014/01/02/openvswitch-and-ovsdb/ 3/8
To illustrate some of the theory above, I created following simple Mininet topology.
sudo mn --controller=remote,ip=192.168.56.101 --topo=linear,3
This is a 3 node linear topology.
Now, lets try to look at the contents of the database
mininet@mininet-vm:~$ sudo ovsdb-client list-dbs
Open_vSwitch
mininet@mininet-vm:~$ sudo ovsdb-client list-tables
Table
------------
Capability
SSL
Bridge
Controller
NetFlow
Port
Mirror
Queue
QoS
Interface
Open_vSwitch
sFlow
Manager
Above, we see the database and tables. Now, lets try to look at columns in bridge table:
mininet@mininet-vm:~$ sudo ovsdb-client list-columns Bridge
Column Type
------------- ---------------------------------------------------
---------------------------
status
{"key":"string","max":"unlimited","min":0,"value":"string"}
fail_mode {"key":{"enum":["set",
["secure","standalone"]],"type":"string"},"min":0}
other_config
{"key":"string","max":"unlimited","min":0,"value":"string"}
_version "uuid"
6/4/2014 Openvswitch and ovsdb | Sreenivas Makam' s Blog
http://sreeninet.wordpress.com/2014/01/02/openvswitch-and-ovsdb/ 4/8
name "string"
datapath_type "string"
netflow {"key":
{"refTable":"NetFlow","type":"uuid"},"min":0}
ports {"key":
{"refTable":"Port","type":"uuid"},"max":"unlimited","min":0}
external_ids
{"key":"string","max":"unlimited","min":0,"value":"string"}
flood_vlans {"key":
{"maxInteger":4095,"minInteger":0,"type":"integer"},"max":4096,"m
in":0}
_uuid "uuid"
controller {"key":
{"refTable":"Controller","type":"uuid"},"max":"unlimited","min":0
}
datapath_id {"key":"string","min":0}
stp_enable "boolean"
mirrors {"key":
{"refTable":"Mirror","type":"uuid"},"max":"unlimited","min":0}
sflow {"key":{"refTable":"sFlow","type":"uuid"},"min":0}
Now, lets try to dump the contents of bridge table.
mininet@mininet-vm:~$ sudo ovsdb-client dump Open_vSwitch
Bridge table
_uuid controller
datapath_id datapath_type external_ids fail_mode
flood_vlans mirrors name netflow other_config
ports
sflow status stp_enable
------------------------------------ ----------------------------
------------------------------------------------ ----------------
-- ------------- ------------ --------- ----------- ------- ----
------- -------------------------------- ------------------------
-----------------------------------------------------------------
--------------------------------------------------------------- -
---- ------ ----------
4aa95bd1-6e44-48c3-9836-a634a2b3bee9 [56efde50-b9a5-4696-98a9-
f632438ec860, 80454ec0-b75b-4ba1-83aa-c87c80e3c409]
"0000000000000001" "" {} secure []
6/4/2014 Openvswitch and ovsdb | Sreenivas Makam' s Blog
http://sreeninet.wordpress.com/2014/01/02/openvswitch-and-ovsdb/ 5/8
[] "s1" [] {datapath-id="0000000000000001"} [1ecfc08a-
cccb-432b-a6f2-a88b6953b27b, 20338ec9-a7ed-4275-9a1a-
4dce0d17f9d0, d026cd6a-c6e5-418c-bfae-8912beccbab8]
[] {} false
31ade9d7-3a84-4809-a067-21d6ab13d3a0 [c309252b-384e-4120-9180-
8c6f3e21d52d, df9f8e75-32a0-4bab-81ae-22161e5d8ce5]
"0000000000000002" "" {} secure []
[] "s2" [] {datapath-id="0000000000000002"} [4a304026-
d090-4163-8328-0d9c1f55ef51, 504ea36c-2ec6-4010-91d5-
ff9ebe6d792f, 8ddd5e79-9b74-48f2-b251-d8ee521146e4, c8e82b90-
41d5-4834-aa9b-05d6faf0baf4] [] {} false
0a3f793d-4958-44a5-9639-a36384927f58 [9e921896-32e9-4f4e-b1e2-
332fb2339f76, fc81e564-6aa5-4ad0-9518-58ce3094451b]
"0000000000000003" "" {} secure []
[] "s3" [] {datapath-id="0000000000000003"} [0c5005d8-
b999-4c6b-bf6e-a638032737f8, 25c8166d-28d8-47f5-b1fc-
69940ec42960, cc54c4d5-32b9-4e0e-9aff-42dd4fdcd1a5]
[] {} false
Above, we see the 3 bridges along with their properties.
Now, lets try to change some properties of this topology using ovs-vsctl. Lets try to delete 1 of the ports in
the bridge.
sudo ovs-vsctl del-port s2 s2-eth2
When we look at the controller for the topology now, we should see the link between s2 and s1 go away.
Once we add it back,
sudo ovs-vsctl add-port s2 s2-eth2
Link should show back on the controller topology.
Following is the generic format for ovs-vsctl.
ovs-vsctl <command> <table name> <record name> <setting=value>
6/4/2014 Openvswitch and ovsdb | Sreenivas Makam' s Blog
http://sreeninet.wordpress.com/2014/01/02/openvswitch-and-ovsdb/ 6/8
Lets say, we want to mirror packets from s2-eth2 interface of bridge s2 and send towards interface s2-
eth3, we can execute the following command. This will modify the bridge and mirror table appropriately.
sudo ovs-vsctl set bridge s2 mirrors=@m -- --id=@eth2 get port
s2-eth2 -- --id=@eth3 get Port s2-eth3 -- --id=@m create mirror
name=mymirror select-dst-port=@eth2 select-src-port=@eth2 output-
port=@eth3
Do a pingall from Mininet and allow simpleforwarding controller application to install flows. To dump
the flow table, we can use ovs-ofctl. Flows can also be dumped using raw dump of the flow table from
ovs-vsctl or ovsdb-client.
mininet@mininet-vm:~$ sudo ovs-ofctl dump-flows s2
NXST_FLOW reply (xid=0x4):
cookie=0x0, duration=79.866s, table=0, n_packets=1, n_bytes=98,
priority=1,ip,nw_dst=10.0.0.3 actions=output:3
cookie=0x0, duration=79.898s, table=0, n_packets=4, n_bytes=392,
priority=1,ip,nw_dst=10.0.0.1 actions=output:5
cookie=0x0, duration=79.884s, table=0, n_packets=2, n_bytes=196,
priority=1,ip,nw_dst=10.0.0.2
actions=mod_dl_dst:d2:87:9b:ac:c0:9f,output:4
We can also create a network and configure the network without using Mininet. Following is an example
for doing this:
sudo ovs-vsctl add-br s1
sudo ovs-vsctl add-br s2
sudo ovs-vsctl add-br s3
sudo ovs-vsctl add-port s1 patch-s1
sudo ovs-vsctl set interface patch-s1 type=patch
sudo ovs-vsctl set interface patch-s1 options:peer=patch-s2
sudo ovs-vsctl add-port s2 patch-s2
sudo ovs-vsctl set interface patch-s2 type=patch
sudo ovs-vsctl set interface patch-s2 options:peer=patch-s1
sudo ovs-vsctl set-controller tcp:192.168.56.101:6633
sudo ovs-vsctl set-controller s1 tcp:192.168.56.101:6633
sudo ovs-vsctl set-controller s2 tcp:192.168.56.101:6633
6/4/2014 Openvswitch and ovsdb | Sreenivas Makam' s Blog
http://sreeninet.wordpress.com/2014/01/02/openvswitch-and-ovsdb/ 7/8
The above set of commands will create a linear 2 node topology with a patch connection between the 2
nodes. Its not clear to me how mininet creates connection between nodes since I did not observe a patch
connection with Mininet created topology.
Opendaylight and ovsdb:
As part of Opendaylight Hydrogen release planned early 2014, ovsdb southbound plugin will be
introduced. This can allow the controller to manage vswitch using ovsdb protocol. Openflow plugin was
already supported which allowed openflow flows to be installed. There is also a Openstack+Opendaylight
integration project happening that will allow the Openstack to use the ML2 plugin of ODL for the
networking stuff. ML2 plugin will talk to ovsdb southbound plugin. More details on this later once I
understand this better.
Following link captures more details on the integration of ovsdb with Opendaylight. I have tried this
tutorial which shows a practical example of ovsdb integration with Opendaylight. This would need us to
compile ovsdb code and copy to controller. Instructions for this is present in the tutorial as well.
References:
Open vswitch database management protocol
Open vswitch database
Opendaylight OVSDB integration
Brents blog on getting started with OVSDB
Open Vswitch project
Share this:
Twitter Facebook Google
You May Like
1.
About these ads

Like
Be the f irst to like this.

6/4/2014 Openvswitch and ovsdb | Sreenivas Makam' s Blog


http://sreeninet.wordpress.com/2014/01/02/openvswitch-and-ovsdb/ 8/8
Related
Network Virtualization -
Openstack+ODL integration
Openflow history and some
hands-on
Tools used with
Opendaylight
In "Opendaylight" In "Openflow" In "Opendaylight"

Das könnte Ihnen auch gefallen