From 3f6d79652ffd83121cdc0d1adb6a7960024d3f61 Mon Sep 17 00:00:00 2001 From: Boden R Date: Mon, 24 Sep 2018 15:35:58 -0600 Subject: [PATCH] use common rpc and exceptions from neutron-lib The neutron.common.rpc and exceptions were rehomed into neutron-lib and are currently shimmed in neutron [1] This patch consumes those modules from neutron-lib by using lib's modules rather than neutrons. [1] https://review.openstack.org/#/c/586525/ Change-Id: I28144714c4c58dfafe089a66aa73ecbb7eb21cf9 --- neutron_fwaas/services/firewall/fwaas_plugin.py | 2 +- .../services/firewall/service_drivers/agents/agents.py | 6 +++--- .../firewall/service_drivers/agents/firewall_agent_api.py | 2 +- .../services/firewall/service_drivers/agents/l2/fwaas_v2.py | 2 +- .../service_drivers/agents/l3reference/firewall_l3_agent.py | 2 +- .../agents/l3reference/firewall_l3_agent_v2.py | 2 +- .../firewall/service_drivers/agents/l2/test_fwaas_v2.py | 2 +- .../services/firewall/service_drivers/agents/test_agents.py | 4 ++-- 8 files changed, 11 insertions(+), 11 deletions(-) diff --git a/neutron_fwaas/services/firewall/fwaas_plugin.py b/neutron_fwaas/services/firewall/fwaas_plugin.py index 0f2cdba1b..a9b0ece2b 100644 --- a/neutron_fwaas/services/firewall/fwaas_plugin.py +++ b/neutron_fwaas/services/firewall/fwaas_plugin.py @@ -13,7 +13,6 @@ # License for the specific language governing permissions and limitations # under the License. -from neutron.common import rpc as n_rpc from neutron import service from neutron_lib.api.definitions import firewall as fw_ext from neutron_lib.api import extensions @@ -22,6 +21,7 @@ from neutron_lib import context as neutron_context from neutron_lib.exceptions import firewall_v1 as f_exc from neutron_lib.plugins import constants as plugin_constants from neutron_lib.plugins import directory +from neutron_lib import rpc as n_rpc from oslo_config import cfg from oslo_log import log as logging import oslo_messaging diff --git a/neutron_fwaas/services/firewall/service_drivers/agents/agents.py b/neutron_fwaas/services/firewall/service_drivers/agents/agents.py index bc4b0efde..8ae52b9c7 100644 --- a/neutron_fwaas/services/firewall/service_drivers/agents/agents.py +++ b/neutron_fwaas/services/firewall/service_drivers/agents/agents.py @@ -13,11 +13,11 @@ # License for the specific language governing permissions and limitations # under the License. -from neutron.common import rpc as neutron_rpc from neutron_lib.api.definitions import portbindings as pb_def from neutron_lib import constants as nl_constants from neutron_lib import context as neutron_context from neutron_lib.exceptions import firewall_v2 as f_exc +from neutron_lib import rpc as n_rpc from oslo_config import cfg from oslo_log import helpers as log_helpers from oslo_log import log as logging @@ -136,7 +136,7 @@ class FirewallAgentApi(object): def __init__(self, topic, host): self.host = host target = oslo_messaging.Target(topic=topic, version='1.0') - self.client = neutron_rpc.get_client(target) + self.client = n_rpc.get_client(target) def create_firewall_group(self, context, firewall_group): cctxt = self.client.prepare(fanout=True) @@ -168,7 +168,7 @@ class FirewallAgentDriver(driver_api.FirewallDriverDB, def start_rpc_listener(self): self.endpoints = [FirewallAgentCallbacks(self.firewall_db)] - self.rpc_connection = neutron_rpc.Connection() + self.rpc_connection = n_rpc.Connection() self.rpc_connection.create_consumer(constants.FIREWALL_PLUGIN, self.endpoints, fanout=False) return self.rpc_connection.consume_in_threads() diff --git a/neutron_fwaas/services/firewall/service_drivers/agents/firewall_agent_api.py b/neutron_fwaas/services/firewall/service_drivers/agents/firewall_agent_api.py index 6f78c7bf7..9fb36113c 100644 --- a/neutron_fwaas/services/firewall/service_drivers/agents/firewall_agent_api.py +++ b/neutron_fwaas/services/firewall/service_drivers/agents/firewall_agent_api.py @@ -13,7 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. -from neutron.common import rpc as n_rpc +from neutron_lib import rpc as n_rpc from oslo_config import cfg import oslo_messaging diff --git a/neutron_fwaas/services/firewall/service_drivers/agents/l2/fwaas_v2.py b/neutron_fwaas/services/firewall/service_drivers/agents/l2/fwaas_v2.py index ea95f8c2e..f9b0394d2 100644 --- a/neutron_fwaas/services/firewall/service_drivers/agents/l2/fwaas_v2.py +++ b/neutron_fwaas/services/firewall/service_drivers/agents/l2/fwaas_v2.py @@ -18,12 +18,12 @@ from oslo_log import log as logging import six from neutron.agent import securitygroups_rpc -from neutron.common import rpc as n_rpc from neutron import manager from neutron.plugins.ml2.drivers.openvswitch.agent import vlanmanager from neutron_lib.agent import l2_extension from neutron_lib import constants as nl_const from neutron_lib.exceptions import firewall_v2 as f_exc +from neutron_lib import rpc as n_rpc from neutron_lib.utils import net as nl_net from neutron_fwaas._i18n import _ diff --git a/neutron_fwaas/services/firewall/service_drivers/agents/l3reference/firewall_l3_agent.py b/neutron_fwaas/services/firewall/service_drivers/agents/l3reference/firewall_l3_agent.py index 909b697fd..bfa5db4d1 100644 --- a/neutron_fwaas/services/firewall/service_drivers/agents/l3reference/firewall_l3_agent.py +++ b/neutron_fwaas/services/firewall/service_drivers/agents/l3reference/firewall_l3_agent.py @@ -13,11 +13,11 @@ # License for the specific language governing permissions and limitations # under the License. -from neutron.common import rpc as n_rpc from neutron_lib.agent import l3_extension from neutron_lib import constants as nl_constants from neutron_lib import context from neutron_lib.exceptions import firewall_v1 as fw_ext +from neutron_lib import rpc as n_rpc from oslo_config import cfg from oslo_log import helpers as log_helpers from oslo_log import log as logging diff --git a/neutron_fwaas/services/firewall/service_drivers/agents/l3reference/firewall_l3_agent_v2.py b/neutron_fwaas/services/firewall/service_drivers/agents/l3reference/firewall_l3_agent_v2.py index 4024678e4..16cfaa682 100644 --- a/neutron_fwaas/services/firewall/service_drivers/agents/l3reference/firewall_l3_agent_v2.py +++ b/neutron_fwaas/services/firewall/service_drivers/agents/l3reference/firewall_l3_agent_v2.py @@ -14,11 +14,11 @@ # under the License. from neutron.agent.linux import ip_lib -from neutron.common import rpc as n_rpc from neutron_lib.agent import l3_extension from neutron_lib import constants as nl_constants from neutron_lib import context from neutron_lib.exceptions import firewall_v2 as fw_ext +from neutron_lib import rpc as n_rpc from oslo_config import cfg from oslo_log import helpers as log_helpers from oslo_log import log as logging diff --git a/neutron_fwaas/tests/unit/services/firewall/service_drivers/agents/l2/test_fwaas_v2.py b/neutron_fwaas/tests/unit/services/firewall/service_drivers/agents/l2/test_fwaas_v2.py index f3e850a18..9c68353ef 100644 --- a/neutron_fwaas/tests/unit/services/firewall/service_drivers/agents/l2/test_fwaas_v2.py +++ b/neutron_fwaas/tests/unit/services/firewall/service_drivers/agents/l2/test_fwaas_v2.py @@ -61,7 +61,7 @@ class TestFWaasV2AgentExtension(TestFWaasV2AgentExtensionBase): cfg.CONF.set_override('firewall_l2_driver', 'ovs', group='fwaas') def test_initialize(self): - with mock.patch('neutron.common.rpc.Connection') as conn: + with mock.patch('neutron_lib.rpc.Connection') as conn: self.l2.initialize(None, 'ovs') self.driver.assert_called_with('neutron.agent.l2.firewall_drivers', 'ovs') diff --git a/neutron_fwaas/tests/unit/services/firewall/service_drivers/agents/test_agents.py b/neutron_fwaas/tests/unit/services/firewall/service_drivers/agents/test_agents.py index 026fd8d21..b1c9a5ab4 100644 --- a/neutron_fwaas/tests/unit/services/firewall/service_drivers/agents/test_agents.py +++ b/neutron_fwaas/tests/unit/services/firewall/service_drivers/agents/test_agents.py @@ -96,8 +96,8 @@ class TestAgentDriver(test_fwaas_plugin_v2.FirewallPluginV2TestCase, DELETEFW_PATH, create=True, new=FakeAgentApi().delete_firewall_group, ).start() - mock.patch.object(agents.neutron_rpc, 'get_client').start() - mock.patch.object(agents.neutron_rpc, 'Connection').start() + mock.patch.object(agents.n_rpc, 'get_client').start() + mock.patch.object(agents.n_rpc, 'Connection').start() l3_plugin_str = ('neutron.tests.unit.extensions.test_l3.' 'TestL3NatServicePlugin')