diff options
author | Neale Ranns <neale.ranns@cisco.com> | 2020-11-20 13:05:59 +0000 |
---|---|---|
committer | Andrew Yourtchenko <ayourtch@gmail.com> | 2020-11-26 15:03:50 +0000 |
commit | b72fb31d69039a86a4ed69d510ce8298c0a4fb49 (patch) | |
tree | b91a0fa89421795831a32d7048d3c1d3dfc309ba /test/test_neighbor.py | |
parent | 0e68a7cb5bf7ed0c8b75c0aa10d418cc14e0bad1 (diff) |
ip-neighbor: Send API event when neighbor is removed
Type: fix
Signed-off-by: Neale Ranns <neale.ranns@cisco.com>
Change-Id: I9952497a108bac26445af95c28d4eed46099c2fc
Diffstat (limited to 'test/test_neighbor.py')
-rw-r--r-- | test/test_neighbor.py | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/test/test_neighbor.py b/test/test_neighbor.py index 1045f4ba1e9..c0af91013ba 100644 --- a/test/test_neighbor.py +++ b/test/test_neighbor.py @@ -1959,16 +1959,51 @@ class NeighborAgeTestCase(VppTestCase): # # load up some neighbours again with 2s aging enabled # they should be removed after 10s (2s age + 4s for probes + gap) + # check for the add and remove events # + enum = VppEnum.vl_api_ip_neighbor_event_flags_t + + self.vapi.want_ip_neighbor_events_v2(enable=1) for ii in range(10): VppNeighbor(self, self.pg0.sw_if_index, self.pg0.remote_hosts[ii].mac, self.pg0.remote_hosts[ii].ip4).add_vpp_config() + + e = self.vapi.wait_for_event(1, "ip_neighbor_event_v2") + self.assertEqual(e.flags, + enum.IP_NEIGHBOR_API_EVENT_FLAG_ADDED) + self.assertEqual(str(e.neighbor.ip_address), + self.pg0.remote_hosts[ii].ip4) + self.assertEqual(e.neighbor.mac_address, + self.pg0.remote_hosts[ii].mac) + self.sleep(10) self.assertFalse(self.vapi.ip_neighbor_dump(sw_if_index=0xffffffff, af=vaf.ADDRESS_IP4)) + evs = [] + for ii in range(10): + e = self.vapi.wait_for_event(1, "ip_neighbor_event_v2") + self.assertEqual(e.flags, + enum.IP_NEIGHBOR_API_EVENT_FLAG_REMOVED) + evs.append(e) + + # check we got the correct mac/ip pairs - done separately + # because we don't care about the order the remove notifications + # arrive + for ii in range(10): + found = False + mac = self.pg0.remote_hosts[ii].mac + ip = self.pg0.remote_hosts[ii].ip4 + + for e in evs: + if (e.neighbor.mac_address == mac and + str(e.neighbor.ip_address) == ip): + found = True + break + self.assertTrue(found) + # # check if we can set age and recycle with empty neighbor list # |