Fix broken port query in Extraroute test case

One of the queries in an extra route test case tries
to filter based on the port owner, but the _list_ports
method it calls doesn't take a device_owner parameter.
This can cause failures if a DHCP port is created on
the same subnet.

Change-Id: I0e62027ae4d98944ef91a5d457d43d4224441b2f
This commit is contained in:
Kevin Benton 2014-09-20 00:17:58 -07:00
parent e883880e15
commit 78a2ecb992
2 changed files with 6 additions and 4 deletions

View File

@ -368,10 +368,12 @@ class NeutronDbPluginV2TestCase(testlib_api.WebTestCase,
def _list_ports(self, fmt, expected_res_status=None,
net_id=None, **kwargs):
query_params = None
query_params = []
if net_id:
query_params = "network_id=%s" % net_id
port_req = self.new_list_request('ports', fmt, query_params)
query_params.append("network_id=%s" % net_id)
if kwargs.get('device_owner'):
query_params.append("device_owner=%s" % kwargs.get('device_owner'))
port_req = self.new_list_request('ports', fmt, '&'.join(query_params))
if ('set_context' in kwargs and
kwargs['set_context'] is True and
'tenant_id' in kwargs):

View File

@ -403,7 +403,7 @@ class ExtraRouteDBTestCaseBase(object):
200,
s['subnet']['network_id'],
tenant_id=r['router']['tenant_id'],
device_own=constants.DEVICE_OWNER_ROUTER_GW)
device_owner=constants.DEVICE_OWNER_ROUTER_GW)
port_list = self.deserialize('json', port_res)
self.assertEqual(len(port_list['ports']), 1)