*** Settings *** Resource ElementPath_XC.robot Resource ../RE0_Common/KeyWord.robot Library Selenium2Library Library SSHLibrary Library String Library DateTime Library DatabaseLibrary *** Keywords *** 执行SQL新增表数据 [Arguments] ${Host_IP} ${Host_User} ${Host_PWD} Open Connection ${Host_IP} 22 log kingbase用户登录远程测试机器 SSHLibrary.Login ${Host_User} ${Host_PWD} ${out}= Execute Command ./kingbaseV8DB.sh create log ${out} Should Contain ${out} CREATE TABLE log 插入数据 ${out}= Execute Command ./kingbaseV8DB.sh insert log ${out} Close Connection Should Contain ${out} INSERT 执行SQL删除 [Arguments] ${Host_IP} ${Host_User} ${Host_PWD} Open Connection ${Host_IP} 22 log kingbase用户登录远程测试机器 SSHLibrary.Login ${Host_User} ${Host_PWD} log 执行脚本和sql语句 ${out} Run Keyword And Ignore Error Execute Command ./kingbaseV8DB.sh drop log ${out} Close Connection Should Contain ${out} DROP TABLE 执行SQL校验 [Arguments] ${Host_IP} ${Host_User} ${Host_PWD} Open Connection ${Host_IP} 22 log kingbase用户登录远程测试机器 SSHLibrary.Login ${Host_User} ${Host_PWD} log 执行脚本和sql语句 ${out}= Execute Command ./kingbaseV8DB.sh query Close Connection Should Contain ${out} 10 Kingbase备份 [Arguments] ${agent_name} ${Kingbase_User} ${Kingbase_PWD} ${mds_name} ${encryption_attr} ${compress_attr} ${dedup_attr} ${cache} ${encryption} ${compress} ${deduped} ${bk_cache} 元素点击 ${Timed_DataProtect} 选择定时数据保护 定位定时数据保护栏失败 ${date} Evaluate time.strftime('%Y%m%d%H%M%S',time.localtime()) time ${random_strategyName}= Catenate SEPARATOR=_ 完全 ${date} ${createpolicy} Catenate SEPARATOR= 新建了策略[ ${random_strategyName} ] Set Suite Variable ${random_strategyName} Set Suite Variable ${createpolicy} Sleep 5s 元素点击 xpath=//span[text()="${agent_name}"] 点击选择代理 定位代理所在位置失败 Sleep 5s 元素点击 ${BackupSet} 点击进入备份集页面 定位备份集按钮失败 元素点击 ${dpm_Protection strategy} 点击进入保护策略页面 定位保护策略按钮失败 元素点击 ${Add_Policy} 点击添加策略按钮 定位添加策略按钮失败 元素点击 ${Select_Backup source_kingbase} 选择备份源 定位备份源失败 元素输入 ${Input_celuename} ${random_strategyName} 定位策略名输入框失败 元素输入 ${Input_kingbase_user} ${Kingbase_User} 定位用户名失败 元素输入 ${Input_kingbase_Pwd} ${Kingbase_PWD} 定位密码失败 元素点击 ${Connection credentials_Next} 点击下一步 定位下一步失败 sleep 5s 元素点击 ${Select_Target database_kingbase} 选择目标数据库 定位目标数据库失败 元素点击 ${Target_database_Next_kingbase} 进入到任务周期页面 定位下一步失败 元素点击 ${Add_TaskCycle} 添加任务周期 定位添加任务周期失败 元素点击 ${Cycle_Once} 设置任务仅执行一次 定位仅一次失败 元素点击 ${Cycle_Confirm} 确定任务周期设置完毕 定位任务周期设置失败 元素点击 ${Cycle_NextStep} 点击下一步进入备份集存储设置界面 定位下一步失败 元素点击 ${Manual_ChooseMDS} 点击勾选手动选择介质 定位选择介质失败 元素点击 ${Select_MDS_DM} 点击介质选择按钮 定位介质选择按钮失败 元素点击 xpath=//select[@id="dialogues_addCycleStorage_storagePath_selectMedia_selectedMdsIP_select"]/option[@label="${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 不勾选压缩 Run Keyword If ${cache}==1 备份缓存 /opt ... ELSE IF ${cache}==0 取消缓存 sleep 2s 循环点击 ${Complete_Policy_Create_No_Info} ${Success_Confirm} sleep 2s 元素点击 ${Success_Confirm} 确定策略创建成功 策略创建失败 元素点击 ${BackupSet} 点击进入备份集一栏 定位备份集页面失败 sleep 30s Wait Until Page Contains Element xpath=//*[@id="backupSetTable"]//tr[2]/td[text()="已完成"] 90s 备份未完成 Log 备份完成 sleep 10s 循环点击 ${BackupSet} ${View} sleep 2s 元素点击 ${View} 点击进入备份集详情 定位备份集详情失败 Sleep 10s 加密属性校验 ${encryption} 压缩属性校验 ${compress} 重删属性校验 ${deduped} 缓存属性校验 ${bk_cache} 元素点击 ${Attr_Cancel} 点击取消关闭备份集详情弹窗 定位取消按钮失败 Log 备份集属性确认完毕 Sleep 2s Kingbase恢复 [Arguments] ${Kingbase_User} ${Kingbase_PWD} ${cache} sleep 5s 循环点击 ${BackupSet} ${Click_recover} sleep 6s Comment 循环点击 ${Click_recover} ${kingbase_Recovry_Pwd} 元素点击 ${Click_recover} 选择最新备份集恢复 定位恢复按钮失败 元素输入 ${kingbase_Recory_Username} ${Kingbase_User} 定位用户名失败 元素输入 ${kingbase_Recovry_Pwd} ${Kingbase_PWD} 定位密码失败 元素点击 ${database_Next_kingbaseR} 选择下一步 定位下一步失败 sleep 5s Run Keyword If ${cache}==1 恢复缓存 /opt Sleep 2s 循环点击 ${Recover} ${Recover_Confirm} 元素点击 ${Recover_Confirm} 恢复确定 恢复确定弹窗定位失败 元素点击 ${Success_Confirm} 点击确定 定位确定失败 元素点击 ${Policy_Work} 选择作业栏 定位作业栏失败 Sleep 30s Wait Until Page Contains Element ${Recover_Success} 90s 恢复失败 sleep 2s Log 恢复成功 备份缓存 [Arguments] ${path} # 缓存路径 元素点击 ${Active_Cache} 勾选缓存 定位缓存选项失败 元素点击 ${Active_Cache} 勾选缓存 定位缓存选项失败 元素输入 ${Cache_Path} ${path} 定位缓存路径输入框失败 元素点击 ${Fin_CachePath} 缓存路径设置完毕 定位缓存路径设置确定按钮失败 恢复缓存 [Arguments] ${path} 元素点击 ${Recover_Cache} 勾选缓存 定位缓存选项失败 元素输入 ${Recover_CachePath} ${path} 定位缓存路径输入框失败 元素点击 ${Fin_Recover_CachePath} 缓存路径设置完毕 定位缓存路径设置确定按钮失败 Sleep 2s 取消压缩 元素点击 ${Type_compress} 取消勾选压缩选项 定位压缩失败 取消缓存 元素点击 ${Active_Cache} 取消勾选缓存 定位缓存选项失败 重删 Sleep 2s 元素点击 ${Type_dedup} 勾选重删 定位重删选项失败 Log 点击重删 Sleep 2s 压缩 Log 点击压缩 元素点击 ${Type_compress} 点击勾选压缩选项 定位压缩失败 加密 Sleep 2s 元素点击 ${Type_encrypt} 勾选加密 定位选项选项失败 Sleep 2s 备份集属性校验 [Arguments] ${encryption} ${compress} ${deduped} ${cache} sleep 10s 循环点击 ${BackupSet} ${View} sleep 2s 元素点击 ${View} 点击进入备份集详情 定位备份集详情失败 Sleep 10s 加密属性校验 ${encryption} 压缩属性校验 ${compress} 重删属性校验 ${deduped} 缓存属性校验 ${cache} 元素点击 ${Attr_Cancel} 点击取消关闭备份集详情弹窗 定位取消按钮失败 Log 备份集属性确认完毕 Sleep 2s 压缩属性校验 [Arguments] ${encryption} ${get_attr}= Get Text ${Compress_Attr} Element Text Should Be ${Compress_Attr} ${encryption} Log 压缩属性校验完毕 加密属性校验 [Arguments] ${compress} ${get_attr}= Get Text ${Encryption_Attr} Element Should Contain ${Encryption_Attr} ${compress} Log 加密属性校验完毕 重删属性校验 [Arguments] ${deduped} ${get_attr}= Get Text ${Deduped_Attr} Element Should Contain ${Deduped_Attr} ${deduped} Log 重删属性校验完毕 缓存属性校验 [Arguments] ${bk_cache} ${get_attr}= Get Text ${cache} Element Should Contain ${cache} ${bk_cache} Log 缓存属性校验完毕