]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Use DVRServerRpcApi instead of a mixin
authorRussell Bryant <rbryant@redhat.com>
Fri, 23 Jan 2015 18:52:10 +0000 (13:52 -0500)
committerRussell Bryant <rbryant@redhat.com>
Mon, 26 Jan 2015 13:07:36 +0000 (08:07 -0500)
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
neutron/plugins/openvswitch/agent/ovs_neutron_agent.py

index 43a5d68acbcea520d602093a864b9c549874f8b2..c6d76bc520606dd4b13637109eb270caeec37784 100644 (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):
index 4f63b25598dcc92c12e0ff2a8dc2e45ef1116e7b..5906b4084f7a5c15b537101aba9cf38cde8942c9 100644 (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