call remove_router_extra_routes only when extra_routes is enabled
- check if 'routes' is present in the router dict before calling
cleanup for extra_routes extension
Closes-Bug: #1805235
Change-Id: I055b4053c795554deeaf167922de58ff49c96725
diff --git a/neutron_tempest_plugin/api/base.py b/neutron_tempest_plugin/api/base.py
index 1b8239b..894cea2 100644
--- a/neutron_tempest_plugin/api/base.py
+++ b/neutron_tempest_plugin/api/base.py
@@ -676,7 +676,8 @@
@classmethod
def delete_router(cls, router, client=None):
client = client or cls.client
- client.remove_router_extra_routes(router['id'])
+ if 'routes' in router:
+ client.remove_router_extra_routes(router['id'])
body = client.list_router_interfaces(router['id'])
interfaces = [port for port in body['ports']
if port['device_owner'] in const.ROUTER_INTERFACE_OWNERS]