Пример #1
0
    def test_analyze_vm(self, provider, vm_to_analyze, fs_type, register_event):
        """Test scanning a VM"""
        vm_details = nav_to_vm_details(provider, vm_to_analyze)
        self.verify_no_data(provider, vm_to_analyze)
        last_analysis_time = vm_details.details.get_section('Lifecycle').get_item(
            'Last Analyzed').value
        register_event(cfme_data['management_systems'][provider]['type'], 'vm', vm_to_analyze,
            ['vm_analysis_request', 'vm_analysis_start', 'vm_analysis_complete'])
        logger.info('Initiating vm smart scan on ' + provider + ":" + vm_to_analyze)
        vm_details.config_button.perform_smart_state_analysis()
        Assert.true(vm_details.flash.message.startswith("Smart State Analysis initiated"))

        # wait for task to complete
        tasks_pg = nav.cnf_tasks_pg()
        self.is_vm_analysis_finished(tasks_pg, vm_to_analyze)

        # Then delete the tasks
        tasks_pg.task_buttons.delete_all()

        # back to vm_details
        logger.info('Checking vm details metadata...')
        vm_details = nav_to_vm_details(provider, vm_to_analyze)
        yaml_vm_os = cfme_data["test_vm_analysis"][provider][vm_to_analyze]["os"]

        # check users/group counts
        assert vm_details.details.get_section('Security').get_item('Users').value != '0',\
            'No users found in VM detail'

        assert vm_details.details.get_section('Security').get_item('Groups').value != '0',\
            'No groups found in VM detail'

        # check advanced settings
        if cfme_data['management_systems'][provider]['type'] == 'virtualcenter':
            assert vm_details.details.get_section('Properties').get_item(
                'Advanced Settings').value != "0"

        # assert last analyze time
        assert vm_details.details.get_section('Lifecycle').get_item(
            'Last Analyzed').value != last_analysis_time

        # drift history
        assert vm_details.details.get_section('Relationships').get_item(
            'Drift History').value == "1"

        # analysis history
        assert vm_details.details.get_section('Relationships').get_item(
            'Analysis History').value == "1"

        # check OS
        assert (vm_details.details.get_section('Properties').get_item('Operating System').value ==
            cfme_data["test_vm_analysis"][provider][vm_to_analyze]["os"])

        # check os specific values
        if "Fedora" in yaml_vm_os or "Linux" in yaml_vm_os:
            assert vm_details.details.get_section('Configuration').get_item(
                'Packages').value != "1"
            assert vm_details.details.get_section('Configuration').get_item(
                'Init Processes').value != "1"
        elif "Windows" in yaml_vm_os:
            assert vm_details.details.get_section('Security').get_item(
                'Patches').value != "0"
            assert vm_details.details.get_section('Configuration').get_item(
                'Applications').value != "0"
            assert vm_details.details.get_section('Configuration').get_item(
                'Win32 Services').value != "0"
            assert vm_details.details.get_section('Configuration').get_item(
                'Kernel Drivers').value != "0"
            assert vm_details.details.get_section('Configuration').get_item(
                'File System Drivers').value != "0"

        logger.info('Checking vm operating system icons...')
        details_os_icon = vm_details.details.get_section('Properties').get_item(
            'Operating System').icon_href
        provider_details = nav.infra_providers_pg().load_provider_details(
            cfme_data["management_systems"][provider]["name"])
        all_vms = provider_details.all_vms()
        all_vms.find_vm_page(vm_to_analyze, None, False, False, 6)
        quadicon_os_icon = all_vms.quadicon_region.get_quadicon_by_title(
            vm_to_analyze).os

        # check os icon images
        yaml_vm_os = cfme_data["test_vm_analysis"][provider][vm_to_analyze]["os"]
        if "Red Hat Enterprise Linux" in yaml_vm_os:
            assert "os-linux_redhat.png" in details_os_icon
            assert "linux_redhat" in quadicon_os_icon
        elif "Windows" in yaml_vm_os:
            assert "os-windows_generic.png" in details_os_icon
            assert "windows_generic" in quadicon_os_icon
        elif "Fedora" in yaml_vm_os:
            assert "os-linux_fedora.png" in details_os_icon
            assert "linux_fedora" in quadicon_os_icon
