Merge "Properly handle empty before/after notifications in l2pop code"

This commit is contained in:
Jenkins 2014-10-15 03:47:21 +00:00 committed by Gerrit Code Review
commit 904435757d
2 changed files with 16 additions and 2 deletions

View File

@ -242,12 +242,12 @@ class L2populationRpcCallBackTunnelMixin(L2populationRpcCallBackMixin):
if agent_ip == local_ip:
continue
after = state.get('after')
after = state.get('after', [])
for mac, ip in after:
self.setup_entry_for_arp_reply(br, 'add', lvm.vlan, mac,
ip)
before = state.get('before')
before = state.get('before', [])
for mac, ip in before:
self.setup_entry_for_arp_reply(br, 'remove', lvm.vlan, mac,
ip)

View File

@ -234,3 +234,17 @@ class TestL2populationRpcCallBackTunnelMixin(
upd_fdb_entry_val, self.local_ip,
self.local_vlan_map1)
self.assertFalse(m_setup_entry_for_arp_reply.call_count)
def test_fdb_chg_ip_tun_empty_before_after(self):
upd_fdb_entry_val = {
self.lvms[0].net: {
self.local_ip: {},
},
}
m_setup_entry_for_arp_reply = mock.Mock()
self.fakeagent.setup_entry_for_arp_reply = m_setup_entry_for_arp_reply
# passing non-local ip
self.fakeagent.fdb_chg_ip_tun('context', self.fakebr,
upd_fdb_entry_val, "8.8.8.8",
self.local_vlan_map1)
self.assertFalse(m_setup_entry_for_arp_reply.call_count)