netdisco-do -d accepts IP prefixes (subnet in CIDR format)

This commit is contained in:
Oliver Gorwits
2015-03-07 13:17:49 +00:00
parent f7bc66ff54
commit b98d75b01c
5 changed files with 83 additions and 59 deletions

View File

@@ -46,8 +46,9 @@ sub _single_body {
my $layer_method = $job_type .'_layer';
my $job_layer = $self->$layer_method;
my $host = NetAddr::IP::Lite->new($job->device);
my $device = get_device($host->addr);
my $device = get_device($job->device)
or job_error("$job_type failed: unable to interpret device parameter");
my $host = $device->ip;
if ($device->in_storage
and $device->vendor and $device->vendor eq 'netdisco') {
@@ -72,7 +73,7 @@ sub _single_body {
$job_action->($device, $snmp);
return job_done("Ended $job_type for ". $host->addr);
return job_done("Ended $job_type for $host");
}
sub _single_node_body {

View File

@@ -39,8 +39,9 @@ sub discoverall {
sub discover {
my ($self, $job) = @_;
my $host = NetAddr::IP::Lite->new($job->device);
my $device = get_device($host->addr);
my $device = get_device($job->device)
or job_error("discover failed: unable to interpret device parameter");
my $host = $device->ip;
if ($device->ip eq '0.0.0.0') {
return job_error("discover failed: no device param (need -d ?)");
@@ -90,7 +91,7 @@ sub discover {
}
}
return job_done("Ended discover for ". $host->addr);
return job_done("Ended discover for $host");
}
1;

View File

@@ -25,8 +25,9 @@ sub nbtwalk { (shift)->_walk_body('nbtstat', @_) }
sub nbtstat {
my ($self, $job) = @_;
my $host = NetAddr::IP::Lite->new($job->device);
my $device = get_device($host->addr);
my $device = get_device($job->device)
or job_error("nbtstat failed: unable to interpret device parameter");
my $host = $device->ip;
unless (is_discoverable($device->ip)) {
return job_defer("nbtstat deferred: $host is not discoverable");
@@ -66,7 +67,7 @@ sub nbtstat {
}
}
return job_done("Ended nbtstat for ". $host->addr);
return job_done("Ended nbtstat for $host");
}
1;