ovs/vsctl: Add missing Port 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>
This commit is contained in:
IWASE Yusuke 2016-10-20 16:48:20 +09:00 committed by FUJITA Tomonori
parent 2744d0a9e3
commit 05b3738359

View File

@ -1148,7 +1148,7 @@ class VSCtl(object):
'add-port': (self._pre_cmd_add_port, self._cmd_add_port),
'add-bond': (self._pre_cmd_add_bond, self._cmd_add_bond),
'del-port': (self._pre_get_info, self._cmd_del_port),
# 'port-to-br':
'port-to-br': (self._pre_get_info, self._cmd_port_to_br),
# Interface commands.
'list-ifaces': (self._pre_get_info, self._cmd_list_ifaces),
@ -1596,6 +1596,20 @@ class VSCtl(object):
br_name = command.args[0] if len(command.args) == 2 else None
self._del_port(ctx, br_name, target, must_exist, with_iface)
def _port_to_br(self, ctx, port_name):
ctx.populate_cache()
port = ctx.find_port(port_name, True)
bridge = port.bridge()
if bridge is None:
vsctl_fatal('Bridge associated to port "%s" does not exist' %
port_name)
return bridge.name
def _cmd_port_to_br(self, ctx, command):
iface_name = command.args[0]
command.result = self._iface_to_br(ctx, iface_name)
# Interface commands:
def _list_ifaces(self, ctx, br_name):