summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--ryu/lib/ovs/vsctl.py20
1 files changed, 19 insertions, 1 deletions
diff --git a/ryu/lib/ovs/vsctl.py b/ryu/lib/ovs/vsctl.py
index 5e7367d5..a79b8b92 100644
--- a/ryu/lib/ovs/vsctl.py
+++ b/ryu/lib/ovs/vsctl.py
@@ -1152,7 +1152,7 @@ class VSCtl(object):
# Interface commands.
'list-ifaces': (self._pre_get_info, self._cmd_list_ifaces),
- # 'iface-to-br':
+ 'iface-to-br': (self._pre_get_info, self._cmd_iface_to_br),
# Controller commands.
'get-controller': (self._pre_controller, self._cmd_get_controller),
@@ -1617,6 +1617,24 @@ class VSCtl(object):
iface_names = self._list_ifaces(ctx, br_name)
command.result = sorted(iface_names)
+ def _iface_to_br(self, ctx, iface_name):
+ ctx.populate_cache()
+ iface = ctx.find_iface(iface_name, True)
+ port = iface.port()
+ if port is None:
+ vsctl_fatal('Port associated to iface "%s" does not exist' %
+ iface_name)
+ bridge = port.bridge()
+ if bridge is None:
+ vsctl_fatal('Bridge associated to iface "%s" does not exist' %
+ iface_name)
+
+ return bridge.name
+
+ def _cmd_iface_to_br(self, ctx, command):
+ iface_name = command.args[0]
+ command.result = self._iface_to_br(ctx, iface_name)
+
# Utility commands for quantum_adapter:
def _pre_cmd_list_ifaces_verbose(self, ctx, command):