From 275bd796346c3b1618170f4eda36b9a41ade9c87 Mon Sep 17 00:00:00 2001 From: Nathan Skrzypczak Date: Fri, 17 Sep 2021 17:29:14 +0200 Subject: ip: fix fib and mfib locks This patches fixes an issue that could cause fib locks to underflow: if an API user deletes a fib and quickly recreates it, the fib may not have been actually deleted. As a result, the lock would not be incremented on the create call leading to the fib potentially disappearing afterwards - or to the lock to underflow when the fib is deleted again. In order to keep the existing API semantics, we use the locks with API and CLI source as flags. This means we need to use a different counter for the interface-related locks. This also prevents an issue where an interface being bound to a vrf via API and released via CLI could mess up the lock counter. Finally, this will help with cleaning up the interface-related locks on interface deletion in a later patch. Type: fix Change-Id: I93030a7660646d6dd179ddf27fe4e708aa11b90e Signed-off-by: Nathan Skrzypczak Signed-off-by: Aloys Augustin --- test/test_ip6_vrf_multi_instance.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'test') diff --git a/test/test_ip6_vrf_multi_instance.py b/test/test_ip6_vrf_multi_instance.py index 0f4a073366b..97cebff8dce 100755 --- a/test/test_ip6_vrf_multi_instance.py +++ b/test/test_ip6_vrf_multi_instance.py @@ -592,6 +592,33 @@ class TestIP6VrfMultiInst(VppTestCase): vrf_list_length, 0, "List of configured VRFs is not empty: %s != 0" % vrf_list_length) + def test_ip6_vrf_06(self): + """ IP6 VRF Multi-instance test 6 - recreate 4 VRFs + """ + # Reconfigure all the VRFs + self.create_vrf_and_assign_interfaces(4) + # Verify + for vrf_id in self.vrf_list: + self.assert_equal(self.verify_vrf(vrf_id), + VRFState.configured, VRFState) + # Test + self.run_verify_test() + self.run_crosswise_vrf_test() + # Cleanup + for i in range(len(self.vrf_list)): + self.reset_vrf_and_remove_from_vrf_list(self.vrf_list[0]) + # Verify + for vrf_id in self.vrf_reset_list: + self.assert_equal(self.verify_vrf(vrf_id), + VRFState.reset, VRFState) + vrf_list_length = len(self.vrf_list) + self.assertEqual( + vrf_list_length, 0, + "List of configured VRFs is not empty: %s != 0" % vrf_list_length) + # Test + self.run_verify_test() + self.run_crosswise_vrf_test() + if __name__ == '__main__': unittest.main(testRunner=VppTestRunner) -- cgit 1.2.3-korg