当前位置: 首页>>代码示例>>Python>>正文


Python PD_DebugLog.info_print方法代码示例

本文整理汇总了Python中Common.Utils.PD_DebugLog.info_print方法的典型用法代码示例。如果您正苦于以下问题:Python PD_DebugLog.info_print方法的具体用法?Python PD_DebugLog.info_print怎么用?Python PD_DebugLog.info_print使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Common.Utils.PD_DebugLog的用法示例。


在下文中一共展示了PD_DebugLog.info_print方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: pd_login

# 需要导入模块: from Common.Utils import PD_DebugLog [as 别名]
# 或者: from Common.Utils.PD_DebugLog import info_print [as 别名]
 def pd_login(self, driver, username, password):
     '''
     Use default configurations in shared_config file to login PD
     '''
         
     pd_browser_client = driver
 
     PD_DebugLog.stepinfo("Login PowerDirector")
     PD_DebugLog.debug_print("client browser title is " + pd_browser_client.title)
     assert "PowerDirector" in pd_browser_client.title
     PD_DebugLog.info_print("Page title: " + pd_browser_client.title)
 
     uid_input = pd_browser_client.find_element_by_id("uid")
     uid_input.send_keys(username)
     p_input = pd_browser_client.find_element_by_id("pword")
     p_input.send_keys(password)
     login_button = pd_browser_client.find_element_by_xpath("/html/body/div/form/div/p[4]/input")
     login_button.click()
     expect_welcome_panel = pd_browser_client.find_element_by_id("user_panel")
     welcome_text = "PowerDirector"
 
     try:
        if welcome_text in expect_welcome_panel.text:
             PD_DebugLog.debug_print(expect_welcome_panel.text)
     except:
         raise Login_Error("Login fails")
         pd_browser_client.quit()
 
     return pd_browser_client
开发者ID:xhan-shannon,项目名称:WebAutotest,代码行数:31,代码来源:Connect.py

示例2: setUp

# 需要导入模块: from Common.Utils import PD_DebugLog [as 别名]
# 或者: from Common.Utils.PD_DebugLog import info_print [as 别名]
 def setUp(self):
     # 继承父类Basejob,调用环境设置过程
     # 设置了日志输出文件接口:PD_DebugLog.xxx
     # 浏览器对象使用self.driver
     PD_DebugLog.info_print("Call the parent method setUp")
     Basejob.setUp(self)
开发者ID:xhan-shannon,项目名称:WebAutotest,代码行数:8,代码来源:PowerdownVM.py

示例3: test_powerdown_vm_normally

# 需要导入模块: from Common.Utils import PD_DebugLog [as 别名]
# 或者: from Common.Utils.PD_DebugLog import info_print [as 别名]
    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.")
                             
         
#.........这里部分代码省略.........
开发者ID:xhan-shannon,项目名称:WebAutotest,代码行数:103,代码来源:PowerdownVM.py

示例4: test_register_vm_ip_normally

# 需要导入模块: from Common.Utils import PD_DebugLog [as 别名]
# 或者: from Common.Utils.PD_DebugLog import info_print [as 别名]
    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)
#.........这里部分代码省略.........
开发者ID:xhan-shannon,项目名称:WebAutotest,代码行数:103,代码来源:RegisterVMIP.py

示例5:

# 需要导入模块: from Common.Utils import PD_DebugLog [as 别名]
# 或者: from Common.Utils.PD_DebugLog import info_print [as 别名]
from BootVM import BootVM
from RebootVM import RebootVM
from PingVM import PingVM
from RegisterVMIP import RegisterVMIP


RESULT_DIR = os.path.join(os.environ["AUTODIR"], "results")

if __name__ == "__main__":
    # logging.basicConfig(format='[%(pathname)s: %(lineno)d: %(levelname)s:%(asctime)s]:%(message)s',
    #                    level=logging.DEBUG)

    logging.basicConfig(format="[%(levelname)s:%(asctime)s]:%(message)s", level=logging.DEBUG)

    auto_cur_dir = os.path.dirname(sys.argv[0])
    PD_DebugLog.info_print("The current dir is: " + auto_cur_dir)
    os.environ["AUTODIR"] = os.path.abspath(os.path.join(auto_cur_dir, ".."))
    testsuite = unittest.TestSuite()

    # testsuite.addTest(ActivateProduction('test_activateproduct'))
    # testsuite.addTest(ActivateProduction('test_activateproduct_with_wronglicfile'))
    # testsuite.addTest(ActivateProduction('test_activateproduct_with_correctlicfile'))

    # testsuite.addTest(RegisterPlatform('test_Register_Platform'))
    # testsuite.addTest(RegisterPlatform('test_Register_Platform_Check'))

    # UploadISO 上传镜像
    # testsuite.addTest(UploadISO('test_upload_iso'))

    # RegisterISO 注册镜像
    # testsuite.addTest(RegisterIMG('test_register_image'))
开发者ID:yangming85,项目名称:WebAutotest,代码行数:33,代码来源:autotest_local.py

示例6: test_register_image

