Replace non-ovs_lib calls of run_vsctl with libary functions

There is already an OVSBridge.set_controller() function, so replace
calls to run_vsctl(['set-controller', ...]) with calls to
OVSBridge.set_controller().

This is also the only non-ovs_lib call to run_vsctl. This change
will also make it easier to abstract out the ovsdb-related code in
the future.

Change-Id: Ia5a3e2c759d2479a2e7088a2ab7db1d4e17d1ae2
This commit is contained in:
Terry Wilson 2014-12-12 10:12:02 -07:00
parent 6f2231a709
commit 06295477aa
2 changed files with 4 additions and 9 deletions

View File

@ -142,9 +142,7 @@ class SdnveNeutronAgent(object):
if self.int_br and new_controller:
LOG.debug("info_update received. New controller"
"is to be set to: %s", new_controller)
self.int_br.run_vsctl(["set-controller",
self.int_bridge_name,
"tcp:" + new_controller])
self.int_br.set_controller(["tcp:" + new_controller])
if out_of_band:
LOG.debug("info_update received. New controller"
"is set to be out of band")
@ -175,8 +173,7 @@ class SdnveNeutronAgent(object):
# set the controller
if controller_ip:
int_br.run_vsctl(
["set-controller", bridge_name, "tcp:" + controller_ip])
int_br.set_controller(["tcp:" + controller_ip])
if out_of_band:
int_br.set_db_attribute("controller", bridge_name,
"connection-mode", "out-of-band")

View File

@ -96,13 +96,11 @@ class TestSdnveNeutronAgent(base.BaseTestCase):
def test_get_info_set_controller(self):
with mock.patch.object(self.agent.int_br,
'run_vsctl') as run_vsctl_func:
'set_controller') as set_controller_func:
kwargs = {}
kwargs['info'] = {'new_controller': '10.10.10.1'}
self.agent.info_update('dummy', **kwargs)
run_vsctl_func.assert_called_once_with(['set-controller',
'br_int',
'tcp:10.10.10.1'])
set_controller_func.assert_called_once_with(['tcp:10.10.10.1'])
def test_get_info(self):
with mock.patch.object(self.agent.int_br,