Drop usage of RpcProxy from L3PluginApi
Drop the usage of the RpcProxy compatibility class from the L3PluginApi. The equivalent direct usage of the oslo.messaging APIs are now being used instead. Part of blueprint drop-rpc-compat. Change-Id: I6639d1aa8acca8c0544020e28489e71f3d5d2955
This commit is contained in:
parent
50f65e2a9a
commit
e38e259c28
@ -78,7 +78,7 @@ PRIORITY_SYNC_ROUTERS_TASK = 1
|
|||||||
DELETE_ROUTER = 1
|
DELETE_ROUTER = 1
|
||||||
|
|
||||||
|
|
||||||
class L3PluginApi(n_rpc.RpcProxy):
|
class L3PluginApi(object):
|
||||||
"""Agent side of the l3 agent RPC API.
|
"""Agent side of the l3 agent RPC API.
|
||||||
|
|
||||||
API version history:
|
API version history:
|
||||||
@ -92,18 +92,16 @@ class L3PluginApi(n_rpc.RpcProxy):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
BASE_RPC_API_VERSION = '1.0'
|
|
||||||
|
|
||||||
def __init__(self, topic, host):
|
def __init__(self, topic, host):
|
||||||
super(L3PluginApi, self).__init__(
|
|
||||||
topic=topic, default_version=self.BASE_RPC_API_VERSION)
|
|
||||||
self.host = host
|
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):
|
def get_routers(self, context, router_ids=None):
|
||||||
"""Make a remote process call to retrieve the sync data for routers."""
|
"""Make a remote process call to retrieve the sync data for routers."""
|
||||||
return self.call(context,
|
cctxt = self.client.prepare()
|
||||||
self.make_msg('sync_routers', host=self.host,
|
return cctxt.call(context, 'sync_routers', host=self.host,
|
||||||
router_ids=router_ids))
|
router_ids=router_ids)
|
||||||
|
|
||||||
def get_external_network_id(self, context):
|
def get_external_network_id(self, context):
|
||||||
"""Make a remote process call to retrieve the external network id.
|
"""Make a remote process call to retrieve the external network id.
|
||||||
@ -112,40 +110,31 @@ class L3PluginApi(n_rpc.RpcProxy):
|
|||||||
exc_type if there are more than one
|
exc_type if there are more than one
|
||||||
external network
|
external network
|
||||||
"""
|
"""
|
||||||
return self.call(context,
|
cctxt = self.client.prepare()
|
||||||
self.make_msg('get_external_network_id',
|
return cctxt.call(context, 'get_external_network_id', host=self.host)
|
||||||
host=self.host))
|
|
||||||
|
|
||||||
def update_floatingip_statuses(self, context, router_id, fip_statuses):
|
def update_floatingip_statuses(self, context, router_id, fip_statuses):
|
||||||
"""Call the plugin update floating IPs's operational status."""
|
"""Call the plugin update floating IPs's operational status."""
|
||||||
return self.call(context,
|
cctxt = self.client.prepare(version='1.1')
|
||||||
self.make_msg('update_floatingip_statuses',
|
return cctxt.call(context, 'update_floatingip_statuses',
|
||||||
router_id=router_id,
|
router_id=router_id, fip_statuses=fip_statuses)
|
||||||
fip_statuses=fip_statuses),
|
|
||||||
version='1.1')
|
|
||||||
|
|
||||||
def get_ports_by_subnet(self, context, subnet_id):
|
def get_ports_by_subnet(self, context, subnet_id):
|
||||||
"""Retrieve ports by subnet id."""
|
"""Retrieve ports by subnet id."""
|
||||||
return self.call(context,
|
cctxt = self.client.prepare(version='1.2')
|
||||||
self.make_msg('get_ports_by_subnet', host=self.host,
|
return cctxt.call(context, 'get_ports_by_subnet', host=self.host,
|
||||||
subnet_id=subnet_id),
|
subnet_id=subnet_id)
|
||||||
topic=self.topic,
|
|
||||||
version='1.2')
|
|
||||||
|
|
||||||
def get_agent_gateway_port(self, context, fip_net):
|
def get_agent_gateway_port(self, context, fip_net):
|
||||||
"""Get or create an agent_gateway_port."""
|
"""Get or create an agent_gateway_port."""
|
||||||
return self.call(context,
|
cctxt = self.client.prepare(version='1.2')
|
||||||
self.make_msg('get_agent_gateway_port',
|
return cctxt.call(context, 'get_agent_gateway_port',
|
||||||
network_id=fip_net, host=self.host),
|
network_id=fip_net, host=self.host)
|
||||||
topic=self.topic,
|
|
||||||
version='1.2')
|
|
||||||
|
|
||||||
def get_service_plugin_list(self, context):
|
def get_service_plugin_list(self, context):
|
||||||
"""Make a call to get the list of activated services."""
|
"""Make a call to get the list of activated services."""
|
||||||
return self.call(context,
|
cctxt = self.client.prepare(version='1.3')
|
||||||
self.make_msg('get_service_plugin_list'),
|
return cctxt.call(context, 'get_service_plugin_list')
|
||||||
topic=self.topic,
|
|
||||||
version='1.3')
|
|
||||||
|
|
||||||
|
|
||||||
class LinkLocalAddressPair(netaddr.IPNetwork):
|
class LinkLocalAddressPair(netaddr.IPNetwork):
|
||||||
|
@ -55,9 +55,8 @@ class L3AgentTestFramework(base.BaseOVSLinuxTestCase):
|
|||||||
br_ex = self.create_ovs_bridge()
|
br_ex = self.create_ovs_bridge()
|
||||||
cfg.CONF.set_override('external_network_bridge', br_ex.br_name)
|
cfg.CONF.set_override('external_network_bridge', br_ex.br_name)
|
||||||
|
|
||||||
mock.patch('neutron.common.rpc.RpcProxy.cast').start()
|
mock.patch('neutron.agent.l3_agent.L3PluginApi').start()
|
||||||
mock.patch('neutron.common.rpc.RpcProxy.call').start()
|
|
||||||
mock.patch('neutron.common.rpc.RpcProxy.fanout_cast').start()
|
|
||||||
self.agent = l3_agent.L3NATAgent('localhost', cfg.CONF)
|
self.agent = l3_agent.L3NATAgent('localhost', cfg.CONF)
|
||||||
|
|
||||||
mock.patch.object(self.agent, '_send_gratuitous_arp_packet').start()
|
mock.patch.object(self.agent, '_send_gratuitous_arp_packet').start()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user