def test_pre_scenario_remoteexecution_satellite(self):
        """Run REX job on client registered with Satellite

        :id: preupgrade-3f338475-fa69-43ef-ac86-f00f4d324b33

        :steps:
            1. Create Subnet.
            2. Create Content host.
            3. Install katello-ca package and register to Satellite host.
            4. Add rex ssh_key of Satellite on content host.
            5. Run the REX job on client vm.

        :expectedresults:
            1. It should create with pre-required details.
            2. REX job should run on it.
        """
        try:
            default_loc_id = entities.Location().search(
                query={'search': 'name="{}"'.format(DEFAULT_LOC)})[0].id
            sn = entities.Subnet(
                domain=self.vm_domain,
                gateway=self.gateway,
                ipam='DHCP',
                location=[default_loc_id],
                mask=self.netmask,
                network=self.subnet,
                organization=[self.org.id],
                remote_execution_proxy=[entities.SmartProxy(id=1)],
            ).create()
            client = VirtualMachine(distro=DISTRO_RHEL7,
                                    provisioning_server=self.libvirt_vm,
                                    bridge=self.bridge)
            client.create()
            client.install_katello_ca()
            client.register_contenthost(org=self.org.label, lce='Library')
            add_remote_execution_ssh_key(hostname=client.ip_addr)
            host = entities.Host().search(
                query={'search': 'name="{}"'.format(client.hostname)})
            host[0].subnet = sn
            host[0].update(['subnet'])
            job = entities.JobInvocation().run(
                data={
                    'job_template_id': 89,
                    'inputs': {
                        'command': "ls"
                    },
                    'targeting_type': 'static_query',
                    'search_query': "name = {0}".format(client.hostname)
                })
            self.assertEqual(job['output']['success_count'], 1)
            global_dict = {
                self.__class__.__name__: {
                    'client_name': client.hostname
                }
            }
            create_dict(global_dict)
        except Exception as exp:
            if client._created:
                self._vm_cleanup(hostname=client.hostname)
            raise Exception(exp)
示例#2
0
    def test_pre_repository_scenario_upstream_authorization(self):
        """Create a custom repository and set the upstream username on it.

        :id: preupgrade-11c5ceee-bfe0-4ce9-8f7b-67a835baf522

        :steps:
            1. Create a custom repository and sync it.
            2. Set the upstream username on same repository using foreman-rake.

        :expectedresults:
            1. Upstream username should be set on repository.

        :BZ: 1641785
        """

        org = entities.Organization().create()
        custom_repo = create_sync_custom_repo(org_id=org.id)
        rake_repo = f'repo = Katello::Repository.find_by_id({custom_repo})'
        rake_username = f'; repo.root.upstream_username = "******"'
        rake_repo_save = '; repo.save!(validate: false)'
        result = run(
            f"echo '{rake_repo}{rake_username}{rake_repo_save}'|foreman-rake console"
        )
        assert 'true' in result

        global_dict = {self.__class__.__name__: {'repo_id': custom_repo}}
        create_dict(global_dict)
示例#3
0
    def test_pre_version_cv_export_import(self):
        """Create Content view and publish promote it

        :id: preupgrade-f19e4928-94db-4df6-8ce8-b5e4afe34258

        :steps:

        1. Before upgrade, Create a ContentView
        2. Publish and promote the Content View

        :expectedresults: content view should be published and promoted
        """
        exporting_cv_name = gen_string('alphanumeric')
        exporting_prod_name = gen_string('alphanumeric')
        exporting_repo_name = gen_string('alphanumeric')
        org = entities.Organization().create()
        product = entities.Product(organization=org, name=exporting_prod_name).create()
        repo = entities.Repository(
            product=product, name=exporting_repo_name,
            mirror_on_sync=False, download_policy='immediate').create()
        repo.sync()
        cv = entities.ContentView(name=exporting_cv_name, organization=org).create()
        cv.repository = [repo]
        cv.update(['repository'])
        cv.publish()
        cv = cv.read()
        self.assertTrue(cv.version[0].read().package_count > 0)
        scenario_facts = {self.__class__.__name__: {
            'exporting_orgid': org.id,
            'exporting_cvname': exporting_cv_name,
            'exporting_prodname': exporting_prod_name,
            'exporting_reponame': exporting_repo_name}}
        create_dict(scenario_facts)
 def setupScenario(self):
     """Import some parametrized puppet classes. This is required to make
     sure that we have smart class variable available.
     Read all available smart class parameters for imported puppet class to
     be able to work with unique entity for each specific test.
     """
     self.puppet_modules = [
         {'author': 'robottelo', 'name': 'api_test_classparameters'},
     ]
     self.org = entities.Organization().create()
     cv = publish_puppet_module(
         self.puppet_modules, CUSTOM_PUPPET_REPO, self.org)
     self.env = entities.Environment().search(
         query={'search': u'content_view="{0}"'.format(cv.name)}
     )[0].read()
     self.puppet_class = entities.PuppetClass().search(query={
         'search': u'name = "{0}" and environment = "{1}"'.format(
             self.puppet_modules[0]['name'], self.env.name)
     })[0]
     self.sc_params_list = entities.SmartClassParameters().search(
         query={
             'search': 'puppetclass="{0}"'.format(self.puppet_class.name),
             'per_page': 1000
         })
     scenario_ents = {self.__class__.__name__: {
         'puppet_class': self.puppet_class.name}}
     create_dict(scenario_ents)
示例#5
0
    def test_pre_sync_plan_migration(self):
        """Pre-upgrade scenario that creates sync plan and assigns repo to sync plan

        :id: badaeec2-d42f-41d5-bd85-4b23d6d5a724

        :steps:
            1. Create Product and Repository
            2. Create Sync Plan
            3. Assign sync plan to product and sync the repo

        :expectedresults: Run sync plan create, get, assign and verify it should pass

         """
        org = entities.Organization().create()
        sync_plan_name = "Test_Sync_plan_Migration_{0}".format(gen_string('alpha'))
        sync_plan = entities.SyncPlan(
            organization=org,
            name=sync_plan_name).create()
        product = entities.Product(organization=org).create()
        entities.Repository(product=product).create()
        sync_plan.add_products(data={'product_ids': [product.id]})
        product.sync()
        product = product.read()
        self.assertEqual(product.sync_plan.id, sync_plan.id)
        sync_plan = sync_plan.read()
        scenario_dict = {self.__class__.__name__: {
            'sync_plan_name': sync_plan_name,
            'interval': sync_plan.interval,
            'sync_date': sync_plan.sync_date,
            'product_id': product.id,
            'sync_plan_id': sync_plan.id,
            'org_id': org.id
        }}
        create_dict(scenario_dict)
示例#6
0
    def test_pre_user_scenario_capsule_sync(self):
        """Pre-upgrade scenario that creates and sync repository with
        rpm in satellite which will be synced in post upgrade scenario.


        :id: preupgrade-eb8970fa-98cc-4a99-99fb-1c12c4e319c9

        :steps:
            1. Before Satellite upgrade, Sync a repo/rpm in satellite

        :expectedresults: The repo/rpm should be synced to satellite

         """
        ak = entities.ActivationKey(organization=self.org_id).search(
            query={'search': 'name={}'.format(self.activation_key)})[0]
        ak_env = ak.environment.read()
        product = entities.Product(name=self.prod_name,
                                   organization=self.org_id).create()
        create_repo(rpm1, self.repo_path)
        repo = entities.Repository(product=product.id,
                                   name=self.repo_name,
                                   url=self.repo_url).create()
        repo.sync()
        content_view = entities.ContentView(name=self.cv_name,
                                            organization=self.org_id).create()
        content_view.repository = [repo]
        content_view = content_view.update(['repository'])
        content_view.publish()
        promote(content_view.read().version[0], ak_env.id)
        self.assertEqual(content_view.read().environment[-1].id, ak_env.id)

        global_dict = {self.__class__.__name__: {'env_name': ak_env.name}}
        create_dict(global_dict)
示例#7
0
    def test_pre_repository_scenario_upstream_authorization(self):
        """ Create a custom repository and set the upstream username on it.

        :id: preupgrade-11c5ceee-bfe0-4ce9-8f7b-67a835baf522

        :steps:
            1. Create a custom repository and sync it.
            2. Set the upstream username on same repository using foreman-rake.

        :expectedresults:
            1. Upstream username should be set on repository.

        :BZ: 1641785
        """

        org = entities.Organization().create()
        custom_repo = create_sync_custom_repo(org_id=org.id)
        rake_repo = 'repo = Katello::Repository.find_by_id({0})'.format(
            custom_repo)
        rake_username = '******'.format(
            self.upstream_username)
        rake_repo_save = '; repo.save!(validate: false)'
        result = run("echo '{0}{1}{2}'|foreman-rake console".format(
            rake_repo, rake_username, rake_repo_save))
        self.assertIn('true', result)

        global_dict = {self.__class__.__name__: {'repo_id': custom_repo}}
        create_dict(global_dict)
