BPDU

BPDU

Bridge Protocol Data Unit(BPDU, IEEE 802.1D) parser/serializer http://standards.ieee.org/getieee802/download/802.1D-2004.pdf

Configuration BPDUs format

Structure

Octet

Protocol Identifier = 0000 0000 0000 0000

1 - 2

Protocol Version Identifier = 0000 0000

3

BPDU Type = 0000 0000

4

Flags

5

Root Identifier
include - priority

system ID extension MAC address

6 - 13

Root Path Cost

14 - 17

Bridge Identifier
include - priority

system ID extension MAC address

18 - 25

Port Identifier
include - priority

port number

26 - 27

Message Age

28 - 29

Max Age

30 - 31

Hello Time

32 - 33

Forward Delay

34 - 35

Topology Change NotificationBPDUs format

Structure

Octet

Protocol Identifier = 0000 0000 0000 0000

1 - 2

Protocol Version Identifier = 0000 0000

3

BPDU Type = 1000 0000

4

Rapid Spanning Tree BPDUs(RST BPDUs) format

Structure

Octet

Protocol Identifier = 0000 0000 0000 0000

1 - 2

Protocol Version Identifier = 0000 0010

3

BPDU Type = 0000 0010

4

Flags

5

Root Identifier
include - priority

system ID extension MAC address

6 - 13

Root Path Cost

14 - 17

Bridge Identifier
include - priority

system ID extension MAC address

18 - 25

Port Identifier
include - priority

port number

26 - 27

Message Age

28 - 29

Max Age

30 - 31

Hello Time

32 - 33

Forward Delay

34 - 35

Version 1 Length = 0000 0000

36

class os_ken.lib.packet.bpdu.ConfigurationBPDUs(flags=0, root_priority=32768, root_system_id_extension=0, root_mac_address='00:00:00:00:00:00', root_path_cost=0, bridge_priority=32768, bridge_system_id_extension=0, bridge_mac_address='00:00:00:00:00:00', port_priority=128, port_number=0, message_age=0, max_age=20, hello_time=2, forward_delay=15)

Configuration BPDUs(IEEE 802.1D) header encoder/decoder class.

An instance has the following attributes at least. Most of them are same to the on-wire counterparts but in host byte order. __init__ takes the corresponding args in this order.

Attribute

Description

flags

Bit 1: Topology Change flag
Bits 2 through 7: unused and take the value 0
Bit 8: Topology Change Acknowledgment flag

root_priority

Root Identifier priority set 0-61440 in steps of 4096

root_system_id_extension

Root Identifier system ID extension

root_mac_address

Root Identifier MAC address

root_path_cost

Root Path Cost

bridge_priority

Bridge Identifier priority set 0-61440 in steps of 4096

bridge_system_id_extension

Bridge Identifier system ID extension

bridge_mac_address

Bridge Identifier MAC address

port_priority

Port Identifier priority set 0-240 in steps of 16

port_number

Port Identifier number

message_age

Message Age timer value

max_age

Max Age timer value

hello_time

Hello Time timer value

forward_delay

Forward Delay timer value

classmethod parser(buf)

Decode a protocol header.

This method is used only when decoding a packet.

Decode a protocol header at offset 0 in bytearray buf. Returns the following three objects.

  • An object to describe the decoded header.

  • A packet_base.PacketBase subclass appropriate for the rest of the packet. None when the rest of the packet should be considered as raw payload.

  • The rest of packet.

serialize(payload, prev)

Encode a protocol header.

This method is used only when encoding a packet.

Encode a protocol header. Returns a bytearray which contains the header.

payload is the rest of the packet which will immediately follow this header.

prev is a packet_base.PacketBase subclass for the outer protocol header. prev is None if the current header is the outer-most. For example, prev is ipv4 or ipv6 for tcp.serialize.

class os_ken.lib.packet.bpdu.RstBPDUs(flags=0, root_priority=32768, root_system_id_extension=0, root_mac_address='00:00:00:00:00:00', root_path_cost=0, bridge_priority=32768, bridge_system_id_extension=0, bridge_mac_address='00:00:00:00:00:00', port_priority=128, port_number=0, message_age=0, max_age=20, hello_time=2, forward_delay=15)

Rapid Spanning Tree BPDUs(RST BPDUs, IEEE 802.1D) header encoder/decoder class.

An instance has the following attributes at least. Most of them are same to the on-wire counterparts but in host byte order. __init__ takes the corresponding args in this order.

Attribute

Description

flags

Bit 1: Topology Change flag
Bit 2: Proposal flag
Bits 3 and 4: Port Role
Bit 5: Learning flag
Bit 6: Forwarding flag
Bit 7: Agreement flag
Bit 8: Topology Change Acknowledgment flag

root_priority

Root Identifier priority set 0-61440 in steps of 4096

root_system_id_extension

Root Identifier system ID extension

root_mac_address

Root Identifier MAC address

root_path_cost

Root Path Cost

bridge_priority

Bridge Identifier priority set 0-61440 in steps of 4096

bridge_system_id_extension

Bridge Identifier system ID extension

bridge_mac_address

Bridge Identifier MAC address

port_priority

Port Identifier priority set 0-240 in steps of 16

port_number

Port Identifier number

message_age

Message Age timer value

max_age

Max Age timer value

hello_time

Hello Time timer value

forward_delay

Forward Delay timer value

classmethod parser(buf)

Decode a protocol header.

This method is used only when decoding a packet.

Decode a protocol header at offset 0 in bytearray buf. Returns the following three objects.

  • An object to describe the decoded header.

  • A packet_base.PacketBase subclass appropriate for the rest of the packet. None when the rest of the packet should be considered as raw payload.

  • The rest of packet.

serialize(payload, prev)

Encode a protocol header.

This method is used only when encoding a packet.

Encode a protocol header. Returns a bytearray which contains the header.

payload is the rest of the packet which will immediately follow this header.

prev is a packet_base.PacketBase subclass for the outer protocol header. prev is None if the current header is the outer-most. For example, prev is ipv4 or ipv6 for tcp.serialize.

class os_ken.lib.packet.bpdu.TopologyChangeNotificationBPDUs

Topology Change Notification BPDUs(IEEE 802.1D) header encoder/decoder class.

classmethod parser(buf)

Decode a protocol header.

This method is used only when decoding a packet.

Decode a protocol header at offset 0 in bytearray buf. Returns the following three objects.

  • An object to describe the decoded header.

  • A packet_base.PacketBase subclass appropriate for the rest of the packet. None when the rest of the packet should be considered as raw payload.

  • The rest of packet.

class os_ken.lib.packet.bpdu.bpdu

Bridge Protocol Data Unit(BPDU) header encoder/decoder base class.

classmethod parser(buf)

Decode a protocol header.

This method is used only when decoding a packet.

Decode a protocol header at offset 0 in bytearray buf. Returns the following three objects.

  • An object to describe the decoded header.

  • A packet_base.PacketBase subclass appropriate for the rest of the packet. None when the rest of the packet should be considered as raw payload.

  • The rest of packet.

serialize(payload, prev)

Encode a protocol header.

This method is used only when encoding a packet.

Encode a protocol header. Returns a bytearray which contains the header.

payload is the rest of the packet which will immediately follow this header.

prev is a packet_base.PacketBase subclass for the outer protocol header. prev is None if the current header is the outer-most. For example, prev is ipv4 or ipv6 for tcp.serialize.

Creative Commons Attribution 3.0 License

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.