示例#1
0
    def test_positive_delete_configure(self, session, form_data):
        """Verify when a config is deleted the associated user is deleted.

        :id: 0e66dcf6-dc64-4fb2-b8a9-518f5adfa800

        :steps:
            1. Create a virt-who configuration and deploy it to a
               virt-who server.
            2. Delete the configuration on the Satellite.

        :expectedresults:
            1. Verify the virt-who server can no longer connect to the
               Satellite.

        """
        name = gen_string('alpha')
        form_data['name'] = name
        with session:
            session.virtwho_configure.create(form_data)
            config_id = get_configure_id(name)
            config_command = get_configure_command(config_id)
            deploy_configure_by_command(config_command, form_data['hypervisor_type'])
            assert session.virtwho_configure.search(name)[0]['Status'] == 'ok'
            session.virtwho_configure.delete(name)
            assert not session.virtwho_configure.search(name)
            restart_virtwho_service()
            assert get_virtwho_status() == 'logerror'
示例#2
0
    def test_positive_hypervisor_id_option(self, default_org, session, form_data):
        """Verify Hypervisor ID dropdown options.

        :id: 09826cc0-aa49-4355-8980-8097511eb7d7

        :expectedresults:
            hypervisor_id can be changed in virt-who-config-{}.conf if the
            dropdown option is selected to uuid/hwuuid/hostname.

        :CaseLevel: Integration

        :CaseImportance: Medium
        """
        name = gen_string('alpha')
        form_data['name'] = name
        with session:
            session.virtwho_configure.create(form_data)
            config_id = get_configure_id(name)
            config_command = get_configure_command(config_id, default_org.name)
            config_file = get_configure_file(config_id)
            values = ['uuid', 'hostname']
            for value in values:
                session.virtwho_configure.edit(name, {'hypervisor_id': value})
                results = session.virtwho_configure.read(name)
                assert results['overview']['hypervisor_id'] == value
                deploy_configure_by_command(
                    config_command, form_data['hypervisor_type'], org=default_org.label
                )
                assert get_configure_option('hypervisor_id', config_file) == value
            session.virtwho_configure.delete(name)
            assert not session.virtwho_configure.search(name)
示例#3
0
    def test_positive_hypervisor_id_option(self, session, form_data):
        """Verify Hypervisor ID dropdown options.

        :id: cc494bd9-51d9-452a-bfa9-5cdcafef5197

        :expectedresults:
            hypervisor_id can be changed in virt-who-config-{}.conf if the
            dropdown option is selected to uuid/hwuuid/hostname.

        :CaseLevel: Integration

        :CaseImportance: Medium
        """
        name = gen_string('alpha')
        form_data['name'] = name
        with session:
            session.virtwho_configure.create(form_data)
            config_id = get_configure_id(name)
            config_command = get_configure_command(config_id)
            config_file = get_configure_file(config_id)
            # esx and rhevm support hwuuid option
            values = ['uuid', 'hostname', 'hwuuid']
            for value in values:
                session.virtwho_configure.edit(name, {'hypervisor_id': value})
                results = session.virtwho_configure.read(name)
                assert results['overview']['hypervisor_id'] == value
                deploy_configure_by_command(config_command, form_data['hypervisor_type'])
                assert get_configure_option('hypervisor_id', config_file) == value
            session.virtwho_configure.delete(name)
            assert not session.virtwho_configure.search(name)
示例#4
0
    def test_positive_proxy_option(self, session, form_data):
        """Verify 'HTTP Proxy' and 'Ignore Proxy' options.

        :id: 6659d577-0135-4bf0-81af-14b930011536

        :expectedresults:
            http_proxy ad NO_PROXY will be setting in /etc/sysconfig/virt-who.

        :CaseLevel: Integration

        :CaseImportance: Medium
        """
        name = gen_string('alpha')
        form_data['name'] = name
        with session:
            session.virtwho_configure.create(form_data)
            config_id = get_configure_id(name)
            config_command = get_configure_command(config_id)
            http_proxy = 'test.example.com:3128'
            no_proxy = 'test.satellite.com'
            session.virtwho_configure.edit(name, {'proxy': http_proxy, 'no_proxy': no_proxy})
            results = session.virtwho_configure.read(name)
            assert results['overview']['proxy'] == http_proxy
            assert results['overview']['no_proxy'] == no_proxy
            deploy_configure_by_command(config_command, form_data['hypervisor_type'])
            assert get_configure_option('http_proxy', VIRTWHO_SYSCONFIG) == http_proxy
            assert get_configure_option('NO_PROXY', VIRTWHO_SYSCONFIG) == no_proxy
            session.virtwho_configure.delete(name)
            assert not session.virtwho_configure.search(name)