示例#8
0
 def setupScenario(self):
     """Import some parametrized puppet classes. This is required to make
     sure that we have smart class variable available.
     Read all available smart class parameters for imported puppet class to
     be able to work with unique entity for each specific test.
     """
     self.puppet_modules = [{
         'author': 'robottelo',
         'name': 'api_test_classparameters'
     }]
     self.org = entities.Organization().create()
     cv = publish_puppet_module(self.puppet_modules, CUSTOM_PUPPET_REPO,
                                self.org)
     self.env = (entities.Environment().search(
         query={'search': 'content_view="{0}"'.format(cv.name)})[0].read())
     self.puppet_class = entities.PuppetClass().search(
         query={
             'search':
             'name = "{0}" and environment = "{1}"'.format(
                 self.puppet_modules[0]['name'], self.env.name)
         })[0]
     self.sc_params_list = entities.SmartClassParameters().search(
         query={
             'search': 'puppetclass="{0}"'.format(self.puppet_class.name),
             'per_page': 1000
         })
     scenario_ents = {
         self.__class__.__name__: {
             'puppet_class': self.puppet_class.name
         }
     }
     create_dict(scenario_ents)
示例#9
0
    def test_pre_user_scenario_capsule_sync(self):
        """Pre-upgrade scenario that creates and sync repository with
        rpm in satellite which will be synced in post upgrade scenario.


        :id: preupgrade-eb8970fa-98cc-4a99-99fb-1c12c4e319c9

        :steps:
            1. Before Satellite upgrade, Sync a repo/rpm in satellite

        :expectedresults: The repo/rpm should be synced to satellite

         """
        ak = entities.ActivationKey(organization=self.org_id).search(
            query={'search': 'name={}'.format(self.activation_key)})[0]
        ak_env = ak.environment.read()
        product = entities.Product(
            name=self.prod_name, organization=self.org_id).create()
        self.create_repo()
        repo = entities.Repository(
            product=product.id, name=self.repo_name,
            url=self.repo_url).create()
        repo.sync()
        content_view = entities.ContentView(
            name=self.cv_name, organization=self.org_id).create()
        content_view.repository = [repo]
        content_view = content_view.update(['repository'])
        content_view.publish()
        promote(content_view.read().version[0], ak_env.id)
        self.assertEqual(content_view.read().environment[-1].id, ak_env.id)

        global_dict = {self.__class__.__name__: {
            'env_name': ak_env.name}}
        create_dict(global_dict)
示例#10
0
    def test_pre_scenario_yum_plugins_count(self):
        """Create content host and register with Satellite.

        :id: preupgrade-45241ada-c2c4-409e-a6e2-92c2cf0ac16c

        :steps:

            1. Before Satellite upgrade.
            2. Create LifecycleEnvironment.
            3. Enable/sync 'base os RHEL7' and tools repos.
            4. Create 'Content View' and activation key.
            5. Create a content host, register and install katello-agent on it.

        :expectedresults:

            1. The content host is created.
            2. katello-agent install and goferd run.
        """
        environment = entities.LifecycleEnvironment(
            organization=self.org).search(query={'search': 'name=Library'})[0]
        repos = self._get_rh_rhel_tools_repos()
        content_view = publish_content_view(org=self.org, repolist=repos)
        ak = entities.ActivationKey(content_view=content_view,
                                    organization=self.org.id,
                                    environment=environment).create()

        rhel7_client = dockerize(ak_name=ak.name,
                                 distro='rhel7',
                                 org_label=self.org.label)
        client_container_id = [value for value in rhel7_client.values()][0]
        wait_for(
            lambda: self.org.label in execute(
                docker_execute_command,
                client_container_id,
                'subscription-manager identity',
                host=self.docker_vm,
            )[self.docker_vm],
            timeout=800,
            delay=2,
            logger=self.logger,
        )
        status = execute(
            docker_execute_command,
            client_container_id,
            'subscription-manager identity',
            host=self.docker_vm,
        )[self.docker_vm]
        self.assertIn(self.org.label, status)

        install_or_update_package(client_hostname=client_container_id,
                                  package="katello-agent")
        run_goferd(client_hostname=client_container_id)

        scenario_dict = {
            self.__class__.__name__: {
                'rhel_client': rhel7_client,
                'cv_id': content_view.id
            }
        }
        create_dict(scenario_dict)
示例#11
0
    def test_pre_repository_scenario_upstream_authorization(self):
        """ Create a custom repository and set the upstream username on it.

        :id: preupgrade-11c5ceee-bfe0-4ce9-8f7b-67a835baf522

        :steps:
            1. Create a custom repository and sync it.
            2. Set the upstream username on same repository using foreman-rake.

        :expectedresults:
            1. Upstream username should be set on repository.

        :BZ: 1641785
        """

        org = entities.Organization().create()
        custom_repo = create_sync_custom_repo(org_id=org.id)
        rake_repo = 'repo = Katello::Repository.find_by_id({0})'.format(custom_repo)
        rake_username = '******'.format(self.upstream_username)
        rake_repo_save = '; repo.save!(validate: false)'
        result = run("echo '{0}{1}{2}'|foreman-rake console".format(rake_repo, rake_username,
                                                                    rake_repo_save))
        self.assertIn('true', result)

        global_dict = {
            self.__class__.__name__: {'repo_id': custom_repo}
        }
        create_dict(global_dict)
示例#12
0
    def test_pre_subscription_scenario_autoattach(self):
        """Create content host and register with Satellite

        :id: preupgrade-940fc78c-ffa6-4d9a-9c4b-efa1b9480a22

        :steps:
            1. Before Satellite upgrade.
            2. Create new Organization and Location
            3. Upload a manifest in it.
            4. Create a AK with 'auto-attach False' and without Subscription add in it.
            5. Create a content host.
            6. Update content host location.

        :expectedresults:
            1. Content host should be created.
            2. Content host location should be updated.
        """
        org = entities.Organization().create()
        loc = entities.Location(organization=[org]).create()
        manifests.upload_manifest_locked(org.id,
                                         interface=manifests.INTERFACE_API)
        act_key = entities.ActivationKey(auto_attach=False,
                                         organization=org.id,
                                         environment=org.library.id).create()
        rhel7_client = dockerize(ak_name=act_key.name,
                                 distro='rhel7',
                                 org_label=org.label)
        client_container_id = [value for value in rhel7_client.values()][0]
        client_container_name = [key for key in rhel7_client.keys()][0]
        host_location_update(client_container_name=client_container_name,
                             logger_obj=self.logger,
                             loc=loc)

        wait_for(
            lambda: org.name in execute(
                docker_execute_command,
                client_container_id,
                'subscription-manager identity',
                host=self.docker_vm,
            )[self.docker_vm],
            timeout=100,
            delay=2,
            logger=self.logger,
        )
        status = execute(
            docker_execute_command,
            client_container_id,
            'subscription-manager identity',
            host=self.docker_vm,
        )[self.docker_vm]
        self.assertIn(org.name, status)

        global_dict = {
            self.__class__.__name__: {
                'client_container_id': client_container_id
            }
        }
        create_dict(global_dict)
示例#13
0
    def test_pre_scenario_preclient_package_installation(
            default_org, pre_upgrade_cv, pre_upgrade_repo, module_ak):
        """Create product and repo, from which a package will be installed
        post upgrade. Create a content host and register it.

        :id: preupgrade-eedab638-fdc9-41fa-bc81-75dd2790f7be

        :setup:

            1. Create and sync repo from which a package can be
                installed on content host
            2. Add repo to CV and then to Activation key


        :steps:

            1. Create a container as content host and register with Activation key

        :expectedresults:

            1. The "pre-upgrade" content host is created and registered.
            2. The new repo is enabled on the content host.

        """
        rhel7_client = dockerize(ak_name=module_ak.name,
                                 distro='rhel7',
                                 org_label=default_org.label)
        client_container_id = list(rhel7_client.values())[0]
        # Wait 60 seconds as script in /tmp takes up to 2 min inc the repo sync time
        time.sleep(60)
        # Use yum install again in case script was not yet finished
        installed_package = execute(
            docker_execute_command,
            client_container_id,
            'yum -y install katello-agent',
            host=docker_vm,
        )[docker_vm]
        # Assert gofer was installed after yum completes
        installed_package = execute(
            docker_execute_command,
            client_container_id,
            'rpm -q gofer',
            host=docker_vm,
        )[docker_vm]
        assert 'package gofer is not installed' not in installed_package
        # Run goferd on client as its docker container
        kwargs = {'async': True, 'host': docker_vm}
        execute(docker_execute_command, client_container_id, 'goferd -f',
                **kwargs)
        # Holding on for 30 seconds while goferd starts
        time.sleep(30)
        status = execute(docker_execute_command,
                         client_container_id,
                         'ps -aux',
                         host=docker_vm)[docker_vm]
        assert 'goferd' in status
        # Save client info to disk for post-upgrade test
        create_dict({__name__: rhel7_client})
示例#14
0
    def test_pre_scenario_remoteexecution_external_capsule(
            self, request, default_location, rhel7_contenthost):
        """Run REX job on client registered with external capsule

        :id: preupgrade-261dd2aa-be01-4c34-b877-54b8ee346561

        :steps:
            1. Create Subnet.
            2. Create Content host.
            3. Install katello-ca package and register to Satellite host.
            4. add rex ssh_key of external capsule on content host.
            5. run the REX job on client vm.

        :expectedresults:
            1. Content host should create with pre-required details.
            2. REX job should run on it.

        :parametrized: yes
        """
        sn = entities.Subnet(
            domain=self.vm_domain,
            gateway=self.gateway,
            ipam='DHCP',
            location=[default_location.id],
            mask=self.netmask,
            network=self.subnet,
            organization=[self.org.id],
            remote_execution_proxy=[entities.SmartProxy(id=2)],
        ).create()
        rhel7_contenthost.install_capsule_katello_ca(capsule=self.proxy_name)
        rhel7_contenthost.register_contenthost(org=self.org.label,
                                               lce='Library')
        capsule = Capsule(self.proxy_name)
        rhel7_contenthost.add_rex_key(satellite=capsule)
        host = entities.Host().search(
            query={'search': f'name="{rhel7_contenthost.hostname}"'})
        host[0].subnet = sn
        host[0].update(['subnet'])
        job = entities.JobInvocation().run(
            data={
                'job_template_id': 89,
                'inputs': {
                    'command': 'ls'
                },
                'targeting_type': 'static_query',
                'search_query': f'name = {rhel7_contenthost.hostname}',
            })
        assert job['output']['success_count'] == 1
        global_dict = {
            self.__class__.__name__: {
                'client_name': rhel7_contenthost.hostname
            }
        }
        create_dict(global_dict)
