]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Drop RpcProxy usage from cisco.cfg_agent
authorRussell Bryant <rbryant@redhat.com>
Fri, 21 Nov 2014 14:51:55 +0000 (14:51 +0000)
committerRussell Bryant <rbryant@redhat.com>
Mon, 24 Nov 2014 21:01:42 +0000 (21:01 +0000)
Drop usage of the RpcProxy compatibility class from cisco.cfg_agent.
The equivalent direct usage of oslo.messaging APIs is now used
instead.

Part of blueprint drop-rpc-compat.

Change-Id: I3ec71b3689adf7e96cdc2fdbf501c5cc37a9e0e4

neutron/plugins/cisco/cfg_agent/cfg_agent.py
neutron/plugins/cisco/cfg_agent/service_helpers/routing_svc_helper.py

index 7512dee8aea7ddc86946c5f1bb1a1213f542f33f..051726fcf7d6b214896b324d0feceaef2e58355c 100644 (file)
@@ -19,6 +19,7 @@ import sys
 import time
 
 from oslo.config import cfg
+from oslo import messaging
 
 from neutron.agent.common import config
 from neutron.agent.linux import external_process
@@ -47,15 +48,13 @@ REGISTRATION_RETRY_DELAY = 2
 MAX_REGISTRATION_ATTEMPTS = 30
 
 
-class CiscoDeviceManagementApi(n_rpc.RpcProxy):
+class CiscoDeviceManagementApi(object):
     """Agent side of the device manager RPC API."""
 
-    BASE_RPC_API_VERSION = '1.0'
-
     def __init__(self, topic, host):
-        super(CiscoDeviceManagementApi, self).__init__(
-            topic=topic, default_version=self.BASE_RPC_API_VERSION)
         self.host = host
+        target = messaging.Target(topic=topic, version='1.0')
+        self.client = n_rpc.get_client(target)
 
     def report_dead_hosting_devices(self, context, hd_ids=None):
         """Report that a hosting device cannot be contacted (presumed dead).
@@ -64,19 +63,14 @@ class CiscoDeviceManagementApi(n_rpc.RpcProxy):
         :param: hosting_device_ids: list of non-responding hosting devices
         :return: None
         """
-        # Cast since we don't expect a return value.
-        self.cast(context,
-                  self.make_msg('report_non_responding_hosting_devices',
-                                host=self.host,
-                                hosting_device_ids=hd_ids),
-                  topic=self.topic)
+        cctxt = self.client.prepare()
+        cctxt.cast(context, 'report_non_responding_hosting_devices',
+                   host=self.host, hosting_device_ids=hd_ids)
 
     def register_for_duty(self, context):
         """Report that a config agent is ready for duty."""
-        return self.call(context,
-                         self.make_msg('register_for_duty',
-                                       host=self.host),
-                         topic=self.topic)
+        cctxt = self.client.prepare()
+        return cctxt.call(context, 'register_for_duty', host=self.host)
 
 
 class CiscoCfgAgent(manager.Manager):
index d19a1b17c479b15d493942dc90bb9e2cc6f140d6..9fe5af2fd3105683560ce941c5e3a6b737892e1b 100644 (file)
@@ -85,15 +85,13 @@ class RouterInfo(object):
         return N_ROUTER_PREFIX + self.router_id
 
 
-class CiscoRoutingPluginApi(n_rpc.RpcProxy):
+class CiscoRoutingPluginApi(object):
     """RoutingServiceHelper(Agent) side of the  routing RPC API."""
 
-    BASE_RPC_API_VERSION = '1.1'
-
     def __init__(self, topic, host):
-        super(CiscoRoutingPluginApi, self).__init__(
-            topic=topic, default_version=self.BASE_RPC_API_VERSION)
         self.host = host
+        target = messaging.Target(topic=topic, version='1.0')
+        self.client = n_rpc.get_client(target)
 
     def get_routers(self, context, router_ids=None, hd_ids=None):
         """Make a remote process call to retrieve the sync data for routers.
@@ -103,12 +101,9 @@ class CiscoRoutingPluginApi(n_rpc.RpcProxy):
         :param hd_ids : hosting device ids, only routers assigned to these
                         hosting devices will be returned.
         """
-        return self.call(context,
-                         self.make_msg('cfg_sync_routers',
-                                       host=self.host,
-                                       router_ids=router_ids,
-                                       hosting_device_ids=hd_ids),
-                         topic=self.topic)
+        cctxt = self.client.prepare(version='1.1')
+        return cctxt.call(context, 'cfg_sync_routers', host=self.host,
+                          router_ids=router_ids, hosting_device_ids=hd_ids)
 
 
 class RoutingServiceHelper():