From 864da4c1ec59391f6af3ca3628ffde010fbe3739 Mon Sep 17 00:00:00 2001 From: Oliver Gorwits Date: Mon, 26 Aug 2013 20:27:58 +0100 Subject: [PATCH] support for macsuck_min_age, arpnip_min_age --- Netdisco/Changes | 2 +- .../lib/App/Netdisco/Manual/Configuration.pod | 22 ++++++++++++------- Netdisco/lib/App/Netdisco/Util/Device.pm | 18 ++++++++++++++- 3 files changed, 32 insertions(+), 10 deletions(-) diff --git a/Netdisco/Changes b/Netdisco/Changes index 03a6a517..a23ed3ca 100644 --- a/Netdisco/Changes +++ b/Netdisco/Changes @@ -4,7 +4,7 @@ * Display port descriptions in topology editing form * Support store_modules config (default true) - * Support for discover_min_age + * Support for discover_min_age, macsuck_min_age, arpnip_min_age 2.013001 - 2013-08-23 diff --git a/Netdisco/lib/App/Netdisco/Manual/Configuration.pod b/Netdisco/lib/App/Netdisco/Manual/Configuration.pod index 9b0b1c61..7da8252d 100644 --- a/Netdisco/lib/App/Netdisco/Manual/Configuration.pod +++ b/Netdisco/lib/App/Netdisco/Manual/Configuration.pod @@ -336,6 +336,20 @@ Set to true will let nodes accumulate on uplink ports without topology information. This is a debug option to help you figure out your topology and generally should not be set. +=head3 C + +Value: Number. Default: 0. + +Sets the minimum amount of time in seconds which must elapse between any two +macsuck jobs for a device. + +=head3 C + +Value: Number. Default: 0. + +Sets the minimum amount of time in seconds which must elapse between any two +arpnip jobs for a device. + =head3 C Value: Boolean. Default: C. @@ -569,10 +583,6 @@ These settings are from Netdisco 1.x but are yet to be supported in Netdisco =item * -C - -=item * - C =item * @@ -613,10 +623,6 @@ C =item * -C - -=item * - C =item * diff --git a/Netdisco/lib/App/Netdisco/Util/Device.pm b/Netdisco/lib/App/Netdisco/Util/Device.pm index 52b3630b..d8725c43 100644 --- a/Netdisco/lib/App/Netdisco/Util/Device.pm +++ b/Netdisco/lib/App/Netdisco/Util/Device.pm @@ -110,7 +110,7 @@ sub is_discoverable { if ($device->since_last_discover and $device->since_last_discover < $discover_since) { - return _bail_msg("is_discoverable: last discovered less than discover_min_age"); + return _bail_msg("is_discoverable: last discover less than discover_min_age"); } return 1; @@ -152,6 +152,14 @@ sub is_arpnipable { return 0 if not $okay; } + my $arpnip_since = setting('arpnip_min_age') || 0; + + if ($device->since_last_arpnip + and $device->since_last_arpnip < $arpnip_since) { + + return _bail_msg("is_arpnipable: last arpnip less than arpnip_min_age"); + } + return 1; } @@ -191,6 +199,14 @@ sub is_macsuckable { return 0 if not $okay; } + my $macsuck_since = setting('macsuck_min_age') || 0; + + if ($device->since_last_macsuck + and $device->since_last_macsuck < $macsuck_since) { + + return _bail_msg("is_macsuckable: last macsuck less than macsuck_min_age"); + } + return 1; }