diff --git a/includes/definitions/discovery/tait-infra93.yaml b/includes/definitions/discovery/tait-infra93.yaml index 81cb424664..e4fee1f518 100644 --- a/includes/definitions/discovery/tait-infra93.yaml +++ b/includes/definitions/discovery/tait-infra93.yaml @@ -1078,6 +1078,7 @@ modules: value: paTxOutputForwardPower num_oid: '.1.3.6.1.4.1.3570.2.2.2.1.2.3.2.1.{{ $index }}' descr: 'PA output (W)' + entPhysicalIndex: '130{{ $index }}' index: 'paTxOutputForwardPower.{{ $index }}' group: Power Amplifier count: @@ -1124,5 +1125,6 @@ modules: value: rctTemperatureBoard num_oid: '.1.3.6.1.4.1.3570.2.2.2.1.2.2.6.1.{{ $index }}' descr: 'Reciter Temperature (C)' + entPhysicalIndex: '120{{ $index }}' index: 'rctTemperatureBoard.{{ $index }}' group: Reciter diff --git a/includes/discovery/entity-physical/tait-infra93.inc.php b/includes/discovery/entity-physical/tait-infra93.inc.php new file mode 100644 index 0000000000..7060c473f3 --- /dev/null +++ b/includes/discovery/entity-physical/tait-infra93.inc.php @@ -0,0 +1,148 @@ + '10', + 'entPhysicalDescr' => 'Chassis', + 'entPhysicalClass' => 'chassis', + 'entPhysicalName' => 'Chassis', + 'entPhysicalModelName' => 'Infra93', + 'entPhysicalContainedIn' => '0', + 'entPhysicalMfgName' => 'TAIT', + 'entPhysicalIsFRU' => 'false', +]; + +// Fill the different modules the "entPhysical" way to have a correct display. +// We suppose only one FrontPanel, PA, PMU and Reciter is returned. If more than one is, +// this code would need to be adapted with loops +if (isset($modules_array[0]) and isset($modules_array[0]['fpInfoProductCode'])) { + $entity_array[] = [ + 'entPhysicalIndex' => '11', + 'entPhysicalDescr' => 'Front Panel', + 'entPhysicalClass' => 'module', + 'entPhysicalName' => 'Front Panel', + 'entPhysicalModelName' => $modules_array[0]['fpInfoProductCode'], + 'entPhysicalSerialNum' => $modules_array[0]['fpInfoSerialNumber'], + 'entPhysicalContainedIn' => '10', + 'entPhysicalMfgName' => 'TAIT', + 'entPhysicalHardwareRev' => $modules_array[0]['fpInfoHardwareVersion'], + 'entPhysicalFirmwareRev' => $modules_array[0]['fpInfoFirmwareVersion'], + 'entPhysicalIsFRU' => 'true', + ]; +} + +if (isset($modules_array[0]) and isset($modules_array[0]['rctInfoProductCode'])) { + $entity_array[] = [ + 'entPhysicalIndex' => '120', + 'entPhysicalDescr' => 'Reciter', + 'entPhysicalClass' => 'module', + 'entPhysicalName' => 'Reciter', + 'entPhysicalModelName' => $modules_array[0]['rctInfoProductCode'], + 'entPhysicalSerialNum' => $modules_array[0]['rctInfoSerialNumber'], + 'entPhysicalContainedIn' => '10', + 'entPhysicalMfgName' => 'TAIT', + 'entPhysicalHardwareRev' => $modules_array[0]['rctInfoHardwareVersion'], + 'entPhysicalFirmwareRev' => $modules_array[0]['rctInfoFirmwareVersion'], + 'entPhysicalIsFRU' => 'true', + ]; + $entity_array[] = [ + 'entPhysicalIndex' => '1200', + 'entPhysicalDescr' => 'Reciter Temperature Sensor', + 'entPhysicalClass' => 'sensor', + 'entPhysicalName' => 'Reciter Temperature', + 'entPhysicalContainedIn' => '120', + 'entPhysicalMfgName' => 'TAIT', + 'entPhysicalParentRelPos' => '-1', + 'entPhysicalIsFRU' => 'false', + ]; +} + +if (isset($modules_array[0]) and isset($modules_array[0]['paInfoProductCode'])) { + $entity_array[] = [ + 'entPhysicalIndex' => '130', + 'entPhysicalDescr' => 'Power Amplifier', + 'entPhysicalClass' => 'module', + 'entPhysicalName' => 'Power Amplifier', + 'entPhysicalModelName' => $modules_array[0]['paInfoProductCode'], + 'entPhysicalSerialNum' => $modules_array[0]['paInfoSerialNumber'], + 'entPhysicalContainedIn' => '10', + 'entPhysicalMfgName' => 'TAIT', + 'entPhysicalHardwareRev' => $modules_array[0]['paInfoHardwareVersion'], + 'entPhysicalFirmwareRev' => $modules_array[0]['paInfoFirmwareVersion'], + 'entPhysicalIsFRU' => 'true', + ]; + $entity_array[] = [ + 'entPhysicalIndex' => '1300', + 'entPhysicalDescr' => 'Amplifier Power Sensor', + 'entPhysicalClass' => 'sensor', + 'entPhysicalName' => 'Output Power', + 'entPhysicalContainedIn' => '130', + 'entPhysicalMfgName' => 'TAIT', + 'entPhysicalParentRelPos' => '-1', + 'entPhysicalIsFRU' => 'false', + ]; +} + +$entity_array[] = [ + 'entPhysicalIndex' => '140', + 'entPhysicalDescr' => 'PMU', + 'entPhysicalClass' => 'module', + 'entPhysicalName' => 'PMU', + 'entPhysicalModelName' => $modules_array[0]['pmuInfoProductCode'], + 'entPhysicalSerialNum' => $modules_array[0]['pmuInfoSerialNumber'], + 'entPhysicalContainedIn' => '10', + 'entPhysicalMfgName' => 'TAIT', + 'entPhysicalParentRelPos' => '', + 'entPhysicalVendorType' => '', + 'entPhysicalHardwareRev' => $modules_array[0]['pmuInfoHardwareVersion'], + 'entPhysicalFirmwareRev' => $modules_array[0]['pmuInfoFirmwareVersion'], + 'entPhysicalIsFRU' => 'true', +]; + +foreach ($entity_array as $entPhysicalIndex => $entry) { + $entPhysicalIndex = array_key_exists('entPhysicalIndex', $entry) ? $entry['entPhysicalIndex'] : ''; + $entPhysicalDescr = array_key_exists('entPhysicalDescr', $entry) ? $entry['entPhysicalDescr'] : ''; + $entPhysicalClass = array_key_exists('entPhysicalClass', $entry) ? $entry['entPhysicalClass'] : ''; + $entPhysicalName = array_key_exists('entPhysicalName', $entry) ? $entry['entPhysicalName'] : ''; + $entPhysicalModelName = array_key_exists('entPhysicalModelName', $entry) ? $entry['entPhysicalModelName'] : ''; + $entPhysicalSerialNum = array_key_exists('entPhysicalSerialNum', $entry) ? $entry['entPhysicalSerialNum'] : ''; + $entPhysicalContainedIn = array_key_exists('entPhysicalContainedIn', $entry) ? $entry['entPhysicalContainedIn'] : ''; + $entPhysicalMfgName = array_key_exists('entPhysicalMfgName', $entry) ? $entry['entPhysicalMfgName'] : ''; + $entPhysicalParentRelPos = array_key_exists('entPhysicalParentRelPos', $entry) ? $entry['entPhysicalParentRelPos'] : ''; + $entPhysicalVendorType = array_key_exists('entPhysicalVendorType', $entry) ? $entry['entPhysicalVendorType'] : ''; + $entPhysicalHardwareRev = array_key_exists('entPhysicalHardwareRev', $entry) ? $entry['entPhysicalHardwareRev'] : ''; + $entPhysicalFirmwareRev = array_key_exists('entPhysicalFirmwareRev', $entry) ? $entry['entPhysicalFirmwareRev'] : ''; + $entPhysicalSoftwareRev = array_key_exists('entPhysicalSoftwareRev', $entry) ? $entry['entPhysicalSoftwareRev'] : ''; + $entPhysicalIsFRU = array_key_exists('entPhysicalIsFRU', $entry) ? $entry['entPhysicalIsFRU'] : ''; + $entPhysicalAlias = array_key_exists('entPhysicalAlias', $entry) ? $entry['entPhysicalAlias'] : ''; + $entPhysicalAssetID = array_key_exists('entPhysicalAssetID', $entry) ? $entry['entPhysicalAssetID'] : ''; + $ifIndex = array_key_exists('ifIndex', $entry) ? $entry['ifIndex'] : ''; + + discover_entity_physical($valid, $device, $entPhysicalIndex, $entPhysicalDescr, $entPhysicalClass, $entPhysicalName, $entPhysicalModelName, $entPhysicalSerialNum, $entPhysicalContainedIn, $entPhysicalMfgName, $entPhysicalParentRelPos, $entPhysicalVendorType, $entPhysicalHardwareRev, $entPhysicalFirmwareRev, $entPhysicalSoftwareRev, $entPhysicalIsFRU, $entPhysicalAlias, $entPhysicalAssetID, $ifIndex); +}//end foreach + +echo "\n"; +unset( + $modules_array, + $entry, + $entity_array +); diff --git a/tests/data/tait-infra93.json b/tests/data/tait-infra93_tb9300.json similarity index 99% rename from tests/data/tait-infra93.json rename to tests/data/tait-infra93_tb9300.json index 2742d2482d..a3228a614d 100644 --- a/tests/data/tait-infra93.json +++ b/tests/data/tait-infra93_tb9300.json @@ -834,7 +834,7 @@ "sensor_limit_low_warn": null, "sensor_alert": 1, "sensor_custom": "No", - "entPhysicalIndex": null, + "entPhysicalIndex": "1300", "entPhysicalIndex_measured": null, "sensor_prev": null, "user_func": null, @@ -2682,7 +2682,7 @@ "sensor_limit_low_warn": null, "sensor_alert": 1, "sensor_custom": "No", - "entPhysicalIndex": null, + "entPhysicalIndex": "1200", "entPhysicalIndex_measured": null, "sensor_prev": null, "user_func": null, diff --git a/tests/snmpsim/tait-infra93.snmprec b/tests/snmpsim/tait-infra93_tb9300.snmprec similarity index 100% rename from tests/snmpsim/tait-infra93.snmprec rename to tests/snmpsim/tait-infra93_tb9300.snmprec