示例#15
0
    def test_pre_scenario_remoteexecution_satellite(self, request,
                                                    compute_resource_setup,
                                                    default_location,
                                                    rhel7_contenthost,
                                                    default_sat):
        """Run REX job on client registered with Satellite

        :id: preupgrade-3f338475-fa69-43ef-ac86-f00f4d324b33

        :steps:
            1. Create Subnet.
            2. Create Content host.
            3. Install katello-ca package and register to Satellite host.
            4. Add rex ssh_key of Satellite on content host.
            5. Run the REX job on client vm.

        :expectedresults:
            1. It should create with pre-required details.
            2. REX job should run on it.

        :parametrized: yes
        """
        sn = entities.Subnet(
            domain=self.vm_domain,
            gateway=self.gateway,
            ipam='DHCP',
            location=[default_location.id],
            mask=self.netmask,
            network=self.subnet,
            organization=[self.org.id],
            remote_execution_proxy=[entities.SmartProxy(id=1)],
        ).create()
        rhel7_contenthost.configure_rex(satellite=default_sat,
                                        org=self.org,
                                        by_ip=False)
        host = rhel7_contenthost.nailgun_host
        host[0].subnet = sn
        host[0].update(['subnet'])
        job = entities.JobInvocation().run(
            data={
                'job_template_id': 89,
                'inputs': {
                    'command': 'ls'
                },
                'targeting_type': 'static_query',
                'search_query': f'name = {rhel7_contenthost.hostname}',
            })
        assert job['output']['success_count'] == 1
        global_dict = {
            self.__class__.__name__: {
                'client_name': rhel7_contenthost.hostname
            }
        }
        create_dict(global_dict)
示例#16
0
    def test_pre_scenario_remoteexecution_external_capsule(self):
        """Run REX job on client registered with external capsule

        :id: preupgrade-261dd2aa-be01-4c34-b877-54b8ee346561

        :steps:
            1. Create Subnet.
            2. Create Content host.
            3. Install katello-ca package and register to Satellite host.
            4. add rex ssh_key of external capsule on content host.
            5. run the REX job on client vm.

        :expectedresults:
            1. Content host should create with pre-required details.
            2. REX job should run on it.
        """
        try:
            sn = entities.Subnet(
                domain=self.vm_domain,
                gateway=self.gateway,
                ipam='DHCP',
                location=[DEFAULT_LOC_ID],
                mask=self.netmask,
                network=self.subnet,
                organization=[self.org.id],
                remote_execution_proxy=[entities.SmartProxy(id=2)],
            ).create()
            client = VirtualMachine(
                distro=DISTRO_RHEL7,
                provisioning_server=self.libvirt_vm,
                bridge=self.bridge)
            client.create()
            client.install_capsule_katello_ca(capsule=self.proxy_name)
            client.register_contenthost(org=self.org.label, lce='Library')
            add_remote_execution_ssh_key(hostname=client.ip_addr,
                                         proxy_hostname=self.proxy_name)
            host = entities.Host().search(
                query={'search': 'name="{}"'.format(client.hostname)})
            host[0].subnet = sn
            host[0].update(['subnet'])
            job = entities.JobInvocation().run(data={
                'job_template_id': 89, 'inputs': {'command': "ls"},
                'targeting_type': 'static_query', 'search_query': "name = {0}"
                .format(client.hostname)})
            self.assertEqual(job['output']['success_count'], 1)
            global_dict = {
                self.__class__.__name__: {'client_name': client.hostname}
            }
            create_dict(global_dict)
        except Exception as exp:
            if client._created:
                self._vm_cleanup(hostname=client.hostname)
            raise Exception(exp)
示例#17
0
    def test_pre_scenario_yum_plugins_count(self):
        """Create content host and register with Satellite.

        :id: preupgrade-45241ada-c2c4-409e-a6e2-92c2cf0ac16c

        :steps:

            1. Before Satellite upgrade.
            2. Create new Organization and Location.
            3. Create Product, custom tools, rhel repos and sync them.
            4. Create activation key and add subscription.
            5. Create a content host, register and install katello-agent on it.

        :expectedresults:

            1. The content host is created.
            2. katello-agent install and goferd run.
        """
        org = entities.Organization().create()
        loc = entities.Location(organization=[org]).create()

        environment = entities.LifecycleEnvironment(organization=org
                                                    ).search(query={'search': 'name=Library'})[0]
        product = entities.Product(organization=org).create()
        tools_repo, rhel_repo = self._create_custom_rhel_tools_repos(product)
        product.sync()
        repolist = [tools_repo, rhel_repo]
        content_view = self._publish_content_view(org=org, repolist=repolist)

        ak = entities.ActivationKey(content_view=content_view, organization=org.id,
                                    environment=environment).create()
        subscription = entities.Subscription(organization=org).search(query={
            'search': 'name={}'.format(product.name)})[0]

        ak.add_subscriptions(data={'subscription_id': subscription.id})
        rhel7_client = dockerize(ak_name=ak.name, distro='rhel7', org_label=org.label)
        client_container_id = [value for value in rhel7_client.values()][0]
        client_container_name = [key for key in rhel7_client.keys()][0]
        self._host_location_update(client_container_name=client_container_name, loc=loc)

        status = execute(docker_execute_command, client_container_id,
                         'subscription-manager identity', host=self.docker_vm)[self.docker_vm]
        self.assertIn(org.name, status)

        self._install_or_update_package(client_container_id, 'katello-agent')
        self._run_goferd(client_container_id)

        scenario_dict = {self.__class__.__name__: {
            'rhel_client': rhel7_client,
            'product_id': product.id,
            'conten_view_id': content_view.id
        }}
        create_dict(scenario_dict)
示例#18
0
    def test_pre_user_scenario_capsule_sync(self):
        """Pre-upgrade scenario that creates and sync repository with
        rpm in satellite which will be synced in post upgrade scenario.


        :id: preupgrade-eb8970fa-98cc-4a99-99fb-1c12c4e319c9

        :steps:
            1. Before Satellite upgrade, Sync a repo/rpm in satellite

        :expectedresults: The repo/rpm should be synced to satellite

         """
        _, env_name = hammer.hammer_determine_cv_and_env_from_ak(
            self.activation_key, '1')
        self.create_repo()
        print(hammer.hammer_product_create(self.prod_name, self.org_id))
        prod_list = hammer.hammer('product list --organization-id {}'.format(
            self.org_id))
        self.assertEqual(
            self.prod_name,
            hammer.get_attribute_value(prod_list, self.prod_name, 'name'))
        print(
            hammer.hammer_repository_create(self.repo_name, self.org_id,
                                            self.prod_name, self.repo_url))
        repo_list = hammer.hammer(
            'repository list --product {0} --organization-id {1}'.format(
                self.prod_name, self.org_id))
        self.assertEqual(
            self.repo_name,
            hammer.get_attribute_value(repo_list, self.repo_name, 'name'))
        print(
            hammer.hammer_repository_synchronize(self.repo_name, self.org_id,
                                                 self.prod_name))
        print(hammer.hammer_content_view_create(self.cv_name, self.org_id))
        print(
            hammer.hammer_content_view_add_repository(self.cv_name,
                                                      self.org_id,
                                                      self.prod_name,
                                                      self.repo_name))
        print(hammer.hammer_content_view_publish(self.cv_name, self.org_id))
        cv_ver = hammer.get_latest_cv_version(self.cv_name)
        env_data = hammer.hammer(
            'lifecycle-environment list --organization-id {0} '
            '--name {1}'.format(self.org_id, env_name))
        env_id = hammer.get_attribute_value(env_data, env_name, 'id')
        print(
            hammer.hammer_content_view_promote_version(self.cv_name, cv_ver,
                                                       env_id, self.org_id))
        global_dict = {self.__class__.__name__: {'env_name': env_name}}
        create_dict(global_dict)
示例#19
0
    def test_pre_create_gce_cr_and_host(self, arch_os_domain, function_org,
                                        gce_cert):
        """Create GCE Compute Resource

        :id: preupgrade-ef82143d-efef-49b2-9702-93d67ef6804c

        :steps: In Preupgrade Satellite, create GCE Compute Resource

        :expectedresults: The GCE CR created successfully
        """
        arch, os, domain_name = arch_os_domain
        cr_name = gen_string('alpha')
        loc = entities.Location().create()
        with Session('gce_upgrade_tests') as session:
            # Compute Resource Create and Assertions
            session.computeresource.create({
                'name':
                cr_name,
                'provider':
                FOREMAN_PROVIDERS['google'],
                'provider_content.google_project_id':
                gce_cert['project_id'],
                'provider_content.client_email':
                gce_cert['client_email'],
                'provider_content.certificate_path':
                settings.gce.cert_path,
                'provider_content.zone.value':
                settings.gce.zone,
                'organizations.resources.assigned': [function_org.name],
                'locations.resources.assigned': [loc.name],
            })
        gce_cr = entities.AbstractComputeResource().search(
            query={'search': f'name={cr_name}'})[0]
        gce_img = entities.Image(
            architecture=arch,
            compute_resource=gce_cr,
            name='autoupgrade_gce_img',
            operatingsystem=os,
            username='******',
            uuid=LATEST_RHEL7_GCE_IMG_UUID,
        ).create()
        create_dict({
            self.__class__.__name__: {
                'org': function_org.name,
                'loc': loc.name,
                'cr_name': cr_name,
            }
        })
        assert gce_cr.name == cr_name
        assert gce_img.name == 'autoupgrade_gce_img'
