def test_ssa_template(local_setup_provider, provider, soft_assert, vm_analysis_provisioning_data, appliance, ssa_profile): """ Tests SSA can be performed on a template Metadata: test_flag: vm_analysis """ template_name = vm_analysis_provisioning_data['image'] template = Template.factory(template_name, provider, template=True) template.smartstate_scan(wait_for_task_result=True) # Check release and quadricon quadicon_os_icon = template.find_quadicon().data['os'] view = navigate_to(template, 'Details') details_os_icon = view.entities.summary('Properties').get_text_of( 'Operating System') logger.info("Icons: {}, {}".format(details_os_icon, quadicon_os_icon)) c_users = view.entities.summary('Security').get_text_of('Users') c_groups = view.entities.summary('Security').get_text_of('Groups') c_packages = 0 if vm_analysis_provisioning_data['fs-type'] not in ['ntfs', 'fat32']: c_packages = view.entities.summary('Configuration').get_text_of( 'Packages') logger.info("SSA shows {} users, {} groups and {} packages".format( c_users, c_groups, c_packages)) if vm_analysis_provisioning_data['fs-type'] not in ['ntfs', 'fat32']: soft_assert(c_users != '0', "users: '{}' != '0'".format(c_users)) soft_assert(c_groups != '0', "groups: '{}' != '0'".format(c_groups)) soft_assert(c_packages != '0', "packages: '{}' != '0'".format(c_packages)) else: # Make sure windows-specific data is not empty c_patches = view.entities.summary('Security').get_text_of('Patches') c_applications = view.entities.summary('Configuration').get_text_of( 'Applications') c_win32_services = view.entities.summary('Configuration').get_text_of( 'Win32 Services') c_kernel_drivers = view.entities.summary('Configuration').get_text_of( 'Kernel Drivers') c_fs_drivers = view.entities.summary('Configuration').get_text_of( 'File System Drivers') soft_assert(c_patches != '0', "patches: '{}' != '0'".format(c_patches)) soft_assert(c_applications != '0', "applications: '{}' != '0'".format(c_applications)) soft_assert(c_win32_services != '0', "win32 services: '{}' != '0'".format(c_win32_services)) soft_assert(c_kernel_drivers != '0', "kernel drivers: '{}' != '0'".format(c_kernel_drivers)) soft_assert(c_fs_drivers != '0', "fs drivers: '{}' != '0'".format(c_fs_drivers))
def test_ssa_template(local_setup_provider, provider, soft_assert, vm_analysis_provisioning_data, appliance, ssa_profile): """ Tests SSA can be performed on a template Metadata: test_flag: vm_analysis """ template_name = vm_analysis_provisioning_data['image'] template = Template.factory(template_name, provider, template=True) template.smartstate_scan(wait_for_task_result=True) # Check release and quadricon quadicon_os_icon = template.find_quadicon().data['os'] view = navigate_to(template, 'Details') details_os_icon = view.entities.summary('Properties').get_text_of('Operating System') logger.info("Icons: {}, {}".format(details_os_icon, quadicon_os_icon)) c_users = view.entities.summary('Security').get_text_of('Users') c_groups = view.entities.summary('Security').get_text_of('Groups') c_packages = 0 if vm_analysis_provisioning_data['fs-type'] not in ['ntfs', 'fat32']: c_packages = view.entities.summary('Configuration').get_text_of('Packages') logger.info("SSA shows {} users, {} groups and {} packages".format( c_users, c_groups, c_packages)) if vm_analysis_provisioning_data['fs-type'] not in ['ntfs', 'fat32']: soft_assert(c_users != '0', "users: '{}' != '0'".format(c_users)) soft_assert(c_groups != '0', "groups: '{}' != '0'".format(c_groups)) soft_assert(c_packages != '0', "packages: '{}' != '0'".format(c_packages)) else: # Make sure windows-specific data is not empty c_patches = view.entities.summary('Security').get_text_of('Patches') c_applications = view.entities.summary('Configuration').get_text_of('Applications') c_win32_services = view.entities.summary('Configuration').get_text_of('Win32 Services') c_kernel_drivers = view.entities.summary('Configuration').get_text_of('Kernel Drivers') c_fs_drivers = view.entities.summary('Configuration').get_text_of('File System Drivers') soft_assert(c_patches != '0', "patches: '{}' != '0'".format(c_patches)) soft_assert(c_applications != '0', "applications: '{}' != '0'".format(c_applications)) soft_assert(c_win32_services != '0', "win32 services: '{}' != '0'".format(c_win32_services)) soft_assert(c_kernel_drivers != '0', "kernel drivers: '{}' != '0'".format(c_kernel_drivers)) soft_assert(c_fs_drivers != '0', "fs drivers: '{}' != '0'".format(c_fs_drivers))
def test_ssa_template(request, local_setup_provider, provider, soft_assert, vm_analysis_data): """ Tests SSA can be performed on a template Metadata: test_flag: vm_analysis """ template_name = vm_analysis_data['image'] template = Template.factory(template_name, provider, template=True) # Set credentials to all hosts set for this datastore if provider.type != 'openstack': datastore_name = vm_analysis_data['datastore'] test_datastore = datastore.Datastore(datastore_name, provider.key) host_list = cfme_data.get('management_systems', {})[provider.key].get('hosts', []) host_names = test_datastore.get_hosts() for host_name in host_names: test_host = host.Host(name=host_name) hosts_data = [x for x in host_list if x.name == host_name] if len(hosts_data) > 0: host_data = hosts_data[0] if not test_host.has_valid_credentials: creds = host.get_credentials_from_config(host_data['credentials']) test_host.update( updates={'credentials': creds}, validate_credentials=True ) template.smartstate_scan() wait_for(lambda: is_vm_analysis_finished(template_name), delay=15, timeout="10m", fail_func=lambda: toolbar.select('Reload')) # Check release and quadricon quadicon_os_icon = template.find_quadicon().os details_os_icon = template.get_detail( properties=('Properties', 'Operating System'), icon_href=True) logger.info("Icons: {}, {}".format(details_os_icon, quadicon_os_icon)) # We shouldn't use get_detail anymore - it takes too much time c_users = InfoBlock.text('Security', 'Users') c_groups = InfoBlock.text('Security', 'Groups') c_packages = 0 if vm_analysis_data['fs-type'] not in ['ntfs', 'fat32']: c_packages = InfoBlock.text('Configuration', 'Packages') logger.info("SSA shows {} users, {} groups and {} packages".format( c_users, c_groups, c_packages)) if vm_analysis_data['fs-type'] not in ['ntfs', 'fat32']: soft_assert(c_users != '0', "users: '{}' != '0'".format(c_users)) soft_assert(c_groups != '0', "groups: '{}' != '0'".format(c_groups)) soft_assert(c_packages != '0', "packages: '{}' != '0'".format(c_packages)) else: # Make sure windows-specific data is not empty c_patches = InfoBlock.text('Security', 'Patches') c_applications = InfoBlock.text('Configuration', 'Applications') c_win32_services = InfoBlock.text('Configuration', 'Win32 Services') c_kernel_drivers = InfoBlock.text('Configuration', 'Kernel Drivers') c_fs_drivers = InfoBlock.text('Configuration', 'File System Drivers') soft_assert(c_patches != '0', "patches: '{}' != '0'".format(c_patches)) soft_assert(c_applications != '0', "applications: '{}' != '0'".format(c_applications)) soft_assert(c_win32_services != '0', "win32 services: '{}' != '0'".format(c_win32_services)) soft_assert(c_kernel_drivers != '0', "kernel drivers: '{}' != '0'".format(c_kernel_drivers)) soft_assert(c_fs_drivers != '0', "fs drivers: '{}' != '0'".format(c_fs_drivers))
def test_ssa_template(request, local_setup_provider, provider, soft_assert, vm_analysis_data, appliance): """ Tests SSA can be performed on a template Metadata: test_flag: vm_analysis """ template_name = vm_analysis_data['image'] template = Template.factory(template_name, provider, template=True) # Set credentials to all hosts set for this datastore if provider.type in ['virtualcenter', 'rhevm']: datastore_name = vm_analysis_data['datastore'] datastore_collection = appliance.collections.datastores test_datastore = datastore_collection.instantiate(name=datastore_name, provider=provider) host_list = cfme_data.get('management_systems', {})[provider.key].get('hosts', []) host_names = [h.name for h in test_datastore.get_hosts()] for host_name in host_names: host_collection = appliance.collections.hosts test_host = host_collection.instantiate(name=host_name, provider=provider) hosts_data = [x for x in host_list if x.name == host_name] if len(hosts_data) > 0: host_data = hosts_data[0] if not test_host.has_valid_credentials: creds = host.get_credentials_from_config( host_data['credentials']) test_host.update(updates={'credentials': creds}, validate_credentials=True) template.smartstate_scan() wait_for(lambda: is_vm_analysis_finished(template_name), delay=15, timeout="35m", fail_func=lambda: toolbar.select('Reload')) # Check release and quadricon quadicon_os_icon = template.find_quadicon().data['os'] details_os_icon = template.get_detail(properties=('Properties', 'Operating System'), icon_href=True) logger.info("Icons: {}, {}".format(details_os_icon, quadicon_os_icon)) # We shouldn't use get_detail anymore - it takes too much time c_users = InfoBlock.text('Security', 'Users') c_groups = InfoBlock.text('Security', 'Groups') c_packages = 0 if vm_analysis_data['fs-type'] not in ['ntfs', 'fat32']: c_packages = InfoBlock.text('Configuration', 'Packages') logger.info("SSA shows {} users, {} groups and {} packages".format( c_users, c_groups, c_packages)) if vm_analysis_data['fs-type'] not in ['ntfs', 'fat32']: soft_assert(c_users != '0', "users: '{}' != '0'".format(c_users)) soft_assert(c_groups != '0', "groups: '{}' != '0'".format(c_groups)) soft_assert(c_packages != '0', "packages: '{}' != '0'".format(c_packages)) else: # Make sure windows-specific data is not empty c_patches = InfoBlock.text('Security', 'Patches') c_applications = InfoBlock.text('Configuration', 'Applications') c_win32_services = InfoBlock.text('Configuration', 'Win32 Services') c_kernel_drivers = InfoBlock.text('Configuration', 'Kernel Drivers') c_fs_drivers = InfoBlock.text('Configuration', 'File System Drivers') soft_assert(c_patches != '0', "patches: '{}' != '0'".format(c_patches)) soft_assert(c_applications != '0', "applications: '{}' != '0'".format(c_applications)) soft_assert(c_win32_services != '0', "win32 services: '{}' != '0'".format(c_win32_services)) soft_assert(c_kernel_drivers != '0', "kernel drivers: '{}' != '0'".format(c_kernel_drivers)) soft_assert(c_fs_drivers != '0', "fs drivers: '{}' != '0'".format(c_fs_drivers))