示例#5
0
    def test_positive_debug_option(self, session, form_data):
        """Verify debug checkbox and the value changes of VIRTWHO_DEBUG

        :id: adb435c4-d02b-47b6-89f5-dce9a4ff7939

        :expectedresults:
            1. if debug is checked, VIRTWHO_DEBUG=1 in /etc/sysconfig/virt-who
            2. if debug is unchecked, VIRTWHO_DEBUG=0 in /etc/sysconfig/virt-who

        :CaseLevel: Integration

        :CaseImportance: Medium
        """
        name = gen_string('alpha')
        form_data['name'] = name
        with session:
            session.virtwho_configure.create(form_data)
            config_id = get_configure_id(name)
            config_command = get_configure_command(config_id)
            deploy_configure_by_command(config_command, form_data['hypervisor_type'])
            assert get_configure_option('VIRTWHO_DEBUG', VIRTWHO_SYSCONFIG) == '1'
            session.virtwho_configure.edit(name, {'debug': False})
            results = session.virtwho_configure.read(name)
            assert results['overview']['debug'] is False
            deploy_configure_by_command(config_command, form_data['hypervisor_type'])
            assert get_configure_option('VIRTWHO_DEBUG', VIRTWHO_SYSCONFIG) == '0'
            session.virtwho_configure.delete(name)
            assert not session.virtwho_configure.search(name)
示例#6
0
    def test_positive_filtering_option(self, default_org, session, form_data):
        """Verify Filtering dropdown options.

        :id: e17dda14-79cd-4cd2-8f29-60970b24a905

        :expectedresults:
            1. if filtering is selected to Whitelist, 'Filter hosts' can be set.
            2. if filtering is selected to Blacklist, 'Exclude hosts' can be set.

        :CaseLevel: Integration

        :CaseImportance: Medium

        :BZ: 1735670
        """
        name = gen_string('alpha')
        form_data['name'] = name
        with session:
            session.virtwho_configure.create(form_data)
            config_id = get_configure_id(name)
            config_command = get_configure_command(config_id,
                                                   default_org.label)
            config_file = get_configure_file(config_id)
            regex = '.*redhat.com'
            whitelist = {
                'filtering': 'Whitelist',
                'filtering_content.filter_hosts': regex
            }
            blacklist = {
                'filtering': 'Blacklist',
                'filtering_content.exclude_hosts': regex
            }
            # esx support filter-host-parents and exclude-host-parents options
            whitelist['filtering_content.filter_host_parents'] = regex
            blacklist['filtering_content.exclude_host_parents'] = regex
            # Update Whitelist and check the result
            session.virtwho_configure.edit(name, whitelist)
            results = session.virtwho_configure.read(name)
            assert results['overview']['filter_hosts'] == regex
            assert results['overview']['filter_host_parents'] == regex
            deploy_configure_by_command(config_command,
                                        form_data['hypervisor_type'],
                                        org=default_org.label)
            assert regex == get_configure_option('filter_hosts', config_file)
            assert regex == get_configure_option('filter_host_parents',
                                                 config_file)
            # Update Blacklist and check the result
            session.virtwho_configure.edit(name, blacklist)
            results = session.virtwho_configure.read(name)
            assert results['overview']['exclude_hosts'] == regex
            assert results['overview']['exclude_host_parents'] == regex
            deploy_configure_by_command(config_command,
                                        form_data['hypervisor_type'],
                                        org=default_org.label)
            assert regex == get_configure_option('exclude_hosts', config_file)
            assert regex == get_configure_option('exclude_host_parents',
                                                 config_file)
            session.virtwho_configure.delete(name)
            assert not session.virtwho_configure.search(name)
