# BMP

BGP Monitoring Protocol draft-ietf-grow-bmp-07

class `ryu.lib.packet.bmp.``BMPInitiation`(info, type_=4, len_=None, version=3)

  BMP Initiation Message

  Attribute | Description
  --- | ---
  version | Version. this packet lib defines BMP ver. 3
  len | Length field. Ignored when encoding.
  type | Type field. one of BMP_MSG_ constants.
  info | One or more piece of information encoded as a TLV

  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 `ryu.lib.packet.bmp.``BMPMessage`(type_, len_=None, version=3)

  Base class for BGP Monitoring Protocol messages.

  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
  --- | ---
  version | Version. this packet lib defines BMP ver. 3
  len | Length field. Ignored when encoding.
  type | Type field. one of BMP_MSG_ constants.

  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`()

    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 `ryu.lib.packet.bmp.``BMPPeerDownNotification`(reason, data, peer_type, is_post_policy, peer_distinguisher, peer_address, peer_as, peer_bgp_id, timestamp, version=3, type_=2, len_=None)

  BMP Peer Down Notification Message

  Attribute | Description
  --- | ---
  version | Version. this packet lib defines BMP ver. 3
  len | Length field. Ignored when encoding.
  type | Type field. one of BMP_MSG_ constants.
  reason | Reason indicates why the session was closed.
  data | vary by the reason.

  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 `ryu.lib.packet.bmp.``BMPPeerMessage`(peer_type, is_post_policy, peer_distinguisher, peer_address, peer_as, peer_bgp_id, timestamp, version=3, type_=None, len_=None)

  BMP Message with Per Peer Header

  Following BMP Messages contain Per Peer Header after Common BMP Header.

  - BMP_MSG_TYPE_ROUTE_MONITRING
  - BMP_MSG_TYPE_STATISTICS_REPORT
  - BMP_MSG_PEER_UP_NOTIFICATION

  Attribute | Description
  --- | ---
  version | Version. this packet lib defines BMP ver. 3
  len | Length field. Ignored when encoding.
  type | Type field. one of BMP_MSG_ constants.
  peer_type | The type of the peer.
  is_post_policy | Indicate the message reflects the post-policy Adj-RIB-In
  peer_distinguisher | Use for L3VPN router which can have multiple instance.
  peer_address | The remote IP address associated with the TCP session.
  peer_as | The Autonomous System number of the peer.
  peer_bgp_id | The BGP Identifier of the peer
  timestamp | The time when the encapsulated routes were received.

  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 `ryu.lib.packet.bmp.``BMPPeerUpNotification`(local_address, local_port, remote_port, sent_open_message, received_open_message, peer_type, is_post_policy, peer_distinguisher, peer_address, peer_as, peer_bgp_id, timestamp, version=3, type_=3, len_=None)

  BMP Peer Up Notification Message

  Attribute | Description
  --- | ---
  version | Version. this packet lib defines BMP ver. 3
  len | Length field. Ignored when encoding.
  type | Type field. one of BMP_MSG_ constants.
  peer_type | The type of the peer.
  peer_flags | Provide more information about the peer.
  peer_distinguisher | Use for L3VPN router which can have multiple instance.
  peer_address | The remote IP address associated with the TCP session.
  peer_as | The Autonomous System number of the peer.
  peer_bgp_id | The BGP Identifier of the peer
  timestamp | The time when the encapsulated routes were received.
  local_address | The local IP address associated with the peering TCP session.
  local_port | The local port number associated with the peering TCP session.
  remote_port | The remote port number associated with the peering TCP session.
  sent_open_message | The full OPEN message transmitted by the monitored router to its peer.
  received_open_message | The full OPEN message received by the monitored router from its peer.

  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 `ryu.lib.packet.bmp.``BMPRouteMonitoring`(bgp_update, peer_type, is_post_policy, peer_distinguisher, peer_address, peer_as, peer_bgp_id, timestamp, version=3, type_=0, len_=None)

  BMP Route Monitoring Message

  Attribute | Description
  --- | ---
  version | Version. this packet lib defines BMP ver. 3
  len | Length field. Ignored when encoding.
  type | Type field. one of BMP_MSG_ constants.
  peer_type | The type of the peer.
  peer_flags | Provide more information about the peer.
  peer_distinguisher | Use for L3VPN router which can have multiple instance.
  peer_address | The remote IP address associated with the TCP session.
  peer_as | The Autonomous System number of the peer.
  peer_bgp_id | The BGP Identifier of the peer
  timestamp | The time when the encapsulated routes were received.
  bgp_update | BGP Update PDU

  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 `ryu.lib.packet.bmp.``BMPStatisticsReport`(stats, peer_type, is_post_policy, peer_distinguisher, peer_address, peer_as, peer_bgp_id, timestamp, version=3, type_=1, len_=None)

  BMP Statistics Report Message

  Attribute | Description
  --- | ---
  version | Version. this packet lib defines BMP ver. 3
  len | Length field. Ignored when encoding.
  type | Type field. one of BMP_MSG_ constants.
  peer_type | The type of the peer.
  peer_flags | Provide more information about the peer.
  peer_distinguisher | Use for L3VPN router which can have multiple instance.
  peer_address | The remote IP address associated with the TCP session.
  peer_as | The Autonomous System number of the peer.
  peer_bgp_id | The BGP Identifier of the peer
  timestamp | The time when the encapsulated routes were received.
  stats | Statistics (one or more stats encoded as a TLV)

  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 `ryu.lib.packet.bmp.``BMPTermination`(info, type_=5, len_=None, version=3)

  BMP Termination Message

  Attribute | Description
  --- | ---
  version | Version. this packet lib defines BMP ver. 3
  len | Length field. Ignored when encoding.
  type | Type field. one of BMP_MSG_ constants.
  info | One or more piece of information encoded as a TLV

  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.