Using a dedicated External network for PTR test suite
To avoid potential conflicts with other Tempest plugin like Neutron,
using a dedicated External network for Designate Tempest will be
a better practice.
Change-Id: I6a1c143bd3894d1461b1079b94dcc03b06380cc4
diff --git a/designate_tempest_plugin/tests/api/v2/test_ptrs.py b/designate_tempest_plugin/tests/api/v2/test_ptrs.py
index a72b61a..dcb31a9 100644
--- a/designate_tempest_plugin/tests/api/v2/test_ptrs.py
+++ b/designate_tempest_plugin/tests/api/v2/test_ptrs.py
@@ -13,6 +13,7 @@
# under the License.
from oslo_log import log as logging
from tempest import config
+from tempest.lib.common.utils import test_utils
from tempest.lib.common.utils import data_utils
from tempest.lib import decorators
from tempest.lib import exceptions as lib_exc
@@ -23,7 +24,7 @@
from designate_tempest_plugin.common import waiters
from designate_tempest_plugin import data_utils as dns_data_utils
-import tempest.test
+import tempest.api.network.base
CONF = config.CONF
LOG = logging.getLogger(__name__)
@@ -41,6 +42,8 @@
cls.admin_tld_client = cls.os_system_admin.dns_v2.TldClient()
else:
cls.admin_tld_client = cls.os_admin.dns_v2.TldClient()
+ cls.admin_network_client = cls.os_admin.networks_client
+ cls.admin_subnet_client = cls.os_admin.subnets_client
@classmethod
def resource_setup(cls):
@@ -51,6 +54,26 @@
cls.tld_name = tld_name[:-1]
cls.class_tld = cls.admin_tld_client.create_tld(tld_name=tld_name[:-1])
+ # Create dedicated External network for PTRs tests
+ network_name = data_utils.rand_name('designate-tempest-fips-external')
+ cls.external_network = cls.admin_network_client.create_network(
+ name=network_name, **{'router:external': True})['network']
+ cls.addClassResourceCleanup(
+ test_utils.call_and_ignore_notfound_exc,
+ cls.admin_network_client.delete_network,
+ cls.external_network['id'])
+
+ # Create subnet for External network
+ cls.external_subnet = cls.admin_subnet_client.create_subnet(
+ network_id=cls.external_network['id'],
+ allocation_pools=[
+ {'start': '198.51.100.10', 'end': '198.51.100.200'}],
+ cidr='198.51.100.0/24', ip_version=4, enable_dhcp=False)
+ cls.addClassResourceCleanup(
+ test_utils.call_and_ignore_notfound_exc,
+ cls.admin_subnet_client.delete_subnet,
+ cls.external_subnet['subnet']['id'])
+
@classmethod
def resource_cleanup(cls):
cls.admin_tld_client.delete_tld(cls.class_tld[1]['id'])
@@ -97,7 +120,7 @@
tld = self.tld_name
if not fip_id:
fip = self.primary_floating_ip_client.create_floatingip(
- floating_network_id=CONF.network.public_network_id)[
+ floating_network_id=self.external_network['id'])[
'floatingip']
fip_id = fip['id']
self.addCleanup(
@@ -221,7 +244,7 @@
tld = self.tld_name
if not fip_id:
fip = self.primary_floating_ip_client.create_floatingip(
- floating_network_id=CONF.network.public_network_id)[
+ floating_network_id=self.external_network['id'])[
'floatingip']
fip_id = fip['id']
self.addCleanup(