| 1 | package Cisco::SNMP::ProxyPing; | ||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | ################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | # AUTHOR = Michael Vincent | ||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | # www.VinsWorld.com | ||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | ################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 3 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 3 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 3 | ▶ | use Net::SNMP qw(:asn1); | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 3 | ▶ | use Cisco::SNMP; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 3 | our $VERSION = $Cisco::SNMP::VERSION; | |||||||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 3 | our @ISA = qw(Cisco::SNMP); | |||||||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 3 | ▶ | use Sys::Hostname; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 3 | ▶ | use Socket qw(AF_INET); | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | # use Net::IPv6Addr; | ||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 3 | my $HAVE_Net_IPv6Addr = 0; | |||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 3 | ▶ | if ( $Socket::VERSION >= 1.94 ) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 3 | ▶ | eval "use Net::IPv6Addr 0.2"; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 3 | ▶ | if ( !$@ ) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 3 | $HAVE_Net_IPv6Addr = 1; | |||||||||||||||||||||||||||||||||||||||||||||||
| 27 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 3 | my $AF_INET6 = eval { Socket::AF_INET6() }; | |||||||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | ################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | # Start Public Module | ||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | ################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 0 | ▶ | sub _ppOID { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_ppOID: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 0 | return '1.3.6.1.4.1.9.9.16.1.1.1'; | |||||||||||||||||||||||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 0 | ▶ | sub proxy_ping { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
proxy_ping: not called CC=35 SCAR=71.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 0 | ▶ | my $class = ref($self) || $self; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
ref $self || $self
MC/DC0%0/2
ref $self || $self
ref $self
$self
Truth table0%0/3
A || B
A= ref $selfB= $self
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 0 | my $session = $self->{_SESSION_}; | |||||||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 0 | my %params = ( | |||||||||||||||||||||||||||||||||||||||||||||||
| 47 | count => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | size => 64, | ||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | wait => 1 | ||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 0 | my %args; | |||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 0 | ▶ | if ( @_ == 1 ) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 0 | ( $params{host} ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||
| 55 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 0 | %args = @_; | |||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 0 | for ( keys(%args) ) { | |||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 0 | ▶ | if ( (/^-?host(?:name)?$/i) || (/^-?dest(?:ination)?$/i) ) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 6 branches
Condition0%0/3
/^-?host(?:name)?$/i or /^-?dest(?:ination)?$/i
MC/DC0%0/2
/^-?host(?:name)?$/i or /^-?dest(?:ination)?$/i
/^-?host(?:name)?$/i
/^-?dest(?:ination)?$/i
Truth table0%0/3
A or B
A= /^-?host(?:name)?$/iB= /^-?dest(?:ination)?$/i
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 0 | $params{host} = $args{$_}; | |||||||||||||||||||||||||||||||||||||||||||||||
| 60 | } elsif (/^-?size$/i) { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 0 | ▶ | if ( $args{$_} =~ /^\d+$/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 0 | $params{size} = $args{$_}; | |||||||||||||||||||||||||||||||||||||||||||||||
| 63 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 0 | $Cisco::SNMP::LASTERROR = "Invalid size `$args{$_}'"; | |||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||
| 66 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | } elsif (/^-?family$/i) { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 0 | ▶ | if ( $args{$_} | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 0 | =~ /^(?:(?:(:?ip)?v?(?:4|6))|${\AF_INET}|$AF_INET6)$/ ) { | |||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 0 | ▶ | if ( $args{$_} =~ /^(?:(?:(:?ip)?v?4)|${\AF_INET})$/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 0 | $params{family} = AF_INET; | |||||||||||||||||||||||||||||||||||||||||||||||
| 72 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 0 | $params{family} = $AF_INET6; | |||||||||||||||||||||||||||||||||||||||||||||||
| 74 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 0 | $Cisco::SNMP::LASTERROR = "Invalid family `$args{$_}'"; | |||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||
| 78 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | } elsif (/^-?count$/i) { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | ▶ | if ( $args{$_} =~ /^\d+$/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 0 | $params{count} = $args{$_}; | |||||||||||||||||||||||||||||||||||||||||||||||
| 82 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 0 | $Cisco::SNMP::LASTERROR = "Invalid count `$args{$_}'"; | |||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||
| 85 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | ▶ | } elsif ( (/^-?wait$/i) || (/^-?timeout$/i) ) { | |||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
/^-?wait$/i or /^-?timeout$/i
MC/DC0%0/2
/^-?wait$/i or /^-?timeout$/i
/^-?wait$/i
/^-?timeout$/i
Truth table0%0/3
A or B
A= /^-?wait$/iB= /^-?timeout$/i
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 0 | ▶ | if ( $args{$_} =~ /^\d+$/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 0 | $params{wait} = $args{$_}; | |||||||||||||||||||||||||||||||||||||||||||||||
| 89 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | $Cisco::SNMP::LASTERROR = "Invalid wait time `$args{$_}'"; | |||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||
| 92 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | } elsif (/^-?vrf(?:name)?$/i) { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 0 | $params{vrf} = $args{$_}; | |||||||||||||||||||||||||||||||||||||||||||||||
| 95 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 0 | my $pp; | |||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 0 | $pp->{_params_} = \%params; | |||||||||||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | # host must be defined | ||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 0 | ▶ | if ( not defined $params{host} ) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | $params{host} = hostname; | |||||||||||||||||||||||||||||||||||||||||||||||
| 104 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | # inherit from new() | ||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 0 | ▶ | if ( not defined $params{family} ) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 0 | $params{family} = $self->{family}; | |||||||||||||||||||||||||||||||||||||||||||||||
| 109 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | # resolve host our way | ||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 0 | ▶ | if (defined( | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | my $ret = Cisco::SNMP::_resolv( $params{host}, $params{family} ) | ||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 0 | $params{host} = $ret->{addr}; | |||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 0 | $params{family} = $ret->{family}; | |||||||||||||||||||||||||||||||||||||||||||||||
| 118 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||
| 120 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 0 | my $instance = int( rand(1024) + 1024 ); | |||||||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | # Prepare object by clearing row | ||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 0 | my $response | |||||||||||||||||||||||||||||||||||||||||||||||
| 126 | = $session->set_request( _ppOID() . '.16.' . $instance, INTEGER, 6 ); | ||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | ▶ | if ( not defined $response ) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 0 | $Cisco::SNMP::LASTERROR = "proxy ping NOT SUPPORTED"; | |||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||
| 130 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | # Convert destination to Hex equivalent | ||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 0 | my $dest; | |||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 0 | ▶ | if ( $params{family} == AF_INET ) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 0 | for ( split( /\./, $params{host} ) ) { | |||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 0 | $dest .= sprintf( "%02x", $_ ); | |||||||||||||||||||||||||||||||||||||||||||||||
| 137 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 0 | ▶ | if ($HAVE_Net_IPv6Addr) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 0 | my $addr = Net::IPv6Addr->new( $params{host} ); | |||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 0 | my @dest = $addr->to_array; | |||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | $dest .= join '', $_ for (@dest); | |||||||||||||||||||||||||||||||||||||||||||||||
| 143 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 0 | $Cisco::SNMP::LASTERROR | |||||||||||||||||||||||||||||||||||||||||||||||
| 145 | = "Socket > 1.94 and Net::IPv6Addr required"; | ||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||
| 147 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | # ciscoPingEntryStatus (5 = createAndWait, 6 = destroy) | ||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | $response | |||||||||||||||||||||||||||||||||||||||||||||||
| 152 | = $session->set_request( _ppOID() . '.16.' . $instance, INTEGER, 6 ); | ||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 0 | $response | |||||||||||||||||||||||||||||||||||||||||||||||
| 154 | = $session->set_request( _ppOID() . '.16.' . $instance, INTEGER, 5 ); | ||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | # ciscoPingEntryOwner (<anyname>) | ||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 0 | $response = $session->set_request( _ppOID() . '.15.' . $instance, | |||||||||||||||||||||||||||||||||||||||||||||||
| 158 | OCTET_STRING, __PACKAGE__ ); | ||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | # ciscoPingProtocol (1 = IP, 20 = IPv6) | ||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | $response = $session->set_request( _ppOID() . '.2.' . $instance, | ||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | ▶ | INTEGER, ( $params{family} == AF_INET ) ? 1 : 20 ); | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 0 | ▶ | if ( not defined $response ) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 0 | $Cisco::SNMP::LASTERROR | |||||||||||||||||||||||||||||||||||||||||||||||
| 165 | = "Device does not support ciscoPingProtocol 20 (IPv6)"; | ||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||
| 167 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | # ciscoPingAddress (NOTE: hex string, not regular IP) | ||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 0 | $response = $session->set_request( _ppOID() . '.3.' . $instance, | |||||||||||||||||||||||||||||||||||||||||||||||
| 171 | OCTET_STRING, pack( 'H*', $dest ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | # ciscoPingPacketTimeout (in ms) | ||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | $response = $session->set_request( _ppOID() . '.6.' . $instance, | ||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 0 | INTEGER32, $params{wait} * 100 ); | |||||||||||||||||||||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | # ciscoPingDelay (Set gaps (in ms) between successive pings) | ||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | $response = $session->set_request( _ppOID() . '.7.' . $instance, | ||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 0 | INTEGER32, $params{wait} * 100 ); | |||||||||||||||||||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | # ciscoPingPacketCount | ||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | $response = $session->set_request( _ppOID() . '.4.' . $instance, | ||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 0 | INTEGER, $params{count} ); | |||||||||||||||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | # ciscoPingPacketSize (protocol dependent) | ||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | $response = $session->set_request( _ppOID() . '.5.' . $instance, | ||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 0 | INTEGER, $params{size} ); | |||||||||||||||||||||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 0 | ▶ | if ( exists $params{vrf} ) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | # ciscoPingVrfName (<name>) | ||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | $response = $session->set_request( _ppOID() . '.17.' . $instance, | ||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 0 | OCTET_STRING, $params{vrf} ); | |||||||||||||||||||||||||||||||||||||||||||||||
| 194 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | # Verify ping is ready (ciscoPingEntryStatus = 2) | ||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 0 | $response = $session->get_request( _ppOID() . '.16.' . $instance ); | |||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 0 | ▶ | if ( defined $response->{_ppOID() . '.16.' . $instance} ) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | 0 | ▶ | if ( $response->{_ppOID() . '.16.' . $instance} != 2 ) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 0 | $Cisco::SNMP::LASTERROR = "Ping not ready"; | |||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||
| 202 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 0 | $Cisco::SNMP::LASTERROR = "proxy ping NOT SUPPORTED (after setup)"; | |||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||
| 206 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | # ciscoPingEntryStatus (1 = activate) | ||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 0 | $response | |||||||||||||||||||||||||||||||||||||||||||||||
| 210 | = $session->set_request( _ppOID() . '.16.' . $instance, INTEGER, 1 ); | ||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | # Wait sample interval | ||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 0 | sleep $params{wait}; | |||||||||||||||||||||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | # Get results | ||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 0 | $response = $session->get_table( _ppOID() ); | |||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 0 | ▶ | $pp->{Sent} = $response->{_ppOID() . '.9.' . $instance} || 0; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$$response{_ppOID() . '.9.' . $instance} || 0
MC/DC0%0/1
$$response{_ppOID() . '.9.' . $instance} || 0
$$response{_ppOID() . '.9.' . $instance}
Truth table0%0/2
A
A= $$response{_ppOID() . '.9.' . $instance}
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 0 | ▶ | $pp->{Received} = $response->{_ppOID() . '.10.' . $instance} || 0; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$$response{_ppOID() . '.10.' . $instance} || 0
MC/DC0%0/1
$$response{_ppOID() . '.10.' . $instance} || 0
$$response{_ppOID() . '.10.' . $instance}
Truth table0%0/2
A
A= $$response{_ppOID() . '.10.' . $instance}
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 0 | ▶ | $pp->{Minimum} = $response->{_ppOID() . '.11.' . $instance} || 0; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$$response{_ppOID() . '.11.' . $instance} || 0
MC/DC0%0/1
$$response{_ppOID() . '.11.' . $instance} || 0
$$response{_ppOID() . '.11.' . $instance}
Truth table0%0/2
A
A= $$response{_ppOID() . '.11.' . $instance}
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 0 | ▶ | $pp->{Average} = $response->{_ppOID() . '.12.' . $instance} || 0; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$$response{_ppOID() . '.12.' . $instance} || 0
MC/DC0%0/1
$$response{_ppOID() . '.12.' . $instance} || 0
$$response{_ppOID() . '.12.' . $instance}
Truth table0%0/2
A
A= $$response{_ppOID() . '.12.' . $instance}
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 0 | ▶ | $pp->{Maximum} = $response->{_ppOID() . '.13.' . $instance} || 0; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$$response{_ppOID() . '.13.' . $instance} || 0
MC/DC0%0/1
$$response{_ppOID() . '.13.' . $instance} || 0
$$response{_ppOID() . '.13.' . $instance}
Truth table0%0/2
A
A= $$response{_ppOID() . '.13.' . $instance}
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | # destroy entry | ||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 0 | $response | |||||||||||||||||||||||||||||||||||||||||||||||
| 225 | = $session->set_request( _ppOID() . '.16.' . $instance, INTEGER, 6 ); | ||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | 0 | return bless $pp, $class; | |||||||||||||||||||||||||||||||||||||||||||||||
| 227 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 0 | ▶ | sub ppSent { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ppSent: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 0 | return $self->{Sent}; | |||||||||||||||||||||||||||||||||||||||||||||||
| 232 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 0 | ▶ | sub ppReceived { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ppReceived: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 0 | return $self->{Received}; | |||||||||||||||||||||||||||||||||||||||||||||||
| 237 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 0 | ▶ | sub ppMinimum { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ppMinimum: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||
| 241 | 0 | return $self->{Minimum}; | |||||||||||||||||||||||||||||||||||||||||||||||
| 242 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 0 | ▶ | sub ppAverage { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ppAverage: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||
| 246 | 0 | return $self->{Average}; | |||||||||||||||||||||||||||||||||||||||||||||||
| 247 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 0 | ▶ | sub ppMaximum { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ppMaximum: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 0 | return $self->{Maximum}; | |||||||||||||||||||||||||||||||||||||||||||||||
| 252 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | ################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | # End Public Module | ||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | ################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | 3 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||