diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/test_bfd.py | 45 | ||||
-rw-r--r-- | test/vpp_papi_provider.py | 3 |
2 files changed, 48 insertions, 0 deletions
diff --git a/test/test_bfd.py b/test/test_bfd.py index f14ff71b341..a7f2b93982b 100644 --- a/test/test_bfd.py +++ b/test/test_bfd.py @@ -252,6 +252,51 @@ class BFDAPITestCase(VppTestCase): session.add_vpp_config() session.activate_auth(key2) + def test_set_del_udp_echo_source(self): + """ set/del udp echo source """ + self.create_loopback_interfaces(1) + self.loopback0 = self.lo_interfaces[0] + self.loopback0.admin_up() + echo_source = self.vapi.bfd_udp_get_echo_source() + self.assertFalse(echo_source.is_set) + self.assertFalse(echo_source.have_usable_ip4) + self.assertFalse(echo_source.have_usable_ip6) + + self.vapi.bfd_udp_set_echo_source(self.loopback0.sw_if_index) + echo_source = self.vapi.bfd_udp_get_echo_source() + self.assertTrue(echo_source.is_set) + self.assertEqual(echo_source.sw_if_index, self.loopback0.sw_if_index) + self.assertFalse(echo_source.have_usable_ip4) + self.assertFalse(echo_source.have_usable_ip6) + + self.loopback0.config_ip4() + unpacked = unpack("!L", self.loopback0.local_ip4n) + echo_ip4 = pack("!L", unpacked[0] ^ 1) + echo_source = self.vapi.bfd_udp_get_echo_source() + self.assertTrue(echo_source.is_set) + self.assertEqual(echo_source.sw_if_index, self.loopback0.sw_if_index) + self.assertTrue(echo_source.have_usable_ip4) + self.assertEqual(echo_source.ip4_addr, echo_ip4) + self.assertFalse(echo_source.have_usable_ip6) + + self.loopback0.config_ip6() + unpacked = unpack("!LLLL", self.loopback0.local_ip6n) + echo_ip6 = pack("!LLLL", unpacked[0], unpacked[1], unpacked[2], + unpacked[3] ^ 1) + echo_source = self.vapi.bfd_udp_get_echo_source() + self.assertTrue(echo_source.is_set) + self.assertEqual(echo_source.sw_if_index, self.loopback0.sw_if_index) + self.assertTrue(echo_source.have_usable_ip4) + self.assertEqual(echo_source.ip4_addr, echo_ip4) + self.assertTrue(echo_source.have_usable_ip6) + self.assertEqual(echo_source.ip6_addr, echo_ip6) + + self.vapi.bfd_udp_del_echo_source() + echo_source = self.vapi.bfd_udp_get_echo_source() + self.assertFalse(echo_source.is_set) + self.assertFalse(echo_source.have_usable_ip4) + self.assertFalse(echo_source.have_usable_ip6) + @unittest.skipUnless(running_extended_tests(), "part of extended tests") class BFDTestSession(object): diff --git a/test/vpp_papi_provider.py b/test/vpp_papi_provider.py index 5ef1b309e06..a51dea4685e 100644 --- a/test/vpp_papi_provider.py +++ b/test/vpp_papi_provider.py @@ -2272,6 +2272,9 @@ class VppPapiProvider(object): def bfd_udp_del_echo_source(self): return self.api(self.papi.bfd_udp_del_echo_source, {}) + def bfd_udp_get_echo_source(self): + return self.api(self.papi.bfd_udp_get_echo_source, {}) + def classify_add_del_table( self, is_add, |