Issue 1865, Juniper hardware inventory fix

This commit is contained in:
Rick Hodger
2015-11-20 10:47:47 +00:00
parent 7a1f9e4998
commit 8b1dc95d83

View File

@@ -37,6 +37,9 @@ if ($config['enable_inventory']) {
$entPhysicalIsFRU = $entry['jnxFruType']; $entPhysicalIsFRU = $entry['jnxFruType'];
$entPhysicalAlias = $entry['entPhysicalAlias']; $entPhysicalAlias = $entry['entPhysicalAlias'];
$entPhysicalAssetID = $entry['entPhysicalAssetID']; $entPhysicalAssetID = $entry['entPhysicalAssetID'];
// fix for issue 1865, $entPhysicalIndex, as it contains a quad dotted number on newer Junipers
// using str_replace to remove all dots should fix this even if it changes in future
$entPhysicalIndex = str_replace('.','',$entPhysicalIndex);
} }
else { else {
$entPhysicalDescr = $entry['entPhysicalDescr']; $entPhysicalDescr = $entry['entPhysicalDescr'];
@@ -127,18 +130,19 @@ if ($config['enable_inventory']) {
echo '+'; echo '+';
}//end if }//end if
if ($device['os'] == 'junos') { // This entire if/else statement is no longer necessary as we fix $entPhysicalIndex at the start of the loop
//if ($device['os'] == 'junos') {
// $entPhysicalIndex appears as a numeric OID fragment // $entPhysicalIndex appears as a numeric OID fragment
// (string), so convert it to an "integer" for the // (string), so convert it to an "integer" for the
// validation step below since it is stored in the DB as // validation step below since it is stored in the DB as
// an integer. This should be fixed. // an integer. This should be fixed.
list($first,$second) = explode('.', $entPhysicalIndex); //list($first,$second) = explode('.', $entPhysicalIndex);
$entPhysicalIndexNoDots = $first.$second; //$entPhysicalIndexNoDots = $first.$second;
$valid[$entPhysicalIndexNoDots] = 1; //$valid[$entPhysicalIndexNoDots] = 1;
} //}
else { //else {
$valid[$entPhysicalIndex] = 1; $valid[$entPhysicalIndex] = 1;
} //}
}//end if }//end if
}//end foreach }//end foreach
} }