예제 #1
0
    def test_powerdown_vm_normally(self):
        u'''删除指定的已经存在虚拟机'''
        #
        # The id starts from 1.
        vm_id = 4   
        vm_name = "AutoTest_VM%02d" % vm_id
        vm_name = "PD3_Cluster_VM123"
        host_name = "localhost"


        '''
        Find the virtual machine first,
        Then, decide if it is running.
        If yes, shutdown the virtual machine.
        The third is to delete it.
        And at the same to watch history or task bar to detect if the deletion is running or finished.  
        
        '''
        
        # Step 1: Login and pass in with username, password, server and port
        pd_client_browser = self.pd_login()
        time.sleep(TestSpeedControl.TEST_STEP_INTERVAL)
        self.pd_client_browser = pd_client_browser
        
        # Step 2: Make sure the host resource tab is selected
        PD_DebugLog.stepinfo("click and select the host resource tab")
        
        pd_browser_main_map = Main_Browser_UIMap(pd_client_browser)
        self.pd_browser_main_map = pd_browser_main_map
        
        platform_resource_tab = pd_browser_main_map.get_platform_resource_tab()
        platform_resource_tab.click()
        time.sleep(TestSpeedControl.TEST_STEP_INTERVAL)
        
        # Step 3: Got the directory tree frame and check all the levels
        # travel around the leaves elements
        sub_tree = pd_browser_main_map.get_platform_sub_menu_tree()
        
        if type(sub_tree) is list:
            sub_menu_tree_elem = sub_tree[0]
        else:
            sub_menu_tree_elem = sub_tree
            
        platform_tree = Submenu_Tree(sub_menu_tree_elem)
        
        PD_DebugLog.debug_print("The tree id is: " + platform_tree.get_submenu_tree_id())
        
        tree_node = TreeNode(sub_menu_tree_elem)
        elemts = tree_node.get_all_child_nodes()
        
        if type(elemts) is list:
            fst_lvl_node_elm = elemts[0]
        else:
            fst_lvl_node_elm = elemts
        fst_lvl_node = TreeNode(fst_lvl_node_elm)
        PD_DebugLog.info_print("First level child node text is :" + fst_lvl_node.get_node_title() )      
        
        #platform_tree.travel_around_child_nodes()
        utils_misc.set_script_timeout(pd_client_browser, 0.2)
        pd_client_browser.implicitly_wait(6)
        elem = platform_tree.find_element_by_vmname(vm_name)
        if elem:
            elem_node = TreeNode(elem[0])
            PD_DebugLog.info_print("Find the elem, the title is " + elem_node.get_node_title())
            elem_node.click()
        time.sleep(TestSpeedControl.TEST_STEP_INTERVAL)
        
        utils_misc.restore_script_timeout(pd_client_browser)
        
        vm_summary_page = VM_Summary_UIMap(pd_client_browser)
        
        #task_startup_abouttime = time.time()
        # The testcase running machine time is not same as the AIX machine under test.  
        vm_summary_page.execute_powerdown_system(True)
        
        # Step 4: Check the vm current status, it would turn into "in shutdown progress"
        check_return = utils_misc.wait_for(vm_summary_page.is_vm_in_powerdown_progress, 10, 0.2, 0.1, "Check if vm goes into shutdown status")
        self.assert_(check_return, "After execution of shutdown action, vm must go into 'in shutdown progess'")
        
        if check_return:
            # find the task item to get the item information: starttime, name and description
            # Then to watch when it disappears
            # The end, check it in the history of task to get the final status, success or fail.
            # If it failed, get the failure description.
            
            # Step 5: to check task status and wait the task finishes
            # if popup_task is not open, click the button again
            
            task_type = u'断电'
            utils_misc.wait_for(self.shutdown_task_appears, 10, 0, 0.1, "Shutdown vm task should appear in current tasks list")
            taskstarttime = self.get_task_starttime(task_type, vm_name, host_name)
            utils_misc.wait_for(self.shutdown_task_disappears, 10, 0, 0.1, "Shutdown vm task should finish and go into the history tasks list")
            status,fail_desc = self.get_task_status_from_history_task(task_type, vm_name, host_name, taskstarttime)

            if status == Messages.FAIL_STATUS_STR:
                self.fail("The task failed: " + fail_desc)
            else:
                PD_DebugLog.debug_print("The task finished successfully.")
                             
         
        time.sleep(TestSpeedControl.TEST_STEP_INTERVAL)
        