示例#20
0
    def test_pre_scenario_preclient_package_installation(self):
        """Create product and repo from which the package will be installed
        post upgrade

        :id: preupgrade-eedab638-fdc9-41fa-bc81-75dd2790f7be

        :steps:

            1. Create a content host with existing client ak
            2. Create and sync repo from which the package will be
                installed on content host
            3. Add repo to CV and then in Activation key

        :expectedresults:

            1. The content host is created
            2. The new repo and its product has been added to ak using which
                the content host is created

        """
        rhel7_client = dockerize(distro='rhel7')
        product = entities.Product(
            name='preclient_scenario_product',
            organization=1,
        ).create()
        yum_repo = entities.Repository(
            name='preclient_scenario_repo', product=product
        ).create()
        yum_repo.sync()
        self.cv.repository = [yum_repo]
        cv = self.cv.update(['repository'])
        cv.publish()
        cv = cv.read()  # Published CV with new version
        # Promote CV
        environment = entities.ActivationKey().search(
            query={'search': 'name={}'.format(self.ak)}
        )[0].environment
        cvv = entities.ContentViewVersion(
            id=max([cvv.id for cvv in cv.version])
        ).read()
        cvv.promote(
            data={
                u'environment_id': environment.id,
                u'force': False
            }
        )
        create_dict(
            {self.__class__.__name__: rhel7_client}
        )
示例#21
0
 def test_pre_create_gce_cr_and_host(self):
     """
     """
     cr_name = gen_string('alpha')
     org = entities.Organization().create()
     loc = entities.Location().create()
     with Session('gce_upgrade_tests') as session:
         # Compute Resource Create and Assertions
         session.computeresource.create({
             'name':
             cr_name,
             'provider':
             FOREMAN_PROVIDERS['google'],
             'provider_content.google_project_id':
             GCE_SETTINGS['project_id'],
             'provider_content.client_email':
             GCE_SETTINGS['client_email'],
             'provider_content.certificate_path':
             GCE_SETTINGS['cert_path'],
             'provider_content.zone.value':
             GCE_SETTINGS['zone'],
             'organizations.resources.assigned': [org.name],
             'locations.resources.assigned': [loc.name],
         })
     gce_cr = entities.AbstractComputeResource().search(
         query={'search': 'name={}'.format(cr_name)})[0]
     gce_img = entities.Image(
         architecture=self.arch,
         compute_resource=gce_cr,
         name='autoupgrade_gce_img',
         operatingsystem=self.os,
         username='******',
         uuid=LATEST_RHEL7_GCE_IMG_UUID,
     ).create()
     create_dict({
         self.__class__.__name__: {
             'org': org.name,
             'loc': loc.name,
             'cr_name': cr_name
         }
     })
     assert gce_cr.name == cr_name
     assert gce_img.name == 'autoupgrade_gce_img'
示例#22
0
    def test_pre_sync_plan_migration(self):
        """Pre-upgrade scenario that creates sync plan and assigns repo to sync plan

        :id: badaeec2-d42f-41d5-bd85-4b23d6d5a724

        :steps:
            1. Create Product and Repository
            2. Create Sync Plan
            3. Assign sync plan to product and sync the repo

        :expectedresults: Run sync plan create, get, assign and verify it should pass

        """
        org = entities.Organization().create()
        sync_plan_name = "Test_Sync_plan_Migration_{}".format(
            gen_string('alpha'))
        sync_plan = entities.SyncPlan(organization=org,
                                      name=sync_plan_name).create()
        product = entities.Product(organization=org).create()
        entities.Repository(product=product).create()
        sync_plan.add_products(data={'product_ids': [product.id]})
        product.sync()
        product = product.read()
        self.assertEqual(product.sync_plan.id, sync_plan.id)
        sync_plan = sync_plan.read()
        scenario_dict = {
            self.__class__.__name__: {
                'sync_plan_name': sync_plan_name,
                'interval': sync_plan.interval,
                'sync_date': sync_plan.sync_date,
                'product_id': product.id,
                'sync_plan_id': sync_plan.id,
                'org_id': org.id,
            }
        }
        create_dict(scenario_dict)
示例#23
0
 def _setup_scenario(self, default_sat):
     """Import some parametrized puppet classes. This is required to make
     sure that we have smart class variable available.
     Read all available smart class parameters for imported puppet class to
     be able to work with unique entity for each specific test.
     """
     self.org = entities.Organization().create()
     repo = 'api_test_classparameters'
     env_name = default_sat.create_custom_environment(repo=repo)
     self.puppet_class = entities.PuppetClass().search(
         query={
             'search': f'name = "{repo}" and environment = "{env_name}"'
         })[0]
     self.sc_params_list = entities.SmartClassParameters().search(
         query={
             'search': f'puppetclass="{self.puppet_class.name}"',
             'per_page': 1000
         })
     scenario_ents = {
         self.__class__.__name__: {
             'puppet_class': self.puppet_class.name
         }
     }
     create_dict(scenario_ents)
    def test_pre_scenario_preclient_package_installation(self):
        """Create product and repo from which the package will be installed
        post upgrade

        :id: preupgrade-eedab638-fdc9-41fa-bc81-75dd2790f7be

        :steps:

            1. Create a content host with existing client ak
            2. Create and sync repo from which the package will be
                installed on content host
            3. Add repo to CV and then in Activation key

        :expectedresults:

            1. The content host is created
            2. The new repo and its product has been added to ak using which
                the content host is created

        """
        prior_env = entities.LifecycleEnvironment(
            organization=self.org
        ).search(query={'search': 'name=Library'})[0]
        environment = entities.LifecycleEnvironment(
            organization=self.org,
            prior=prior_env.id,
            label=self.le_lable,
            name=self.le_name
        ).create()
        ak = create_activation_key_for_client_registration(
            ak_name=self.ak_name,
            client_os='rhel7',
            org=self.org,
            environment=environment,
            sat_state='pre'
        )
        rhel7_client = dockerize(
            ak_name=ak.name, distro='rhel7', org_label=self.org.label)
        client_container_id = rhel7_client.values()[0]
        client_name = rhel7_client.keys()[0]
        product, yum_repo = create_yum_test_repo(
            product_name=self.prod_name, repo_url=FAKE_REPO_ZOO3, org=self.org)
        update_product_subscription_in_ak(
            product=product, yum_repo=yum_repo, ak=ak, org=self.org)
        time.sleep(30)
        execute(
            attach_subscription_to_host_from_satellite,
            self.org.id,
            product.name,
            client_name,
            host=get_satellite_host()
        )
        # Refresh subscriptions on client
        execute(
            docker_execute_command,
            client_container_id,
            'subscription-manager refresh',
            host=self.docker_vm
        )
        # Run goferd on client as its docker container
        execute(
            docker_execute_command,
            client_container_id,
            'goferd -f',
            async=True,
            host=self.docker_vm
        )
        create_dict(
            {self.__class__.__name__: rhel7_client}
        )
    def test_pre_scenario_containers_support_removal(self):
        """Pre-upgrade scenario test to verify containers created and run
        before upgrade

        :id: preupgrade-f6de07ae-14c7-4452-9cb1-cafe2aa648ae

        :steps:

            1. Create docker host
            2. Create and run container from dockerhub
            3. Create and run container from external registry

        :expectedresults:

            1. Docker host is created
            2. Container from dockerhub is created and running
            3. Container from external registry is created and running

        """
        rh_registry_available = not bz_bug_is_open(1703397)
        repo_name = 'rhel'
        compute_resource_name = gen_string('alpha')
        registry_url = settings.docker.external_registry_1

        org = entities.Organization().create()

        docker_host = VirtualMachine(source_image=settings.docker.docker_image,
                                     tag=u'docker')
        docker_host.create()
        try:
            docker_host.install_katello_ca()

            compute_resource = entities.DockerComputeResource(
                name=compute_resource_name,
                organization=[org],
                url='http://{0}:2375'.format(docker_host.ip_addr),
            ).create()

            # Only one registry with given URL can exist on Satellite,
            # so search for it first and create it only if necessary
            try:
                registry = entities.Registry().search(
                    filters={'url': registry_url})[0]
            except IndexError:
                registry = entities.Registry(
                    url=registry_url,
                    organization=[org],
                ).create()

            # container from dockerhub
            dockerhub_container = entities.DockerHubContainer(
                command='sleep inf',
                compute_resource=compute_resource,
                organization=[org],
            ).create()
            self.assertEqual(dockerhub_container.compute_resource.id,
                             compute_resource.id)

            # container from external registry
            if rh_registry_available:
                external_container = entities.DockerRegistryContainer(
                    command='sleep inf',
                    compute_resource=compute_resource,
                    organization=[org],
                    registry=registry,
                    repository_name=repo_name,
                ).create()
                self.assertEqual(external_container.compute_resource.id,
                                 compute_resource.id)
                self.assertEqual(external_container.registry.id, registry.id)
                self.assertEqual(external_container.repository_name, repo_name)

            running_containers = docker_host.run('docker ps')
            self.assertEqual(running_containers.return_code, 0)

            self.assertTrue(
                any(dockerhub_container.name in line
                    for line in running_containers.stdout))
            if rh_registry_available:
                self.assertTrue(
                    any(external_container.name in line
                        for line in running_containers.stdout))

            ext_container_name = external_container.name if rh_registry_available else ''

            scenario_dict = {
                self.__class__.__name__: {
                    'rh_registry_available': rh_registry_available,
                    'docker_host': docker_host.hostname,
                    'dockerhub_container': dockerhub_container.name,
                    'external_container': ext_container_name,
                }
            }
            create_dict(scenario_dict)
        except Exception as exp:
            self._vm_cleanup(hostname=docker_host.hostname)
            raise Exception(exp)
