2.1. bfd module

BFD protocol implementation

class bfd.BFD(*args, **kwargs)

Bases: scapy.packet.Packet

BFD protocol layer for scapy

bfd_pkt_len = 24
fields_desc = [scapy.fields.BitField, scapy.fields.BitEnumField, scapy.fields.BitEnumField, scapy.fields.FlagsField, scapy.fields.XByteField, scapy.fields.BitField, scapy.fields.BitField, scapy.fields.BitField, scapy.fields.BitField, scapy.fields.BitField, scapy.fields.BitField, scapy.fields.ConditionalField, scapy.fields.ConditionalField, scapy.fields.ConditionalField, scapy.fields.ConditionalField, scapy.fields.ConditionalField, scapy.fields.ConditionalField, scapy.fields.ConditionalField]
mysummary()
name = 'BFD'
sha1_auth_len = 28
udp_dport = 3784

BFD destination port per RFC 5881

udp_dport_echo = 3785
udp_sport_max = 65535

BFD source port max value per RFC 5881

udp_sport_min = 49152

BFD source port min value per RFC 5881

class bfd.BFDAuthType(value)

Bases: util.NumericConstant

BFD Authentication Type

desc_dict = {0: 'No authentication', 1: 'Simple Password', 2: 'Keyed MD5', 3: 'Meticulous Keyed MD5', 4: 'Keyed SHA1', 5: 'Meticulous Keyed SHA1'}
keyed_md5 = 2
keyed_sha1 = 4
meticulous_keyed_md5 = 3
meticulous_keyed_sha1 = 5
no_auth = 0
simple_pwd = 1
class bfd.BFDDiagCode(value)

Bases: util.NumericConstant

BFD Diagnostic Code

administratively_down = 7
concatenated_path_down = 6
control_detection_time_expired = 1
desc_dict = {0: 'No diagnostic', 1: 'Control Detection Time Expired', 2: 'Echo Function Failed', 3: 'Neighbor Signaled Session Down', 4: 'Forwarding Plane Reset', 5: 'Path Down', 6: 'Concatenated Path Down', 7: 'Administratively Down', 8: 'Reverse Concatenated Path Down'}
echo_function_failed = 2
forwarding_plane_reset = 4
neighbor_signaled_session_down = 3
no_diagnostic = 0
path_down = 5
reverse_concatenated_path_down = 8
class bfd.BFDState(value)

Bases: util.NumericConstant

BFD State

admin_down = 0
desc_dict = {0: 'AdminDown', 1: 'Down', 2: 'Init', 3: 'Up'}
down = 1
init = 2
up = 3
class bfd.BFD_vpp_echo(*args, **kwargs)

Bases: scapy.packet.Packet

BFD echo packet as used by VPP (non-rfc, as rfc doesn’t define one)

fields_desc = [scapy.fields.BitField, scapy.fields.BitField, scapy.fields.BitField]
mysummary()
name = 'BFD_VPP_ECHO'
udp_dport = 3785

BFD echo destination port per RFC 5881

class bfd.VppBFDAuthKey(test, conf_key_id, auth_type, key)

Bases: vpp_object.VppObject

Represents BFD authentication key in VPP

add_vpp_config()

Add the configuration for this object to vpp.

auth_type

Authentication type for this key

conf_key_id

configuration key ID

get_bfd_auth_keys_dump_entry()

get the entry in the auth keys dump corresponding to this key

key

key data

object_id()

Return a unique string representing this object.

query_vpp_config()

Query the vpp configuration.

Returns

True if the object is configured

remove_vpp_config()

Remove the configuration for this object from vpp.

test

Test which created this key

class bfd.VppBFDUDPSession(test, interface, peer_addr, local_addr=None, af=<AddressFamily.AF_INET: 2>, desired_min_tx=300000, required_min_rx=300000, detect_mult=3, sha1_key=None, bfd_key_id=None)

Bases: vpp_object.VppObject

Represents BFD UDP session in VPP

activate_auth(key, bfd_key_id=None, delayed=False)

activate authentication for this session

add_vpp_config()

Add the configuration for this object to vpp.

admin_down()

set bfd session admin-down

admin_up()

set bfd session admin-up

af

Address family - AF_INET or AF_INET6

bfd_key_id

bfd key id in use

deactivate_auth(delayed=False)

deactivate authentication

desired_min_tx

desired minimum tx interval

detect_mult

detect multiplier

get_bfd_udp_session_dump_entry()

get the namedtuple entry from bfd udp session dump

interface

Interface on which this session lives

local_addr

BFD session local address (VPP address)

local_addr_n

BFD session local address (VPP address) - raw, suitable for API

modify_parameters(detect_mult=None, desired_min_tx=None, required_min_rx=None)

modify session parameters

object_id()

Return a unique string representing this object.

peer_addr

BFD session peer address

peer_addr_n

BFD session peer address - raw, suitable for API

query_vpp_config()

Query the vpp configuration.

Returns

True if the object is configured

remove_vpp_config()

Remove the configuration for this object from vpp.

required_min_rx

required minimum rx interval

sha1_key

sha1 key

state

BFD session state

test

Test which created this session

bfd.bfd_is_auth_used(pkt)

is packet authenticated?

bfd.bfd_is_md5_or_sha1_used(pkt)

is md5 or sha1 used?

bfd.bfd_is_md5_used(pkt)

is md5 authentication used?

bfd.bfd_is_sha1_used(pkt)

is sha1 authentication used?

bfd.bfd_is_simple_pwd_used(pkt)

is simple password authentication used?