#!/usr/bin/perl -w
use strict;

use Net::Netmask;
use Cisco;
use Juniper;
use config;

my %routers = config::routers;
my $targetdir = "/home/httpd/bgp-weekly/";

#close(STDOUT);
foreach my $router (keys %routers) {
	my $session;

	print STDERR "$router: bgp summary...";
	my $rtype = $routers{$router}{type};

	$session = $rtype->login($routers{$router});
	open(STDOUT,"> $targetdir/bgpsummary.$router") or die;
	$rtype->bgp_summary($session);
	print STDERR "done. bgp...";
	
	$session = $rtype->login($routers{$router});
	open(STDOUT, "> $targetdir/bgp.$router") or die;
	$rtype->bgp($session, "", "terse");
	close(STDOUT);
	print STDERR "done.\n";
}