예제 #2
0
    def test_ping_vm_normally(self):
        u'''Ping指定的已经存在虚拟机'''
        #
        # The id starts from 1.
        vm_id = 4
        vm_name = "AutoTest_VM%02d" % vm_id
        vm_name = "PD3_Cluster_VM123"
        host_name = "localhost"
        vm_name = "JAVA_VM62"
        '''
        Find the virtual machine first,
        Then, decide if it is running.
        If yes, shutdown the virtual machine.
        The third is to delete it.
        And at the same to watch history or task bar to detect if the deletion is running or finished.  
        
        '''

        # Step 1: Login and pass in with username, password, server and port
        pd_client_browser = self.pd_login()
        time.sleep(TestSpeedControl.TEST_STEP_INTERVAL)
        self.pd_client_browser = pd_client_browser

        # Step 2: Make sure the host resource tab is selected
        PD_DebugLog.stepinfo("click and select the host resource tab")

        pd_browser_main_map = Main_Browser_UIMap(pd_client_browser)
        self.pd_browser_main_map = pd_browser_main_map

        platform_resource_tab = pd_browser_main_map.get_platform_resource_tab()
        platform_resource_tab.click()
        time.sleep(TestSpeedControl.TEST_STEP_INTERVAL)

        # Step 3: Got the directory tree frame and check all the levels
        # travel around the leaves elements
        sub_tree = pd_browser_main_map.get_platform_sub_menu_tree()

        if type(sub_tree) is list:
            sub_menu_tree_elem = sub_tree[0]
        else:
            sub_menu_tree_elem = sub_tree

        platform_tree = Submenu_Tree(sub_menu_tree_elem)

        PD_DebugLog.debug_print("The tree id is: " +
                                platform_tree.get_submenu_tree_id())

        tree_node = TreeNode(sub_menu_tree_elem)
        elemts = tree_node.get_all_child_nodes()

        if type(elemts) is list:
            fst_lvl_node_elm = elemts[0]
        else:
            fst_lvl_node_elm = elemts
        fst_lvl_node = TreeNode(fst_lvl_node_elm)
        PD_DebugLog.info_print("First level child node text is :" +
                               fst_lvl_node.get_node_title())

        #platform_tree.travel_around_child_nodes()
        utils_misc.set_script_timeout(pd_client_browser, 0.2)
        pd_client_browser.implicitly_wait(6)
        elem = platform_tree.find_element_by_vmname(vm_name)
        if elem:
            elem_node = TreeNode(elem[0])
            PD_DebugLog.info_print("Find the elem, the title is " +
                                   elem_node.get_node_title())
            elem_node.click()
        time.sleep(TestSpeedControl.TEST_STEP_INTERVAL)

        utils_misc.restore_script_timeout(pd_client_browser)

        vm_summary_page = VM_Summary_UIMap(pd_client_browser)

        # in the vm summary page, locate the ip address label
        # And get the ip address value.
        target_vm_ipaddr = vm_summary_page.get_vm_ip()

        if not utils_misc.is_valid_ip(target_vm_ipaddr):
            self.fail("Get VM IP failed")

        # Step 4: Check the vm current status, it would turn into "in shutdown progress"
        ping_output = utils_misc.ping(target_vm_ipaddr)
        PD_DebugLog.debug_print("Print the ping output : " + ping_output)

        if utils_misc.get_loss_ratio(ping_output) > 0:
            self.fail("Ping failed" + ping_output)

        time.sleep(TestSpeedControl.TEST_STEP_INTERVAL)