示例#26
0
    def test_pre_scenario_custom_repo_check(self, default_sat):
        """This is pre-upgrade scenario test to verify if we can create a
         custom repository and consume it via content host.

        :id: preupgrade-eb6831b1-c5b6-4941-a325-994a09467478

        :steps:
            1. Before Satellite upgrade.
            2. Create new Organization, Location.
            3. Create Product, custom repo, cv.
            4. Create activation key and add subscription.
            5. Create a content host, register and install package on it.

        :expectedresults:

            1. Custom repo is created.
            2. Package is installed on Content host.

        """
        org = default_sat.api.Organization().create()
        loc = default_sat.api.Location(organization=[org]).create()
        lce = default_sat.api.LifecycleEnvironment(organization=org).create()

        product = default_sat.api.Product(organization=org).create()
        create_repo(rpm1, FILE_PATH)
        repo = default_sat.api.Repository(
            product=product.id,
            url=f'{default_sat.url}/pub/custom_repo').create()
        repo.sync()

        content_view = publish_content_view(org=org, repolist=repo)
        promote(content_view.version[0], lce.id)

        result = default_sat.execute(
            f'ls /var/lib/pulp/published/yum/https/repos/{org.label}/{lce.name}/'
            f'{content_view.label}/custom/{product.label}/{repo.label}/Packages/b/'
            f'|grep {RPM1_NAME}')

        assert result.status == 0
        assert len(result.stdout) >= 1

        subscription = default_sat.api.Subscription(organization=org).search(
            query={'search': f'name={product.name}'})[0]
        ak = default_sat.api.ActivationKey(content_view=content_view,
                                           organization=org.id,
                                           environment=lce).create()
        ak.add_subscriptions(data={'subscription_id': subscription.id})

        rhel7_client = dockerize(ak_name=ak.name,
                                 distro='rhel7',
                                 org_label=org.label)
        client_container_id = [value for value in rhel7_client.values()][0]
        client_container_name = [key for key in rhel7_client.keys()][0]

        host_location_update(client_container_name=client_container_name,
                             logger_obj=logger,
                             loc=loc)
        status = execute(
            docker_execute_command,
            client_container_id,
            'subscription-manager identity',
            host=DOCKER_VM,
        )[DOCKER_VM]
        assert org.name in status
        install_or_update_package(client_hostname=client_container_id,
                                  package=RPM1_NAME)

        scenario_dict = {
            self.__class__.__name__: {
                'content_view_name': content_view.name,
                'lce_id': lce.id,
                'lce_name': lce.name,
                'org_label': org.label,
                'prod_label': product.label,
                'rhel_client': rhel7_client,
                'repo_name': repo.name,
            }
        }
        create_dict(scenario_dict)
示例#27
0
    def test_pre_scenario_preclient_package_installation(self):
        """Create product and repo from which the package will be installed
        post upgrade

        :id: preupgrade-eedab638-fdc9-41fa-bc81-75dd2790f7be

        :steps:

            1. Create a content host with existing client ak
            2. Create and sync repo from which the package will be
                installed on content host
            3. Add repo to CV and then in Activation key

        :expectedresults:

            1. The content host is created
            2. The new repo and its product has been added to ak using which
                the content host is created

        """
        prior_env = entities.LifecycleEnvironment(
            organization=self.org
        ).search(query={'search': 'name=Library'})[0]
        environment = entities.LifecycleEnvironment(
            organization=self.org,
            prior=prior_env.id,
            label=self.le_lable,
            name=self.le_name
        ).create()
        ak = create_activation_key_for_client_registration(
            ak_name=self.ak_name,
            client_os='rhel7',
            org=self.org,
            environment=environment,
            sat_state='pre'
        )
        rhel7_client = dockerize(
            ak_name=ak.name, distro='rhel7', org_label=self.org.label)
        client_container_id = list(rhel7_client.values())[0]
        product, yum_repo = create_yum_test_repo(
            product_name=self.prod_name, repo_url=FAKE_REPO_ZOO3, org=self.org)
        update_product_subscription_in_ak(
            product=product, yum_repo=yum_repo, ak=ak, org=self.org)
        attach_custom_product_subscription(
            prod_name=product.name, host_name=str(list(rhel7_client.keys())[0]).lower())
        # Refresh subscriptions on client
        execute(
            docker_execute_command,
            client_container_id,
            'subscription-manager refresh',
            host=self.docker_vm
        )
        # Run goferd on client as its docker container
        kwargs = {'async': True, 'host': self.docker_vm}
        execute(
            docker_execute_command,
            client_container_id,
            'goferd -f',
            **kwargs
        )
        status = execute(docker_execute_command, client_container_id, 'ps -aux',
                         host=self.docker_vm)[self.docker_vm]
        self.assertIn('goferd', status)

        create_dict(
            {self.__class__.__name__: rhel7_client}
        )
示例#28
0
    def test_pre_scenario_yum_plugins_count(self):
        """Create content host and register with Satellite.

        :id: preupgrade-45241ada-c2c4-409e-a6e2-92c2cf0ac16c

        :steps:

            1. Before Satellite upgrade.
            2. Create new Organization and Location.
            3. Create Product, custom tools, rhel repos and sync them.
            4. Create activation key and add subscription.
            5. Create a content host, register and install katello-agent on it.

        :expectedresults:

            1. The content host is created.
            2. katello-agent install and goferd run.
        """
        org = entities.Organization().create()
        loc = entities.Location(organization=[org]).create()

        environment = entities.LifecycleEnvironment(organization=org).search(
            query={'search': 'name=Library'})[0]
        product = entities.Product(organization=org).create()
        tools_repo, rhel_repo = self._create_custom_rhel_tools_repos(product)
        product.sync()
        repolist = [tools_repo, rhel_repo]
        content_view = self._publish_content_view(org=org, repolist=repolist)

        ak = entities.ActivationKey(content_view=content_view,
                                    organization=org.id,
                                    environment=environment).create()
        subscription = entities.Subscription(organization=org).search(
            query={'search': 'name={}'.format(product.name)})[0]

        ak.add_subscriptions(data={'subscription_id': subscription.id})
        rhel7_client = dockerize(ak_name=ak.name,
                                 distro='rhel7',
                                 org_label=org.label)
        client_container_id = [value for value in rhel7_client.values()][0]
        client_container_name = [key for key in rhel7_client.keys()][0]
        self._host_location_update(client_container_name=client_container_name,
                                   loc=loc)

        status = execute(docker_execute_command,
                         client_container_id,
                         'subscription-manager identity',
                         host=self.docker_vm)[self.docker_vm]
        self.assertIn(org.name, status)

        self._install_or_update_package(client_container_id, 'katello-agent')
        self._run_goferd(client_container_id)

        scenario_dict = {
            self.__class__.__name__: {
                'rhel_client': rhel7_client,
                'product_id': product.id,
                'conten_view_id': content_view.id
            }
        }
        create_dict(scenario_dict)
示例#29
0
    def test_pre_create_virt_who_configuration(self, form_data):
        """Create and deploy virt-who configuration.

        :id: preupgrade-a36cbe89-47a2-422f-9881-0f86bea0e24e

        :steps: In Preupgrade Satellite, Create and deploy virt-who configuration.

        :expectedresults:
            1. Config can be created and deployed by command.
            2. No error msg in /var/log/rhsm/rhsm.log.
            3. Report is sent to satellite.
            4. Virtual sku can be generated and attached.
        """
        default_loc_id = entities.Location().search(
            query={'search': f'name="{DEFAULT_LOC}"'})[0].id
        default_loc = entities.Location(id=default_loc_id).read()
        org = entities.Organization(name=ORG_DATA['name']).create()
        default_loc.organization.append(entities.Organization(id=org.id))
        default_loc.update(['organization'])
        with manifests.clone() as manifest:
            upload_manifest(org.id, manifest.content)
        form_data.update({'organization_id': org.id})
        vhd = entities.VirtWhoConfig(**form_data).create()
        assert vhd.status == 'unknown'
        command = get_configure_command(vhd.id, org=org.name)
        hypervisor_name, guest_name = deploy_configure_by_command(
            command, form_data['hypervisor_type'], debug=True, org=org.label)
        virt_who_instance = (entities.VirtWhoConfig(
            organization_id=org.id).search(
                query={'search': f'name={form_data["name"]}'})[0].status)
        assert virt_who_instance == 'ok'
        hosts = [
            (hypervisor_name,
             f'product_id={settings.virtwho.sku.vdc_physical} and type=NORMAL'
             ),
            (guest_name,
             f'product_id={settings.virtwho.sku.vdc_physical} and type=STACK_DERIVED'
             ),
        ]
        for hostname, sku in hosts:
            host = Host.list({'search': hostname})[0]
            subscriptions = Subscription.list({
                'organization-id': org.id,
                'search': sku
            })
            vdc_id = subscriptions[0]['id']
            if 'type=STACK_DERIVED' in sku:
                for item in subscriptions:
                    if hypervisor_name.lower() in item['type']:
                        vdc_id = item['id']
                        break
            entities.HostSubscription(host=host['id']).add_subscriptions(
                data={'subscriptions': [{
                    'id': vdc_id,
                    'quantity': 1
                }]})
            result = (entities.Host(organization=org.id).search(
                query={'search': hostname})[0].read_json())
            assert result['subscription_status_label'] == 'Fully entitled'

        scenario_dict = {
            self.__class__.__name__: {
                'hypervisor_name': hypervisor_name,
                'guest_name': guest_name,
            }
        }
        create_dict(scenario_dict)
