![]() |
![]()
| ![]() |
![]()
NAME"Net::BGP::ASPath" - Class encapsulating BGP-4 AS Path information SYNOPSISuse 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) { ... }; DESCRIPTIONThis module encapsulates the data contained in a BGP-4 AS_PATH, including confederation extensions. CONSTRUCTOR
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 a 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
ACCESSOR METHODS
SEE ALSOAUTHORMartin Lorensen <bgp@martin.lorensen.dk>
|