From f3bcdbf071c98ed676591bd22c3d3f8601009fa8 Mon Sep 17 00:00:00 2001 From: Klement Sekera Date: Tue, 2 May 2017 07:38:01 +0200 Subject: BFD: don't crash if interface is deleted Instead, drop the BFD session associated with it.. Change-Id: Ie09877d5c94844be2e833900d9dde7f23edaf8cd Signed-off-by: Klement Sekera --- test/test_bfd.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'test') diff --git a/test/test_bfd.py b/test/test_bfd.py index 0923d36d8ba..be42cdadd46 100644 --- a/test/test_bfd.py +++ b/test/test_bfd.py @@ -17,6 +17,7 @@ from bfd import VppBFDAuthKey, BFD, BFDAuthType, VppBFDUDPSession, \ BFDDiagCode, BFDState, BFD_vpp_echo from framework import VppTestCase, VppTestRunner, running_extended_tests from vpp_pg_interface import CaptureTimeoutError, is_ipv6_misc +from vpp_lo_interface import VppLoInterface from util import ppp from vpp_papi_provider import UnexpectedApiReturnValueError from vpp_ip_route import VppIpRoute, VppRoutePath @@ -1403,6 +1404,20 @@ class BFD4TestCase(VppTestCase): self.assert_equal(count, 0, "number of packets received") self.assert_equal(len(events), 0, "number of events received") + def test_intf_deleted(self): + """ interface with bfd session deleted """ + intf = VppLoInterface(self, 0) + intf.config_ip4() + intf.admin_up() + sw_if_index = intf.sw_if_index + vpp_session = VppBFDUDPSession(self, intf, intf.remote_ip4) + vpp_session.add_vpp_config() + vpp_session.admin_up() + intf.remove_vpp_config() + e = self.vapi.wait_for_event(1, "bfd_udp_session_details") + self.assert_equal(e.sw_if_index, sw_if_index, "sw_if_index") + self.assertFalse(vpp_session.query_vpp_config()) + @unittest.skipUnless(running_extended_tests(), "part of extended tests") class BFD6TestCase(VppTestCase): @@ -1597,6 +1612,21 @@ class BFD6TestCase(VppTestCase): self.test_session.send_packet() self.assertTrue(echo_seen, "No echo packets received") + def test_intf_deleted(self): + """ interface with bfd session deleted """ + intf = VppLoInterface(self, 0) + intf.config_ip6() + intf.admin_up() + sw_if_index = intf.sw_if_index + vpp_session = VppBFDUDPSession( + self, intf, intf.remote_ip6, af=AF_INET6) + vpp_session.add_vpp_config() + vpp_session.admin_up() + intf.remove_vpp_config() + e = self.vapi.wait_for_event(1, "bfd_udp_session_details") + self.assert_equal(e.sw_if_index, sw_if_index, "sw_if_index") + self.assertFalse(vpp_session.query_vpp_config()) + @unittest.skipUnless(running_extended_tests(), "part of extended tests") class BFDFIBTestCase(VppTestCase): -- cgit 1.2.3-korg