示例#30
0
    def test_pre_user_scenario_bug_1429201(self):
        """This is pre-upgrade scenario test to verify if we can create a
         custom repository and consume it via client

         :id: 8fb8ec87-efa5-43ed-8cb3-960ef9cd6df2

         :steps:
             1. Create repository RepoFoo that you will later add to your
                Satellite. This repository should contain PackageFoo-1.0.rpm
             2. Install satellite 6.1
             3. Create custom product ProductFoo pointing to repository RepoFoo
             4. Sync RepoFoo
             5. Create content view CVFoo
             6. Add RepoFoo to CVFoo
             7. Publish version 1 of CVFoo

         :expectedresults: The client and product is created successfully

         :BZ: 1429201
         """
        self.create_repo()
        # End to End product + ak association
        print(hammer.hammer_product_create(self.prd_name, self.org_id))
        print(hammer.hammer_repository_create(
            self.repo_name,
            self.org_id,
            self.prd_name,
            self.custom_repo))
        print(hammer.hammer(
            'lifecycle-environment create --name "{0}" '
            '--organization-id {1} --prior-id "{2}"'.format(
                self.lc_name, self.org_id, 1)))
        print(hammer.hammer_repository_synchronize(
            self.repo_name,
            self.org_id,
            self.prd_name))
        print(hammer.hammer_content_view_create(self.cv_name, self.org_id))
        print(hammer.hammer_content_view_add_repository(
            self.cv_name,
            self.org_id,
            self.prd_name,
            self.repo_name))
        print(hammer.hammer_content_view_publish(self.cv_name, self.org_id))
        latest_repo_version = hammer.get_latest_cv_version(self.cv_name)
        lc_result = hammer.hammer(
            '"{0}" info --name "{1}" --organization-id '
            '{2}'.format('lifecycle-environment',
                         self.lc_name,
                         self.org_id
                         )
                                  )
        lifecycle_id = hammer.get_attribute_value(
            lc_result,
            self.lc_name,
            'id'
            )
        print(hammer.hammer_content_view_promote_version(
            self.cv_name,
            latest_repo_version,
            lifecycle_id,
            self.org_id
            ))
        print(hammer.hammer_activation_key_create(
            self.ak_name,
            self.org_id,
            self.cv_name,
            self.lc_name
            ))
        print(hammer.hammer_activation_key_add_subscription(
            self.ak_name,
            self.org_id,
            self.prd_name
            ))
        time.sleep(5)
        # Creating a rhel7 vm and subscribing to AK
        container_ids = dockerize(self.ak_name, 'rhel7')
        # Subscription manager needs time to register
        execute(docker_wait_until_repo_list,
                list(container_ids.values())[0],
                host=self.docker_vm)
        result = execute(
            docker_execute_command,
            list(container_ids.values())[0],
            'yum list {0} | grep {0}'.format(self.rpm1_name.split('-')[0]),
            host=self.docker_vm
            )
        # Info on created entities to assert the test case using hammer info
        prd_info = hammer.hammer(
            '"{0}" info --name "{1}" --organization-id '
            '{2}'.format('product', self.prd_name, self.org_id)
        )
        self.assertEqual(
            self.prd_name,
            hammer.get_attribute_value(prd_info, self.prd_name, 'name')
        )
        self.assertIsNotNone(container_ids)
        self.assertIn(self.repo_name, list(result.values())[0])
        global_dict = {self.__class__.__name__: {
            'prd_name': self.prd_name,
            'ak_name': self.ak_name,
            'repo_name': self.repo_name,
            'container_ids': container_ids
        }
        }
        create_dict(global_dict)
示例#31
0
    def test_pre_scenario_generate_errata_with_previous_version_katello_agent_client(
            self, default_org):
        """Create product and repo from which the errata will be generated for the
        Satellite client or content host.

        :id: preupgrade-4e515f84-2582-4b8b-a625-9f6c6966aa59

        :steps:

            1. Create Life Cycle Environment, Product and Custom Yum Repo.
            2. Enable/sync 'base os RHEL7' and tools repos.
            3. Create a content view and publish it.
            4. Create activation key and add subscription.
            5. Registering Docker Content Host RHEL7.
            6. Install and check katello agent and goferd service running on host.
            7. Generate Errata by Installing Outdated/Older Packages.
            8. Collect the Erratum list.

        :expectedresults:

            1. The content host is created.
            2. errata count, erratum list will be generated to satellite client/content host.

        """
        environment = entities.LifecycleEnvironment(
            organization=default_org).search(
                query={'search': 'name=Library'})[0]

        product = entities.Product(organization=default_org).create()
        custom_yum_repo = entities.Repository(
            product=product, content_type='yum',
            url=settings.repos.yum_9.url).create()
        call_entity_method_with_timeout(product.sync, timeout=1400)

        repos = self._get_rh_rhel_tools_repos(default_org)
        repos.append(custom_yum_repo)
        content_view = publish_content_view(org=default_org, repolist=repos)
        custom_sub = entities.Subscription(organization=default_org).search(
            query={'search': f'name={product.name}'})[0]
        rh_sub = entities.Subscription(organization=1).search(
            query={'search': f'{DEFAULT_SUBSCRIPTION_NAME}'})[0]

        ak = entities.ActivationKey(
            content_view=content_view,
            organization=default_org.id,
            environment=environment,
            auto_attach=False,
        ).create()
        ak.add_subscriptions(data={'subscription_id': custom_sub.id})
        ak.add_subscriptions(data={'subscription_id': rh_sub.id})

        rhel7_client = dockerize(ak_name=ak.name,
                                 distro='rhel7',
                                 org_label=default_org.label)
        client_container_id = list(rhel7_client.values())[0]

        docker_vm = settings.upgrade.docker_vm
        wait_for(
            lambda: default_org.label in execute(
                docker_execute_command,
                client_container_id,
                'subscription-manager identity',
                host=docker_vm,
            )[docker_vm],
            timeout=800,
            delay=2,
            logger=logger,
        )
        status = execute(
            docker_execute_command,
            client_container_id,
            'subscription-manager identity',
            host=docker_vm,
        )[docker_vm]

        assert default_org.label in status

        # Update OS to make errata count 0
        execute(docker_execute_command,
                client_container_id,
                'yum update -y',
                host=docker_vm)[docker_vm]
        install_or_update_package(client_hostname=client_container_id,
                                  package="katello-agent")
        run_goferd(client_hostname=client_container_id)

        for package in FAKE_9_YUM_OUTDATED_PACKAGES:
            install_or_update_package(client_hostname=client_container_id,
                                      package=package)
        host = entities.Host().search(
            query={'search': f'activation_key={ak.name}'})[0]

        installable_errata_count = host.content_facet_attributes[
            'errata_counts']['total']
        assert installable_errata_count > 1

        erratum_list = entities.Errata(repository=custom_yum_repo).search(
            query={
                'order': 'updated ASC',
                'per_page': 1000
            })
        errata_ids = [errata.errata_id for errata in erratum_list]
        assert sorted(errata_ids) == sorted(settings.repos.yum_9.errata)
        scenario_dict = {
            self.__class__.__name__: {
                'rhel_client': rhel7_client,
                'activation_key': ak.name,
                'custom_repo_id': custom_yum_repo.id,
                'product_id': product.id,
            }
        }
        create_dict(scenario_dict)
