view release on metacpan or search on metacpan
'Sub::Util' => '1.40',
'Template' => '2.24',
'Template::AutoFilter' => '0',
'Template::Plugin::CSV' => '0.04',
'Template::Plugin::Number::Format' => '1.02',
'Term::ANSIColor' => '5.01',
'Term::ReadLine' => '0',
'Term::UI' => '0',
'Text::CSV' => '2.04',
'Text::CSV_XS' => '1.53',
'Try::Tiny' => '0',
'URI' => '0',
'URI::Based' => '0',
'URL::Encode' => '0.03',
'URL::Encode::XS' => '0',
'YAML' => '0.84',
'YAML::XS' => '0.41',
},
recommends => {
'Graph' => '0',
'GraphViz' => '0',
"Sys::SigAction" : "0",
"Template" : "2.24",
"Template::AutoFilter" : "0",
"Template::Plugin::CSV" : "0.04",
"Template::Plugin::Number::Format" : "1.02",
"Term::ANSIColor" : "5.01",
"Term::ReadLine" : "0",
"Term::UI" : "0",
"Text::CSV" : "2.04",
"Text::CSV_XS" : "1.53",
"Try::Tiny" : "0",
"URI" : "0",
"URI::Based" : "0",
"URL::Encode" : "0.03",
"URL::Encode::XS" : "0",
"YAML" : "0.84",
"YAML::XS" : "0.41",
"aliased" : "0",
"autovivification" : "0",
"namespace::clean" : "0.24",
"version" : "0.9902"
Sys::SigAction: '0'
Template: '2.24'
Template::AutoFilter: '0'
Template::Plugin::CSV: '0.04'
Template::Plugin::Number::Format: '1.02'
Term::ANSIColor: '5.01'
Term::ReadLine: '0'
Term::UI: '0'
Text::CSV: '2.04'
Text::CSV_XS: '1.53'
Try::Tiny: '0'
URI: '0'
URI::Based: '0'
URL::Encode: '0.03'
URL::Encode::XS: '0'
YAML: '0.84'
YAML::XS: '0.41'
aliased: '0'
autovivification: '0'
namespace::clean: '0.24'
version: '0.9902'
bin/nd-import-topology view on Meta::CPAN
}
use App::Netdisco;
use Dancer ':script';
use Dancer::Plugin::DBIC 'schema';
use App::Netdisco::JobQueue 'jq_insert';
use App::Netdisco::Util::Device 'get_device';
use NetAddr::IP::Lite ':lower';
use Try::Tiny;
=head1 NAME
nd-import-topology - Import a Nedisco 1.x Manual Topology File
=head1 USAGE
~/bin/localenv nd-import-topology /path/to/netdisco-topology.txt
=head1 DESCRIPTION
bin/netdisco-db-deploy view on Meta::CPAN
dir($FindBin::RealBin, 'lib')->stringify;
use Config;
$ENV{PATH} = $FindBin::RealBin . $Config{path_sep} . $ENV{PATH};
}
use App::Netdisco;
use Dancer ':script';
use Dancer::Plugin::DBIC 'schema';
use Try::Tiny;
=head1 NAME
netdisco-db-deploy - Database deployment for Netdisco
=head1 USAGE
This script upgrades or initialises a Netdisco database schema.
~/bin/netdisco-db-deploy [--redeploy-all]
bin/netdisco-deploy view on Meta::CPAN
use 5.010_000;
use Term::UI;
use Term::ReadLine;
use Term::ANSIColor;
use Archive::Extract;
$Archive::Extract::PREFER_BIN = 1;
use File::Slurper 'read_lines';
use HTTP::Tiny;
use Digest::MD5;
use Try::Tiny;
use File::Path ();
use File::Copy ();
use Encode;
=head1 NAME
netdisco-deploy - Database, OUI and MIB deployment for Netdisco
=head1 USAGE
bin/netdisco-do view on Meta::CPAN
# stuff useful locations into @INC and $PATH
unshift @INC,
dir($FindBin::RealBin)->parent->subdir('lib')->stringify,
dir($FindBin::RealBin, 'lib')->stringify;
}
# for netdisco app config
use App::Netdisco;
use Dancer qw/:moose :script/;
use Try::Tiny;
use Pod::Usage;
use Scalar::Util 'blessed';
use File::Slurper 'read_lines';
use NetAddr::IP qw/:rfc3021 :lower/;
use App::Netdisco::Backend::Job;
use App::Netdisco::JobQueue 'jq_insert';
use App::Netdisco::Util::Device 'get_device';
use Getopt::Long;
lib/App/Netdisco/Backend/Role/Poller.pm view on Meta::CPAN
package App::Netdisco::Backend::Role::Poller;
use Dancer qw/:moose :syntax :script/;
use Try::Tiny;
use App::Netdisco::Util::MCE;
use Time::HiRes 'sleep';
use App::Netdisco::JobQueue qw/jq_defer jq_complete/;
use Role::Tiny;
use namespace::clean;
# add dispatch methods for poller tasks
with 'App::Netdisco::Worker::Runner';
lib/App/Netdisco/DB/ResultSet/Device.pm view on Meta::CPAN
package App::Netdisco::DB::ResultSet::Device;
use base 'App::Netdisco::DB::ResultSet';
use strict;
use warnings;
use Try::Tiny;
use Regexp::Common 'net';
use NetAddr::IP::Lite ':lower';
use NetAddr::MAC ();
require Dancer::Logger;
=head1 ADDITIONAL METHODS
=head2 device_ips_with_address_or_name( $address_or_name )
lib/App/Netdisco/DB/ResultSet/DevicePort.pm view on Meta::CPAN
package App::Netdisco::DB::ResultSet::DevicePort;
use base 'App::Netdisco::DB::ResultSet';
use strict;
use warnings;
use Try::Tiny;
require Dancer::Logger;
__PACKAGE__->load_components(qw/
+App::Netdisco::DB::ExplicitLocking
/);
=head1 ADDITIONAL METHODS
=head2 with_times
lib/App/Netdisco/DB/SchemaVersioned.pm view on Meta::CPAN
package App::Netdisco::DB::SchemaVersioned;
use strict;
use warnings;
use base 'DBIx::Class::Schema::Versioned';
use Try::Tiny;
use DBIx::Class::Carp;
sub apply_statement {
my ($self, $statement) = @_;
try { $self->storage->txn_do(sub { $self->storage->dbh->do($statement) }) }
catch { carp "SQL was: $statement" if $ENV{DBIC_TRACE} };
}
1;
lib/App/Netdisco/JobQueue/PostgreSQL.pm view on Meta::CPAN
package App::Netdisco::JobQueue::PostgreSQL;
use Dancer qw/:moose :syntax :script/;
use Dancer::Plugin::DBIC 'schema';
use App::Netdisco::Util::Device 'get_denied_actions';
use App::Netdisco::Backend::Job;
use App::Netdisco::DB::ExplicitLocking ':modes';
use JSON::PP ();
use Try::Tiny;
use base 'Exporter';
our @EXPORT = ();
our @EXPORT_OK = qw/
jq_warm_thrusters
jq_getsome
jq_locked
jq_queued
jq_lock
jq_defer
lib/App/Netdisco/Transport/Python.pm view on Meta::CPAN
use App::Netdisco::Util::Python 'py_cmd';
use IPC::Run 'harness';
use MIME::Base64 'decode_base64';
use Path::Class;
use File::ShareDir 'dist_dir';
use File::Slurper qw/read_text write_text/;
use File::Temp ();
use JSON::PP ();
use YAML::XS ();
use Try::Tiny;
=head1 NAME
App::Netdisco::Transport::Python
=head1 DESCRIPTION
Not really a transport, but has similar behaviour to a Transport.
Returns an object which has a live Python subprocess expecting
lib/App/Netdisco/Transport/SNMP.pm view on Meta::CPAN
use Dancer qw/:syntax :script/;
use Dancer::Plugin::DBIC 'schema';
use App::Netdisco::Util::SNMP qw/get_communities get_mibdirs/;
use App::Netdisco::Util::Device 'get_device';
use App::Netdisco::Util::Permission 'acl_matches';
use App::Netdisco::Util::Snapshot qw/load_cache_for_device add_snmpinfo_aliases/;
use SNMP::Info;
use Try::Tiny;
use Module::Load ();
use NetAddr::IP::Lite ':lower';
use List::Util qw/pairkeys pairfirst/;
use base 'Dancer::Object::Singleton';
=head1 NAME
App::Netdisco::Transport::SNMP
lib/App/Netdisco/Transport/SSH.pm view on Meta::CPAN
package App::Netdisco::Transport::SSH;
use Dancer qw/:syntax :script/;
use App::Netdisco::Util::Device 'get_device';
use Module::Load ();
use Net::OpenSSH;
use Try::Tiny;
use base 'Dancer::Object::Singleton';
=head1 NAME
App::Netdisco::Transport::SSH
=head1 DESCRIPTION
Returns an object which has an active SSH connection which can be used
lib/App/Netdisco/Util/DeviceAuth.pm view on Meta::CPAN
package App::Netdisco::Util::DeviceAuth;
use Dancer qw/:syntax :script/;
use App::Netdisco::Util::DNS 'hostname_from_ip';
use Storable 'dclone';
use Try::Tiny;
use base 'Exporter';
our @EXPORT = ();
our @EXPORT_OK = qw/
fixup_device_auth get_external_credentials
/;
our %EXPORT_TAGS = (all => \@EXPORT_OK);
=head1 NAME
lib/App/Netdisco/Web/API/Objects.pm view on Meta::CPAN
package App::Netdisco::Web::API::Objects;
use Dancer ':syntax';
use Dancer::Plugin::DBIC;
use Dancer::Plugin::Swagger;
use Dancer::Plugin::Auth::Extensible;
use App::Netdisco::JobQueue 'jq_insert';
use Try::Tiny;
swagger_path {
tags => ['Objects'],
path => (setting('api_base') || '').'/object/device/{ip}',
description => 'Returns a row from the device table',
parameters => [
ip => {
description => 'Canonical IP of the Device. Use Search methods to find this.',
required => 1,
in => 'path',
lib/App/Netdisco/Web/API/Queue.pm view on Meta::CPAN
package App::Netdisco::Web::API::Queue;
use Dancer ':syntax';
use Dancer::Plugin::DBIC;
use Dancer::Plugin::Swagger;
use Dancer::Plugin::Auth::Extensible;
use App::Netdisco::JobQueue 'jq_insert';
use Try::Tiny;
swagger_path {
tags => ['Queue'],
path => (setting('api_base') || '').'/queue/backends',
description => 'Return list of currently active backend names (usually FQDN)',
responses => { default => {} },
}, get '/api/v1/queue/backends' => require_role api_admin => sub {
# from 1d988bbf7 this always returns an entry
my @names = schema(vars->{'tenant'})->resultset('DeviceSkip')
->get_distinct_col('backend');
lib/App/Netdisco/Web/Auth/Provider/DBIC.pm view on Meta::CPAN
use Dancer ':syntax';
use Dancer::Plugin::DBIC;
use Dancer::Plugin::Passphrase;
use Digest::MD5;
use Net::LDAP;
use Authen::Radius;
use Authen::TacacsPlus;
use Path::Class;
use File::ShareDir 'dist_dir';
use Try::Tiny;
sub authenticate_user {
my ($self, $username, $password) = @_;
return unless defined $username;
my $user = $self->get_user_details($username) or return;
return unless $user->in_storage;
return $self->match_password($password, $user);
}
lib/App/Netdisco/Web/Plugin/AdminTask/Topology.pm view on Meta::CPAN
package App::Netdisco::Web::Plugin::AdminTask::Topology;
use Dancer ':syntax';
use Dancer::Plugin::Ajax;
use Dancer::Plugin::DBIC;
use Dancer::Plugin::Auth::Extensible;
use App::Netdisco::Web::Plugin;
use App::Netdisco::Util::Device 'get_device';
use Try::Tiny;
use NetAddr::IP::Lite ':lower';
register_admin_task({
tag => 'topology',
label => 'Manual Device Topology',
roles => [qw/admin port_control/],
});
sub _sanity_ok {
my $dev1 = NetAddr::IP::Lite->new(param('dev1'));
lib/App/Netdisco/Web/Plugin/Device/SNMP.pm view on Meta::CPAN
use Dancer qw(:syntax);
use Dancer::Plugin::Ajax;
use Dancer::Plugin::DBIC;
use Dancer::Plugin::Swagger;
use Dancer::Plugin::Auth::Extensible;
use App::Netdisco::Web::Plugin;
use App::Netdisco::Util::SNMP 'decode_and_munge';
use Module::Load ();
use Try::Tiny;
register_device_tab({ tag => 'snmp', label => 'SNMP' });
get '/ajax/content/device/snmp' => require_login sub {
my $device = try { schema(vars->{'tenant'})->resultset('Device')
->search_for_device( param('q') ) }
or send_error('Bad Device', 404);
template 'ajax/device/snmp.tt', { device => $device->ip },
{ layout => 'noop' };
lib/App/Netdisco/Worker/Plugin/Discover/Neighbors.pm view on Meta::CPAN
use App::Netdisco::Transport::SNMP ();
use App::Netdisco::Util::Device qw/get_device is_discoverable/;
use App::Netdisco::Util::Permission 'acl_matches';
use App::Netdisco::JobQueue 'jq_insert';
use Dancer::Plugin::DBIC 'schema';
use List::Util 'pairs';
use NetAddr::IP::Lite ();
use NetAddr::MAC;
use Encode;
use Try::Tiny;
=head2 discover_new_neighbors( )
Given a Device database object, and a working SNMP connection, discover and
store the device's port neighbors information.
Entries in the Topology database table will override any discovered device
port relationships.
The Device database object can be a fresh L<DBIx::Class::Row> object which is
lib/App/Netdisco/Worker/Plugin/PrimeSkiplist.pm view on Meta::CPAN
use Dancer ':syntax';
use Dancer::Plugin::DBIC 'schema';
use App::Netdisco::Worker::Plugin;
use aliased 'App::Netdisco::Worker::Status';
use App::Netdisco::Util::Device 'get_denied_actions';
use App::Netdisco::Util::MCE 'parse_max_workers';
use App::Netdisco::Backend::Job;
use Try::Tiny;
register_worker({ phase => 'main' }, sub {
my ($job, $workerconf) = @_;
my $happy = false;
my $devices = schema(vars->{'tenant'})->resultset('Device');
my $rs = schema(vars->{'tenant'})->resultset('DeviceSkip');
my %actionset = ();
while (my $d = $devices->next) {
lib/App/Netdisco/Worker/Runner.pm view on Meta::CPAN
use Dancer qw/:moose :syntax/;
use Dancer::Plugin::DBIC 'schema';
use App::Netdisco::Util::CustomFields;
use App::Netdisco::Transport::Python ();
use App::Netdisco::Util::Device 'get_device';
use App::Netdisco::Util::Permission qw/acl_matches acl_matches_only/;
use aliased 'App::Netdisco::Worker::Status';
use Try::Tiny;
use Time::HiRes ();
use Module::Load ();
use Scope::Guard 'guard';
use Storable 'dclone';
use Sys::SigAction 'timeout_call';
use Moo::Role;
use namespace::clean;
with 'App::Netdisco::Worker::Loader';
xt/30-backend-workers.t view on Meta::CPAN
use Test::More 0.88;
use Test::File::ShareDir::Dist { 'App-Netdisco' => 'share/' };
use lib 'xt/lib';
use App::Netdisco;
use App::Netdisco::DB; # fake device row
use App::Netdisco::Backend::Job;
use Try::Tiny;
use Dancer qw/:moose :script !pass/;
# configure logging to force console output
my $CONFIG = config();
$CONFIG->{logger} = 'console';
$CONFIG->{log} = ($ENV{'DANCER_DEBUG'} ? 'debug' : 'error');
Dancer::Logger->init('console', $CONFIG);
{
package MyWorker;