Hi Thomas,
Thanks for your reporting!
Hmmmm... I also tried to implement the similar API (as following), but no bridge
instance was created...
def create_bridge(manager, system_id, bridge_name,
bridge_info=None, port_info=None, iface_info=None,
bridge_insert_uuid=None, port_insert_uuid=None,
iface_insert_uuid=None):
bridge_info = bridge_info or {}
bridge_info['name'] = bridge_name
port_info = port_info or {}
port_info['name'] = bridge_name
iface_info = iface_info or {}
iface_info['name'] = bridge_name
bridge_insert_uuid = bridge_insert_uuid or uuid.uuid4()
port_insert_uuid = port_insert_uuid or uuid.uuid4()
iface_insert_uuid = iface_insert_uuid or uuid.uuid4()
def _create_bridge(tables, insert):
iface = insert(tables['Interface'], iface_insert_uuid)
iface_info.update({
'type': 'internal',
})
for key, val in iface_info.items():
setattr(iface, key, val)
port = insert(tables['Port'], port_insert_uuid)
port_info.update({
'interfaces': [iface],
'fake_bridge': False,
})
for key, val in port_info.items():
setattr(port, key, val)
bridge = insert(tables['Bridge'], bridge_insert_uuid)
bridge_info.update({
'ports': [port],
})
for key, val in bridge_info.items():
setattr(bridge, key, val)
return iface_insert_uuid, port_insert_uuid, bridge_insert_uuid
req = ovsdb_event.EventModifyRequest(system_id, _create_bridge)
return manager.send_request(req)
Does anyone know why?
I found the corresponding API "add_bridge" on "ryu.lib.ovs.vsctl", this API
works as expected, but I couldn't investigate lacks of my implementation...
https://github.com/osrg/ryu/blob/8a48b62c90745e8112bb3f7277e8ac46dabb3e4e/ryu/lib/ovs/vsctl.py#L687-L756
Thanks,
Iwase
On 2018年02月28日 23:04, Thomas Langenskiöld wrote:
In my application I need to use the OVSDB manager to spawn ports and bridges on
OVS switches running on separate hosts. As I need to use in-band control, I need
to use an "active manager", i.e. the OVS switch initiates the OVSDB connection
to the manager.
It appears that the OVSDB manager library provided in Ryu is a bit incomplete. I
can use it to add ports, but I need to add bridges as well.
I tried to implement a function similar to the add_port function to add bridges,
but the bridges do not show up on the OVS switches. The code is included below:
from ryu.services.protocols.ovsdb import event as ovsdb_event
import uuid
def create_bridge(manager, system_id, bridge_name):
bridge_uuid = uuid.uuid4()
interface_uuid = uuid.uuid4()
port_uuid = uuid.uuid4()
def _create_bridge(tables, insert):
bridge = insert(tables['Bridge'], bridge_uuid)
setattr(bridge, 'name', bridge_name)
interface = insert(tables['Interface'], interface_uuid)
setattr(interface, 'name', bridge_name)
setattr(interface, 'type', 'internal')
port = insert(tables['Port'], port_uuid)
setattr(port, 'name', bridge_name)
port.interfaces = [interface]
bridge.ports = [port]
return interface_uuid, port_uuid, bridge_uuid
req = ovsdb_event.EventModifyRequest(system_id, _create_bridge)
return manager.send_request(req)
The result returned is as follows:
EventModifyReply<system_id=s1, status=success,
insert_uuids={UUID('8b70c13a-a31f-47a2-aee4-0980784bda16'):
UUID('673427e2-0ad1-40ae-a946-c5a506bc54b6'),
UUID('783af59e-118c-4c2e-ac21-8d8ac55624dd'):
UUID('1d400a21-a2f8-4bbb-aa7a-0f5186e9ce60'),
UUID('f156cb87-d57c-4c74-8706-d012c41ea0d0'):
UUID('44a526d7-820b-4396-b99f-0bf2195021f5')}, error_msg=None>
But no new bridges show up on my OVS switches. Any pointers on what's missing,
or am I doing something wrong?
Thanks in advance,
- Thomas
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel