In TestOpenvswitchSGServerRpcCallBack and NetworkBindingsTest
in OVS plugin tests, OVS plugin was not loaded properly.
* For NetworkBindingsTest, it can be fixed by changing setUp()
to take 'plugin' arguments in the base test classes
SecurityGroupDBTestCase and SGServerRpcCallBackMixinTestCase.
This fixes bug
1242510 in ML2 unit tests.
* For NetworkBindingsTest, it can be fixed by passing the plugin
class to super.setUp(). The test itself needs to be updated
because network binding is added when a network is created.
* NetworkBindingsTest in Linux Bridge plugin has the same issue,
so it is also fixed in this patch.
Closes-Bug: #
1230083
Closes-Bug: #
1242510
Change-Id: I914876225480585d822748c188e9b69d1adf46f3
# See the License for the specific language governing permissions and
# limitations under the License.
+from oslo.config import cfg
import testtools
from testtools import matchers
UPDATED_VLAN_RANGES = {PHYS_NET: [(VLAN_MIN + 5, VLAN_MAX + 5)],
PHYS_NET_2: [(VLAN_MIN + 20, VLAN_MAX + 20)]}
+PLUGIN_NAME = ('neutron.plugins.linuxbridge.'
+ 'lb_neutron_plugin.LinuxBridgePluginV2')
+
class NetworkStatesTest(base.BaseTestCase):
def setUp(self):
class NetworkBindingsTest(test_plugin.NeutronDbPluginV2TestCase):
def setUp(self):
- super(NetworkBindingsTest, self).setUp()
+ cfg.CONF.set_override('network_vlan_ranges', ['physnet1:1000:2999'],
+ group='VLANS')
+ super(NetworkBindingsTest, self).setUp(plugin=PLUGIN_NAME)
lb_db.initialize()
self.session = db.get_session()
def test_add_network_binding(self):
- with self.network() as network:
+ params = {'provider:network_type': 'vlan',
+ 'provider:physical_network': PHYS_NET,
+ 'provider:segmentation_id': 1234}
+ params['arg_list'] = tuple(params.keys())
+ with self.network(**params) as network:
TEST_NETWORK_ID = network['network']['id']
- self.assertIsNone(lb_db.get_network_binding(self.session,
- TEST_NETWORK_ID))
- lb_db.add_network_binding(self.session, TEST_NETWORK_ID, PHYS_NET,
- 1234)
binding = lb_db.get_network_binding(self.session, TEST_NETWORK_ID)
self.assertIsNotNone(binding)
self.assertEqual(binding.network_id, TEST_NETWORK_ID)
# limitations under the License.
import mock
+from oslo.config import cfg
import testtools
from testtools import matchers
TUNNEL_RANGES = [(TUN_MIN, TUN_MAX)]
UPDATED_TUNNEL_RANGES = [(TUN_MIN + 5, TUN_MAX + 5)]
+PLUGIN_NAME = ('neutron.plugins.openvswitch.'
+ 'ovs_neutron_plugin.OVSNeutronPluginV2')
+
class VlanAllocationsTest(base.BaseTestCase):
def setUp(self):
class NetworkBindingsTest(test_plugin.NeutronDbPluginV2TestCase):
def setUp(self):
- super(NetworkBindingsTest, self).setUp()
+ cfg.CONF.set_override('network_vlan_ranges', ['physnet1:1000:2999'],
+ group='OVS')
+ super(NetworkBindingsTest, self).setUp(plugin=PLUGIN_NAME)
ovs_db_v2.initialize()
self.session = db.get_session()
def test_add_network_binding(self):
- with self.network() as network:
+ params = {'provider:network_type': 'vlan',
+ 'provider:physical_network': PHYS_NET,
+ 'provider:segmentation_id': 1234}
+ params['arg_list'] = tuple(params.keys())
+ with self.network(**params) as network:
TEST_NETWORK_ID = network['network']['id']
- self.assertIsNone(ovs_db_v2.get_network_binding(self.session,
- TEST_NETWORK_ID))
- ovs_db_v2.add_network_binding(self.session, TEST_NETWORK_ID,
- 'vlan', PHYS_NET, 1234)
binding = ovs_db_v2.get_network_binding(self.session,
TEST_NETWORK_ID)
self.assertIsNotNone(binding)
class SecurityGroupDBTestCase(SecurityGroupsTestCase):
def setUp(self, plugin=None):
- test_config['plugin_name_v2'] = DB_PLUGIN_KLASS
+ plugin = plugin or DB_PLUGIN_KLASS
ext_mgr = SecurityGroupTestExtensionManager()
test_config['extension_manager'] = ext_mgr
super(SecurityGroupDBTestCase, self).setUp(plugin)
- def tearDown(self):
- del test_config['plugin_name_v2']
- super(SecurityGroupDBTestCase, self).tearDown()
-
class TestSecurityGroups(SecurityGroupDBTestCase):
def test_create_security_group(self):
class SGServerRpcCallBackMixinTestCase(test_sg.SecurityGroupDBTestCase):
def setUp(self, plugin=None):
- super(SGServerRpcCallBackMixinTestCase, self).setUp()
+ super(SGServerRpcCallBackMixinTestCase, self).setUp(plugin)
self.rpc = FakeSGCallback()
def test_security_group_rules_for_devices_ipv4_ingress(self):