diff options
author | IWASE Yusuke <iwase.yusuke0@gmail.com> | 2017-11-02 09:11:26 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2017-11-02 09:20:55 +0900 |
commit | eda4940eb86f874f7b218b75f2e3a8c11e62c9ae (patch) | |
tree | 21ff6d6345309f13c12b83aae7338390797c917a /doc/source/library_ovsdb_manager.rst | |
parent | 92730dc7e9906649d761bb1ee4cc1a354d4ef96c (diff) |
library_ovsdb_manager: Descriptions for OVS configs
To connect OVSDB Manager library to OVS, some additional configurations
on OVS is required, but currently no description about these
configurations.
This patch adds descriptions for OVS configurations and includes some
improvements of sample application.
Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'doc/source/library_ovsdb_manager.rst')
-rw-r--r-- | doc/source/library_ovsdb_manager.rst | 51 |
1 files changed, 42 insertions, 9 deletions
diff --git a/doc/source/library_ovsdb_manager.rst b/doc/source/library_ovsdb_manager.rst index b36a9335..aae6baf6 100644 --- a/doc/source/library_ovsdb_manager.rst +++ b/doc/source/library_ovsdb_manager.rst @@ -2,6 +2,8 @@ OVSDB Manager library ********************* +Path: ``ryu.services.protocols.ovsdb`` + Introduction ============ @@ -9,11 +11,40 @@ Ryu OVSDB Manager library allows your code to interact with devices speaking the OVSDB protocol. This enables your code to perform remote management of the devices and react to topology changes on them. +Please note this library will spawn a server listening on the port 6640 (the +IANA registered for OVSDB protocol), but does not initiate connections from +controller side. +Then, to make your devices connect to Ryu, you need to tell the controller IP +address and port to your devices. + +.. code-block:: bash + + # Show current configuration + $ ovs-vsctl get-manager + + # Set manager (controller) address + $ ovs-vsctl set-manager "tcp:127.0.0.1:6640" + + # If you want to specify IPv6 address, wrap ip with brackets + $ ovs-vsctl set-manager "tcp:[::1]:6640" + +Also this library identifies the devices by "system-id" which should be unique, +persistent identifier among all devices connecting to a single controller. +Please make sure "system-id" is configured before connecting. + +.. code-block:: bash + + # Show current configuration + $ ovs-vsctl get Open_vSwitch . external_ids:system-id + + # Set system-id manually + $ ovs-vsctl set Open_vSwitch . external_ids:system-id=<SYSTEM-ID> + Example ======= -The following logs all new OVSDB connections and allows creating a port -on a bridge. +The following logs all new OVSDB connections in "handle_new_ovsdb_connection" +and also provides the API "create_port" for creating a port on a bridge. .. code-block:: python @@ -29,11 +60,14 @@ on a bridge. @set_ev_cls(ovsdb_event.EventNewOVSDBConnection) def handle_new_ovsdb_connection(self, ev): system_id = ev.system_id - addr = ev.client.address - self.logger.info('New OVSDB connection from system id %s', - system_id) - self.logger.info('The connection address id %s', - addr) + address = ev.client.address + self.logger.info( + 'New OVSDB connection from system-id=%s, address=%s', + system_id, address) + + # Example: If device has bridge "s1", add port "s1-eth99" + if ovsdb.bridge_exists(self, system_id, "s1"): + self.create_port(system_id, "s1", "s1-eth99") def create_port(self, system_id, bridge_name, name): new_iface_uuid = uuid.uuid4() @@ -42,7 +76,6 @@ on a bridge. bridge = ovsdb.row_by_name(self, system_id, bridge_name) def _create_port(tables, insert): - iface = insert(tables['Interface'], new_iface_uuid) iface.name = name iface.type = 'internal' @@ -53,7 +86,7 @@ on a bridge. bridge.ports = bridge.ports + [port] - return (new_port_uuid, new_iface_uuid) + return new_port_uuid, new_iface_uuid req = ovsdb_event.EventModifyRequest(system_id, _create_port) rep = self.send_request(req) |