コード例 #1
0
 def setUp(self):
     # | BEFORE_EACH |
     super(IloCommonModuleTestCase, self).setUp()
     self.ribcl = ribcl.RIBCLOperations("x.x.x.x", "admin", "Admin", 60,
                                        443)
     self.ris = ris.RISOperations("x.x.x.x", "admin", "Admin", 60, 443)
     self.any_scexe_file = 'any_file.scexe'
     self.any_rpm_file = 'any_file.rpm'
コード例 #2
0
    def test_init(self, disable_warning_mock):
        ribcl_client = ribcl.RIBCLOperations(
            "x.x.x.x", "admin", "Admin", 60, 443, cacert='/somepath')

        self.assertEqual(ribcl_client.host, "x.x.x.x")
        self.assertEqual(ribcl_client.login, "admin")
        self.assertEqual(ribcl_client.password, "Admin")
        self.assertEqual(ribcl_client.timeout, 60)
        self.assertEqual(ribcl_client.port, 443)
        self.assertEqual(ribcl_client.cacert, '/somepath')
コード例 #3
0
    def test_init_without_cacert(self, disable_warning_mock):
        ribcl_client = ribcl.RIBCLOperations("x.x.x.x", "admin", "Admin", 60,
                                             443)

        self.assertEqual(ribcl_client.host, "x.x.x.x")
        self.assertEqual(ribcl_client.login, "admin")
        self.assertEqual(ribcl_client.password, "Admin")
        self.assertEqual(ribcl_client.timeout, 60)
        self.assertEqual(ribcl_client.port, 443)
        self.assertIsNone(ribcl_client.cacert)
        disable_warning_mock.assert_called_once_with(
            urllib3_exceptions.InsecureRequestWarning)
コード例 #4
0
    def test__request_host_with_verify(self, request_mock):
        self.ilo = ribcl.RIBCLOperations(
            "x.x.x.x", "admin", "Admin", 60, 443,
            cacert='/somepath')
        response_mock = mock.MagicMock(text='foo')
        request_mock.return_value = response_mock

        retval = self.ilo._request_host()

        request_mock.assert_called_once_with(
            "https://x.x.x.x/xmldata?item=all", verify='/somepath')
        response_mock.raise_for_status.assert_called_once_with()
        self.assertEqual('foo', retval)
コード例 #5
0
ファイル: client.py プロジェクト: ramineni/proliantutils
    def __new__(self, host, login, password, timeout=60, port=443,
                bios_password=None):

        # Object is created based on the server model
        client = ribcl.RIBCLOperations(host, login, password, timeout, port)

        # Till the full RIS Integration is done, disabling the automatic switch
        # between RIS and RIBCL CLient. Defaulting it to RIBCL for now.
        # TODO(Anusha): Uncomment when full RIS library is available.
#         model = client.get_product_name()
#
#         if 'Gen9' in model:
#             client = ris.RISOperations(host, login, password, bios_password)
        return client
コード例 #6
0
ファイル: client.py プロジェクト: anta-nok/proliantutils
    def __init__(self, host, login, password, timeout=60, port=443,
                 bios_password=None, cacert=None, snmp_credentials=None,
                 use_redfish_only=False):
        self.ribcl = ribcl.RIBCLOperations(host, login, password, timeout,
                                           port, cacert=cacert)
        self.info = {'address': host, 'username': login, 'password': password}
        self.host = host
        self.use_redfish_only = use_redfish_only

        if use_redfish_only:
            self._init_redfish_object(None, host, login, password,
                                      bios_password=bios_password,
                                      cacert=cacert)
            LOG.debug(self._("Forced to use 'redfish' way to interact "
                             "with iLO. Model: %(model)s"),
                      {'model': self.model})
        else:
            try:
                self.model = self.ribcl.get_product_name()
            except exception.IloError:
                # Note(deray): This can be a potential scenario where
                # RIBCL is disabled on a Gen10 (iLO 5) hardware.
                # So, trying out the redfish operation object instantiation.
                # If that passes we know that our assumption is right.
                # If that errors out, then alas! we are left with no other
                # choice.
                self._init_redfish_object(False, host, login, password,
                                          bios_password=bios_password,
                                          cacert=cacert)
            else:
                self.ribcl.init_model_based_tags(self.model)
                if ('Gen10' in self.model):
                    self._init_redfish_object(True, host, login, password,
                                              bios_password=bios_password,
                                              cacert=cacert,
                                              should_set_model=False)
                else:
                    # Gen9
                    self.ris = ris.RISOperations(
                        host, login, password, bios_password=bios_password,
                        cacert=cacert)

        self.snmp_credentials = snmp_credentials
        self._validate_snmp()
        LOG.debug(self._("IloClient object created. "
                         "Model: %(model)s"), {'model': self.model})
コード例 #7
0
    def test__request_ilo_with_verify(self, post_mock, serialize_mock):
        self.ilo = ribcl.RIBCLOperations(
            "x.x.x.x", "admin", "Admin", 60, 443,
            cacert='/somepath')
        response_mock = mock.MagicMock(text='returned-text')
        serialize_mock.return_value = 'serialized-xml'
        post_mock.return_value = response_mock

        retval = self.ilo._request_ilo('xml-obj')

        post_mock.assert_called_once_with(
            'https://x.x.x.x:443/ribcl',
            headers={"Content-length": '14'},
            data='serialized-xml',
            verify='/somepath')
        response_mock.raise_for_status.assert_called_once_with()
        self.assertEqual('returned-text', retval)
コード例 #8
0
 def __init__(self,
              host,
              login,
              password,
              timeout=60,
              port=443,
              bios_password=None,
              cacert=None):
     self.ribcl = ribcl.RIBCLOperations(host,
                                        login,
                                        password,
                                        timeout,
                                        port,
                                        cacert=cacert)
     self.ris = ris.RISOperations(host,
                                  login,
                                  password,
                                  bios_password=bios_password,
                                  cacert=cacert)
     self.info = {'address': host, 'username': login, 'password': password}
     self.host = host
     self.model = self.ribcl.get_product_name()
     LOG.debug(self._("IloClient object created. "
                      "Model: %(model)s"), {'model': self.model})
コード例 #9
0
 def setUp(self):
     super(IloRibclTestCase, self).setUp()
     self.ilo = ribcl.RIBCLOperations("x.x.x.x", "admin", "Admin", 60, 443)
     self.ilo.init_model_based_tags('ProLiant DL580 Gen8')
コード例 #10
0
 def setUp(self):
     super(IloCommonModuleTestCase, self).setUp()
     self.ribcl = ribcl.RIBCLOperations("x.x.x.x", "admin", "Admin",
                                        60, 443)
コード例 #11
0
 def setUp(self):
     super(IloRibclTestCase, self).setUp()
     self.ilo = ribcl.RIBCLOperations("x.x.x.x", "admin", "Admin", 60, 443)