def test_cluster_graph_screen(provider, cluster, host, graph_type, interval, enable_candu): """Test Cluster graphs for Hourly and Daily Interval prerequisites: * C&U enabled appliance Steps: * Navigate to Cluster * Check graph displayed or not * Select interval Hourly/Daily * Zoom graph to get Table * Compare table and graph data Polarion: assignee: gtalreja caseimportance: medium casecomponent: CandU initialEstimate: 1/4h """ host.capture_historical_data() cluster.wait_candu_data_available(timeout=1200) view = navigate_to(cluster, "Utilization") view.options.interval.fill(interval) # Check garph displayed or not try: graph = getattr(view, graph_type) except AttributeError as e: logger.error(e) assert graph.is_displayed def refresh(): provider.browser.refresh() view.options.interval.fill(interval) # wait, some time graph take time to load wait_for(lambda: len(graph.all_legends) > 0, delay=5, timeout=200, fail_func=refresh) # zoom in button not available with normal graph except Host and VM. # We have to use vm or host average graph for zoom in operation. graph_zoom = ["cluster_host", "cluster_vm"] avg_graph = graph_type if graph_type in graph_zoom else f"{graph_type}_vm_host_avg" try: avg_graph = getattr(view, avg_graph) except AttributeError as e: logger.error(e) avg_graph.zoom_in() view = view.browser.create_view(UtilizationZoomView) # wait, some time graph take time to load wait_for(lambda: len(view.chart.all_legends) > 0, delay=5, timeout=300, fail_func=refresh) assert view.chart.is_displayed view.flush_widget_cache() legends = view.chart.all_legends graph_data = view.chart.all_data # Clear cache of table widget before read else it will mismatch headers. view.table.clear_cache() table_data = view.table.read() compare_data(table_data=table_data, graph_data=graph_data, legends=legends)
def test_cluster_graph_screen(provider, cluster, host, graph_type, interval, enable_candu): """Test Cluster graphs for Hourly and Daily Interval prerequisites: * C&U enabled appliance Steps: * Navigate to Cluster * Check graph displayed or not * Select interval Hourly/Daily * Zoom graph to get Table * Compare table and graph data Polarion: assignee: nachandr caseimportance: medium casecomponent: CandU initialEstimate: 1/4h """ host.capture_historical_data() cluster.wait_candu_data_available(timeout=1200) view = navigate_to(cluster, "Utilization") view.options.interval.fill(interval) # Check garph displayed or not try: graph = getattr(view, graph_type) except AttributeError as e: logger.error(e) assert graph.is_displayed def refresh(): provider.browser.refresh() view.options.interval.fill(interval) # wait, some time graph take time to load wait_for(lambda: len(graph.all_legends) > 0, delay=5, timeout=200, fail_func=refresh) # zoom in button not available with normal graph except Host and VM. # We have to use vm or host average graph for zoom in operation. graph_zoom = ["cluster_host", "cluster_vm"] avg_graph = graph_type if graph_type in graph_zoom else "{}_vm_host_avg".format(graph_type) try: avg_graph = getattr(view, avg_graph) except AttributeError as e: logger.error(e) avg_graph.zoom_in() view = view.browser.create_view(UtilizationZoomView) # wait, some time graph take time to load wait_for(lambda: len(view.chart.all_legends) > 0, delay=5, timeout=300, fail_func=refresh) assert view.chart.is_displayed view.flush_widget_cache() legends = view.chart.all_legends graph_data = view.chart.all_data # Clear cache of table widget before read else it will mismatch headers. view.table.clear_cache() table_data = view.table.read() compare_data(table_data=table_data, graph_data=graph_data, legends=legends)
def test_vm_graph_screen(provider, interval, graph_type, enable_candu): """Test VM graphs for hourly and Daily prerequisites: * C&U enabled appliance Steps: * Navigate to VM (cu-24x7) Utilization Page * Check graph displayed or not * Zoom graph * Compare data of Table and Graph Polarion: assignee: gtalreja caseimportance: medium initialEstimate: 1/4h casecomponent: CandU """ collection = provider.appliance.provider_based_collection(provider) vm = collection.instantiate('cu-24x7', provider) if not provider.one_of(CloudProvider): wait_for(vm.capture_historical_data, delay=20, timeout=1000, message="wait for capturing VM historical data") vm.wait_candu_data_available(timeout=1200) view = navigate_to(vm, 'candu') view.options.interval.fill(interval) try: graph = getattr(view, graph_type) except AttributeError as e: logger.error(e) assert graph.is_displayed def refresh(): provider.browser.refresh() view = navigate_to(vm, 'candu') view.options.interval.fill(interval) # wait, some time graph took time to load wait_for(lambda: len(graph.all_legends) > 0, delay=5, timeout=600, fail_func=refresh) graph.zoom_in() view = view.browser.create_view(UtilizationZoomView) assert view.chart.is_displayed graph_data = view.chart.all_data # Clear cache of table widget before read else it will mismatch headers. view.table.clear_cache() table_data = view.table.read() legends = view.chart.all_legends compare_data(table_data=table_data, graph_data=graph_data, legends=legends)
def test_vm_graph_screen(provider, interval, graph_type, enable_candu): """Test VM graphs for hourly and Daily prerequisites: * C&U enabled appliance Steps: * Navigate to VM (cu-24x7) Utilization Page * Check graph displayed or not * Zoom graph * Compare data of Table and Graph Polarion: assignee: nachandr caseimportance: medium initialEstimate: 1/4h casecomponent: CandU """ collection = provider.appliance.provider_based_collection(provider) vm = collection.instantiate('cu-24x7', provider) if not provider.one_of(CloudProvider): wait_for( vm.capture_historical_data, delay=20, timeout=1000, message="wait for capturing VM historical data" ) vm.wait_candu_data_available(timeout=1200) view = navigate_to(vm, 'candu') view.options.interval.fill(interval) try: graph = getattr(view, graph_type) except AttributeError as e: logger.error(e) assert graph.is_displayed def refresh(): provider.browser.refresh() view = navigate_to(vm, 'candu') view.options.interval.fill(interval) # wait, some time graph took time to load wait_for(lambda: len(graph.all_legends) > 0, delay=5, timeout=600, fail_func=refresh) graph.zoom_in() view = view.browser.create_view(UtilizationZoomView) assert view.chart.is_displayed graph_data = view.chart.all_data # Clear cache of table widget before read else it will mismatch headers. view.table.clear_cache() table_data = view.table.read() legends = view.chart.all_legends compare_data(table_data=table_data, graph_data=graph_data, legends=legends)
def test_graph_screen(provider, interval, graph_type, host, enable_candu): """Test Host graphs for hourly and Daily prerequisites: * C&U enabled appliance Steps: * Navigate to Host Utilization Page * Check graph displayed or not * Select interval(Hourly or Daily) * Zoom graph to get Table * Compare table and graph data """ wait_for( host.capture_historical_data, delay=20, timeout=1000, message="wait for capturing host historical data") host.wait_candu_data_available(timeout=1200) view = navigate_to(host, 'candu') view.options.interval.fill(interval) # Check garph displayed or not try: graph = getattr(view.interval_type, graph_type) except AttributeError as e: logger.error(e) assert graph.is_displayed def refresh(): provider.browser.refresh() view.options.interval.fill(interval) # wait, some time graph take time to load wait_for(lambda: len(graph.all_legends) > 0, delay=5, timeout=200, fail_func=refresh) # zoom in button not available with normal graph in Host Utilization page. # We have to use vm average graph for zoom in operation. try: vm_avg_graph = getattr(view.interval_type, "{}_vm_avg".format(graph_type)) except AttributeError as e: logger.error(e) vm_avg_graph.zoom_in() view = view.browser.create_view(UtilizationZoomView) # wait, some time graph take time to load wait_for(lambda: len(view.chart.all_legends) > 0, delay=5, timeout=300, fail_func=refresh) assert view.chart.is_displayed view.flush_widget_cache() legends = view.chart.all_legends graph_data = view.chart.all_data # Clear cache of table widget before read else it will mismatch headers. view.table.clear_cache() table_data = view.table.read() compare_data(table_data=table_data, graph_data=graph_data, legends=legends)
def test_azone_graph_screen(provider, azone, graph_type, interval, enable_candu): """Test Availibility zone graphs for Hourly prerequisites: * C&U enabled appliance Steps: * Navigate to Availibility Zone Utilization Page * Check graph displayed or not * Select interval Hourly * Zoom graph to get Table * Compare table and graph data Polarion: assignee: nachandr caseimportance: medium initialEstimate: 1/4h """ azone.wait_candu_data_available(timeout=1200) view = navigate_to(azone, "Utilization") view.options.interval.fill(interval) # Check garph displayed or not try: graph = getattr(view, graph_type) except AttributeError as e: logger.error(e) assert graph.is_displayed def refresh(): provider.browser.refresh() view.options.interval.fill(interval) # wait, some time graph take time to load wait_for(lambda: len(graph.all_legends) > 0, delay=5, timeout=200, fail_func=refresh) # zoom in button not available with normal graph except Instance in Azone Utilization page. # We have to use vm average graph for zoom in operation. avg_graph = graph_type if graph_type == "azone_instance" else "{}_avg".format(graph_type) try: avg_graph = getattr(view, avg_graph) except AttributeError as e: logger.error(e) avg_graph.zoom_in() view = view.browser.create_view(UtilizationZoomView) # wait, some time graph take time to load wait_for(lambda: len(view.chart.all_legends) > 0, delay=5, timeout=300, fail_func=refresh) assert view.chart.is_displayed view.flush_widget_cache() legends = view.chart.all_legends graph_data = view.chart.all_data # Clear cache of table widget before read else it will mismatch headers. view.table.clear_cache() table_data = view.table.read() compare_data(table_data=table_data, graph_data=graph_data, legends=legends)
def test_graph_screen(provider, azone, graph_type, interval, enable_candu): """Test Availibility zone graphs for Hourly prerequisites: * C&U enabled appliance Steps: * Navigate to Availibility Zone Utilization Page * Check graph displayed or not * Select interval Hourly * Zoom graph to get Table * Compare table and graph data Polarion: assignee: nachandr caseimportance: medium initialEstimate: 1/4h """ azone.wait_candu_data_available(timeout=1200) view = navigate_to(azone, "Utilization") view.options.interval.fill(interval) # Check garph displayed or not try: graph = getattr(view, graph_type) except AttributeError as e: logger.error(e) assert graph.is_displayed def refresh(): provider.browser.refresh() view.options.interval.fill(interval) # wait, some time graph take time to load wait_for(lambda: len(graph.all_legends) > 0, delay=5, timeout=200, fail_func=refresh) # zoom in button not available with normal graph except Instance in Azone Utilization page. # We have to use vm average graph for zoom in operation. avg_graph = graph_type if graph_type == "azone_instance" else "{}_avg".format(graph_type) try: avg_graph = getattr(view, avg_graph) except AttributeError as e: logger.error(e) avg_graph.zoom_in() view = view.browser.create_view(UtilizationZoomView) # wait, some time graph take time to load wait_for(lambda: len(view.chart.all_legends) > 0, delay=5, timeout=300, fail_func=refresh) assert view.chart.is_displayed view.flush_widget_cache() legends = view.chart.all_legends graph_data = view.chart.all_data # Clear cache of table widget before read else it will mismatch headers. view.table.clear_cache() table_data = view.table.read() compare_data(table_data=table_data, graph_data=graph_data, legends=legends)
def test_datastore_graph_screen(provider, interval, graph_type, enable_candu): """Test Datastore graphs for hourly prerequisites: * C&U enabled appliance Steps: * Navigate to Datastore Utilization Page * Check graph displayed or not * Select interval Hourly * Zoom graph to get Table * Compare table and graph data Polarion: assignee: nachandr caseimportance: medium casecomponent: CandU initialEstimate: 1/4h """ vm_collection = provider.appliance.provider_based_collection(provider) vm = vm_collection.instantiate("cu-24x7", provider) datastore = vm.datastore datastore.wait_candu_data_available(timeout=1500) view = navigate_to(datastore, "Utilization") view.options.interval.fill(interval) # Check graph displayed or not try: graph = getattr(view.interval_type, graph_type) except AttributeError as e: logger.error(e) assert graph.is_displayed def refresh(): provider.browser.refresh() view.options.interval.fill(interval) # wait, some time graph take time to load wait_for(lambda: bool(graph.all_legends), delay=5, timeout=200, fail_func=refresh) graph.zoom_in() view = view.browser.create_view(UtilizationZoomView) assert view.chart.is_displayed view.flush_widget_cache() legends = view.chart.all_legends graph_data = view.chart.all_data # Clear cache of table widget before read else it will mismatch headers. view.table.clear_cache() table_data = view.table.read() compare_data(table_data=table_data, graph_data=graph_data, legends=legends)
def test_datastore_graph_screen(provider, interval, graph_type, enable_candu): """Test Datastore graphs for hourly prerequisites: * C&U enabled appliance Steps: * Navigate to Datastore Utilization Page * Check graph displayed or not * Select interval Hourly * Zoom graph to get Table * Compare table and graph data Polarion: assignee: nachandr caseimportance: medium casecomponent: CandU initialEstimate: 1/4h """ vm_collection = provider.appliance.provider_based_collection(provider) vm = vm_collection.instantiate("cu-24x7", provider) datastore = vm.datastore datastore.wait_candu_data_available(timeout=1500) view = navigate_to(datastore, "Utilization") view.options.interval.fill(interval) # Check graph displayed or not try: graph = getattr(view.interval_type, graph_type) except AttributeError as e: logger.error(e) assert graph.is_displayed def refresh(): provider.browser.refresh() view.options.interval.fill(interval) # wait, some time graph take time to load wait_for(lambda: bool(graph.all_legends), delay=5, timeout=200, fail_func=refresh) graph.zoom_in() view = view.browser.create_view(UtilizationZoomView) assert view.chart.is_displayed view.flush_widget_cache() legends = view.chart.all_legends graph_data = view.chart.all_data # Clear cache of table widget before read else it will mismatch headers. view.table.clear_cache() table_data = view.table.read() compare_data(table_data=table_data, graph_data=graph_data, legends=legends)
def test_graph_screen(provider, interval, graph_type, host, enable_candu): """Test Host graphs for hourly and Daily prerequisites: * C&U enabled appliance Steps: * Navigate to Host Utilization Page * Check graph displayed or not * Select interval(Hourly or Daily) * Zoom graph to get Table * Compare table and graph data """ wait_for(host.capture_historical_data, delay=20, timeout=1000, message="wait for capturing host historical data") host.wait_candu_data_available(timeout=1200) view = navigate_to(host, 'candu') view.options.interval.fill(interval) # Check garph displayed or not try: graph = getattr(view.interval_type, graph_type) except AttributeError as e: logger.error(e) assert graph.is_displayed def refresh(): provider.browser.refresh() view.options.interval.fill(interval) # wait, some time graph take time to load wait_for(lambda: len(graph.all_legends) > 0, delay=5, timeout=200, fail_func=refresh) # zoom in button not available with normal graph in Host Utilization page. # We have to use vm average graph for zoom in operation. try: vm_avg_graph = getattr(view.interval_type, "{}_vm_avg".format(graph_type)) except AttributeError as e: logger.error(e) vm_avg_graph.zoom_in() view = view.browser.create_view(UtilizationZoomView) # wait, some time graph take time to load wait_for(lambda: len(view.chart.all_legends) > 0, delay=5, timeout=300, fail_func=refresh) assert view.chart.is_displayed view.flush_widget_cache() legends = view.chart.all_legends graph_data = view.chart.all_data # Clear cache of table widget before read else it will mismatch headers. view.table.clear_cache() table_data = view.table.read() compare_data(table_data=table_data, graph_data=graph_data, legends=legends)