]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Replace non-ovs_lib calls of run_vsctl with libary functions
authorTerry Wilson <twilson@redhat.com>
Fri, 12 Dec 2014 17:12:02 +0000 (10:12 -0700)
committerTerry Wilson <twilson@redhat.com>
Fri, 12 Dec 2014 17:12:02 +0000 (10:12 -0700)
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

neutron/plugins/ibm/agent/sdnve_neutron_agent.py
neutron/tests/unit/ibm/test_sdnve_agent.py

index 0abd1d7bf2a23408848656aeb1f8920c1f4f1436..d6f559dbed80fe870d1e6ead3340eddc7717885b 100644 (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")
index c1c9f95ed753262c7789b88e5d4434450ab9c63d..c701bc4a9bbd1632199e65eae3e62b361aa8b11c 100644 (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,