Beispiel #1
0
    def setUp(self):
        super(BarbicanScenarioTest, self).setUp()
        self.useFixture(
            api_microversion_fixture.APIMicroversionFixture(
                self.request_microversion))
        self.img_file = CONF.scenario.img_file
        if not os.path.exists(self.img_file):
            # TODO(kopecmartin): replace LOG.warning for rasing
            # InvalidConfiguration exception after tempest 25.0.0 is
            # released - there will be one release which accepts both
            # behaviors in order to avoid many failures across CIs and etc.
            LOG.warning(
                'Starting Tempest 25.0.0 release, CONF.scenario.img_file need '
                'a full path for the image. CONF.scenario.img_dir was '
                'deprecated and will be removed in the next release. Till '
                'Tempest 25.0.0, old behavior is maintained and keep working '
                'but starting Tempest 26.0.0, you need to specify the full '
                'path in CONF.scenario.img_file config option.')
            self.img_file = os.path.join(CONF.scenario.img_dir, self.img_file)

        self.private_key = rsa.generate_private_key(public_exponent=65537,
                                                    key_size=3072,
                                                    backend=default_backend())
        self.signing_certificate = self._create_self_signed_certificate(
            self.private_key, u"Test Certificate")
        self.signing_cert_uuid = self._store_cert(self.signing_certificate)
        self.bad_signing_certificate = self._create_self_signed_certificate(
            self.private_key, u"Bad Certificate")
        self.bad_cert_uuid = self._store_cert(self.bad_signing_certificate)
Beispiel #2
0
 def _test_update_flavor(self, bytes_body=False):
     self.useFixture(
         api_microversion_fixture.APIMicroversionFixture('2.55'))
     expected = {"flavor": TestFlavorsClient.FAKE_FLAVOR_UPDATE}
     request = {"flavor": {"description": "updated description"}}
     self.check_service_client_function(
         self.client.update_flavor,
         'tempest.lib.common.rest_client.RestClient.put',
         expected,
         bytes_body,
         flavor_id='8c7aae5a-d315-4216-875b-ed9b6a5bcfc6',
         **request)
    def test_hypervisor_reboot(self, test='hypervisor_reboot'):
        """Test functionality of DPDK and SRIOV after hypervisor reboot

        The test will spawn up an instance and then will
        reboot the hypervisor that holds the test instance.
        After hypervisor boot up, the instance will be started
        and tested for the accessability.
        """
        servers, key_pair = self.create_and_verify_resources(test=test)
        # Ensure that we are using microversion '2.32' from now
        self.useFixture(
            api_microversion_fixture.APIMicroversionFixture('2.32'))
        LOG.info("Locate instance hypervisor")
        srv_hyper_name = self.os_admin.servers_client.show_server(
            servers[0]['id'])['server']['OS-EXT-SRV-ATTR:host']
        srv_on_hyper = self.hypervisor_client.list_servers_on_hypervisor(
            srv_hyper_name)['hypervisors'][0]['servers']
        LOG.info("Shut down the instances and reboot the hypervisor "
                 "the instance resides on")
        # In order the prevent instances file system corruption,
        # shut down the instance.
        for srv in srv_on_hyper:
            self.servers_client.stop_server(srv['uuid'])
            waiters.wait_for_server_status(self.servers_client, srv['uuid'],
                                           'SHUTOFF')
        shell_utils.run_command_over_ssh(servers[0]['hypervisor_ip'],
                                         "sudo reboot")
        # Reboot of the baremetal hypervisor takes time.
        # In order to not confuse the test, look for the hypervisor status
        # "down" and then "up".
        hyper_rebooted = False
        timeout_start = time.time()
        timeout_end = CONF.nfv_plugin_options.hypervisor_wait_timeout
        while time.time() < timeout_start + timeout_end:
            time.sleep(10)
            hyper_state = self.hypervisor_client.search_hypervisor(
                srv_hyper_name)['hypervisors'][0]['state']
            if 'down' in hyper_state:
                hyper_rebooted = True
                continue
            if hyper_rebooted and 'up' in hyper_state:
                break
        LOG.info("Hypervisor has been rebooted. Booting up the instances.")
        for srv in srv_on_hyper:
            self.servers_client.start_server(srv['uuid'])
            waiters.wait_for_server_status(self.servers_client, srv['uuid'],
                                           'ACTIVE')
        LOG.info("Check instances connectivity")
        for srv in servers:
            self.check_instance_connectivity(ip_addr=srv['fip'],
                                             user=self.instance_user,
                                             key_pair=key_pair['private_key'])
        LOG.info("The hypervisor reboot test passed.")
    def setUp(self):
        """Check hypervisor configuration:

        SSH user and Private key/password definition [must].
        External config file exist [not a must].
        """
        super(BareMetalManager, self).setUp()
        self.assertIsNotNone(CONF.nfv_plugin_options.overcloud_node_user,
                             "Missing SSH user login in config")

        if CONF.nfv_plugin_options.overcloud_node_pkey_file:
            key_str = open(
                CONF.nfv_plugin_options.overcloud_node_pkey_file).read()
            CONF.nfv_plugin_options.overcloud_node_pkey_file_rsa = \
                paramiko.RSAKey.from_private_key(StringIO(key_str))
        else:
            self.assertIsNotNone(CONF.nfv_plugin_options.overcloud_node_pass,
                                 'Missing SSH password or key_file')
        if CONF.nfv_plugin_options.external_config_file:
            if os.path.exists(CONF.nfv_plugin_options.external_config_file):
                self.read_external_config_file()

        self.useFixture(
            api_microversion_fixture.APIMicroversionFixture(
                self.request_microversion))

        if CONF.nfv_plugin_options.external_resources_output_file:
            if os.path.exists(
                    CONF.nfv_plugin_options.external_resources_output_file):
                self._read_and_validate_external_resources_data_file()

        if CONF.nfv_plugin_options.quota_cores and \
                CONF.nfv_plugin_options.quota_ram:
            self.os_admin.quotas_client.update_quota_set(
                self.os_primary.tenants_client.tenant_id,
                cores=CONF.nfv_plugin_options.quota_cores,
                ram=CONF.nfv_plugin_options.quota_ram,
                instances=CONF.nfv_plugin_options.quota_instances)
Beispiel #5
0
 def setUp(self):
     super(BaseV2ComputeTest, self).setUp()
     self.useFixture(
         api_microversion_fixture.APIMicroversionFixture(
             self.request_microversion))