Removed release_port_fixed_ip dead code
It's not used since I822cc4a92cb05cdef88679bb628fad4e5063cddd. Closes-Bug: #1212520 Change-Id: I1bb0755fa1379f3dad4241e7ae8d50c4c842d89e
This commit is contained in:
parent
e7675a8af5
commit
9ad3c6ac9b
|
@ -452,13 +452,6 @@ class DhcpPluginApi(object):
|
|||
network_id=network_id, device_id=device_id,
|
||||
host=self.host)
|
||||
|
||||
def release_port_fixed_ip(self, network_id, device_id, subnet_id):
|
||||
"""Make a remote process call to release a fixed_ip on the port."""
|
||||
cctxt = self.client.prepare()
|
||||
return cctxt.call(self.context, 'release_port_fixed_ip',
|
||||
network_id=network_id, subnet_id=subnet_id,
|
||||
device_id=device_id, host=self.host)
|
||||
|
||||
|
||||
class NetworkCache(object):
|
||||
"""Agent cache of the current network state."""
|
||||
|
|
|
@ -56,9 +56,12 @@ class DhcpRpcCallback(object):
|
|||
# RPC client for many releases, it should be OK to bump the
|
||||
# minor release instead and claim RPC compatibility with the
|
||||
# last few client versions.
|
||||
# 1.3 - Removed release_port_fixed_ip. It's not used by reference DHCP
|
||||
# agent since Juno, so similar rationale for not bumping the
|
||||
# major version as above applies here too.
|
||||
target = oslo_messaging.Target(
|
||||
namespace=constants.RPC_NAMESPACE_DHCP_PLUGIN,
|
||||
version='1.2')
|
||||
version='1.3')
|
||||
|
||||
def _get_active_networks(self, context, **kwargs):
|
||||
"""Retrieve and return a list of the active networks."""
|
||||
|
@ -173,31 +176,6 @@ class DhcpRpcCallback(object):
|
|||
plugin = manager.NeutronManager.get_plugin()
|
||||
plugin.delete_ports_by_device_id(context, device_id, network_id)
|
||||
|
||||
@db_api.retry_db_errors
|
||||
def release_port_fixed_ip(self, context, **kwargs):
|
||||
"""Release the fixed_ip associated the subnet on a port."""
|
||||
host = kwargs.get('host')
|
||||
network_id = kwargs.get('network_id')
|
||||
device_id = kwargs.get('device_id')
|
||||
subnet_id = kwargs.get('subnet_id')
|
||||
|
||||
LOG.debug('DHCP port remove fixed_ip for %(subnet_id)s request '
|
||||
'from %(host)s',
|
||||
{'subnet_id': subnet_id, 'host': host})
|
||||
plugin = manager.NeutronManager.get_plugin()
|
||||
filters = dict(network_id=[network_id], device_id=[device_id])
|
||||
ports = plugin.get_ports(context, filters=filters)
|
||||
|
||||
if ports:
|
||||
port = ports[0]
|
||||
|
||||
fixed_ips = port.get('fixed_ips', [])
|
||||
for i in range(len(fixed_ips)):
|
||||
if fixed_ips[i]['subnet_id'] == subnet_id:
|
||||
del fixed_ips[i]
|
||||
break
|
||||
plugin.update_port(context, port['id'], dict(port=port))
|
||||
|
||||
def update_lease_expiration(self, context, **kwargs):
|
||||
"""Release the fixed_ip associated the subnet on a port."""
|
||||
# NOTE(arosen): This method is no longer used by the DHCP agent but is
|
||||
|
|
|
@ -1031,10 +1031,6 @@ class TestDhcpPluginApiProxy(base.BaseTestCase):
|
|||
self._test_dhcp_api('release_dhcp_port', network_id='fake_id',
|
||||
device_id='fake_id_2')
|
||||
|
||||
def test_release_port_fixed_ip(self):
|
||||
self._test_dhcp_api('release_port_fixed_ip', network_id='fake_id',
|
||||
device_id='fake_id_2', subnet_id='fake_id_3')
|
||||
|
||||
|
||||
class TestNetworkCache(base.BaseTestCase):
|
||||
def test_put_network(self):
|
||||
|
|
|
@ -211,17 +211,3 @@ class TestDhcpRpcCallback(base.BaseTestCase):
|
|||
|
||||
self.plugin.assert_has_calls([
|
||||
mock.call.delete_ports_by_device_id(mock.ANY, 'devid', 'netid')])
|
||||
|
||||
def test_release_port_fixed_ip(self):
|
||||
port_retval = dict(id='port_id', fixed_ips=[dict(subnet_id='a')])
|
||||
port_update = dict(id='port_id', fixed_ips=[])
|
||||
self.plugin.get_ports.return_value = [port_retval]
|
||||
|
||||
self.callbacks.release_port_fixed_ip(mock.ANY, network_id='netid',
|
||||
device_id='devid', subnet_id='a')
|
||||
|
||||
self.plugin.assert_has_calls([
|
||||
mock.call.get_ports(mock.ANY, filters=dict(network_id=['netid'],
|
||||
device_id=['devid'])),
|
||||
mock.call.update_port(mock.ANY, 'port_id',
|
||||
dict(port=port_update))])
|
||||
|
|
Loading…
Reference in New Issue