File: 01_methods.t

package info (click to toggle)
libnet-irr-perl 0.10-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 80 kB
  • sloc: perl: 181; makefile: 6
file content (56 lines) | stat: -rw-r--r-- 1,535 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56

use Test::More tests => 21;

BEGIN{ use_ok('Net::IRR') }

my $host = 'whois.radb.net';
can_ok("Net::IRR", "connect");
my $i = Net::IRR->connect( host => $host );
ok($i, "connected to $host");

can_ok($i, "get_irrd_version");
ok ($i->get_irrd_version, 'IRRd version number found');

can_ok($i, "get_routes_by_origin");
my @routes = $i->get_routes_by_origin("AS5650");
my $found = scalar @routes;
ok ($found, "found $found routes for AS5650");

can_ok($i, "get_ipv6_routes_by_origin");

can_ok($i, "get_as_set");
if (my @ases = $i->get_as_set("AS-FRONTIER", 1)) {
    my $found = scalar @ases;
    ok ($found, "found $found ASNs in the AS-FRONTIER AS set. (1)");
}
else {
    fail('no ASNs found in the AS-FRONTIER AS set (1)');
}

can_ok($i, "get_route_set");
if (my @ases = $i->get_route_set("AS-FRONTIER", 1)) {
    my $found = scalar @ases;
    ok ($found, "found $found ASNs in the AS-FRONTIER AS set (2).");
}
else {
    fail('no ASNs found in the AS-FRONTIER AS set (2)');
}

can_ok($i, "match");
my $person = $i->match("aut-num","as5650");
ok($person, "found an aut-num object for AS5650");

can_ok($i, "route_search");
my $origin = $i->route_search("208.186.0.0/15", 'o');
ok( $origin, "$origin originates 208.186.0.0/15" );

my $origin1 = $i->route_search("10.0.0.0/8", 'o');
ok( not(defined($i->error())), "10.0.0.0/8 was not found" );

can_ok($i, "get_sync_info");
my $info = $i->get_sync_info();
ok($info, 'found synchronization information');

can_ok($i, "disconnect");
ok($i->disconnect(), 'disconnect was successful');