201 lines
10 KiB
Plaintext
201 lines
10 KiB
Plaintext
|
*** Settings ***
|
|||
|
Resource ElementPath.robot
|
|||
|
Resource ../RE0_Common/KeyWord.robot
|
|||
|
|
|||
|
*** Keywords ***
|
|||
|
生成备份文件并上传
|
|||
|
删除桶中文件 ${S3_IP_Lin} ${S3_User_Lin} ${S3_Password_Lin}
|
|||
|
Execute Command rm -rf /B.dbf
|
|||
|
Execute Command dd if=/dev/zero of=/B.dbf bs=1M count=50
|
|||
|
Sleep 5s
|
|||
|
${origin_file_md5} Execute Command md5sum /B.dbf|cut -d" " -f1
|
|||
|
Set Suite Variable ${origin_file_md5}
|
|||
|
Log 源文件MD5值:${origin_file_md5}
|
|||
|
Log 源文件MD5值计算完毕
|
|||
|
Execute Command mc cp /B.dbf minio/test
|
|||
|
Close Connection
|
|||
|
|
|||
|
S3文件备份
|
|||
|
[Arguments] ${agent_name} ${bk_type} ${encryption_attr} ${compress_attr} ${dedup_attr} ${check_attr}=0
|
|||
|
元素点击 ${Timed_DataProtect} 点击进入定时数据保护页面 定位定时数据保护失败
|
|||
|
${date} Evaluate time.strftime('%Y%m%d%H%M%S',time.localtime()) time
|
|||
|
${random_strategyName}= Catenate SEPARATOR=_ ${bk_type} ${date}
|
|||
|
${createpolicy} Catenate SEPARATOR= 新建了策略[ ${random_strategyName} ]
|
|||
|
Set Suite Variable ${random_strategyName}
|
|||
|
Set Suite Variable ${createpolicy}
|
|||
|
Sleep 5s
|
|||
|
元素点击 xpath=//span[text()="${agent_name}"] 点击选择代理 定位代理所在位置失败
|
|||
|
元素点击 ${S3 strategy} 点击进入保护策略页面 定位保护策略按钮失败
|
|||
|
元素点击 ${S3_Add_Policy} 点击添加策略按钮 定位添加策略按钮失败
|
|||
|
sleep 10s
|
|||
|
元素输入 ${Set_S3_PolicyName} ${random_strategyName} 定位策略名输入框失败
|
|||
|
元素点击 ${Select_S3_master} 勾选需要备份的文件 定位需要备份的文件失败
|
|||
|
元素点击 ${Bk_S3_NextStep} 点击下一步进入多通道配置 定位下一步按钮失败
|
|||
|
元素点击 ${Bk_S3_NextStep2} 点击下一步进入执行节点选择 定位下一步按钮失败
|
|||
|
元素点击 ${select_S3_node} 点击勾选执行节点 勾选执行节点失败
|
|||
|
元素点击 ${Bk_S3_NextStep3} 点击下一步进入备份集存储 定位下一步按钮失败
|
|||
|
元素点击 ${select_media} 点击勾选备份介质 勾选备份介质失败
|
|||
|
元素点击 ${Bk_S3_NextStep4} 点击下一步进入备份高级选项 定位下一步按钮失败
|
|||
|
Run Keyword If ${encryption_attr}==1 加密
|
|||
|
... ELSE log 不选择加密
|
|||
|
Run Keyword If ${compress_attr}==1 压缩
|
|||
|
... ELSE log 不选择压缩
|
|||
|
Run Keyword If ${dedup_attr}==1 重删
|
|||
|
... ELSE log 不选择重删
|
|||
|
元素点击 ${Bk_S3_NextStep5} 点击下一步进入备份高级选项 定位下一步按钮失败
|
|||
|
元素点击 ${Add_taskcycle} 点击添加任务周期 定位添加任务周期按钮失败
|
|||
|
Run Keyword If "${bk_type}"=="完全" log 进行完全备份
|
|||
|
... ELSE IF "${bk_type}"=="增量" 增量备份
|
|||
|
... ELSE Fail \ \ \ \ \ 定位备份类型失败
|
|||
|
元素点击 ${Cycle_Once} 设置任务仅执行一次 定位仅执行一次失败
|
|||
|
元素点击 ${Cycle_Confirm} 确定任务周期设置完毕 定位任务周期设置失败
|
|||
|
元素点击 ${Complete_Policy_Create_S3} 点击确定按钮完成策略创建 定位确定按钮失败
|
|||
|
Sleep 2s
|
|||
|
元素点击 ${Success_Confirm} 确定策略创建成功 策略创建失败
|
|||
|
元素点击 ${S3_BackupSet} 点击进入备份集一栏 定位备份集栏失败
|
|||
|
Sleep 60s
|
|||
|
元素点击 ${S3_DPMButton_Searchbutton} 点击进入备份集页面刷新 定位备份集栏页面刷新失败
|
|||
|
Wait Until Page Contains Element Xpath=//div[text()="${random_strategyName}"]/../../..//tr[@data-index="0"]/td/div[text()="已完成"] 120s 备份未完成
|
|||
|
Log 备份完成
|
|||
|
Sleep 2s
|
|||
|
|
|||
|
加密
|
|||
|
Sleep 2s
|
|||
|
Click Element ${Option_Encryption}
|
|||
|
Log 点击加密
|
|||
|
Sleep 2s
|
|||
|
|
|||
|
压缩
|
|||
|
Log 点击压缩
|
|||
|
Set Focus To Element ${Option_Compress}
|
|||
|
Click Element ${Option_Compress}
|
|||
|
|
|||
|
重删
|
|||
|
Sleep 2s
|
|||
|
Click Element ${S3_Select_Dedup}
|
|||
|
Log 点击重删
|
|||
|
Sleep 2s
|
|||
|
|
|||
|
增量备份
|
|||
|
Sleep 2s
|
|||
|
Click Element ${select_increment_backup}
|
|||
|
Log 点击增量备份
|
|||
|
Sleep 2s
|
|||
|
|
|||
|
备份集属性校验
|
|||
|
[Arguments] ${encryption} ${compress} ${deduped}
|
|||
|
sleep 10s
|
|||
|
${BK_Detailid}= Catenate SEPARATOR= compileBackupViewId ${random_strategyName}
|
|||
|
click element xpath=//div[text()="${random_strategyName}"]/../../..//tr[@data-index="0"]/td/div/button[text()="详情"]
|
|||
|
Sleep 10s
|
|||
|
Run Keyword If ${encryption}==1 加密属性校验
|
|||
|
... ELSE Log 属性不校验
|
|||
|
Run Keyword If ${compress}==1 压缩属性校验
|
|||
|
... ELSE Log 属性不校验
|
|||
|
Run Keyword If ${deduped}==1 重删属性校验
|
|||
|
... ELSE Log 属性不校验
|
|||
|
元素点击 ${S3_Attr_Cancel} 点击取消关闭备份集详情弹窗 定位取消按钮失败
|
|||
|
Log 备份集属性确认完毕
|
|||
|
Sleep 2s
|
|||
|
|
|||
|
加密属性校验
|
|||
|
${get_attr}= Get Text ${S3_Encryption_Attr}
|
|||
|
Element Should Contain ${S3_Encryption_Attr} 是
|
|||
|
Log 加密属性校验完毕
|
|||
|
|
|||
|
压缩属性校验
|
|||
|
${get_attr}= Get Text ${S3_Compress_Attr}
|
|||
|
Element Text Should Be ${S3_Compress_Attr} 是
|
|||
|
Log 压缩属性校验完毕
|
|||
|
|
|||
|
重删属性校验
|
|||
|
${get_attr}= Get Text ${S3_Deduped_Attr}
|
|||
|
Element Should Contain ${S3_Deduped_Attr} 是
|
|||
|
Log 重删属性校验完毕
|
|||
|
|
|||
|
S3文件恢复
|
|||
|
删除桶中文件 ${S3_IP_Lin} ${S3_User_Lin} ${S3_Password_Lin}
|
|||
|
sleep 5s
|
|||
|
元素输入 ${Input_S3_Policy_Name} ${random_strategyName} 定位策略名搜索框失败
|
|||
|
元素点击 ${S3_DPMButton_Searchbutton} 点击查找筛选策略 定位查找按钮失败
|
|||
|
sleep 5s
|
|||
|
元素点击 ${S3_recovery} 选择备份集进行恢复 定位恢复按钮失败
|
|||
|
sleep 5s
|
|||
|
元素点击 ${S3_Recover_File} 选择需要恢复的文件 定位需要恢复的文件失败
|
|||
|
元素点击 ${Recover_S3_Nextstep} 点击下一步进入到恢复桶页面 定位下一步定位失败
|
|||
|
元素点击 ${Recover_Source_path} 点击恢复到原桶 定位恢复到原桶失败
|
|||
|
元素点击 ${recover_confirm} 点击确认 定位确认按钮成功
|
|||
|
元素点击 ${Recover_S3_Nextstep2} 点击下一步进入到多通道配置 定位下一步失败
|
|||
|
元素点击 ${Recover_S3_Nextstep3} 点击下一步进入到执行节点 定位下一步失败
|
|||
|
元素点击 ${restore_select_S3_node} 点击恢复执行节点 定位恢复执行节点失败
|
|||
|
元素点击 ${Recover_S3_Nextstep4} 点击下一步进入到高级选项 定位下一步失败
|
|||
|
元素点击 ${Recover_S3_complete} 点击完成按钮成功 定位完成按钮失败
|
|||
|
元素点击 ${Success_Confirm} 恢复策略确定创建成功 恢复作业创建成功弹窗定位失败
|
|||
|
元素点击 ${S3_Policy_Work} 点击进入作业栏 定位作业栏失败
|
|||
|
Sleep 60s
|
|||
|
元素输入 ${Input_S3_Policy} 恢复策略 定位所有策略输入框失败
|
|||
|
元素点击 ${S3_Searchbutton} 点击查找筛选恢复策略 定位查找按钮失败
|
|||
|
log 恢复成功
|
|||
|
|
|||
|
删除桶中文件
|
|||
|
[Arguments] ${ip} ${user} ${pwd}
|
|||
|
Open Connection ${ip}
|
|||
|
SSHLibrary.Login ${user} ${pwd}
|
|||
|
log 新建备份所需文件
|
|||
|
Execute Command service iptables stop
|
|||
|
Execute Command mc alias set minio http://10.18.32.91:9000 accesskey secretkey
|
|||
|
Execute Command mc rm minio/test/B.dbf
|
|||
|
|
|||
|
校验S3文件
|
|||
|
[Arguments] ${ip} ${user} ${pwd}
|
|||
|
Open Connection ${ip}
|
|||
|
SSHLibrary.Login ${user} ${pwd}
|
|||
|
Log 连接成功
|
|||
|
Execute Command mc cp minio/test/B.dbf /opt/
|
|||
|
${recovered_file_md5} Execute Command md5sum /opt/B.dbf|cut -d" " -f1
|
|||
|
Close Connection
|
|||
|
Log origin_file_md5=${origin_file_md5}
|
|||
|
Run Keyword If "${recovered_file_md5}"=="${origin_file_md5}" Log 文件恢复成功,MD5值一致
|
|||
|
... ELSE Fail 文件恢复失败,MD5值不一致
|
|||
|
|
|||
|
修改备份数据源
|
|||
|
删除桶中文件 ${S3_IP_Lin} ${S3_User_Lin} ${S3_Password_Lin}
|
|||
|
Execute Command rm -rf /B.dbf
|
|||
|
Execute Command dd if=/dev/zero of=/B.dbf bs=1M count=50
|
|||
|
Sleep 5s
|
|||
|
${origin_file_md5} Execute Command md5sum /B.dbf|cut -d" " -f1
|
|||
|
Set Suite Variable ${origin_file_md5}
|
|||
|
Log 源文件MD5值:${origin_file_md5}
|
|||
|
Log 源文件MD5值计算完毕
|
|||
|
Execute Command mc cp /B.dbf minio/test
|
|||
|
Close Connection
|
|||
|
|
|||
|
立即执行
|
|||
|
[Arguments] ${bk_type}
|
|||
|
元素点击 ${Timed_DataProtect} 点击进入定时数据保护页面 定位定时数据保护失败
|
|||
|
元素点击 xpath=//*[@id="treeboxbox_tree"]/div/table/tbody/tr[2]/td[2]/table/tbody/tr[5]/td[2]/table/tbody/tr/td[4]/span 点击代理 点击代理失败
|
|||
|
Sleep 2s
|
|||
|
元素点击 ${S3 strategy} 点击进入保护策略页面 定位保护策略按钮失败
|
|||
|
Sleep 5s
|
|||
|
元素输入 xpath=//*[@id="hcs_tabPolicy_policyNameFilter_input"] 完全_20231025133315 输入策略名失败
|
|||
|
元素点击 ${S3_Job_Searchbutton} 点击查询按钮成功 点击查询按钮失败
|
|||
|
元素点击 ${Exe_S3_Bk} 点击展开立即执行下拉框 定位立即执行备份类型失败
|
|||
|
Run Keyword If "${bk_type}"=="完全" 立即执行_完全
|
|||
|
... ELSE IF "${bk_type}"=="增量" 立即执行_增量
|
|||
|
Sleep 5s
|
|||
|
元素点击 ${Complie_confirm_S3} 点击确定按钮 定位确定按钮失败
|
|||
|
元素点击 ${S3_BackupSet} 点击进入备份集一栏 定位备份集栏失败
|
|||
|
Sleep 20s
|
|||
|
元素点击 ${S3_DPMButton_Searchbutton} 点击查询成功 点击查询失败
|
|||
|
Log 备份完成
|
|||
|
Sleep 5s
|
|||
|
|
|||
|
立即执行_完全
|
|||
|
log 选择完全备份
|
|||
|
元素点击 ${Now Full_Bacup_S3} 点击确定按钮成功 点击确定按钮失败
|
|||
|
|
|||
|
立即执行_增量
|
|||
|
log 选择增量备份
|
|||
|
元素点击 ${Now Add_Backu_S3} 选择增量备份成功 选择增量备份失败
|
|||
|
元素点击 ${Now Full_Bacup_S3} 点击确定按钮成功 点击确定按钮失败
|