robotframework-demo/Project/task4/Resource/RE3_DPM/KeyWord_VMware.robot

188 lines
9.3 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

*** Settings ***
Resource ElementPath.robot
Resource ../RE0_Common/KeyWord.robot
*** Keywords ***
VMware备份
[Arguments] ${esxi_name} ${bk_name} ${bk_type} ${mds_name} ${encryption_attr} ${compress_attr} ${dedup_attr} # 备份模式esxi名称备份类型备份虚拟机名称介质名称加密压缩重删
元素点击 ${Timed_DataProtect} 点击进入定时数据保护页面 定位定时数据保护失败
${date} Evaluate time.strftime('%Y%m%d%H%M%S',time.localtime()) time
${random_strategyName}= Catenate SEPARATOR=_ VM ${date}
Set Suite Variable ${random_strategyName}
Log 切换为全局变量
Sleep 5s
元素点击 xpath=//span[text()="${esxi_name}"] 点击定位esxi 定位esxi失败
元素点击 ${dpm_Protection strategy} 切换到策略一栏 定位策略失败
Sleep 5s
FOR ${n} IN RANGE 3
${bk_status} Run Keyword And Return Status Wait Until Element Is Visible ${Policy_Delete}
Run Keyword If "${bk_status}"=="True" 策略清理
... ELSE Exit For Loop
Sleep 5s
END
Log 策略清理完成
元素点击 ${VM_DPM_Addpolicy} 点击添加策略按钮 添加策略定位失败
元素点击 ${VM_DPM_virtual} 选择备份源为虚拟机 定位虚拟机类型失败
元素输入 ${VM_DPM_Vmname} ${bk_name} 定位虚拟机输入框失败
Log 输入虚拟机名称完毕
元素点击 ${VM_DPM_Vmnamesearch} 点击搜索虚拟机按钮 定位搜索虚拟机按钮失败
元素点击 xpath=//span[text()="${bk_name}"]/../../td[2]/div 勾选备份虚拟机 定位虚拟机失败
元素点击 ${VM_DPM_AddSelected} 添加虚拟机完毕 定位添加虚拟机按钮失败
元素点击 ${VM_DPM_fwStep2} 进入任务周期界面 定位添加策略下一步失败
元素点击 ${Add_TaskCycle} 添加任务周期 定位添加任务周期按钮失败
Run Keyword If "${bk_type}"=="完全" 完全备份
... ELSE IF "${bk_type}"=="增量" 增量备份
元素点击 ${Cycle_Once} 添加仅一次立即备份 一次循环模式定位失败
元素点击 ${Cycle_Confirm} 添加任务周期 任务周期确定定位失败
元素点击 ${Cycle_NextStep} 点击下一步 任务周期下一步定位失败
Log 进入备份集存储界面
元素点击 ${BackupStorage_hand} 点击勾选手动选择介质 定位选择介质失败
元素点击 ${Select_MDS_DM} 点击介质选择按钮 定位介质选择按钮失败
元素点击 xpath=//select[@id="dialogues_addCycleStorage_storagePath_selectMedia_selectedMdsIP_select"]/option[text()="${mds_name}"] 点击选择指定介质 定位指定介质失败
Run Keyword If ${dedup_attr}==1 重删
... ELSE log 不重删
元素点击 ${Storage_NextStep} 点击下一步进入到备份高级选项 定位下一步失败
Log 进入高级选项
Run Keyword If ${encryption_attr}==1 加密
... ELSE log 不加密
Run Keyword If ${compress_attr}==1 压缩
... ELSE log 不压缩
Sleep 2s
元素输入 ${Set_PolicyName} ${random_strategyName} 定位虚拟机策略名称失败
Log 策略名称输入完毕
元素点击 ${Senior_NextStep} 点击确定 定位确定按钮失败
Sleep 2s
元素点击 ${Success_Confirm} 策略添加完成 备份策略完成定位失败
log 开始备份
元素点击 ${Backup_html} 进入备份集栏 定位备份集选项失败
Sleep 60s
元素输入 ${DPMFind_Policy} ${random_strategyName} 定位策略名搜索框失败
元素点击 ${DPMButton_Searchbutton} 点击查找筛选策略 定位查找按钮失败
Sleep 60s
FOR ${n} IN RANGE 10
Click Element ${Button_Searchbk}
Sleep 10s
${bk_status} Run Keyword And Return Status Wait Until Element Is Visible xpath=//*[@id="backupSetTable"]/div[2]/table/tbody/tr[2]/td[text()="已完成"]
Run Keyword If "${bk_status}"=="True" Exit For Loop
... ELSE Log 备份未完成
Sleep 120s
END
Run Keyword If ${bk_status}==False Fail
... ELSE Log 备份成功
Sleep 5s
备份集属性校验
[Arguments] ${encryption} ${compress} ${deduped} # 加密;压缩;重删
sleep 2s
循环点击 ${BackupSet} ${Detail}
元素点击 ${Detail} 点击进入备份集详情 定位备份集详情失败
Sleep 2s
Element Should Contain ${Encryption_Attr} ${encryption}
Log 加密属性校验完毕
Sleep 2s
Element Text Should Be ${Compress_Attr} ${compress}
Log 压缩属性校验完毕
Sleep 2s
Element Should Contain ${SQLserver_Deduped_Attr} ${deduped}
Log 重删属性校验完毕
Sleep 2s
元素点击 ${Attr_Cancel} 点击取消关闭备份集详情弹窗 定位取消按钮失败
Log 备份集属性确认完毕
Sleep 5s
策略清理
Sleep 2s
循环点击 ${Policy_Delete} ${VMDPM_Delconfirm}
Sleep 2s
元素点击 ${VMDPM_Delconfirm} 确认删除 确认删除定位失败
Sleep 2s
元素点击 ${Success_Confirm} 完成策略删除 定位删除成功按钮失败
Sleep 2s
VMware恢复
sleep 2s
循环点击 ${BackupSet} ${Click_recover}
元素点击 ${Click_recover} 点击恢复按钮 定位恢复按钮失败
sleep 10s
元素点击 ${Recover_data} 选择需要恢复到的DataStore 定位DataStore失败
元素点击 ${Recover_next} 点击下一步 定位恢复目标下一步失败
循环点击 ${Recover_finish} ${Confirm_Recovery}
元素点击 ${Confirm_Recovery} 点击确认恢复成功 定位恢复确认按钮失败
元素点击 ${Success_Confirm} 恢复策略确定创建成功 恢复作业创建成功弹窗定位失败
元素点击 ${Policy_Work} 点击进入作业栏 定位作业栏失败
sleep 60s
元素输入 ${Input_All_Policy} 恢复 定位所有策略输入框失败
元素点击 ${Search_By_Policy} 点击查找筛选恢复策略 定位查找按钮失败
sleep 10s
FOR ${n} IN RANGE 10
${bk_status} Run Keyword And Return Status Wait Until Element Is Visible ${Recover_Success}
Run Keyword If "${bk_status}"=="True" Exit For Loop
... ELSE Log 未恢复完成
Sleep 60s
END
Run Keyword If ${bk_status}==False Fail
... ELSE Log 恢复成功
Comment Wait Until Page Contains Element ${Recover_Success} 240s 恢复失败
sleep 2s
Log 恢复成功
完全备份
Sleep 2s
Click Element ${Full_Backup}
Log 勾选完全备份
增量备份
Sleep 2s
Click Element ${Incre_Backup}
Log 勾选增量备份
加密
Sleep 2s
元素点击 ${Type_encrypt} 选择加密 定位选项选项失败
Sleep 2s
压缩
Sleep 2s
元素点击 ${Type_compress} 勾选压缩 定位压缩选项失败
Sleep 2s
重删
Sleep 2s
元素点击 ${Type_dedup} 选择重删 定位重删选项失败
Sleep 2s
立即执行
[Arguments] ${bktype} ${bk_name} # 备份类型#备份源名称
元素点击 ${dpm_Protection strategy} 点击进入定时保护策略一栏 定位保护策略栏失败
元素点击 ${Complie_execute} 点击策略立即执行按钮 定位立即执行元素失败
sleep 10s
元素点击 ${Select_Srctype_Gbase8t} 点击选择备份类型按钮 定位选择备份类型元素失败
Run Keyword If "${bktype}"=="增量" 立即增量备份
... ELSE IF "${bktype}"=="完全" 立即完全备份
元素点击 ${VM_DPM_RESExpand} 点击展开虚拟机列表 定位展开虚拟机失败
Sleep 5s
元素点击 xpath=//*[@id="executeVM_bksource"]//span[text()="${bk_name}"]/../../td[2]/div 点击备份虚拟机 定位备份目标失败
元素点击 ${VM_DPM_executeSure} 点击立即执行确定按钮 定位立即执行确定元素失败
Sleep 5s
元素点击 ${Gbase8t_Execute_Confirm} 点击确定按钮 定位确定按钮失败
Sleep 5s
元素点击 ${BackupSet} 点击进入备份集一栏 定位备份集栏失败
Sleep 60s
Wait Until Page Contains Element xpath=//*[@id="backupSetTable"]/div[2]/table/tbody/tr[2]/td[5][text()="VMware${bktype}备份"] 120s 备份集为非${bktype}
Log 备份集类型为${bktype}
Sleep 5s
Wait Until Page Contains Element ${Backup_Completed} 300s 备份未完成
Log 备份完成
立即增量备份
Sleep 2s
Click Element ${Complie_incre_Sybase}
Log 立即执行增量备份
Sleep 2s
立即完全备份
Sleep 2s
Click Element ${Now Full_BackupMysql}
Log 立即执行完全备份
Sleep 2s