remove unused rpc method get_active_networks

This method was originally left for backwards compatibility during
an upgrade of neutron. It stopped being used in havana so I think it
should be safe to remove now.

Closes-bug: #1583835
Change-Id: I503d10ee59ba2fa046b5030e8281fd41a49ee74e
This commit is contained in:
Aaron Rosen 2016-05-18 22:29:03 -07:00
parent 96a195c064
commit 2ddbbce7ba
2 changed files with 5 additions and 24 deletions

View File

@ -67,9 +67,13 @@ class DhcpRpcCallback(object):
# DHCP agent since Juno, so similar rationale for not bumping the
# major version as above applies here too.
# 1.5 - Added dhcp_ready_on_ports.
# 1.6 - Removed get_active_networks. It's not used by reference
# DHCP agent since Havana, so similar rationale for not bumping
# the major version as above applies here too.
target = oslo_messaging.Target(
namespace=n_const.RPC_NAMESPACE_DHCP_PLUGIN,
version='1.5')
version='1.6')
def _get_active_networks(self, context, **kwargs):
"""Retrieve and return a list of the active networks."""
@ -117,16 +121,6 @@ class DhcpRpcCallback(object):
"could not complete successfully: %(reason)s"),
{"action": action, "net_id": net_id, 'reason': e})
def get_active_networks(self, context, **kwargs):
"""Retrieve and return a list of the active network ids."""
# NOTE(arosen): This method is no longer used by the DHCP agent but is
# left so that neutron-dhcp-agents will still continue to work if
# neutron-server is upgraded and not the agent.
host = kwargs.get('host')
LOG.debug('get_active_networks requested from %s', host)
nets = self._get_active_networks(context, **kwargs)
return [net['id'] for net in nets]
def _group_by_network_id(self, res):
grouped = {}
keyfunc = operator.itemgetter('network_id')

View File

@ -45,19 +45,6 @@ class TestDhcpRpcCallback(base.BaseTestCase):
self.utils_p = mock.patch('neutron.plugins.common.utils.create_port')
self.utils = self.utils_p.start()
def test_get_active_networks(self):
plugin_retval = [dict(id='a'), dict(id='b')]
self.plugin.get_networks.return_value = plugin_retval
networks = self.callbacks.get_active_networks(mock.Mock(), host='host')
self.assertEqual(networks, ['a', 'b'])
self.plugin.assert_has_calls(
[mock.call.get_networks(mock.ANY,
filters=dict(admin_state_up=[True]))])
self.assertEqual(len(self.log.mock_calls), 1)
def test_group_by_network_id(self):
port1 = {'network_id': 'a'}
port2 = {'network_id': 'b'}