Example #1
0
    def validate(self, task):
        """Validates the driver-specific information used by the idrac BMC

        :param task: a TaskManager instance containing the node to act on
        :raises: InvalidParameterValue if some mandatory information
                 is missing on the node or on invalid inputs
        """
        drac_common.parse_driver_info(task.node)
    def test_parse_driver_info_missing_path(self):
        node = obj_utils.create_test_node(self.context,
                                          driver='fake_drac',
                                          driver_info=INFO_DICT)
        del node.driver_info['drac_path']

        info = drac_common.parse_driver_info(node)
        self.assertEqual('/wsman', info.get('drac_path'))
Example #3
0
    def test_parse_driver_info_missing_path(self):
        node = obj_utils.create_test_node(self.context,
                                          driver='idrac',
                                          driver_info=INFO_DICT)
        del node.driver_info['drac_path']

        info = drac_common.parse_driver_info(node)
        self.assertEqual('/wsman', info['drac_path'])
Example #4
0
    def test_parse_driver_info_missing_port(self):
        node = obj_utils.create_test_node(self.context,
                                          driver='fake_drac',
                                          driver_info=INFO_DICT)
        del node.driver_info['drac_port']

        info = drac_common.parse_driver_info(node)
        self.assertEqual(443, info['drac_port'])
Example #5
0
    def test_parse_driver_info_missing_protocol(self):
        node = obj_utils.create_test_node(self.context,
                                          driver='fake_drac',
                                          driver_info=INFO_DICT)
        del node.driver_info['drac_protocol']

        info = drac_common.parse_driver_info(node)
        self.assertEqual('https', info.get('drac_protocol'))
Example #6
0
    def test_parse_driver_info_missing_protocol(self):
        node = obj_utils.create_test_node(self.context,
                                          driver='fake_drac',
                                          driver_info=INFO_DICT)
        del node.driver_info['drac_protocol']

        info = drac_common.parse_driver_info(node)
        self.assertEqual('https', info['drac_protocol'])
Example #7
0
    def test_parse_driver_info_missing_port(self):
        node = obj_utils.create_test_node(self.context,
                                          driver='idrac',
                                          driver_info=INFO_DICT)
        del node.driver_info['drac_port']

        info = drac_common.parse_driver_info(node)
        self.assertEqual(443, info['drac_port'])
Example #8
0
 def test_parse_driver_info_drac_host_and_drac_address(self, mock_log):
     driver_info = db_utils.get_test_drac_info()
     driver_info['drac_host'] = '4.5.6.7'
     node = obj_utils.create_test_node(self.context,
                                       driver='idrac',
                                       driver_info=driver_info)
     info = drac_common.parse_driver_info(node)
     self.assertEqual('4.5.6.7', driver_info['drac_host'])
     self.assertEqual(driver_info['drac_address'], info['drac_address'])
     self.assertTrue(mock_log.called)
Example #9
0
 def test_parse_driver_info_drac_host_and_drac_address(self, mock_log):
     driver_info = db_utils.get_test_drac_info()
     driver_info['drac_host'] = '4.5.6.7'
     node = obj_utils.create_test_node(self.context,
                                       driver='fake_drac',
                                       driver_info=driver_info)
     info = drac_common.parse_driver_info(node)
     self.assertEqual('4.5.6.7', driver_info['drac_host'])
     self.assertEqual(driver_info['drac_address'], info['drac_address'])
     self.assertTrue(mock_log.called)
Example #10
0
 def test_parse_driver_info(self):
     node = obj_utils.create_test_node(self.context,
                                       driver='fake_drac',
                                       driver_info=INFO_DICT)
     info = drac_common.parse_driver_info(node)
     self.assertEqual(INFO_DICT['drac_host'], info['drac_host'])
     self.assertEqual(INFO_DICT['drac_port'], info['drac_port'])
     self.assertEqual(INFO_DICT['drac_path'], info['drac_path'])
     self.assertEqual(INFO_DICT['drac_protocol'], info['drac_protocol'])
     self.assertEqual(INFO_DICT['drac_username'], info['drac_username'])
     self.assertEqual(INFO_DICT['drac_password'], info['drac_password'])
