Drop RpcProxy usage from cisco.cfg_agent
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
This commit is contained in:
parent
4a622e7d86
commit
7e200b1566
@ -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):
|
||||
|
@ -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():
|
||||
|
Loading…
x
Reference in New Issue
Block a user