Send Netdot-devel mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
https://osl.uoregon.edu/mailman/listinfo/netdot-devel
or, via email, send a message with subject or body 'help' to
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Netdot-devel digest..."
Today's Topics:
1. [SCM] Netdot branch netdot-1.0 updated.
netdot-1.0.2-21-g1d31ed9 ([email protected])
2. [SCM] Netdot branch netdot-1.0 updated.
netdot-1.0.2-22-g54958cf ([email protected])
3. [Netdot - Feature #1711] Allow containers/subnets in bigger
subnets ([email protected])
4. [SCM] Netdot branch netdot-1.0 updated.
netdot-1.0.2-24-g22aecb9 ([email protected])
----------------------------------------------------------------------
Message: 1
Date: Thu, 29 Nov 2012 09:13:03 -0800
From: [email protected]
Subject: [Netdot-devel] [SCM] Netdot branch netdot-1.0 updated.
netdot-1.0.2-21-g1d31ed9
To: [email protected]
Message-ID: <[email protected]>
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Netdot".
The branch, netdot-1.0 has been updated
via 1d31ed9a3c55ae4ed26d232b5940205630b75dbf (commit)
from 23da8a954b44c5d6429b08e42c83313a1c02ef9a (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 1d31ed9a3c55ae4ed26d232b5940205630b75dbf
Author: Carlos Vicente <[email protected]>
Date: Thu Nov 29 12:12:47 2012 -0500
Correction
diff --git a/lib/Netdot/Model/Device.pm b/lib/Netdot/Model/Device.pm
index 63aa209..8040564 100644
--- a/lib/Netdot/Model/Device.pm
+++ b/lib/Netdot/Model/Device.pm
@@ -5716,35 +5716,45 @@ sub _update_interfaces {
if ( $int_thold <= 0 || $int_thold >= 1 ){
$self->throw_fatal('Incorrect value for IF_COUNT_THRESHOLD in
config file');
}
-
+
my %old_snmp_ifs;
map { $old_snmp_ifs{$_->id} = $_ }
grep { $_->doc_status eq 'snmp' } values %oldifs;
-
+
my $ifs_old = scalar(keys(%old_snmp_ifs));
my $ifs_new = scalar(keys(%{$info->{interface}}));
+ $logger->debug("$host: Old Ifs: $ifs_old, New Ifs: $ifs_new");
+
if ( ($ifs_old && !$ifs_new) || ($ifs_new && ($ifs_new < $ifs_old) &&
- ($ifs_new / $ifs_old) <= $int_thold) ){
- $logger->warn("The ratio of new to old interfaces is below the
configured".
- " threshold (IF_COUNT_THRESHOLD). Skipping interface
update.".
- " Please re-discover device manually if needed.");
+ ($ifs_new / $ifs_old) <= $int_thold) ){
+ $logger->warn(sprintf("%s: new/old interface ratio: %d is below
INT_COUNT_THRESHOLD".
+ "Skipping interface update. Re-discover
manually if needed.",
+ $host, $ifs_new/$ifs_old));
return;
}
-
+
# Do the same for IP addresses
-
my $ips_old = scalar(keys(%old_ips));
- my $ips_new = scalar(keys(%{$info->{ips}}));
+ my $ips_new = 0;
+ foreach my $i ( values %{ $info->{interface} } ){
+ foreach my $ip ( values %{ $i->{ips} } ){
+ my $address = $ip->{address};
+ next if Ipblock->is_loopback($address);
+ $ips_new++;
+ }
+ }
+ $logger->debug("$host: Old IPs: $ips_old, New IPs: $ips_new");
+
if ( ($ips_old && !$ips_new) || ($ips_new && ($ips_new < $ips_old) &&
- ($ips_new / $ips_old) <= $int_thold) ){
- $logger->warn("The ratio of new to old IP addresses is below the
configured".
- " threshold (IF_COUNT_THRESHOLD). Skipping IP
update.".
- " Please re-discover device manually if needed.");
+ ($ips_new / $ips_old) <= $int_thold) ){
+ $logger->warn(sprintf("%s: new/old IP ratio: %d is below
INT_COUNT_THRESHOLD".
+ "Skipping interface update. Re-discover
manually if needed.",
+ $host, $ips_new/$ips_old));
return;
}
-
+
}
# Index by interface name (ifDescr) and number (ifIndex)
diff --git a/lib/Netdot/Model/Ipblock.pm b/lib/Netdot/Model/Ipblock.pm
index 5d78d79..807ff7e 100644
--- a/lib/Netdot/Model/Ipblock.pm
+++ b/lib/Netdot/Model/Ipblock.pm
@@ -2250,6 +2250,12 @@ sub update_a_records {
sub ip2int {
my ($self, $address) = @_;
my $ipobj;
+
+ # Transform RFC2317 format to a real IP
+ if ( $address =~/(.+)-(\d+)/ ) {
+ $address = $1;
+ }
+
unless ( $ipobj = NetAddr::IP->new($address) ){
$self->throw_user("Invalid IP address: $address");
}
@@ -2274,6 +2280,11 @@ sub ip2int {
sub validate {
my ($self, $address, $prefix) = @_;
+ # Transform RFC2317 format to a real ip
+ if ($address =~/(.+)-(\d+)/) {
+ $address = $1;
+ }
+
eval {
$self->_prevalidate($address, $prefix);
};
diff --git a/lib/Netdot/Model/RRPTR.pm b/lib/Netdot/Model/RRPTR.pm
index 399576f..40953bb 100644
--- a/lib/Netdot/Model/RRPTR.pm
+++ b/lib/Netdot/Model/RRPTR.pm
@@ -58,7 +58,13 @@ sub insert {
$rr = RR->search(name=>$name)->first;
unless ( $rr ){
my $domain = $zone->name;
- $name =~ s/\.$domain\.?$//i;
+ if ( $domain =~ /^\d+\-\d+\.s/ ) {
+ # Transform RFC2317 domain name to allowed one
+ $name =~ s/^(\d+).*/$1/;
+ } else {
+ $name =~ s/\.$domain\.?$//i;
+ }
+
$rr = RR->insert({zone=>$zone, name=>$name});
$logger->debug("Netdot::Model::RRPTR: Created owner RR for IP: ".
$ipb->get_label." as: ".$rr->get_label);
diff --git a/lib/Netdot/Model/Zone.pm b/lib/Netdot/Model/Zone.pm
index 4911184..cc91f3c 100644
--- a/lib/Netdot/Model/Zone.pm
+++ b/lib/Netdot/Model/Zone.pm
@@ -75,6 +75,24 @@ sub search {
return $class->SUPER::search(id => $alias->zone->id, $opts);
}elsif ( $argv{name} =~ /\./ && !Ipblock->matches_v4($argv{name}) ){
my @sections = split '\.', $argv{name};
+
+ # first try to search for the RFC2317 reverse if it exists
+ if ( $argv{name} =~ /(\d+)\.(\d+)\.(\d+)\.(\d+)\.in-addr\.arpa$/ ) {
+ my $address = join('.',($4, $3, $2, $1));
+ if ( my $ipb = Ipblock->search(address=>$address)->first ){
+ if ( my $subnet = $ipb->parent ){
+ my $subnetaddr = $subnet->address;
+ my $prefix = $subnet->prefix;
+ my @octs = split('\.', $subnetaddr);
+ $argv{name} =
$octs[3]."-".$prefix.".$octs[2].$octs[1].$octs[0].in-addr.arpa";
+ $logger->debug(sub{ "Zone::search: $argv{name}" });
+ if ( $class->SUPER::search(%argv, $opts) ){
+ $logger->debug(sub{ "Zone::search: found: ",
$argv{name} });
+ return $class->SUPER::search(%argv, $opts);
+ }
+ }
+ }
+ }
while ( @sections ){
$argv{name} = join '.', @sections;
$logger->debug(sub{ "Zone::search: $argv{name}" });
@@ -946,6 +964,9 @@ sub _dot_arpa_to_ip {
$version = 6;
}
+ # Transform RFC2317 format to real IP
+ $ipaddr =~ s/\d+-\d+\.(\d+\.\d+\.\d+)/$1/g;
+
my $plen; # prefix length
if ( $version == 4 ){
my @octets = (reverse split '\.', $ipaddr);
-----------------------------------------------------------------------
Summary of changes:
lib/Netdot/Model/Device.pm | 38 ++++++++++++++++++++++++--------------
lib/Netdot/Model/Ipblock.pm | 11 +++++++++++
lib/Netdot/Model/RRPTR.pm | 8 +++++++-
lib/Netdot/Model/Zone.pm | 21 +++++++++++++++++++++
4 files changed, 63 insertions(+), 15 deletions(-)
hooks/post-receive
--
Netdot
------------------------------
Message: 2
Date: Thu, 29 Nov 2012 09:36:41 -0800
From: [email protected]
Subject: [Netdot-devel] [SCM] Netdot branch netdot-1.0 updated.
netdot-1.0.2-22-g54958cf
To: [email protected]
Message-ID: <[email protected]>
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Netdot".
The branch, netdot-1.0 has been updated
via 54958cffa75338f6214c359a30550bfd3ed10e42 (commit)
from 1d31ed9a3c55ae4ed26d232b5940205630b75dbf (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 54958cffa75338f6214c359a30550bfd3ed10e42
Author: Carlos Vicente <[email protected]>
Date: Thu Nov 29 12:35:30 2012 -0500
Revert "Correction"
This reverts commit 1d31ed9a3c55ae4ed26d232b5940205630b75dbf.
diff --git a/lib/Netdot/Model/Device.pm b/lib/Netdot/Model/Device.pm
index 8040564..63aa209 100644
--- a/lib/Netdot/Model/Device.pm
+++ b/lib/Netdot/Model/Device.pm
@@ -5716,45 +5716,35 @@ sub _update_interfaces {
if ( $int_thold <= 0 || $int_thold >= 1 ){
$self->throw_fatal('Incorrect value for IF_COUNT_THRESHOLD in
config file');
}
-
+
my %old_snmp_ifs;
map { $old_snmp_ifs{$_->id} = $_ }
grep { $_->doc_status eq 'snmp' } values %oldifs;
-
+
my $ifs_old = scalar(keys(%old_snmp_ifs));
my $ifs_new = scalar(keys(%{$info->{interface}}));
- $logger->debug("$host: Old Ifs: $ifs_old, New Ifs: $ifs_new");
-
if ( ($ifs_old && !$ifs_new) || ($ifs_new && ($ifs_new < $ifs_old) &&
- ($ifs_new / $ifs_old) <= $int_thold) ){
- $logger->warn(sprintf("%s: new/old interface ratio: %d is below
INT_COUNT_THRESHOLD".
- "Skipping interface update. Re-discover
manually if needed.",
- $host, $ifs_new/$ifs_old));
+ ($ifs_new / $ifs_old) <= $int_thold) ){
+ $logger->warn("The ratio of new to old interfaces is below the
configured".
+ " threshold (IF_COUNT_THRESHOLD). Skipping interface
update.".
+ " Please re-discover device manually if needed.");
return;
}
-
+
# Do the same for IP addresses
+
my $ips_old = scalar(keys(%old_ips));
- my $ips_new = 0;
- foreach my $i ( values %{ $info->{interface} } ){
- foreach my $ip ( values %{ $i->{ips} } ){
- my $address = $ip->{address};
- next if Ipblock->is_loopback($address);
- $ips_new++;
- }
- }
+ my $ips_new = scalar(keys(%{$info->{ips}}));
- $logger->debug("$host: Old IPs: $ips_old, New IPs: $ips_new");
-
if ( ($ips_old && !$ips_new) || ($ips_new && ($ips_new < $ips_old) &&
- ($ips_new / $ips_old) <= $int_thold) ){
- $logger->warn(sprintf("%s: new/old IP ratio: %d is below
INT_COUNT_THRESHOLD".
- "Skipping interface update. Re-discover
manually if needed.",
- $host, $ips_new/$ips_old));
+ ($ips_new / $ips_old) <= $int_thold) ){
+ $logger->warn("The ratio of new to old IP addresses is below the
configured".
+ " threshold (IF_COUNT_THRESHOLD). Skipping IP
update.".
+ " Please re-discover device manually if needed.");
return;
}
-
+
}
# Index by interface name (ifDescr) and number (ifIndex)
diff --git a/lib/Netdot/Model/Ipblock.pm b/lib/Netdot/Model/Ipblock.pm
index 807ff7e..5d78d79 100644
--- a/lib/Netdot/Model/Ipblock.pm
+++ b/lib/Netdot/Model/Ipblock.pm
@@ -2250,12 +2250,6 @@ sub update_a_records {
sub ip2int {
my ($self, $address) = @_;
my $ipobj;
-
- # Transform RFC2317 format to a real IP
- if ( $address =~/(.+)-(\d+)/ ) {
- $address = $1;
- }
-
unless ( $ipobj = NetAddr::IP->new($address) ){
$self->throw_user("Invalid IP address: $address");
}
@@ -2280,11 +2274,6 @@ sub ip2int {
sub validate {
my ($self, $address, $prefix) = @_;
- # Transform RFC2317 format to a real ip
- if ($address =~/(.+)-(\d+)/) {
- $address = $1;
- }
-
eval {
$self->_prevalidate($address, $prefix);
};
diff --git a/lib/Netdot/Model/RRPTR.pm b/lib/Netdot/Model/RRPTR.pm
index 40953bb..399576f 100644
--- a/lib/Netdot/Model/RRPTR.pm
+++ b/lib/Netdot/Model/RRPTR.pm
@@ -58,13 +58,7 @@ sub insert {
$rr = RR->search(name=>$name)->first;
unless ( $rr ){
my $domain = $zone->name;
- if ( $domain =~ /^\d+\-\d+\.s/ ) {
- # Transform RFC2317 domain name to allowed one
- $name =~ s/^(\d+).*/$1/;
- } else {
- $name =~ s/\.$domain\.?$//i;
- }
-
+ $name =~ s/\.$domain\.?$//i;
$rr = RR->insert({zone=>$zone, name=>$name});
$logger->debug("Netdot::Model::RRPTR: Created owner RR for IP: ".
$ipb->get_label." as: ".$rr->get_label);
diff --git a/lib/Netdot/Model/Zone.pm b/lib/Netdot/Model/Zone.pm
index cc91f3c..4911184 100644
--- a/lib/Netdot/Model/Zone.pm
+++ b/lib/Netdot/Model/Zone.pm
@@ -75,24 +75,6 @@ sub search {
return $class->SUPER::search(id => $alias->zone->id, $opts);
}elsif ( $argv{name} =~ /\./ && !Ipblock->matches_v4($argv{name}) ){
my @sections = split '\.', $argv{name};
-
- # first try to search for the RFC2317 reverse if it exists
- if ( $argv{name} =~ /(\d+)\.(\d+)\.(\d+)\.(\d+)\.in-addr\.arpa$/ ) {
- my $address = join('.',($4, $3, $2, $1));
- if ( my $ipb = Ipblock->search(address=>$address)->first ){
- if ( my $subnet = $ipb->parent ){
- my $subnetaddr = $subnet->address;
- my $prefix = $subnet->prefix;
- my @octs = split('\.', $subnetaddr);
- $argv{name} =
$octs[3]."-".$prefix.".$octs[2].$octs[1].$octs[0].in-addr.arpa";
- $logger->debug(sub{ "Zone::search: $argv{name}" });
- if ( $class->SUPER::search(%argv, $opts) ){
- $logger->debug(sub{ "Zone::search: found: ",
$argv{name} });
- return $class->SUPER::search(%argv, $opts);
- }
- }
- }
- }
while ( @sections ){
$argv{name} = join '.', @sections;
$logger->debug(sub{ "Zone::search: $argv{name}" });
@@ -964,9 +946,6 @@ sub _dot_arpa_to_ip {
$version = 6;
}
- # Transform RFC2317 format to real IP
- $ipaddr =~ s/\d+-\d+\.(\d+\.\d+\.\d+)/$1/g;
-
my $plen; # prefix length
if ( $version == 4 ){
my @octets = (reverse split '\.', $ipaddr);
-----------------------------------------------------------------------
Summary of changes:
lib/Netdot/Model/Device.pm | 38 ++++++++++++++------------------------
lib/Netdot/Model/Ipblock.pm | 11 -----------
lib/Netdot/Model/RRPTR.pm | 8 +-------
lib/Netdot/Model/Zone.pm | 21 ---------------------
4 files changed, 15 insertions(+), 63 deletions(-)
hooks/post-receive
--
Netdot
------------------------------
Message: 3
Date: Thu, 29 Nov 2012 11:24:05 -0800
From: [email protected]
Subject: [Netdot-devel] [Netdot - Feature #1711] Allow
containers/subnets in bigger subnets
To: [email protected], [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=utf-8
Issue #1711 has been updated by Carlos Vicente.
Wim Vandersmissen wrote:
> Yes, a real subnet and it's indeed the same feature.
>
> If I would use a container as you suggest, could you tell me what the impact
> is ? What are the gotcha's?
The suggestion was because I thought that it was a routed "prefix", meaning
that it was advertised, perhaps as an aggregation. But you have clarified that
it is indeed a subnet configured in a router interface. In that case, the main
problem you'd have is that, when the device is re-discovered, Netdot will try
to mark it as a Subnet, and it will give an error because it can't. There may
be other problems that I can't think of right now.
----------------------------------------
Feature #1711: Allow containers/subnets in bigger subnets
https://osl.uoregon.edu/redmine/issues/1711#change-3025
Author: Wim Vandersmissen
Status: New
Priority: Normal
Assignee:
Category:
Target version:
Resolution:
E.g. we have a 10.120.0.0/21 subnet routed, that we internally split up in 8 x
/24's.
We would like to delegate DNS for each /24 to another entity.
When trying to create a container or subnet (management zone) for 10.120.0.0/24
this fails
"Block allocations only allowed under Container blocks: 10.120.0.0/24 within
10.120.0.0/21"
--
You have received this notification because you have either subscribed to it,
or are involved in it.
To change your notification preferences, please click here:
http://osl.uoregon.edu/redmine/my/account
------------------------------
Message: 4
Date: Thu, 29 Nov 2012 11:25:22 -0800
From: [email protected]
Subject: [Netdot-devel] [SCM] Netdot branch netdot-1.0 updated.
netdot-1.0.2-24-g22aecb9
To: [email protected]
Message-ID: <[email protected]>
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Netdot".
The branch, netdot-1.0 has been updated
via 22aecb91bcbec4179e9113a550fa89886d0366a9 (commit)
via 6edbb5c7097a3804f42c99cfa3437973dd793213 (commit)
from 54958cffa75338f6214c359a30550bfd3ed10e42 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 22aecb91bcbec4179e9113a550fa89886d0366a9
Author: Carlos Vicente <[email protected]>
Date: Thu Nov 29 14:25:16 2012 -0500
Changes towards feature #719 (RFC2317 classless reverse delegations)
diff --git a/lib/Netdot/Model/Ipblock.pm b/lib/Netdot/Model/Ipblock.pm
index 5d78d79..9a10c45 100644
--- a/lib/Netdot/Model/Ipblock.pm
+++ b/lib/Netdot/Model/Ipblock.pm
@@ -2250,6 +2250,12 @@ sub update_a_records {
sub ip2int {
my ($self, $address) = @_;
my $ipobj;
+
+ # Transform RFC2317 format to a real IP
+ if ( $address =~/^(.+)-(\d+)/ ) {
+ $address = $1;
+ }
+
unless ( $ipobj = NetAddr::IP->new($address) ){
$self->throw_user("Invalid IP address: $address");
}
@@ -2274,6 +2280,11 @@ sub ip2int {
sub validate {
my ($self, $address, $prefix) = @_;
+ # Transform RFC2317 format to a real ip
+ if ( $address =~/^(.+)-(\d+)/ ) {
+ $address = $1;
+ }
+
eval {
$self->_prevalidate($address, $prefix);
};
diff --git a/lib/Netdot/Model/RRPTR.pm b/lib/Netdot/Model/RRPTR.pm
index 399576f..5f0f035 100644
--- a/lib/Netdot/Model/RRPTR.pm
+++ b/lib/Netdot/Model/RRPTR.pm
@@ -58,7 +58,13 @@ sub insert {
$rr = RR->search(name=>$name)->first;
unless ( $rr ){
my $domain = $zone->name;
- $name =~ s/\.$domain\.?$//i;
+ if ( $domain =~ /^\d+\-\d+\./ ) {
+ # Transform RFC2317 domain name to allowed one
+ $name =~ s/^(\d+).*/$1/;
+ } else {
+ $name =~ s/\.$domain\.?$//i;
+ }
+
$rr = RR->insert({zone=>$zone, name=>$name});
$logger->debug("Netdot::Model::RRPTR: Created owner RR for IP: ".
$ipb->get_label." as: ".$rr->get_label);
diff --git a/lib/Netdot/Model/Zone.pm b/lib/Netdot/Model/Zone.pm
index 4911184..685b8ef 100644
--- a/lib/Netdot/Model/Zone.pm
+++ b/lib/Netdot/Model/Zone.pm
@@ -75,6 +75,24 @@ sub search {
return $class->SUPER::search(id => $alias->zone->id, $opts);
}elsif ( $argv{name} =~ /\./ && !Ipblock->matches_v4($argv{name}) ){
my @sections = split '\.', $argv{name};
+
+ # first try to search for the RFC2317 reverse if it exists
+ if ( $argv{name} =~ /(\d+)\.(\d+)\.(\d+)\.(\d+)\.in-addr\.arpa$/o )
{
+ my $address = join('.',($4, $3, $2, $1));
+ if ( my $ipb = Ipblock->search(address=>$address)->first ){
+ if ( my $subnet = $ipb->parent ){
+ my $subnetaddr = $subnet->address;
+ my $prefix = $subnet->prefix;
+ my @octs = split('\.', $subnetaddr);
+ $argv{name} =
$octs[3]."-".$prefix.".$octs[2].$octs[1].$octs[0].in-addr.arpa";
+ $logger->debug(sub{ "Zone::search: $argv{name}" });
+ if ( $class->SUPER::search(%argv, $opts) ){
+ $logger->debug(sub{ "Zone::search: found: ",
$argv{name} });
+ return $class->SUPER::search(%argv, $opts);
+ }
+ }
+ }
+ }
while ( @sections ){
$argv{name} = join '.', @sections;
$logger->debug(sub{ "Zone::search: $argv{name}" });
@@ -946,6 +964,9 @@ sub _dot_arpa_to_ip {
$version = 6;
}
+ # Transform RFC2317 format to real IP
+ $ipaddr =~ s/\d+-\d+\.(\d+\.\d+\.\d+)/$1/g;
+
my $plen; # prefix length
if ( $version == 4 ){
my @octets = (reverse split '\.', $ipaddr);
commit 6edbb5c7097a3804f42c99cfa3437973dd793213
Author: Carlos Vicente <[email protected]>
Date: Thu Nov 29 12:39:20 2012 -0500
Correction to IP ratio check
diff --git a/lib/Netdot/Model/Device.pm b/lib/Netdot/Model/Device.pm
index 63aa209..8040564 100644
--- a/lib/Netdot/Model/Device.pm
+++ b/lib/Netdot/Model/Device.pm
@@ -5716,35 +5716,45 @@ sub _update_interfaces {
if ( $int_thold <= 0 || $int_thold >= 1 ){
$self->throw_fatal('Incorrect value for IF_COUNT_THRESHOLD in
config file');
}
-
+
my %old_snmp_ifs;
map { $old_snmp_ifs{$_->id} = $_ }
grep { $_->doc_status eq 'snmp' } values %oldifs;
-
+
my $ifs_old = scalar(keys(%old_snmp_ifs));
my $ifs_new = scalar(keys(%{$info->{interface}}));
+ $logger->debug("$host: Old Ifs: $ifs_old, New Ifs: $ifs_new");
+
if ( ($ifs_old && !$ifs_new) || ($ifs_new && ($ifs_new < $ifs_old) &&
- ($ifs_new / $ifs_old) <= $int_thold) ){
- $logger->warn("The ratio of new to old interfaces is below the
configured".
- " threshold (IF_COUNT_THRESHOLD). Skipping interface
update.".
- " Please re-discover device manually if needed.");
+ ($ifs_new / $ifs_old) <= $int_thold) ){
+ $logger->warn(sprintf("%s: new/old interface ratio: %d is below
INT_COUNT_THRESHOLD".
+ "Skipping interface update. Re-discover
manually if needed.",
+ $host, $ifs_new/$ifs_old));
return;
}
-
+
# Do the same for IP addresses
-
my $ips_old = scalar(keys(%old_ips));
- my $ips_new = scalar(keys(%{$info->{ips}}));
+ my $ips_new = 0;
+ foreach my $i ( values %{ $info->{interface} } ){
+ foreach my $ip ( values %{ $i->{ips} } ){
+ my $address = $ip->{address};
+ next if Ipblock->is_loopback($address);
+ $ips_new++;
+ }
+ }
+ $logger->debug("$host: Old IPs: $ips_old, New IPs: $ips_new");
+
if ( ($ips_old && !$ips_new) || ($ips_new && ($ips_new < $ips_old) &&
- ($ips_new / $ips_old) <= $int_thold) ){
- $logger->warn("The ratio of new to old IP addresses is below the
configured".
- " threshold (IF_COUNT_THRESHOLD). Skipping IP
update.".
- " Please re-discover device manually if needed.");
+ ($ips_new / $ips_old) <= $int_thold) ){
+ $logger->warn(sprintf("%s: new/old IP ratio: %d is below
INT_COUNT_THRESHOLD".
+ "Skipping interface update. Re-discover
manually if needed.",
+ $host, $ips_new/$ips_old));
return;
}
-
+
}
# Index by interface name (ifDescr) and number (ifIndex)
-----------------------------------------------------------------------
Summary of changes:
lib/Netdot/Model/Device.pm | 38 ++++++++++++++++++++++++--------------
lib/Netdot/Model/Ipblock.pm | 11 +++++++++++
lib/Netdot/Model/RRPTR.pm | 8 +++++++-
lib/Netdot/Model/Zone.pm | 21 +++++++++++++++++++++
4 files changed, 63 insertions(+), 15 deletions(-)
hooks/post-receive
--
Netdot
------------------------------
_______________________________________________
Netdot-devel mailing list
[email protected]
https://osl.uoregon.edu/mailman/listinfo/netdot-devel
End of Netdot-devel Digest, Vol 68, Issue 11
********************************************