NAME
Net::BGP::Update - Class encapsulating BGP-4 UPDATE message
SYNOPSIS
use Net::BGP::Update qw( :origin );
# Constructor
$update = Net::BGP::Update->new(
NLRI => [ qw( 10/8 172.168/16 ) ],
Withdraw => [ qw( 192.168.1/24 172.10/16 192.168.2.1/32 ) ],
# For Net::BGP::NLRI
Aggregator => [ 64512, '10.0.0.1' ],
AsPath => [ 64512, 64513, 64514 ],
AtomicAggregate => 1,
Communities => [ qw( 64512:10000 64512:10001 ) ],
LocalPref => 100,
MED => 200,
NextHop => '10.0.0.1',
Origin => INCOMPLETE,
);
# Construction from a NLRI object:
$nlri = Net::BGP::NLRI->new( ... );
$update = Net::BGP::Update->new($nlri,$nlri_ref,$withdrawn_ref);
# Object Copy
$clone = $update->clone();
# Accessor Methods
$nlri_ref = $update->nlri($nlri_ref);
$withdrawn_ref = $update->withdrawn($withdrawn_ref);
$prefix_hash_ref = $update->ashash;
# Comparison
if ($update1 eq $update2) { ... }
if ($update1 ne $update2) { ... }
DESCRIPTION
This module encapsulates the data contained in a BGP-4 UPDATE message. It provides a constructor, and accessor methods for each of the message fields and well-known path attributes of an UPDATE. Whenever a Net::BGP::Peer sends an UPDATE message to its peer, it does so by passing a Net::BGP::Update object to the peer object's update() method. Similarly, when the peer receives an UPDATE message from its peer, the UPDATE callback is called and passed a reference to a Net::BGP::Update object. The callback function can then examine the UPDATE message fields by means of the accessor methods.
CONSTRUCTOR
new() - create a new Net::BGP::Update object
$update = Net::BGP::Update->new(
NLRI => [ qw( 10/8 172.168/16 ) ],
Withdraw => [ qw( 192.168.1/24 172.10/16 192.168.2.1/32 ) ],
# For Net::BGP::NLRI
Aggregator => [ 64512, '10.0.0.1' ],
AsPath => [ 64512, 64513, 64514 ],
AtomicAggregate => 1,
Communities => [ qw( 64512:10000 64512:10001 ) ],
LocalPref => 100,
MED => 200,
NextHop => '10.0.0.1',
Origin => INCOMPLETE,
);
This is the constructor for Net::BGP::Update objects. It returns a reference to the newly created object. The following named parameters may be passed to the constructor. See RFC 1771 for the semantics of each path attribute.
An alternative is to construct an object from a Net::BGP::NLRI object:
$nlri = Net::BGP::NLRI->new( ... );
$nlri_ref = [ qw( 10/8 172.168/16 ) ];
$withdrawn_ref = [ qw( 192.168.1/24 172.10/16 192.168.2.1/32 ) ];
$update = Net::BGP::Update->new($nlri,$nlri_ref,$withdrawn_ref);
The NLRI object will not be modified in any way.
NLRI
This parameter corresponds to the Network Layer Reachability Information (NLRI) field of an UPDATE message. It represents the route(s) being advertised in this particular UPDATE. It is expressed as an array reference of route prefixes which are encoded in a special format as perl strings: XXX.XXX.XXX.XXX/XX. The part preceding the slash is a dotted-decimal notation IP prefix. Only as many octets as are significant according to the mask need to be specified. The part following the slash is the mask which is an integer in the range [0,32] which indicates how many bits are significant in the prefix. At least one of either the NLRI or Withdraw parameters is mandatory and must always be provided to the constructor.
Withdraw
This parameter corresponds to the Withdrawn Routes field of an UPDATE message. It represents route(s) advertised by a previous UPDATE message which are now being withdrawn by this UPDATE. It is expressed in the same way as the NLRI parameter. At least one of either the NLRI or Withdraw parameters is mandatory and must always be provided to the constructor.
OBJECT COPY
clone() - clone a Net::BGP::Update object
$clone = $update->clone();
This method creates an exact copy of the Net::BGP::Update object, with Withdrawn Routes, Path Attributes, and NLRI fields matching those of the original object. This is useful for propagating a modified UPDATE message when the original object needs to remain unchanged.
ACCESSOR METHODS
nlri()
withdrawn()
These accessor methods return the value(s) of the associated UPDATE message field if called with no arguments. If called with arguments, they set the associated field. The representation of parameters and return values is the same as described for the corresponding named constructor parameters above.
ashash()
This method returns a hash reference index on the prefixes in found in the nlri and withdrawn fields. Withdrawn networks has undefined as value, while nlri prefixes all has the same reference to a Net::BGP::NLRI object matching the Update object self.
EXPORTS
The module does not export anything.
SEE ALSO
RFC 1771, RFC 1997, Net::BGP, Net::BGP::Process, Net::BGP::Peer, Net::BGP::Notification, Net::BGP::NLRI
AUTHOR
Stephen J. Scheck <sscheck@cpan.org>