def test_update_ipmi_properties(self): with task_manager.acquire(self.context, self.node.uuid, shared=False) as task: ipmi_info = { "ipmi_address": "1.2.3.4", "ipmi_username": "******", "ipmi_password": "******", "ipmi_terminal_port": 60, } self.info["console_port"] = 60 task.node.driver_info = self.info ilo_common.update_ipmi_properties(task) actual_info = task.node.driver_info expected_info = dict(self.info, **ipmi_info) self.assertEqual(expected_info, actual_info)
def get_sensors_data(self, task): """Get sensors data. :param task: a TaskManager instance. :raises: FailedToGetSensorData when getting the sensor data fails. :raises: FailedToParseSensorData when parsing sensor data fails. :raises: InvalidParameterValue if required ipmi parameters are missing. :raises: MissingParameterValue if a required parameter is missing. :returns: returns a dict of sensor data group by sensor type. """ ilo_common.update_ipmi_properties(task) ipmi_management = ipmitool.IPMIManagement() return ipmi_management.get_sensors_data(task)
def test_update_ipmi_properties(self): with task_manager.acquire(self.context, self.node.uuid, shared=False) as task: ipmi_info = { "ipmi_address": "1.2.3.4", "ipmi_username": "******", "ipmi_password": "******", "ipmi_terminal_port": 60 } self.info['console_port'] = 60 task.node.driver_info = self.info ilo_common.update_ipmi_properties(task) actual_info = task.node.driver_info expected_info = dict(self.info, **ipmi_info) self.assertEqual(expected_info, actual_info)
def validate(self, task): """Validate the Node console info. :param task: a task from TaskManager. :raises: InvalidParameterValue :raises: MissingParameterValue when a required parameter is missing """ node = task.node driver_info = ilo_common.parse_driver_info(node) if "console_port" not in driver_info: raise exception.MissingParameterValue(_("Missing 'console_port' parameter in node's driver_info.")) ilo_common.update_ipmi_properties(task) super(IloConsoleInterface, self).validate(task)
def validate(self, task): """Validate the Node console info. :param task: a task from TaskManager. :raises: InvalidParameterValue :raises: MissingParameterValue when a required parameter is missing """ node = task.node driver_info = ilo_common.parse_driver_info(node) if 'console_port' not in driver_info: raise exception.MissingParameterValue( _("Missing 'console_port' parameter in node's driver_info.")) ilo_common.update_ipmi_properties(task) super(IloConsoleInterface, self).validate(task)