Merge "Ensure OVS plugin is loaded in OVS plugin test"

This commit is contained in:
Jenkins 2013-10-26 21:44:12 +00:00 committed by Gerrit Code Review
commit 1ae8a31019
4 changed files with 26 additions and 18 deletions

View File

@ -13,6 +13,7 @@
# 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
@ -30,6 +31,9 @@ VLAN_RANGES = {PHYS_NET: [(VLAN_MIN, VLAN_MAX)]}
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):
@ -147,17 +151,19 @@ class NetworkStatesTest(base.BaseTestCase):
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)

View File

@ -16,6 +16,7 @@
# limitations under the License.
import mock
from oslo.config import cfg
import testtools
from testtools import matchers
@ -40,6 +41,9 @@ TUN_MAX = 109
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):
@ -295,17 +299,19 @@ class TunnelAllocationsTest(base.BaseTestCase):
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)

View File

@ -240,15 +240,11 @@ class SecurityGroupTestPlugin(db_base_plugin_v2.NeutronDbPluginV2,
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):

View File

@ -52,7 +52,7 @@ class FakeSGCallback(sg_db_rpc.SecurityGroupServerRpcCallbackMixin):
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):