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
This commit is contained in:
Aditya Vaja 2018-11-26 14:20:10 -08:00 committed by Aditya Prakash Vaja
parent 0e04f8f2b7
commit 49819a7b03
1 changed files with 2 additions and 1 deletions

View File

@ -676,7 +676,8 @@ class BaseNetworkTest(test.BaseTestCase):
@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]