The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Net::BGP::RIBEntry - Class representing an entry in a BGP RIB

SYNOPSIS

    use Net::BGP::RIBEntry;

    # Constructor
    $entry = new Net::BGP::RIBEntry(
        Prefix          => '10.0.0.1'
    );

    # Object Copy
    $clone = $entry->clone();

    # Accessor Methods
    $entry->add_peer($peer,$dir);
    $entry->remove_peer($peer,$dir);

    $entry           = $entry->update_in($peer,$nlri);
    $has_changed     = $entry->update_local($policy);
    $changes_hashref = $entry->update_out($policy);

    $has_changed     = $entry->handle_changes($policy)

    $prefix          = $entry->prefix($prefix);

    $nlri            = $entry->local;
    $nlri_hashref    = $entry->in;
    $nlri_hashref    = $entry->out;

    $string          = $entry->asstring;

DESCRIPTION

This module implement a class representing an entry in a BGP Routing Information Base. It stores the prefix that the entry represents as well as 3 categories of network layer reachability information (NLRI). Each NLRI is represented as an Net::BGP::NLRI object:

IN - An NLRI object for each peer that has sent an UPDATE regarding this prefix.
Local - The preferred of the policy processed available NLRIs from the IN RIB.
OUT - An NLRI object for each outgoing peer representing the processed Local NLRI.

CONSTRUCTOR

new() - create a new Net::BGP::RIBEntry object
    $entry = new Net::BGP::RIBEntry(
        Prefix          => '10.0.0.1'
    );

This is the constructor for Net::BGP::RIBEntry object. It returns a reference to the newly created object. The following named parameter may be passed to the constructor:

Prefix

This parameter corresponds to the prefix the RIB Entry represents.

OBJECT COPY

clone() - clone a Net::BGP::RIBEntry object
    $clone = $nlri->clone();

This method creates an exact copy of the Net::BGP::RIBEntry object.

ACCESSOR METHODS

add_peer()
remove_peer()

Both add_peer() and remove_peer() takes two arguments: The peer object and the direction of the peer (in or out).

update_in()

This method updates the RIB IN part of the object. The first argument is the peer object that received the BGP UPDATE message and the second argument is an NLRI object corresponding the received UPDATE message.

The method returns the RIBEntry object.

update_local()

This method applies the incoming policy and executes the route selection process of BGP. If no arguments (or a undefined value), no policy will be used. Otherwise the argument should be a Net::BGP::Policy object - or something inherited from that.

After applying the given policy, the selection process updates the Local RIB with the best available NLRI.

The return value is true if the Local RIB is changed, otherwise false.

update_out()

This method applies the outgoing policy to the Local RIB and updates the OUT RIB accordingly. If no arguments (or a undefined value), no policy will be used. Otherwise the argument should be a Net::BGP::Policy object - or something inherited from that.

handle_changes()

This method combines the update_local() and update_out() methods and generates UPDATE messages for each change and sends them to the peers. It takes a optional policy as first argument which are used in the calls to update_local() and update_out().

It returns -1 if no changes has happend. Otherwise it returns the number of changes send.

prefix()

This mothod returns the prefix the RIB Entry represent. It an argument is given, the prefix will be replaced with that value.

local()

This method returns the currently selected NLRI or undefined if no NLRIs are available.

in()
out()

Both the in() and out() method returns a reference to a hash indexed on peers containing Net::BGP::NLRI objects coresponding the the incoming or outgoing UPDATE message data.

asstring()

This method returns a print-friendly string describing the RIB entry.

SEE ALSO

Net::BGP, Net::BGP::RIB, Net::BGP::NLRI, Net::BGP::Update, Net::BGP::Policy

AUTHOR

Martin Lorensen <bgp@martin.lorensen.dk>