Branch Coverage

blib/lib/FusionInventory/Agent/Tools/Hardware.pm
Criterion Covered Total %
branch 87 384 22.6


line true false branch
272 2 1 if ($sysobjectid)
278 1 1 if $match->{'type'}
279 0 2 if $match->{'model'}
281 1 1 if $match->{'manufacturer'}
286 3 0 if ($sysdescr)
292 0 3 if ($result)
293 0 0 if $result->{'vendor'}
294 0 0 if $result->{'type'}
299 9 0 unless $sysdescr =~ /$rule->{'match'}/
300 0 0 if $rule->{'vendor'}
301 0 0 if $rule->{'type'}
308 2 1 unless (exists $device->{'TYPE'})
309 0 2 if ($snmp->get('.1.3.6.1.2.1.43.11.1.1.6.1.1') or $snmp->get('.1.3.6.1.2.1.25.3.2.1.3.1'))
318 3 0 unless (exists $device->{'MODEL'})
319 0 3 exists $device->{'TYPE'} && $device->{'TYPE'} eq 'PRINTER' ? :
322 0 3 if $model
326 2 1 unless (exists $device->{'MANUFACTURER'})
328 0 2 if $manufacturer
332 1 2 if (not exists $device->{'VENDOR'} and exists $device->{'MANUFACTURER'})
341 3 18 if (ref $variable->{'oid'} eq 'ARRAY') { }
344 0 6 if defined $raw_value
349 21 0 unless defined $raw_value
352 0 0 $type eq 'count' ? :
0 0 $type eq 'string' ? :
0 0 $type eq 'memory' ? :
358 0 0 if defined $value
362 0 3 if $mac
365 0 3 if $serial
368 0 3 if $firmware
372 0 3 if $results
381 0 2 unless $params{'id'}
383 2 0 unless %sysobjectid
394 0 2 unless ($manufacturer_id)
395 0 0 if $logger
400 0 2 unless ($device_id)
401 0 0 if $logger
408 2 0 if ($device_id)
410 0 2 if ($match)
411 0 0 if $logger
420 1 1 if ($match)
421 0 1 if $logger
430 0 1 if $logger
439 1 1 unless $params{'datadir'}
442 0 1 unless $handle
445 14 3581 if $line =~ /^#/
446 64 3517 if $line =~ /^$/
464 0 3 if $entPhysicalSerialNum
469 0 3 if $prtGeneralSerialNumber
487 30 0 unless $value
498 0 3 if $entPhysicalSoftwareRev
501 0 3 if $entPhysicalFirmwareRev
504 0 3 if $ios_version
507 0 3 if $firmware
519 0 3 if $address and $address =~ /^$FusionInventory::Agent::Tools::Hardware::mac_address_pattern$/
531 0 3 if @addresses and @addresses == 1
544 0 0 unless $info
548 0 0 if (exists $info->{'DESCRIPTION'})
555 0 0 if (exists $info->{'SNMPHOSTNAME'})
582 0 0 if $info->{'TYPE'} and $info->{'TYPE'} eq 'PRINTER'
589 0 0 if $info->{'TYPE'} and $info->{'TYPE'} eq 'NETWORKING'
593 0 0 if ($ports and %$ports) { }
619 0 0 unless $variable->{'oid'}
622 0 0 if (ref $variable->{'oid'} eq 'ARRAY') { }
625 0 0 if $results
630 0 0 unless $results
636 0 0 $type eq 'count' ? :
0 0 $type eq 'string' ? :
0 0 $type eq 'constant' ? :
0 0 $type eq 'mac' ? :
642 0 0 if defined $value
652 0 0 $highspeed_value ? :
662 0 0 unless $value
664 0 0 unless (exists $ports->{$value})
665 0 0 if $logger
670 0 0 unless ($suffix =~ /^$FusionInventory::Agent::Tools::Hardware::ip_address_pattern$/)
671 0 0 if $logger
702 0 0 unless defined $max and defined $current
709 0 0 if ($type_id != 1) { }
714 0 0 $description =~ /transfer/i ? :
0 0 $description =~ /fuser/i ? :
0 0 $description =~ /maintenance/i ? :
721 0 0 unless ($type)
722 0 0 if $logger
726 0 0 if ($type eq 'TONER' or $type eq 'DRUM' or $type eq 'CARTRIDGE' or $type eq 'DEVELOPER')
728 0 0 if ($color_id) { }
730 0 0 unless ($color)
731 0 0 if $logger
737 0 0 $description =~ /(black|noir)/i ? :
0 0 $description =~ /(yellow|jaune)/i ? :
0 0 $description =~ /magenta/i ? :
0 0 $description =~ /cyan/i ? :
748 0 0 if ($current == -2) { }
0 0 elsif ($current == -3) { }
756 0 0 if ($max != -2) { }
761 0 0 $unit_id == 4 ? :
0 0 $unit_id == 7 ? :
0 0 $unit_id == 8 ? :
0 0 $unit_id == 11 ? :
0 0 $unit_id == 13 ? :
0 0 $unit_id == 15 ? :
0 0 $unit_id == 16 ? :
0 0 $unit_id == 17 ? :
0 0 $unit_id == 18 ? :
0 0 $unit_id == 19 ? :
783 0 0 if (ref $variable->{'oid'} eq 'ARRAY') { }
786 0 0 if $value
792 0 0 unless defined $value
793 0 0 unless (_isInteger($value))
794 0 0 if $logger
845 0 0 unless defined $value1 and _isInteger($value1)
846 0 0 unless defined $value2 and _isInteger($value2)
847 0 0 if $value1 == 0
861 3 3 unless $value
864 1 2 if ($value =~ /$FusionInventory::Agent::Tools::Hardware::mac_address_pattern/) { }
0 2 elsif ($value =~ /^\d{2}:\d{2}:\d{2}:\d{2}:\d{2}$/) { }
875 2 0 if ($value =~ /^0x[0-9A-F]{0,4}([0-9A-F]{12})$/i) { }
884 0 3 if $result eq '00:00:00:00:00:00'
892 2 4 unless $value
901 0 4 unless $value
910 0 0 unless $value
916 0 0 unless $value
924 0 0 if ($value =~ /^(\d+) KBytes$/) { }
934 0 0 if _isInteger($value)
935 0 0 if $value =~ /\((\d+)\)$/
941 0 0 _isInteger($value) ? :
972 4 0 if ($addresses)
987 0 4 if ($addresses) { }
1002 1 0 if exists $port->{'CONNECTIONS'} and exists $port->{'CONNECTIONS'}{'CDP'} and $port->{'CONNECTIONS'}{'CDP'}
1003 3 0 unless exists $port->{'VLANS'}
1012 0 0 if $logger
1019 0 0 unless $mac_addresses
1027 0 4 if @vlans
1041 0 4 unless (exists $ports->{$port_id})
1042 0 0 if $logger
1055 1 0 if exists $port->{'CONNECTIONS'} and exists $port->{'CONNECTIONS'}{'CDP'} and $port->{'CONNECTIONS'}{'CDP'}
1060 1 2 if $port->{'MAC'}
1064 0 0 if exists $port->{'CONNECTIONS'} and exists $port->{'CONNECTIONS'}{'CONNECTION'} and exists $port->{'CONNECTIONS'}{'CONNECTION'}{'MAC'}
1069 0 3 unless @adresses
1096 0 10 unless defined $interface_id
1099 0 10 if @bytes > 6
1115 0 0 if ($lldp_info)
1118 0 0 unless (exists $ports->{$interface_id})
1119 0 0 if $logger
1136 0 0 if ($cdp_info)
1139 0 0 unless (exists $ports->{$interface_id})
1140 0 0 if $logger
1150 0 0 if ($lldp_connection) { }
1151 0 0 if ($cdp_connection->{'SYSDESCR'} eq $lldp_connection->{'SYSDESCR'}) { }
1174 0 0 if ($edp_info)
1177 0 0 unless (exists $ports->{$interface_id})
1178 0 0 if $logger
1188 0 0 if ($lldp_connection) { }
1189 0 0 if ($edp_connection->{'SYSDESCR'} eq $lldp_connection->{'SYSDESCR'}) { }
1235 0 0 unless $sysdescr
1245 0 0 if (not $portId =~ /^0x/ or length $portId != 14)
1250 0 0 if $ifdescr
1253 0 0 if $sysname
1259 0 0 $params{'vendor'} eq 'Juniper' ? :
0 0 !exists $port2interface->{$id} ? :
1287 0 3 if $ip eq '0.0.0.0'
1291 2 1 unless $sysdescr and $model
1301 0 1 if ($devicePort =~ /^\d+$/) { }
1309 0 1 if ($deviceId =~ /^0x/) { }
1310 0 0 if (length $deviceId == 14) { }
1321 1 0 if ($connection->{'SYSNAME'} and $connection->{'SYSNAME'} =~ /^SIP([A-F0-9a-f]*)$/)
1328 0 1 if ($results->{$interface_id}) { }
1368 0 0 if $ip eq '0.0.0.0'
1383 0 0 if ($results->{$interface_id}) { }
1407 0 0 unless $vlans
1414 0 0 unless (exists $ports->{$port_id})
1415 0 0 if $logger
1437 0 0 if ($vtpVlanName and $vmPortStatus)
1452 0 0 if ($vlanId)
1470 0 0 unless $trunk_ports
1477 0 0 unless (exists $ports->{$port_id})
1478 0 0 if $logger
1500 1 0 if ($vlanStatus)
1502 2 1 $value == 1 ? :
1513 0 0 if ($accessMode)
1518 0 0 $value == 2 ? :
1529 0 0 if ($vlanId)
1534 0 0 !exists $port2interface->{$id} ? :
1535 0 0 $value == 0 ? :
1550 0 0 if ($lacp_info)
1553 0 0 unless ($ports->{$interface_id})
1554 0 0 if $logger
1564 0 0 if ($pagp_info)
1567 0 0 unless ($ports->{$interface_id})
1568 0 0 if $logger
1588 0 0 if $aggregator_id == 0
1589 0 0 if $aggregator_id == $interface_id
1606 0 0 unless $portShortNum > 0