Merge branch 'master' into og-api-tokens

This commit is contained in:
Oliver Gorwits
2018-12-31 17:27:30 +00:00
21 changed files with 182 additions and 70 deletions

View File

@@ -62,7 +62,7 @@ __PACKAGE__->set_primary_key("job");
=head2 device_skips( $backend?, $max_deferrals?, $retry_after? )
Retuns the set of C<device_skip> entries which apply to this job. They match
Returns the set of C<device_skip> entries which apply to this job. They match
the device IP, current backend, and job action.
You probably want to use the ResultSet method C<skipped> which completes this
@@ -122,7 +122,7 @@ sub display_name {
=head1 ADDITIONAL COLUMNS
=head2 entererd_stamp
=head2 entered_stamp
Formatted version of the C<entered> field, accurate to the minute.

View File

@@ -205,6 +205,8 @@ NodeIp table of nodes with addresses of the supplied IP version.
The C<version> parameter must be an integer either 4 or 6.
=back
=cut
sub ip_version {

View File

@@ -59,8 +59,9 @@ Performs initialisation of the Job Queue backend.
=head2 jq_log()
Returns a list of the most recent 50 jobs in the queue. Jobs are returned as
objects which implement the Netdisco job instance interface (see below).
Returns a list of the most recent jobs as defined in C<jobs_qdepth> from the
queue. Jobs are returned as objects which implement the Netdisco job instance
interface (see below).
=head2 jq_userlog( $user )

View File

@@ -273,7 +273,7 @@ sub jq_log {
return schema('netdisco')->resultset('Admin')->search({}, {
prefetch => 'target',
order_by => { -desc => [qw/entered device action/] },
rows => 50,
rows => (setting('jobs_qdepth') || 50),
})->with_times->hri->all;
}

View File

@@ -36,6 +36,11 @@ Returns a list of hashrefs in the format C<{ mac => MACADDR, ip => IPADDR }>.
sub arpnip {
my ($self, $hostlabel, $ssh, $args) = @_;
# IOSXR show commands seem to depend on an available STDIN
unless (-t STDIN){
open STDIN, "<", "/dev/zero" or warn "Failed to fake stdin: $!";
}
debug "$hostlabel $$ arpnip()";
my @data = $ssh->capture("show arp vrf all");

View File

@@ -16,17 +16,18 @@ register_worker({ phase => 'main', driver => 'snmp' }, sub {
my $snmp = App::Netdisco::Transport::SNMP->reader_for($device)
or return Status->defer("discover failed: could not SNMP connect to $device");
my $ospf_peers = $snmp->ospf_peers || {};
my $bgp_peers = $snmp->bgp_peer_addr || {};
my $eigrp_peers = $snmp->eigrp_peers || {};
my $ospf_peers = $snmp->ospf_peers || {};
my $ospf_routers = $snmp->ospf_peer_id || {};
my $bgp_peers = $snmp->bgp_peer_addr || {};
my $eigrp_peers = $snmp->eigrp_peers || {};
return Status->info(" [$device] neigh - no BGP, OSPF, or EIGRP peers")
unless ((scalar values %$ospf_peers) or (scalar values %$bgp_peers)
or (scalar values %$eigrp_peers));
my $count = 0;
foreach my $ip ((values %$ospf_peers), (values %$bgp_peers),
(values %$eigrp_peers)) {
foreach my $ip ((values %$ospf_peers), (values %$ospf_routers),
(values %$bgp_peers), (values %$eigrp_peers)) {
my $peer = get_device($ip);
next if $peer->in_storage or not is_discoverable($peer);
next if vars->{'queued'}->{$ip};

View File

@@ -181,6 +181,13 @@ register_worker({ phase => 'early', driver => 'snmp' }, sub {
next;
}
# Skip interfaces which are 'notPresent' and match the notpresent type filter
if (defined $i_up->{$entry} and defined $i_type->{$entry} and $i_up->{$entry} eq 'notPresent' and (scalar grep {$i_type->{$entry} =~ m/^$_$/} @{setting('ignore_notpresent_types') || []}) ) {
debug sprintf ' [%s] interfaces - ignoring %s (%s) (%s) (config:ignore_notpresent_types)',
$device->ip, $entry, $port, $i_up->{$entry};
next;
}
my $lc = $i_lastchange->{$entry} || 0;
if (not $dev_uptime_wrapped and $lc > $dev_uptime) {
info sprintf ' [%s] interfaces - device uptime wrapped (%s) - correcting',
@@ -263,7 +270,7 @@ sub _get_vrf_list {
if ($vrf =~ /^\S+$/) {
my $ctx_name = pack("C*",split(/\./,$idx));
$ctx_name =~ s/.*[^[:print:]]+//;
debug sprintf(' [%s] Discover VRF %s with SNMP Context %s', $device->ip, $vrf, $ctx_name);
debug sprintf(' [%s] Discover VRF %s with SNMP Context %s', $device->ip, $vrf, $ctx_name);
push (@ok_vrfs, $ctx_name);
}
}

View File

@@ -68,6 +68,8 @@ register_worker({ phase => 'main' }, sub {
true;
=encoding utf8
=head1 NAME
MakeRancidConf - Generate RANCID Configuration