Merge "Pass filters in arrays in get_agent_gw_ports_exist_for_network"
This commit is contained in:
commit
6a7bf84ea1
|
@ -295,9 +295,9 @@ class L3_NAT_with_dvr_db_mixin(l3_db.L3_NAT_db_mixin,
|
|||
return
|
||||
|
||||
filters = {
|
||||
'network_id': network_id,
|
||||
'device_id': agent_id,
|
||||
'device_owner': DEVICE_OWNER_AGENT_GW
|
||||
'network_id': [network_id],
|
||||
'device_id': [agent_id],
|
||||
'device_owner': [DEVICE_OWNER_AGENT_GW]
|
||||
}
|
||||
ports = self._core_plugin.get_ports(context, filters)
|
||||
if ports:
|
||||
|
@ -346,7 +346,6 @@ class L3_NAT_with_dvr_db_mixin(l3_db.L3_NAT_db_mixin,
|
|||
context, l3_const.AGENT_TYPE_L3, host)
|
||||
if l3_agent_db:
|
||||
LOG.debug("Agent ID exists: %s", l3_agent_db['id'])
|
||||
# TODO(Swami): is this call still valid for external agent gw port?
|
||||
f_port = self.get_agent_gw_ports_exist_for_network(
|
||||
context, network_id, host, l3_agent_db['id'])
|
||||
if not f_port:
|
||||
|
|
|
@ -19,6 +19,7 @@ from neutron.common import constants as l3_const
|
|||
from neutron import context
|
||||
from neutron.db import api as db
|
||||
from neutron.db import l3_dvr_db
|
||||
from neutron import manager
|
||||
from neutron.tests import base
|
||||
|
||||
|
||||
|
@ -134,3 +135,15 @@ class L3DvrTestCase(base.BaseTestCase):
|
|||
def test__is_distributed_router_distributed(self):
|
||||
router = {'id': 'foo_router_id', 'distributed': True}
|
||||
self._test__is_distributed_router(router, True)
|
||||
|
||||
def test_get_agent_gw_ports_exist_for_network(self):
|
||||
with mock.patch.object(manager.NeutronManager, 'get_plugin') as gp:
|
||||
plugin = mock.Mock()
|
||||
gp.return_value = plugin
|
||||
plugin.get_ports.return_value = []
|
||||
self.mixin.get_agent_gw_ports_exist_for_network(
|
||||
self.ctx, 'network_id', 'host', 'agent_id')
|
||||
plugin.get_ports.assert_called_with(self.ctx, {
|
||||
'network_id': ['network_id'],
|
||||
'device_id': ['agent_id'],
|
||||
'device_owner': [l3_const.DEVICE_OWNER_AGENT_GW]})
|
||||
|
|
Loading…
Reference in New Issue