]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Sync dhcp_agent.ini with the codes
authorHui HX Xiang <xianghui@cn.ibm.com>
Fri, 29 Nov 2013 04:38:10 +0000 (20:38 -0800)
committerHui HX Xiang <xianghui@cn.ibm.com>
Thu, 5 Dec 2013 06:41:29 +0000 (22:41 -0800)
Add an option item into dhcp_agent.ini to sync with the codes.
* Add ovs_integration_bridge in /etc/dhcp_agent.ini
* Add corresponding unit test

Change-Id: Ia78e7ca6c1fcbeca3e962f870a393e44183d719c
closes-Bug: #1256197

etc/dhcp_agent.ini
neutron/tests/unit/test_linux_interface.py

index 1fea47858628a4012b2f07b7da80e290eef2b99b..78fb6c165050c2d9926306a4dcc7715393170b6c 100644 (file)
@@ -15,6 +15,9 @@
 # BigSwitch/Floodlight)
 # interface_driver = neutron.agent.linux.interface.OVSInterfaceDriver
 
+# Name of Open vSwitch bridge to use
+# ovs_integration_bridge = br-int
+
 # Use veth for an OVS interface or not.
 # Support kernels with limited namespace support
 # (e.g. RHEL 6.5) so long as ovs_use_veth is set to True.
index d5576439e47b3f2710f482bf5f0664c625c9a89a..1b540a431315c1b8180b117e0cd2960b7a943159 100644 (file)
@@ -110,6 +110,31 @@ class TestOVSInterfaceDriver(TestBase):
     def test_plug_alt_bridge(self):
         self._test_plug(bridge='br-foo')
 
+    def test_plug_configured_bridge(self):
+        br = 'br-v'
+        self.conf.set_override('ovs_use_veth', False)
+        self.conf.set_override('ovs_integration_bridge', br)
+        self.assertEqual(self.conf.ovs_integration_bridge, br)
+
+        def device_exists(dev, root_helper=None, namespace=None):
+            return dev == br
+
+        ovs = interface.OVSInterfaceDriver(self.conf)
+        with mock.patch.object(ovs, '_ovs_add_port') as add_port:
+            self.device_exists.side_effect = device_exists
+            ovs.plug('01234567-1234-1234-99',
+                     'port-1234',
+                     'tap0',
+                     'aa:bb:cc:dd:ee:ff',
+                     bridge=None,
+                     namespace=None)
+
+        add_port.assert_called_once_with('br-v',
+                                         'tap0',
+                                         'port-1234',
+                                         'aa:bb:cc:dd:ee:ff',
+                                         internal=True)
+
     def _test_plug(self, additional_expectation=[], bridge=None,
                    namespace=None):