Branch Coverage

blib/lib/FusionInventory/Agent/Tools/Hardware.pm
Criterion Covered Total %
branch 107 404 26.4


line true false branch
272 3 1 if ($sysobjectid)
278 2 1 if $match->{'type'}
279 1 2 if $match->{'model'}
281 2 1 if $match->{'manufacturer'}
282 1 2 if $match->{'module'}
287 3 1 if ($sysdescr)
293 0 3 if ($result)
294 0 0 if $result->{'vendor'}
295 0 0 if $result->{'type'}
300 9 0 unless $sysdescr =~ /$rule->{'match'}/
301 0 0 if $rule->{'vendor'}
302 0 0 if $rule->{'type'}
309 2 2 unless (exists $device->{'TYPE'})
310 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'))
319 3 1 unless (exists $device->{'MODEL'})
320 0 3 exists $device->{'TYPE'} && $device->{'TYPE'} eq 'PRINTER' ? :
323 0 3 if $model
327 2 2 unless (exists $device->{'MANUFACTURER'})
329 0 2 if $manufacturer
333 2 2 if (not exists $device->{'VENDOR'} and exists $device->{'MANUFACTURER'})
342 4 24 if (ref $variable->{'oid'} eq 'ARRAY') { }
345 0 8 if defined $raw_value
350 28 0 unless defined $raw_value
353 0 0 $type eq 'count' ? :
0 0 $type eq 'string' ? :
0 0 $type eq 'memory' ? :
359 0 0 if defined $value
363 0 4 if $mac
366 0 4 if $serial
369 0 4 if $firmware
373 0 4 if $results
382 0 3 unless $params{'id'}
384 2 1 unless %sysobjectid
395 0 3 unless ($manufacturer_id)
396 0 0 if $logger
401 0 3 unless ($device_id)
402 0 0 if $logger
409 3 0 if ($device_id)
411 1 2 if ($match)
412 0 1 if $logger
421 1 1 if ($match)
422 0 1 if $logger
431 0 1 if $logger
440 1 1 unless $params{'datadir'}
443 0 1 unless $handle
446 15 3590 if $line =~ /^#/
447 67 3523 if $line =~ /^$/
455 4 3519 if $module
466 0 4 if $entPhysicalSerialNum
471 0 4 if $prtGeneralSerialNumber
489 40 0 unless $value
500 0 4 if $entPhysicalSoftwareRev
503 0 4 if $entPhysicalFirmwareRev
506 0 4 if $ios_version
509 0 4 if $firmware
521 0 4 if $address and $address =~ /^$FusionInventory::Agent::Tools::Hardware::mac_address_pattern$/
533 0 4 if @addresses and @addresses == 1
546 0 0 unless $info
550 0 0 if (exists $info->{'DESCRIPTION'})
557 0 0 if (exists $info->{'SNMPHOSTNAME'})
584 0 0 if $info->{'TYPE'} and $info->{'TYPE'} eq 'PRINTER'
591 0 0 if $info->{'TYPE'} and $info->{'TYPE'} eq 'NETWORKING'
594 0 0 if ($device->{'INFO'}{'EXTMOD'})
613 0 0 if ($ports and %$ports) { }
639 0 0 unless $variable->{'oid'}
642 0 0 if (ref $variable->{'oid'} eq 'ARRAY') { }
645 0 0 if $results
650 0 0 unless $results
656 0 0 $type eq 'count' ? :
0 0 $type eq 'string' ? :
0 0 $type eq 'constant' ? :
0 0 $type eq 'mac' ? :
662 0 0 if defined $value
672 0 0 $highspeed_value ? :
682 0 0 unless $value
684 0 0 unless (exists $ports->{$value})
685 0 0 if $logger
690 0 0 unless ($suffix =~ /^$FusionInventory::Agent::Tools::Hardware::ip_address_pattern$/)
691 0 0 if $logger
722 0 0 unless defined $max and defined $current
729 0 0 if ($type_id != 1) { }
734 0 0 $description =~ /transfer/i ? :
0 0 $description =~ /fuser/i ? :
0 0 $description =~ /maintenance/i ? :
741 0 0 unless ($type)
742 0 0 if $logger
746 0 0 if ($type eq 'TONER' or $type eq 'DRUM' or $type eq 'CARTRIDGE' or $type eq 'DEVELOPER')
748 0 0 if ($color_id) { }
750 0 0 unless ($color)
751 0 0 if $logger
757 0 0 $description =~ /(black|noir)/i ? :
0 0 $description =~ /(yellow|jaune)/i ? :
0 0 $description =~ /magenta/i ? :
0 0 $description =~ /cyan/i ? :
768 0 0 if ($current == -2) { }
0 0 elsif ($current == -3) { }
776 0 0 if ($max != -2) { }
781 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 ? :
803 0 0 if (ref $variable->{'oid'} eq 'ARRAY') { }
806 0 0 if $value
812 0 0 unless defined $value
813 0 0 unless (_isInteger($value))
814 0 0 if $logger
865 0 0 unless defined $value1 and _isInteger($value1)
866 0 0 unless defined $value2 and _isInteger($value2)
867 0 0 if $value1 == 0
881 4 9 unless $value
887 0 9 if ($value =~ /\A [[:ascii:]] \Z/msx)
892 5 4 if ($value =~ /^(?:0x)?([0-9A-F]+)$/i) { }
897 1 3 if grep((!/^[0-9A-F]{1,2}$/i), @bytes)
900 4 4 if (scalar @bytes == 6) { }
2 2 elsif (scalar @bytes == 8 and $bytes[0] eq '10' && $bytes[1] =~ /^0+/ || $bytes[0] =~ /^2/) { }
1 1 elsif (scalar @bytes < 6) { }
1 0 elsif (scalar @bytes > 6) { }
916 0 8 if $result eq '00:00:00:00:00:00'
924 2 4 unless $value
933 0 4 unless $value
942 0 0 unless $value
948 0 0 unless $value
956 0 0 if ($value =~ /^(\d+) KBytes$/) { }
966 0 0 if _isInteger($value)
967 0 0 if $value =~ /\((\d+)\)$/
973 0 0 _isInteger($value) ? :
1004 4 0 if ($addresses)
1019 0 4 if ($addresses) { }
1034 1 0 if exists $port->{'CONNECTIONS'} and exists $port->{'CONNECTIONS'}{'CDP'} and $port->{'CONNECTIONS'}{'CDP'}
1035 3 0 unless exists $port->{'VLANS'}
1045 0 0 if $logger
1052 0 0 unless $mac_addresses
1056 0 4 if @vlans
1059 4 0 unless (@mac_addresses)
1065 0 4 if $addresses
1089 0 4 unless (exists $ports->{$port_id})
1090 0 0 if $logger
1103 1 0 if exists $port->{'CONNECTIONS'} and exists $port->{'CONNECTIONS'}{'CDP'} and $port->{'CONNECTIONS'}{'CDP'}
1108 1 2 if $port->{'MAC'}
1112 0 0 if exists $port->{'CONNECTIONS'} and exists $port->{'CONNECTIONS'}{'CONNECTION'} and exists $port->{'CONNECTIONS'}{'CONNECTION'}{'MAC'}
1117 0 3 unless @adresses
1144 0 10 unless defined $interface_id
1147 0 10 if @bytes > 6
1167 0 0 unless defined $interface_id
1183 0 0 if ($lldp_info)
1186 0 0 unless (exists $ports->{$interface_id})
1187 0 0 if $logger
1204 0 0 if ($cdp_info)
1207 0 0 unless (exists $ports->{$interface_id})
1208 0 0 if $logger
1218 0 0 if ($lldp_connection) { }
1219 0 0 if ($cdp_connection->{'SYSDESCR'} eq $lldp_connection->{'SYSDESCR'}) { }
1242 0 0 if ($edp_info)
1245 0 0 unless (exists $ports->{$interface_id})
1246 0 0 if $logger
1256 0 0 if ($lldp_connection) { }
1257 0 0 if ($edp_connection->{'SYSDESCR'} eq $lldp_connection->{'SYSDESCR'}) { }
1303 0 0 unless $sysdescr
1313 0 0 if (not $portId =~ /^0x/ or length $portId != 14)
1318 0 0 if $ifdescr
1321 0 0 if $sysname
1327 0 0 $params{'vendor'} eq 'Juniper' ? :
0 0 !exists $port2interface->{$id} ? :
1355 0 3 if $ip eq '0.0.0.0'
1359 2 1 unless $sysdescr and $model
1369 0 1 if ($devicePort =~ /^\d+$/) { }
1377 0 1 if ($deviceId =~ /^0x/) { }
1378 0 0 if (length $deviceId == 14) { }
1389 1 0 if ($connection->{'SYSNAME'} and $connection->{'SYSNAME'} =~ /^SIP([A-F0-9a-f]*)$/)
1396 0 1 if ($results->{$interface_id}) { }
1436 0 0 if $ip eq '0.0.0.0'
1451 0 0 if ($results->{$interface_id}) { }
1475 0 0 unless $vlans
1482 0 0 unless (exists $ports->{$port_id})
1483 0 0 if $logger
1505 0 0 if ($vtpVlanName and $vmPortStatus)
1520 0 0 if ($vlanId)
1538 0 0 unless $trunk_ports
1545 0 0 unless (exists $ports->{$port_id})
1546 0 0 if $logger
1568 1 0 if ($vlanStatus)
1570 2 1 $value == 1 ? :
1581 0 0 if ($accessMode)
1586 0 0 $value == 2 ? :
1597 0 0 if ($vlanId)
1602 0 0 !exists $port2interface->{$id} ? :
1603 0 0 $value == 0 ? :
1618 0 0 if ($lacp_info)
1621 0 0 unless ($ports->{$interface_id})
1622 0 0 if $logger
1632 0 0 if ($pagp_info)
1635 0 0 unless ($ports->{$interface_id})
1636 0 0 if $logger
1656 0 0 if $aggregator_id == 0
1657 0 0 if $aggregator_id == $interface_id
1674 0 0 unless $portShortNum > 0