MCPcopy Create free account
hub / github.com/FDio/vpp / bfd_session_up

Function bfd_session_up

test/test_bfd.py:872–912  ·  view source on GitHub ↗

Bring BFD session up

(test)

Source from the content-addressed store, hash-verified

870
871
872def bfd_session_up(test):
873 """Bring BFD session up"""
874 test.logger.info("BFD: Waiting for slow hello")
875 p = wait_for_bfd_packet(test, 2, is_tunnel=test.vpp_session.is_tunnel)
876 old_offset = None
877 if hasattr(test, "vpp_clock_offset"):
878 old_offset = test.vpp_clock_offset
879 test.vpp_clock_offset = time.time() - float(p.time)
880 test.logger.debug("BFD: Calculated vpp clock offset: %s", test.vpp_clock_offset)
881 if old_offset:
882 test.assertAlmostEqual(
883 old_offset,
884 test.vpp_clock_offset,
885 delta=0.5,
886 msg="vpp clock offset not stable (new: %s, old: %s)"
887 % (test.vpp_clock_offset, old_offset),
888 )
889 test.logger.info("BFD: Sending Init")
890 test.test_session.update(
891 my_discriminator=randint(0, 40000000),
892 your_discriminator=p[BFD].my_discriminator,
893 state=BFDState.init,
894 )
895 if (
896 test.test_session.sha1_key
897 and test.test_session.sha1_key.auth_type == BFDAuthType.meticulous_keyed_sha1
898 ):
899 test.test_session.inc_seq_num()
900 test.test_session.send_packet()
901 test.logger.info("BFD: Waiting for event")
902 e = test.vapi.wait_for_event(1, "bfd_udp_session_event")
903 verify_event(test, e, expected_state=BFDState.up)
904 test.logger.info("BFD: Session is Up")
905 test.test_session.update(state=BFDState.up)
906 if (
907 test.test_session.sha1_key
908 and test.test_session.sha1_key.auth_type == BFDAuthType.meticulous_keyed_sha1
909 ):
910 test.test_session.inc_seq_num()
911 test.test_session.send_packet()
912 test.assert_equal(test.vpp_session.state, BFDState.up, BFDState)
913
914
915def bfd_session_down(test):

Calls 7

wait_for_bfd_packetFunction · 0.85
verify_eventFunction · 0.85
inc_seq_numMethod · 0.80
wait_for_eventMethod · 0.80
updateMethod · 0.45
send_packetMethod · 0.45
assert_equalMethod · 0.45

Tested by

no test coverage detected