示例#1
0
    def validate(self, task):
        """Check if node.driver_info contains the required CIMC credentials.

        :param task: a TaskManager instance.
        :raises: InvalidParameterValue if required CIMC credentials are
                 missing.
        """
        common.parse_driver_info(task.node)
示例#2
0
    def validate(self, task):
        """Check if node.driver_info contains the required CIMC credentials.

        :param task: a TaskManager instance.
        :raises: InvalidParameterValue if required CIMC credentials are
                 missing.
        """
        common.parse_driver_info(task.node)
示例#3
0
    def test_cimc_handle_login(self, mock_handle):
        info = cimc_common.parse_driver_info(self.node)

        with task_manager.acquire(self.context, self.node.uuid,
                                  shared=False) as task:
            with mock_handle(task) as handle:
                cimc_common.handle_login(task, handle, info)

                handle.login.assert_called_once_with(
                    self.node.driver_info['cimc_address'],
                    self.node.driver_info['cimc_username'],
                    self.node.driver_info['cimc_password'])
示例#4
0
    def test_cimc_handle_login(self, mock_handle):
        info = cimc_common.parse_driver_info(self.node)

        with task_manager.acquire(self.context, self.node.uuid,
                                  shared=False) as task:
            with mock_handle(task) as handle:
                cimc_common.handle_login(task, handle, info)

                handle.login.assert_called_once_with(
                    self.node.driver_info['cimc_address'],
                    self.node.driver_info['cimc_username'],
                    self.node.driver_info['cimc_password'])
示例#5
0
    def test_cimc_handle_login_exception(self, mock_handle):
        info = cimc_common.parse_driver_info(self.node)

        with task_manager.acquire(self.context, self.node.uuid,
                                  shared=False) as task:
            with mock_handle(task) as handle:
                handle.login.side_effect = imcsdk.ImcException('Boom')

                self.assertRaises(exception.CIMCException,
                                  cimc_common.handle_login, task, handle, info)

                handle.login.assert_called_once_with(
                    self.node.driver_info['cimc_address'],
                    self.node.driver_info['cimc_username'],
                    self.node.driver_info['cimc_password'])
示例#6
0
    def test_cimc_handle_login_exception(self, mock_handle):
        info = cimc_common.parse_driver_info(self.node)

        with task_manager.acquire(self.context, self.node.uuid,
                                  shared=False) as task:
            with mock_handle(task) as handle:
                handle.login.side_effect = imcsdk.ImcException('Boom')

                self.assertRaises(exception.CIMCException,
                                  cimc_common.handle_login,
                                  task, handle, info)

                handle.login.assert_called_once_with(
                    self.node.driver_info['cimc_address'],
                    self.node.driver_info['cimc_username'],
                    self.node.driver_info['cimc_password'])
示例#7
0
    def test_cimc_handle(self, mock_login, mock_handle):
        mo_hand = mock.MagicMock()
        mo_hand.username = self.node.driver_info.get('cimc_username')
        mo_hand.password = self.node.driver_info.get('cimc_password')
        mo_hand.name = self.node.driver_info.get('cimc_address')
        mock_handle.return_value = mo_hand
        info = cimc_common.parse_driver_info(self.node)

        with task_manager.acquire(self.context, self.node.uuid,
                                  shared=False) as task:
            with cimc_common.cimc_handle(task) as handle:
                self.assertEqual(handle, mock_handle.return_value)

        mock_login.assert_called_once_with(task, mock_handle.return_value,
                                           info)
        mock_handle.return_value.logout.assert_called_once_with()
示例#8
0
    def test_cimc_handle(self, mock_login, mock_handle):
        mo_hand = mock.MagicMock()
        mo_hand.username = self.node.driver_info.get('cimc_username')
        mo_hand.password = self.node.driver_info.get('cimc_password')
        mo_hand.name = self.node.driver_info.get('cimc_address')
        mock_handle.return_value = mo_hand
        info = cimc_common.parse_driver_info(self.node)

        with task_manager.acquire(self.context, self.node.uuid,
                                  shared=False) as task:
            with cimc_common.cimc_handle(task) as handle:
                self.assertEqual(handle, mock_handle.return_value)

        mock_login.assert_called_once_with(task, mock_handle.return_value,
                                           info)
        mock_handle.return_value.logout.assert_called_once_with()
示例#9
0
    def test_parse_driver_info(self):
        info = cimc_common.parse_driver_info(self.node)

        self.assertIsNotNone(info.get('cimc_address'))
        self.assertIsNotNone(info.get('cimc_username'))
        self.assertIsNotNone(info.get('cimc_password'))
示例#10
0
    def test_parse_driver_info(self):
        info = cimc_common.parse_driver_info(self.node)

        self.assertEqual(INFO_DICT['cimc_address'], info['cimc_address'])
        self.assertEqual(INFO_DICT['cimc_username'], info['cimc_username'])
        self.assertEqual(INFO_DICT['cimc_password'], info['cimc_password'])
示例#11
0
    def test_parse_driver_info(self):
        info = cimc_common.parse_driver_info(self.node)

        self.assertIsNotNone(info.get('cimc_address'))
        self.assertIsNotNone(info.get('cimc_username'))
        self.assertIsNotNone(info.get('cimc_password'))
示例#12
0
    def test_parse_driver_info(self):
        info = cimc_common.parse_driver_info(self.node)

        self.assertEqual(INFO_DICT['cimc_address'], info['cimc_address'])
        self.assertEqual(INFO_DICT['cimc_username'], info['cimc_username'])
        self.assertEqual(INFO_DICT['cimc_password'], info['cimc_password'])