Commit 52b13806 authored by Robert Ricci's avatar Robert Ricci

Add a script to auto-generate ip-mapping.txt files. Should be run on

an Emulab (probably not Planetlab) node.

Works due to three conventions:
1) The Emulab controlled LAN is called elabc
2) The Planetlab LAN is called planetc
3) Elab/Plab peers have names like {elab,planet}foo
parent c2e39e38
#!/usr/bin/perl -w
#
# Make an ipmap file from /etc/hosts
#
use strict;
my (%elabips, %plabips);
open(HOSTS,"/etc/hosts") or die "Unable to open /etc/hosts: $!\n";
while (<HOSTS>) {
my ($IP,@names) = split /\s+/;
my $firstname = shift @names;
if ($firstname =~ /^(.+)-elabc/) {
$elabips{$1} = $IP;
} elsif ($firstname =~ /^(.+)-planetc/) {
$plabips{$1} = $IP;
}
}
foreach my $elabnode (keys %elabips) {
my $plabnode = $elabnode;
$plabnode =~ s/elab/planet/i;
if (exists $plabips{$plabnode}) {
print "$elabips{$elabnode} $plabips{$plabnode} elabc-$elabnode\n";
}
}
close HOSTS;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment