]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Remove RpcProxy class
authorRussell Bryant <rbryant@redhat.com>
Tue, 2 Dec 2014 16:20:23 +0000 (16:20 +0000)
committerRussell Bryant <rbryant@redhat.com>
Thu, 4 Dec 2014 16:35:19 +0000 (16:35 +0000)
All users of this class have now been converted to use oslo.messaging
APIs directly, so this compatibility class can be removed.

Part of blueprint drop-rpc-compat.

Change-Id: Ife5c96d2d737694b9e79fe079d62dc48f23c033a

neutron/common/rpc.py
neutron/tests/base.py

index 995f6f6cd3a8d99d5f16f5d6e2ab53ca28a2bf35..37e9e3273440f365295deae7ab1df220b23b5ea7 100644 (file)
@@ -19,7 +19,6 @@ from oslo import messaging
 from oslo.messaging import serializer as om_serializer
 
 from neutron.common import exceptions
-from neutron.common import log
 from neutron import context
 from neutron.openstack.common import log as logging
 from neutron.openstack.common import service
@@ -135,58 +134,6 @@ class RequestContextSerializer(om_serializer.Serializer):
                                load_admin_roles=False, **rpc_ctxt_dict)
 
 
-class RpcProxy(object):
-    '''
-    This class is created to facilitate migration from oslo-incubator
-    RPC layer implementation to oslo.messaging and is intended to
-    emulate RpcProxy class behaviour using oslo.messaging API once the
-    migration is applied.
-    '''
-    RPC_API_NAMESPACE = None
-
-    def __init__(self, topic, default_version, version_cap=None):
-        super(RpcProxy, self).__init__()
-        self.topic = topic
-        target = messaging.Target(topic=topic, version=default_version)
-        self._client = get_client(target, version_cap=version_cap)
-
-    def make_msg(self, method, **kwargs):
-        return {'method': method,
-                'namespace': self.RPC_API_NAMESPACE,
-                'args': kwargs}
-
-    @log.log
-    def call(self, context, msg, **kwargs):
-        return self.__call_rpc_method(
-            context, msg, rpc_method='call', **kwargs)
-
-    @log.log
-    def cast(self, context, msg, **kwargs):
-        self.__call_rpc_method(context, msg, rpc_method='cast', **kwargs)
-
-    @log.log
-    def fanout_cast(self, context, msg, **kwargs):
-        kwargs['fanout'] = True
-        self.__call_rpc_method(context, msg, rpc_method='cast', **kwargs)
-
-    def __call_rpc_method(self, context, msg, **kwargs):
-        options = dict(
-            ((opt, kwargs[opt])
-             for opt in ('fanout', 'timeout', 'topic', 'version')
-             if kwargs.get(opt))
-        )
-        if msg['namespace']:
-            options['namespace'] = msg['namespace']
-
-        if options:
-            callee = self._client.prepare(**options)
-        else:
-            callee = self._client
-
-        func = getattr(callee, kwargs['rpc_method'])
-        return func(context, msg['method'], **msg['args'])
-
-
 class RpcCallback(object):
     '''
     This class is created to facilitate migration from oslo-incubator
index a55068c066eb1e3fda27adce2c609d29aa7a191b..07914f531e04412413fc3ef00b2d61772b624680 100644 (file)
@@ -28,7 +28,6 @@ import os.path
 import sys
 
 import fixtures
-import mock
 from oslo.config import cfg
 from oslo.messaging import conffixture as messaging_conffixture
 
@@ -109,11 +108,6 @@ class BaseTestCase(sub_base.SubBaseTestCase):
             'neutron.common.rpc.Connection.consume_in_threads',
             fake_consume_in_threads))
 
-        # immediately return RPC calls
-        self.useFixture(fixtures.MonkeyPatch(
-            'neutron.common.rpc.RpcProxy._RpcProxy__call_rpc_method',
-            mock.MagicMock()))
-
         self.useFixture(fixtures.MonkeyPatch(
             'oslo.messaging.Notifier', fake_notifier.FakeNotifier))