diff options
author | Neale Ranns <neale.ranns@cisco.com> | 2020-11-20 13:05:59 +0000 |
---|---|---|
committer | Neale Ranns <nranns@cisco.com> | 2020-11-25 12:57:16 +0000 |
commit | 4ac36bcb190b85e6541d27072157fdcee42bee23 (patch) | |
tree | 8c3da48e217bcef492b56deacd2e3c333ff5a683 /test/test_neighbor.py | |
parent | 38340fa32c96e9c6cb1593f03117dd504efbd5f4 (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 d81fe1b3f80..2dc27a83b0a 100644 --- a/test/test_neighbor.py +++ b/test/test_neighbor.py @@ -1991,16 +1991,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 # |