281 lines
13 KiB
Plaintext
281 lines
13 KiB
Plaintext
*** Settings ***
|
|
Resource ElementPath_XC.robot
|
|
Library SSHLibrary
|
|
Resource ../RE0_Common/KeyWord.robot
|
|
|
|
*** Keywords ***
|
|
创建数据表
|
|
[Arguments] ${ip} ${user} ${pwd}
|
|
Open Connection ${ip}
|
|
SSHLibrary.Login ${user} ${pwd}
|
|
Run Keyword And Ignore Error Execute Command /opt/ShenTong/bin/isql -d OSRDB -U SYSDBA/szoscar55 -c "drop table xiba"
|
|
Execute Command /opt/ShenTong/bin/isql -d OSRDB -U SYSDBA/szoscar55 -c "create table xiba(a VARCHAR(10));"
|
|
Execute Command /opt/ShenTong/bin/isql -d OSRDB -U SYSDBA/szoscar55 -c "insert into xiba values('xibalasi');"
|
|
Close Connection
|
|
|
|
删除数据表
|
|
[Arguments] ${ip} ${user} ${pwd}
|
|
Open Connection ${ip}
|
|
SSHLibrary.Login ${user} ${pwd}
|
|
Run Keyword And Ignore Error Execute Command /opt/ShenTong/bin/isql -d OSRDB -U SYSDBA/szoscar55 -c "drop table xiba"
|
|
Close Connection
|
|
Sleep 2s
|
|
|
|
ShenTong备份
|
|
[Arguments] ${ShenTong_Agent} ${bk_type} ${DB_User} ${DB_PWD} ${DB_Instance} ${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=_ ${bk_type} ${date}
|
|
${createpolicy} Catenate SEPARATOR= 新建了策略[ ${random_strategyName} ]
|
|
Set Suite Variable ${random_strategyName}
|
|
Set Suite Variable ${createpolicy}
|
|
Sleep 5s
|
|
元素点击 xpath=//span[text()="${ShenTong_Agent}"] 点击选择代理 定位代理所在位置失败
|
|
Comment 元素点击 ${BackupSet} 点击进入备份集页面 定位备份集按钮失败
|
|
元素点击 ${dpm_Protection strategy} 点击进入保护策略页面 定位保护策略按钮失败
|
|
元素点击 ${Add_Policy} 点击添加策略按钮 定位添加策略按钮失败
|
|
元素点击 ${Module_ST} 点击添加神通数据库 定位神通数据库模块失败
|
|
元素输入 ${Input_celuename} ${random_strategyName} 定位策略名输入框失败
|
|
元素输入 ${Input_ST_Usename} ${DB_User} 定位用户名输入框失败
|
|
元素输入 ${Input_ST_Pwd} ${DB_PWD} 定位密码输入框失败
|
|
元素输入 ${Input_ST_Instance} ${DB_Instance} 定位实例名输入框失败
|
|
元素点击 ${Connection credentials_Next} 点击下一步进入目标数据库选择界面 定位下一步按钮失败
|
|
元素点击 ${ST_BK_Target} 点击勾选要备份的数据库 定位数据库前勾选框失败
|
|
元素点击 ${Target_database_Next_ST} 点击下一步进入任务周期界面 定位下一步按钮失败
|
|
元素点击 ${Add_TaskCycle} 点击添加任务周期 定位添加任务周期按钮失败
|
|
Run Keyword If "${bk_type}"=="完全" 完全备份
|
|
... ELSE IF "${bk_type}"=="增量" 增量备份
|
|
... ELSE IF "${bk_type}"=="差量" 差量备份
|
|
Sleep 2s
|
|
元素点击 ${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 重删
|
|
元素点击 ${Storage_NextStep} 点击下一步进入到备份高级选项 定位下一步失败
|
|
log 进入备份高级选项
|
|
FOR ${n} IN RANGE 3
|
|
${cache_status} Run Keyword And Return Status Wait Until Element Is Visible xpath=//input[@id="PathChangeB"]
|
|
Run Keyword If ${cache_status}==True 取消缓存
|
|
... ELSE Exit For Loop
|
|
END
|
|
Log 环境清理完毕
|
|
Run Keyword If ${encryption_attr}==1 加密
|
|
Run Keyword If ${compress_attr}==1 压缩
|
|
Run Keyword If ${cache}==1 备份缓存 /opt
|
|
元素点击 ${ST_Complete_CreatePolicy} 点击确定按钮完成策略创建 定位确定按钮失败
|
|
sleep 2s
|
|
元素点击 ${Success_Confirm} 确定策略创建成功 策略创建失败
|
|
sleep 2s
|
|
元素点击 ${BackupSet} 点击进入备份集一栏 定位备份集栏失败
|
|
Sleep 60s
|
|
Wait Until Page Contains Element Xpath=//td[text()="${random_strategyName}"]/..//td[text()="已完成"] 300s 备份未完成
|
|
Log 备份完成
|
|
Sleep 2s
|
|
sleep 10s
|
|
循环点击 ${BackupSet} ${View}
|
|
sleep 2s
|
|
元素点击 ${View} 点击进入备份集详情 定位备份集详情失败
|
|
Sleep 10s
|
|
加密属性校验 ${encryption}
|
|
压缩属性校验 ${compress}
|
|
重删属性校验 ${deduped}
|
|
缓存属性校验 ${bk_cache}
|
|
元素点击 ${Attr_Cancel} 点击取消关闭备份集详情弹窗 定位取消按钮失败
|
|
Log 备份集属性确认完毕
|
|
Sleep 2s
|
|
|
|
ShenTong恢复
|
|
[Arguments] ${DB_User} ${DB_PWD} ${DB_Instance} ${Cache}
|
|
sleep 5s
|
|
循环点击 ${BackupSet} ${Click_recover}
|
|
元素点击 ${Click_recover} 选择备份集进行恢复 定位恢复按钮失败
|
|
Sleep 2s
|
|
元素输入 ${Recover_ST_User} ${DB_User} 定位恢复数据库用户名输入框失败
|
|
Sleep 2s
|
|
元素输入 ${Recover_ST_PWD} ${DB_PWD} 定位恢复数据库密码输入框失败
|
|
元素输入 ${Recover_ST_Instance} ${DB_Instance} 定位恢复数据库实例名输入框失败
|
|
元素点击 ${Recover_Nextstep} 点击下一步进入恢复高级选项 定位下一步失败
|
|
sleep 3s
|
|
Run Keyword If ${cache}==1 恢复缓存 /opt
|
|
... ELSE IF ${cache}==0 Log 不勾选缓存
|
|
Sleep 2s
|
|
元素点击 ${ST_Rec_Exe} 确定完成恢复策略创建 恢复执行定位失败
|
|
Sleep 2s
|
|
元素点击 ${Recover_Confirm} 恢复确定 恢复确定弹窗定位失败
|
|
元素点击 ${Success_Confirm} 恢复策略确定创建成功 恢复作业创建成功弹窗定位失败
|
|
元素点击 ${Policy_Work} 点击进入作业栏 定位作业栏失败
|
|
Sleep 60s
|
|
Wait Until Page Contains Element ${Recover_Success} 1200s 恢复失败
|
|
sleep 2s
|
|
Log 恢复成功
|
|
|
|
完全备份
|
|
Sleep 2s
|
|
Click Element ${Full_Backup}
|
|
Log 勾选完全备份
|
|
|
|
差量备份
|
|
Sleep 2s
|
|
Click Element ${Divergence_Backup}
|
|
Log 勾选差量备份
|
|
|
|
增量备份
|
|
Sleep 2s
|
|
Click Element ${Incre_Backup}
|
|
Log 勾选增量备份
|
|
|
|
加密
|
|
Sleep 2s
|
|
元素点击 ${Type_encrypt} 勾选加密 定位选项选项失败
|
|
Sleep 2s
|
|
|
|
压缩
|
|
Log 点击压缩
|
|
Sleep 2s
|
|
元素点击 ${Type_compress} 点击勾选压缩选项 定位压缩失败
|
|
Sleep 2s
|
|
|
|
重删
|
|
Sleep 2s
|
|
元素点击 ${Type_dedup} 勾选重删 定位重删选项失败
|
|
Log 点击重删
|
|
Sleep 2s
|
|
|
|
取消压缩
|
|
Sleep 2s
|
|
元素点击 ${Type_compress} 点击取消勾选压缩选项 定位压缩失败
|
|
Log 取消勾选压缩
|
|
Sleep 2s
|
|
|
|
备份缓存
|
|
[Arguments] ${path}
|
|
元素点击 ${Active_Cache} 点击勾选缓存 定位缓存选项失败
|
|
Comment 元素点击 ${Button_Change_Cachepath} 点击更改缓存路径 定位缓存路径更改失败
|
|
sleep 2s
|
|
元素输入 ${Cache_Path} ${path} 定位缓存路径输入框失败
|
|
元素点击 ${Fin_CachePath} 缓存路径设置完毕 定位缓存路径设置确定按钮失败
|
|
|
|
取消缓存
|
|
元素点击 ${Active_Cache} 取消勾选缓存 定位缓存选项失败
|
|
|
|
恢复缓存
|
|
[Arguments] ${path}
|
|
元素点击 ${Recover_Cache} 勾选缓存 定位缓存选项失败
|
|
元素输入 ${Recover_CachePath} ${path} 定位缓存路径输入框失败
|
|
元素点击 ${Fin_Recover_CachePath} 缓存路径设置完毕 定位缓存路径设置确定按钮失败
|
|
Sleep 2s
|
|
|
|
校验数据表
|
|
[Arguments] ${ip} ${user} ${pwd}
|
|
Open Connection ${ip}
|
|
SSHLibrary.Login ${user} ${pwd}
|
|
${sql_result}= Execute Command /opt/ShenTong/bin/isql -d OSRDB -U SYSDBA/szoscar55 -c "select * from xiba;"
|
|
Should Contain ${sql_result} xiba
|
|
Execute Command /opt/ShenTong/bin/isql -d OSRDB -U SYSDBA/szoscar55 -c "drop table xiba"
|
|
Close Connection
|
|
|
|
插入数据表
|
|
[Arguments] ${ip} ${user} ${pwd}
|
|
Open Connection ${ip}
|
|
SSHLibrary.Login ${user} ${pwd}
|
|
Run Keyword And Ignore Error Execute Command /opt/ShenTong/bin/isql -d OSRDB -U SYSDBA/szoscar55 -c "insert into xiba select * from xiba"
|
|
Close Connection
|
|
|
|
立即执行_ShenTong
|
|
[Arguments] ${bk_type} # 立即备份执行备份类型
|
|
元素点击 ${Timed_DataProtect} 点击进入定时数据保护页面 定位定时数据保护失败
|
|
元素点击 ${dpm_Protection strategy} 切换到定时保护策略栏 定位定时保护策略功能栏失败
|
|
Sleep 2s
|
|
元素点击 xpath=//td[text()="${random_strategyName}"]/..//span[text()="立即执行"] 点击策略立即执行 定位立即执行失败
|
|
元素点击 ${Exe_ST_BK} 点击展开立即执行下拉框 定位立即执行备份类型失败
|
|
Run Keyword If "${bk_type}"=="完全" 立即执行_完全备份
|
|
... ELSE IF "${bk_type}"=="差量" 立即执行_差量备份
|
|
... ELSE IF "${bk_type}"=="增量" 立即执行_增量备份
|
|
Sleep 2s
|
|
循环点击 ${ExecutePolicy_execute} ${Complie_confirm}
|
|
Sleep 5s
|
|
元素点击 ${Complie_confirm} 点击确定按钮 定位确定按钮失败
|
|
元素点击 ${BackupSet} 点击进入备份集一栏 定位备份集栏失败
|
|
元素输入 ${Input_Policy_Name} ${random_strategyName} 输入策略名
|
|
FOR ${n} IN RANGE 10
|
|
Click Element ${Button_Searchbk}
|
|
${bk_status} Run Keyword And Return Status Wait Until Element Is Visible Xpath=//td[text()="${random_strategyName}"]/../td[contains(text(),"${bk_type}")]/../td[text()="已完成"]
|
|
Run Keyword If "${bk_status}"=="True" Exit For Loop
|
|
... ELSE Log 备份未完成
|
|
Sleep 60s
|
|
END
|
|
Run Keyword If ${bk_status}==False Fail
|
|
... ELSE Log 备份成功
|
|
Sleep 15s
|
|
|
|
立即执行_完全备份
|
|
Sleep 2s
|
|
Click Element ${Now Full_Bacup}
|
|
Log 勾选完全备份
|
|
|
|
立即执行_差量备份
|
|
Sleep 2s
|
|
Click Element ${Now Difference_Backup}
|
|
Log 勾选差量备份
|
|
|
|
立即执行_增量备份
|
|
Sleep 2s
|
|
Click Element ${Now Add_Backup}
|
|
Log 勾选增量备份
|
|
|
|
备份集属性校验
|
|
[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 缓存属性校验完毕
|
|
|
|
创建数据表win
|
|
[Arguments] ${ip} ${user} ${pwd}
|
|
Open Connection ${ip}
|
|
SSHLibrary.Login ${user} ${pwd}
|
|
start Command chcp 65001
|
|
Comment Execute Command cd C:\ShenTong\bin
|
|
Run Keyword And Ignore Error Execute Command C:\ShenTong\bin\isql -d OSRDB -U SYSDBA/szoscar55 -c "drop table xiba"
|
|
Execute Command C:\ShenTong\bin\isql -d OSRDB -U SYSDBA/szoscar55 -c "create table xiba(a VARCHAR(10));"
|
|
Execute Command C:\ShenTong\bin\isql -d OSRDB -U SYSDBA/szoscar55 -c "insert into xiba values('xibalasi');"
|
|
start Command C:\ShenTong\bin\isql -d OSRDB -U SYSDBA/szoscar55 -c "select count(*) from xiba;"
|
|
${out}= Read Command Output
|
|
log ${out}
|
|
Close Connection
|