Example #11
0
 def test_parse_driver_info(self):
     node = obj_utils.create_test_node(self.context,
                                       driver='idrac',
                                       driver_info=INFO_DICT)
     info = drac_common.parse_driver_info(node)
     self.assertEqual(INFO_DICT['drac_address'], info['drac_address'])
     self.assertEqual(INFO_DICT['drac_port'], info['drac_port'])
     self.assertEqual(INFO_DICT['drac_path'], info['drac_path'])
     self.assertEqual(INFO_DICT['drac_protocol'], info['drac_protocol'])
     self.assertEqual(INFO_DICT['drac_username'], info['drac_username'])
     self.assertEqual(INFO_DICT['drac_password'], info['drac_password'])
Example #12
0
    def validate(self, task):
        """Validate the driver-specific Node power info.

        This method validates whether the 'driver_info' property of the
        supplied node contains the required information for this driver to
        manage the power state of the node.

        :param task: a TaskManager instance containing the node to act on.
        :raises: InvalidParameterValue if required driver_info attribute
                 is missing or invalid on the node.
        """
        return drac_common.parse_driver_info(task.node)
    def test_parse_driver_info(self):
        node = obj_utils.create_test_node(self.context,
                                          driver='fake_drac',
                                          driver_info=INFO_DICT)
        info = drac_common.parse_driver_info(node)

        self.assertIsNotNone(info.get('drac_host'))
        self.assertIsNotNone(info.get('drac_port'))
        self.assertIsNotNone(info.get('drac_path'))
        self.assertIsNotNone(info.get('drac_protocol'))
        self.assertIsNotNone(info.get('drac_username'))
        self.assertIsNotNone(info.get('drac_password'))
Example #14
0
    def test_parse_driver_info(self):
        node = obj_utils.create_test_node(self.context,
                                          driver='fake_drac',
                                          driver_info=INFO_DICT)
        info = drac_common.parse_driver_info(node)

        self.assertIsNotNone(info.get('drac_host'))
        self.assertIsNotNone(info.get('drac_port'))
        self.assertIsNotNone(info.get('drac_path'))
        self.assertIsNotNone(info.get('drac_protocol'))
        self.assertIsNotNone(info.get('drac_username'))
        self.assertIsNotNone(info.get('drac_password'))
Example #15
0
    def validate(self, task):
        """Validate the driver-specific Node power info.

        This method validates whether the 'driver_info' property of the
        supplied node contains the required information for this driver to
        manage the power state of the node.

        :param task: a TaskManager instance containing the node to act on.
        :raises: InvalidParameterValue if required driver_info attribute
                 is missing or invalid on the node.
        """
        return drac_common.parse_driver_info(task.node)
Example #16
0
    def validate(self, task, **kwargs):
        """Validates the driver_info of a node.

        This method validates the driver_info associated with the node that is
        associated with the task.

        :param task: the ironic task used to identify the node.
        :param kwargs: not used.
        :raises: InvalidParameterValue if mandatory information is missing on
                 the node or any driver_info is invalid.
        :returns: a dict containing information from driver_info
                  and default values.
        """
        return drac_common.parse_driver_info(task.node)
Example #17
0
    def validate(self, task, **kwargs):
        """Validates the driver_info of a node.

        This method validates the driver_info associated with the node that is
        associated with the task.

        :param task: the ironic task used to identify the node.
        :param kwargs: not used.
        :raises: InvalidParameterValue if mandatory information is missing on
                 the node or any driver_info is invalid.
        :returns: a dict containing information from driver_info
                  and default values.
        """
        return drac_common.parse_driver_info(task.node)
Example #18
0
def get_wsman_client(node):
    """Return a DRAC client object.

    Given an ironic node object, this method gives back a
    Client object which is a wrapper for pywsman.Client.

    :param node: an ironic node object.
    :returns: a Client object.
    :raises: InvalidParameterValue if some mandatory information
             is missing on the node or on invalid inputs.
    """
    driver_info = drac_common.parse_driver_info(node)
    client = Client(**driver_info)
    return client
Example #19
0
def get_wsman_client(node):
    """Return a DRAC client object.

    Given an ironic node object, this method gives back a
    Client object which is a wrapper for pywsman.Client.

    :param node: an ironic node object.
    :returns: a Client object.
    :raises: InvalidParameterValue if some mandatory information
             is missing on the node or on invalid inputs.
    """
    driver_info = drac_common.parse_driver_info(node)
    client = Client(**driver_info)
    return client