Execute router commands with admin client
The API calls that change the router external gateway info "enable_snat"
flag are, by default, allowed only for admin users. That fix is proposed
to the Neutron API definitions in [1].
[1]https://review.opendev.org/c/openstack/neutron-lib/+/941631
Related-Bug: #2098109
Change-Id: I6c19692fefb09c15423aa58756fb001615ce1ce4
diff --git a/neutron_tempest_plugin/api/base_routers.py b/neutron_tempest_plugin/api/base_routers.py
index 94db116..37a84b8 100644
--- a/neutron_tempest_plugin/api/base_routers.py
+++ b/neutron_tempest_plugin/api/base_routers.py
@@ -31,10 +31,14 @@
pass
def _create_router(self, name, admin_state_up=False,
- external_network_id=None, enable_snat=None, **kwargs):
+ external_network_id=None, enable_snat=None,
+ client=None, **kwargs):
# associate a cleanup with created routers to avoid quota limits
- router = self.create_router(name, admin_state_up,
- external_network_id, enable_snat, **kwargs)
+ client = client or self.client
+ router = self._create_router_with_client(
+ client, router_name=name, admin_state_up=admin_state_up,
+ external_network_id=external_network_id, enable_snat=enable_snat,
+ **kwargs)
self.addCleanup(self._cleanup_router, router)
return router