BGPmon::Translator::XFB2PerlHash::Simple - a clean interface to extract commonly-used information from XFB messages.
use BGPmon::Translator::XFB2PerlHash::Simple;
print get_error_msg('init') if !init('/XML/MESSAGE/TO/PARSE');
my $scalar_result = get_timestamp();
print $scalar_result;
my @array_result = get_nlri();
do_something() foreach my $nlri (@array_result)...
my $hash_ref_result = get_peering();
print $hash_ref_result-{'element'}-{'subelement'}-{'attribute'};
init get_timestamp get_dateTime get_nlri get_mp_nlri get_withdrawn get_mp_withdrawn get_peering get_origin get_as_path get_as4_path get_next_hop get_mp_next_hop get_xml_string get_xml_message_type
This function takes an XML message to be translated and internally converts it to an appropriate data structure for querying.
Input: The message to be translated Output: 1 on success, 0 on failure
Returns the UNIX timestamp from an XFB message as a scalar.
Returns a human-readable, scalar version of the timestamp of an XFB message.
Returns an array of hashes. Each of these hashes are structured like so:
{ 'SAFI' = { 'value' = '1', 'content' = 'UNICAST' }, 'AFI' = { 'value' = '1', 'content' = 'IPV4' }, 'ADDRESS' = { 'content' = '192.168.0.0/16' }
}
Returns an array of hashes which contain an AFI,SAFI,and announced prefix. These hashes are structured just like the ones described in the documentation for get_nlri().
Returns an array of hashes which contain an AFI,SAFI,and withdrawn IPv4 prefix. These hashes are structured just like the ones described in the documentation for get_nlri().
Returns an array of hashes which contain an AFI,SAFI,and withdrawn prefix. These hashes are structured just like the ones described in the documentation for get_nlri().
Returns a hash reference that contains information about the BGP peering session that the message was received from. To see its contents, check the XFB specification or use Data::Dumper.
Returns the stringified origin of the BGP message. Defined values are given in the XFB specification.
Returns an array of hashes that contains the AS path attribute of the message. Each hash represents a single AS Segment, which can be either an AS_SEQUENCE or AS_SET. Each AS_SEG has an AS subarray that contains the ASNs for that segment.
Returns the 4-byte AS path, if present.
Returns a scalar IPv4 address in dotted-decimal notation as given in the next hop attribute.
Returns an array of hashes with the next hop(s) from the MP_REACH attribute.
Ex: my @ret = get_mp_next_hop(); print my $addr-{'ADDRESS'}-{'content'} foreach $addr (@ret);
Returns the raw XML string passed into init
Returns a string that contains the type of the BGP_MESSAGE.
Ex: my $type = get_xml_message_type();
Get the error code
Input : the name of the function whose error code we should report
Output: the function's error code or NO_FUNCTION_SPECIFIED if the user did not supply a function or INVALID_FUNCTION_SPECIFIED if the user provided an invalid function
Get the error message
Input : the name of the function whose error message we should report
Output: the function's error message or NO_FUNCTION_SPECIFIED if the user did not supply a function or INVALID_FUNCTION_SPECIFIED if the user provided an invalid function
This function is identical to get_error_message
Jason Bartlett, <bartletj at cs.colostate.edu>
<bartletj at cs.colostate.edu>
Please report any bugs or feature requests to bgpmon at netsec.colostate.edu, or through the web interface at http://bgpmon.netsec.colostate.edu.
bgpmon at netsec.colostate.edu
You can find documentation for this module with the perldoc command.
perldoc BGPmon::Translator::XFB2PerlHash::Simple
Copyright (c) 2012 Colorado State University
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\ File: Simple.pm Authors: Jason Bartlett Date: 17 July 2012
To install BGPmon::Log, copy and paste the appropriate command in to your terminal.
cpanm
cpanm BGPmon::Log
CPAN shell
perl -MCPAN -e shell install BGPmon::Log
For more information on module installation, please visit the detailed CPAN module installation guide.