import time
from oslo.config import cfg
+from oslo import messaging
from neutron.agent.common import config
from neutron.agent.linux import external_process
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).
: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):
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.
: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():