File Coverage

blib/lib/SNMP/Insight/Device.pm
Criterion Covered Total %
statement 12 16 75.0
branch n/a
condition n/a
subroutine 4 5 80.0
pod 1 1 100.0
total 17 22 77.2


line stmt bran cond sub pod time code
1             package SNMP::Insight::Device;
2              
3             #ABSTRACT: Base class for devices
4 3     3   1520 use Moose;
  3         244895  
  3         17  
5 3     3   13558 use namespace::autoclean;
  3         1080  
  3         22  
6              
7             our $VERSION = '0.002'; #TRIAL VERSION:
8 3     3   525 use SNMP::Insight::Session;
  3         4  
  3         93  
9 3     3   1200 use SNMP::Insight::MIB::Utils qw(sysObjectID2vendor);
  3         7  
  3         590  
10              
11             has 'session' => (
12             isa => 'SNMP::Insight::Session',
13             is => 'ro',
14             );
15              
16             has model => (
17             is => 'ro',
18             isa => 'Str'
19             );
20              
21             has os => (
22             is => 'ro',
23             isa => 'Str'
24             );
25              
26             has os_ver => (
27             is => 'ro',
28             isa => 'Str'
29             );
30              
31             has vendor => (
32             is => 'ro',
33             isa => 'Str',
34             default => sub {
35             my $self = shift;
36             return sysObjectID2vendor( $self->sysObjectID ) || "";
37             }
38             );
39              
40             sub get_all_mib_roles {
41 0     0 1   my $self = shift;
42              
43 0           my @roles = grep { $_->can('mib_name') }
  0            
44             $self->meta->calculate_all_roles_with_inheritance;
45              
46 0           return @roles;
47             }
48              
49             with 'SNMP::Insight::MIB::SNMPv2';
50              
51             __PACKAGE__->meta->make_immutable;
52             1;
53              
54             # Local Variables:
55             # mode: cperl
56             # indent-tabs-mode: nil
57             # cperl-indent-level: 4
58             # cperl-indent-parens-as-block: t
59             # End:
60              
61             __END__
62              
63             =pod
64              
65             =head1 NAME
66              
67             SNMP::Insight::Device - Base class for devices
68              
69             =head1 VERSION
70              
71             version 0.002
72              
73             =head1 ATTRIBUTES
74              
75             =head2 session
76              
77             An L<SNMP::Insight::Session> instance used to retrieve SNMP info.
78              
79             =head2 model
80              
81             Guessed device model. May be overridden by device roles.
82              
83             =head2 os
84              
85             Guessed device operating system. May be overridden by device roles.
86              
87             =head2 os_ver
88              
89             Guessed device operating system version. May be overridden by device roles.
90              
91             =head2 os_ver
92              
93             Guessed device vendor. May be overridden by device roles.
94              
95             =head1 METHODS
96              
97             =head2 get_all_mib_roles
98              
99             Return all the MIB roles for this device.
100              
101             =head1 AUTHOR
102              
103             Gabriele Mambrini <g.mambrini@gmail.com>
104              
105             =head1 COPYRIGHT AND LICENSE
106              
107             This software is copyright (c) 2015 by Gabriele Mambrini.
108              
109             This is free software; you can redistribute it and/or modify it under
110             the same terms as the Perl 5 programming language system itself.
111              
112             =cut