BGPmon-core-2

 view release on metacpan or  search on metacpan

lib/BGPmon/Fetch/Archive.pm  view on Meta::CPAN

'connection_duration');

use constant NO_ERROR_CODE => 0;
use constant NO_ERROR_MSG => 'No Error';
use constant UNDEFINED_ARGUMENT_CODE => 401;
use constant UNDEFINED_ARGUMENT_MSG => 'Undefined Argument(s)';
use constant UNCONNECTED_CODE => 402;
use constant UNCONNECTED_MSG => 'Not connected to an archive';
use constant ALREADY_CONNECTED_CODE => 403;
use constant ALREADY_CONNECTED_MSG => 'Already connected to an archive';
use constant NO_INDEX_PAGE_CODE => 404;
use constant NO_INDEX_PAGE_MSG => 'Unable to find an index page';
use constant SYSCALL_FAIL_CODE => 405;
use constant SYSCALL_FAIL_MSG => 'System call failed';
use constant INVALID_ARGUMENT_CODE => 406;
use constant INVALID_ARGUMENT_MSG => 'Invalid value given for argument';
use constant INIT_FAIL_CODE => 407;
use constant INIT_FAIL_MSG => 'Failed to initialize connection to archive';
use constant FILE_OPERATION_FAIL_CODE => 408;
use constant FILE_OPERATION_FAIL_MSG => 'File operation failed';
use constant DOWNLOAD_FAIL_CODE => 409;

lib/BGPmon/Fetch/Archive.pm  view on Meta::CPAN


    401:    A subroutine was missing an expected argument
            'Undefined Argument(s)'

    402:    There is no active connection to an archive
            'Not connected to an archive'

    403:    There is a currently-active connection to an archive
            'Already connected to an archive'

    404:    The module was unable to find an HTML index page
                or any download links on the index page
            'Unable to find an index page'

    405:    A system call failed
            'System call failed'

    406:    An invalid value was passed to a subroutine as an argument
            'Invalid value given for argument'

    407:    The connection could not be initialized, either by a failure

t/04-bgpmon-translator-xfb2bgpdump.t  view on Meta::CPAN

our $bgp_msg_9_description = "AFI of 1 announced prefix set to IPV6";#TODO
our @bgp_msg_9_bgpdump = ("BGP4MP|1336075235|A|187.16.217.104|613|84.205.74.0/24|262757 16735 3549 3257 12637 12654");
our $bgp_msg_9 = '<BGP_MONITOR_MESSAGE xmlns:xsi="http://www.w3.org/2001/XMLSchema" xmlns="urn:ietf:params:xml:ns:bgp_monitor" xmlns:bgp="urn:ietf:params:xml:ns:xfb" xmlns:ne="urn:ietf:params:xml:ns:network_elements"><SOURCE><ADDRESS afi="1">164.128....

our $bgp_msg_11_description = "Valid XML: Table dump message";
our @bgp_msg_11_bgpdump = ("TABLE_DUMP2|1380322461|A|213.248.80.244|1299|93.190.10.0/24|1299 3356 20485 9198 43994 47254");
our $bgp_msg_11 = '<BGP_MONITOR_MESSAGE xmlns:xsi="http://www.w3.org/2001/XMLSchema" xmlns="urn:ietf:params:xml:ns:bgp_monitor" xmlns:bgp="urn:ietf:params:xml:ns:xfb" xmlns:ne="urn:ietf:params:xml:ns:network_elements"><SOURCE><ADDRESS afi="1">213.248...

our $bgp_msg_12_description = "Valid XML: IPv6 MP_REACH message";
our @bgp_msg_12_bgpdump = ("BGP4MP|1380586060|A|2001:1620:1::203|13030|2a00:7540::/48|13030 6939 31692 31692 41938 8359 8359 41938 31692 57401");
our $bgp_msg_12 = '<BGP_MONITOR_MESSAGE xmlns:xsi="http://www.w3.org/2001/XMLSchema" xmlns="urn:ietf:params:xml:ns:bgp_monitor" xmlns:bgp="urn:ietf:params:xml:ns:xfb" xmlns:ne="urn:ietf:params:xml:ns:network_elements"><SOURCE><ADDRESS afi="2">2001:16...

our $bgp_msg_13_description = "Valid XML: IPv6 MP_UNREACH message";
our @bgp_msg_13_bgpdump = ('BGP4MP|1380586081|W|2001:470:0:1a::1|6939|2408:8056:4f00::/40',
                           'BGP4MP|1380586081|W|2001:470:0:1a::1|6939|2408:8ffe::/32',
                           'BGP4MP|1380586081|W|2001:470:0:1a::1|6939|100::/1');
our $bgp_msg_13 = '<BGP_MONITOR_MESSAGE xmlns:xsi="http://www.w3.org/2001/XMLSchema" xmlns="urn:ietf:params:xml:ns:bgp_monitor" xmlns:bgp="urn:ietf:params:xml:ns:xfb" xmlns:ne="urn:ietf:params:xml:ns:network_elements"><SOURCE><ADDRESS afi="2">2001:47...

