Merge "Neutron: handle DVR router interfaces"

This commit is contained in:
Zuul 2018-09-09 19:06:22 +00:00 committed by Gerrit Code Review
commit add202ff6a
2 changed files with 12 additions and 5 deletions

View File

@ -45,7 +45,8 @@ class RouterInterfaces(base.ServiceResource):
def list(self):
return self.cloud.list_ports(
filters={'device_owner': 'network:router_interface',
filters={'device_owner': ['network:router_interface',
'network:router_interface_distributed'],
'tenant_id': self.cleanup_project_id}
)
@ -64,7 +65,8 @@ class Routers(base.ServiceResource):
def check_prerequisite(self):
return self.cloud.list_ports(
filters={'device_owner': 'network:router_interface',
filters={'device_owner': ['network:router_interface',
'network:router_interface_distributed'],
'tenant_id': self.cleanup_project_id}
) == []
@ -87,7 +89,9 @@ class Ports(base.ServiceResource):
ports = self.cloud.list_ports(
filters={'tenant_id': self.cleanup_project_id}
)
excluded = ['network:dhcp', 'network:router_interface']
excluded = ['network:dhcp',
'network:router_interface',
'network:router_interface_distributed']
return [p for p in ports if p['device_owner'] not in excluded]
def delete(self, resource):

View File

@ -79,7 +79,8 @@ class TestRouterInterfaces(unittest.TestCase):
self.assertIs(self.cloud.list_ports.return_value,
neutron.RouterInterfaces(self.creds_manager).list())
self.cloud.list_ports.assert_called_once_with(
filters={'device_owner': 'network:router_interface',
filters={'device_owner': ['network:router_interface',
'network:router_interface_distributed'],
'tenant_id': self.creds_manager.project_id}
)
@ -115,7 +116,8 @@ class TestRouters(unittest.TestCase):
False, neutron.Routers(self.creds_manager).check_prerequisite())
self.cloud.list_ports.assert_called_with(
filters={'device_owner': 'network:router_interface',
filters={'device_owner': ['network:router_interface',
'network:router_interface_distributed'],
'tenant_id': self.creds_manager.project_id}
)
@ -144,6 +146,7 @@ class TestPorts(unittest.TestCase):
self.cloud.list_ports.return_value = [
{'device_owner': 'network:dhcp'},
{'device_owner': 'network:router_interface'},
{'device_owner': 'network:router_interface_distributed'},
{'device_owner': ''}
]
ports = neutron.Ports(self.creds_manager).list()