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
This commit is contained in:
Boden R 2018-09-24 15:35:58 -06:00
parent fb14c43da8
commit 3f6d79652f
8 changed files with 11 additions and 11 deletions

View File

@ -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

View File

@ -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()

View File

@ -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

View File

@ -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 _

View File

@ -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

View File

@ -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

View File

@ -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')

View File

@ -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')