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-14-gaa1ea42 ([email protected])
   2. [SCM] Netdot branch netdot-1.0 updated.
      netdot-1.0.2-15-g8909954 ([email protected])


----------------------------------------------------------------------

Message: 1
Date: Tue, 27 Nov 2012 11:43:23 -0800
From: [email protected]
Subject: [Netdot-devel] [SCM] Netdot branch netdot-1.0 updated.
        netdot-1.0.2-14-gaa1ea42
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  aa1ea42dc645249b5158484d63c05113152a4ee1 (commit)
      from  d059b3db2894f1a2df71f544834c757593077078 (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 aa1ea42dc645249b5158484d63c05113152a4ee1
Author: Carlos Vicente <[email protected]>
Date:   Tue Nov 27 14:43:17 2012 -0500

    More checks to avoid incorrect removal of interfaces and IP addresses 
caused by icomplete SNMP information

diff --git a/lib/Netdot/Model/Device.pm b/lib/Netdot/Model/Device.pm
index 3b7fdb4..6245f59 100644
--- a/lib/Netdot/Model/Device.pm
+++ b/lib/Netdot/Model/Device.pm
@@ -1085,6 +1085,11 @@ sub get_snmp_info {
     ################################################################
     # IPv4 addresses and masks 
     #
+
+    # This table is critical, so if we didn't get anything, ask again
+    if ( !defined($hashes{'ip_index'}) || !(keys $hashes{'ip_index'}) ){
+       $hashes{'ip_index'} = $sinfo->ip_index();
+    }
     while ( my($ip,$iid) = each %{ $hashes{'ip_index'} } ){
        next unless (defined $dev{interface}{$iid});
        next if &_check_if_status_down(\%dev, $iid);
@@ -5708,7 +5713,7 @@ sub _update_interfaces {
        # whose username is netdot, running the update
 
        my $int_thold = $self->config->get('IF_COUNT_THRESHOLD');
-       if ( $int_thold >= 1 ){
+       if ( $int_thold <= 0 || $int_thold >= 1 ){
            $self->throw_fatal('Incorrect value for IF_COUNT_THRESHOLD in 
config file');
        }
 
@@ -5716,16 +5721,30 @@ sub _update_interfaces {
        map { $old_snmp_ifs{$_->id} = $_ } 
        grep { $_->doc_status eq 'snmp' } values %oldifs;
 
-       my $num_old = scalar(keys(%old_snmp_ifs));
-       my $num_new = scalar(keys(%{$info->{interface}}));
+       my $ifs_old = scalar(keys(%old_snmp_ifs));
+       my $ifs_new = scalar(keys(%{$info->{interface}}));
        
-       if ( ($num_old && !$num_new) || ($num_new && ($num_new < $num_old) && 
-            ($num_new / $num_old) <= $int_thold) ){
+       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.");
            return;
        }
+
+       # Do the same for IP addresses
+
+       my $ips_old = scalar(keys(%old_ips));
+       my $ips_new = scalar(keys(%{$info->{ips}}));
+       
+       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.");
+           return;
+       }
+
     }
 
     # Index by interface name (ifDescr) and number (ifIndex)
@@ -5891,6 +5910,14 @@ sub _update_interfaces {
            next;
        }
 
+       # Don't delete snmp_target address unless updating via UI
+       if ( $ENV{REMOTE_USER} eq 'netdot' && 
+            $self->snmp_target->id == $obj->id ){
+           $logger->debug(sub{sprintf("%s: IP %s is snmp target. Skipping 
delete", 
+                                      $host, $obj->address)});
+           next;
+       }
+
        $logger->info(sprintf("%s: IP %s no longer exists.  Removing.", 
                              $host, $obj->address));
        $obj->delete(no_update_tree=>1);

-----------------------------------------------------------------------

Summary of changes:
 lib/Netdot/Model/Device.pm |   37 ++++++++++++++++++++++++++++++++-----
 1 files changed, 32 insertions(+), 5 deletions(-)


hooks/post-receive
-- 
Netdot


------------------------------

Message: 2
Date: Tue, 27 Nov 2012 11:47:32 -0800
From: [email protected]
Subject: [Netdot-devel] [SCM] Netdot branch netdot-1.0 updated.
        netdot-1.0.2-15-g8909954
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  8909954b82ab248babebcfc6f2048f9aa63428bd (commit)
      from  aa1ea42dc645249b5158484d63c05113152a4ee1 (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 8909954b82ab248babebcfc6f2048f9aa63428bd
Author: Carlos Vicente <[email protected]>
Date:   Tue Nov 27 14:47:28 2012 -0500

    Correction

diff --git a/lib/Netdot/Model/Device.pm b/lib/Netdot/Model/Device.pm
index 6245f59..b509b73 100644
--- a/lib/Netdot/Model/Device.pm
+++ b/lib/Netdot/Model/Device.pm
@@ -1087,7 +1087,7 @@ sub get_snmp_info {
     #
 
     # This table is critical, so if we didn't get anything, ask again
-    if ( !defined($hashes{'ip_index'}) || !(keys $hashes{'ip_index'}) ){
+    if ( !defined($hashes{'ip_index'}) || !(keys %{ $hashes{'ip_index'} }) ){
        $hashes{'ip_index'} = $sinfo->ip_index();
     }
     while ( my($ip,$iid) = each %{ $hashes{'ip_index'} } ){

-----------------------------------------------------------------------

Summary of changes:
 lib/Netdot/Model/Device.pm |    2 +-
 1 files changed, 1 insertions(+), 1 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 8
*******************************************

Reply via email to