# 需要导入模块: from Common.Utils import PD_DebugLog [as 别名]
# 或者: from Common.Utils.PD_DebugLog import info_print [as 别名]
    def test_register_image(self):
        u'''
                         在PDHelper中配置了‘镜像库’地址和共享目录
                         注册平台 后,注册模板镜像用于安装虚拟机
         '''
        register_image_config = utils_misc.readconfig(self.__class__.__name__)
            
        u'''???平台注册后,有什么标志可以用来检测判断已经成功注册'''
        # Step 1: 登陆PD Web界面(用户名密码在配置文件tests-shared.cfg)
        PD_DebugLog.stepinfo(Messages.LOGIN_POWERDIRECTOR) #"Login PowerDirector"
        pd_client_browser = self.driver
        pd_client_browser.implicitly_wait(30)
        pd_client_browser.maximize_window()
        
        # :输入用户名,密码 Login and pass in with username, password, server and port
        self.pd_login()
        time.sleep(TestSpeedControl.TEST_STEP_INTERVAL)
        
        # Step 2: 选择镜像库标签
        PD_DebugLog.stepinfo(Messages.IMAGE_LIB)
        PD_DebugLog.stepinfo(Messages.SELECT_CLICK_IMAGELIB_TAB)
        pd_browser_main_map = Main_Browser_UIMap(pd_client_browser)
        imagelib_tab = pd_browser_main_map.get_image_library_tab()
        imagelib_tab.click()
        
        # 确认当前页面已经切换到镜像库页面
        # 通过检查左侧树形标题/html/body/div[2]/div/div[2]/div[3]/ul/li/span
        expect_title = u"镜像"
        PD_DebugLog.info_print(u"期望在左侧树形面板标题获得“镜像”文本")
        got_title = pd_browser_main_map.get_sub_menu_tree_title(
                        Main_Browser_UIMap.IMAGE)
        
        PD_DebugLog.debug_print("expect_title: " + expect_title)
        PD_DebugLog.debug_print("got_title: " + got_title)
        assert expect_title == got_title
        time.sleep(TestSpeedControl.TEST_STEP_INTERVAL)
        
        # Step 3: 选择镜像库标签->"注册镜像"链接
        pd_imagelib_summary_map = ImageLib_Summary_UIMap(pd_client_browser)
        pd_imagelib_summary_map.click_register_image_link()
        time.sleep(TestSpeedControl.TEST_STEP_INTERVAL)
        
        # Step 4: 在注册镜像对话框中输入镜像对应的目录名
        # Step 4: input the image or iso file name under the nfs template 
        #         directory.
        iso_image_file_name = register_image_config.get("images", "rh64_template_img")
        
        if not iso_image_file_name:
            iso_image_file_name = "RedHat_6.4_image"
        
        pd_image_register_uimap = Register_Image_Frame_UIMap(pd_client_browser)
        image_alias_input_elem = pd_image_register_uimap.get_image_alias_input()
        image_alias_input_elem.send_keys(iso_image_file_name)
        
        time.sleep(TestSpeedControl.TEST_STEP_INTERVAL)
        image_location_input_elem = pd_image_register_uimap.get_image_file_location_input()
        image_location_input_elem.send_keys(iso_image_file_name)
        time.sleep(TestSpeedControl.TEST_STEP_INTERVAL)
        
        # Step 5: select file type as ISO or IMG
        # Step 5: 选择文件类型为ISO或IMG 
        file_type_img_radiobtn = pd_image_register_uimap.get_file_type_img_radiobtn()
        
        if not file_type_img_radiobtn:
            raise ElemNotExisted
        
        file_type_img_radiobtn.click()
        time.sleep(TestSpeedControl.TEST_STEP_INTERVAL)
            
        # Step 6: select the proper OS type
        # Step 6: 选择合适的操作系统类型    
        os_type = register_image_config.get("images", "os_type")
        pd_image_register_uimap.select_ostype_by_value(os_type)
        
        time.sleep(TestSpeedControl.TEST_STEP_INTERVAL)
        os_name = register_image_config.get("images", "os_name")
        try:
            pd_image_register_uimap.select_osname_by_value(os_name)
        except:
            register_isoimage_fail_file = "register_isoimage_fail_file.png"
            utils_misc.save_screenshot(self.driver, self.testcasedir, 
                                       register_isoimage_fail_file)
            
        time.sleep(TestSpeedControl.TEST_STEP_INTERVAL)
        
        # Step 7: click submit
        # Step 7: 点击提交按钮
        submit_btn = pd_image_register_uimap.get_submit_btn()
        submit_btn.click()
        #time.sleep(TestSpeedControl.TEST_STEP_INTERVAL)
        
        # Step 8: verify alert is present 
        # Step 8: 确认成功对话框弹出
        #time.sleep(3)  # 等待时间不能太短
            
        # wait to alert dialog pops up
        orig_window_handles = self.driver.window_handles
        
        time_out = 100
        curtime = 0
#.........这里部分代码省略.........
开发者ID:xhan-shannon,项目名称:WebAutotest,代码行数:103,代码来源:RegisterIMG.py

示例7: test_ping_vm_normally

# 需要导入模块: from Common.Utils import PD_DebugLog [as 别名]
# 或者: from Common.Utils.PD_DebugLog import info_print [as 别名]
    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)
        
开发者ID:xhan-shannon,项目名称:WebAutotest,代码行数:88,代码来源:PingVM.py


注:本文中的Common.Utils.PD_DebugLog.info_print方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。