From 83a7ef5f284b503805b22c27d140b0fb6c9c4ade Mon Sep 17 00:00:00 2001 From: Kyle Mestery Date: Wed, 2 Apr 2014 14:39:13 +0000 Subject: [PATCH] Revert changes removing OVSBridge return This reverts changes from this review [1] which incorrectly removed the return of the OVSBridge object when calling BaseOVS.add_bridge. This broke all functional tests relying on this return. [1] https://review.openstack.org/#/c/71142/ Related-Bug: #1301363 Change-Id: If32e155cc2bd368b2e842f14b1d1da0827ccfeff --- neutron/agent/linux/ovs_lib.py | 1 + neutron/tests/unit/agent/linux/test_ovs_lib.py | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/neutron/agent/linux/ovs_lib.py b/neutron/agent/linux/ovs_lib.py index e1172234f8..b50ea7a30c 100644 --- a/neutron/agent/linux/ovs_lib.py +++ b/neutron/agent/linux/ovs_lib.py @@ -75,6 +75,7 @@ class BaseOVS(object): def add_bridge(self, bridge_name): self.run_vsctl(["--", "--may-exist", "add-br", bridge_name]) + return OVSBridge(bridge_name, self.root_helper) def delete_bridge(self, bridge_name): self.run_vsctl(["--", "--if-exists", "del-br", bridge_name]) diff --git a/neutron/tests/unit/agent/linux/test_ovs_lib.py b/neutron/tests/unit/agent/linux/test_ovs_lib.py index a9c1b981ad..b34f7be648 100644 --- a/neutron/tests/unit/agent/linux/test_ovs_lib.py +++ b/neutron/tests/unit/agent/linux/test_ovs_lib.py @@ -42,9 +42,12 @@ class TestBaseOVS(base.BaseTestCase): def test_add_bridge(self): with mock.patch.object(self.ovs, 'run_vsctl') as mock_vsctl: - self.ovs.add_bridge(self.br_name) + bridge = self.ovs.add_bridge(self.br_name) + mock_vsctl.assert_called_with(["--", "--may-exist", "add-br", self.br_name]) + self.assertEqual(bridge.br_name, self.br_name) + self.assertEqual(bridge.root_helper, self.ovs.root_helper) def test_delete_bridge(self): with mock.patch.object(self.ovs, 'run_vsctl') as mock_vsctl: