-
-
Notifications
You must be signed in to change notification settings - Fork 72
/
Arpnip.pm
31 lines (21 loc) · 886 Bytes
/
Arpnip.pm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package App::Netdisco::Worker::Plugin::Arpnip;
use Dancer ':syntax';
use App::Netdisco::Worker::Plugin;
use aliased 'App::Netdisco::Worker::Status';
use App::Netdisco::Util::Device 'is_arpnipable_now';
register_worker({ phase => 'check' }, sub {
my ($job, $workerconf) = @_;
my $device = $job->device;
return Status->error('arpnip failed: unable to interpret device param')
unless defined $device;
return Status->error("arpnip skipped: $device not yet discovered")
unless $device->in_storage;
return Status->info("macsuck skipped: $device is pseudo-device")
if $device->is_pseudo;
return Status->info("arpnip skipped: $device has no layer 3 capability")
unless $device->has_layer(3);
return Status->info("arpnip skipped: $device is not arpnipable")
unless is_arpnipable_now($device);
return Status->done('arpnip is able to run');
});
true;