Пример #1
0
    def test_positive_proxy_option(self, form_data, virtwho_config):
        """Verify http_proxy option by hammer virt-who-config update"

        :id: 409d108e-e814-482b-93ed-09db89d21dda

        :expectedresults: http_proxy and no_proxy option can be updated.

        :CaseLevel: Integration

        :CaseImportance: Medium

        :BZ: 1902199
        """
        # Check the https proxy option, update it via http proxy name
        https_proxy_url, https_proxy_name, https_proxy_id = create_http_proxy()
        no_proxy = 'test.satellite.com'
        VirtWhoConfig.update(
            {'id': virtwho_config['id'], 'http-proxy': https_proxy_name, 'no-proxy': no_proxy}
        )
        result = VirtWhoConfig.info({'id': virtwho_config['id']})
        assert result['http-proxy']['http-proxy-name'] == https_proxy_name
        assert result['connection']['ignore-proxy'] == no_proxy
        command = get_configure_command(virtwho_config['id'])
        deploy_configure_by_command(command, form_data['hypervisor-type'])
        assert get_configure_option('https_proxy', VIRTWHO_SYSCONFIG) == https_proxy_url
        assert get_configure_option('NO_PROXY', VIRTWHO_SYSCONFIG) == no_proxy

        # Check the http proxy option, update it via http proxy id
        http_proxy_url, http_proxy_name, http_proxy_id = create_http_proxy(type='http')
        VirtWhoConfig.update({'id': virtwho_config['id'], 'http-proxy-id': http_proxy_id})
        deploy_configure_by_command(command, form_data['hypervisor-type'])
        assert get_configure_option('http_proxy', VIRTWHO_SYSCONFIG) == http_proxy_url

        VirtWhoConfig.delete({'name': virtwho_config['name']})
        assert not VirtWhoConfig.exists(search=('name', form_data['name']))
Пример #2
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)
Пример #3
0
    def test_positive_proxy_option(self, default_org, form_data,
                                   virtwho_config):
        """Verify http_proxy option by "PUT

        /foreman_virt_who_configure/api/v2/configs/:id""

        :id: e1b00b46-d5e6-40d5-a955-a45a75a5cfad

        :expectedresults: http_proxy/https_proxy and no_proxy option can be updated.

        :CaseLevel: Integration

        :CaseImportance: Medium

        :BZ: 1902199
        """
        command = get_configure_command(virtwho_config.id, default_org.name)
        deploy_configure_by_command(command,
                                    form_data['hypervisor_type'],
                                    org=default_org.label)
        # Check default NO_PROXY option
        assert get_configure_option('no_proxy', ETC_VIRTWHO_CONFIG) == '*'
        # Check HTTTP Proxy and No_PROXY option
        http_proxy_url, http_proxy_name, http_proxy_id = create_http_proxy(
            http_type='http', org=default_org)
        no_proxy = 'test.satellite.com'
        virtwho_config.http_proxy_id = http_proxy_id
        virtwho_config.no_proxy = no_proxy
        virtwho_config.update(['http_proxy_id', 'no_proxy'])
        command = get_configure_command(virtwho_config.id, default_org.name)
        deploy_configure_by_command(command,
                                    form_data['hypervisor_type'],
                                    org=default_org.label)
        assert get_configure_option('http_proxy',
                                    ETC_VIRTWHO_CONFIG) == http_proxy_url
        assert get_configure_option('no_proxy', ETC_VIRTWHO_CONFIG) == no_proxy
        # Check HTTTPs Proxy option
        https_proxy_url, https_proxy_name, https_proxy_id = create_http_proxy(
            org=default_org)
        virtwho_config.http_proxy_id = https_proxy_id
        virtwho_config.update(['http_proxy_id'])
        deploy_configure_by_command(command,
                                    form_data['hypervisor_type'],
                                    org=default_org.label)
        assert get_configure_option('https_proxy',
                                    ETC_VIRTWHO_CONFIG) == https_proxy_url
        virtwho_config.delete()
        assert not entities.VirtWhoConfig().search(
            query={'search': f"name={form_data['name']}"})
Пример #4
0
    def test_positive_overview_label_name(self, form_data, session):
        """Verify the label name on virt-who config Overview Page.

        :id: 21df8175-bb41-422e-a263-8677bc3a9565

        :BZ: 1649928

        :CaseLevel: Integration

        :CaseImportance: Medium
        """
        name = gen_string('alpha')
        form_data['name'] = name
        hypervisor_type = form_data['hypervisor_type']
        http_proxy_url, proxy_name, proxy_id = create_http_proxy()
        form_data['proxy'] = http_proxy_url
        form_data['no_proxy'] = 'test.satellite.com'
        regex = '.*redhat.com'
        whitelist = {'filtering': 'Whitelist', 'filtering_content.filter_hosts': regex}
        blacklist = {'filtering': 'Blacklist', 'filtering_content.exclude_hosts': regex}
        if hypervisor_type == 'esx':
            whitelist['filtering_content.filter_host_parents'] = regex
            blacklist['filtering_content.exclude_host_parents'] = regex
        form_data = dict(form_data, **whitelist)
        with session:
            session.virtwho_configure.create(form_data)
            fields = {
                'status_label': 'Status',
                'hypervisor_type_label': 'Hypervisor Type',
                'hypervisor_server_label': 'Hypervisor Server',
                'hypervisor_username_label': 'Hypervisor Username',
                'interval_label': 'Interval',
                'satellite_url_label': 'Satellite server FQDN',
                'hypervisor_id_label': 'Hypervisor ID',
                'debug_label': 'Enable debugging output?',
                'filtering_label': 'Filtering',
                'filter_hosts_label': 'Filter Hosts',
                'proxy_label': 'HTTP Proxy',
                'no_proxy_label': 'Ignore Proxy',
            }
            if hypervisor_type == 'kubevirt':
                del fields['hypervisor_username_label']
                del fields['hypervisor_server_label']
                fields['kubeconfig_path_label'] = 'Kubeconfig Path'
            if hypervisor_type == 'esx':
                fields['filter_host_parents_label'] = 'Filter Host Parents'
            results = session.virtwho_configure.read(name)
            for key, value in fields.items():
                assert results['overview'][key] == value
            session.virtwho_configure.edit(name, blacklist)
            results = session.virtwho_configure.read(name)
            del fields['filter_hosts_label']
            if hypervisor_type == 'esx':
                del fields['filter_host_parents_label']
                fields['exclude_host_parents_label'] = 'Exclude Host Parents'
            fields['exclude_hosts_label'] = 'Exclude Hosts'
            for key, value in fields.items():
                assert results['overview'][key] == value
            session.virtwho_configure.delete(name)
            assert not session.virtwho_configure.search(name)