Merge "Ensure OVS plugin is loaded in OVS plugin test"
This commit is contained in:
commit
1ae8a31019
@ -13,6 +13,7 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
from oslo.config import cfg
|
||||||
import testtools
|
import testtools
|
||||||
from testtools import matchers
|
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)],
|
UPDATED_VLAN_RANGES = {PHYS_NET: [(VLAN_MIN + 5, VLAN_MAX + 5)],
|
||||||
PHYS_NET_2: [(VLAN_MIN + 20, VLAN_MAX + 20)]}
|
PHYS_NET_2: [(VLAN_MIN + 20, VLAN_MAX + 20)]}
|
||||||
|
|
||||||
|
PLUGIN_NAME = ('neutron.plugins.linuxbridge.'
|
||||||
|
'lb_neutron_plugin.LinuxBridgePluginV2')
|
||||||
|
|
||||||
|
|
||||||
class NetworkStatesTest(base.BaseTestCase):
|
class NetworkStatesTest(base.BaseTestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
@ -147,17 +151,19 @@ class NetworkStatesTest(base.BaseTestCase):
|
|||||||
|
|
||||||
class NetworkBindingsTest(test_plugin.NeutronDbPluginV2TestCase):
|
class NetworkBindingsTest(test_plugin.NeutronDbPluginV2TestCase):
|
||||||
def setUp(self):
|
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()
|
lb_db.initialize()
|
||||||
self.session = db.get_session()
|
self.session = db.get_session()
|
||||||
|
|
||||||
def test_add_network_binding(self):
|
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']
|
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)
|
binding = lb_db.get_network_binding(self.session, TEST_NETWORK_ID)
|
||||||
self.assertIsNotNone(binding)
|
self.assertIsNotNone(binding)
|
||||||
self.assertEqual(binding.network_id, TEST_NETWORK_ID)
|
self.assertEqual(binding.network_id, TEST_NETWORK_ID)
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
|
from oslo.config import cfg
|
||||||
import testtools
|
import testtools
|
||||||
from testtools import matchers
|
from testtools import matchers
|
||||||
|
|
||||||
@ -40,6 +41,9 @@ TUN_MAX = 109
|
|||||||
TUNNEL_RANGES = [(TUN_MIN, TUN_MAX)]
|
TUNNEL_RANGES = [(TUN_MIN, TUN_MAX)]
|
||||||
UPDATED_TUNNEL_RANGES = [(TUN_MIN + 5, TUN_MAX + 5)]
|
UPDATED_TUNNEL_RANGES = [(TUN_MIN + 5, TUN_MAX + 5)]
|
||||||
|
|
||||||
|
PLUGIN_NAME = ('neutron.plugins.openvswitch.'
|
||||||
|
'ovs_neutron_plugin.OVSNeutronPluginV2')
|
||||||
|
|
||||||
|
|
||||||
class VlanAllocationsTest(base.BaseTestCase):
|
class VlanAllocationsTest(base.BaseTestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
@ -295,17 +299,19 @@ class TunnelAllocationsTest(base.BaseTestCase):
|
|||||||
|
|
||||||
class NetworkBindingsTest(test_plugin.NeutronDbPluginV2TestCase):
|
class NetworkBindingsTest(test_plugin.NeutronDbPluginV2TestCase):
|
||||||
def setUp(self):
|
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()
|
ovs_db_v2.initialize()
|
||||||
self.session = db.get_session()
|
self.session = db.get_session()
|
||||||
|
|
||||||
def test_add_network_binding(self):
|
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']
|
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,
|
binding = ovs_db_v2.get_network_binding(self.session,
|
||||||
TEST_NETWORK_ID)
|
TEST_NETWORK_ID)
|
||||||
self.assertIsNotNone(binding)
|
self.assertIsNotNone(binding)
|
||||||
|
@ -240,15 +240,11 @@ class SecurityGroupTestPlugin(db_base_plugin_v2.NeutronDbPluginV2,
|
|||||||
|
|
||||||
class SecurityGroupDBTestCase(SecurityGroupsTestCase):
|
class SecurityGroupDBTestCase(SecurityGroupsTestCase):
|
||||||
def setUp(self, plugin=None):
|
def setUp(self, plugin=None):
|
||||||
test_config['plugin_name_v2'] = DB_PLUGIN_KLASS
|
plugin = plugin or DB_PLUGIN_KLASS
|
||||||
ext_mgr = SecurityGroupTestExtensionManager()
|
ext_mgr = SecurityGroupTestExtensionManager()
|
||||||
test_config['extension_manager'] = ext_mgr
|
test_config['extension_manager'] = ext_mgr
|
||||||
super(SecurityGroupDBTestCase, self).setUp(plugin)
|
super(SecurityGroupDBTestCase, self).setUp(plugin)
|
||||||
|
|
||||||
def tearDown(self):
|
|
||||||
del test_config['plugin_name_v2']
|
|
||||||
super(SecurityGroupDBTestCase, self).tearDown()
|
|
||||||
|
|
||||||
|
|
||||||
class TestSecurityGroups(SecurityGroupDBTestCase):
|
class TestSecurityGroups(SecurityGroupDBTestCase):
|
||||||
def test_create_security_group(self):
|
def test_create_security_group(self):
|
||||||
|
@ -52,7 +52,7 @@ class FakeSGCallback(sg_db_rpc.SecurityGroupServerRpcCallbackMixin):
|
|||||||
|
|
||||||
class SGServerRpcCallBackMixinTestCase(test_sg.SecurityGroupDBTestCase):
|
class SGServerRpcCallBackMixinTestCase(test_sg.SecurityGroupDBTestCase):
|
||||||
def setUp(self, plugin=None):
|
def setUp(self, plugin=None):
|
||||||
super(SGServerRpcCallBackMixinTestCase, self).setUp()
|
super(SGServerRpcCallBackMixinTestCase, self).setUp(plugin)
|
||||||
self.rpc = FakeSGCallback()
|
self.rpc = FakeSGCallback()
|
||||||
|
|
||||||
def test_security_group_rules_for_devices_ipv4_ingress(self):
|
def test_security_group_rules_for_devices_ipv4_ingress(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user