示例#7
0
    def test_positive_virtwho_viewer_role(self, session, test_name, form_data):
        """Verify the virt-who viewer role can TRULY work.

        :id: bf3be2e4-3853-41cc-9b3e-c8677f0b8c5f

        :expectedresults:
            Virt-who Viewer Role granting permissions to see all configurations
            including their configuration scripts, which means viewers could still
            deploy the virt-who instances for existing virt-who configurations.
        """
        username = gen_string('alpha')
        password = gen_string('alpha')
        config_name = gen_string('alpha')
        with session:
            # Create an user
            session.user.create({
                'user.login': username,
                'user.mail': valid_emails_list()[0],
                'user.auth': 'INTERNAL',
                'user.password': password,
                'user.confirm': password,
            })
            # Create a virt-who config plugin
            form_data['name'] = config_name
            session.virtwho_configure.create(form_data)
            values = session.virtwho_configure.read(config_name)
            command = values['deploy']['command']
            deploy_configure_by_command(command, form_data['hypervisor_type'])
            assert session.virtwho_configure.search(
                config_name)[0]['Status'] == 'ok'
            # Check the permissioin of Virt-who Viewer
            session.user.update(
                username, {'roles.resources.assigned': ['Virt-who Viewer']})
            user = session.user.read(username)
            assert user['roles']['resources']['assigned'] == [
                'Virt-who Viewer'
            ]
            # Update the virt-who config file
            config_id = get_configure_id(config_name)
            config_file = get_configure_file(config_id)
            update_configure_option('rhsm_username', username, config_file)
            delete_configure_option('rhsm_encrypted_password', config_file)
            add_configure_option('rhsm_password', password, config_file)
            restart_virtwho_service()
            assert get_virtwho_status() == 'logerror'
            with Session(test_name, username, password) as newsession:
                create_permission = newsession.virtwho_configure.check_create_permission(
                )
                update_permission = newsession.virtwho_configure.check_update_permission(
                    config_name)
                assert create_permission['can_view']
                assert not create_permission['can_create']
                assert not update_permission['can_delete']
                assert not update_permission['can_edit']
                newsession.virtwho_configure.read(config_name)
            # Delete the created user
            session.user.delete(username)
            assert not session.user.search(username)
示例#8
0
    def test_positive_virtwho_reporter_role(self, default_org, session,
                                            test_name, form_data):
        """Verify the virt-who reporter role can TRULY work.

        :id: cd235ab0-d89c-464b-98d6-9d090ac40d8f

        :expectedresults:
            Virt-who Reporter Role granting minimal set of permissions for virt-who
            to upload the report, it can be used if you configure virt-who manually
            and want to use user that has locked down account.
        """
        username = gen_string('alpha')
        password = gen_string('alpha')
        config_name = gen_string('alpha')
        with session:
            # Create an user
            session.user.create({
                'user.login': username,
                'user.mail': valid_emails_list()[0],
                'user.auth': 'INTERNAL',
                'user.password': password,
                'user.confirm': password,
            })
            # Create a virt-who config plugin
            form_data['name'] = config_name
            session.virtwho_configure.create(form_data)
            values = session.virtwho_configure.read(config_name)
            command = values['deploy']['command']
            deploy_configure_by_command(command,
                                        form_data['hypervisor_type'],
                                        org=default_org.label)
            assert session.virtwho_configure.search(
                config_name)[0]['Status'] == 'ok'
            # Update the virt-who config file
            config_id = get_configure_id(config_name)
            config_file = get_configure_file(config_id)
            update_configure_option('rhsm_username', username, config_file)
            delete_configure_option('rhsm_encrypted_password', config_file)
            add_configure_option('rhsm_password', password, config_file)
            restart_virtwho_service()
            assert get_virtwho_status() == 'logerror'
            # Check the permissioin of Virt-who Reporter
            session.user.update(
                username, {'roles.resources.assigned': ['Virt-who Reporter']})
            assert session.user.search(username)[0]['Username'] == username
            user = session.user.read(username)
            assert user['roles']['resources']['assigned'] == [
                'Virt-who Reporter'
            ]
            restart_virtwho_service()
            assert get_virtwho_status() == 'running'
            with Session(test_name, username, password) as newsession:
                assert not newsession.virtwho_configure.check_create_permission(
                )['can_view']
            session.user.delete(username)
            assert not session.user.search(username)
示例#9
0
    def test_positive_virtwho_configs_widget(self, session, form_data):
        """Check if Virt-who Configurations Status Widget is working in the Dashboard UI

        :id: 5d61ce00-a640-4823-89d4-7b1d02b50ea6

        :Steps:

            1. Create a Virt-who Configuration
            2. Navigate Monitor -> Dashboard
            3. Review the Virt-who Configurations Status widget

        :expectedresults: The widget is updated with all details.

        :CaseLevel: Integration

        :CaseImportance: Low
        """
        org_name = gen_string('alpha')
        name = gen_string('alpha')
        form_data['name'] = name
        with session:
            session.organization.create({'name': org_name})
            session.organization.select(org_name)
            session.virtwho_configure.create(form_data)
            expected_values = [
                {'Configuration Status': 'No Reports', 'Count': '1'},
                {'Configuration Status': 'No Change', 'Count': '0'},
                {'Configuration Status': 'OK', 'Count': '0'},
                {'Configuration Status': 'Total Configurations', 'Count': '1'},
            ]
            values = session.dashboard.read('VirtWhoConfigStatus')
            assert values['config_status'] == expected_values
            assert values['latest_config'] == 'No configuration found'
            # Check the 'Status' changed after deployed the virt-who config
            config_id = get_configure_id(name)
            config_command = get_configure_command(config_id, org_name)
            deploy_configure_by_command(config_command, form_data['hypervisor_type'])
            assert session.virtwho_configure.search(name)[0]['Status'] == 'ok'
            expected_values = [
                {'Configuration Status': 'No Reports', 'Count': '0'},
                {'Configuration Status': 'No Change', 'Count': '0'},
                {'Configuration Status': 'OK', 'Count': '1'},
                {'Configuration Status': 'Total Configurations', 'Count': '1'},
            ]
            values = session.dashboard.read('VirtWhoConfigStatus')
            assert values['config_status'] == expected_values
            assert values['latest_config'] == 'No configuration found'
            session.virtwho_configure.delete(name)
            assert not session.virtwho_configure.search(name)
            session.organization.select("Default Organization")
            session.organization.delete(org_name)
