line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Cisco::SNMP::Image; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
################################################## |
4
|
|
|
|
|
|
|
# AUTHOR = Michael Vincent |
5
|
|
|
|
|
|
|
# www.VinsWorld.com |
6
|
|
|
|
|
|
|
################################################## |
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
50461
|
use strict; |
|
1
|
|
|
|
|
16
|
|
|
1
|
|
|
|
|
38
|
|
9
|
1
|
|
|
1
|
|
7
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
42
|
|
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
734
|
use Net::SNMP qw(:asn1); |
|
1
|
|
|
|
|
78198
|
|
|
1
|
|
|
|
|
261
|
|
12
|
1
|
|
|
1
|
|
333
|
use Cisco::SNMP; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
205
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our $VERSION = $Cisco::SNMP::VERSION; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
our @ISA = qw(Cisco::SNMP); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
################################################## |
19
|
|
|
|
|
|
|
# Start Public Module |
20
|
|
|
|
|
|
|
################################################## |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub _imageOID { |
23
|
0
|
|
|
0
|
|
|
return '.1.3.6.1.4.1.9.9.25.1.1.1.2'; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub image_info { |
27
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
28
|
0
|
|
0
|
|
|
|
my $class = ref($self) || $self; |
29
|
|
|
|
|
|
|
|
30
|
0
|
|
|
|
|
|
my $session = $self->{_SESSION_}; |
31
|
|
|
|
|
|
|
|
32
|
0
|
|
|
|
|
|
my $response = Cisco::SNMP::_snmpwalk( $session, _imageOID() ); |
33
|
|
|
|
|
|
|
|
34
|
0
|
|
|
|
|
|
my %ImageHash; |
35
|
0
|
|
|
|
|
|
for ( @{$response} ) { |
|
0
|
|
|
|
|
|
|
36
|
0
|
|
|
|
|
|
my ( $key, $value ) = split /\$/, $_, 2; |
37
|
0
|
|
|
|
|
|
$key =~ s/^CW_//; |
38
|
0
|
|
|
|
|
|
$key = ucfirst( lc($key) ); |
39
|
0
|
|
|
|
|
|
$value =~ s/\$$//; |
40
|
0
|
|
|
|
|
|
$ImageHash{$key} = $value; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
1
|
|
|
1
|
|
8
|
no strict 'refs'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
68
|
|
44
|
0
|
|
|
|
|
|
for my $key ( keys(%ImageHash) ) { |
45
|
0
|
|
|
|
|
|
*{"image" . $key} = sub { |
46
|
0
|
|
|
0
|
|
|
return $ImageHash{$key}; |
47
|
|
|
|
|
|
|
} |
48
|
0
|
|
|
|
|
|
} |
49
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
219
|
|
50
|
|
|
|
|
|
|
|
51
|
0
|
0
|
|
|
|
|
if ( defined $response ) { |
52
|
0
|
|
|
|
|
|
return bless $response, $class; |
53
|
|
|
|
|
|
|
} else { |
54
|
0
|
|
|
|
|
|
$Cisco::SNMP::LASTERROR = "Cannot read image MIB"; |
55
|
0
|
|
|
|
|
|
return undef; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub imageString { |
60
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
61
|
0
|
|
|
|
|
|
my ($idx) = @_; |
62
|
|
|
|
|
|
|
|
63
|
0
|
0
|
|
|
|
|
if ( not defined $idx ) { |
|
|
0
|
|
|
|
|
|
64
|
0
|
|
|
|
|
|
$idx = 0; |
65
|
|
|
|
|
|
|
} elsif ( $idx !~ /^\d+$/ ) { |
66
|
0
|
|
|
|
|
|
$Cisco::SNMP::LASTERROR = "Invalid image index `$idx'"; |
67
|
0
|
|
|
|
|
|
return undef; |
68
|
|
|
|
|
|
|
} |
69
|
0
|
|
|
|
|
|
return $self->[$idx]; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub get_imageString { |
73
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
74
|
0
|
|
|
|
|
|
my ($idx) = @_; |
75
|
|
|
|
|
|
|
|
76
|
0
|
|
|
|
|
|
my $s = $self->session; |
77
|
0
|
|
|
|
|
|
my $r = $s->get_request( varbindlist => [_imageOID() . '.' . ($idx)] ); |
78
|
0
|
|
|
|
|
|
return $r->{_imageOID() . '.' . ($idx)}; |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
################################################## |
82
|
|
|
|
|
|
|
# End Public Module |
83
|
|
|
|
|
|
|
################################################## |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
1; |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
__END__ |