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-30-gdb8e51a ([email protected])
   2. [SCM] Netdot branch netdot-1.0 updated.
      netdot-1.0.2-32-gc5d7570 ([email protected])


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

Message: 1
Date: Fri, 30 Nov 2012 12:11:18 -0800
From: [email protected]
Subject: [Netdot-devel] [SCM] Netdot branch netdot-1.0 updated.
        netdot-1.0.2-30-gdb8e51a
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  db8e51a647d6bb10966c70ed9c0ab54b41328055 (commit)
       via  206cc0fefea3491cfce1bd03c3a588163ef8353a (commit)
       via  fc8b23a3fe5f0e835da3d2d7028e9de065fc97df (commit)
      from  5926ecfc71889c3069b0c007f60041577a692d81 (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 db8e51a647d6bb10966c70ed9c0ab54b41328055
Author: Carlos Vicente <[email protected]>
Date:   Fri Nov 30 15:11:11 2012 -0500

    Correction in printf

diff --git a/lib/Netdot/Model/Device.pm b/lib/Netdot/Model/Device.pm
index 8040564..477c371 100644
--- a/lib/Netdot/Model/Device.pm
+++ b/lib/Netdot/Model/Device.pm
@@ -5728,7 +5728,7 @@ sub _update_interfaces {
 
        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".
+           $logger->warn(sprintf("%s: new/old interface ratio: %.2f is below 
INT_COUNT_THRESHOLD".
                                  "Skipping interface update. Re-discover 
manually if needed.",
                                  $host, $ifs_new/$ifs_old));
            return;
@@ -5749,7 +5749,7 @@ sub _update_interfaces {
 
        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".
+           $logger->warn(sprintf("%s: new/old IP ratio: %.2f is below 
INT_COUNT_THRESHOLD".
                                  "Skipping interface update. Re-discover 
manually if needed.",
                                  $host, $ips_new/$ips_old));
            return;

commit 206cc0fefea3491cfce1bd03c3a588163ef8353a
Author: Carlos Vicente <[email protected]>
Date:   Fri Nov 30 14:59:47 2012 -0500

    Remove obsolete CLI command

diff --git a/bin/defragdb b/bin/defragdb
deleted file mode 100644
index 4a391f1..0000000
--- a/bin/defragdb
+++ /dev/null
@@ -1,165 +0,0 @@
-#
-# Check for existing max IDs for tables 
-# such as physaddr, ipblock (these have high churn rates)
-# and, if necessary, renumber all the existing records' fields starting from 1.
-# This script also updates any foreign key fields referencing these IDs.
-# 
-# We do not attempt to update anything related to
-# fwtable, fwtableentry, arpcache, or arpcacheentry
-# since they are usually time-consuming and can be solve easily by
-# executing prune_db.pl, such as bin/prune_db.pl -F -A -d 7 -r
-# 
-use strict;
-use lib "../lib";
-use DBUTIL;
-use Netdot;
-use Netdot::Model;
-use Data::Dumper;
-
-my %CONFIG;
-$CONFIG{debug}             = 0;
-$CONFIG{threshold}         = 0.7;
-
-my $real_run = 1;
-
-my $mysql_uint_max = 4294967295;
-my $pg_uint_max    = 2147483647;
-
-foreach my $var ( qw /DB_TYPE DB_HOME DB_HOST DB_PORT DB_DBA DB_DBA_PASSWORD 
-                 DB_NETDOT_USER DB_NETDOT_PASS DB_DATABASE/ ){
-    $CONFIG{$var} = Netdot->config->get($var);
-}
-
-# need DBA's ALTER privileges, which netdot_user does not have
-my $dbh = &dbconnect($CONFIG{DB_TYPE}, $CONFIG{DB_HOST}, $CONFIG{DB_PORT}, 
-                    $CONFIG{DB_DBA}, $CONFIG{DB_DBA_PASSWORD}, 
$CONFIG{DB_DATABASE});
-
-my @tables = Netdot->meta->get_tables(with_history=>0);
-
-if ( $CONFIG{DB_TYPE} eq 'mysql' ){
-    foreach my $t ( @tables ){
-       my %locks = ();
-       my $table = lc($t->db_name);
-       my ($max_id) = $dbh->selectrow_array("SELECT max(id) FROM $table");
-       $max_id = 0 if !defined($max_id);
-       next if 1.0*$max_id / $mysql_uint_max < $CONFIG{threshold};
-       
-       my ($count_id) = $dbh->selectrow_array("SELECT count(id) FROM $table");
-       print "Defragmenting table $table (max ID is $max_id, number of IDs is 
$count_id)...\n";
-       
-       # finding which tables to lock (WRITE lock)
-       $locks{$table} = 1;
-       my %from = $t->get_links_from;
-       foreach my $method ( keys %from ){
-           foreach my $far_table ( keys %{ $from{$method} } ){
-               my $far_tname = $far_table->meta_data->db_name;
-               if ( !exists $locks{$far_tname} ) {
-                   $locks{$far_tname} = 1;
-               }
-           }
-       }
-       
-       # check if {fwtable, fwtableentry, arpcache, arpcacheentry} is to be 
updated
-       my $skip = 0;
-       foreach my $big_table ( qw /arpcache arpcacheentry fwtable 
fwtableentry/ ) {
-           if ( exists $locks{$big_table} ) {
-               my ($ref_count) = $dbh->selectrow_array("SELECT count(id) FROM 
$big_table");
-               if ( $ref_count > 0 ) {
-                   $skip = 1;
-                   last;
-               }
-           }
-       }
-       if ($skip == 1) {
-           print "Skipping table $table because it references to a large table 
(it may be too time consuming to update).\n";
-           print "Please run prune_db.pl with rotate on arpcache, 
arpcacheentry, fwtable, fwtableentry first.\n";
-           next;
-       }
-       
-       # before locking tables, check if we need to do transactions
-       # i.e. we need transactions if this table is referenced by other tables
-       # mysql suggests to use "SET autocommit=0" rather than "START 
TRANSACTION"
-       if ( (scalar keys %from) > 0 ){
-           $dbh->{AutoCommit} = 0 if $real_run;
-       }
-       
-       # actually locking the tables
-       my $lock_st = "LOCK TABLES " . join(', ', keys %locks) . " WRITE";
-       $lock_st =~ s/,/ WRITE,/g;
-       $dbh->do($lock_st) if $real_run;
-       print $lock_st."\n" if $CONFIG{debug};
-       
-       # prepare statements
-       my $smallest_id_st = $dbh->prepare("SELECT min(id) FROM $table WHERE 
id>?");
-       my $update_id_st   = $dbh->prepare("UPDATE $table SET id=? WHERE id=?");
-       my %update_st = ();
-       foreach my $method ( keys %from ){
-           foreach my $far_table ( keys %{ $from{$method} } ){
-               my $far_tname = $far_table->meta_data->db_name;
-               my $far_col = $from{$method}{$far_table};
-               $update_st{$far_tname} = $dbh->prepare("UPDATE $far_tname SET 
$far_col=? WHERE $far_col=?");
-           }
-       }
-       
-       # shift down the ids so that they start from 1
-       my $new_index = 1;
-       my @new_id_st = ();
-       my $prev_id = 0;
-       my $old_id = 0;
-       for ( $new_index = 1; ; $new_index++ ) {
-           $smallest_id_st->execute($old_id);
-           ($old_id) = $smallest_id_st->fetchrow_array();
-           last if !defined($old_id);
-           last if $old_id == $prev_id;
-           next if $old_id == $new_index;
-           
-           $update_id_st->execute($new_index,$old_id) if $real_run;
-           print "UPDATE $table SET id=$new_index WHERE id=$old_id"."\n" if 
$CONFIG{debug};
-           
-           # get the other tables that link to this id
-           # and update those values
-           foreach my $far_tname ( keys %update_st ) {
-               $update_st{$far_tname}->execute($new_index,$old_id);
-           }
-           $prev_id = $old_id;
-           
-           if ( (scalar keys %from) > 0 ){
-               $dbh->commit if $real_run;
-           }
-       }
-       
-       $dbh->do("ALTER TABLE $table AUTO_INCREMENT=$new_index") if $real_run;
-       print "ALTER TABLE $table AUTO_INCREMENT=$new_index"."\n" if 
$CONFIG{debug};
-       
-       # unlock the tables
-       $dbh->commit if $real_run;
-       $dbh->do("UNLOCK TABLES") if $real_run;
-       
-       # set autocommit back to 1
-       $dbh->{AutoCommit} = 1 if $real_run;
-       
-       my ($new_max_id) = $dbh->selectrow_array("SELECT max(id) FROM $table");
-       print "Done with $table, new max ID is $new_max_id.\n";
-       
-       print $table.": ".1.0*$max_id/$mysql_uint_max."\n\n" if $CONFIG{debug};
-    }
-} elsif ( $CONFIG{DB_TYPE} =~ /^pg$/i ) {
-    # The only two things that are different is table locking
-    # and modifying the auto increment index.
-    # 
-    # For the table locking part, 
-    # the idea is to write (exclusive) lock the table so that the new value of 
auto_increment at the end is valid (nobody can generate a new id during this 
update)
-    # make sure transactions (AutoCommit set to 0) play well with locks 
(although the use of AutoCommit = 0 rather than explicit transactions should be 
ok for Pg as well)
-    # 
-    # For the auto increment part, the SQL query is:
-    # $dbh->do("SELECT setval('" . $table . "_id_seq', $new_index, false)"); 
#nextval() will return new_index
-    print "Pg currently not supported.\n";
-} else {
-    print "Database type $CONFIG{db_type} is not supported.\n";
-}
-
-&dbdisconnect($dbh);
-
-sub debug {
-    print STDERR "[DEBUG] Executing: ", @_, "\n" if $CONFIG{debug};
-}

commit fc8b23a3fe5f0e835da3d2d7028e9de065fc97df
Author: Carlos Vicente <[email protected]>
Date:   Fri Nov 30 14:59:01 2012 -0500

    Remove unnecessary third party package

diff --git a/thirdparty/Net-Patricia-1.19_01.tar.gz 
b/thirdparty/Net-Patricia-1.19_01.tar.gz
deleted file mode 100644
index b5e8272..0000000
Binary files a/thirdparty/Net-Patricia-1.19_01.tar.gz and /dev/null differ

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

Summary of changes:
 bin/defragdb                           |  165 --------------------------------
 lib/Netdot/Model/Device.pm             |    4 +-
 thirdparty/Net-Patricia-1.19_01.tar.gz |  Bin 27098 -> 0 bytes
 3 files changed, 2 insertions(+), 167 deletions(-)
 delete mode 100644 bin/defragdb
 delete mode 100644 thirdparty/Net-Patricia-1.19_01.tar.gz


hooks/post-receive
-- 
Netdot


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

Message: 2
Date: Fri, 30 Nov 2012 12:56:39 -0800
From: [email protected]
Subject: [Netdot-devel] [SCM] Netdot branch netdot-1.0 updated.
        netdot-1.0.2-32-gc5d7570
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  c5d7570a5fb631b2beda35617e4ce00f982e250e (commit)
       via  5dae1418f96a8576dd585e89cb8896e37d0ceaa8 (commit)
      from  db8e51a647d6bb10966c70ed9c0ab54b41328055 (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 c5d7570a5fb631b2beda35617e4ce00f982e250e
Author: Carlos Vicente <[email protected]>
Date:   Fri Nov 30 15:55:52 2012 -0500

    Require Net::Patricia 1.20. Remove code to install locally patched 
Net::Patricia

diff --git a/bin/perldeps.pl b/bin/perldeps.pl
index a8df8b6..ab66aae 100755
--- a/bin/perldeps.pl
+++ b/bin/perldeps.pl
@@ -49,7 +49,7 @@ my @DEPS = (
     {cpan=>'Log::Log4perl', apt=>'liblog-log4perl-perl', 
rpm=>'perl-Log-Log4perl'},
     {cpan=>'Parallel::ForkManager', apt=>'libparallel-forkmanager-perl', 
      rpm=>'perl-Parallel-ForkManager'},
-    {cpan=>'Net::Patricia 1.19_01', apt=> 'libnet-patricia-perl', rpm=>''},
+    {cpan=>'Net::Patricia 1.20', apt=> 'libnet-patricia-perl', rpm=>''},
     {cpan=>'Authen::Radius', apt=>'libauthen-radius-perl', 
rpm=>'perl-Authen-Radius'},
     {cpan=>'Test::Simple' , apt=> 'libtest-simple-perl', rpm=>''},
     {cpan=>'Net::IRR', apt=> 'libnet-irr-perl', rpm=>''},
@@ -278,13 +278,6 @@ sub install_modules_cpan{
        my $module = $anon_hash->{'cpan'};
        next unless $module;
 
-       # This is temporary until Net::Patricia is patched upstream
-       if ( $module =~ /^Net::Patricia/ ){
-           &cmd("cd thirdparty/; tar xzvf Net-Patricia-1.19_01.tar.gz;".
-                "cd Net-Patricia-1.19_01; perl Makefile.PL; ".
-                "make all && make test && make install");
-       }
-       
        eval "use $module";
        if ( $@ ){
            $module =~ s/^(.*)\s+.*/$1/;

commit 5dae1418f96a8576dd585e89cb8896e37d0ceaa8
Author: Carlos Vicente <[email protected]>
Date:   Fri Nov 30 15:39:51 2012 -0500

    Removed two unnecessary exceptions in Device class. Avoids noisy error 
messages

diff --git a/lib/Netdot/Model/Device.pm b/lib/Netdot/Model/Device.pm
index 477c371..0c7c8b7 100644
--- a/lib/Netdot/Model/Device.pm
+++ b/lib/Netdot/Model/Device.pm
@@ -699,8 +699,10 @@ sub get_snmp_info {
            $sess_args{$arg} = $args{$arg} if defined $args{$arg};
        }
        $sinfo = $self->_get_snmp_session(%sess_args);
+       return unless $sinfo;
     }
 
+
     $dev{_sclass} = $sinfo->class();
 
     # Assign the snmp_target by resolving the name
@@ -842,7 +844,9 @@ sub get_snmp_info {
                                                                           
'communities' => [$comm],
                                                                           
'version'     => $sinfo->snmp_ver,
                                                                           
'sclass'      => $sinfo->class);
-                                   
+
+                                   return unless $vsinfo;
+  
                                    $stp_p_info = $class->_exec_timeout( 
                                        $args{host}, 
                                        sub{  return 
$self->_get_stp_info(sinfo=>$vsinfo) } 
@@ -888,6 +892,9 @@ sub get_snmp_info {
                                                                       
'communities' => [$comm],
                                                                       
'version'     => $sinfo->snmp_ver,
                                                                       'sclass' 
     => $sinfo->class);
+                               
+                               return unless $vsinfo;
+                               
                                my $stp_p_info = $class->_exec_timeout( 
                                    $args{host}, 
                                    sub{  return 
$self->_get_stp_info(sinfo=>$vsinfo) } );
@@ -1436,6 +1443,8 @@ sub discover {
                                                   priv_proto  => 
$argv{priv_proto},
                                                   priv_pass   => 
$argv{priv_pass},
                    );
+
+               return unless $sinfo;
            }
            $info = $class->_exec_timeout($name, 
                                          sub{ return 
$class->get_snmp_info(session   => $sinfo,
@@ -2711,6 +2720,9 @@ sub snmp_update {
                                          priv_proto  => $argv{priv_proto},
                                          priv_pass   => $argv{priv_pass},
            );
+
+       return unless $sinfo;
+
     }
     
     # Re-bless into appropriate sub-class if needed
@@ -3820,12 +3832,16 @@ sub _get_snmp_session {
        # Being called as an instance method
 
        # Do not continue unless snmp_managed flag is on
-       $self->throw_user(sprintf("Device %s not SNMP-managed. Aborting.", 
$self->fqdn))
-           unless $self->snmp_managed;
+       unless ( $self->snmp_managed ){
+           $logger->debug(sprintf("Device %s not SNMP-managed. Aborting.", 
$self->fqdn));
+           return;
+       }
 
        # Do not continue if we've exceeded the connection attempts threshold
-       $self->throw_user(sprintf("Device %s has been marked as snmp_down. 
Aborting.", $self->fqdn))
-           if ( $self->snmp_down == 1 );
+       if ( $self->snmp_down == 1 ){
+           $logger->info(sprintf("Device %s has been marked as snmp_down. 
Aborting.", $self->fqdn));
+           return;
+       }
 
        # Fill up SNMP arguments from object if it wasn't passed to us
        if ( !defined $argv{communities} && $self->community ){
@@ -4578,6 +4594,8 @@ sub _get_arp_from_snmp {
     my %cache;
     my $sinfo = $argv{session} || $self->_get_snmp_session();
 
+    return unless $sinfo;
+
     my %devints; my %devsubnets;
     foreach my $int ( $self->interfaces ){
        $devints{$int->number} = $int->id;
@@ -4645,6 +4663,9 @@ sub _get_v6_nd_from_snmp {
     my $host = $self->fqdn;
     my %cache;
     my $sinfo = $argv{session} || $self->_get_snmp_session();
+
+    return unless $sinfo;
+
     unless ( $sinfo->can('ipv6_n2p_mac') ){
        $logger->debug("Device::_get_v6_nd_from_snmp: This version of 
SNMP::Info ".
                       "does not support fetching Ipv6 addresses");
@@ -4789,6 +4810,9 @@ sub _get_fwt_from_snmp {
 
     my $start   = time;
     my $sinfo   = $argv{session} || $self->_get_snmp_session();
+
+    return unless $sinfo;
+
     my $sints   = $sinfo->interfaces();
 
     # Build a hash with device's interfaces, indexed by ifIndex
@@ -4847,6 +4871,9 @@ sub _get_fwt_from_snmp {
                 $logger->error("$host: SNMP error for VLAN $vlan: $e");
                 next;
             }
+
+           return unless $vlan_sinfo;
+
             $class->_exec_timeout($host, sub{ return $self->_walk_fwt(sinfo   
=> $vlan_sinfo,
                                                                      sints   
=> $sints,
                                                                      devints 
=> \%devints,

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

Summary of changes:
 bin/perldeps.pl            |    9 +--------
 lib/Netdot/Model/Device.pm |   37 ++++++++++++++++++++++++++++++++-----
 2 files changed, 33 insertions(+), 13 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 69, Issue 1
*******************************************

Reply via email to