示例#32
0
    def test_pre_scenario_generate_errata_for_client(self):
        """Create product and repo from which the errata will be generated for the
        Satellite client or content host.

        :id: 88fd28e6-b4df-46c0-91d6-784859fd1c21

        :steps:

            1. Create  Life Cycle Environment, Product and Custom Yum Repo
            2. Create custom tools, rhel repos and sync them
            3. Create content view and publish it
            4. Create activation key and add subscription.
            5. Registering Docker Content Host RHEL7
            6. Check katello agent and goferd service running on host
            7. Generate Errata by Installing Outdated/Older Packages
            8. Collect the Erratum list


        :expectedresults:

            1. The content host is created
            2. errata count, erratum list will be generated to satellite client/content host

        """
        org = entities.Organization().create()
        loc = entities.Location(organization=[org]).create()

        environment = entities.LifecycleEnvironment(organization=org).search(
            query={'search': 'name=Library'})[0]

        product = entities.Product(organization=org).create()
        custom_yum_repo = entities.Repository(product=product,
                                              content_type='yum',
                                              url=FAKE_9_YUM_REPO).create()
        product.sync()

        tools_repo, rhel_repo = self._create_custom_rhel_tools_repos(product)
        repolist = [custom_yum_repo, tools_repo, rhel_repo]
        content_view = self._publish_content_view(org=org, repolist=repolist)
        ak = entities.ActivationKey(content_view=content_view,
                                    organization=org.id,
                                    environment=environment).create()
        subscription = entities.Subscription(organization=org).search(
            query={'search': 'name={}'.format(product.name)})[0]

        ak.add_subscriptions(data={'subscription_id': subscription.id})
        rhel7_client = dockerize(ak_name=ak.name,
                                 distro='rhel7',
                                 org_label=org.label)
        client_container_id = list(rhel7_client.values())[0]
        client_container_name = [key for key in rhel7_client.keys()][0]
        self._host_location_update(client_container_name=client_container_name,
                                   loc=loc)
        self._install_or_update_package(client_container_id, 'katello-agent')
        self._run_goferd(client_container_id)

        for package in FAKE_9_YUM_OUTDATED_PACKAGES:
            self._install_or_update_package(client_container_id, package)
        host = entities.Host().search(
            query={'search': 'activation_key={0}'.format(ak.name)})[0]
        applicable_errata_count = host.content_facet_attributes[
            'errata_counts']['total']
        self.assertGreater(applicable_errata_count, 1)
        erratum_list = entities.Errata(repository=custom_yum_repo).search(
            query={
                'order': 'updated ASC',
                'per_page': 1000,
            })
        errata_ids = [errata.errata_id for errata in erratum_list]
        self.assertEqual(sorted(errata_ids), sorted(FAKE_9_YUM_ERRATUM))
        scenario_dict = {
            self.__class__.__name__: {
                'rhel_client': rhel7_client,
                'activation_key': ak.name,
                'custom_repo_id': custom_yum_repo.id,
                'product_id': product.id,
                'conten_view_id': content_view.id
            }
        }
        create_dict(scenario_dict)
示例#33
0
    def test_pre_scenario_generate_errata_for_client(self):
        """Create product and repo from which the errata will be generated for the
        Satellite client or content host.

        :id: 88fd28e6-b4df-46c0-91d6-784859fd1c21

        :steps:

            1. Create  Life Cycle Environment, Product and Custom Yum Repo
            2. Create custom tools, rhel repos and sync them
            3. Create content view and publish it
            4. Create activation key and add subscription.
            5. Registering Docker Content Host RHEL7
            6. Check katello agent and goferd service running on host
            7. Generate Errata by Installing Outdated/Older Packages
            8. Collect the Erratum list

        :expectedresults:

            1. The content host is created
            2. errata count, erratum list will be generated to satellite client/content
                host

        """
        org = entities.Organization().create()
        loc = entities.Location(organization=[org]).create()
        environment = entities.LifecycleEnvironment(organization=org).search(
            query={'search': 'name=Library'})[0]

        product = entities.Product(organization=org).create()
        custom_yum_repo = entities.Repository(
            product=product, content_type='yum',
            url=settings.repos.yum_9.url).create()
        product.sync()

        tools_repo, rhel_repo = self._create_custom_rhel_tools_repos(product)
        repolist = [custom_yum_repo, tools_repo, rhel_repo]
        content_view = publish_content_view(org=org, repolist=repolist)
        ak = entities.ActivationKey(content_view=content_view,
                                    organization=org.id,
                                    environment=environment).create()
        subscription = entities.Subscription(organization=org).search(
            query={'search': f'name={product.name}'})[0]

        ak.add_subscriptions(data={'subscription_id': subscription.id})
        rhel7_client = dockerize(ak_name=ak.name,
                                 distro='rhel7',
                                 org_label=org.label)
        client_container_id = list(rhel7_client.values())[0]
        client_container_name = [key for key in rhel7_client.keys()][0]
        host_location_update(client_container_name=client_container_name,
                             logger_obj=logger,
                             loc=loc)

        docker_vm = settings.upgrade.docker_vm
        wait_for(
            lambda: org.name in execute(
                docker_execute_command,
                client_container_id,
                'subscription-manager identity',
                host=docker_vm,
            )[docker_vm],
            timeout=800,
            delay=2,
            logger=logger,
        )
        install_or_update_package(client_hostname=client_container_id,
                                  package="katello-agent")
        run_goferd(client_hostname=client_container_id)

        for package in FAKE_9_YUM_OUTDATED_PACKAGES:
            install_or_update_package(client_hostname=client_container_id,
                                      package=package)

        host = entities.Host().search(
            query={'search': f'activation_key={ak.name}'})[0]
        installable_errata_count = host.content_facet_attributes[
            'errata_counts']['total']
        assert installable_errata_count > 1
        erratum_list = entities.Errata(repository=custom_yum_repo).search(
            query={
                'order': 'updated ASC',
                'per_page': 1000
            })
        errata_ids = [errata.errata_id for errata in erratum_list]
        assert sorted(errata_ids) == sorted(settings.repos.yum_9.errata)
        scenario_dict = {
            self.__class__.__name__: {
                'rhel_client': rhel7_client,
                'activation_key': ak.name,
                'custom_repo_id': custom_yum_repo.id,
                'product_id': product.id,
                'conten_view_id': content_view.id,
            }
        }
        create_dict(scenario_dict)
示例#34
0
    def test_pre_scenario_custom_repo_check(self):
        """This is pre-upgrade scenario test to verify if we can create a
         custom repository and consume it via content host.

        :id: preupgrade-eb6831b1-c5b6-4941-a325-994a09467478

        :steps:
            1. Before Satellite upgrade.
            2. Create new Organization, Location.
            3. Create Product, custom repo, cv.
            4. Create activation key and add subscription.
            5. Create a content host, register and install package on it.

        :expectedresults:

            1. Custom repo is created.
            2. Package is installed on Content host.

        """
        org = entities.Organization().create()
        loc = entities.Location(organization=[org]).create()
        lce = entities.LifecycleEnvironment(organization=org).create()

        product = entities.Product(organization=org).create()

        self._create_repo()
        repo = entities.Repository(product=product.id,
                                   url=self.custom_repo).create()
        repo.sync()

        content_view = self._create_publish_content_view(org=org, repo=repo)
        promote(content_view.version[0], lce.id)

        result = ssh.command(
            'ls /var/lib/pulp/published/yum/https/repos/{}/{}/{}/custom/{}/{}/'
            'Packages/b/|grep {}'.format(org.label, lce.name,
                                         content_view.label, product.label,
                                         repo.label, self.rpm1_name))

        self.assertEqual(result.return_code, 0)
        self.assertGreaterEqual(len(result.stdout), 1)

        subscription = entities.Subscription(organization=org).search(
            query={'search': 'name={}'.format(product.name)})[0]
        ak = entities.ActivationKey(content_view=content_view,
                                    organization=org.id,
                                    environment=lce).create()
        ak.add_subscriptions(data={'subscription_id': subscription.id})

        rhel7_client = dockerize(ak_name=ak.name,
                                 distro='rhel7',
                                 org_label=org.label)
        client_container_id = [value for value in rhel7_client.values()][0]
        client_container_name = [key for key in rhel7_client.keys()][0]

        self._host_location_update(client_container_name=client_container_name,
                                   loc=loc)
        status = execute(docker_execute_command,
                         client_container_id,
                         'subscription-manager identity',
                         host=self.docker_vm)[self.docker_vm]
        self.assertIn(org.name, status)
        self._install_package(client_container_id, self.rpm1_name)

        scenario_dict = {
            self.__class__.__name__: {
                'content_view_name': content_view.name,
                'lce_id': lce.id,
                'lce_name': lce.name,
                'org_label': org.label,
                'prod_label': product.label,
                'rhel_client': rhel7_client,
                'repo_name': repo.name,
            }
        }
        create_dict(scenario_dict)
示例#35
0
    def test_pre_user_scenario_bug_1429201(self):
        """This is pre-upgrade scenario test to verify if we can create a
         custom repository and consume it via client

         :id: 8fb8ec87-efa5-43ed-8cb3-960ef9cd6df2

         :steps:
             1. Create repository RepoFoo that you will later add to your
                Satellite. This repository should contain PackageFoo-1.0.rpm
             2. Install satellite 6.1
             3. Create custom product ProductFoo pointing to repository RepoFoo
             4. Sync RepoFoo
             5. Create content view CVFoo
             6. Add RepoFoo to CVFoo
             7. Publish version 1 of CVFoo

         :expectedresults: The client and product is created successfully

         :BZ: 1429201
         """
        self.create_repo()
        # End to End product + ak association
        print(hammer.hammer_product_create(self.prd_name, self.org_id))
        print(
            hammer.hammer_repository_create(self.repo_name, self.org_id,
                                            self.prd_name, self.custom_repo))
        print(
            hammer.hammer('lifecycle-environment create --name "{0}" '
                          '--organization-id {1} --prior-id "{2}"'.format(
                              self.lc_name, self.org_id, 1)))
        print(
            hammer.hammer_repository_synchronize(self.repo_name, self.org_id,
                                                 self.prd_name))
        print(hammer.hammer_content_view_create(self.cv_name, self.org_id))
        print(
            hammer.hammer_content_view_add_repository(self.cv_name,
                                                      self.org_id,
                                                      self.prd_name,
                                                      self.repo_name))
        print(hammer.hammer_content_view_publish(self.cv_name, self.org_id))
        latest_repo_version = hammer.get_latest_cv_version(self.cv_name)
        lc_result = hammer.hammer('"{0}" info --name "{1}" --organization-id '
                                  '{2}'.format('lifecycle-environment',
                                               self.lc_name, self.org_id))
        lifecycle_id = hammer.get_attribute_value(lc_result, self.lc_name,
                                                  'id')
        print(
            hammer.hammer_content_view_promote_version(self.cv_name,
                                                       latest_repo_version,
                                                       lifecycle_id,
                                                       self.org_id))
        print(
            hammer.hammer_activation_key_create(self.ak_name, self.org_id,
                                                self.cv_name, self.lc_name))
        print(
            hammer.hammer_activation_key_add_subscription(
                self.ak_name, self.org_id, self.prd_name))
        time.sleep(5)
        # Creating a rhel7 vm and subscribing to AK
        container_ids = dockerize(self.ak_name, 'rhel7')
        # Subscription manager needs time to register
        execute(docker_wait_until_repo_list,
                list(container_ids.values())[0],
                host=self.docker_vm)
        result = execute(docker_execute_command,
                         list(container_ids.values())[0],
                         'yum list {0} | grep {0}'.format(
                             self.rpm1_name.split('-')[0]),
                         host=self.docker_vm)
        # Info on created entities to assert the test case using hammer info
        prd_info = hammer.hammer('"{0}" info --name "{1}" --organization-id '
                                 '{2}'.format('product', self.prd_name,
                                              self.org_id))
        self.assertEqual(
            self.prd_name,
            hammer.get_attribute_value(prd_info, self.prd_name, 'name'))
        self.assertIsNotNone(container_ids)
        self.assertIn(self.repo_name, list(result.values())[0])
        global_dict = {
            self.__class__.__name__: {
                'prd_name': self.prd_name,
                'ak_name': self.ak_name,
                'repo_name': self.repo_name,
                'container_ids': container_ids
            }
        }
        create_dict(global_dict)
