diff options
author | IWASE Yusuke <iwase.yusuke0@gmail.com> | 2016-10-20 16:48:19 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2016-10-25 16:22:41 +0900 |
commit | 2744d0a9e34f10b51103ebd97635499b8bdce76b (patch) | |
tree | 30dc902d65e0f4b1dae3990dcf259b02f286f68b | |
parent | 3e19c38e9e67e59f9b060cf5ed5d41af466e0484 (diff) |
ovs/vsctl: Add missing Interface commands in OVS v2.6.0
Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r-- | ryu/lib/ovs/vsctl.py | 20 |
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): |