Пример #2
0
    def test_analyze_vm(self, provider, vm_to_analyze, fs_type,
                        register_event):
        """Test scanning a VM"""
        vm_details = nav_to_vm_details(provider, vm_to_analyze)
        self.verify_no_data(provider, vm_to_analyze)
        last_analysis_time = vm_details.details.get_section(
            'Lifecycle').get_item('Last Analyzed').value
        register_event(cfme_data['management_systems'][provider]['type'], 'vm',
                       vm_to_analyze, [
                           'vm_analysis_request', 'vm_analysis_start',
                           'vm_analysis_complete'
                       ])
        logger.info('Initiating vm smart scan on ' + provider + ":" +
                    vm_to_analyze)
        vm_details.config_button.perform_smart_state_analysis()
        Assert.true(
            vm_details.flash.message.startswith(
                "Smart State Analysis initiated"))

        # wait for task to complete
        tasks_pg = nav.cnf_tasks_pg()
        self.is_vm_analysis_finished(tasks_pg, vm_to_analyze)

        # Then delete the tasks
        tasks_pg.task_buttons.delete_all()

        # back to vm_details
        logger.info('Checking vm details metadata...')
        vm_details = nav_to_vm_details(provider, vm_to_analyze)
        yaml_vm_os = cfme_data["test_vm_analysis"][provider][vm_to_analyze][
            "os"]

        # check users/group counts
        assert vm_details.details.get_section('Security').get_item('Users').value != '0',\
            'No users found in VM detail'

        assert vm_details.details.get_section('Security').get_item('Groups').value != '0',\
            'No groups found in VM detail'

        # check advanced settings
        if cfme_data['management_systems'][provider][
                'type'] == 'virtualcenter':
            assert vm_details.details.get_section('Properties').get_item(
                'Advanced Settings').value != "0"

        # assert last analyze time
        assert vm_details.details.get_section('Lifecycle').get_item(
            'Last Analyzed').value != last_analysis_time

        # drift history
        assert vm_details.details.get_section('Relationships').get_item(
            'Drift History').value == "1"

        # analysis history
        assert vm_details.details.get_section('Relationships').get_item(
            'Analysis History').value == "1"

        # check OS
        assert (vm_details.details.get_section('Properties').get_item(
            'Operating System').value == cfme_data["test_vm_analysis"]
                [provider][vm_to_analyze]["os"])

        # check os specific values
        if "Fedora" in yaml_vm_os or "Linux" in yaml_vm_os:
            assert vm_details.details.get_section('Configuration').get_item(
                'Packages').value != "1"
            assert vm_details.details.get_section('Configuration').get_item(
                'Init Processes').value != "1"
        elif "Windows" in yaml_vm_os:
            assert vm_details.details.get_section('Security').get_item(
                'Patches').value != "0"
            assert vm_details.details.get_section('Configuration').get_item(
                'Applications').value != "0"
            assert vm_details.details.get_section('Configuration').get_item(
                'Win32 Services').value != "0"
            assert vm_details.details.get_section('Configuration').get_item(
                'Kernel Drivers').value != "0"
            assert vm_details.details.get_section('Configuration').get_item(
                'File System Drivers').value != "0"

        logger.info('Checking vm operating system icons...')
        details_os_icon = vm_details.details.get_section(
            'Properties').get_item('Operating System').icon_href
        provider_details = nav.infra_providers_pg().load_provider_details(
            cfme_data["management_systems"][provider]["name"])
        all_vms = provider_details.all_vms()
        all_vms.find_vm_page(vm_to_analyze, None, False, False, 6)
        quadicon_os_icon = all_vms.quadicon_region.get_quadicon_by_title(
            vm_to_analyze).os

        # check os icon images
        yaml_vm_os = cfme_data["test_vm_analysis"][provider][vm_to_analyze][
            "os"]
        if "Red Hat Enterprise Linux" in yaml_vm_os:
            assert "os-linux_redhat.png" in details_os_icon
            assert "linux_redhat" in quadicon_os_icon
        elif "Windows" in yaml_vm_os:
            assert "os-windows_generic.png" in details_os_icon
            assert "windows_generic" in quadicon_os_icon
        elif "Fedora" in yaml_vm_os:
            assert "os-linux_fedora.png" in details_os_icon
            assert "linux_fedora" in quadicon_os_icon
Пример #3
0
def delete_tasks_first():
    '''Delete any existing tasks within the UI before running tests'''
    tasks_pg = nav.cnf_tasks_pg()
    tasks_pg.task_buttons.delete_all()
Пример #4
0
def delete_tasks_first():
    '''Delete any existing tasks within the UI before running tests'''
    tasks_pg = nav.cnf_tasks_pg()
    tasks_pg.task_buttons.delete_all()