diff --git a/neutronclient/neutron/v2_0/purge.py b/neutronclient/neutron/v2_0/purge.py index 63f7d2ebe..332a20b32 100644 --- a/neutronclient/neutron/v2_0/purge.py +++ b/neutronclient/neutron/v2_0/purge.py @@ -49,7 +49,9 @@ class Purge(neutronV20.NeutronCommand): def _delete_resource(self, neutron_client, resource_type, resource): resource_id = resource['id'] if resource_type == 'port': - if resource.get('device_owner', '') == 'network:router_interface': + router_interface_owners = ['network:router_interface', + 'network:router_interface_distributed'] + if resource.get('device_owner', '') in router_interface_owners: body = {'port_id': resource_id} neutron_client.remove_interface_router(resource['device_id'], body) diff --git a/neutronclient/tests/functional/core/test_purge.py b/neutronclient/tests/functional/core/test_purge.py index 91d92a9ef..6aed6e40b 100644 --- a/neutronclient/tests/functional/core/test_purge.py +++ b/neutronclient/tests/functional/core/test_purge.py @@ -116,6 +116,8 @@ class PurgeNeutronClientCLITest(base.ClientTestBase): def _verify_deletion(self, resources, resource_type): purged = True no_purge_purged = True + router_interface_owners = ['network:router_interface', + 'network:router_interface_distributed'] for row in resources: if resource_type == 'port' and row.get('id', None): port = self.parser.listing(self.neutron('port-show', @@ -123,7 +125,7 @@ class PurgeNeutronClientCLITest(base.ClientTestBase): port_dict = {} for row in port: port_dict[row['Field']] = row['Value'] - if port_dict['device_owner'] == 'network:router_interface': + if port_dict['device_owner'] in router_interface_owners: if port_dict['tenant_id'] == 'purge-tenant': purged = False elif port_dict['tenant_id'] == 'no-purge-tenant':