예제 #3
0
    def test_reboot_vm_normally(self):
        u'''重新启动指定的已经存在虚拟机'''
        #
        # The id starts from 1.
        vm_id = 4
        vm_name = "AutoTest_VM%02d" % vm_id
        vm_name = "PD3_Cluster_VM123"
        host_name = "localhost"
        vm_name = "JAVA_VM62"
        '''
        Find the virtual machine first,
        Then, decide if it is running.
        If yes, shutdown the virtual machine.
        The third is to delete it.
        And at the same to watch history or task bar to detect if the deletion is running or finished.  
        
        '''

        # Step 1: Login and pass in with username, password, server and port
        pd_client_browser = self.pd_login()
        time.sleep(TestSpeedControl.TEST_STEP_INTERVAL)
        self.pd_client_browser = pd_client_browser

        # Step 2: Make sure the host resource tab is selected
        PD_DebugLog.stepinfo("click and select the host resource tab")

        pd_browser_main_map = Main_Browser_UIMap(pd_client_browser)
        self.pd_browser_main_map = pd_browser_main_map

        platform_resource_tab = pd_browser_main_map.get_platform_resource_tab()
        platform_resource_tab.click()
        time.sleep(TestSpeedControl.TEST_STEP_INTERVAL)

        # Step 3: Got the directory tree frame and check all the levels
        # travel around the leaves elements
        sub_tree = pd_browser_main_map.get_platform_sub_menu_tree()

        if type(sub_tree) is list:
            sub_menu_tree_elem = sub_tree[0]
        else:
            sub_menu_tree_elem = sub_tree

        platform_tree = Submenu_Tree(sub_menu_tree_elem)

        PD_DebugLog.debug_print("The tree id is: " +
                                platform_tree.get_submenu_tree_id())

        tree_node = TreeNode(sub_menu_tree_elem)
        elemts = tree_node.get_all_child_nodes()

        if type(elemts) is list:
            fst_lvl_node_elm = elemts[0]
        else:
            fst_lvl_node_elm = elemts
        fst_lvl_node = TreeNode(fst_lvl_node_elm)
        PD_DebugLog.info_print("First level child node text is :" +
                               fst_lvl_node.get_node_title())

        #platform_tree.travel_around_child_nodes()
        utils_misc.set_script_timeout(pd_client_browser, 0.2)
        pd_client_browser.implicitly_wait(6)
        elem = platform_tree.find_element_by_vmname(vm_name)
        if elem:
            elem_node = TreeNode(elem[0])
            PD_DebugLog.info_print("Find the elem, the title is " +
                                   elem_node.get_node_title())
            elem_node.click()
        time.sleep(TestSpeedControl.TEST_STEP_INTERVAL)

        utils_misc.restore_script_timeout(pd_client_browser)

        vm_summary_page = VM_Summary_UIMap(pd_client_browser)

        #task_startup_abouttime = time.time()
        # The testcase running machine time is not same as the AIX machine under test.
        vm_summary_page.execute_reboot_system()

        # Step 4: Check the vm current status, it would turn into "in shutdown progress"
        check_return = utils_misc.wait_for(
            vm_summary_page.is_vm_starting, 10, 0.2, 0.1,
            "Check if vm goes into shutdown status")
        self.assert_(
            check_return,
            "After execution of boot up action, vm must go into 'in starting'")

        if check_return:
            # find the task item to get the item information: starttime, name and description
            # Then to watch when it disappears
            # The end, check it in the history of task to get the final status, success or fail.
            # If it failed, get the failure description.

            # Step 5: to check task status and wait the task finishes
            # if popup_task is not open, click the button again

            task_type = u'重启虚拟机'
            utils_misc.wait_for(
                self.shutdown_task_appears, 10, 0, 0.1,
                "Shutdown vm task should appear in current tasks list")
            taskstarttime = self.get_task_starttime(task_type, vm_name,
                                                    host_name)
            utils_misc.wait_for(
                self.shutdown_task_disappears, 10, 0, 0.1,
                "Shutdown vm task should finish and go into the history tasks list"
            )
            status, fail_desc = self.get_task_status_from_history_task(
                task_type, vm_name, host_name, taskstarttime)

            if status == Messages.FAIL_STATUS_STR:
                self.fail("The task failed: " + fail_desc)
            else:
                PD_DebugLog.debug_print("The task finished successfully.")

        time.sleep(TestSpeedControl.TEST_STEP_INTERVAL)
