Commit 5e36c240 authored by Leigh Stoller's avatar Leigh Stoller

Add ips.txt generation.

parent d6b461d2
......@@ -30,10 +30,11 @@ sub usage()
{
exit(-1);
}
my $optlist = "dwi";
my $optlist = "dwxi";
my $debug = 0;
my $genwires = 0;
my $genilo = 0;
my $genips = 0;
#
# Configure variables
......@@ -45,6 +46,7 @@ my $ILOPSWD = "$TB/etc/ilo.pswd";
sub Fatal($);
sub GenXML(@);
sub GenWires(@);
sub GenIPs(@);
# un-taint path
$ENV{'PATH'} = '/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/site/bin';
......@@ -73,6 +75,9 @@ if (! getopts($optlist, \%options)) {
if (defined($options{"d"})) {
$debug = 1;
}
if (defined($options{"i"})) {
$genips = 1;
}
if (defined($options{"w"})) {
$genwires = 1;
}
......@@ -98,6 +103,9 @@ if ($genwires) {
elsif ($genilo) {
GenXML(@nodes);
}
elsif ($genips) {
GenIPs(@nodes);
}
exit(0);
sub GenXML(@)
......@@ -165,6 +173,22 @@ sub GenWires(@)
print "<wiring>\n";
}
sub GenIPs(@)
{
my @nodes = @_;
foreach my $node (@nodes) {
my $control = Interface->LookupControl($node);
my $mngmnt = Interface->LookupManagement($node);
if (! (defined($control) && defined($mngmnt))) {
Fatal("No control or management interface for $node");
}
print $node->node_id() .
" " . $control->IP() . " " . $mngmnt->IP() . "\n";
}
}
sub PrintInterface($$)
{
my ($interface, $location) = @_;
......
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