示例#36
0
    def test_pre_scenario_generate_errata_for_client(self):
        """Create product and repo from which the errata will be generated for the
        Satellite client or content host.

        :id: 88fd28e6-b4df-46c0-91d6-784859fd1c21

        :steps:

            1. Create  Life Cycle Environment, Product and Custom Yum Repo
            2. Create custom tools, rhel repos and sync them
            3. Create content view and publish it
            4. Create activation key and add subscription.
            5. Registering Docker Content Host RHEL7
            6. Check katello agent and goferd service running on host
            7. Generate Errata by Installing Outdated/Older Packages
            8. Collect the Erratum list


        :expectedresults:

            1. The content host is created
            2. errata count, erratum list will be generated to satellite client/content host

        """
        org = entities.Organization().create()
        loc = entities.Location(organization=[org]).create()

        environment = entities.LifecycleEnvironment(
            organization=org
        ).search(query={'search': 'name=Library'})[0]

        product = entities.Product(organization=org).create()
        custom_yum_repo = entities.Repository(product=product,
                                              content_type='yum',
                                              url=FAKE_9_YUM_REPO
                                              ).create()
        product.sync()

        tools_repo, rhel_repo = self._create_custom_rhel_tools_repos(product)
        repolist = [custom_yum_repo, tools_repo, rhel_repo]
        content_view = self._publish_content_view(org=org, repolist=repolist)
        ak = entities.ActivationKey(
            content_view=content_view,
            organization=org.id,
            environment=environment
        ).create()
        subscription = entities.Subscription(organization=org).search(query={
            'search': 'name={}'.format(product.name)
        })[0]

        ak.add_subscriptions(data={
            'subscription_id': subscription.id})
        rhel7_client = dockerize(
            ak_name=ak.name, distro='rhel7', org_label=org.label)
        client_container_id = list(rhel7_client.values())[0]
        client_container_name = [key for key in rhel7_client.keys()][0]
        self._host_location_update(client_container_name=client_container_name, loc=loc)
        self._install_or_update_package(client_container_id, 'katello-agent')
        self._run_goferd(client_container_id)

        for package in FAKE_9_YUM_OUTDATED_PACKAGES:
            self._install_or_update_package(client_container_id, package)
        host = entities.Host().search(query={
            'search': 'activation_key={0}'.format(ak.name)})[0]
        installable_errata_count = host.content_facet_attributes[
            'errata_counts']['total']
        self.assertGreater(installable_errata_count, 1)
        erratum_list = entities.Errata(repository=custom_yum_repo).search(query={
            'order': 'updated ASC',
            'per_page': 1000,
        })
        errata_ids = [errata.errata_id for errata in erratum_list]
        self.assertEqual(sorted(errata_ids), sorted(FAKE_9_YUM_ERRATUM))
        scenario_dict = {self.__class__.__name__: {
            'rhel_client': rhel7_client,
            'activation_key': ak.name,
            'custom_repo_id': custom_yum_repo.id,
            'product_id': product.id,
            'conten_view_id': content_view.id
        }}
        create_dict(scenario_dict)
示例#37
0
    def test_pre_scenario_remoteexecution_external_capsule(self):
        """Run REX job on client registered with external capsule

        :id: preupgrade-261dd2aa-be01-4c34-b877-54b8ee346561

        :steps:
            1. Create Subnet.
            2. Create Content host.
            3. Install katello-ca package and register to Satellite host.
            4. add rex ssh_key of external capsule on content host.
            5. run the REX job on client vm.

        :expectedresults:
            1. Content host should create with pre-required details.
            2. REX job should run on it.
        """
        try:
            default_loc_id = (entities.Location().search(
                query={'search': f'name="{DEFAULT_LOC}"'})[0].id)
            sn = entities.Subnet(
                domain=self.vm_domain,
                gateway=self.gateway,
                ipam='DHCP',
                location=[default_loc_id],
                mask=self.netmask,
                network=self.subnet,
                organization=[self.org.id],
                remote_execution_proxy=[entities.SmartProxy(id=2)],
            ).create()
            client = VirtualMachine(distro=DISTRO_RHEL7,
                                    provisioning_server=self.libvirt_vm,
                                    bridge=self.bridge)
            client.create()
            client.install_capsule_katello_ca(capsule=self.proxy_name)
            client.register_contenthost(org=self.org.label, lce='Library')
            add_remote_execution_ssh_key(hostname=client.ip_addr,
                                         proxy_hostname=self.proxy_name)
            host = entities.Host().search(
                query={'search': f'name="{client.hostname}"'})
            host[0].subnet = sn
            host[0].update(['subnet'])
            job = entities.JobInvocation().run(
                data={
                    'job_template_id': 89,
                    'inputs': {
                        'command': "ls"
                    },
                    'targeting_type': 'static_query',
                    'search_query': f"name = {client.hostname}",
                })
            self.assertEqual(job['output']['success_count'], 1)
            global_dict = {
                self.__class__.__name__: {
                    'client_name': client.hostname
                }
            }
            create_dict(global_dict)
        except Exception as exp:
            if client._created:
                cleanup_of_provisioned_server(
                    hostname=client.hostname,
                    provisioning_server=self.libvirt_vm,
                    distro=DISTRO_RHEL7,
                )
            raise Exception(exp)
示例#38
0
    def test_pre_create_virt_who_configuration(self):
        """Create and deploy virt-who configuration.

        :id: preupgrade-a36cbe89-47a2-422f-9881-0f86bea0e24e

        :steps: In Preupgrade Satellite, Create and deploy virt-who configuration.

        :expectedresults:
            1. Config can be created and deployed by command.
            2. No error msg in /var/log/rhsm/rhsm.log.
            3. Report is sent to satellite.
            4. Virtual sku can be generated and attached.
        """
        default_loc_id = (
            entities.Location().search(query={'search': 'name="{}"'.format(DEFAULT_LOC)})[0].id
        )
        default_loc = entities.Location(id=default_loc_id).read()
        org = entities.Organization(name=self.org_name).create()
        default_loc.organization.append(entities.Organization(id=org.id))
        default_loc.update(['organization'])
        with manifests.clone() as manifest:
            upload_manifest(org.id, manifest.content)
        args = self._make_virtwho_configure()
        args.update({'name': self.name, 'organization_id': org.id})
        vhd = entities.VirtWhoConfig(**args).create()
        self.assertEqual(vhd.status, 'unknown')
        command = get_configure_command(vhd.id, org=org.name)
        hypervisor_name, guest_name = deploy_configure_by_command(
            command, args['hypervisor_type'], debug=True, org=org.name
        )
        self.assertEqual(
            entities.VirtWhoConfig(organization_id=org.id)
            .search(query={'search': 'name={}'.format(self.name)})[0]
            .status,
            'ok',
        )
        hosts = [
            (hypervisor_name, 'product_id={} and type=NORMAL'.format(self.vdc_physical)),
            (guest_name, 'product_id={} and type=STACK_DERIVED'.format(self.vdc_physical)),
        ]
        for hostname, sku in hosts:
            if 'type=NORMAL' in sku:
                subscriptions = entities.Subscription(organization=org.id).search(
                    query={'search': sku}
                )
                vdc_id = subscriptions[0].id
            if 'type=STACK_DERIVED' in sku:
                subscriptions = entities.Subscription(organization=org.id).search(
                    query={'search': sku}
                )
                vdc_id = subscriptions[0].id
            host, time = wait_for(
                entities.Host(organization=org.id).search,
                func_args=(None, {'search': hostname}),
                fail_condition=[],
                timeout=5,
                delay=1,
            )
            entities.HostSubscription(host=host[0].id).add_subscriptions(
                data={'subscriptions': [{'id': vdc_id, 'quantity': 1}]}
            )
            result = (
                entities.Host(organization=org.id)
                .search(query={'search': hostname})[0]
                .read_json()
            )
            self.assertEqual(result['subscription_status_label'], 'Fully entitled')

        scenario_dict = {
            self.__class__.__name__: {
                'hypervisor_name': hypervisor_name,
                'guest_name': guest_name,
            }
        }
        create_dict(scenario_dict)