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.4-108-g13f17fb ([email protected])
2. [SCM] Netdot branch netdot-1.0 updated.
netdot-1.0.4-109-g771bab9 ([email protected])
3. [SCM] Netdot branch master updated. netdot-1.0.4-109-g771bab9
([email protected])
----------------------------------------------------------------------
Message: 1
Date: Wed, 30 Oct 2013 13:45:04 -0700
From: [email protected]
Subject: [Netdot-devel] [SCM] Netdot branch netdot-1.0 updated.
netdot-1.0.4-108-g13f17fb
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 13f17fbac8c635a58e49080c2a21130607a28bc9 (commit)
from 93a4c244f5015810ef5a559c63fed2830966f677 (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 13f17fbac8c635a58e49080c2a21130607a28bc9
Author: Carlos Vicente <[email protected]>
Date: Wed Oct 30 00:24:02 2013 -0400
Avoid problems when discovering new devices if the name matches more than
one RR
diff --git a/lib/Netdot/Model/Device.pm b/lib/Netdot/Model/Device.pm
index 78b3688..9d92fb1 100644
--- a/lib/Netdot/Model/Device.pm
+++ b/lib/Netdot/Model/Device.pm
@@ -432,11 +432,9 @@ sub assign_name {
unless $host;
# An RR record might already exist
- if ( defined $host && (my @rrs = RR->search(name=>$host)) ){
- if ( scalar @rrs == 1 ){
- $logger->debug(sub{"Name $host exists in DB"});
- return $rrs[0];
- }
+ if ( defined $host && (my $rr = RR->search(name=>$host)->first) ){
+ $logger->debug(sub{"Name $host exists in DB"});
+ return $rr;
}
# An RR matching $host does not exist, or the name exists in
# multiple zones
-----------------------------------------------------------------------
Summary of changes:
lib/Netdot/Model/Device.pm | 8 +++-----
1 files changed, 3 insertions(+), 5 deletions(-)
hooks/post-receive
--
Netdot
------------------------------
Message: 2
Date: Thu, 31 Oct 2013 08:26:05 -0700
From: [email protected]
Subject: [Netdot-devel] [SCM] Netdot branch netdot-1.0 updated.
netdot-1.0.4-109-g771bab9
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 771bab9602a9284af6980e7c6846ddd76b288541 (commit)
from 13f17fbac8c635a58e49080c2a21130607a28bc9 (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 771bab9602a9284af6980e7c6846ddd76b288541
Author: Carlos Vicente <[email protected]>
Date: Wed Oct 30 04:08:58 2013 -0400
Pass all SNMP-related parameters from updatedevices.pl to the topology
discovery process
diff --git a/bin/updatedevices.pl b/bin/updatedevices.pl
index af70f08..12318c2 100755
--- a/bin/updatedevices.pl
+++ b/bin/updatedevices.pl
@@ -4,7 +4,8 @@
#
# This script retrieves SNMP information from one ore more devices
# and updates the Netdot database. It can retrive basic device information
-# as well as bridge forwarding tables and ARP caches.
+# as well as bridge forwarding tables and ARP caches. In addition, it can
+# execute the topology discovery process.
#
use strict;
use lib "<<Make:LIB>>";
@@ -18,8 +19,8 @@ my ($host, $blocks, $db, $matching, $file, $commstrs,
$version, $sec_name,
$sec_level, $auth_proto, $auth_pass, $priv_proto, $priv_pass);
# Default values
-my $retries = Netdot->config->get('DEFAULT_SNMPRETRIES');
-my $timeout = Netdot->config->get('DEFAULT_SNMPTIMEOUT');
+my $retries = Netdot->config->get('DEFAULT_SNMPRETRIES');
+my $timeout = Netdot->config->get('DEFAULT_SNMPTIMEOUT');
# Flags
my ($ATOMIC, $ADDSUBNETS, $SUBSINHERIT, $BGPPEERS, $RECURSIVE, $INFO, $FWT,
@@ -129,10 +130,24 @@ foreach my $flagref ( \$ADDSUBNETS, \$SUBSINHERIT,
\$BGPPEERS ){
}
}
+# Common update arguments
+my %uargs = (version => $version,
+ timeout => $timeout,
+ retries => $retries,
+ sec_name => $sec_name,
+ sec_level => $sec_level,
+ auth_proto => $auth_proto,
+ auth_pass => $auth_pass,
+ priv_proto => $priv_proto,
+ priv_pass => $priv_pass,
+ );
+
my @communities = split ',', $commstrs if defined $commstrs;
# Remove any spaces
map { $_ =~ s/\s+// } @communities;
+$uargs{communities} = \@communities if @communities;
+
# Add a log appender
my $logscr = Netdot::Util::Log->new_appender('Screen', stderr=>0);
@@ -160,32 +175,29 @@ $logger->info(sprintf("$0 started at %s", scalar
localtime($start)));
if ( $INFO || $FWT || $ARP ){
- my %uargs = (version => $version,
- timeout => $timeout,
- retries => $retries,
- sec_name => $sec_name,
- sec_level => $sec_level,
- auth_proto => $auth_proto,
- auth_pass => $auth_pass,
- priv_proto => $priv_proto,
- priv_pass => $priv_pass,
- pretend => $PRETEND,
- atomic => $ATOMIC,
- add_subnets => $ADDSUBNETS,
- subs_inherit => $SUBSINHERIT,
- bgp_peers => $BGPPEERS,
- do_info => $INFO,
- do_fwt => $FWT,
- do_arp => $ARP,
- matching => $matching,
+ # Arguments specific to these functions
+ my %dargs = (
+ pretend => $PRETEND,
+ atomic => $ATOMIC,
+ add_subnets => $ADDSUBNETS,
+ subs_inherit => $SUBSINHERIT,
+ bgp_peers => $BGPPEERS,
+ do_info => $INFO,
+ do_fwt => $FWT,
+ do_arp => $ARP,
+ matching => $matching,
);
- $uargs{communities} = \@communities if @communities;
-
+
+ # Add the common update arguments
+ while ( my($key, $val) = each %uargs ){
+ $dargs{$key} = $val;
+ }
+
if ( $host ){
$logger->info("Updating single device: $host");
- $uargs{name} = $host;
+ $dargs{name} = $host;
eval {
- Device->discover(%uargs);
+ Device->discover(%dargs);
};
die "ERROR: $@\n" if $@;
@@ -193,17 +205,17 @@ if ( $INFO || $FWT || $ARP ){
my @blocks = split ',', $blocks;
map { $_ =~ s/\s+//g } @blocks;
$logger->info("Updating all devices in $blocks");
- $uargs{blocks} = \@blocks;
- Netdot::Model::Device->snmp_update_block(%uargs);
+ $dargs{blocks} = \@blocks;
+ Netdot::Model::Device->snmp_update_block(%dargs);
}elsif ( $db ){
$logger->info("Updating all devices in the DB");
- Netdot::Model::Device->snmp_update_all(%uargs);
+ Netdot::Model::Device->snmp_update_all(%dargs);
}elsif ( $file ){
$logger->info("Updating all devices in given file: $file");
- $uargs{file} = $file;
- Netdot::Model::Device->snmp_update_from_file(%uargs);
+ $dargs{file} = $file;
+ Netdot::Model::Device->snmp_update_from_file(%dargs);
}else{
print $USAGE;
@@ -215,9 +227,7 @@ if ( $TOPO ){
$logger = Netdot->log->get_logger('Netdot::Topology');
$logger->level($DEBUG) if ( $_DEBUG ); # Notice that $DEBUG is imported
from Log::Log4perl
$logger->add_appender($logscr);
- my %uargs;
- $uargs{recursive} = 1 if $RECURSIVE;
- $uargs{communities} = \@communities if @communities;
+ $uargs{recursive} = 1 if $RECURSIVE;
Netdot::Topology->discover(%uargs);
}
@@ -229,7 +239,7 @@ Carlos Vicente, C<< <cvicente at ns.uoregon.edu> >>
=head1 COPYRIGHT & LICENSE
-Copyright 2009 University of Oregon, all rights reserved.
+Copyright 2013 University of Oregon, all rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/Netdot/Topology.pm b/lib/Netdot/Topology.pm
index 292fece..ac3e411 100644
--- a/lib/Netdot/Topology.pm
+++ b/lib/Netdot/Topology.pm
@@ -35,11 +35,21 @@ Netdot Device Topology Class
exclude_p2p - optional, set to true to exclude P2P
interfaces - optional, interfaces to preform topology update on
recursive - optional, recursively discover unknown neighbors
- communities - Array of communities to try when discovering unknown
neighbors
+ communities - Arrayref of SNMP communities
+ version - SNMP version
+ timeout - SNMP timeout
+ retries - SNMP retries
+ sec_name - SNMP Security Name
+ sec_level - SNMP Security Level
+ auth_proto - SNMP Authentication Protocol
+ auth_pass - SNMP Auth Key
+ priv_proto - SNMP Privacy Protocol
+ priv_pass - SNMP Privacy Key
+
Returns:
True
Examples:
- Netdot::Topology->discover();
+ Netdot::Topology->discover(%args);
=cut
@@ -59,12 +69,10 @@ sub discover {
$srcs, $MINSCORE));
my $start = time;
- my $stp_links = $class->get_stp_links() if ( $SOURCES{STP} );
- my $fdb_links = $class->get_fdb_links() if ( $SOURCES{FDB} );
-
- my $dp_links = $class->get_dp_links(%argv) if ( $SOURCES{DP} );
-
- my $p2p_links = $class->get_p2p_links() if ( $SOURCES{P2P} );
+ my $stp_links = $class->get_stp_links() if ( $SOURCES{STP} );
+ my $fdb_links = $class->get_fdb_links() if ( $SOURCES{FDB} );
+ my $dp_links = $class->get_dp_links(%argv) if ( $SOURCES{DP} );
+ my $p2p_links = $class->get_p2p_links() if ( $SOURCES{P2P} );
$logger->debug(sprintf("Netdot::Topology: All links determined in %s",
$class->sec2dhms(time - $start)));
@@ -311,9 +319,19 @@ sub update_links {
=head2 get_dp_links - Get links between devices based on Discovery Protocol
(CDP/LLDP) Info
Arguments:
- interfaces - Optional interfaces to get dp links from
- recursive - Recursively discover unknown neighbors
- communities - Array of communities to try when discovering unknown
neighbors
+ interfaces - Optional interfaces to get dp links from
+ recursive - Recursively discover unknown neighbors
+ communities - Arrayref of SNMP communities
+ version - SNMP version
+ timeout - SNMP timeout
+ retries - SNMP retries
+ sec_name - SNMP Security Name
+ sec_level - SNMP Security Level
+ auth_proto - SNMP Authentication Protocol
+ auth_pass - SNMP Auth Key
+ priv_proto - SNMP Privacy Protocol
+ priv_pass - SNMP Privacy Key
+
Returns:
Hashref with link info
Example:
@@ -556,6 +574,13 @@ sub get_dp_links {
$logger->debug(sprintf("Topology::get_dp_links: %d Links determined in
%s",
scalar keys %links, $class->sec2dhms(time -
$start)));
+ # Grab the relevant arguments for Device::discover()
+ my %dargs;
+ foreach my $key (qw/communities version timeoutretries sec_name sec_level
+ auth_proto auth_pass priv_proto priv_pass /){
+ $dargs{$key} = $argv{$key};
+ }
+
my @new_devs;
IPLOOP: foreach my $ip ( keys %ips2discover ){
foreach my $block ( keys %$excluded_blocks ){
@@ -567,7 +592,7 @@ sub get_dp_links {
}
$logger->info("Topology::get_dp_links: Discovering unknown neighbor:
$ip");
eval {
- push @new_devs, Device->discover(name=>$ip,
communities=>$argv{communities});
+ push @new_devs, Device->discover(name=>$ip, %dargs);
};
}
if ( @new_devs && $argv{recursive} ){
-----------------------------------------------------------------------
Summary of changes:
bin/updatedevices.pl | 78 +++++++++++++++++++++++++++---------------------
lib/Netdot/Topology.pm | 49 ++++++++++++++++++++++-------
2 files changed, 81 insertions(+), 46 deletions(-)
hooks/post-receive
--
Netdot
------------------------------
Message: 3
Date: Thu, 31 Oct 2013 08:26:51 -0700
From: [email protected]
Subject: [Netdot-devel] [SCM] Netdot branch master updated.
netdot-1.0.4-109-g771bab9
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, master has been updated
via 771bab9602a9284af6980e7c6846ddd76b288541 (commit)
via 13f17fbac8c635a58e49080c2a21130607a28bc9 (commit)
from 93a4c244f5015810ef5a559c63fed2830966f677 (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 -----------------------------------------------------------------
-----------------------------------------------------------------------
Summary of changes:
bin/updatedevices.pl | 78 +++++++++++++++++++++++++-------------------
lib/Netdot/Model/Device.pm | 8 ++---
lib/Netdot/Topology.pm | 49 +++++++++++++++++++++-------
3 files changed, 84 insertions(+), 51 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 79, Issue 11
********************************************