From 4dca257646aa55f656e4bfdc52af44c21aac4fe0 Mon Sep 17 00:00:00 2001 From: Russell Bryant Date: Fri, 23 Jan 2015 13:52:10 -0500 Subject: [PATCH] Use DVRServerRpcApi instead of a mixin Replace DVRServerRpcApiMixin with a standalone rpc client class, DVRServerRpcApi. Also convert the one user of this code (the ovs agent) to use it. This is a prerequisite to being able to put this rpc interface into a messaging namespace. Part of blueprint rpc-docs-and-namespaces. Change-Id: I33b8bff78fd9ca0223c5e48713f7e8f2db026752 --- neutron/api/rpc/handlers/dvr_rpc.py | 7 +++++-- neutron/plugins/openvswitch/agent/ovs_neutron_agent.py | 5 +++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/neutron/api/rpc/handlers/dvr_rpc.py b/neutron/api/rpc/handlers/dvr_rpc.py index 43a5d68ac..c6d76bc52 100644 --- a/neutron/api/rpc/handlers/dvr_rpc.py +++ b/neutron/api/rpc/handlers/dvr_rpc.py @@ -16,6 +16,7 @@ from oslo import messaging from neutron.common import log +from neutron.common import rpc as n_rpc from neutron.common import topics from neutron import manager from neutron.openstack.common import log as logging @@ -23,10 +24,12 @@ from neutron.openstack.common import log as logging LOG = logging.getLogger(__name__) -class DVRServerRpcApiMixin(object): +class DVRServerRpcApi(object): """Agent-side RPC (stub) for agent-to-plugin interaction.""" - DVR_RPC_VERSION = "1.0" + def __init__(self, topic): + target = messaging.Target(topic=topic, version='1.0') + self.client = n_rpc.get_client(target) @log.log def get_dvr_mac_address_by_host(self, context, host): diff --git a/neutron/plugins/openvswitch/agent/ovs_neutron_agent.py b/neutron/plugins/openvswitch/agent/ovs_neutron_agent.py index 4f63b2559..5906b4084 100644 --- a/neutron/plugins/openvswitch/agent/ovs_neutron_agent.py +++ b/neutron/plugins/openvswitch/agent/ovs_neutron_agent.py @@ -82,7 +82,7 @@ class LocalVLANMapping(object): self.segmentation_id)) -class OVSPluginApi(agent_rpc.PluginApi, dvr_rpc.DVRServerRpcApiMixin): +class OVSPluginApi(agent_rpc.PluginApi): pass @@ -218,7 +218,7 @@ class OVSNeutronAgent(sg_rpc.SecurityGroupAgentRpcCallbackMixin, self.dvr_agent = ovs_dvr_neutron_agent.OVSDVRNeutronAgent( self.context, - self.plugin_rpc, + self.dvr_plugin_rpc, self.int_br, self.tun_br, self.patch_int_ofport, @@ -273,6 +273,7 @@ class OVSNeutronAgent(sg_rpc.SecurityGroupAgentRpcCallbackMixin, self.topic = topics.AGENT self.plugin_rpc = OVSPluginApi(topics.PLUGIN) self.sg_plugin_rpc = sg_rpc.SecurityGroupServerRpcApi(topics.PLUGIN) + self.dvr_plugin_rpc = dvr_rpc.DVRServerRpcApi(topics.PLUGIN) self.state_rpc = agent_rpc.PluginReportStateAPI(topics.PLUGIN) # RPC network init -- 2.45.2