本文整理汇总了Python中cfme.intelligence.reports.reports.CannedSavedReport.new方法的典型用法代码示例。如果您正苦于以下问题:Python CannedSavedReport.new方法的具体用法?Python CannedSavedReport.new怎么用?Python CannedSavedReport.new使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cfme.intelligence.reports.reports.CannedSavedReport
的用法示例。
在下文中一共展示了CannedSavedReport.new方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_providers_summary
# 需要导入模块: from cfme.intelligence.reports.reports import CannedSavedReport [as 别名]
# 或者: from cfme.intelligence.reports.reports.CannedSavedReport import new [as 别名]
def test_providers_summary(soft_assert, setup_a_provider):
"""Checks some informations about the provider. Does not check memory/frequency as there is
presence of units and rounding."""
path = ["Configuration Management", "Providers", "Providers Summary"]
report = CannedSavedReport.new(path)
for provider in report.data.rows:
if any(ptype in provider["MS Type"] for ptype in {"ec2", "openstack"}): # Skip cloud
continue
provider_fake_obj = Provider(name=provider["Name"])
sel.force_navigate("infrastructure_provider", context={"provider": provider_fake_obj})
hostname = version.pick({
version.LOWEST: ("Hostname", "Hostname"),
"5.5": ("Host Name", "Hostname")})
soft_assert(
provider_props(hostname[0]) == provider[hostname[1]],
"Hostname does not match at {}".format(provider["Name"]))
if version.current_version() < "5.4":
# In 5.4, hostname and IP address are shared under Hostname (above)
soft_assert(
provider_props("IP Address") == provider["IP Address"],
"IP Address does not match at {}".format(provider["Name"]))
soft_assert(
provider_props("Aggregate Host CPU Cores") == provider["Total Number of Logical CPUs"],
"Logical CPU count does not match at {}".format(provider["Name"]))
soft_assert(
provider_props("Aggregate Host CPUs") == provider["Total Number of Physical CPUs"],
"Physical CPU count does not match at {}".format(provider["Name"]))
示例2: test_operations_vm_on
# 需要导入模块: from cfme.intelligence.reports.reports import CannedSavedReport [as 别名]
# 或者: from cfme.intelligence.reports.reports.CannedSavedReport import new [as 别名]
def test_operations_vm_on(soft_assert, appliance):
adb = appliance.db.client
vms = adb['vms']
hosts = adb['hosts']
storages = adb['storages']
path = ["Operations", "Virtual Machines", "Online VMs (Powered On)"]
report = CannedSavedReport.new(path)
vms_in_db = adb.session.query(
vms.name.label('vm_name'),
vms.location.label('vm_location'),
vms.last_scan_on.label('vm_last_scan'),
storages.name.label('storages_name'),
hosts.name.label('hosts_name')).join(
hosts, vms.host_id == hosts.id).join(
storages, vms.storage_id == storages.id).filter(
vms.power_state == 'on').order_by(vms.name).all()
assert len(vms_in_db) == len(list(report.data.rows))
for vm in vms_in_db:
store_path = '{}/{}'.format(vm.storages_name.encode('utf8'),
vm.vm_location.encode('utf8'))
for item in report.data.rows:
if vm.vm_name.encode('utf8') == item['VM Name']:
assert vm.hosts_name.encode('utf8') == item['Host']
assert vm.storages_name.encode('utf8') == item['Datastore']
assert store_path == item['Datastore Path']
assert (str(vm.vm_last_scan).encode('utf8') == item['Last Analysis Time'] or
(str(vm.vm_last_scan).encode('utf8') == 'None' and
item['Last Analysis Time'] == ''))
示例3: test_datastores_summary
# 需要导入模块: from cfme.intelligence.reports.reports import CannedSavedReport [as 别名]
# 或者: from cfme.intelligence.reports.reports.CannedSavedReport import new [as 别名]
def test_datastores_summary(soft_assert, appliance):
"""Checks Datastores Summary report with DB data. Checks all data in report, even rounded
storage sizes."""
adb = appliance.db.client
storages = adb['storages']
vms = adb['vms']
host_storages = adb['host_storages']
path = ["Configuration Management", "Storage", "Datastores Summary"]
report = CannedSavedReport.new(path)
storages_in_db = adb.session.query(storages.store_type, storages.free_space,
storages.total_space, storages.name, storages.id).all()
assert len(storages_in_db) == len(list(report.data.rows))
for store in storages_in_db:
number_of_vms = adb.session.query(vms.id).filter(
vms.storage_id == store.id).filter(
vms.template == 'f').count()
number_of_hosts = adb.session.query(host_storages.host_id).filter(
host_storages.storage_id == store.id).count()
for item in report.data.rows:
if store.name.encode('utf8') == item['Datastore Name']:
assert store.store_type.encode('utf8') == item['Type']
assert round_num(store.free_space) == extract_num(item['Free Space'])
assert round_num(store.total_space) == extract_num(item['Total Space'])
assert int(number_of_hosts) == int(item['Number of Hosts'])
assert int(number_of_vms) == int(item['Number of VMs'])
示例4: test_reports_generate_report
# 需要导入模块: from cfme.intelligence.reports.reports import CannedSavedReport [as 别名]
# 或者: from cfme.intelligence.reports.reports.CannedSavedReport import new [as 别名]
def test_reports_generate_report(request, path):
""" This Tests run one default report for each category
Steps:
*Run one default report
*Delete this Saved Report from the Database
"""
report = CannedSavedReport.new(path)
request.addfinalizer(report.delete_if_exists)
示例5: report
# 需要导入模块: from cfme.intelligence.reports.reports import CannedSavedReport [as 别名]
# 或者: from cfme.intelligence.reports.reports.CannedSavedReport import new [as 别名]
def report():
# TODO parameterize on path, for now test infrastructure reports
path = ["Configuration Management", "Hosts", "Virtual Infrastructure Platforms"]
report = CannedSavedReport.new(path)
report_time = report.datetime
logger.debug('Created report for path {} and time {}'.format(path, report_time))
yield report
try:
report.delete()
except Exception:
logger.warning('Failed to delete report for path {} and time {}'.format(path, report_time))
示例6: test_report_page_per_item
# 需要导入模块: from cfme.intelligence.reports.reports import CannedSavedReport [as 别名]
# 或者: from cfme.intelligence.reports.reports.CannedSavedReport import new [as 别名]
def test_report_page_per_item(setup_a_provider, set_report):
""" Tests report items per page
Metadata:
test_flag: visuals
"""
path = ["Configuration Management", "Virtual Machines", "VMs Snapshot Summary"]
limit = visual.report_view_limit
report = CannedSavedReport.new(path)
report.navigate()
if int(paginator.rec_total()) >= int(limit):
assert int(paginator.rec_end()) == int(limit), "Reportview Failed!"
示例7: test_infra_report_page_per_item
# 需要导入模块: from cfme.intelligence.reports.reports import CannedSavedReport [as 别名]
# 或者: from cfme.intelligence.reports.reports.CannedSavedReport import new [as 别名]
def test_infra_report_page_per_item(value, set_report):
""" Tests report items per page
Metadata:
test_flag: visuals
"""
visual.report_view_limit = value
path = ["Configuration Management", "Virtual Machines", "VMs Snapshot Summary"]
limit = visual.report_view_limit
report = CannedSavedReport.new(path)
view = navigate_to(report, 'Details')
max_item = view.paginator.max_item
item_amt = view.paginator.items_amount
if int(item_amt) >= int(limit):
assert int(max_item) == int(limit), "Reportview Failed!"
assert int(max_item) <= int(item_amt)
示例8: test_cluster_relationships
# 需要导入模块: from cfme.intelligence.reports.reports import CannedSavedReport [as 别名]
# 或者: from cfme.intelligence.reports.reports.CannedSavedReport import new [as 别名]
def test_cluster_relationships(soft_assert, setup_a_provider):
path = ["Relationships", "Virtual Machines, Folders, Clusters", "Cluster Relationships"]
report = CannedSavedReport.new(path)
for relation in report.data.rows:
name = relation["Name"]
provider_name = relation["Provider Name"]
provider = provider_factory_by_name(provider_name)
host_name = relation["Host Name"]
soft_assert(name in provider.list_cluster(), "Cluster {} not found in {}".format(
name, provider_name
))
for host in provider.list_host():
if host_name in host or host in host_name: # Tends to get truncated and so
break
else:
soft_assert(False, "Hostname {} not found in {}".format(host_name, provider_name))
示例9: test_cluster_relationships
# 需要导入模块: from cfme.intelligence.reports.reports import CannedSavedReport [as 别名]
# 或者: from cfme.intelligence.reports.reports.CannedSavedReport import new [as 别名]
def test_cluster_relationships(soft_assert, setup_a_provider):
path = ["Relationships", "Virtual Machines, Folders, Clusters", "Cluster Relationships"]
report = CannedSavedReport.new(path)
for relation in report.data.rows:
name = relation["Name"]
provider_name = relation["Provider Name"]
if not provider_name.strip():
# If no provider name specified, ignore it
continue
provider = get_mgmt_by_name(provider_name)
host_name = relation["Host Name"].strip()
soft_assert(name in provider.list_cluster(), "Cluster {} not found in {}".format(
name, provider_name
))
if not host_name:
continue # No host name
host_ip = resolve_hostname(host_name, force=True)
if host_ip is None:
# Don't check
continue
for host in provider.list_host():
if ip_address.match(host) is None:
host_is_ip = False
ip_from_provider = resolve_hostname(host, force=True)
else:
host_is_ip = True
ip_from_provider = host
if not host_is_ip:
# Strings first
if host == host_name:
break
elif host_name.startswith(host):
break
elif ip_from_provider is not None and ip_from_provider == host_ip:
break
else:
if host_ip == ip_from_provider:
break
else:
soft_assert(False, "Hostname {} not found in {}".format(host_name, provider_name))
示例10: test_providers_summary
# 需要导入模块: from cfme.intelligence.reports.reports import CannedSavedReport [as 别名]
# 或者: from cfme.intelligence.reports.reports.CannedSavedReport import new [as 别名]
def test_providers_summary(soft_assert):
"""Checks some informations about the provider. Does not check memory/frequency as there is
presence of units and rounding."""
path = ["Configuration Management", "Providers", "Providers Summary"]
report = CannedSavedReport.new(path)
for provider in report.data.rows:
if any(ptype in provider["MS Type"] for ptype in {"ec2", "openstack"}): # Skip cloud
continue
details_view = navigate_to(InfraProvider(name=provider["Name"]), 'Details')
props = details_view.entities.properties
hostname = ("Host Name", "Hostname")
soft_assert(props.get_text_of(hostname[0]) == provider[hostname[1]],
"Hostname does not match at {}".format(provider["Name"]))
cpu_cores = props.get_text_of("Aggregate Host CPU Cores")
soft_assert(cpu_cores == provider["Total Number of Logical CPUs"],
"Logical CPU count does not match at {}".format(provider["Name"]))
host_cpu = props.get_text_of("Aggregate Host CPUs")
soft_assert(host_cpu == provider["Total Number of Physical CPUs"],
"Physical CPU count does not match at {}".format(provider["Name"]))
示例11: test_tabular_view
# 需要导入模块: from cfme.intelligence.reports.reports import CannedSavedReport [as 别名]
# 或者: from cfme.intelligence.reports.reports.CannedSavedReport import new [as 别名]
def test_tabular_view(request, setup_a_provider):
path = ["Configuration Management", "Hosts", "Virtual Infrastructure Platforms"]
report = CannedSavedReport.new(path)
report.navigate()
tb.select('Tabular View')
assert tb.is_active('Tabular View'), "Tabular view setting failed"
示例12: test_graph_view
# 需要导入模块: from cfme.intelligence.reports.reports import CannedSavedReport [as 别名]
# 或者: from cfme.intelligence.reports.reports.CannedSavedReport import new [as 别名]
def test_graph_view(request, setup_a_provider):
path = ["Configuration Management", "Hosts", "Virtual Infrastructure Platforms"]
report = CannedSavedReport.new(path)
report.navigate()
tb.set_vms_graph_view()
assert tb.is_vms_graph_view(), "Graph view setting failed"