From: Terry Wilson Date: Fri, 12 Dec 2014 17:12:02 +0000 (-0700) Subject: Replace non-ovs_lib calls of run_vsctl with libary functions X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=06295477aa74f6bfea38cc10c76cf2390b469305;p=openstack-build%2Fneutron-build.git 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 --- diff --git a/neutron/plugins/ibm/agent/sdnve_neutron_agent.py b/neutron/plugins/ibm/agent/sdnve_neutron_agent.py index 0abd1d7bf..d6f559dbe 100644 --- a/neutron/plugins/ibm/agent/sdnve_neutron_agent.py +++ b/neutron/plugins/ibm/agent/sdnve_neutron_agent.py @@ -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") diff --git a/neutron/tests/unit/ibm/test_sdnve_agent.py b/neutron/tests/unit/ibm/test_sdnve_agent.py index c1c9f95ed..c701bc4a9 100644 --- a/neutron/tests/unit/ibm/test_sdnve_agent.py +++ b/neutron/tests/unit/ibm/test_sdnve_agent.py @@ -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,