2.22. test_bfd module¶
BFD tests
-
class
test_bfd.
AuthKeyFactory
¶ Bases:
object
Factory class for creating auth keys with unique conf key ID
-
create_random_key
(test, auth_type=4)¶ create a random key with unique conf key id
-
-
class
test_bfd.
BFD4TestCase
(methodName='runTest')¶ Bases:
framework.VppTestCase
Bidirectional Forwarding Detection (BFD)
-
pg0
= None¶
-
setUp
()¶ Clear trace before running each test
-
classmethod
setUpClass
()¶ Perform class setup before running the testcase Remove shared memory files, start vpp and connect the vpp-api
-
tearDown
()¶ Show various debug prints after each test
-
classmethod
tearDownClass
()¶ Perform final cleanup after running all tests in this test-case
-
test_admin_up_down
()¶ put session admin-up and admin-down
-
test_config_change_remote_demand
()¶ configuration change while peer in demand mode
-
test_conn_down
()¶ verify session goes down after inactivity
-
test_echo
()¶ echo function
-
test_echo_fail
()¶ session goes down if echo function fails
-
test_echo_looped_back
()¶ echo packets looped back
-
test_echo_source_removed
()¶ echo function stops if echo source is removed
-
test_echo_stop
()¶ echo function stops if peer sets required min echo rx zero
-
test_hold_up
()¶ hold BFD session up
-
test_immediate_remote_min_rx_reduction
()¶ immediately honor remote required min rx reduction
-
test_intf_deleted
()¶ interface with bfd session deleted
-
test_invalid_echo_checksum
()¶ echo packets with invalid checksum don’t keep a session up
-
test_large_required_min_rx
()¶ large remote required min rx interval
-
test_modify_detect_mult
()¶ modify detect multiplier
-
test_modify_req_min_rx_double
()¶ modify session - double required min rx
-
test_modify_req_min_rx_halve
()¶ modify session - halve required min rx
-
test_no_periodic_if_remote_demand
()¶ no periodic frames outside poll sequence if remote demand set
-
test_poll_response
()¶ test correct response to control frame with poll bit set
-
test_queued_poll
()¶ test poll sequence queueing
-
test_session
= None¶
-
test_session_down
()¶ bring BFD session down
-
test_session_up
()¶ bring BFD session up
-
test_session_up_by_ip
()¶ bring BFD session up - first frame looked up by address pair
-
test_slow_timer
()¶ verify slow periodic control frames while session down
-
test_stale_echo
()¶ stale echo packets don’t keep a session up
-
test_zero_remote_min_rx
()¶ no packets when zero remote required min rx interval
-
vpp_clock_offset
= None¶
-
vpp_session
= None¶
-
-
class
test_bfd.
BFD6TestCase
(methodName='runTest')¶ Bases:
framework.VppTestCase
Bidirectional Forwarding Detection (BFD) (IPv6)
-
pg0
= None¶
-
setUp
()¶ Clear trace before running each test
-
classmethod
setUpClass
()¶ Perform class setup before running the testcase Remove shared memory files, start vpp and connect the vpp-api
-
tearDown
()¶ Show various debug prints after each test
-
classmethod
tearDownClass
()¶ Perform final cleanup after running all tests in this test-case
-
test_echo
()¶ echo function
-
test_echo_looped_back
()¶ echo packets looped back
-
test_hold_up
()¶ hold BFD session up
-
test_intf_deleted
()¶ interface with bfd session deleted
-
test_session
= None¶
-
test_session_up
()¶ bring BFD session up
-
test_session_up_by_ip
()¶ bring BFD session up - first frame looked up by address pair
-
vpp_clock_offset
= None¶
-
vpp_session
= None¶
-
-
class
test_bfd.
BFDAPITestCase
(methodName='runTest')¶ Bases:
framework.VppTestCase
Bidirectional Forwarding Detection (BFD) - API
-
pg0
= None¶
-
pg1
= None¶
-
setUp
()¶ Clear trace before running each test
-
classmethod
setUpClass
()¶ Perform class setup before running the testcase Remove shared memory files, start vpp and connect the vpp-api
-
classmethod
tearDownClass
()¶ Perform final cleanup after running all tests in this test-case
-
test_activate_auth
()¶ activate SHA1 authentication
-
test_add_auth_nonexistent_key
()¶ create BFD session using non-existent SHA1 (negative case)
-
test_add_bfd
()¶ create a BFD session
-
test_add_bfd6
()¶ create IPv6 BFD session
-
test_add_bfd_sha1
()¶ create a BFD session (SHA1)
-
test_add_sha1_keys
()¶ add SHA1 keys
-
test_change_key
()¶ change SHA1 key
-
test_deactivate_auth
()¶ deactivate SHA1 authentication
-
test_double_add
()¶ create the same BFD session twice (negative case)
-
test_double_add_sha1
()¶ create the same BFD session twice (negative case) (SHA1)
-
test_mod_bfd
()¶ modify BFD session parameters
-
test_set_del_udp_echo_source
()¶ set/del udp echo source
share single SHA1 key between multiple BFD sessions
-
-
class
test_bfd.
BFDAuthOnOffTestCase
(methodName='runTest')¶ Bases:
framework.VppTestCase
Bidirectional Forwarding Detection (BFD) (changing auth)
-
pg0
= None¶
-
setUp
()¶ Clear trace before running each test
-
classmethod
setUpClass
()¶ Perform class setup before running the testcase Remove shared memory files, start vpp and connect the vpp-api
-
tearDown
()¶ Show various debug prints after each test
-
classmethod
tearDownClass
()¶ Perform final cleanup after running all tests in this test-case
-
test_auth_change_key_delayed
()¶ change auth key without disturbing session state (delayed)
-
test_auth_change_key_immediate
()¶ change auth key without disturbing session state (immediate)
-
test_auth_off_delayed
()¶ turn auth off without disturbing session state (delayed)
-
test_auth_off_immediate
()¶ turn auth off without disturbing session state (immediate)
-
test_auth_on_delayed
()¶ turn auth on without disturbing session state (delayed)
-
test_auth_on_immediate
()¶ turn auth on without disturbing session state (immediate)
-
test_session
= None¶
-
vpp_session
= None¶
-
-
class
test_bfd.
BFDCLITestCase
(methodName='runTest')¶ Bases:
framework.VppTestCase
Bidirectional Forwarding Detection (BFD) (CLI)
-
cli_verify_no_response
(cli)¶ execute a CLI, asserting that the response is empty
-
cli_verify_response
(cli, expected)¶ execute a CLI, asserting that the response matches expectation
-
pg0
= None¶
-
setUp
()¶ Clear trace before running each test
-
classmethod
setUpClass
()¶ Perform class setup before running the testcase Remove shared memory files, start vpp and connect the vpp-api
-
tearDown
()¶ Show various debug prints after each test
-
classmethod
tearDownClass
()¶ Perform final cleanup after running all tests in this test-case
-
test_add_mod_del_bfd_udp
()¶ create/modify/delete IPv4 BFD UDP session
-
test_add_mod_del_bfd_udp6
()¶ create/modify/delete IPv6 BFD UDP session
-
test_add_mod_del_bfd_udp6_auth
()¶ create/modify/delete IPv6 BFD UDP session (authenticated)
-
test_add_mod_del_bfd_udp_auth
()¶ create/modify/delete IPv4 BFD UDP session (authenticated)
-
test_admin_up_down
()¶ put session admin-up and admin-down
-
test_auth_on_off
()¶ turn authentication on and off
-
test_auth_on_off_delayed
()¶ turn authentication on and off (delayed)
-
test_set_del_meticulous_sha1_key
()¶ set/delete meticulous SHA1 auth key
-
test_set_del_sha1_key
()¶ set/delete SHA1 auth key
-
test_set_del_udp_echo_source
()¶ set/del udp echo source
-
test_show
()¶ show commands
-
-
class
test_bfd.
BFDFIBTestCase
(methodName='runTest')¶ Bases:
framework.VppTestCase
BFD-FIB interactions (IPv6)
-
static
pkt_is_not_data_traffic
(p)¶ not data traffic implies BFD or the usual IPv6 ND/RA
-
setUp
()¶ Clear trace before running each test
-
classmethod
setUpClass
()¶ Perform class setup before running the testcase Remove shared memory files, start vpp and connect the vpp-api
-
tearDown
()¶ Show various debug prints after each test
-
classmethod
tearDownClass
()¶ Perform final cleanup after running all tests in this test-case
-
test_session
= None¶
-
test_session_with_fib
()¶ BFD-FIB interactions
-
vpp_session
= None¶
-
static
-
class
test_bfd.
BFDSHA1TestCase
(methodName='runTest')¶ Bases:
framework.VppTestCase
Bidirectional Forwarding Detection (BFD) (SHA1 auth)
-
execute_rogue_session_scenario
(vpp_bfd_udp_session, legitimate_test_session, rogue_test_session, rogue_bfd_values=None)¶ execute a rogue session interaction scenario
create vpp session, add config
bring the legitimate session up
copy the bfd values from legitimate session to rogue session
apply rogue_bfd_values to rogue session
set rogue session state to down
send message to take the session down from the rogue session
assert that the legitimate session is unaffected
-
pg0
= None¶
-
setUp
()¶ Clear trace before running each test
-
classmethod
setUpClass
()¶ Perform class setup before running the testcase Remove shared memory files, start vpp and connect the vpp-api
-
tearDown
()¶ Show various debug prints after each test
-
classmethod
tearDownClass
()¶ Perform final cleanup after running all tests in this test-case
-
test_hold_up
()¶ hold BFD session up
-
test_hold_up_meticulous
()¶ hold BFD session up - meticulous auth
-
test_mismatch_auth
()¶ session is not brought down by unauthenticated msg
-
test_mismatch_bfd_key_id
()¶ session is not brought down by msg with non-existent key-id
-
test_mismatched_auth_type
()¶ session is not brought down by msg with wrong auth type
-
test_restart
()¶ simulate remote peer restart and resynchronization
-
test_send_bad_seq_number
()¶ session is not kept alive by msgs with bad sequence numbers
-
test_session
= None¶
-
test_session_up
()¶ bring BFD session up
-
vpp_clock_offset
= None¶
-
vpp_session
= None¶
-
-
class
test_bfd.
BFDTestSession
(test, interface, af, detect_mult=3, sha1_key=None, bfd_key_id=None, our_seq_number=None)¶ Bases:
object
BFD session as seen from test framework side
-
create_packet
()¶ create a BFD packet, reflecting the current state of session
-
fill_packet_fields
(packet)¶ set packet fields with known values in packet
-
inc_seq_num
()¶ increment sequence number, wrapping if needed
-
send_packet
(packet=None, interface=None)¶ send packet on interface, creating the packet if needed
-
update
(my_discriminator=None, your_discriminator=None, desired_min_tx=None, required_min_rx=None, required_min_echo_rx=None, detect_mult=None, diag=None, state=None, auth_type=None)¶ update BFD parameters associated with session
-
verify_bfd
(packet)¶ Verify correctness of BFD layer.
-
verify_sha1_auth
(packet)¶ Verify correctness of authentication in BFD layer.
-
-
test_bfd.
bfd_session_down
(test)¶ Bring BFD session down
-
test_bfd.
bfd_session_up
(test)¶ Bring BFD session up
-
test_bfd.
getrandbits
(k) → x. Generates an int with k random bits.¶
-
test_bfd.
verify_bfd_session_config
(test, session, state=None)¶
-
test_bfd.
verify_event
(test, event, expected_state)¶ Verify correctness of event values.
-
test_bfd.
verify_ip
(test, packet)¶ Verify correctness of IP layer.
-
test_bfd.
verify_udp
(test, packet)¶ Verify correctness of UDP layer.
-
test_bfd.
wait_for_bfd_packet
(test, timeout=1, pcap_time_min=None)¶ wait for BFD packet and verify its correctness
- Parameters
timeout – how long to wait
pcap_time_min – ignore packets with pcap timestamp lower than this
- Returns
tuple (packet, time spent waiting for packet)