def _check_psu_sensor_info(self, sensor_name, oid_offset): psu_sub_id = get_psu_sub_id(2)[0] sub_id = get_psu_sensor_sub_id((psu_sub_id, ), sensor_name)[0] expected_mib = { 2: (ValueType.OCTET_STRING, "{} for PSU 2".format(PSU_SENSOR_NAME_MAP[sensor_name])), 4: (ValueType.INTEGER, psu_sub_id), 5: (ValueType.INTEGER, PhysicalClass.SENSOR), 6: (ValueType.INTEGER, PSU_SENSOR_POSITION_MAP[sensor_name]), 7: (ValueType.OCTET_STRING, "{} for PSU 2".format(PSU_SENSOR_NAME_MAP[sensor_name])), 16: (ValueType.INTEGER, 2) } self._check_getpdu(sub_id, expected_mib)
def test_getpdu_psu_current_sensor(self): """ Test case for correctness of psu current sensor MIB values """ expected_values = [ rfc3433.EntitySensorDataType.AMPERES, rfc3433.EntitySensorDataScale.UNITS, 3, # precision 13400, # expected sensor value rfc3433.EntitySensorStatus.OK ] psu_sub_id = get_psu_sub_id(self.PSU_POSITION) self._test_getpdu_sensor( get_psu_sensor_sub_id(psu_sub_id, "current")[0], expected_values)
def test_getpdu_psu_power_sensor(self): """ Test case for correctness of psu voltage sensor MIB values """ expected_values = [ rfc3433.EntitySensorDataType.WATTS, rfc3433.EntitySensorDataScale.UNITS, 3, # precision 312600, # expected sensor value rfc3433.EntitySensorStatus.OK ] psu_sub_id = get_psu_sub_id(self.PSU_POSITION) self._test_getpdu_sensor( get_psu_sensor_sub_id(psu_sub_id, "power")[0], expected_values)
def test_getpdu_psu_temp_sensor(self): """ Test case for correctness of psu temperature sensor MIB values """ expected_values = [ rfc3433.EntitySensorDataType.CELSIUS, rfc3433.EntitySensorDataScale.UNITS, 3, # precision 31100, # expected sensor value rfc3433.EntitySensorStatus.OK ] psu_sub_id = get_psu_sub_id(self.PSU_POSITION) self._test_getpdu_sensor( get_psu_sensor_sub_id(psu_sub_id, "temperature")[0], expected_values)
def test_getpdu_psu_info(self): sub_id = get_psu_sub_id(2)[0] expected_mib = { 2: (ValueType.OCTET_STRING, "PSU 2"), 4: (ValueType.INTEGER, 1), 5: (ValueType.INTEGER, PhysicalClass.POWERSUPPLY), 6: (ValueType.INTEGER, 2), 7: (ValueType.OCTET_STRING, "PSU 2"), 8: (ValueType.OCTET_STRING, ""), 9: (ValueType.OCTET_STRING, ""), 10: (ValueType.OCTET_STRING, ""), 11: (ValueType.OCTET_STRING, "PSU_SERIAL"), 12: (ValueType.OCTET_STRING, ""), 13: (ValueType.OCTET_STRING, "PSU_MODEL"), 16: (ValueType.INTEGER, 1) } self._check_getpdu(sub_id, expected_mib)
def test_getpdu_psu_fan_speed_sensor(self): """ Test case for correctness of psu fan speed sensor MIB values """ expected_values = [ rfc3433.EntitySensorDataType.UNKNOWN, rfc3433.EntitySensorDataScale.UNITS, 0, # precision 57, # expected sensor value rfc3433.EntitySensorStatus.OK ] psu_sub_id = get_psu_sub_id(self.PSU_POSITION) fan_sub_id = get_fan_sub_id(psu_sub_id, self.PSU_FAN_POSITION) self._test_getpdu_sensor( get_fan_tachometers_sub_id(fan_sub_id)[0], expected_values)