示例#10
0
    def test_positive_proxy_option(self, default_org, session, form_data):
        """Verify 'HTTP Proxy' and 'Ignore Proxy' options.

        :id: 6659d577-0135-4bf0-81af-14b930011536

        :expectedresults:
            http_proxy/https_proxy and NO_PROXY will be setting in /etc/sysconfig/virt-who.

        :CaseLevel: Integration

        :CaseImportance: Medium
        """
        https_proxy, https_proxy_name, https_proxy_id = create_http_proxy(
            org=default_org)
        http_proxy, http_proxy_name, http_proxy_id = create_http_proxy(
            http_type='http', org=default_org)
        name = gen_string('alpha')
        form_data['name'] = name
        with session:
            session.virtwho_configure.create(form_data)
            config_id = get_configure_id(name)
            config_command = get_configure_command(config_id,
                                                   default_org.label)
            no_proxy = 'test.satellite.com'
            # Check the https proxy and No_PROXY settings
            session.virtwho_configure.edit(name, {
                'proxy': https_proxy,
                'no_proxy': no_proxy
            })
            results = session.virtwho_configure.read(name)
            assert results['overview']['proxy'] == https_proxy
            assert results['overview']['no_proxy'] == no_proxy
            deploy_configure_by_command(config_command,
                                        form_data['hypervisor_type'],
                                        org=default_org.label)
            assert get_configure_option('https_proxy',
                                        ETC_VIRTWHO_CONFIG) == https_proxy
            assert get_configure_option('no_proxy',
                                        ETC_VIRTWHO_CONFIG) == no_proxy
            # Check the http proxy setting
            session.virtwho_configure.edit(name, {'proxy': http_proxy})
            results = session.virtwho_configure.read(name)
            assert results['overview']['proxy'] == http_proxy
            deploy_configure_by_command(config_command,
                                        form_data['hypervisor_type'],
                                        org=default_org.label)
            assert get_configure_option('http_proxy',
                                        ETC_VIRTWHO_CONFIG) == http_proxy
            session.virtwho_configure.delete(name)
            assert not session.virtwho_configure.search(name)
示例#11
0
    def test_positive_interval_option(self, default_org, session, form_data):
        """Verify interval dropdown options and the value changes of VIRTWHO_INTERVAL.

        :id: 731f8361-38d4-40b9-9530-8d785d61eaab

        :expectedresults:
            VIRTWHO_INTERVAL can be changed in /etc/sysconfig/virt-who if the
            dropdown option is selected to Every 2/4/8/12/24 hours, Every 2/3 days.

        :CaseLevel: Integration

        :CaseImportance: Medium
        """
        name = gen_string('alpha')
        form_data['name'] = name
        with session:
            session.virtwho_configure.create(form_data)
            config_id = get_configure_id(name)
            config_command = get_configure_command(config_id,
                                                   default_org.label)
            intervals = {
                'Every hour': '3600',
                'Every 2 hours': '7200',
                'Every 4 hours': '14400',
                'Every 8 hours': '28800',
                'Every 12 hours': '43200',
                'Every 24 hours': '86400',
                'Every 2 days': '172800',
                'Every 3 days': '259200',
            }
            for option, value in sorted(intervals.items(),
                                        key=lambda item: int(item[1])):
                session.virtwho_configure.edit(name, {'interval': option})
                results = session.virtwho_configure.read(name)
                assert results['overview']['interval'] == option
                deploy_configure_by_command(config_command,
                                            form_data['hypervisor_type'],
                                            org=default_org.label)
                assert get_configure_option('interval',
                                            ETC_VIRTWHO_CONFIG) == value
            session.virtwho_configure.delete(name)
            assert not session.virtwho_configure.search(name)