From: Gary Kotton Date: Sun, 13 Dec 2015 12:52:27 +0000 (-0800) Subject: Use the constant HOST_ID instead of 'binding:host_id' X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=19de679e8aec09b75d56271f14b9e1ef19111d6b;p=openstack-build%2Fneutron-build.git Use the constant HOST_ID instead of 'binding:host_id' This patch makes use of the constant defined in the extension. In addition to this having value of debing defined in one place it also enables the caller to understand that the portbindings extension is required. Note: the constant is not used in the API tests. This has import issues so it is not relevant. TrivialFix Change-Id: I7bfe2528dbbd8017ddbdcf949dbb6264ce1eb5d8 --- diff --git a/neutron/agent/l3/ha_router.py b/neutron/agent/l3/ha_router.py index 196d70c9b..d1d1a1f39 100644 --- a/neutron/agent/l3/ha_router.py +++ b/neutron/agent/l3/ha_router.py @@ -25,6 +25,7 @@ from neutron.agent.linux import ip_lib from neutron.agent.linux import keepalived from neutron.common import constants as n_consts from neutron.common import utils as common_utils +from neutron.extensions import portbindings LOG = logging.getLogger(__name__) HA_DEV_PREFIX = 'ha-' @@ -345,7 +346,7 @@ class HaRouter(router.RouterInfo): def _get_filtered_dict(d, ignore): return {k: v for k, v in d.items() if k not in ignore} - keys_to_ignore = set(['binding:host_id']) + keys_to_ignore = set([portbindings.HOST_ID]) port1_filtered = _get_filtered_dict(port1, keys_to_ignore) port2_filtered = _get_filtered_dict(port2, keys_to_ignore) return port1_filtered == port2_filtered diff --git a/neutron/db/l3_agentschedulers_db.py b/neutron/db/l3_agentschedulers_db.py index ff0010c8b..5ee651f79 100644 --- a/neutron/db/l3_agentschedulers_db.py +++ b/neutron/db/l3_agentschedulers_db.py @@ -34,6 +34,7 @@ from neutron.db import agentschedulers_db from neutron.db import l3_attrs_db from neutron.db import model_base from neutron.extensions import l3agentscheduler +from neutron.extensions import portbindings from neutron.extensions import router_availability_zone as router_az from neutron import manager from neutron.plugins.common import constants as service_constants @@ -482,7 +483,7 @@ class L3AgentSchedulerDbMixin(l3agentscheduler.L3AgentSchedulerPluginBase, ports = core_plugin.get_ports(context, filters=filter) for port in ports: if (n_utils.is_dvr_serviced(port['device_owner']) and - l3_agent['host'] == port['binding:host_id']): + l3_agent['host'] == port[portbindings.HOST_ID]): return True return False diff --git a/neutron/db/l3_dvr_db.py b/neutron/db/l3_dvr_db.py index a97b07ef0..99ae7aef7 100644 --- a/neutron/db/l3_dvr_db.py +++ b/neutron/db/l3_dvr_db.py @@ -606,7 +606,7 @@ class L3_NAT_with_dvr_db_mixin(l3_db.L3_NAT_db_mixin, 'network_id': network_id, 'device_id': l3_agent_db['id'], 'device_owner': l3_const.DEVICE_OWNER_AGENT_GW, - 'binding:host_id': host, + portbindings.HOST_ID: host, 'admin_state_up': True, 'name': ''} agent_port = p_utils.create_port(self._core_plugin, context, diff --git a/neutron/db/l3_dvrscheduler_db.py b/neutron/db/l3_dvrscheduler_db.py index c0941c78f..a70b0e495 100644 --- a/neutron/db/l3_dvrscheduler_db.py +++ b/neutron/db/l3_dvrscheduler_db.py @@ -32,6 +32,7 @@ from neutron.db import l3_agentschedulers_db as l3agent_sch_db from neutron.db import model_base from neutron.db import models_v2 from neutron.extensions import l3agentscheduler +from neutron.extensions import portbindings from neutron import manager from neutron.plugins.common import constants as service_constants from neutron.plugins.ml2 import db as ml2_db @@ -100,7 +101,7 @@ class L3_DVRsch_db_mixin(l3agent_sch_db.L3AgentSchedulerDbMixin): def dvr_update_router_addvm(self, context, port): port_dict = self._core_plugin.get_port(context, port['id']) - port_host = port_dict['binding:host_id'] + port_host = port_dict[portbindings.HOST_ID] l3_agent_on_host = (self.get_l3_agents( context, filters={'host': [port_host]}) or [None])[0] if not l3_agent_on_host: @@ -157,7 +158,7 @@ class L3_DVRsch_db_mixin(l3agent_sch_db.L3AgentSchedulerDbMixin): ports = self._core_plugin.get_ports(context, filters=filter_sub) for port in ports: if (n_utils.is_dvr_serviced(port['device_owner']) - and port['binding:host_id'] == host + and port[portbindings.HOST_ID] == host and port['id'] != port_id): LOG.debug('DVR: %(port_status)s port exists for subnet ' '%(subnet_id)s on host %(host)s', @@ -496,8 +497,9 @@ def _notify_l3_agent_port_update(resource, event, trigger, **kwargs): n_utils.is_dvr_serviced(original_device_owner) and not n_utils.is_dvr_serviced(new_device_owner)) is_port_moved = ( - original_port['binding:host_id'] and - original_port['binding:host_id'] != new_port['binding:host_id']) + original_port[portbindings.HOST_ID] and + original_port[portbindings.HOST_ID] != + new_port[portbindings.HOST_ID]) if is_port_no_longer_serviced or is_port_moved: l3plugin = manager.NeutronManager.get_service_plugins().get( service_constants.L3_ROUTER_NAT) @@ -505,7 +507,7 @@ def _notify_l3_agent_port_update(resource, event, trigger, **kwargs): removed_routers = l3plugin.dvr_deletens_if_no_port( context, original_port['id'], - port_host=original_port['binding:host_id']) + port_host=original_port[portbindings.HOST_ID]) if removed_routers: removed_router_args = { 'context': context, diff --git a/neutron/debug/debug_agent.py b/neutron/debug/debug_agent.py index a83a8b060..d1f069c9b 100644 --- a/neutron/debug/debug_agent.py +++ b/neutron/debug/debug_agent.py @@ -23,7 +23,7 @@ from neutron._i18n import _LW from neutron.agent.linux import dhcp from neutron.agent.linux import ip_lib from neutron.common import constants - +from neutron.extensions import portbindings LOG = logging.getLogger(__name__) @@ -173,7 +173,7 @@ class NeutronDebugAgent(object): 'device_id': '%s' % socket.gethostname(), 'device_owner': '%s:probe' % device_owner, 'tenant_id': network.tenant_id, - 'binding:host_id': host, + portbindings.HOST_ID: host, 'fixed_ips': [dict(subnet_id=s.id) for s in network.subnets]}} port_dict = self.client.create_port(body)['port'] diff --git a/neutron/tests/fullstack/resources/client.py b/neutron/tests/fullstack/resources/client.py index b781c8e14..449c3539d 100644 --- a/neutron/tests/fullstack/resources/client.py +++ b/neutron/tests/fullstack/resources/client.py @@ -17,6 +17,7 @@ import functools import fixtures from neutronclient.common import exceptions +from neutron.extensions import portbindings from neutron.tests import base @@ -81,7 +82,7 @@ class ClientFixture(fixtures.Fixture): spec = { 'network_id': network_id, 'tenant_id': tenant_id, - 'binding:host_id': hostname, + portbindings.HOST_ID: hostname, } if qos_policy_id: spec['qos_policy_id'] = qos_policy_id diff --git a/neutron/tests/functional/agent/l3/test_dvr_router.py b/neutron/tests/functional/agent/l3/test_dvr_router.py index 3ade35cc1..831d670a6 100644 --- a/neutron/tests/functional/agent/l3/test_dvr_router.py +++ b/neutron/tests/functional/agent/l3/test_dvr_router.py @@ -25,6 +25,7 @@ from neutron.agent.l3 import namespaces from neutron.agent.linux import ip_lib from neutron.agent.linux import utils from neutron.common import constants as l3_constants +from neutron.extensions import portbindings from neutron.tests.common import l3_test_common from neutron.tests.common import net_helpers from neutron.tests.functional.agent.l3 import framework @@ -192,7 +193,7 @@ class TestDvrRouter(framework.L3AgentTestFramework): internal_ports = router.get(l3_constants.INTERFACE_KEY, []) router['distributed'] = True router['gw_port_host'] = agent.conf.host - router['gw_port']['binding:host_id'] = agent.conf.host + router['gw_port'][portbindings.HOST_ID] = agent.conf.host floating_ip = router['_floatingips'][0] floating_ip['floating_network_id'] = router['gw_port']['network_id'] floating_ip['host'] = agent.conf.host @@ -229,7 +230,7 @@ class TestDvrRouter(framework.L3AgentTestFramework): 'network_id': external_gw_port['network_id'], 'device_owner': l3_constants.DEVICE_OWNER_AGENT_GW, 'mac_address': 'fa:16:3e:80:8d:89', - 'binding:host_id': self.agent.conf.host, + portbindings.HOST_ID: self.agent.conf.host, 'fixed_ips': [{'subnet_id': fixed_ip['subnet_id'], 'ip_address': fip_gw_port_ip, 'prefixlen': prefixlen}], diff --git a/neutron/tests/functional/services/l3_router/test_l3_dvr_router_plugin.py b/neutron/tests/functional/services/l3_router/test_l3_dvr_router_plugin.py index a6981f251..0e6e38685 100644 --- a/neutron/tests/functional/services/l3_router/test_l3_dvr_router_plugin.py +++ b/neutron/tests/functional/services/l3_router/test_l3_dvr_router_plugin.py @@ -17,6 +17,7 @@ import mock from neutron.api.v2 import attributes from neutron.common import constants from neutron.extensions import external_net +from neutron.extensions import portbindings from neutron.tests.common import helpers from neutron.tests.unit.plugins.ml2 import base as ml2_test_base @@ -129,7 +130,7 @@ class L3DvrTestCase(ml2_test_base.ML2TestFramework): 'fixed_ips': attributes.ATTR_NOT_SPECIFIED, 'device_id': self.l3_agent['id'], 'device_owner': constants.DEVICE_OWNER_AGENT_GW, - 'binding:host_id': '', + portbindings.HOST_ID: '', 'admin_state_up': True, 'name': ''}}) return network_id, port @@ -256,7 +257,7 @@ class L3DvrTestCase(ml2_test_base.ML2TestFramework): if dvr: l3_notif.routers_updated_on_host.assert_called_once_with( self.context, [router['id']], - int_port['port']['binding:host_id']) + int_port['port'][portbindings.HOST_ID]) self.assertFalse(l3_notif.routers_updated.called) else: l3_notif.routers_updated.assert_called_once_with( @@ -281,10 +282,10 @@ class L3DvrTestCase(ml2_test_base.ML2TestFramework): # locate internal ports on different hosts self.core_plugin.update_port( self.context, int_port1['port']['id'], - {'port': {'binding:host_id': 'host1'}}) + {'port': {portbindings.HOST_ID: 'host1'}}) self.core_plugin.update_port( self.context, int_port2['port']['id'], - {'port': {'binding:host_id': 'host2'}}) + {'port': {portbindings.HOST_ID: 'host2'}}) # and create l3 agents on corresponding hosts helpers.register_l3_agent(host='host1', agent_mode=constants.L3_AGENT_MODE_DVR) @@ -381,7 +382,7 @@ class L3DvrTestCase(ml2_test_base.ML2TestFramework): if dvr: l3_notif.routers_updated_on_host.assert_called_once_with( self.context, [router['id']], - int_port['port']['binding:host_id']) + int_port['port'][portbindings.HOST_ID]) self.assertFalse(l3_notif.routers_updated.called) else: l3_notif.routers_updated.assert_called_once_with( @@ -483,7 +484,7 @@ class L3DvrTestCase(ml2_test_base.ML2TestFramework): constants.AGENT_TYPE_L3] = l3_notifier self.core_plugin.update_port( self.context, port['port']['id'], - {'port': {'binding:host_id': HOST1}}) + {'port': {portbindings.HOST_ID: HOST1}}) # now router should be scheduled to dvr_snat agent and # dvr agent on host1 @@ -503,7 +504,7 @@ class L3DvrTestCase(ml2_test_base.ML2TestFramework): l3_notifier.reset_mock() self.core_plugin.update_port( self.context, port['port']['id'], - {'port': {'binding:host_id': HOST2}}) + {'port': {portbindings.HOST_ID: HOST2}}) # now router should be scheduled to dvr_snat agent and # dvr agent on host2 agents = self.l3_plugin.list_l3_agents_hosting_router( diff --git a/neutron/tests/unit/agent/l3/test_agent.py b/neutron/tests/unit/agent/l3/test_agent.py index 22576d709..f187f1e41 100644 --- a/neutron/tests/unit/agent/l3/test_agent.py +++ b/neutron/tests/unit/agent/l3/test_agent.py @@ -46,6 +46,7 @@ from neutron.agent import rpc as agent_rpc from neutron.common import config as base_config from neutron.common import constants as l3_constants from neutron.common import exceptions as n_exc +from neutron.extensions import portbindings from neutron.plugins.common import constants as p_const from neutron.tests import base from neutron.tests.common import l3_test_common @@ -352,7 +353,7 @@ class TestBasicRouterOperations(BasicRouterOperationsFramework): 'subnets': [{'gateway_ip': '20.0.0.1'}], 'extra_subnets': [{'cidr': '172.16.0.0/24'}], 'id': _uuid(), - 'binding:host_id': HOSTNAME, + portbindings.HOST_ID: HOSTNAME, 'network_id': _uuid(), 'mac_address': 'ca:fe:de:ad:be:ef'} ri.snat_ports = sn_port diff --git a/neutron/tests/unit/agent/l3/test_dvr_local_router.py b/neutron/tests/unit/agent/l3/test_dvr_local_router.py index 36a8b1a10..b200cf57e 100644 --- a/neutron/tests/unit/agent/l3/test_dvr_local_router.py +++ b/neutron/tests/unit/agent/l3/test_dvr_local_router.py @@ -31,6 +31,7 @@ from neutron.agent.linux import ip_lib from neutron.common import config as base_config from neutron.common import constants as l3_constants from neutron.common import utils as common_utils +from neutron.extensions import portbindings from neutron.tests import base from neutron.tests.common import l3_test_common @@ -487,7 +488,7 @@ class TestDvrRouterOperations(base.BaseTestCase): 'cidr': '20.0.0.0/24', 'gateway_ip': '20.0.0.1'}], 'id': _uuid(), - 'binding:host_id': 'myhost', + portbindings.HOST_ID: 'myhost', 'device_owner': l3_constants.DEVICE_OWNER_AGENT_GW, 'network_id': fake_network_id, 'mac_address': 'ca:fe:de:ad:be:ef'}] diff --git a/neutron/tests/unit/api/rpc/handlers/test_dhcp_rpc.py b/neutron/tests/unit/api/rpc/handlers/test_dhcp_rpc.py index 9e772bf06..1786b732c 100644 --- a/neutron/tests/unit/api/rpc/handlers/test_dhcp_rpc.py +++ b/neutron/tests/unit/api/rpc/handlers/test_dhcp_rpc.py @@ -20,6 +20,7 @@ from neutron.api.rpc.handlers import dhcp_rpc from neutron.common import constants from neutron.common import exceptions as n_exc from neutron.common import utils +from neutron.extensions import portbindings from neutron.tests import base @@ -169,7 +170,7 @@ class TestDhcpRpcCallback(base.BaseTestCase): } expected_port = {'port': {'network_id': 'foo_network_id', 'device_owner': constants.DEVICE_OWNER_DHCP, - 'binding:host_id': 'foo_host', + portbindings.HOST_ID: 'foo_host', 'fixed_ips': [{'subnet_id': 'foo_subnet_id'}] }, 'id': 'foo_port_id' @@ -193,7 +194,7 @@ class TestDhcpRpcCallback(base.BaseTestCase): } expected_port = {'port': {'network_id': 'foo_network_id', 'device_owner': constants.DEVICE_OWNER_DHCP, - 'binding:host_id': 'foo_host', + portbindings.HOST_ID: 'foo_host', 'fixed_ips': [{'subnet_id': 'foo_subnet_id'}] }, 'id': 'foo_port_id' @@ -225,7 +226,7 @@ class TestDhcpRpcCallback(base.BaseTestCase): } expected_port = {'port': {'network_id': 'foo_network_id', 'device_owner': constants.DEVICE_OWNER_DHCP, - 'binding:host_id': 'foo_host', + portbindings.HOST_ID: 'foo_host', 'fixed_ips': [{'subnet_id': 'foo_subnet_id'}] }, 'id': 'foo_port_id' diff --git a/neutron/tests/unit/db/test_l3_dvr_db.py b/neutron/tests/unit/db/test_l3_dvr_db.py index a0dd2c4c9..e752ca90f 100644 --- a/neutron/tests/unit/db/test_l3_dvr_db.py +++ b/neutron/tests/unit/db/test_l3_dvr_db.py @@ -23,6 +23,7 @@ from neutron.db import agents_db from neutron.db import common_db_mixin from neutron.db import l3_agentschedulers_db from neutron.db import l3_dvr_db +from neutron.extensions import portbindings from neutron import manager from neutron.plugins.common import constants as plugin_const from neutron.tests.unit.db import test_db_base_plugin_v2 @@ -267,13 +268,13 @@ class L3DvrTestCase(test_db_base_plugin_v2.NeutronDbPluginV2TestCase): def _helper_delete_floatingip_agent_gateway_port(self, port_host): ports = [{ 'id': 'my_port_id', - 'binding:host_id': 'foo_host', + portbindings.HOST_ID: 'foo_host', 'network_id': 'ext_network_id', 'device_owner': l3_const.DEVICE_OWNER_ROUTER_GW }, { 'id': 'my_new_port_id', - 'binding:host_id': 'my_foo_host', + portbindings.HOST_ID: 'my_foo_host', 'network_id': 'ext_network_id', 'device_owner': l3_const.DEVICE_OWNER_ROUTER_GW }] @@ -429,7 +430,7 @@ class L3DvrTestCase(test_db_base_plugin_v2.NeutronDbPluginV2TestCase): self, fip, floatingip_db, router_db): port = { 'id': '1234', - 'binding:host_id': 'myhost', + portbindings.HOST_ID: 'myhost', 'network_id': 'external_net' } diff --git a/neutron/tests/unit/debug/test_commands.py b/neutron/tests/unit/debug/test_commands.py index 331257410..60c6edea9 100644 --- a/neutron/tests/unit/debug/test_commands.py +++ b/neutron/tests/unit/debug/test_commands.py @@ -23,6 +23,7 @@ from neutron.agent.linux import interface from neutron.common import config as common_config from neutron.debug import commands from neutron.debug import debug_agent +from neutron.extensions import portbindings from neutron.tests import base @@ -114,7 +115,7 @@ class TestDebugCommands(base.BaseTestCase): 'admin_state_up': True, 'network_id': 'fake_net', 'tenant_id': 'fake_tenant', - 'binding:host_id': cfg.CONF.host, + portbindings.HOST_ID: cfg.CONF.host, 'fixed_ips': [{'subnet_id': 'fake_subnet'}], 'device_id': socket.gethostname()}} namespace = 'qprobe-fake_port' @@ -159,7 +160,7 @@ class TestDebugCommands(base.BaseTestCase): 'admin_state_up': True, 'network_id': 'fake_net', 'tenant_id': 'fake_tenant', - 'binding:host_id': cfg.CONF.host, + portbindings.HOST_ID: cfg.CONF.host, 'fixed_ips': [{'subnet_id': 'fake_subnet'}], 'device_id': socket.gethostname()}} namespace = 'qprobe-fake_port' @@ -288,7 +289,7 @@ class TestDebugCommands(base.BaseTestCase): 'admin_state_up': True, 'network_id': 'fake_net', 'tenant_id': 'fake_tenant', - 'binding:host_id': cfg.CONF.host, + portbindings.HOST_ID: cfg.CONF.host, 'fixed_ips': [{'subnet_id': 'fake_subnet'}], 'device_id': socket.gethostname()}} expected = [mock.call.show_network('fake_net'), diff --git a/neutron/tests/unit/extensions/test_l3.py b/neutron/tests/unit/extensions/test_l3.py index ac0e0ef4e..efb5d53d0 100644 --- a/neutron/tests/unit/extensions/test_l3.py +++ b/neutron/tests/unit/extensions/test_l3.py @@ -2882,7 +2882,7 @@ class L3RpcCallbackTestCase(base.BaseTestCase): self.l3_rpc_cb._ensure_host_set_on_port( mock.ANY, mock.ANY, port, router_id) self.l3_rpc_cb.plugin.update_port.assert_called_once_with( - mock.ANY, port_id, {'port': {'binding:host_id': mock.ANY}}) + mock.ANY, port_id, {'port': {portbindings.HOST_ID: mock.ANY}}) self.assertTrue(mock_log.call_count) expected_message = ('Port foo_port_id not found while updating ' 'agent binding for router foo_router_id.') diff --git a/neutron/tests/unit/plugins/ml2/drivers/l2pop/test_mech_driver.py b/neutron/tests/unit/plugins/ml2/drivers/l2pop/test_mech_driver.py index 7402cc49f..c45f9a337 100644 --- a/neutron/tests/unit/plugins/ml2/drivers/l2pop/test_mech_driver.py +++ b/neutron/tests/unit/plugins/ml2/drivers/l2pop/test_mech_driver.py @@ -731,11 +731,11 @@ class TestL2PopulationRpcTestCase(test_plugin.Ml2PluginV2TestCase): self.assertEqual(port_id, details['port_id']) def _update_and_check_portbinding(self, port_id, host_id): - data = {'port': {'binding:host_id': host_id}} + data = {'port': {portbindings.HOST_ID: host_id}} req = self.new_update_request('ports', data, port_id) res = self.deserialize(self.fmt, req.get_response(self.api)) - self.assertEqual(host_id, res['port']['binding:host_id']) + self.assertEqual(host_id, res['port'][portbindings.HOST_ID]) def _test_host_changed(self, twice): self._register_ml2_agents() diff --git a/neutron/tests/unit/plugins/ml2/test_plugin.py b/neutron/tests/unit/plugins/ml2/test_plugin.py index c0011fb30..b8b6af3f7 100644 --- a/neutron/tests/unit/plugins/ml2/test_plugin.py +++ b/neutron/tests/unit/plugins/ml2/test_plugin.py @@ -995,7 +995,7 @@ class TestMl2PortBinding(Ml2PluginV2TestCase, plugin = manager.NeutronManager.get_plugin() port = { 'id': 'foo_port_id', - 'binding:host_id': 'foo_host', + portbindings.HOST_ID: 'foo_host', } with mock.patch.object(ml2_db, 'ensure_dvr_port_binding') as mock_dvr: plugin.update_dvr_port_binding( diff --git a/neutron/tests/unit/scheduler/test_l3_agent_scheduler.py b/neutron/tests/unit/scheduler/test_l3_agent_scheduler.py index 3cc9588d8..32730f457 100644 --- a/neutron/tests/unit/scheduler/test_l3_agent_scheduler.py +++ b/neutron/tests/unit/scheduler/test_l3_agent_scheduler.py @@ -39,6 +39,7 @@ from neutron.db import l3_hamode_db from neutron.db import l3_hascheduler_db from neutron.extensions import l3_ext_ha_mode as l3_ha from neutron.extensions import l3agentscheduler as l3agent +from neutron.extensions import portbindings from neutron import manager from neutron.scheduler import l3_agent_scheduler from neutron.tests import base @@ -758,7 +759,7 @@ class L3SchedulerTestBaseMixin(object): l3_agent = self._prepare_check_ports_exist_tests() # matching subnet port = {'subnet_id': str(uuid.uuid4()), - 'binding:host_id': 'host_1', + portbindings.HOST_ID: 'host_1', 'device_owner': constants.DEVICE_OWNER_COMPUTE_PREFIX, 'id': 1234} subnet = {'id': str(uuid.uuid4()), @@ -949,7 +950,7 @@ class L3DvrSchedulerTestCase(testlib_api.SqlTestCase): 'port': None, 'original_port': { 'id': port_id, - 'binding:host_id': 'vm-host', + portbindings.HOST_ID: 'vm-host', 'device_id': 'vm-id', 'device_owner': DEVICE_OWNER_COMPUTE, 'mac_address': '02:04:05:17:18:19' @@ -981,14 +982,14 @@ class L3DvrSchedulerTestCase(testlib_api.SqlTestCase): 'context': self.adminContext, 'port': { 'id': port_id, - 'binding:host_id': None, + portbindings.HOST_ID: None, 'device_id': '', 'device_owner': '' }, 'mac_address_updated': False, 'original_port': { 'id': port_id, - 'binding:host_id': 'vm-host', + portbindings.HOST_ID: 'vm-host', 'device_id': 'vm-id', 'device_owner': DEVICE_OWNER_COMPUTE } @@ -1046,7 +1047,7 @@ class L3DvrSchedulerTestCase(testlib_api.SqlTestCase): 'id': 'port1', 'device_id': 'abcd', 'device_owner': DEVICE_OWNER_COMPUTE_NOVA, - 'binding:host_id': 'host1', + portbindings.HOST_ID: 'host1', 'fixed_ips': [ { 'subnet_id': '80947d4a-fbc8-484b-9f92-623a6bfcf3e0', @@ -1094,7 +1095,8 @@ class L3DvrSchedulerTestCase(testlib_api.SqlTestCase): self.dut.dvr_update_router_addvm(self.adminContext, port) get_l3_agents.assert_called_once_with( - self.adminContext, filters={'host': [port['binding:host_id']]}) + self.adminContext, + filters={'host': [port[portbindings.HOST_ID]]}) (self.dut.l3_rpc_notifier.routers_updated_on_host. assert_called_once_with( self.adminContext, {'r1', 'r2'}, 'host1')) @@ -1173,7 +1175,7 @@ class L3DvrSchedulerTestCase(testlib_api.SqlTestCase): 'id': 'fake_id', 'device_id': 'r1', 'status': port_status, - 'binding:host_id': 'thisHost', + portbindings.HOST_ID: 'thisHost', 'device_owner': DEVICE_OWNER_COMPUTE_NOVA, 'fixed_ips': [ { @@ -1228,7 +1230,7 @@ class L3DvrSchedulerTestCase(testlib_api.SqlTestCase): 'id': 'lbaas-vip-port1', 'device_id': 'vip-pool-id', 'status': 'ACTIVE', - 'binding:host_id': 'thisHost', + portbindings.HOST_ID: 'thisHost', 'device_owner': device_owner, 'fixed_ips': [ { @@ -1256,7 +1258,7 @@ class L3DvrSchedulerTestCase(testlib_api.SqlTestCase): 'device_id': port_name, 'device_owner': device_owner, 'status': status, - 'binding:host_id': host, + portbindings.HOST_ID: host, 'fixed_ips': [ { 'subnet_id': subnet_id, @@ -1443,7 +1445,7 @@ class L3DvrSchedulerTestCase(testlib_api.SqlTestCase): 'id': 'dhcp-port1', 'device_id': 'dhcp-net-id', 'status': 'ACTIVE', - 'binding:host_id': 'thisHost', + portbindings.HOST_ID: 'thisHost', 'device_owner': constants.DEVICE_OWNER_DHCP, 'fixed_ips': [ {