Remove _get_router & _create_router methods
As tempest.scenario.manager was announced stable interface in Tempest 27.0.0[1] it can be now reused in plugins.
Replaced methods:
* _get_router
* _create_router
Etherpad concerning this effort:
https://etherpad.opendev.org/p/tempest-scenario-manager-cleanup
[1] https://docs.openstack.org/releasenotes/tempest/v27.0.0.html#release-notes-27-0-0
Change-Id: I3dc123bea822a2c430a7fe4b714ca2bb9e5a5494
diff --git a/ironic_tempest_plugin/manager.py b/ironic_tempest_plugin/manager.py
index 4c2f45b..c9d2c7b 100644
--- a/ironic_tempest_plugin/manager.py
+++ b/ironic_tempest_plugin/manager.py
@@ -82,50 +82,6 @@
# The create_[resource] functions only return body and discard the
# resp part which is not used in scenario tests
- def _get_router(self, client=None, tenant_id=None):
- """Retrieve a router for the given tenant id.
-
- If a public router has been configured, it will be returned.
-
- If a public router has not been configured, but a public
- network has, a tenant router will be created and returned that
- routes traffic to the public network.
- """
- if not client:
- client = self.os_primary.routers_client
- if not tenant_id:
- tenant_id = client.tenant_id
- router_id = CONF.network.public_router_id
- network_id = CONF.network.public_network_id
- if router_id:
- body = client.show_router(router_id)
- return body['router']
- elif network_id:
- router = self._create_router(client, tenant_id)
- kwargs = {'external_gateway_info': dict(network_id=network_id)}
- router = client.update_router(router['id'], **kwargs)['router']
- return router
- else:
- raise Exception("Neither of 'public_router_id' or "
- "'public_network_id' has been defined.")
-
- def _create_router(self, client=None, tenant_id=None,
- namestart='router-smoke'):
- if not client:
- client = self.os_primary.routers_client
- if not tenant_id:
- tenant_id = client.tenant_id
- name = data_utils.rand_name(namestart)
- result = client.create_router(name=name,
- admin_state_up=True,
- tenant_id=tenant_id)
- router = result['router']
- self.assertEqual(router['name'], name)
- self.addCleanup(test_utils.call_and_ignore_notfound_exc,
- client.delete_router,
- router['id'])
- return router
-
class NetworkScenarioTest(manager.NetworkScenarioTest):
"""Base class for network scenario tests.
diff --git a/ironic_tempest_plugin/tests/scenario/test_baremetal_multitenancy.py b/ironic_tempest_plugin/tests/scenario/test_baremetal_multitenancy.py
index cc3ca73..0d30bc4 100644
--- a/ironic_tempest_plugin/tests/scenario/test_baremetal_multitenancy.py
+++ b/ironic_tempest_plugin/tests/scenario/test_baremetal_multitenancy.py
@@ -54,9 +54,9 @@
network = self._create_network(
networks_client=clients.networks_client,
tenant_id=clients.credentials.tenant_id)
- router = self._get_router(
+ router = self.get_router(
client=clients.routers_client,
- tenant_id=clients.credentials.tenant_id)
+ project_id=clients.credentials.tenant_id)
result = clients.subnets_client.create_subnet(
name=data_utils.rand_name('subnet'),
diff --git a/ironic_tempest_plugin/tests/scenario/test_baremetal_single_tenant.py b/ironic_tempest_plugin/tests/scenario/test_baremetal_single_tenant.py
index 60f986a..1735bef 100644
--- a/ironic_tempest_plugin/tests/scenario/test_baremetal_single_tenant.py
+++ b/ironic_tempest_plugin/tests/scenario/test_baremetal_single_tenant.py
@@ -54,9 +54,9 @@
network = self._create_network(
networks_client=clients.networks_client,
tenant_id=clients.credentials.tenant_id)
- router = self._get_router(
+ router = self.get_router(
client=clients.routers_client,
- tenant_id=clients.credentials.tenant_id)
+ project_id=clients.credentials.tenant_id)
extra_subnet_args = {}
if CONF.validation.ip_version_for_ssh == 6: