GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  NET::BGP::ASPATH (3)

.ds Aq ’

NAME

Net::BGP::ASPath - Class encapsulating BGP-4 AS Path information

CONTENTS

SYNOPSIS



    use Net::BGP::ASPath;

    # Constructor
    $aspath  = Net::BGP::ASPath->new(undef, { as4 => 1 });
    $aspath2 = Net::BGP::ASPath->new([65001,65002]);
    $aspath3 = Net::BGP::ASPath->new("(65001 65002) 65010");
    $aspath4 = Net::BGP::ASPath->new("65001 {65011,65010}");

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

    # Modifiers;
    $aspath  = $aspath->prepend(64999);
    $aspath  = $aspath->prepend("64999 65998");
    $aspath  = $aspath->prepend([64999,65998]);

    $aspath  = $aspath->prepend("(64999 65998)");
    $aspath  = $aspath->prepend_confed("64999 65998");

    $aspath += "65001 65002";    # Same as $aspath->prepend("65001 65002")

    $aspath5 = $aspath->striped; # New object
    $aspath  = $aspath->strip;   # Same modified

    $aspath  = $aspath->cleanup  # Same modified

    # Aggregation
    $aspath  = $aspath1->aggregate($aspath2,$aspath3);
    $aspath  = Net::BGP::ASPath->aggregate($aspath1,$aspath2,$aspath3);


    # Accessor Methods
    $length    = $aspath->length;
    $string    = $aspath->as_string;
    $array_ref = $aspath->asarray

    # In context
    $string    = "The AS path is: " . $aspath;
    $firstas   = $aspath[0];

    # Length comparisons
    if ($aspath < $aspath2) { ... };
    if ($aspath > $aspath2) { ... };
    if ($aspath == $aspath2) { ... };
    if ($aspath != $aspath2) { ... };
    @sorted = sort { $a <=> $b } ($aspath, $aspath2, $aspath3, $aspath4);

    # Path comparisons
    if ($aspath eq $aspath2) { ... };
    if ($aspath ne $aspath2) { ... };



DESCRIPTION

This module encapsulates the data contained in a BGP-4 AS_PATH, inluding confederation extentions.

CONSTRUCTOR

new() - create a new Net::BGP::ASPath object


    $aspath = Net::BGP::ASPath->new( PATHDATA, OPTIONS );



This is the constructor for Net::BGP::ASPath objects. It returns a reference to the newly created object. The first parameter may be either:
ARRAY_REF An array ref containing AS numbers inteperted as an AS_PATH_SEQUENCE.
SCALAR A string with AS numbers seperated by spaces (AS_PATH_SEQUANCE). AS_PATH_SETs is written using {} with , to seperate AS numbers. AS_PATH_CONFED_* is writen equally, but encapsulated in ().
Net::BGP::ASPath Another ASPath object, in which case a clone is constructed.
undef This will create the ASPath object with empty contents

Following the PATHDATA, the OPTIONS may be specified. Currently the only valid option is c<as4>, which, if true, builds ASPath objects usable for talking to an peer that supports 32 bit ASNs. False, or the default value, assumes that the peer does not support 32 bit ASNs, which affects the decode routines. Note that the encode routines are not dependent upon this option.

Basically, if as4 is true, AS_PATH is populated from messages assuming 4 byte ASNs and AS4_PATH is not used. Encoded AS_PATH attributes also assume a 4 byte ASN.

If as4 is false, AS_PATH is populated from messages assuming 2 byte ASNs, and, if available, AS4_PATH is used to replace occurences of 23456 when possible when outputing to user-readable formats. Encoding routines will also allow output of AS4_PATH objects when appropriate.

OBJECT COPY

clone() - clone a Net::BGP::ASPath object


    $clone = $aspath->clone();



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

ACCESSOR METHODS

length() Return the path-length used in BGP path selection. This is the sum of the lengths of all AS_PATH elements. This does however not include AS_PATH_CONFED_* elements and AS_SEGMENTS count as one BGP hop.
as_string() Returns the path as a string in same notation as the constructor accept.
cleanup() Reduce the path by removing meaningless AS_PATH elements (empty sets or sequences) and joining neighbour elements of same _SET type.
strip() Strips AS_CONFED_* segments from the path.
striped() Returns a strip() ’ed clone() of the path.
prepend(ARRAY)
prepend(SCALAR) Strips AS_CONFED_* segments from the path and prepends one or more AS numbers to the path as given as arguments, either as an array of AS numbers or as a string with space seperated AS numbers. If string has () arround, prepend_confed will be used instead.
prepend_confed(ARRAY)
prepend_confed(SCALAR) Prepends one or more confederation AS numbers to the path as given as arguments, either as an array of AS numbers or as a string with space seperated AS numbers. () arround the string is ignored.
aggregate(ASPath)
aggregate(ARRAY) Aggregates the current ASPath with the ASPath(s) given as argument. If invoked as class method, aggregate all ASPaths given as argument.

To aggregate means to find the longest common substring (of the paths of all objects that should be aggregated) and keep them, but replacing the non-common substrings with AS_SET segments. Currently only the longest common normal and confederation head will be found and the remaing will be left as an AS_SET and AS_CONFED_SET.

Returns the aggregated object. The objects self are not modified.

SEE ALSO

<B>RFC 1771B>, <B>RFC 1997B>, Net::BGP, Net::BGP::Process, Net::BGP::Peer, Net::BGP::Notification, Net::BGP::NLRI, Net::BGP::Update

AUTHOR

Martin Lorensen <bgp@martin.lorensen.dk>
Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 NET::BGP::ASPATH (3) 2015-01-27

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.