# Test for complete xml message.
my $out = translate_message();
ok (!defined($out), "Testing for complete XML correct output return.");

t/05-bgpmon-translator-xfb2perlhash-simpler.t  view on Meta::CPAN

}



##Messages for all tests
my $blankMsg = '<BGP_MONITOR_MESSAGE xmlns:xsi="http://www.w3.org/2001/XMLSchema" xmlns="urn:ietf:params:xml:ns:bgp_monitor" xmlns:bgp="urn:ietf:params:xml:ns:xfb" xmlns:ne="urn:ietf:params:xml:ns:network_elements"><SOURCE><ADDRESS afi="2">2402:7400:...



#Testing NLRI Message Parsing
my $nlriMsg = '<BGP_MONITOR_MESSAGE xmlns:xsi="http://www.w3.org/2001/XMLSchema" xmlns="urn:ietf:params:xml:ns:bgp_monitor" xmlns:bgp="urn:ietf:params:xml:ns:xfb" xmlns:ne="urn:ietf:params:xml:ns:network_elements"><SOURCE><ADDRESS afi="1">129.250.1.2...

my $nlriMsg2 = '<BGP_MONITOR_MESSAGE xmlns:xsi="http://www.w3.org/2001/XMLSchema" xmlns="urn:ietf:params:xml:ns:bgp_monitor" xmlns:bgp="urn:ietf:params:xml:ns:xfb" xmlns:ne="urn:ietf:params:xml:ns:network_elements"><SOURCE><ADDRESS afi="1">129.250.1....


my $ret = BGPmon::Translator::XFB2PerlHash::Simpler::parse_xml_msg($nlriMsg);
is($ret, 0, "PARSE XML FOR NLRI");
my @nlris = BGPmon::Translator::XFB2PerlHash::Simpler::extract_nlri();
my $size = scalar @nlris;
is($size, 1, "NLRI_PARSING SINGLE SIZE");
is($nlris[0], '63.172.189.0/24', "NLRI SINGLE VALUE");


t/06-bgpmon-fetch-client.t  view on Meta::CPAN

	use Test::More;
}
else{
	use Test::More skip_all => "Only run for development";
	#use Test::More;
}



my $server = '127.0.0.1';
my $xml_msg = '<BGP_MONITOR_MESSAGE xmlns:xsi="http://www.w3.org/2001/XMLSchema" xmlns="urn:ietf:params:xml:ns:bgp_monitor" xmlns:bgp="urn:ietf:params:xml:ns:xfb" xmlns:ne="urn:ietf:params:xml:ns:network_elements"><SOURCE><ADDRESS afi="1">129.250.0.1...