예제 #4
0
    def test_register_vm_ip_normally(self):
        u'''为指定的已经存在虚拟机登记IP地址'''
        #
        # The id starts from 1.
        vm_id = 4   
        vm_name = "AutoTest_VM%02d" % vm_id
        vm_name = "PD3_Cluster_VM123"
        host_name = "localhost"
        vm_name = "JAVA_VM62"
        
        # Step 1: Login and pass in with username, password, server and port
        pd_client_browser = self.pd_login()
        time.sleep(TestSpeedControl.TEST_STEP_INTERVAL)
        self.pd_client_browser = pd_client_browser
        
        # Step 2: Make sure the host resource tab is selected
        PD_DebugLog.stepinfo("click and select the host resource tab")
        
        pd_browser_main_map = Main_Browser_UIMap(pd_client_browser)
        self.pd_browser_main_map = pd_browser_main_map
        
        platform_resource_tab = pd_browser_main_map.get_platform_resource_tab()
        platform_resource_tab.click()
        time.sleep(TestSpeedControl.TEST_STEP_INTERVAL)
        
        # Step 3: Got the directory tree frame and check all the levels
        # travel around the leaves elements
        sub_tree = pd_browser_main_map.get_platform_sub_menu_tree()
        
        if type(sub_tree) is list:
            sub_menu_tree_elem = sub_tree[0]
        else:
            sub_menu_tree_elem = sub_tree
            
        platform_tree = Submenu_Tree(sub_menu_tree_elem)
        
        PD_DebugLog.debug_print("The tree id is: " + platform_tree.get_submenu_tree_id())
        
        tree_node = TreeNode(sub_menu_tree_elem)
        elemts = tree_node.get_all_child_nodes()
        
        if type(elemts) is list:
            fst_lvl_node_elm = elemts[0]
        else:
            fst_lvl_node_elm = elemts
        fst_lvl_node = TreeNode(fst_lvl_node_elm)
        PD_DebugLog.info_print("First level child node text is :" + fst_lvl_node.get_node_title() )      
        
        #platform_tree.travel_around_child_nodes()
        utils_misc.set_script_timeout(pd_client_browser, 0.2)
        pd_client_browser.implicitly_wait(6)
        elem = platform_tree.find_element_by_vmname(vm_name)
        if elem:
            elem_node = TreeNode(elem[0])
            PD_DebugLog.info_print("Find the elem, the title is " + elem_node.get_node_title())
            elem_node.click()
        time.sleep(TestSpeedControl.TEST_STEP_INTERVAL)
        
        utils_misc.restore_script_timeout(pd_client_browser)
        
        vm_summary_page = self.vm_summary_page = VM_Summary_UIMap(pd_client_browser)
        
        # Step 4: expand the more actions bar
        
        vm_summary_page.expand_more_actions_bar()
        
        # Step 5: click Register IP button link
        vm_summary_page.click_register_IP_link()
        
        # Step 6: input the ip... value in the register ip form
        register_vm_ip_form = Register_VM_IP_Frame_UIMap(self.driver)
        register_vm_ip_form.get_ip_addr_input().send_keys("172.30.126.62")
        register_vm_ip_form.get_netmask_input().send_keys("255.255.255.0")
        register_vm_ip_form.get_gateway_input().send_keys("172.30.126.254")
        register_vm_ip_form.get_dns_input().send_keys("202.106.0.20")
        register_vm_ip_form.get_seconddns_input().send_keys("202.106.196.115")
        register_vm_ip_form.get_submit_btn().click()
        
        register_vm_ip_form.return_main_page()
        time.sleep(TestSpeedControl.TEST_STEP_INTERVAL)
        
        result = utils_misc.wait_for(self.determine_ip_is_set, 20, 1, 1, "The ip is not set successfully.")
        
        if not result:
            self.fail("The ip is not set successfully.")
        else:
            PD_DebugLog.info_print("The ip is set done.")
        
        
