示例#1
0
 def determine_ip_is_set(self):
     '''
     compare the ip between the target ip and the static label value
     '''
     #vm_summary_page = VM_Summary_UIMap(self.driver)
     vm_summary_page = VM_Summary_UIMap(self.pd_client_browser)
     got_ip = vm_summary_page.get_vm_ip()
     if got_ip == self.config.get("vm", "ip_addr"):
         return True
     else:
         return False
示例#2
0
 def determine_ip_is_set(self):
     '''
     compare the ip between the target ip and the static label value
     '''
     #vm_summary_page = VM_Summary_UIMap(self.driver)
     vm_summary_page = VM_Summary_UIMap(self.pd_client_browser)
     got_ip = vm_summary_page.get_vm_ip()
     if got_ip == self.config.get("vm", "ip_addr"):
         return True
     else:
         return False
示例#3
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)
示例#4
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)