[#14] Support partial DNS names in *_only/*_no (via regexp)
This commit is contained in:
@@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
* [#81] Identify wireless nodes and provide information when available
|
* [#81] Identify wireless nodes and provide information when available
|
||||||
* [#13] Support IP address ranges in *_only/*_no configuration
|
* [#13] Support IP address ranges in *_only/*_no configuration
|
||||||
|
* [#14] Support partial DNS names in *_only/*_no (via regexp)
|
||||||
|
|
||||||
[ENHANCEMENTS]
|
[ENHANCEMENTS]
|
||||||
|
|
||||||
|
|||||||
@@ -381,8 +381,9 @@ devices. For more fine-grained control see the C<bulkwalk_no> setting.
|
|||||||
Value: List of Network Identifiers or Device Properties. Default: Empty List.
|
Value: List of Network Identifiers or Device Properties. Default: Empty List.
|
||||||
|
|
||||||
IP addresses in the list will use C<GETNEXT> (and not C<BULKWALK>). You can
|
IP addresses in the list will use C<GETNEXT> (and not C<BULKWALK>). You can
|
||||||
include hostnames, IP addresses, subnets (IPv4 or IPv6), and address ranges
|
include hostnames, IP addresses, subnets (IPv4 or IPv6), YAML Regexp to match
|
||||||
(using a hyphen and no whitespace) in the list.
|
the DNS name, and address ranges (using a hyphen and no whitespace) in the
|
||||||
|
list.
|
||||||
|
|
||||||
Alternatively include a "C<property:regex>" entry to match the named property
|
Alternatively include a "C<property:regex>" entry to match the named property
|
||||||
of the device. The regex must match the complete value.
|
of the device. The regex must match the complete value.
|
||||||
@@ -446,8 +447,9 @@ Number of times to retry connecting to a device before giving up.
|
|||||||
Value: List of Network Identifiers or Device Properties. Default: Empty List.
|
Value: List of Network Identifiers or Device Properties. Default: Empty List.
|
||||||
|
|
||||||
IP addresses in the list will not be visited during device discovery. You can
|
IP addresses in the list will not be visited during device discovery. You can
|
||||||
include hostnames, IP addresses, subnets (IPv4 or IPv6), and address ranges
|
include hostnames, IP addresses, subnets (IPv4 or IPv6), YAML Regexp to match
|
||||||
(using a hyphen and no whitespace) in the list.
|
the DNS name, and address ranges (using a hyphen and no whitespace) in the
|
||||||
|
list.
|
||||||
|
|
||||||
Alternatively include a "C<property:regex>" entry to match the named property
|
Alternatively include a "C<property:regex>" entry to match the named property
|
||||||
of the device. The regex must match the complete value.
|
of the device. The regex must match the complete value.
|
||||||
@@ -458,7 +460,8 @@ Value: List of Network Identifiers or Device Properties. Default: Empty List.
|
|||||||
|
|
||||||
If present, device discovery will be limited to IP addresses matching entries
|
If present, device discovery will be limited to IP addresses matching entries
|
||||||
in this list. You can include hostnames, IP addresses, subnets (IPv4 and
|
in this list. You can include hostnames, IP addresses, subnets (IPv4 and
|
||||||
IPv6), and address ranges (using a hyphen and no whitespace).
|
IPv6), YAML Regexp to match the DNS name, and address ranges (using a hyphen
|
||||||
|
and no whitespace).
|
||||||
|
|
||||||
Alternatively include a "C<property:regex>" entry to match the named property
|
Alternatively include a "C<property:regex>" entry to match the named property
|
||||||
of the device. The regex must match the complete value.
|
of the device. The regex must match the complete value.
|
||||||
@@ -488,8 +491,8 @@ discover jobs for a device.
|
|||||||
Value: List of Network Identifiers or Device Properties. Default: Empty List.
|
Value: List of Network Identifiers or Device Properties. Default: Empty List.
|
||||||
|
|
||||||
IP addresses in the list will not be visited for macsuck. You can include
|
IP addresses in the list will not be visited for macsuck. You can include
|
||||||
hostnames, IP addresses, subnets (IPv4 or IPv6), and address ranges (using a
|
hostnames, IP addresses, subnets (IPv4 or IPv6), YAML Regexp to match the DNS
|
||||||
hyphen and no whitespace) in the list.
|
name, and address ranges (using a hyphen and no whitespace) in the list.
|
||||||
|
|
||||||
Alternatively include a "C<property:regex>" entry to match the named property
|
Alternatively include a "C<property:regex>" entry to match the named property
|
||||||
of the device. The regex must match the complete value.
|
of the device. The regex must match the complete value.
|
||||||
@@ -499,8 +502,9 @@ of the device. The regex must match the complete value.
|
|||||||
Value: List of Network Identifiers or Device Properties. Default: Empty List.
|
Value: List of Network Identifiers or Device Properties. Default: Empty List.
|
||||||
|
|
||||||
If present, macsuck will be limited to IP addresses matching entries in this
|
If present, macsuck will be limited to IP addresses matching entries in this
|
||||||
list. You can include hostnames, IP addresses, subnets (IPv4 and IPv6), and
|
list. You can include hostnames, IP addresses, subnets (IPv4 and IPv6), YAML
|
||||||
address ranges (using a hyphen and no whitespace).
|
Regexp to match the DNS name, and address ranges (using a hyphen and no
|
||||||
|
whitespace).
|
||||||
|
|
||||||
Alternatively include a "C<property:regex>" entry to match the named property
|
Alternatively include a "C<property:regex>" entry to match the named property
|
||||||
of the device. The regex must match the complete value.
|
of the device. The regex must match the complete value.
|
||||||
@@ -556,8 +560,8 @@ macsuck jobs for a device.
|
|||||||
Value: List of Network Identifiers or Device Properties. Default: Empty List.
|
Value: List of Network Identifiers or Device Properties. Default: Empty List.
|
||||||
|
|
||||||
IP addresses in the list will not be visited for arpnip. You can include
|
IP addresses in the list will not be visited for arpnip. You can include
|
||||||
hostnames, IP addresses, subnets (IPv4 or IPv6), and address ranges (using a
|
hostnames, IP addresses, subnets (IPv4 or IPv6), YAML Regexp to match the DNS
|
||||||
hyphen and no whitespace) in the list.
|
name, and address ranges (using a hyphen and no whitespace) in the list.
|
||||||
|
|
||||||
Alternatively include a "C<property:regex>" entry to match the named property
|
Alternatively include a "C<property:regex>" entry to match the named property
|
||||||
of the device. The regex must match the complete value.
|
of the device. The regex must match the complete value.
|
||||||
@@ -567,8 +571,9 @@ of the device. The regex must match the complete value.
|
|||||||
Value: List of Network Identifiers or Device Properties. Default: Empty List.
|
Value: List of Network Identifiers or Device Properties. Default: Empty List.
|
||||||
|
|
||||||
If present, arpnip will be limited to IP addresses matching entries in this
|
If present, arpnip will be limited to IP addresses matching entries in this
|
||||||
list. You can include hostnames, IP addresses, subnets (IPv4 and IPv6), and
|
list. You can include hostnames, IP addresses, subnets (IPv4 and IPv6), YAML
|
||||||
address ranges (using a hyphen and no whitespace).
|
Regexp to match the DNS name, and address ranges (using a hyphen and no
|
||||||
|
whitespace).
|
||||||
|
|
||||||
Alternatively include a "C<property:regex>" entry to match the named property
|
Alternatively include a "C<property:regex>" entry to match the named property
|
||||||
of the device. The regex must match the complete value.
|
of the device. The regex must match the complete value.
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ use Dancer qw/:syntax :script/;
|
|||||||
use Dancer::Plugin::DBIC 'schema';
|
use Dancer::Plugin::DBIC 'schema';
|
||||||
|
|
||||||
use NetAddr::IP::Lite ':lower';
|
use NetAddr::IP::Lite ':lower';
|
||||||
|
use App::Netdisco::Util::DNS 'hostname_from_ip';
|
||||||
|
|
||||||
use base 'Exporter';
|
use base 'Exporter';
|
||||||
our @EXPORT = ();
|
our @EXPORT = ();
|
||||||
@@ -76,6 +77,12 @@ sub check_acl {
|
|||||||
my $addr = NetAddr::IP::Lite->new($device->ip);
|
my $addr = NetAddr::IP::Lite->new($device->ip);
|
||||||
|
|
||||||
foreach my $item (@$config) {
|
foreach my $item (@$config) {
|
||||||
|
if (ref qr// eq ref $item) {
|
||||||
|
my $name = hostname_from_ip($addr->addr) or next;
|
||||||
|
return 1 if $name =~ $item;
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
|
||||||
if ($item =~ m/^([^:]+)\s*:\s*([^:]+)$/) {
|
if ($item =~ m/^([^:]+)\s*:\s*([^:]+)$/) {
|
||||||
my $prop = $1;
|
my $prop = $1;
|
||||||
my $match = $2;
|
my $match = $2;
|
||||||
@@ -155,6 +162,12 @@ IP address range, using a hyphen and no whitespace
|
|||||||
|
|
||||||
=item *
|
=item *
|
||||||
|
|
||||||
|
Regular Expression in YAML format which will match the device DNS name, e.g.:
|
||||||
|
|
||||||
|
- !!perl/regexp ^sep0.*$
|
||||||
|
|
||||||
|
=item *
|
||||||
|
|
||||||
C<"model:regex"> - matched against the device model
|
C<"model:regex"> - matched against the device model
|
||||||
|
|
||||||
=item *
|
=item *
|
||||||
@@ -200,6 +213,12 @@ IP address range, using a hyphen and no whitespace
|
|||||||
|
|
||||||
=item *
|
=item *
|
||||||
|
|
||||||
|
Regular Expression in YAML format which will match the device DNS name, e.g.:
|
||||||
|
|
||||||
|
- !!perl/regexp ^sep0.*$
|
||||||
|
|
||||||
|
=item *
|
||||||
|
|
||||||
C<"model:regex"> - matched against the device model
|
C<"model:regex"> - matched against the device model
|
||||||
|
|
||||||
=item *
|
=item *
|
||||||
|
|||||||
Reference in New Issue
Block a user