#         if not utils_misc.is_valid_ip(target_vm_ipaddr):
#             self.fail("Get VM IP failed")
#             
#         # Step 6: Check the vm current status, it would turn into "in shutdown progress"
#         ping_output = utils_misc.ping(target_vm_ipaddr)
#         PD_DebugLog.debug_print("Print the ping output : " + ping_output)
#         
#         if utils_misc.get_loss_ratio(ping_output) > 0:
#             self.fail("Ping failed" + ping_output)

        time.sleep(TestSpeedControl.TEST_STEP_INTERVAL)
        
예제 #5
0
    def test_register_vm_ip_normally(self):
        u'''为指定的已经存在虚拟机登记IP地址'''
        #
        # The id starts from 1.
        vm_id = 4
        vm_name = "AutoTest_VM%02d" % vm_id
        vm_name = "PD3_Cluster_VM123"
        host_name = "localhost"
        vm_name = "JAVA_VM62"

        # Step 1: Login and pass in with username, password, server and port
        pd_client_browser = self.pd_login()
        time.sleep(TestSpeedControl.TEST_STEP_INTERVAL)
        self.pd_client_browser = pd_client_browser

        # Step 2: Make sure the host resource tab is selected
        PD_DebugLog.stepinfo("click and select the host resource tab")

        pd_browser_main_map = Main_Browser_UIMap(pd_client_browser)
        self.pd_browser_main_map = pd_browser_main_map

        platform_resource_tab = pd_browser_main_map.get_platform_resource_tab()
        platform_resource_tab.click()
        time.sleep(TestSpeedControl.TEST_STEP_INTERVAL)

        # Step 3: Got the directory tree frame and check all the levels
        # travel around the leaves elements
        sub_tree = pd_browser_main_map.get_platform_sub_menu_tree()

        if type(sub_tree) is list:
            sub_menu_tree_elem = sub_tree[0]
        else:
            sub_menu_tree_elem = sub_tree

        platform_tree = Submenu_Tree(sub_menu_tree_elem)

        PD_DebugLog.debug_print("The tree id is: " +
                                platform_tree.get_submenu_tree_id())

        tree_node = TreeNode(sub_menu_tree_elem)
        elemts = tree_node.get_all_child_nodes()

        if type(elemts) is list:
            fst_lvl_node_elm = elemts[0]
        else:
            fst_lvl_node_elm = elemts
        fst_lvl_node = TreeNode(fst_lvl_node_elm)
        PD_DebugLog.info_print("First level child node text is :" +
                               fst_lvl_node.get_node_title())

        #platform_tree.travel_around_child_nodes()
        utils_misc.set_script_timeout(pd_client_browser, 0.2)
        pd_client_browser.implicitly_wait(6)
        elem = platform_tree.find_element_by_vmname(vm_name)
        if elem:
            elem_node = TreeNode(elem[0])
            PD_DebugLog.info_print("Find the elem, the title is " +
                                   elem_node.get_node_title())
            elem_node.click()
        time.sleep(TestSpeedControl.TEST_STEP_INTERVAL)

        utils_misc.restore_script_timeout(pd_client_browser)

        vm_summary_page = self.vm_summary_page = VM_Summary_UIMap(
            pd_client_browser)

        # Step 4: expand the more actions bar

        vm_summary_page.expand_more_actions_bar()

        # Step 5: click Register IP button link
        vm_summary_page.click_register_IP_link()

        # Step 6: input the ip... value in the register ip form
        register_vm_ip_form = Register_VM_IP_Frame_UIMap(self.driver)
        register_vm_ip_form.get_ip_addr_input().send_keys("172.30.126.62")
        register_vm_ip_form.get_netmask_input().send_keys("255.255.255.0")
        register_vm_ip_form.get_gateway_input().send_keys("172.30.126.254")
        register_vm_ip_form.get_dns_input().send_keys("202.106.0.20")
        register_vm_ip_form.get_seconddns_input().send_keys("202.106.196.115")
        register_vm_ip_form.get_submit_btn().click()

        register_vm_ip_form.return_main_page()
        time.sleep(TestSpeedControl.TEST_STEP_INTERVAL)

        result = utils_misc.wait_for(self.determine_ip_is_set, 20, 1, 1,
                                     "The ip is not set successfully.")

        if not result:
            self.fail("The ip is not set successfully.")
        else:
            PD_DebugLog.info_print("The ip is set done.")

