Merge "Removed deprecated class LocalVLANMapping"
This commit is contained in:
commit
ff9f88f8b8
|
@ -223,40 +223,18 @@ class L2populationRpcCallBackTunnelMixin(L2populationRpcCallBackMixin):
|
|||
'''
|
||||
pass
|
||||
|
||||
def _get_lvm_getter(self, local_vlan_map):
|
||||
def get_lvm_from_mapping(net_id, local_vlan_map):
|
||||
"""This introduces backward compatibility with local_vlan_map, will
|
||||
be removed in Ocata.
|
||||
"""
|
||||
try:
|
||||
return local_vlan_map[net_id]
|
||||
except KeyError:
|
||||
raise vlanmanager.MappingNotFound(net_id=net_id)
|
||||
|
||||
def get_lvm_from_manager(net_id, local_vlan_map):
|
||||
vlan_manager = vlanmanager.LocalVlanManager()
|
||||
return vlan_manager.get(net_id)
|
||||
|
||||
if local_vlan_map is not None:
|
||||
vlanmanager.deprecate_local_vlan_map_in_object(
|
||||
"%s.get_agent_ports()" % self.__class__.__name__,
|
||||
stacklevel_extra=1)
|
||||
return get_lvm_from_mapping
|
||||
return get_lvm_from_manager
|
||||
|
||||
def get_agent_ports(self, fdb_entries, local_vlan_map=None):
|
||||
def get_agent_ports(self, fdb_entries):
|
||||
"""Generator to yield port info.
|
||||
|
||||
For each known (i.e found in VLAN manager) network in
|
||||
fdb_entries, yield (lvm, fdb_entries[network_id]['ports']) pair.
|
||||
|
||||
:param fdb_entries: l2pop fdb entries
|
||||
:param local_vlan_map: Deprecated.
|
||||
"""
|
||||
lvm_getter = self._get_lvm_getter(local_vlan_map)
|
||||
vlan_manager = vlanmanager.LocalVlanManager()
|
||||
for network_id, values in fdb_entries.items():
|
||||
try:
|
||||
lvm = lvm_getter(network_id, local_vlan_map)
|
||||
lvm = vlan_manager.get(network_id)
|
||||
except vlanmanager.MappingNotFound:
|
||||
continue
|
||||
agent_ports = values.get('ports')
|
||||
|
@ -303,8 +281,7 @@ class L2populationRpcCallBackTunnelMixin(L2populationRpcCallBackMixin):
|
|||
getattr(self, method)(context, values)
|
||||
|
||||
@log_helpers.log_method_call
|
||||
def fdb_chg_ip_tun(self, context, br, fdb_entries, local_ip,
|
||||
local_vlan_map=None):
|
||||
def fdb_chg_ip_tun(self, context, br, fdb_entries, local_ip):
|
||||
'''fdb update when an IP of a port is updated.
|
||||
|
||||
The ML2 l2-pop mechanism driver sends an fdb update rpc message when an
|
||||
|
@ -328,12 +305,11 @@ class L2populationRpcCallBackTunnelMixin(L2populationRpcCallBackMixin):
|
|||
PortInfo has .mac_address and .ip_address attrs.
|
||||
|
||||
:param local_ip: local IP address of this agent.
|
||||
:param local_vlan_map: Deprecated.
|
||||
'''
|
||||
lvm_getter = self._get_lvm_getter(local_vlan_map)
|
||||
vlan_manager = vlanmanager.LocalVlanManager()
|
||||
for network_id, agent_ports in fdb_entries.items():
|
||||
try:
|
||||
lvm = lvm_getter(network_id, local_vlan_map)
|
||||
lvm = vlan_manager.get(network_id)
|
||||
except vlanmanager.MappingNotFound:
|
||||
continue
|
||||
|
||||
|
|
|
@ -13,19 +13,11 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import debtcollector
|
||||
from neutron_lib import exceptions
|
||||
|
||||
from neutron._i18n import _
|
||||
|
||||
|
||||
def deprecate_local_vlan_map_in_object(object_name, stacklevel_extra=0):
|
||||
debtcollector.deprecate(
|
||||
"local_vlan_map argument for %s was deprecated." % object_name,
|
||||
version="Newton", removal_version="Ocata",
|
||||
stacklevel=4 + stacklevel_extra)
|
||||
|
||||
|
||||
class VifIdNotFound(exceptions.NeutronException):
|
||||
message = _('VIF ID %(vif_id)s not found in any network managed by '
|
||||
'VLAN Manager')
|
||||
|
|
|
@ -221,7 +221,7 @@ class TestL2populationRpcCallBackTunnelMixin(
|
|||
m_setup_entry_for_arp_reply = mock.Mock()
|
||||
self.fakeagent.setup_entry_for_arp_reply = m_setup_entry_for_arp_reply
|
||||
self.fakeagent.fdb_chg_ip_tun(
|
||||
'context', self.fakebr, self.upd_fdb_entry1, self.local_ip, {})
|
||||
'context', self.fakebr, self.upd_fdb_entry1, self.local_ip)
|
||||
self.assertFalse(m_setup_entry_for_arp_reply.call_count)
|
||||
|
||||
def test__fdb_chg_ip_ip_is_local_ip(self):
|
||||
|
|
|
@ -118,9 +118,3 @@ class TestLocalVlanManager(base.BaseTestCase):
|
|||
def test_pop_non_existing_raises_exception(self):
|
||||
with testtools.ExpectedException(vlanmanager.MappingNotFound):
|
||||
self.vlan_manager.pop(1)
|
||||
|
||||
|
||||
class TestDeprecationMessage(base.BaseTestCase):
|
||||
def test_deprecation_message(self):
|
||||
"""Test that calling function doesn't crash"""
|
||||
vlanmanager.deprecate_local_vlan_map_in_object("foo")
|
||||
|
|
Loading…
Reference in New Issue