Class BmpPeer
- java.lang.Object
-
- org.onlab.packet.BasePacket
-
- org.onlab.packet.bmp.BmpPeer
-
- All Implemented Interfaces:
IPacket
public class BmpPeer extends BasePacket
The per-peer header follows the common header for most BMP messages. The rest of the data in a BMP message is dependent on the Message Type field in the common header.Peer Type (1 byte): Identifies the type of peer. Currently, three types of peers are identified:
* Peer Type = 0: Global Instance Peer * Peer Type = 1: RD Instance Peer * Peer Type = 2: Local Instance Peer
o Peer Flags (1 byte): These flags provide more information about the peer. The flags are defined as follows:
0 1 2 3 4 5 6 7 +-+-+-+-+-+-+-+-+ |V|L|A| Reserved| +-+-+-+-+-+-+-+-+
* The V flag indicates that the Peer address is an IPv6 address. For IPv4 peers, this is set to 0.
The L flag, if set to 1, indicates that the message reflects the post-policy Adj-RIB-In (i.e., its path attributes reflect the application of inbound policy). It is set to 0 if the message reflects the pre-policy Adj-RIB-In. Locally sourced routes also carry an L flag of 1. See Section 5 for further detail. This flag has no significance when used with route mirroring messages.
* The A flag, if set to 1, indicates that the message is formatted using the legacy 2-byte AS_PATH format. If set to 0, the message is formatted using the 4-byte AS_PATH format [RFC6793]. A BMP speaker MAY choose to propagate the AS_PATH information as received from its peer, or it MAY choose to reformat all AS_PATH information into a 4-byte format regardless of how it was received from the peer. In the latter case, AS4_PATH or AS4_AGGREGATOR path attributes SHOULD NOT be sent in the BMP UPDATE message. This flag has no significance when used with route mirroring messages.
The remaining bits are reserved for future use. They MUST be transmitted as 0 and their values MUST be ignored on receipt.
Peer Distinguisher (8 bytes): Routers today can have multiple instances (example: Layer 3 Virtual Private Networks (L3VPNs) [RFC4364]). This field is present to distinguish peers that belong to one address domain from the other.
If the peer is a "Global Instance Peer", this field is zero- filled. If the peer is a "RD Instance Peer", it is set to the route distinguisher of the particular instance the peer belongs to. If the peer is a "Local Instance Peer", it is set to a unique, locally defined value. In all cases, the effect is that the combination of the Peer Type and Peer Distinguisher is sufficient to disambiguate peers for which other identifying information might overlap.
Peer Address: The remote IP address associated with the TCP session over which the encapsulated PDU was received. It is 4 bytes long if an IPv4 address is carried in this field (with the 12 most significant bytes zero-filled) and 16 bytes long if an IPv6 address is carried in this field.
Peer AS: The Autonomous System number of the peer from which the encapsulated PDU was received. If a 16-bit AS number is stored in this field [RFC6793], it should be padded with zeroes in the 16 most significant bits.
Timestamp: The time when the encapsulated routes were received (one may also think of this as the time when they were installed in the Adj-RIB-In), expressed in seconds and microseconds since midnight (zero hour), January 1, 1970 (UTC). If zero, the time is unavailable. Precision of the timestamp is implementation- dependent.
4.3. Initiation Message
The initiation message provides a means for the monitored router to inform the monitoring station of its vendor, software version, and so on. An initiation message MUST be sent as the first message after the TCP session comes up. An initiation message MAY be sent at any point thereafter, if warranted by a change on the monitored router.
The initiation message consists of the common BMP header followed by two or more Information TLVs containing information about the monitored router. The sysDescr and sysName Information TLVs MUST be sent, any others are optional. The string TLV MAY be included multiple times.
-
-
Field Summary
Fields Modifier and Type Field Description protected byte
flags
static short
IPV4_ADDRSZ
static short
IPV6_ADDRSZ
protected int
microseconds
static short
PEER_DISTINGUISHER
static short
PEER_HEADER_MINIMUM_LENGTH
protected InetAddress
peerAddress
protected int
peerAs
protected int
peerBgpId
protected byte[]
peerDistinguisher
protected int
seconds
protected byte
type
-
Fields inherited from class org.onlab.packet.BasePacket
parent, payload
-
-
Constructor Summary
Constructors Constructor Description BmpPeer()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Deserializer<BmpPeer>
deserializer()
boolean
equals(Object obj)
byte
getFlag()
Returns Peer Flag.InetAddress
getIntAddress()
Returns Peer IP Address.int
getMicroseconds()
Returns timestamp in micro second.int
getPeerAs()
Returns Peer Autonomous System number.int
getPeerBgpId()
Returns Peer Bgp Id.byte[]
getPeerDistinguisher()
Returns Peer Distinguisher.int
getSeconds()
Returns timestamp in sec.byte
getType()
Returns Peer Type.int
hashCode()
byte[]
serialize()
Sets all payloads parent packet if applicable, then serializes this packet and all payloads.String
toString()
-
Methods inherited from class org.onlab.packet.BasePacket
clone, getParent, getPayload, resetChecksum, setParent, setPayload
-
-
-
-
Field Detail
-
PEER_HEADER_MINIMUM_LENGTH
public static final short PEER_HEADER_MINIMUM_LENGTH
- See Also:
- Constant Field Values
-
PEER_DISTINGUISHER
public static final short PEER_DISTINGUISHER
- See Also:
- Constant Field Values
-
IPV4_ADDRSZ
public static final short IPV4_ADDRSZ
- See Also:
- Constant Field Values
-
IPV6_ADDRSZ
public static final short IPV6_ADDRSZ
- See Also:
- Constant Field Values
-
type
protected byte type
-
flags
protected byte flags
-
peerDistinguisher
protected byte[] peerDistinguisher
-
peerAddress
protected InetAddress peerAddress
-
peerAs
protected int peerAs
-
peerBgpId
protected int peerBgpId
-
seconds
protected int seconds
-
microseconds
protected int microseconds
-
-
Method Detail
-
getType
public byte getType()
Returns Peer Type.- Returns:
- the peer type
-
getFlag
public byte getFlag()
Returns Peer Flag.- Returns:
- the peer flag
-
getPeerDistinguisher
public byte[] getPeerDistinguisher()
Returns Peer Distinguisher.- Returns:
- the peer distingusiher
-
getIntAddress
public InetAddress getIntAddress()
Returns Peer IP Address.- Returns:
- the peer ip address
-
getPeerAs
public int getPeerAs()
Returns Peer Autonomous System number.- Returns:
- the peer AS number
-
getPeerBgpId
public int getPeerBgpId()
Returns Peer Bgp Id.- Returns:
- the bgp id
-
getSeconds
public int getSeconds()
Returns timestamp in sec.- Returns:
- the timestamp in sec
-
getMicroseconds
public int getMicroseconds()
Returns timestamp in micro second.- Returns:
- the timestamp in micro second
-
serialize
public byte[] serialize()
Description copied from interface:IPacket
Sets all payloads parent packet if applicable, then serializes this packet and all payloads.- Returns:
- a byte[] containing this packet and payloads
-
deserializer
public static Deserializer<BmpPeer> deserializer()
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classBasePacket
-
equals
public boolean equals(Object obj)
- Overrides:
equals
in classBasePacket
-
-