#         if not utils_misc.is_valid_ip(target_vm_ipaddr):
#             self.fail("Get VM IP failed")
#
#         # Step 6: Check the vm current status, it would turn into "in shutdown progress"
#         ping_output = utils_misc.ping(target_vm_ipaddr)
#         PD_DebugLog.debug_print("Print the ping output : " + ping_output)
#
#         if utils_misc.get_loss_ratio(ping_output) > 0:
#             self.fail("Ping failed" + ping_output)

        time.sleep(TestSpeedControl.TEST_STEP_INTERVAL)
예제 #6
0
    def test_ping_vm_normally(self):
        u'''Ping指定的已经存在虚拟机'''
        #
        # The id starts from 1.
        vm_id = 4   
        vm_name = "AutoTest_VM%02d" % vm_id
        vm_name = "PD3_Cluster_VM123"
        host_name = "localhost"
        vm_name = "JAVA_VM62"

        '''
        Find the virtual machine first,
        Then, decide if it is running.
        If yes, shutdown the virtual machine.
        The third is to delete it.
        And at the same to watch history or task bar to detect if the deletion is running or finished.  
        
        '''
        
        # Step 1: Login and pass in with username, password, server and port
        pd_client_browser = self.pd_login()
        time.sleep(TestSpeedControl.TEST_STEP_INTERVAL)
        self.pd_client_browser = pd_client_browser
        
        # Step 2: Make sure the host resource tab is selected
        PD_DebugLog.stepinfo("click and select the host resource tab")
        
        pd_browser_main_map = Main_Browser_UIMap(pd_client_browser)
        self.pd_browser_main_map = pd_browser_main_map
        
        platform_resource_tab = pd_browser_main_map.get_platform_resource_tab()
        platform_resource_tab.click()
        time.sleep(TestSpeedControl.TEST_STEP_INTERVAL)
        
        # Step 3: Got the directory tree frame and check all the levels
        # travel around the leaves elements
        sub_tree = pd_browser_main_map.get_platform_sub_menu_tree()
        
        if type(sub_tree) is list:
            sub_menu_tree_elem = sub_tree[0]
        else:
            sub_menu_tree_elem = sub_tree
            
        platform_tree = Submenu_Tree(sub_menu_tree_elem)
        
        PD_DebugLog.debug_print("The tree id is: " + platform_tree.get_submenu_tree_id())
        
        tree_node = TreeNode(sub_menu_tree_elem)
        elemts = tree_node.get_all_child_nodes()
        
        if type(elemts) is list:
            fst_lvl_node_elm = elemts[0]
        else:
            fst_lvl_node_elm = elemts
        fst_lvl_node = TreeNode(fst_lvl_node_elm)
        PD_DebugLog.info_print("First level child node text is :" + fst_lvl_node.get_node_title() )      
        
        #platform_tree.travel_around_child_nodes()
        utils_misc.set_script_timeout(pd_client_browser, 0.2)
        pd_client_browser.implicitly_wait(6)
        elem = platform_tree.find_element_by_vmname(vm_name)
        if elem:
            elem_node = TreeNode(elem[0])
            PD_DebugLog.info_print("Find the elem, the title is " + elem_node.get_node_title())
            elem_node.click()
        time.sleep(TestSpeedControl.TEST_STEP_INTERVAL)
        
        utils_misc.restore_script_timeout(pd_client_browser)
        
        vm_summary_page = VM_Summary_UIMap(pd_client_browser)
        
        # in the vm summary page, locate the ip address label
        # And get the ip address value.  
        target_vm_ipaddr = vm_summary_page.get_vm_ip()
        
        if not utils_misc.is_valid_ip(target_vm_ipaddr):
            self.fail("Get VM IP failed")
            
        # Step 4: Check the vm current status, it would turn into "in shutdown progress"
        ping_output = utils_misc.ping(target_vm_ipaddr)
        PD_DebugLog.debug_print("Print the ping output : " + ping_output)
        
        if utils_misc.get_loss_ratio(ping_output) > 0:
            self.fail("Ping failed" + ping_output)

        time.sleep(TestSpeedControl.TEST_STEP_INTERVAL)