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
This commit is contained in:
Russell Bryant 2015-01-23 13:52:10 -05:00
parent 8f6e93ea7d
commit 4dca257646
2 changed files with 8 additions and 4 deletions

View File

@ -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):

View File

@ -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