sub server {
	my $p = shift;
	my $socket = new IO::Socket::INET (
    	LocalHost => '127.0.0.1',
   		LocalPort => $p,
		  Proto => 'tcp',
    	Listen => 5,
    	Reuse => 1,
	) or die "Error creating socket: $!";

t/bgpmon-fetch-dup-archiver-msg.xml  view on Meta::CPAN

<xml>
<ARCHIVER><TIME timestamp="1340136304" datetime="2012-06-19T20:05:04Z"/><EVENT cause="CREATE_NEW_FILE">OPENED</EVENT></ARCHIVER>
<ARCHIVER><TIME timestamp="1340136304" datetime="2012-06-19T20:05:04Z"/><EVENT cause="CREATE_NEW_FILE">OPENED</EVENT></ARCHIVER>
<BGP_MONITOR_MESSAGE xmlns:xsi="http://www.w3.org/2001/XMLSchema" xmlns="urn:ietf:params:xml:ns:bgp_monitor" xmlns:bgp="urn:ietf:params:xml:ns:xfb" xmlns:ne="urn:ietf:params:xml:ns:network_elements"><SOURCE><ADDRESS afi="1">133.205.1.142</ADDRESS><PO...
<BGP_MONITOR_MESSAGE xmlns:xsi="http://www.w3.org/2001/XMLSchema" xmlns="urn:ietf:params:xml:ns:bgp_monitor" xmlns:bgp="urn:ietf:params:xml:ns:xfb" xmlns:ne="urn:ietf:params:xml:ns:network_elements"><SOURCE><ADDRESS afi="1">119.63.216.246</ADDRESS><P...
<BGP_MONITOR_MESSAGE xmlns:xsi="http://www.w3.org/2001/XMLSchema" xmlns="urn:ietf:params:xml:ns:bgp_monitor" xmlns:bgp="urn:ietf:params:xml:ns:xfb" xmlns:ne="urn:ietf:params:xml:ns:network_elements"><SOURCE><ADDRESS afi="1">119.63.216.246</ADDRESS><P...
<BGP_MONITOR_MESSAGE xmlns:xsi="http://www.w3.org/2001/XMLSchema" xmlns="urn:ietf:params:xml:ns:bgp_monitor" xmlns:bgp="urn:ietf:params:xml:ns:xfb" xmlns:ne="urn:ietf:params:xml:ns:network_elements"><SOURCE><ADDRESS afi="1">129.250.1.248</ADDRESS><PO...
<BGP_MONITOR_MESSAGE xmlns:xsi="http://www.w3.org/2001/XMLSchema" xmlns="urn:ietf:params:xml:ns:bgp_monitor" xmlns:bgp="urn:ietf:params:xml:ns:xfb" xmlns:ne="urn:ietf:params:xml:ns:network_elements"><SOURCE><ADDRESS afi="2">2a03:a480:ffff:ffff::247</...
<BGP_MONITOR_MESSAGE xmlns:xsi="http://www.w3.org/2001/XMLSchema" xmlns="urn:ietf:params:xml:ns:bgp_monitor" xmlns:bgp="urn:ietf:params:xml:ns:xfb" xmlns:ne="urn:ietf:params:xml:ns:network_elements"><SOURCE><ADDRESS afi="2">2001:15a8:a:a::2</ADDRESS>...
<BGP_MONITOR_MESSAGE xmlns:xsi="http://www.w3.org/2001/XMLSchema" xmlns="urn:ietf:params:xml:ns:bgp_monitor" xmlns:bgp="urn:ietf:params:xml:ns:xfb" xmlns:ne="urn:ietf:params:xml:ns:network_elements"><SOURCE><ADDRESS afi="1">199.66.153.82</ADDRESS><PO...
</xml>

t/bgpmon-translator-dup-archiver-msg.xml  view on Meta::CPAN

<xml>
<BAD_XML_MESSAGE>FOR FUN AND FOR CHECKING</BAD_XML_MESSAGE>
<BGP_MONITOR_MESSAGE xmlns:xsi="http://www.w3.org/2001/XMLSchema" xmlns="urn:ietf:params:xml:ns:bgp_monitor" xmlns:bgp="urn:ietf:params:xml:ns:xfb" xmlns:ne="urn:ietf:params:xml:ns:network_elements"><SOURCE><ADDRESS afi="1">133.205.1.142</ADDRESS><PO...
<BGP_MONITOR_MESSAGE xmlns:xsi="http://www.w3.org/2001/XMLSchema" xmlns="urn:ietf:params:xml:ns:bgp_monitor" xmlns:bgp="urn:ietf:params:xml:ns:xfb" xmlns:ne="urn:ietf:params:xml:ns:network_elements"><SOURCE><ADDRESS afi="1">119.63.216.246</ADDRESS><P...
<BGP_MONITOR_MESSAGE xmlns:xsi="http://www.w3.org/2001/XMLSchema" xmlns="urn:ietf:params:xml:ns:bgp_monitor" xmlns:bgp="urn:ietf:params:xml:ns:xfb" xmlns:ne="urn:ietf:params:xml:ns:network_elements"><SOURCE><ADDRESS afi="1">119.63.216.246</ADDRESS><P...
<BGP_MONITOR_MESSAGE xmlns:xsi="http://www.w3.org/2001/XMLSchema" xmlns="urn:ietf:params:xml:ns:bgp_monitor" xmlns:bgp="urn:ietf:params:xml:ns:xfb" xmlns:ne="urn:ietf:params:xml:ns:network_elements"><SOURCE><ADDRESS afi="1">129.250.1.248</ADDRESS><PO...
<BGP_MONITOR_MESSAGE xmlns:xsi="http://www.w3.org/2001/XMLSchema" xmlns="urn:ietf:params:xml:ns:bgp_monitor" xmlns:bgp="urn:ietf:params:xml:ns:xfb" xmlns:ne="urn:ietf:params:xml:ns:network_elements"><SOURCE><ADDRESS afi="2">2a03:a480:ffff:ffff::247</...
<BGP_MONITOR_MESSAGE xmlns:xsi="http://www.w3.org/2001/XMLSchema" xmlns="urn:ietf:params:xml:ns:bgp_monitor" xmlns:bgp="urn:ietf:params:xml:ns:xfb" xmlns:ne="urn:ietf:params:xml:ns:network_elements"><SOURCE><ADDRESS afi="2">2001:15a8:a:a::2</ADDRESS>...
<BGP_MONITOR_MESSAGE xmlns:xsi="http://www.w3.org/2001/XMLSchema" xmlns="urn:ietf:params:xml:ns:bgp_monitor" xmlns:bgp="urn:ietf:params:xml:ns:xfb" xmlns:ne="urn:ietf:params:xml:ns:network_elements"><SOURCE><ADDRESS afi="1">199.66.153.82</ADDRESS><PO...
</xml>



( run in 2.068 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )