Merge "Remove some duplicate unit tests"
This commit is contained in:
commit
aaa7c8b400
@ -237,20 +237,6 @@ class N1kvPluginTestCase(test_plugin.NeutronDbPluginV2TestCase):
|
|||||||
# Restore the original RESOURCE_ATTRIBUTE_MAP
|
# Restore the original RESOURCE_ATTRIBUTE_MAP
|
||||||
attributes.RESOURCE_ATTRIBUTE_MAP = self.saved_attr_map
|
attributes.RESOURCE_ATTRIBUTE_MAP = self.saved_attr_map
|
||||||
|
|
||||||
def test_plugin(self):
|
|
||||||
self._make_network('json',
|
|
||||||
'some_net',
|
|
||||||
True,
|
|
||||||
tenant_id=self.tenant_id,
|
|
||||||
set_context=True)
|
|
||||||
|
|
||||||
req = self.new_list_request('networks', params="fields=tenant_id")
|
|
||||||
req.environ['neutron.context'] = context.Context('', self.tenant_id)
|
|
||||||
res = req.get_response(self.api)
|
|
||||||
self.assertEqual(res.status_int, 200)
|
|
||||||
body = self.deserialize('json', res)
|
|
||||||
self.assertIn('tenant_id', body['networks'][0])
|
|
||||||
|
|
||||||
|
|
||||||
class TestN1kvNetworkProfiles(N1kvPluginTestCase):
|
class TestN1kvNetworkProfiles(N1kvPluginTestCase):
|
||||||
def _prepare_net_profile_data(self,
|
def _prepare_net_profile_data(self,
|
||||||
@ -959,6 +945,20 @@ class TestN1kvPolicyProfiles(N1kvPluginTestCase):
|
|||||||
class TestN1kvNetworks(test_plugin.TestNetworksV2,
|
class TestN1kvNetworks(test_plugin.TestNetworksV2,
|
||||||
N1kvPluginTestCase):
|
N1kvPluginTestCase):
|
||||||
|
|
||||||
|
def test_plugin(self):
|
||||||
|
self._make_network('json',
|
||||||
|
'some_net',
|
||||||
|
True,
|
||||||
|
tenant_id=self.tenant_id,
|
||||||
|
set_context=True)
|
||||||
|
|
||||||
|
req = self.new_list_request('networks', params="fields=tenant_id")
|
||||||
|
req.environ['neutron.context'] = context.Context('', self.tenant_id)
|
||||||
|
res = req.get_response(self.api)
|
||||||
|
self.assertEqual(res.status_int, 200)
|
||||||
|
body = self.deserialize('json', res)
|
||||||
|
self.assertIn('tenant_id', body['networks'][0])
|
||||||
|
|
||||||
def _prepare_net_data(self, net_profile_id):
|
def _prepare_net_data(self, net_profile_id):
|
||||||
return {'network': {'name': 'net1',
|
return {'network': {'name': 'net1',
|
||||||
n1kv.PROFILE_ID: net_profile_id,
|
n1kv.PROFILE_ID: net_profile_id,
|
||||||
|
@ -17,19 +17,14 @@ from oslo.config import cfg
|
|||||||
|
|
||||||
from neutron.plugins.embrane.common import config # noqa
|
from neutron.plugins.embrane.common import config # noqa
|
||||||
from neutron.tests.unit import test_extension_extraroute as extraroute_test
|
from neutron.tests.unit import test_extension_extraroute as extraroute_test
|
||||||
from neutron.tests.unit import test_l3_plugin as router_test
|
|
||||||
|
|
||||||
PLUGIN_NAME = ('neutron.plugins.embrane.plugins.embrane_fake_plugin.'
|
PLUGIN_NAME = ('neutron.plugins.embrane.plugins.embrane_fake_plugin.'
|
||||||
'EmbraneFakePlugin')
|
'EmbraneFakePlugin')
|
||||||
|
|
||||||
|
|
||||||
class TestEmbraneL3NatDBTestCase(router_test.L3NatDBIntTestCase):
|
class TestEmbraneL3NatDBTestCase(extraroute_test.ExtraRouteDBIntTestCase):
|
||||||
_plugin_name = PLUGIN_NAME
|
_plugin_name = PLUGIN_NAME
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
cfg.CONF.set_override('admin_password', "admin123", 'heleos')
|
cfg.CONF.set_override('admin_password', "admin123", 'heleos')
|
||||||
super(TestEmbraneL3NatDBTestCase, self).setUp()
|
super(TestEmbraneL3NatDBTestCase, self).setUp()
|
||||||
|
|
||||||
|
|
||||||
class ExtraRouteDBTestCase(extraroute_test.ExtraRouteDBIntTestCase):
|
|
||||||
_plugin_name = PLUGIN_NAME
|
|
||||||
|
@ -82,6 +82,9 @@ class SriovNicSwitchMechanismBaseTestCase(base.AgentMechanismBaseTestCase):
|
|||||||
self.driver = mech_driver.SriovNicSwitchMechanismDriver()
|
self.driver = mech_driver.SriovNicSwitchMechanismDriver()
|
||||||
self.driver.initialize()
|
self.driver.initialize()
|
||||||
|
|
||||||
|
|
||||||
|
class SriovSwitchMechGenericTestCase(SriovNicSwitchMechanismBaseTestCase,
|
||||||
|
base.AgentMechanismGenericTestCase):
|
||||||
def test_check_segment(self):
|
def test_check_segment(self):
|
||||||
"""Validate the check_segment call."""
|
"""Validate the check_segment call."""
|
||||||
segment = {'api.NETWORK_TYPE': ""}
|
segment = {'api.NETWORK_TYPE': ""}
|
||||||
@ -92,11 +95,6 @@ class SriovNicSwitchMechanismBaseTestCase(base.AgentMechanismBaseTestCase):
|
|||||||
self.assertFalse(self.driver.check_segment(segment))
|
self.assertFalse(self.driver.check_segment(segment))
|
||||||
|
|
||||||
|
|
||||||
class SriovSwitchMechGenericTestCase(SriovNicSwitchMechanismBaseTestCase,
|
|
||||||
base.AgentMechanismGenericTestCase):
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
class SriovMechVlanTestCase(SriovNicSwitchMechanismBaseTestCase,
|
class SriovMechVlanTestCase(SriovNicSwitchMechanismBaseTestCase,
|
||||||
base.AgentMechanismBaseTestCase):
|
base.AgentMechanismBaseTestCase):
|
||||||
VLAN_SEGMENTS = [{api.ID: 'unknown_segment_id',
|
VLAN_SEGMENTS = [{api.ID: 'unknown_segment_id',
|
||||||
|
@ -62,11 +62,6 @@ class MlnxMechanismFlatTestCase(MlnxMechanismBaseTestCase,
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class MlnxMechanismVlanTestCase(MlnxMechanismBaseTestCase,
|
|
||||||
base.AgentMechanismVlanTestCase):
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
class MlnxMechanismVnicTypeTestCase(MlnxMechanismBaseTestCase,
|
class MlnxMechanismVnicTypeTestCase(MlnxMechanismBaseTestCase,
|
||||||
base.AgentMechanismVlanTestCase):
|
base.AgentMechanismVlanTestCase):
|
||||||
def _check_vif_type_for_vnic_type(self, vnic_type,
|
def _check_vif_type_for_vnic_type(self, vnic_type,
|
||||||
|
@ -46,7 +46,6 @@ class OpenDaylightTestCase(test_plugin.NeutronDbPluginV2TestCase):
|
|||||||
|
|
||||||
super(OpenDaylightTestCase, self).setUp(PLUGIN_NAME)
|
super(OpenDaylightTestCase, self).setUp(PLUGIN_NAME)
|
||||||
self.port_create_status = 'DOWN'
|
self.port_create_status = 'DOWN'
|
||||||
self.segment = {'api.NETWORK_TYPE': ""}
|
|
||||||
self.mech = mechanism_odl.OpenDaylightMechanismDriver()
|
self.mech = mechanism_odl.OpenDaylightMechanismDriver()
|
||||||
mechanism_odl.OpenDaylightMechanismDriver.sendjson = (
|
mechanism_odl.OpenDaylightMechanismDriver.sendjson = (
|
||||||
self.check_sendjson)
|
self.check_sendjson)
|
||||||
@ -54,22 +53,6 @@ class OpenDaylightTestCase(test_plugin.NeutronDbPluginV2TestCase):
|
|||||||
def check_sendjson(self, method, urlpath, obj, ignorecodes=[]):
|
def check_sendjson(self, method, urlpath, obj, ignorecodes=[]):
|
||||||
self.assertFalse(urlpath.startswith("http://"))
|
self.assertFalse(urlpath.startswith("http://"))
|
||||||
|
|
||||||
def test_check_segment(self):
|
|
||||||
"""Validate the check_segment call."""
|
|
||||||
self.segment[api.NETWORK_TYPE] = constants.TYPE_LOCAL
|
|
||||||
self.assertTrue(self.mech.check_segment(self.segment))
|
|
||||||
self.segment[api.NETWORK_TYPE] = constants.TYPE_FLAT
|
|
||||||
self.assertFalse(self.mech.check_segment(self.segment))
|
|
||||||
self.segment[api.NETWORK_TYPE] = constants.TYPE_VLAN
|
|
||||||
self.assertTrue(self.mech.check_segment(self.segment))
|
|
||||||
self.segment[api.NETWORK_TYPE] = constants.TYPE_GRE
|
|
||||||
self.assertTrue(self.mech.check_segment(self.segment))
|
|
||||||
self.segment[api.NETWORK_TYPE] = constants.TYPE_VXLAN
|
|
||||||
self.assertTrue(self.mech.check_segment(self.segment))
|
|
||||||
# Validate a network type not currently supported
|
|
||||||
self.segment[api.NETWORK_TYPE] = 'mpls'
|
|
||||||
self.assertFalse(self.mech.check_segment(self.segment))
|
|
||||||
|
|
||||||
|
|
||||||
class OpenDayLightMechanismConfigTests(testlib_api.SqlTestCase):
|
class OpenDayLightMechanismConfigTests(testlib_api.SqlTestCase):
|
||||||
|
|
||||||
@ -373,3 +356,20 @@ class OpenDaylightMechanismDriverTestCase(base.BaseTestCase):
|
|||||||
requests.codes.not_implemented):
|
requests.codes.not_implemented):
|
||||||
self._test_delete_resource_postcommit(
|
self._test_delete_resource_postcommit(
|
||||||
'port', status_code, requests.exceptions.HTTPError)
|
'port', status_code, requests.exceptions.HTTPError)
|
||||||
|
|
||||||
|
def test_check_segment(self):
|
||||||
|
"""Validate the check_segment call."""
|
||||||
|
segment = {'api.NETWORK_TYPE': ""}
|
||||||
|
segment[api.NETWORK_TYPE] = constants.TYPE_LOCAL
|
||||||
|
self.assertTrue(self.mech.check_segment(segment))
|
||||||
|
segment[api.NETWORK_TYPE] = constants.TYPE_FLAT
|
||||||
|
self.assertFalse(self.mech.check_segment(segment))
|
||||||
|
segment[api.NETWORK_TYPE] = constants.TYPE_VLAN
|
||||||
|
self.assertTrue(self.mech.check_segment(segment))
|
||||||
|
segment[api.NETWORK_TYPE] = constants.TYPE_GRE
|
||||||
|
self.assertTrue(self.mech.check_segment(segment))
|
||||||
|
segment[api.NETWORK_TYPE] = constants.TYPE_VXLAN
|
||||||
|
self.assertTrue(self.mech.check_segment(segment))
|
||||||
|
# Validate a network type not currently supported
|
||||||
|
segment[api.NETWORK_TYPE] = 'mpls'
|
||||||
|
self.assertFalse(self.mech.check_segment(segment))
|
||||||
|
@ -41,7 +41,6 @@ from neutron.tests.unit import test_db_plugin
|
|||||||
from neutron.tests.unit import test_extension_extraroute as extraroute_test
|
from neutron.tests.unit import test_extension_extraroute as extraroute_test
|
||||||
from neutron.tests.unit import test_extension_security_group as test_sg
|
from neutron.tests.unit import test_extension_security_group as test_sg
|
||||||
from neutron.tests.unit import test_extensions
|
from neutron.tests.unit import test_extensions
|
||||||
from neutron.tests.unit import test_l3_plugin
|
|
||||||
|
|
||||||
|
|
||||||
API_EXT_PATH = os.path.dirname(extensions.__file__)
|
API_EXT_PATH = os.path.dirname(extensions.__file__)
|
||||||
@ -383,8 +382,83 @@ class TestNuagePluginPortBinding(NuagePluginV2TestCase,
|
|||||||
self._check_response_no_portbindings(non_admin_port)
|
self._check_response_no_portbindings(non_admin_port)
|
||||||
|
|
||||||
|
|
||||||
class TestNuageL3NatTestCase(NuagePluginV2TestCase,
|
class TestNuageExtrarouteTestCase(NuagePluginV2TestCase,
|
||||||
test_l3_plugin.L3NatDBIntTestCase):
|
extraroute_test.ExtraRouteDBIntTestCase):
|
||||||
|
|
||||||
|
def test_router_update_with_dup_destination_address(self):
|
||||||
|
with self.router() as r:
|
||||||
|
with self.subnet(cidr='10.0.1.0/24') as s:
|
||||||
|
with self.port(subnet=s) as p:
|
||||||
|
self._router_interface_action('add',
|
||||||
|
r['router']['id'],
|
||||||
|
None,
|
||||||
|
p['port']['id'])
|
||||||
|
|
||||||
|
routes = [{'destination': '135.207.0.0/16',
|
||||||
|
'nexthop': '10.0.1.3'},
|
||||||
|
{'destination': '135.207.0.0/16',
|
||||||
|
'nexthop': '10.0.1.5'}]
|
||||||
|
|
||||||
|
self._update('routers', r['router']['id'],
|
||||||
|
{'router': {'routes':
|
||||||
|
routes}},
|
||||||
|
expected_code=exc.HTTPBadRequest.code)
|
||||||
|
|
||||||
|
# clean-up
|
||||||
|
self._router_interface_action('remove',
|
||||||
|
r['router']['id'],
|
||||||
|
None,
|
||||||
|
p['port']['id'])
|
||||||
|
|
||||||
|
def test_router_update_on_external_port(self):
|
||||||
|
with self.router() as r:
|
||||||
|
with self.subnet(cidr='10.0.1.0/24') as s:
|
||||||
|
self._set_net_external(s['subnet']['network_id'])
|
||||||
|
self._add_external_gateway_to_router(
|
||||||
|
r['router']['id'],
|
||||||
|
s['subnet']['network_id'])
|
||||||
|
body = self._show('routers', r['router']['id'])
|
||||||
|
net_id = body['router']['external_gateway_info']['network_id']
|
||||||
|
self.assertEqual(net_id, s['subnet']['network_id'])
|
||||||
|
port_res = self._list_ports(
|
||||||
|
'json',
|
||||||
|
200,
|
||||||
|
s['subnet']['network_id'],
|
||||||
|
tenant_id=r['router']['tenant_id'],
|
||||||
|
device_own=constants.DEVICE_OWNER_ROUTER_GW)
|
||||||
|
port_list = self.deserialize('json', port_res)
|
||||||
|
# The plugin will create 1 port
|
||||||
|
self.assertEqual(2, len(port_list['ports']))
|
||||||
|
|
||||||
|
routes = [{'destination': '135.207.0.0/16',
|
||||||
|
'nexthop': '10.0.1.3'}]
|
||||||
|
|
||||||
|
body = self._update('routers', r['router']['id'],
|
||||||
|
{'router': {'routes':
|
||||||
|
routes}})
|
||||||
|
|
||||||
|
body = self._show('routers', r['router']['id'])
|
||||||
|
self.assertEqual(routes,
|
||||||
|
body['router']['routes'])
|
||||||
|
|
||||||
|
self._remove_external_gateway_from_router(
|
||||||
|
r['router']['id'],
|
||||||
|
s['subnet']['network_id'])
|
||||||
|
body = self._show('routers', r['router']['id'])
|
||||||
|
gw_info = body['router']['external_gateway_info']
|
||||||
|
self.assertIsNone(gw_info)
|
||||||
|
|
||||||
|
def test_floatingip_create_different_fixed_ip_same_port(self):
|
||||||
|
self._test_floatingip_create_different_fixed_ip_same_port()
|
||||||
|
|
||||||
|
def test_floatingip_update_different_router(self):
|
||||||
|
self._test_floatingip_update_different_router()
|
||||||
|
|
||||||
|
def test_floatingip_update_different_fixed_ip_same_port(self):
|
||||||
|
self._test_floatingip_update_different_fixed_ip_same_port()
|
||||||
|
|
||||||
|
def test_network_update_external_failure(self):
|
||||||
|
self._test_network_update_external_failure()
|
||||||
|
|
||||||
def test_update_port_with_assoc_floatingip(self):
|
def test_update_port_with_assoc_floatingip(self):
|
||||||
with self.subnet(cidr='200.0.0.0/24') as public_sub:
|
with self.subnet(cidr='200.0.0.0/24') as public_sub:
|
||||||
@ -465,85 +539,6 @@ class TestNuageRouterExtTestCase(NuagePluginV2TestCase):
|
|||||||
self.assertEqual(exc.HTTPCreated.code, router_res.status_int)
|
self.assertEqual(exc.HTTPCreated.code, router_res.status_int)
|
||||||
|
|
||||||
|
|
||||||
class TestNuageExtrarouteTestCase(NuagePluginV2TestCase,
|
|
||||||
extraroute_test.ExtraRouteDBIntTestCase):
|
|
||||||
|
|
||||||
def test_router_update_with_dup_destination_address(self):
|
|
||||||
with self.router() as r:
|
|
||||||
with self.subnet(cidr='10.0.1.0/24') as s:
|
|
||||||
with self.port(subnet=s) as p:
|
|
||||||
self._router_interface_action('add',
|
|
||||||
r['router']['id'],
|
|
||||||
None,
|
|
||||||
p['port']['id'])
|
|
||||||
|
|
||||||
routes = [{'destination': '135.207.0.0/16',
|
|
||||||
'nexthop': '10.0.1.3'},
|
|
||||||
{'destination': '135.207.0.0/16',
|
|
||||||
'nexthop': '10.0.1.5'}]
|
|
||||||
|
|
||||||
self._update('routers', r['router']['id'],
|
|
||||||
{'router': {'routes':
|
|
||||||
routes}},
|
|
||||||
expected_code=exc.HTTPBadRequest.code)
|
|
||||||
|
|
||||||
# clean-up
|
|
||||||
self._router_interface_action('remove',
|
|
||||||
r['router']['id'],
|
|
||||||
None,
|
|
||||||
p['port']['id'])
|
|
||||||
|
|
||||||
def test_router_update_on_external_port(self):
|
|
||||||
with self.router() as r:
|
|
||||||
with self.subnet(cidr='10.0.1.0/24') as s:
|
|
||||||
self._set_net_external(s['subnet']['network_id'])
|
|
||||||
self._add_external_gateway_to_router(
|
|
||||||
r['router']['id'],
|
|
||||||
s['subnet']['network_id'])
|
|
||||||
body = self._show('routers', r['router']['id'])
|
|
||||||
net_id = body['router']['external_gateway_info']['network_id']
|
|
||||||
self.assertEqual(net_id, s['subnet']['network_id'])
|
|
||||||
port_res = self._list_ports(
|
|
||||||
'json',
|
|
||||||
200,
|
|
||||||
s['subnet']['network_id'],
|
|
||||||
tenant_id=r['router']['tenant_id'],
|
|
||||||
device_own=constants.DEVICE_OWNER_ROUTER_GW)
|
|
||||||
port_list = self.deserialize('json', port_res)
|
|
||||||
# The plugin will create 1 port
|
|
||||||
self.assertEqual(2, len(port_list['ports']))
|
|
||||||
|
|
||||||
routes = [{'destination': '135.207.0.0/16',
|
|
||||||
'nexthop': '10.0.1.3'}]
|
|
||||||
|
|
||||||
body = self._update('routers', r['router']['id'],
|
|
||||||
{'router': {'routes':
|
|
||||||
routes}})
|
|
||||||
|
|
||||||
body = self._show('routers', r['router']['id'])
|
|
||||||
self.assertEqual(routes,
|
|
||||||
body['router']['routes'])
|
|
||||||
|
|
||||||
self._remove_external_gateway_from_router(
|
|
||||||
r['router']['id'],
|
|
||||||
s['subnet']['network_id'])
|
|
||||||
body = self._show('routers', r['router']['id'])
|
|
||||||
gw_info = body['router']['external_gateway_info']
|
|
||||||
self.assertIsNone(gw_info)
|
|
||||||
|
|
||||||
def test_floatingip_create_different_fixed_ip_same_port(self):
|
|
||||||
self._test_floatingip_create_different_fixed_ip_same_port()
|
|
||||||
|
|
||||||
def test_floatingip_update_different_router(self):
|
|
||||||
self._test_floatingip_update_different_router()
|
|
||||||
|
|
||||||
def test_floatingip_update_different_fixed_ip_same_port(self):
|
|
||||||
self._test_floatingip_update_different_fixed_ip_same_port()
|
|
||||||
|
|
||||||
def test_network_update_external_failure(self):
|
|
||||||
self._test_network_update_external_failure()
|
|
||||||
|
|
||||||
|
|
||||||
class TestNuageProviderNetTestCase(NuagePluginV2TestCase):
|
class TestNuageProviderNetTestCase(NuagePluginV2TestCase):
|
||||||
|
|
||||||
def test_create_provider_network(self):
|
def test_create_provider_network(self):
|
||||||
|
@ -23,13 +23,12 @@ from neutron.tests.unit.nuage import test_netpartition
|
|||||||
from neutron.tests.unit.nuage import test_nuage_plugin
|
from neutron.tests.unit.nuage import test_nuage_plugin
|
||||||
from neutron.tests.unit import test_extension_extraroute as extraroute_test
|
from neutron.tests.unit import test_extension_extraroute as extraroute_test
|
||||||
from neutron.tests.unit import test_extension_security_group as test_sg
|
from neutron.tests.unit import test_extension_security_group as test_sg
|
||||||
from neutron.tests.unit import test_l3_plugin
|
|
||||||
|
|
||||||
_uuid = uuidutils.generate_uuid
|
_uuid = uuidutils.generate_uuid
|
||||||
|
|
||||||
|
|
||||||
class TestL3Sync(test_nuage_plugin.NuagePluginV2TestCase,
|
class TestL3Sync(test_nuage_plugin.NuagePluginV2TestCase,
|
||||||
test_l3_plugin.L3NatDBIntTestCase):
|
extraroute_test.ExtraRouteDBIntTestCase):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.session = context.get_admin_context().session
|
self.session = context.get_admin_context().session
|
||||||
@ -154,15 +153,6 @@ class TestL3Sync(test_nuage_plugin.NuagePluginV2TestCase,
|
|||||||
def test_network_update_external_failure(self):
|
def test_network_update_external_failure(self):
|
||||||
self._test_network_update_external_failure()
|
self._test_network_update_external_failure()
|
||||||
|
|
||||||
|
|
||||||
class TestExtraRouteSync(extraroute_test.ExtraRouteDBIntTestCase):
|
|
||||||
|
|
||||||
def setUp(self):
|
|
||||||
self.session = context.get_admin_context().session
|
|
||||||
self.syncmanager = sync.SyncManager(
|
|
||||||
test_nuage_plugin.getNuageClient())
|
|
||||||
super(TestExtraRouteSync, self).setUp()
|
|
||||||
|
|
||||||
def test_route_sync(self):
|
def test_route_sync(self):
|
||||||
route = {'destination': '135.207.0.0/16', 'nexthop': '10.0.1.3'}
|
route = {'destination': '135.207.0.0/16', 'nexthop': '10.0.1.3'}
|
||||||
with self.router() as r:
|
with self.router() as r:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user