Create extra external network with address scope for ndp proxy
tests
For details, please refer to https://review.opendev.org/855850 Closes-Bug: #1987410 Change-Id: I9f3176a9688db8c4f4417139b712d1570c5ab7bb
This commit is contained in:
parent
97af634ac3
commit
14d9215c9a
@ -24,23 +24,35 @@ from neutron_tempest_plugin import config
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
class NDPProxyTestJSON(base.BaseNetworkTest):
|
||||
class NDPProxyTestJSON(base.BaseAdminNetworkTest):
|
||||
|
||||
credentials = ['primary', 'admin']
|
||||
required_extensions = ['router', 'l3-ndp-proxy']
|
||||
required_extensions = ['router', 'l3-ndp-proxy', 'address-scope']
|
||||
|
||||
@classmethod
|
||||
def resource_setup(cls):
|
||||
super(NDPProxyTestJSON, cls).resource_setup()
|
||||
cls.ext_net_id = CONF.network.public_network_id
|
||||
|
||||
address_scope = cls.create_address_scope(
|
||||
"test-as", **{'ip_version': constants.IP_VERSION_6})
|
||||
subnetpool = cls.create_subnetpool(
|
||||
"test-subnetpool",
|
||||
**{'address_scope_id': address_scope['id'],
|
||||
'default_prefixlen': 112,
|
||||
'prefixes': ['2001:abc::0/96']})
|
||||
# Create an external network and it's subnet
|
||||
ext_net = cls.create_network('test-ext-net', client=cls.admin_client,
|
||||
external=True)
|
||||
cls.create_subnet(
|
||||
ext_net, client=cls.admin_client,
|
||||
ip_version=constants.IP_VERSION_6,
|
||||
**{'subnetpool_id': subnetpool['id'], "cidr": "2001:abc::1:0/112"})
|
||||
# Create network, subnet, router and add interface
|
||||
cls.network = cls.create_network()
|
||||
cls.subnet = cls.create_subnet(
|
||||
cls.network, ip_version=constants.IP_VERSION_6,
|
||||
cidr='2002::abcd:0/112')
|
||||
**{'subnetpool_id': subnetpool['id'], "cidr": "2001:abc::2:0/112"})
|
||||
cls.router = cls.create_router(data_utils.rand_name('router'),
|
||||
external_network_id=cls.ext_net_id,
|
||||
external_network_id=ext_net['id'],
|
||||
enable_ndp_proxy=True)
|
||||
cls.create_router_interface(cls.router['id'], cls.subnet['id'])
|
||||
|
||||
|
@ -24,16 +24,28 @@ from neutron_tempest_plugin import config
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
class NDPProxyNegativeTestJSON(base.BaseNetworkTest):
|
||||
class NDPProxyNegativeTestJSON(base.BaseAdminNetworkTest):
|
||||
|
||||
credentials = ['primary', 'admin']
|
||||
required_extensions = ['router', 'l3-ndp-proxy']
|
||||
required_extensions = ['router', 'l3-ndp-proxy', 'address-scope']
|
||||
|
||||
@classmethod
|
||||
def resource_setup(cls):
|
||||
super(NDPProxyNegativeTestJSON, cls).resource_setup()
|
||||
cls.ext_net_id = CONF.network.public_network_id
|
||||
|
||||
address_scope = cls.create_address_scope(
|
||||
"test-as", **{'ip_version': constants.IP_VERSION_6})
|
||||
subnetpool = cls.create_subnetpool(
|
||||
"test-subnetpool",
|
||||
**{'address_scope_id': address_scope['id'],
|
||||
'default_prefixlen': 112,
|
||||
'prefixes': ['2001:abc::0/96']})
|
||||
# Create an external network and it's subnet
|
||||
ext_net = cls.create_network('test-ext-net', client=cls.admin_client,
|
||||
external=True)
|
||||
cls.create_subnet(
|
||||
ext_net, client=cls.admin_client,
|
||||
ip_version=constants.IP_VERSION_6,
|
||||
**{'subnetpool_id': subnetpool['id'], "cidr": "2001:abc::1:0/112"})
|
||||
# Create network, subnet, router and add interface
|
||||
cls.network = cls.create_network()
|
||||
cls.subnet = cls.create_subnet(
|
||||
@ -41,7 +53,7 @@ class NDPProxyNegativeTestJSON(base.BaseNetworkTest):
|
||||
cidr='2002::abcd:0/112')
|
||||
cls.router = cls.create_router(
|
||||
data_utils.rand_name('router'),
|
||||
external_network_id=cls.ext_net_id)
|
||||
external_network_id=ext_net['id'])
|
||||
|
||||
@decorators.attr(type='negative')
|
||||
@decorators.idempotent_id('a0897204-bb85-41cc-a5fd-5d0ab8116a07')
|
||||
@ -102,3 +114,22 @@ class NDPProxyNegativeTestJSON(base.BaseNetworkTest):
|
||||
self.router['id'],
|
||||
enable_ndp_proxy=True,
|
||||
external_gateway_info={})
|
||||
|
||||
@decorators.attr(type='negative')
|
||||
@decorators.idempotent_id('194b5ee7-4c59-4643-aabf-80a125c3f688')
|
||||
def test_enable_ndp_proxy_without_address_scope(self):
|
||||
extnet = self.create_network("extnet", client=self.admin_client,
|
||||
external=True)
|
||||
self.create_subnet(extnet, client=self.admin_client,
|
||||
ip_version=constants.IP_VERSION_6,
|
||||
cidr='2001:abc1::0/112')
|
||||
self.assertRaises(exceptions.Conflict,
|
||||
self.client.create_router,
|
||||
name=data_utils.rand_name('router'),
|
||||
enable_ndp_proxy=True,
|
||||
external_gateway_info={'network_id': extnet['id']})
|
||||
router = self.create_router(data_utils.rand_name('router'))
|
||||
self.assertRaises(exceptions.Conflict,
|
||||
self.client.update_router,
|
||||
router['id'], enable_ndp_proxy=True,
|
||||
external_gateway_info={'network_id': extnet['id']})
|
||||
|
Loading…
Reference in New Issue
Block a user