
It appears that my 3-day-study attempt at R&S v4.0 written was a success :-). Next thing is ~$1.400 crocodile steak at NH hotel in Brussels.
Shall we say February/March time-frame?
These are some unsorted networking, mostly Cisco, stories. Some people may find a thing or two useful here.
#!/usr/bin/perl -w
use Net::Telnet::Cisco();
use strict;
my ($host, $user, $pass, $enab, $cmdf, $lstf, @cmds);
$cmdf = "commands.txt";
$lstf = "list.txt";
$user = "USERNAME";
$pass = "PASSWORD";
$enab = "ENABLE_PASSWORD";
sub ConfigureRouter {
my ($t, $host, $cmd);
$host = $_[0];
if (!($t = Net::Telnet::Cisco->new(Host => "$host", Errmode => "return"))) {
printf("Could not open session to '%s'\n", $host);
return;
};
if (!($t->login($user, $pass))) {
printf("Could not log into '%s' as '%s'\n", $host, $user);
return;
}
$t->enable($enab);
print("Login successful. Setting up ");
$t->print("terminal length 0");
print $t->waitfor("/#/");
$t->print("conf t");
foreach $cmd (@cmds) {
print $t->waitfor("/#/");
$t->printf("%s", $cmd);
}
print $t->waitfor("/#/");
$t->print("end");
print $t->waitfor("/#/");
$t->print("write memory");
print $t->waitfor("/#/");
$t->close();
}
#
# Main Body
#
open (CF, "< " . $cmdf) or die "Can't read the command file '$cmdf'";
@cmds = <CF>;
close(CF);
open (IF, "< " . $lstf) or die "Can't read the router list file '$lstf'";
while (defined ($host = <IF>)) {
chomp($host);
if ($host ne "") {
printf("\n\n\n%s %s %s\n", "-" x 22, $host, "-" x 22);
ConfigureRouter($host);
}
}
close(IF);