2202 lines
124 KiB
Plaintext
2202 lines
124 KiB
Plaintext
*** Settings ***
|
||
Library Selenium2Library
|
||
Resource ../RE0_Common/KeyWord.robot
|
||
Resource ../RE4_CDP/KeyWord.robot
|
||
Library SSHLibrary
|
||
Library String
|
||
Library ../../Script/SC5_DR/Remainder.py
|
||
Resource ElementPath.robot
|
||
Variables ../../Config/DR/DR_config.py
|
||
Library ../../Script/SC0_Common/00_Initial/Vsphere.py
|
||
Library DateTime
|
||
|
||
*** Keywords ***
|
||
选择数据源
|
||
[Arguments] ${SourceType} ${DataSource} ${DrPlatformType}='' ${DrVirtualHostInCDR}='' ${AgentTiming}=''
|
||
Select DataSourceType ${SourceType}
|
||
Log 选择容灾数据源类型
|
||
Run Keyword If '${Source_Type}'=='实时备份数据' Run Keywords 选择容灾数据源 ${DataSource}
|
||
... AND Log 选择容灾数据源
|
||
... ELSE IF '${Source_Type}'=='虚拟化快照数据' Run Keywords Select DrPlatformType ${DrPlatformType}
|
||
... AND Select DrVirtualHostInCDR ${DrVirtualHostInCDR}
|
||
... AND sleep 5s
|
||
... AND 元素点击 xpath=//div[text()='Centos6.5 64bit_10.10.8.20']/../../td[1] 选择数据源成功 数据源获取失败
|
||
元素点击 ${Add_Policy_step2} 点击下一步按钮成功 下一步获取失败
|
||
|
||
容灾机配置(正确)
|
||
[Arguments] ${PDM_Type} ${Plafrom} ${coreCPU} ${numberCPU} ${Memory} ${Network} ${NetworkAdp} ${ChannelIP} ${SourceType} ${Network_Configuration}
|
||
Run Keyword If '${SourceType}'=='实时备份数据' Run Keywords Select PolicyDrMachineType ${PDM_Type}
|
||
... AND Log 选择容灾机类型
|
||
log 是否手动创建容灾机
|
||
sleep 5s
|
||
元素点击 ${Btn_Init} 自动创建容灾机 手动创建容灾机按钮定位失败
|
||
sleep 5s
|
||
Select DrPlatform ${Plafrom}
|
||
Log 选择容灾平台
|
||
元素输入 ${Input_Policy_CoreNumberCPU} ${coreCPU} CPU核心数元素获取失败
|
||
元素输入 ${Input_Policy_NumberCPU} ${numberCPU} CPU个数定位失败
|
||
元素输入 ${Input_Policy_Memory} ${Memory} 内存容量定位失败
|
||
Run Keyword If '${Network_Configuration}'=='保持原有网络配置' 保持原有网络配置
|
||
... ELSE IF '${Network_Configuration}'=='自定义网络配置' 自定义网络配置
|
||
Select ServerChannelIP ${ChannelIP}
|
||
Log 设置服务端通道IP
|
||
元素点击 ${Add_Policy_step3} 容灾机配置下一步点击成功 下一步获取失败
|
||
|
||
容灾机配置(错误)
|
||
[Arguments] ${PDM_Type} ${Plafrom} ${coreCPU} ${numberCPU} ${Memory} ${Network} ${NetworkAdp} ${ChannelIP} ${Message}
|
||
Select PolicyDrMachineType ${PDM_Type}
|
||
Log 选择容灾机类型
|
||
Comment 是否手动创建容灾机
|
||
Select DrPlatform ${Plafrom}
|
||
Log 选择容灾平台
|
||
元素输入 ${Input_Policy_CoreNumberCPU} ${coreCPU} CPU核心数元素获取失败
|
||
元素输入 ${Input_Policy_NumberCPU} ${numberCPU} CPU个数定位失败
|
||
元素输入 ${Input_Policy_Memory} ${Memory} 内存容量定位失败
|
||
Select NetWork ${Network}
|
||
Log 设置网络
|
||
Select NetWorkAdapter ${NetworkAdp}
|
||
Log 设置网络适配器
|
||
Select ServerChannelIP ${ChannelIP}
|
||
Log 设置服务端通道IP
|
||
元素点击 ${Add_Policy_step3} 容灾机配置下一步点击成功 下一步获取失败
|
||
Wait Until Element Is Visible ${Add_Policy_Alert_Message} 10s 警告弹出框
|
||
${info} Get Text ${Add_Policy_Alert_Message}
|
||
should contain ${info} ${Message}
|
||
sleep 2s
|
||
log 点击取消
|
||
click button ${Button_AlertOK}
|
||
|
||
容灾机模式配置_win
|
||
[Arguments] ${Mode} ${Auto_Switch} ${list} ${Auto_Type}
|
||
Select DRMode ${Mode}
|
||
log ${Mode}
|
||
Log 设置容灾机模式
|
||
Run Keyword If '${Auto_Switch}'=="是" and '${Mode}'=="演练模式" 自动演练配置win ${list} ${Auto_Type}
|
||
... ELSE IF '${Auto_Switch}'=="是" and '${Mode}'=="接管模式" 自动接管配置 ${list} ${Auto_Type}
|
||
... ELSE 完成容灾模式配置
|
||
|
||
容灾策略预览
|
||
[Arguments] ${PolicyName} ${Plafrom} ${coreCPU} ${numberCPU} ${Memory} ${Network} ${NetworkAdp} ${ChannelIP} ${PDM_Type} ${datasource}
|
||
Page Should Contain ${PolicyName}
|
||
Page Should Contain ${datasource}
|
||
Page Should Contain CPU个数:${numberCPU}
|
||
Page Should Contain CPU核心数:${coreCPU}
|
||
Comment Page Should Contain 内存容量:${Memory}
|
||
Page Should Contain ${Plafrom}
|
||
Page Should Contain ${Network}
|
||
Page Should Contain ${NetworkAdp}
|
||
Page Should Contain ${PDM_Type}
|
||
Page Should Contain ${ChannelIP}
|
||
Comment Run Keyword If '${SourceType}'=='虚拟化快照数据' Run Keywords
|
||
元素点击 xpath=//*[@id="rightContentMain"]//span[contains(text(),"完成")][1] 预览界面完成按钮点击成功 预览界面完成按钮元素定位失败
|
||
Log 进入下一步
|
||
sleep 10s
|
||
元素点击 ${Button_AlertOK} 策略创建完成 确认按钮获取失败
|
||
|
||
容灾策略创建完成状态
|
||
[Arguments] ${PolicyName} ${Select_DataTimePoint} ${snap_point}=''
|
||
sleep 20s
|
||
${temp} Get Text xpath=//*[@id="disasterTable"]//tr[td[text()="${PolicyName}"]]//td[4]
|
||
FOR ${n} IN RANGE 20
|
||
Sleep 1s
|
||
Run Keyword If "${temp}"=='' ${temp} Get Text xpath=//*[@id="disasterTable"]//tr[td[text()="${PolicyName}"]]//td[4]
|
||
... ELSE Exit For Loop
|
||
END
|
||
Run Keyword If '${temp}'=="创建中" 容灾策略创建完成状态 ${PolicyName} ${Select_DataTimePoint} ${snap_point}
|
||
... ELSE IF '${temp}'=="断开" 执行容灾策略 ${PolicyName} ${Select_DataTimePoint} ${snap_point}
|
||
... ELSE fail
|
||
|
||
执行容灾策略
|
||
[Arguments] ${PolicyName} ${Select_DataTimePoint} ${snap_point}=
|
||
元素点击 xpath=//*[@id="disasterTable"]//tr[td[text()="${PolicyName}"]]//td[9]//div//span[1] 手动演练/接管点击成功 手动演练/接管元素获取失败
|
||
sleep 5s
|
||
Run Keyword If '${Select_DataTimePoint}'=="最新时间点" 最新时间点
|
||
... ELSE IF '${Select_DataTimePoint}'=="指定时间点" 指定时间点
|
||
... ELSE IF '${Select_DataTimePoint}'=="已用时间点" 已用时间点
|
||
... ELSE IF '${Select_DataTimePoint}'=="指定快照" 指定快照 ${snap_point}
|
||
... ELSE 关闭浏览器
|
||
sleep 5s
|
||
元素点击 ${Button_DrPolicy_TakeOverFinish} 选择容灾数据时间点完成 选择容灾时间点完成按钮获取失败
|
||
sleep 3s
|
||
log 开始判断
|
||
${W_KeepData} Run Keyword And Return Status Wait Until Element Is Visible xpath=//div[text()="切换时间会丢失之前接管的数据"]
|
||
${W_LostData} Run Keyword And Return Status Wait Until Element Is Visible xpath=//*[@id="unaryLayer"]/div[1]/div[1]
|
||
log 判断结束
|
||
Run Keyword If ${W_LostData}==True 元素点击 xpath=//a[@class='layui-layer-btn1'] 确定按钮点击成功 确定按钮定位失败
|
||
... ELSE IF ${W_KeepData}==True 元素点击 xpath=//a[@class='layui-layer-btn1'] 确定按钮点击成功 确定按钮定位失败
|
||
... ELSE sleep 1s
|
||
sleep 3s
|
||
Wait Until Element Is Visible ${Button_AlertOK} 30
|
||
元素点击 ${Button_AlertOK} 手动演练/接管配置完成 点击确定操作失败
|
||
执行状态 ${PolicyName}
|
||
log 999991111
|
||
|
||
执行状态
|
||
[Arguments] ${PolicyName}
|
||
sleep 300s
|
||
${temp} Get Text xpath=//*[@id="disasterTable"]//td[text()="${PolicyName}"]/..//td[4]
|
||
Run Keyword If '${temp}'=="连接中" 执行状态 ${PolicyName}
|
||
... ELSE IF '${temp}'=="连接" Log 执行策略成功
|
||
... ELSE fail
|
||
[Teardown]
|
||
|
||
校验容灾机
|
||
Comment 校验CPU、内存
|
||
Open Connection ${DR_BC_IP} 22
|
||
SSHLibrary.Login ${DR_BC_Name} ${DR_BC_PWD}
|
||
Log 进入黑方后台
|
||
Write virsh list --name
|
||
${output} read delay=5s
|
||
Should Contain ${output} ${PolicyName}
|
||
Log 容灾机开启成功
|
||
Write cd /etc/libvirt/qemu
|
||
Write cat *${PolicyName} *
|
||
${output} read delay=5s
|
||
${Memery_total} Evaluate ${Memory}*1024*1024
|
||
Should Contain ${output} <memory unit='KiB'>${Memery_total}</memory>
|
||
Log 内存设置正确
|
||
Should Contain ${output} sockets='${CPU_Num}'
|
||
Log cpu设置正确
|
||
Close Connection
|
||
Comment 获取生产机文件md5值
|
||
sleep 5s
|
||
log 登录容灾机开始校验
|
||
sleep 240s
|
||
Open Connection ${Agent_HostIP} 22
|
||
SSHLibrary.Login ${Agent_User} ${Agent_Pwd} 20s
|
||
Log 进入生产机
|
||
write md5sum /A.txt | awk '{print $1}'
|
||
${output} read delay=5s
|
||
Log 获取生产机文件md5值
|
||
Close Connection
|
||
sleep 60s
|
||
Open Connection ${Add_IPV4_Address_Input} 22
|
||
SSHLibrary.Login ${Agent_User} ${Agent_Pwd} 20s
|
||
Log 进入演练机
|
||
write md5sum /A.txt | awk '{print $1}'
|
||
${output2} read delay=10s
|
||
Log 获取演练机文件md5值
|
||
Should Be Equal ${output2} ${output}
|
||
Log 验证成功
|
||
Close Connection
|
||
|
||
断开连接
|
||
[Arguments] ${PolicyName}
|
||
sleep 5s
|
||
Comment Log 断开连接
|
||
log ${PolicyName}
|
||
Wait Until Element Is Visible xpath=//*[@id="disasterTable"]//tr[td[text()="${PolicyName}"]]/td[9]//div//span[text()="断开连接"] 5s
|
||
元素点击 xpath=//*[@id="disasterTable"]//tr[td[text()="${PolicyName}"]]/td[9]//div//span[text()='断开连接'] 断开连接点击成功 断开连接定位失败
|
||
sleep 5s
|
||
Log 断开连接确定
|
||
元素点击 ${Disconnect_OK} 断开连接确定成功 断开连接确定定位失败
|
||
sleep 10s
|
||
Log 断开操作成功
|
||
元素点击 ${Button_AlertOK} 断开连接操作成功 断开连接操作失败
|
||
断开状态 ${PolicyName}
|
||
sleep 100s
|
||
|
||
断开状态
|
||
[Arguments] ${PolicyName}
|
||
sleep 60s
|
||
${temp} Get Text xpath=//*[@id="disasterTable"]//tr[td[text()="${PolicyName}"]]//td[4]
|
||
Run Keyword If '${temp}'=="断开中" 断开状态 ${PolicyName}
|
||
... ELSE IF '${temp}'=="断开" Log 断开连接成功
|
||
... ELSE 关闭浏览器
|
||
|
||
删除容灾策略
|
||
[Arguments] ${policyname}
|
||
sleep 5s
|
||
元素点击 xpath=//td[text()='${PolicyName}']/../td[9]//span[text()='更多'] 点击更多操作成功 更多操作定位失败
|
||
Log 获取更多操作
|
||
元素点击 ${Delete_Policy} 点击删除操作成功 删除操作定位失败
|
||
元素点击 ${Disconnect_OK} 删除确认按钮点击成功 删除确定定位失败
|
||
元素点击 ${Button_AlertOK} 删除策略确认按钮点击成功 确认按钮元素定位失败
|
||
删除中 ${policyname}
|
||
|
||
删除中
|
||
[Arguments] ${policyname}
|
||
${status} Run Keyword And Return Status Wait Until Element Contains ${policyname} 1
|
||
Run Keyword If '${status}'=="False" Log 删除成功
|
||
... ELSE IF '${status}'=="True" 删除状态 ${policyname}
|
||
|
||
删除状态
|
||
[Arguments] ${PolicyName}
|
||
sleep 10s
|
||
${temp} Get Text xpath=//*[@id="disasterTable"]//tr[td[text()="${PolicyName}"]]//td[3]
|
||
Run Keyword If '${temp}'=="删除中" 删除中 ${PolicyName}
|
||
... ELSE Log 删除策略成功
|
||
|
||
Select DataSourceType
|
||
[Arguments] ${SourceType}
|
||
Wait Until Page Contains Element ${Select_DataSourceType} 30s
|
||
Wait Until Element Is Visible ${Select_DataSourceType} 30s
|
||
Sleep 1s
|
||
Select From List By Label ${Select_DataSourceType} ${SourceType}
|
||
|
||
选择容灾数据源
|
||
[Arguments] ${DataSource}
|
||
Comment Wait Until Page Contains Element ${Select_DataSource} 30s
|
||
Comment log ${Select_DataSource}
|
||
Comment Wait Until Element Is Visible ${Select_DataSource} 30s
|
||
Comment Sleep 1s
|
||
Comment Select From List By Label ${Select_DataSource} ${DataSource}
|
||
元素点击 ${Select_DataSource} 点击数据源下拉框 定位数据源下拉框失败
|
||
log //*[@id="addPolicyDrSelectDataSourceRealTime"]/../div/dl/dd[contains(text(),"${DataSource}")]
|
||
元素点击 xpath=//*[@id="addPolicyDrSelectDataSourceRealTime"]/../div/dl/dd[contains(text(),"${DataSource}")] 选中数据源 选中数据源失败
|
||
sleep 5s
|
||
|
||
Select PolicyDrMachineType
|
||
[Arguments] ${PDM_Type}
|
||
Wait Until Page Contains Element ${Select_DrMachineType} 30s
|
||
Wait Until Element Is Visible ${Select_DrMachineType} 30s
|
||
Sleep 1s
|
||
Select From List By Label ${Select_DrMachineType} ${PDM_Type}
|
||
|
||
Select DrPlatform
|
||
[Arguments] ${Plafrom}
|
||
Wait Until Page Contains Element ${Select_DrPlatform} 30s
|
||
Wait Until Element Is Visible ${Select_DrPlatform} 30s
|
||
Sleep 1s
|
||
Select From List By Label ${Select_DrPlatform} ${Plafrom}
|
||
|
||
Select NetWork
|
||
[Arguments] ${Network}
|
||
Wait Until Page Contains Element ${Select_Policy_Network} 30s
|
||
Wait Until Element Is Visible ${Select_Policy_Network} 30s
|
||
Sleep 1s
|
||
Select From List By Label ${Select_Policy_Network} ${Network}
|
||
Log 设置网络
|
||
|
||
Select NetWorkAdapter
|
||
[Arguments] ${NetworkAdp}
|
||
Wait Until Page Contains Element ${Select_Policy_NetworkAdapter} 30s
|
||
Wait Until Element Is Visible ${Select_Policy_NetworkAdapter} 30s
|
||
Sleep 1s
|
||
Select From List By Label ${Select_Policy_NetworkAdapter} ${NetworkAdp}
|
||
Log 设置网络适配器
|
||
|
||
Select ServerChannelIP
|
||
[Arguments] ${ChannelIP}
|
||
Wait Until Page Contains Element ${Select_Policy_ChannelIP} 30s
|
||
Wait Until Element Is Visible ${Select_Policy_ChannelIP} 30s
|
||
Sleep 1s
|
||
Select From List By Label ${Select_Policy_ChannelIP} ${ChannelIP}
|
||
|
||
Select DRMode
|
||
[Arguments] ${DrMode}
|
||
Wait Until Page Contains Element ${Select_Policy_DrMode} 30s
|
||
Wait Until Element Is Visible ${Select_Policy_DrMode} 30s
|
||
Sleep 1s
|
||
Select From List By Label ${Select_Policy_DrMode} ${DrMode}
|
||
|
||
最新时间点
|
||
sleep 5s
|
||
元素点击 ${Click_DrPolicy_LatestTimePoint} 选择容灾数据时间点(最新时间点) 容灾数据时间点定位失败
|
||
|
||
已用时间点
|
||
元素点击 ${DRPolicy_UsedTimePoint} 选择容灾数据时间点(已用时间点) 容灾数据时间点定位失败
|
||
|
||
接管容灾策略创建完成状态
|
||
[Arguments] ${PolicyName}
|
||
sleep 10s
|
||
${temp} Get Text xpath=//*[@id="disasterTable"]//tr[td[text()="${PolicyName}"]]//td[4]
|
||
Run Keyword If '${temp}'=="创建中" 接管容灾策略创建完成状态 ${PolicyName}
|
||
... ELSE IF '${temp}'=="断开" Log 策略创建完成
|
||
... ELSE 关闭浏览器
|
||
|
||
查看生产机状态
|
||
[Arguments] ${PolicyName} ${IP} ${Select_DataTimePoint} ${snap_point}=
|
||
Comment 如果online进行关机,否则执行策略
|
||
Log 查看的生产机状态
|
||
Open Connection ${DR_BC_IP} 22
|
||
SSHLibrary.Login ${DR_BC_Name} ${DR_BC_PWD}
|
||
Log 进入黑方后台
|
||
Write ping \ '${IP}'
|
||
Sleep 5s
|
||
${output} read delay=20
|
||
Comment ${text2} Get Line ${output} 1
|
||
Close Connection
|
||
${flag} Evaluate 'Destination Host Unreachable' in $output
|
||
Run Keyword If ${flag} 执行容灾策略 ${PolicyName} ${Select_DataTimePoint} ${snap_point}
|
||
... ELSE 查看生产机状态 ${PolicyName} ${IP} ${Select_DataTimePoint} ${snap_point}
|
||
|
||
生产机关机
|
||
Log 打开生产机
|
||
Open Connection ${Agent_HostIP} 22
|
||
SSHLibrary.Login ${Agent_User} ${Agent_Pwd}
|
||
Write shutdown -h now
|
||
sleep 120s
|
||
Close Connection
|
||
|
||
校验接管容灾机
|
||
Comment 校验CPU、内存
|
||
Open Connection ${DR_BC_IP} 22
|
||
SSHLibrary.Login ${DR_BC_Name} ${DR_BC_PWD}
|
||
Log 进入黑方后台
|
||
Write virsh list --name
|
||
${output} read delay=1s
|
||
Should Contain ${output} ${PolicyName}
|
||
Log 容灾机开启成功
|
||
Write cd /etc/libvirt/qemu
|
||
Write cat *${PolicyName}*
|
||
${output} read delay=3s
|
||
${Memery_total} Evaluate ${Memory}*1024*1024
|
||
Should Contain ${output} <memory unit='KiB'>${Memery_total}</memory>
|
||
Log 内存设置正确
|
||
Should Contain ${output} sockets='${CPU_Num}'
|
||
Should Contain ${output} cores='${CPU_Core}'
|
||
Log cpu设置正确
|
||
Close Connection
|
||
sleep 40s
|
||
Comment 获取接管容灾机文件md5值
|
||
Open Connection ${Agent_HostIP} 22
|
||
SSHLibrary.Login ${Agent_User} ${Agent_Pwd}
|
||
Log 进入接管容灾机
|
||
sleep 5s
|
||
Start Command md5sum /A.txt | awk '{print $1}'
|
||
${output} Read Command Output delay=3s
|
||
Log 获取接管容灾机文件md5值
|
||
log ${origin_file_md5}
|
||
log ${output}
|
||
Should Be Equal ${output} ${origin_file_md5}
|
||
Close Connection
|
||
Log 容灾机数据校验成功
|
||
|
||
完成容灾模式配置
|
||
元素点击 ${Add_Policy_step4} 容灾模式下一步点击成功 下一步获取失败
|
||
|
||
自动演练配置
|
||
[Arguments] ${list} ${Auto_Type}
|
||
元素点击 ${Add_Policy_AutoSwitch} 开启自动演练成功 自动演练开启按钮获取失败
|
||
sleep 10s
|
||
Run Keyword If '${Auto_Type}'=='脚本' 选择脚本文件
|
||
... ELSE IF '${Auto_Type}'=='服务' 自动演练服务选择 ${list}
|
||
完成容灾模式配置
|
||
|
||
选择服务
|
||
[Arguments] ${element}
|
||
${temp} Get Text xpath=//*[@class="layui-laypage-count"]
|
||
${length} Get Length ${temp}
|
||
${total} Get Substring ${temp} 1 ${length-1}
|
||
${page} Calc Remainder ${total} 10
|
||
FOR ${i} IN RANGE 1 ${page}+1 1
|
||
元素输入 xpath=//*[@class="layui-table-page"]//button[text()="确定"]/..//input ${i} 页数输入框定位失败
|
||
元素点击 xpath=//*[@class="layui-table-page"]//button[text()="确定"] 点击确定成功 确定按钮获取失败
|
||
${temp} Run Keyword And Return Status Page Should Contain ${element}
|
||
log ${element}
|
||
Run Keyword If '${temp}'=='True' Run Keywords 勾选服务 ${element}
|
||
... AND Log ${element}选择成功
|
||
... AND Exit For Loop
|
||
... ELSE Continue For Loop
|
||
END
|
||
|
||
勾选服务
|
||
[Arguments] ${element}
|
||
元素点击 xpath=//div[contains(text(),"${element}")]/../../td[1] 服务勾选成功 服务位置获取失败
|
||
|
||
选择脚本文件
|
||
元素点击 xpath=//*[@ng-click="addPolicyDrimportScript()"] 点击选择脚本文件按钮成功 选择脚本按钮元素获取失败
|
||
元素点击 xpath=//div[text()="UnaEDRDrillServiceReport7X"]/../../td[1] 选择linux脚本文件成功 选择linux脚本文件元素获取失败
|
||
元素点击 xpath=//*[@id="addPolicyDrSelectScriptFile"]/div[2]/button[2] 脚本选择导入成功 获取导入按钮元素失败
|
||
|
||
自动演练策略创建完成状态
|
||
[Arguments] ${PolicyName}
|
||
sleep 60s
|
||
Wait Until Element Is Visible //*[@id="disasterTable"]//tr[td[text()="${PolicyName}"]]//td[4] 10s 定位容灾状态失败
|
||
${temp} Get Text xpath=//*[@id="disasterTable"]//tr[td[text()="${PolicyName}"]]//td[4]
|
||
Run Keyword If '${temp}'=="创建中" 自动演练策略创建完成状态 ${PolicyName}
|
||
... ELSE IF '${temp}'=="断开" 自动演练策略创建完成状态 ${PolicyName}
|
||
... ELSE IF '${temp}'=="连接" Log 开始自动演练
|
||
... ELSE 关闭浏览器
|
||
|
||
校验演练报告
|
||
[Arguments] ${PolicyName}
|
||
sleep 5s
|
||
元素点击 //*[@id="disasterTable"]/div[2]/table//td[text()="${PolicyName}"]/..//span[text()="更多"] 点击更多操作成功 更多操作定位失败
|
||
Log 获取更多操作
|
||
sleep 5s
|
||
元素点击 ${Click_LookReport} 点击查看演练报告 获取点击查看演练报告失败
|
||
${temp} Run Keyword And Return Status Page Should Contain 查看报告
|
||
Run Keyword If '${temp}'=='True' Run Keywords Log 自动演练成功
|
||
... AND 校验报告内容
|
||
... ELSE Log 自动演练失败
|
||
sleep 5s
|
||
元素点击 xpath=//*[@id="drLookDrillReportId"]/div[2]/button 关闭演练报告窗口 关闭演练报告窗口失败
|
||
|
||
等待自动演练完成
|
||
[Arguments] ${PolicyName}
|
||
sleep 480s
|
||
Wait Until Element Is Visible xpath=//*[@id="disasterTable"]//tr[td[text()="${PolicyName}"]]//td[4] 10s 容灾策略不存在
|
||
${temp} Get Text xpath=//*[@id="disasterTable"]//tr[td[text()="${PolicyName}"]]//td[4]
|
||
Run Keyword If '${temp}'=="连接" 等待自动演练完成 ${PolicyName}
|
||
... ELSE IF '${temp}'=="断开" Log 自动演练作业结束
|
||
|
||
校验报告内容
|
||
sleep 10s
|
||
元素点击 xpath=//a[text()="查看报告"] 查看演练报告 获取查看报告失败
|
||
sleep 5s
|
||
元素点击 xpath=//*[@id="drDrillReportDetailsId"]/div[2]/button 关闭查看演练报告窗口 关闭查看演练报告窗口失败
|
||
|
||
创建容灾策略
|
||
[Arguments] ${PolicyName} ${SourceType} ${DataSource} ${PDM_Type} ${Plafrom} ${coreCPU} ${numberCPU} ${Memory} ${Network} ${NetworkAdp} ${list} ${Auto_Switch} ${DrMode} ${DR_Type} ${Source} ${Auto_Type}
|
||
... ${DrPlatformType}='' ${DrVirtualHostInCDR}='' ${AgentTiming}='' #数据源类型|数据源|容灾平台类型|容灾平台|cpu内核|cpu数|内存|网络|网络适配器|服务列表|是否自动演练/接管|容灾模式|容灾类型
|
||
sleep 3s
|
||
元素点击 ${Btn_Add_Drpolicy} 点击创建容灾策略成功 创建容灾策略点击失败
|
||
元素输入 ${Input_DrPolicyName} ${PolicyName} 获取容灾策略名输入元素失败
|
||
comment 数据源类型 数据源
|
||
选择数据源 ${SourceType} ${DataSource} ${DrPlatformType} ${DrVirtualHostInCDR} ${AgentTiming}
|
||
comment 容灾机类型 容灾平台 cpu核心数 cpu个数 内存 网络 网络适配器 服务端通道
|
||
容灾机配置(正确) ${PDM_Type} ${Plafrom} ${coreCPU} ${numberCPU} ${Memory} ${Network} ${NetworkAdp} ${DR_BC_IP} ${SourceType} ${Network_Configuration_custom}
|
||
comment 容灾机模式
|
||
容灾机模式配置_win ${DrMode} ${Auto_Switch} ${list} ${Auto_Type}
|
||
容灾策略预览 ${PolicyName} ${Plafrom} ${coreCPU} ${numberCPU} 服务列表 ${Network} ${NetworkAdp} ${Data_Address_Transfer} ${DR_Type} ${Source}
|
||
|
||
自动演练服务选择
|
||
[Arguments] ${list}
|
||
元素点击 ${Add_Policy_GetServiceData} 获取服务数据点击成功 获取服务数据元素定位失败
|
||
sleep 10s
|
||
FOR ${element} IN @{list}
|
||
log ${element}
|
||
选择服务 ${element}
|
||
Continue For Loop
|
||
END
|
||
|
||
Select DrPlatformType
|
||
[Arguments] ${DrPlatformType}
|
||
Wait Until Page Contains Element ${Select_DrPlatformType} 30s
|
||
Wait Until Element Is Visible ${Select_DrPlatformType} 30s
|
||
Sleep 1s
|
||
Select From List By Label ${Select_DrPlatformType} ${DrPlatformType}
|
||
|
||
Select DrVirtualHostInCDR
|
||
[Arguments] ${DrVirtualHostInCDR}
|
||
Wait Until Page Contains Element ${Select_DrVirtualHostInCDR} 30s
|
||
Wait Until Element Is Visible ${Select_DrVirtualHostInCDR} 30s
|
||
Sleep 1s
|
||
Select From List By Label ${Select_DrVirtualHostInCDR} ${DrVirtualHostInCDR}
|
||
|
||
Select AgentTiming
|
||
[Arguments] ${AgentTiming}
|
||
Wait Until Page Contains Element ${Select_DrVirtualHostInCDR} 30s
|
||
Wait Until Element Is Visible ${Select_DrVirtualHostInCDR} 30s
|
||
Sleep 1s
|
||
Select From List By Label ${Select_DrVirtualHostInCDR} ${AgentTiming}
|
||
|
||
Select NetWork2
|
||
[Arguments] ${Network}
|
||
Wait Until Page Contains Element ${Select_Policy_Network2} 30s
|
||
Wait Until Element Is Visible ${Select_Policy_Network2} 30s
|
||
Sleep 1s
|
||
Select From List By Label ${Select_Policy_Network2} ${Network}
|
||
Log 设置网络
|
||
|
||
Select NetWorkAdapter2
|
||
[Arguments] ${NetworkAdp}
|
||
Wait Until Page Contains Element ${Select_Policy_NetworkAdapter2} 30s
|
||
Wait Until Element Is Visible ${Select_Policy_NetworkAdapter2} 30s
|
||
Sleep 1s
|
||
Select From List By Label ${Select_Policy_NetworkAdapter2} ${NetworkAdp}
|
||
Log 设置网络适配器
|
||
|
||
指定快照
|
||
[Arguments] ${snap_point}
|
||
元素点击 ${Click_DrPolicy_LatestSnap} 选择容灾数据时间点 容灾数据时间点定位失败
|
||
sleep 2s
|
||
元素点击 xpath=//div[contains(text(),'${snap_point}')]/../../td[1] 选择快照成功 选择快照定位失败
|
||
|
||
校验容灾机状态
|
||
[Arguments] ${Esxi_IP} ${Esxi_User} ${Esxi_PWD}
|
||
Sphere Login ${Esxi_IP} ${Esxi_User} ${Esxi_PWD}
|
||
Log 登录esxi成功
|
||
Vsphere.Vm Poweron Name ${PolicyName}
|
||
Log 容灾机已开启
|
||
|
||
接管机性能数据采集
|
||
${time1} Evaluate ${times}*30
|
||
${time2} Evaluate ${times}*28+30
|
||
Log 接管容灾机开机时间在${time1}s—${time2}s之间
|
||
Run Keyword If ${times}>0 Log 接管容灾机开机时间未在30s内
|
||
... ELSE Log 接管容灾机开机时间在30s内
|
||
|
||
循环次数
|
||
${times} Evaluate ${times}+1
|
||
Set Global Variable ${times}
|
||
|
||
校验容灾机(指定快照1)
|
||
Comment 校验CPU、内存
|
||
Open Connection ${DR_BC_IP} 22
|
||
SSHLibrary.Login ${DR_BC_Name} ${DR_BC_PWD}
|
||
Log 进入黑方后台
|
||
Write virsh list --name
|
||
${output} read delay=1s
|
||
Should Contain ${output} ${PolicyName}
|
||
Log 容灾机开启成功
|
||
Write cd /etc/libvirt/qemu
|
||
Write cat *${PolicyName} *
|
||
${output} read delay=1s
|
||
${Memery_total} Evaluate ${Memory}*1024*1024
|
||
Should Contain ${output} <memory unit='KiB'>${Memery_total}</memory>
|
||
Log 内存设置正确
|
||
Should Contain ${output} sockets='${CPU_Num}' cores='${CPU_Core}'
|
||
Log cpu设置正确
|
||
Close Connection
|
||
Comment 获取生产机文件md5值
|
||
Open Connection ${Agent_HostIP} 22
|
||
SSHLibrary.Login ${Agent_User} ${Agent_Pwd}
|
||
Log 进入生产机
|
||
write cat ${drillfile_path}
|
||
${output1} read delay=2s
|
||
${text2} Get Line ${output1} 9
|
||
${text3} Get Substring ${text2} 13 23
|
||
Log 获取演练机IP
|
||
Close Connection
|
||
sleep 60s
|
||
Open Connection ${text3} 22
|
||
SSHLibrary.Login ${Agent_User} ${Agent_Pwd}
|
||
Log 进入演练机
|
||
write md5sum ${file_path1}
|
||
${output2} read delay=2s
|
||
${text4} Get Substring ${output2} 0 32
|
||
Log 获取演练机文件md5值
|
||
Should Be Equal ${text4} ${file_md5}
|
||
Log 验证成功
|
||
Close Connection
|
||
|
||
校验容灾机(指定快照2)
|
||
Comment 校验CPU、内存
|
||
Open Connection ${DR_BC_IP} 22
|
||
SSHLibrary.Login ${DR_BC_Name} ${DR_BC_PWD}
|
||
Log 进入黑方后台
|
||
Write virsh list --name
|
||
${output} read delay=1s
|
||
Should Contain ${output} ${PolicyName}
|
||
Log 容灾机开启成功
|
||
Write cd /etc/libvirt/qemu
|
||
Write cat *${PolicyName} *
|
||
${output} read delay=1s
|
||
${Memery_total} Evaluate ${Memory}*1024*1024
|
||
Should Contain ${output} <memory unit='KiB'>${Memery_total}</memory>
|
||
Log 内存设置正确
|
||
Should Contain ${output} sockets='${CPU_Num}' cores='${CPU_Core}'
|
||
Log cpu设置正确
|
||
Close Connection
|
||
Comment 获取生产机文件md5值
|
||
Open Connection ${Agent_HostIP} 22
|
||
SSHLibrary.Login ${Agent_User} ${Agent_Pwd}
|
||
Log 进入生产机
|
||
write cat ${drillfile_path}
|
||
${output1} read delay=2s
|
||
${text2} Get Line ${output1} 9
|
||
${text3} Get Substring ${text2} 13 23
|
||
Log 获取演练机IP
|
||
Close Connection
|
||
sleep 60s
|
||
Open Connection ${text3} 22
|
||
SSHLibrary.Login ${Agent_User} ${Agent_Pwd}
|
||
Log 进入演练机
|
||
write md5sum ${file_path2}
|
||
${output2} read delay=2s
|
||
${text4} Get Substring ${output2} 0 32
|
||
Log 获取演练机文件md5值
|
||
Should Be Equal ${text4} ${file2_md5}
|
||
Log 文件md5值成功
|
||
write find file_path1
|
||
${output3} read delay=2s
|
||
${text2} Get Line ${output3} 0
|
||
Run Keyword If '${text2}'>'没有那个文件或目录' Log 验证成功
|
||
... ELSE IF '${text2}'>'No such file or directory' Log 验证成功
|
||
... ELSE Run Keywords Log 验证失败
|
||
... AND 关闭浏览器
|
||
Close Connection
|
||
|
||
自动接管配置
|
||
[Arguments] ${list} ${Auto_Type}
|
||
元素点击 ${Add_Policy_AutoTakeOverSwitch} 开启自动接管成功 自动接管开启按钮获取失败
|
||
sleep 10s
|
||
log 设置离线时间
|
||
元素输入 ${Input_RetryTime} ${RetryTime} 设置离线时间失败
|
||
log ${Input_RetryCycle}
|
||
元素输入 ${Input_RetryNum} ${RetryCycle} 设置检测周期失败
|
||
log 异常次数
|
||
元素输入 //*[@id="addPolicyDrDetectionAlarm"] ${RetryNum} 设置异常次数失败
|
||
Run Keyword If '${Auto_Type}'=='脚本' 选择脚本文件
|
||
... ELSE IF '${Auto_Type}'=='服务' 自动演练服务选择 ${list}
|
||
完成容灾模式配置
|
||
|
||
自动接管等待
|
||
[Arguments] ${list}
|
||
Comment 获取生产机文件md5值
|
||
Open Connection ${Agent1_HostIP} 22
|
||
SSHLibrary.Login ${Agent1_User} ${Agent1_Pwd}
|
||
Log 关闭服务
|
||
FOR ${element} IN @{list}
|
||
log ${element}
|
||
Execute Command service ${element} stop
|
||
Comment ${Message} Read Command Output
|
||
Comment Should Contain ${Message} SUCCESS
|
||
Log ${element}服务关闭成功
|
||
Continue For Loop
|
||
END
|
||
Close Connection
|
||
${time} Evaluate (${RetryTime}+${RetryCycle}*(${RetryNum}-1)+4)*60
|
||
sleep ${time}s
|
||
|
||
生产机关机_win
|
||
Log 打开生产机
|
||
Open Connection ${Agent_HostIP_win} 22
|
||
SSHLibrary.Login ${Agent_User_win} ${Agent_Pwd_win}
|
||
Start Command shutdown /s /t 0
|
||
sleep 120s
|
||
Close Connection
|
||
|
||
查看生产机状态_win_old
|
||
[Arguments] ${PolicyName} ${IP} ${Select_DataTimePoint} ${snap_point}=
|
||
Comment 如果online进行关机,否则执行策略
|
||
Log 查看生产机的状态_win_old
|
||
Open Connection ${DR_BC_IP} 22
|
||
SSHLibrary.Login ${DR_BC_Name} ${DR_BC_PWD}
|
||
Log 进入黑方后台
|
||
Write ping \ '${IP}'
|
||
${output} read delay=6s
|
||
${text2} Get Line ${output} 1
|
||
Close Connection
|
||
Run Keyword If '${text2}'=='From ${DR_BC_IP} icmp_seq=1 Destination Host Unreachable' 执行容灾策略 ${PolicyName} ${Select_DataTimePoint} ${snap_point}
|
||
... ELSE 生产机关机_win ${PolicyName} ${IP} ${Select_DataTimePoint} ${snap_point}
|
||
${Select_DataTimePoint} ${snap_point}
|
||
|
||
创建通用容灾策略
|
||
[Arguments] ${SourceType} ${DataSource} ${PDM_Type} ${Plafrom} ${coreCPU} ${numberCPU} ${Memory} ${Network} ${NetworkAdp} ${BC_IP} ${DR_Type} ${Source} ${DrPlatformType}='' ${DrVirtualHostInCDR}='' ${AgentTiming}=''
|
||
sleep 3s
|
||
${date} Evaluate time.strftime('%Y%m%d%H%M%S',time.localtime()) time
|
||
${random_strategyName}= Catenate SEPARATOR=_ YL ${date}
|
||
Set Suite Variable ${random_strategyName}
|
||
元素点击 ${Btn_Add_Drpolicy} 点击创建容灾策略成功 创建容灾策略点击失败
|
||
元素输入 ${Input_DrPolicyName} ${random_strategyName} 获取容灾策略名输入元素失败
|
||
comment 数据源类型 数据源
|
||
选择数据源 ${SourceType} ${DataSource} ${DrPlatformType} ${DrVirtualHostInCDR} ${AgentTiming}
|
||
comment 容灾机类型 容灾平台 cpu核心数 cpu个数 内存 网络 网络适配器 服务端通道
|
||
容灾机配置(正确) ${PDM_Type} ${Plafrom} ${coreCPU} ${numberCPU} ${Memory} ${Network} ${NetworkAdp} ${BC_IP} ${SourceType}
|
||
comment 容灾机模式
|
||
comment 容灾机模式配置_win ${DrMode} ${Auto_Switch} ${list} ${Auto_Type}
|
||
完成容灾模式配置
|
||
循环点击 ${Add_Policy_Finish} ${Button_AlertOK}
|
||
Log 进入下一步
|
||
sleep 5s
|
||
元素点击 ${Button_AlertOK} 策略创建完成 确认按钮获取失败
|
||
|
||
Windows文件系统校验
|
||
[Arguments] ${rz_agent} ${rz_name} ${rz_pwd} ${bc_agent} ${bc_name} ${bc_pwd} # 容灾代理IP|容灾用户名|容灾密码|黑方IP|黑方密码|黑方密码
|
||
Sleep 300
|
||
Open Connection ${rz_agent}
|
||
SSHLibrary.Login ${rz_name} ${rz_pwd}
|
||
Execute Command chcp 437&&chkdsk C: > C:\\Users\\Administrator\\auto.txt
|
||
Get File C:\\Users\\Administrator\\auto.txt .
|
||
Close Connection
|
||
Log 将容灾机内执行结果下载到本地
|
||
Open Connection ${bc_agent}
|
||
SSHLibrary.Login ${bc_name} ${bc_pwd}
|
||
PUT File ./auto.txt /opt
|
||
${Result}= Execute Command grep "found no problems" /opt/auto.txt
|
||
Should Contain ${Result} found no problems
|
||
Close Connection
|
||
Log 将本地结果发送到黑方,并校验内容
|
||
|
||
添加容灾平台
|
||
[Arguments] ${BCIP} ${BCNAME} ${BCPWD} ${AddDRPlatformType} ${WEBNAME} ${WEBPWD} ${ESXiIP} ${ESXIUSER} ${ESXIPWD} ${CASIP} ${CASUSER} ${CASPWD}
|
||
Open Connection ${BCIP} 22
|
||
SSHLibrary.Login ${BCNAME} ${BCPWD}
|
||
Log 进入黑方后台
|
||
Write mysql -uunadba -p1223Bc@2008
|
||
Write use unary
|
||
Write select * from tbl_drplatform;
|
||
${output1} read delay=1s
|
||
Log ${output1}
|
||
${flag1} Evaluate ${BCIP} not in $output1
|
||
${flag2} Evaluate ${ESXiIP} not in $output1
|
||
${flag3} Evaluate ${CASIP} not in $output1
|
||
Close Connection
|
||
Run Keyword If '${AddDRPlatformType}'=='UnaWare' and ${flag1} Run Keywords Log 添加内置容灾平台
|
||
... AND 元素点击 ${DR_Manage} 点击容灾管理成功 定位容灾管理失败 30s
|
||
... AND sleep 2s
|
||
... AND 元素点击 ${Add_DRPlatform} 点击添加容灾平台成功 定位添加容灾平台失败 30s
|
||
... AND sleep 2s
|
||
... AND Select AddDRPlatformType ${AddDRPlatformType}
|
||
... AND Log 选择内置容灾平台
|
||
... AND sleep 2s
|
||
... AND 元素输入 ${Input_AddDRPt_IP} ${BCIP} 获取IP输入元素失败
|
||
... AND 元素输入 ${Input_AddDRPt_UserName} ${WEBNAME} 获取用户名输入元素失败
|
||
... AND 元素输入 ${Input_AddDRPt_password} ${WEBPWD} 获取密码输入元素失败
|
||
... AND 元素点击 ${Btn_AddDRPt_OK} 点击确定按钮成功 定位确定按钮失败 30s
|
||
... AND sleep 20s
|
||
... AND 元素点击 ${Btn_AfterAddDRPt_OK} 点击确定按钮成功 定位确定按钮失败 30s
|
||
... AND sleep 5s
|
||
... ELSE IF '${AddDRPlatformType}'=='ESXi' and ${flag2} Run Keywords Log 添加ESXi容灾平台
|
||
... AND 元素点击 ${DR_Manage} 点击容灾管理成功 定位容灾管理失败 30s
|
||
... AND sleep 2s
|
||
... AND 元素点击 ${Add_DRPlatform} 点击添加容灾平台成功 定位添加容灾平台失败 30s
|
||
... AND sleep 2s
|
||
... AND Select AddDRPlatformType ${AddDRPlatformType}
|
||
... AND Log 选择ESXi容灾平台
|
||
... AND sleep 2s
|
||
... AND 元素输入 ${Input_AddDRPt_Name} ${ESXiIP} 获取备注平台名输入元素失败
|
||
... AND 元素输入 ${Input_AddDRPt_IP} ${ESXiIP} 获取IP输入元素失败
|
||
... AND 元素输入 ${Input_AddDRPt_UserName} ${ESXIUSER} 获取用户名输入元素失败
|
||
... AND 元素输入 ${Input_AddDRPt_password} ${ESXIPWD} 获取密码输入元素失败
|
||
... AND 元素点击 ${Btn_AddDRPt_OK} 点击确定按钮成功 定位确定按钮失败 30s
|
||
... AND sleep 20s
|
||
... AND 元素点击 ${Btn_AfterAddDRPt_OK} 点击确定按钮成功 定位确定按钮失败 30s
|
||
... AND sleep 5s
|
||
... ELSE IF '${AddDRPlatformType}'=='H3C-CAS' and ${flag3} Run Keywords Log 添加CAS容灾平台
|
||
... AND 元素点击 ${DR_Manage} 点击容灾管理成功 定位容灾管理失败 30s
|
||
... AND sleep 2s
|
||
... AND 元素点击 ${Add_DRPlatform} 点击添加容灾平台成功 定位添加容灾平台失败 30s
|
||
... AND sleep 2s
|
||
... AND Select AddDRPlatformType ${AddDRPlatformType}
|
||
... AND Log 选择CAS容灾平台
|
||
... AND sleep 2s
|
||
... AND 元素输入 ${Input_AddDRPt_Name} ${CASIP} 获取备注平台名输入元素失败
|
||
... AND 元素输入 ${Input_AddDRPt_IP} ${CASIP} 获取IP输入元素失败
|
||
... AND 元素输入 ${Input_AddDRPt_UserName} ${CASUSER} 获取用户名输入元素失败
|
||
... AND 元素输入 ${Input_AddDRPt_password} ${CASPWD} 获取密码输入元素失败
|
||
... AND 元素点击 ${Btn_AddDRPt_OK} 点击确定按钮成功 定位确定按钮失败 30s
|
||
... AND sleep 20s
|
||
... AND 元素点击 ${Btn_AfterAddDRPt_OK} 点击确定按钮成功 定位确定按钮失败 30s
|
||
... AND sleep 5s
|
||
... ELSE Log 容灾平台已存在
|
||
|
||
Select AddDRPlatformType
|
||
[Arguments] ${AddDRPlatformType}
|
||
Wait Until Page Contains Element ${Select_AdddDRPt_Pt} 30s
|
||
Wait Until Element Is Visible ${Select_AdddDRPt_Pt} 30s
|
||
Sleep 1s
|
||
Select From List By Label ${Select_AdddDRPt_Pt} ${AddDRPlatformType}
|
||
|
||
渐进式回迁方式
|
||
[Arguments] ${ip} ${user} ${pwd} ${drRelocationCdpPropertyWayList} ${drRelocationCdpDataTransferMode} ${PolicyName} #livecd ip |livecd 用户名| livecd密码 |回迁方式 |数据传输模式
|
||
Comment 获取livecd localid
|
||
Open Connection ${ip}
|
||
SSHLibrary.Login ${user} ${pwd}
|
||
sleep 2s
|
||
Start Command grep -w 'localId' /usr/cdpagent/agent/ubackup/uagent/conf/node.properties |sed 's/localId=\(.*\)/\1/g'
|
||
${localId} Read Command Output
|
||
log ${localId}
|
||
Close Connection
|
||
sleep 20s
|
||
元素点击 xpath=//*[@id="disasterTable"]//tr[td[text()="${PolicyName}"]]//td[9]//div//span[5] 点击更多按钮成功 定位更多元素失败
|
||
元素点击 //*[@id="app"]/ul/li[2] 点击回迁按钮成功 点击回迁按钮失败
|
||
sleep 60s
|
||
元素点击 //*[@id="drRelocationCdpTargetMachine"] 点击选择目标机成功 点击选择目标机失败
|
||
元素点击 //option[text()='livecd.${LIVECD_IP}'] 选择目标livecd成功 定位目标livecd失败
|
||
元素点击 //*[@id="drRelocationCdpPropertyWayList"] 点击选择回迁方式成功 定位选择回迁方式失败
|
||
Run Keyword If "${drRelocationCdpPropertyWayList}"=="渐进式回迁" 选择渐进式回迁
|
||
... ELSE IF "${drRelocationCdpPropertyWayList}"=="仅恢复增量数据" 选择仅恢复增量数据回迁
|
||
元素点击 //*[@id="drRelocationCdpDataTransferMode"] 选择数据传输选择框成功 定位数据传输选择框失败
|
||
Run Keyword If "${drRelocationCdpDataTransferMode}"=="iSCSI" 选择iSCSI传输方式
|
||
... ELSE IF "${drRelocationCdpDataTransferMode}"=="FC" 选择FC传输方式
|
||
... ELSE 选择OSVI传输方式 1
|
||
sleep 2s
|
||
|
||
选择渐进式回迁
|
||
元素点击 ${CdpPropertyWayList_Jianjin} 点击渐进式回迁方式成功 定位渐进式回迁方式失败
|
||
|
||
选择仅恢复增量数据回迁
|
||
元素点击 ${CdpPropertyWayList_Zengliang} 点击渐进式回迁方式成功 定位渐进式回迁方式失败
|
||
|
||
选择iSCSI传输方式
|
||
元素点击 ${DR_TransferMode_iSCSI} 选择iSCSI传输方式成功 定位iSCSI传输方式失败
|
||
|
||
选择OSVI传输方式
|
||
[Arguments] ${compress} # OSVI压缩
|
||
元素点击 ${DR_TransferMode_OSVI} 选择OSVI传输方式成功 定位OSVI传输方式失败
|
||
Sleep 2s
|
||
Run Keyword If ${compress}==0 Log 不勾选压缩
|
||
... ELSE IF ${compress}==1 元素点击 ${DrRelocationCdp_Compress} 勾选压缩 定位压缩失败
|
||
|
||
选择FC传输方式
|
||
元素点击 ${DR_TransferMode_FC} 选择iSCSI传输方式成功 定位iSCSI传输方式失败
|
||
|
||
选择黑方IP1
|
||
元素点击 //option[text()='${DR_BC_IP}'] 选择黑方IP通道1成功 定位黑方IP通道1失败
|
||
|
||
选择黑方IP2
|
||
元素点击 //option[text()='${DR_BC_IP2}'] 选择黑方IP通道2成功 定位黑方IP通道2失败
|
||
|
||
选择黑方IP3
|
||
元素点击 //option[text()='${DR_BC_IP3}'] 选择黑方IP通道3成功 定位黑方IP通道3失败
|
||
|
||
回迁作业任务
|
||
comment 进入恢复作业管理界面
|
||
元素点击 //*[@id="menu"]/li[2] 成功进入恢复作业管理界面 定位恢复作业管理界面元素失败
|
||
sleep 20s
|
||
元素点击 //*[@ng-click="refreshTasks()"] 刷新按钮成功 刷新按钮失败
|
||
元素点击 //*[@class="objbox"]/table[1]//td[contains(text(),"运行中")]/../td[10]/div[1]/span[1] 点击任务详情成功 点击任务详情失败
|
||
sleep 5s
|
||
FOR ${n} IN RANGE 100
|
||
${text1} Get Text //*[@id="work_detail_list"]
|
||
Run Keyword If Should Contain ${text1} 当前迁移的增量数据小于1GB, 请关闭接管以完成迁移 sleep 10s
|
||
... ELSE sleep 5s
|
||
END
|
||
|
||
添加ESXi容灾平台
|
||
sleep 5s
|
||
元素点击 ${DR_Manage} 点击容灾管理成功 定位容灾管理失败
|
||
sleep 2s
|
||
元素点击 ${Add_DRPlatform} 点击添加容灾平台成功 定位添加容灾平台失败
|
||
sleep 2s
|
||
元素点击 ${Select_AdddDRPt_Pt} 选择容灾平台类型 定位容灾平台类型失败
|
||
sleep 2s
|
||
元素点击 ${Select_Dr_ESXi} 选择ESXi 定位ESXi平台类型失败
|
||
sleep 2s
|
||
元素输入 ${Input_AddDRPt_Name} 2011 获取平台备注输入元素失败
|
||
元素输入 ${Input_AddDRPt_IP} ${DRESXi_IP} 获取IP输入元素失败
|
||
元素输入 ${Input_AddDRPt_UserName} ${DRESXi_user} 获取用户名输入元素失败
|
||
元素输入 ${Input_AddDRPt_password} ${DRESXi_PWD} 获取密码输入元素失败
|
||
元素点击 ${Btn_AddDRPt_OK} 点击确定按钮成功 定位确定按钮失败
|
||
sleep 40s
|
||
元素点击 ${Btn_AfterAddDRPt_OK} 点击确定按钮成功 定位确定按钮失败
|
||
sleep 5s
|
||
|
||
添加内置容灾平台
|
||
元素点击 ${DR_Manage} 点击容灾管理成功 定位容灾管理失败
|
||
sleep 2s
|
||
元素点击 ${Add_DRPlatform} 点击添加容灾平台成功 定位添加容灾平台失败
|
||
sleep 2s
|
||
元素点击 ${Select_AdddDRPt_Pt} 选择容灾平台类型 定位容灾平台类型失败
|
||
sleep 2s
|
||
元素输入 ${Input_AddDRPt_IP} ${DR_BC_IP} 获取IP输入元素失败
|
||
元素输入 ${Input_AddDRPt_UserName} ${DR_BC_Name} 获取用户名输入元素失败
|
||
元素输入 ${Input_AddDRPt_password} ${DR_BC_PWD} 获取密码输入元素失败
|
||
元素点击 ${Btn_AddDRPt_OK} 点击确定按钮成功 定位确定按钮失败
|
||
sleep 20s
|
||
元素点击 ${Btn_AfterAddDRPt_OK} 点击确定按钮成功 定位确定按钮失败
|
||
sleep 5s
|
||
|
||
删除容灾平台
|
||
[Arguments] ${DR_Name}
|
||
Right Click Element //*[@id="sideTreeResource"]//span[text()="${DR_Name}"]
|
||
元素点击 //tr[contains(@id,'deleteSidetreeResource')]/td[2]/div 点击删除成功 定位删除按钮失败
|
||
元素点击 ${Delect plafrom} 点击删除确定按钮 定位删除确定按钮失败
|
||
元素点击 //*[@id="tipsPop_define_btn"] 点击删除成功确定 定位删除成功确定失败
|
||
|
||
进入应用容灾界面
|
||
元素点击 ${DR_Icon} 进入应用容灾界面成功 进入应用容灾界面失败
|
||
|
||
保持原有网络配置
|
||
元素点击 ${Network_Config} 网络配置 点击网络配置失败
|
||
元素点击 xpath=//*[@id="addPolicyDrNetworkConfigCDP"]/option[contains(text(),"保持原有网络配置")] 选择保持原有网络配置 保持原有网络配置模式失败
|
||
Comment 元素点击 //*[@id="addPolicyDrNetworkConfigCDP"]/../div[1]/span[1] 选择刷新网络网络配置 刷新网络配置失败
|
||
Run Keyword If '${SourceType}'=='实时备份数据' Run Keywords Select NetWork ${DR_Network}
|
||
... AND Select NetWorkAdapter ${DR_NetworkAdp}
|
||
... ELSE IF '${SourceType}'=='虚拟化快照数据' Run Keywords 元素点击 ${Btn_AddNetWork} 点击添加网络成功 添加网路定位失败
|
||
... AND Select NetWork2 ${Network}
|
||
... AND Select NetWorkAdapter2 ${NetworkAdp}
|
||
... AND 元素点击 xpath=//*[@id="addPolicyDrNetworkVirtualModal"]/div[2]/button[2] 网络添加成功 网络添加失败
|
||
|
||
自定义网络配置
|
||
Wait Until Element Is Visible ${Network_Config} 60
|
||
元素点击 ${Network_Config} 网络配置 点击网络配置失败
|
||
元素点击 xpath=//*[@id="addPolicyDrNetworkConfigCDP"]/option[contains(text(),"自定义网络配置")] 选择自定义网络配置模式 自定义网络配置模式失败
|
||
元素点击 ${Network_Add} 添加网卡 添加网卡失败
|
||
元素点击 ${Select_Network} 点击网络 网络点击失败
|
||
log //select [@ng-model="addBridgeObj.network"]/option[contains(text(),"${Select_Network_Configuration}")]
|
||
元素点击 xpath=//select [@ng-model="addBridgeObj.network"]/option[contains(text(),"${Select_Network_Configuration}")] 选择网络 选择网络失败
|
||
元素点击 ${Select_Network_Adapter} 点击网络适配器 网络适配器选择失败
|
||
元素点击 xpath=//select [@ng-model="addBridgeObj.networkAdapter"]/option[contains(text(),"${Select_Network_Adapter_Configuration}")] 选择网络适配器 选择网络适配器失败
|
||
Wait Until Element Is Visible ${Add_IPV4_Address} 30
|
||
元素输入 ${Add_IPV4_Address} ${Add_IPV4_Address_Input} 定位IPV4地址输入框失败
|
||
元素输入 ${Add_IPV4_SubnetMask} ${Add_IPV4_SubnetMask_Input} 定位IPV4子网掩码输入框失败
|
||
元素输入 ${Add_IPV4_Gateway} ${Add_IPV4_Gateway_Input} 定位IPV4网关输入框失败
|
||
元素输入 ${Add_IPV6_Address} ${Add_IPV6_Address_Input} 定位IPV6地址输入框失败
|
||
元素输入 ${Add_IPV6_SubnetMask} ${Add_IPV6_SubnetMask_Input} 定位IPV6子网掩码输入框失败
|
||
元素输入 ${Add_IPV6_Gateway} ${Add_IPV6_Gateway_Input} 定位IPV6网关输入框失败
|
||
元素输入 ${Add_FirstDNS} ${Add_FirstDNS_Input} 定位首选DNS输入框失败
|
||
元素输入 ${Add_SecondDNS} ${Add_SecondDNS_Input} 定位备选DNS输入框失败
|
||
元素点击 ${Click_Sure_Button} 点击确认按钮 确认按钮点击失败
|
||
|
||
生产机关机_win_new
|
||
[Arguments] ${PolicyName} ${IP} ${Select_DataTimePoint} ${snap_point}=
|
||
Log 打开生产机
|
||
Open Connection ${IP} 22
|
||
SSHLibrary.Login ${Agent_User_win} ${Agent_Pwd_win}
|
||
Write shutdown -p
|
||
sleep 120s
|
||
Close Connection
|
||
查看生产机状态_win ${PolicyName} ${IP} ${Select_DataTimePoint} ${snap_point}
|
||
|
||
查看生产机状态_win
|
||
[Arguments] ${PolicyName} ${IP} ${Select_DataTimePoint} ${snap_point}= ''
|
||
Comment 如果online进行关机,否则执行策略
|
||
Log 查看生产机的状态
|
||
Sleep 20s
|
||
Open Connection ${DR_BC_IP} 22
|
||
SSHLibrary.Login ${DR_BC_Name} ${DR_BC_PWD}
|
||
Log 进入黑方后台
|
||
Write ping \ '${IP}'
|
||
${output} read delay=30s
|
||
Comment ${text2} Get Line ${output} 1
|
||
Close Connection
|
||
${flag} Evaluate 'Destination Host Unreachable' in $output
|
||
Run Keyword If ${flag} 执行容灾策略 ${PolicyName} ${Select_DataTimePoint} ${snap_point}
|
||
... ELSE 查看生产机状态_win ${PolicyName} ${Agent_HostIP_win} 最新时间点
|
||
|
||
等待自动演练开始
|
||
[Arguments] ${PolicyName}
|
||
sleep 90s
|
||
${temp} Get Text xpath=//*[@id="disasterTable"]//tr[td[text()="${PolicyName}"]]//td[4]
|
||
Run Keyword If '${temp}'=="断开" 等待自动演练开始 ${PolicyName}
|
||
... ELSE IF '${temp}'=="连接" 等待自动演练完成 ${PolicyName}
|
||
... ELSE 关闭浏览器
|
||
|
||
回迁目标端磁盘选择
|
||
[Arguments] ${ip} ${user} ${pwd} # ip地址|用户名|密码
|
||
log 获取盘符
|
||
Open Connection ${ip}
|
||
SSHLibrary.Login ${user} ${pwd}
|
||
Log 进入linux后台
|
||
Sleep 3s
|
||
Write cd ${Linuxdisk_xml_Path}
|
||
Sleep 3s
|
||
Write ${Linux_Python_Path} getdisk_linux.py
|
||
${output1} Read delay=1s
|
||
${output2} Get Line ${output1} 0
|
||
Log ${output2}
|
||
${disklist_lin} Evaluate list(${output2})
|
||
Set Test Variable ${disklist_lin}
|
||
Log ${disklist_lin}
|
||
Close Connection
|
||
log 选择恢复目标盘
|
||
FOR ${a} IN @{disklist_lin}
|
||
元素点击 //*[@id="diskRecovery-diskTable"]//td[text()="磁盘${a}" ]/../td[7] 点击目标端选择成功 定位目标端选择失败
|
||
sleep 5s
|
||
Run Keyword If '${a}'=='/dev/sda' 整机恢复目标端选择第一个盘-68
|
||
... ELSE IF '${a}'=='/dev/sdb' 整机恢复目标端选择第2个盘-68
|
||
... ELSE 整机恢复目标端选择第3个盘-68
|
||
END
|
||
|
||
回迁磁盘选择linux
|
||
[Arguments] ${ip} ${user} ${pwd} # ip地址|用户名|密码
|
||
log 获取盘符
|
||
Open Connection ${ip}
|
||
SSHLibrary.Login ${user} ${pwd}
|
||
Log 进入linux后台
|
||
Sleep 3s
|
||
Write cd ${Linuxdisk_xml_Path}
|
||
Sleep 3s
|
||
Write ${Linux_Python_Path} getpart_linux.py
|
||
${output1} Read delay=1s
|
||
${output2} Get Line ${output1} 0
|
||
Log ${output2}
|
||
${disklist_lin} Evaluate list(${output2})
|
||
Set Test Variable ${disklist_lin}
|
||
Log ${disklist_lin}
|
||
Close Connection
|
||
log 选择已保护的磁盘
|
||
FOR ${diskno} IN @{disklist_lin}
|
||
log ${diskno}
|
||
元素点击 xpath=//*[@id="diskRecovery-diskTable"]//td[text()='${diskno}']/../td[2] 勾选已保护的分区 定位已保护的分区失败
|
||
Continue For Loop
|
||
END
|
||
元素点击 //*[@id="diskRecovery"]/div[2]/button[4] 点击确定恢复按钮成功 定位确定恢复按钮失败
|
||
元素点击 //*[@id="unaryLayer"]/div[1]/div[1]/../../../../div[3]/a[2] 点击确认清除磁盘成功 定位确认清除磁盘成功
|
||
Wait Until Element Is Visible //*[@id="unaryLayer"]/div[1]/div[1]/i 60
|
||
元素点击 //*[@id="unaryLayer"]/div[1]/div[1]/../../../../div[3]/a 点击提示确认成功 点击提示确认失败
|
||
|
||
选择容灾数据源_win
|
||
[Arguments] ${DataSource}
|
||
Wait Until Element Is Visible ${Select_DataSource} 30
|
||
Comment log ${Select_DataSource}
|
||
Comment Wait Until Element Is Visible ${Select_DataSource} 30s
|
||
Comment Sleep 1s
|
||
Comment Select From List By Label ${Select_DataSource} ${DataSource}
|
||
sleep 2s
|
||
元素点击 ${Select_DataSource} 点击数据源下拉框 定位数据源下拉框失败
|
||
元素点击 xpath=//*[@id="addPolicyDrSelectDataSourceRealTime"]/../div/dl/dd[contains(text(),"${Agent_HostIP_win}")] 选中数据源 选中数据源失败
|
||
sleep 5s
|
||
|
||
选择数据源_win
|
||
[Arguments] ${SourceType} ${DataSource} ${DrPlatformType}='' ${DrVirtualHostInCDR}='' ${AgentTiming}=''
|
||
Select DataSourceType ${SourceType}
|
||
sleep 5s
|
||
Log 选择容灾数据源类型
|
||
Run Keyword If '${Source_Type}'=='实时备份数据' Run Keywords 选择容灾数据源_win ${DataSource}
|
||
... AND Log 选择容灾数据源_win
|
||
... ELSE IF '${Source_Type}'=='虚拟化快照数据' Run Keywords Select DrPlatformType ${DrPlatformType}
|
||
... AND Select DrVirtualHostInCDR ${DrVirtualHostInCDR}
|
||
... AND sleep 5s
|
||
... AND 元素点击 xpath=//div[text()='Centos6.5 64bit_10.10.8.20']/../../td[1] 选择数据源成功 数据源获取失败
|
||
元素点击 ${Add_Policy_step2} 点击下一步按钮成功 下一步获取失败
|
||
|
||
创建容灾策略_win
|
||
[Arguments] ${PolicyName} ${SourceType} ${DataSource} ${PDM_Type} ${Plafrom} ${coreCPU} ${numberCPU} ${Memory} ${Network} ${NetworkAdp} ${list} ${Auto_Switch} ${DrMode} ${DR_Type} ${Source} ${Auto_Type}
|
||
... ${DrPlatformType}='' ${DrVirtualHostInCDR}='' ${AgentTiming}='' #数据源类型|数据源|容灾平台类型|容灾平台|cpu内核|cpu数|内存|网络|网络适配器|服务列表|是否自动演练/接管|容灾模式|容灾类型
|
||
sleep 3s
|
||
元素点击 ${Btn_Add_Drpolicy} 点击创建容灾策略成功 创建容灾策略点击失败
|
||
元素输入 ${Input_DrPolicyName} ${PolicyName} 获取容灾策略名输入元素失败
|
||
comment 数据源类型 数据源
|
||
选择数据源_win ${SourceType} ${DataSource} ${DrPlatformType} ${DrVirtualHostInCDR} ${AgentTiming}
|
||
comment 容灾机类型 容灾平台 cpu核心数 cpu个数 内存 网络 网络适配器 服务端通道
|
||
容灾机配置(正确) ${PDM_Type} ${Plafrom} ${coreCPU} ${numberCPU} ${Memory} ${Network} ${NetworkAdp} ${Data_Address_Transfer} ${SourceType} ${Network_Configuration_custom}
|
||
comment 容灾机模式
|
||
容灾机模式配置_win ${DrMode} ${Auto_Switch} ${list} ${Auto_Type}
|
||
容灾策略预览 ${PolicyName} ${Plafrom} ${coreCPU} ${numberCPU} 服务列表 ${Network} ${NetworkAdp} ${Data_Address_Transfer} ${DR_Type} ${Source}
|
||
|
||
校验容灾机_win
|
||
Comment 校验CPU、内存
|
||
Open Connection ${DR_BC_IP} 22
|
||
SSHLibrary.Login ${DR_BC_Name} ${DR_BC_PWD}
|
||
Log 进入黑方后台
|
||
Write virsh list --name
|
||
${output} read delay=5s
|
||
Should Contain ${output} ${PolicyName_win}
|
||
Log 容灾机开启成功
|
||
Write cd /etc/libvirt/qemu
|
||
Write cat *${PolicyName_win} *
|
||
${output} read delay=5s
|
||
${Memery_total} Evaluate ${Memory}*1024*1024
|
||
Should Contain ${output} <memory unit='KiB'>${Memery_total}</memory>
|
||
Log 内存设置正确
|
||
Should Contain ${output} sockets='${CPU_Num}'
|
||
Log cpu设置正确
|
||
Close Connection
|
||
Comment 获取生产机文件md5值
|
||
sleep 5
|
||
comment winsows生产机校验todo
|
||
Open Connection ${Agent_HostIP_win} 22
|
||
SSHLibrary.Login ${Agent_User_win} ${Agent_Pwd_win} 20s
|
||
Log 进入生产机
|
||
write md5sum ${file_path1}
|
||
${output} read delay=5s
|
||
${text1} Get Substring ${output} 0 32
|
||
Log 获取生产机文件md5值
|
||
Close Connection
|
||
Open Connection ${Agent_HostIP_win} 22
|
||
SSHLibrary.Login ${Agent_User_win} ${Agent_Pwd_win} 20s
|
||
Log 进入演练机
|
||
write md5sum ${file_path1}
|
||
${output2} read delay=10s
|
||
${text4} Get Substring ${output2} 0 32
|
||
Log 获取演练机文件md5值
|
||
Should Be Equal ${text4} ${text1}
|
||
Log 验证成功
|
||
Close Connection
|
||
|
||
自动演练配置win
|
||
[Arguments] ${list} ${Auto_Type}
|
||
元素点击 ${Add_Policy_AutoSwitch} 开启自动演练成功 自动演练开启按钮获取失败
|
||
sleep 10s
|
||
Run Keyword If '${Auto_Type}'=='脚本' 选择脚本文件_win
|
||
... ELSE IF '${Auto_Type}'=='服务' 自动演练服务选择 ${list}
|
||
Comment 自动演练配置_自动循环模式win
|
||
完成容灾模式配置
|
||
|
||
选择脚本文件_win
|
||
元素点击 xpath=//*[@ng-click="addPolicyDrimportScript()"] 点击选择脚本文件按钮成功 选择脚本按钮元素获取失败
|
||
元素点击 xpath=//div[text()="UnaEDRDrillServiceReport"]/../../td[1] 选择windows脚本文件成功 选择winsowds脚本文件元素获取失败
|
||
元素点击 xpath=//*[@id="addPolicyDrSelectScriptFile"]/div[2]/button[2] 脚本选择导入成功 获取导入按钮元素失败
|
||
|
||
接管机配置
|
||
[Arguments] ${PDM_Type} ${Plafrom} ${coreCPU} ${numberCPU} ${Memory} ${Network} ${NetworkAdp} ${ChannelIP} ${SourceType}
|
||
Run Keyword If '${SourceType}'=='实时备份数据' Run Keywords Select PolicyDrMachineType ${PDM_Type}
|
||
... AND Log 选择容灾机类型
|
||
log 是否手动创建容灾机
|
||
sleep 5s
|
||
元素点击 ${Btn_Init} 自动创建容灾机 手动创建容灾机按钮定位失败
|
||
sleep 5s
|
||
Select DrPlatform ${Plafrom}
|
||
Log 选择容灾平台
|
||
元素输入 ${Input_Policy_CoreNumberCPU} ${coreCPU} CPU核心数元素获取失败
|
||
元素输入 ${Input_Policy_NumberCPU} ${numberCPU} CPU个数定位失败
|
||
元素输入 ${Input_Policy_Memory} ${Memory} 内存容量定位失败
|
||
Run Keyword If '${Network_Configuration_default}'=='保持原有网络配置' 保持原有网络配置
|
||
... ELSE IF '${Network_Configuration_custom}'=='自定义网络配置' 自定义网络配置
|
||
Select ServerChannelIP ${ChannelIP}
|
||
Log 设置服务端通道IP
|
||
元素点击 ${Add_Policy_step3} 容灾机配置下一步点击成功 下一步获取失败
|
||
|
||
创建接管策略_win
|
||
[Arguments] ${PolicyName} ${SourceType} ${DataSource} ${PDM_Type} ${Plafrom} ${coreCPU} ${numberCPU} ${Memory} ${Network} ${NetworkAdp} ${list} ${Auto_Switch} ${DrMode} ${DR_Type} ${Source} ${Auto_Type}
|
||
... ${DrPlatformType}='' ${DrVirtualHostInCDR}='' ${AgentTiming}='' #数据源类型|数据源|容灾平台类型|容灾平台|cpu内核|cpu数|内存|网络|网络适配器|服务列表|是否自动演练/接管|容灾模式|容灾类型
|
||
sleep 3s
|
||
元素点击 ${Btn_Add_Drpolicy} 点击创建容灾策略成功 创建容灾策略点击失败
|
||
元素输入 ${Input_DrPolicyName} ${PolicyName} 获取容灾策略名输入元素失败
|
||
comment 数据源类型 数据源
|
||
选择数据源_win ${SourceType} ${DataSource} ${DrPlatformType} ${DrVirtualHostInCDR} ${AgentTiming}
|
||
鉴权
|
||
comment 容灾机类型 容灾平台 cpu核心数 cpu个数 内存 网络 网络适配器 服务端通道
|
||
Comment 接管机配置 ${PDM_Type} ${Plafrom} ${coreCPU} ${numberCPU} ${Memory} ${Network} ${NetworkAdp} ${Data_Address_Transfer} ${SourceType}
|
||
容灾机配置(正确) ${PDM_Type} ${Plafrom} ${coreCPU} ${numberCPU} ${Memory} ${Network} ${NetworkAdp} ${Data_Address_Transfer} ${SourceType} ${Network_Configuration_default}
|
||
comment 容灾机模式
|
||
容灾机模式配置_win ${DrMode} ${Auto_Switch} ${list} ${Auto_Type}
|
||
容灾策略预览 ${PolicyName} ${Plafrom} ${coreCPU} ${numberCPU} 服务列表 ${Network} ${NetworkAdp} ${Data_Address_Transfer} ${DR_Type} ${Source}
|
||
|
||
渐进式回迁方式_win
|
||
[Arguments] ${ip} ${user} ${pwd} ${drRelocationCdpPropertyWayList} ${drRelocationCdpDataTransferMode} ${PolicyName} #livecd ip |livecd 用户名| livecd密码 |回迁方式 |数据传输模式|分区名称|磁盘名称
|
||
sleep 20s
|
||
Comment 元素点击 ${Click_More} 点击更多按钮成功 定位更多元素失败
|
||
Comment 元素点击 xpath=//td[text()='${PolicyName}']/../td[9]//span[text()='更多'] 点击更多按钮成功 定位更多元素失败
|
||
元素点击 //td[text()="${PolicyName_win}"]/../td[9]/div/span[5] 点击更多按钮成功 定位更多元素失败
|
||
元素点击 //*[@id="app"]/ul/li[2] 点击回迁按钮成功 点击回迁按钮失败
|
||
sleep 10s
|
||
元素点击 //*[@id="drRelocationCdpTargetMachine"] 点击选择目标机成功 点击选择目标机失败
|
||
元素点击 //option[text()='livecd.${LIVECD_IP_win}'] 选择目标livecd成功 定位目标livecd失败
|
||
元素点击 //*[@id="drRelocationCdpPropertyWayList"] 点击选择回迁方式成功 定位选择回迁方式失败
|
||
Run Keyword If "${drRelocationCdpPropertyWayList}"=="渐进式回迁" 选择渐进式回迁
|
||
... ELSE IF "${drRelocationCdpPropertyWayList}"=="仅恢复增量数据" 选择仅恢复增量数据回迁
|
||
元素点击 //*[@id="drRelocationCdpDataTransferMode"] 选择数据传输选择框成功 定位数据传输选择框失败
|
||
Run Keyword If "${drRelocationCdpDataTransferMode}"=="iSCSI" 选择iSCSI传输方式
|
||
... ELSE IF "${drRelocationCdpDataTransferMode}"=="FC" 选择FC传输方式
|
||
... ELSE IF "${drRelocationCdpDataTransferMode}"=="OSVI" 选择OSVI传输方式 0
|
||
... ELSE 关闭浏览器
|
||
sleep 2s
|
||
|
||
回迁源磁盘选择_win
|
||
${test1} Get Element Count xpath=//*[@id="drRelocationCdpId"]/div[1]/div[6]/div/div/div/div/div/div[2]/table/tbody/tr
|
||
${row_num} Evaluate ${test1}+1
|
||
Set Test Variable ${row_num}
|
||
log 选择已保护的磁盘
|
||
FOR ${diskno} IN RANGE 1 ${row_num}
|
||
log ${diskno}
|
||
元素点击 xpath=//*[@id="drRelocationCdpId"]/div[1]/div[6]/div/div/div/div/div/div[2]/table/tbody/tr[${diskno}]//td[1] 勾选已保护的分区 定位已保护的分区失败
|
||
Continue For Loop
|
||
END
|
||
|
||
回迁目标端磁盘选择_win
|
||
log 选择恢复目标盘
|
||
FOR ${a} IN @{disklist_win}
|
||
元素点击 //div[text()='磁盘${a}']/../../td[6] 点击目标端选择成功 定位目标端选择失败
|
||
sleep 5s
|
||
Run Keyword If '${a}'=='0' 回迁目标盘选择第一个盘
|
||
... ELSE IF '${a}'=='1' 回迁目标盘选择第二个盘
|
||
... ELSE 回迁目标盘选择第三个盘
|
||
END
|
||
|
||
回迁目标盘选择第一个盘
|
||
元素点击 //*[@id="drRelocationCdpTargetDisk"]/option[1] 选择livecd第一个盘成功 选择livecd第一个盘失败
|
||
元素点击 //*[@id="drTargetModalId"]/div[2]/button[2] 点击确定按钮成功 定位确定按钮失败
|
||
|
||
回迁目标盘选择第二个盘
|
||
元素点击 //*[@id="drRelocationCdpTargetDisk"]/option[2] 选择livecd第二个盘成功 选择livecd第二个盘失败
|
||
元素点击 //*[@id="drTargetModalId"]/div[2]/button[2] 点击确定按钮成功 定位确定按钮失败
|
||
|
||
回迁目标盘选择第三个盘
|
||
元素点击 //*[@id="drRelocationCdpTargetDisk"]/option[2] 选择livecd第一个盘成功 选择livecd第一个盘失败
|
||
元素点击 //*[@id="drTargetModalId"]/div[2]/button[2] 点击确定按钮成功 定位确定按钮失败
|
||
|
||
点击确定回迁按钮
|
||
元素点击 //*[@id="drRelocationCdpId"]/div[2]/button[2] 点击确定回迁按钮成功 定位确定回迁按钮失败
|
||
元素点击 //a[text()='确定'] 点击确认数据覆盖成功 定位数据覆盖却按钮失败
|
||
Wait Until Element Is Visible //*[@id="tipsPop_define_btn"] 60
|
||
元素点击 //*[@id="tipsPop_define_btn"] 点击回迁提示却按钮成功 定位回迁提示却按钮失败
|
||
|
||
自动演练获取list
|
||
comment 服务列表
|
||
${list} Create List netprofm
|
||
comment
|
||
Set Test Variable ${list}
|
||
|
||
自动演练获取list_lin
|
||
comment 服务列表
|
||
${list} Create List NetworkManager.service
|
||
comment
|
||
Set Test Variable ${list}
|
||
|
||
回迁作业完成
|
||
log 获取作业状态
|
||
FOR ${n} IN RANGE 100
|
||
${job_status} Get Text //*[@id="childInfoTableTask"]/div/table/tbody/tr[1]/td[7]
|
||
log ${job_status}
|
||
Run Keyword If '${job_status}'=='完成' Exit For Loop
|
||
... ELSE IF '${job_status}'=='异常' Exit For Loop
|
||
... ELSE IF '${job_status}'=='运行' 回迁作业完成
|
||
... ELSE Exit For Loop
|
||
sleep 20s
|
||
END
|
||
Run Keyword If '${job_status}'=='完成' 回迁作业完成
|
||
... ELSE IF '${job_status}'=='异常' 作业异常
|
||
... ELSE log 其他情况
|
||
|
||
校验容灾机(外置)
|
||
[Arguments] ${v_name} ${mem} ${core} ${num} # 容灾机名 | 内存 | CPU核数 | CPU个数
|
||
Comment 校验CPU、内存
|
||
Open Connection ${DRESXi_IP} 22
|
||
SSHLibrary.Login ${DRESXi_user} ${DRESXi_PWD}
|
||
Log 进入ESXi后台
|
||
Write vim-cmd vmsvc/getallvms |grep drvm_${v_name} |awk '{print $1}' | xargs vim-cmd vmsvc/power.getstate | grep Powered |awk '{print $2}'
|
||
${output} read delay=5s
|
||
Should Contain ${output} on
|
||
Log 容灾机开启成功
|
||
Write cat /vmfs/volumes/data3*/drvm_${v_name}*/drvm_${v_name}*.vmx
|
||
${output} read delay=5s
|
||
${Memery_total} Evaluate ${mem}*1024
|
||
Should Contain ${output} memSize = "${Memery_total}"
|
||
Log 内存设置正确
|
||
Should Contain ${output} cpuid.coresPerSocket = "${core}"
|
||
Log cpu设置正确
|
||
Close Connection
|
||
sleep 5
|
||
log 登录容灾机开始校验
|
||
sleep 200s
|
||
Open Connection ${DR_IP} 22
|
||
SSHLibrary.Login ${Agent_User} ${Agent_Pwd} 20s
|
||
Log 进入演练机
|
||
Sleep 5s
|
||
${recor_content} Execute Command cat /test/A.txt
|
||
Log 演练机的校验文件内容为:${recor_content}
|
||
${compare_result} Run Keyword And Return Status Should Contain ${origin_content} ${recor_content}
|
||
Run Keyword If ${compare_result}==True Log 校验成功,文本内容一致
|
||
... ELSE Fail 校验失败,文本内容不一致
|
||
Log 验证成功
|
||
Log 容灾机数据校验成功
|
||
Close Connection
|
||
|
||
校验接管容灾机(外置)
|
||
[Arguments] ${v_name} ${mem} ${core} ${num} # 容灾机名 | 内存 | CPU核数 | CPU个数
|
||
Comment 校验CPU、内存
|
||
Open Connection ${DRESXi_IP} 22
|
||
SSHLibrary.Login ${DRESXi_user} ${DRESXi_PWD}
|
||
Log 进入ESXi后台
|
||
Write vim-cmd vmsvc/getallvms |grep drvm_${v_name} |awk '{print $1}' | xargs vim-cmd vmsvc/power.getstate | grep Powered |awk '{print $2}'
|
||
${output} read delay=5s
|
||
Should Contain ${output} on
|
||
Log 容灾机开启成功
|
||
Write cat /vmfs/volumes/data3*/drvm_${v_name}*/drvm_${v_name}*.vmx
|
||
${output} read delay=5s
|
||
${Memery_total} Evaluate ${mem}*1024
|
||
Should Contain ${output} memSize = "${Memery_total}"
|
||
Log 内存设置正确
|
||
${cpu_total} Evaluate ${num} * ${core}
|
||
Should Contain ${output} numvcpus = "${cpu_total}"
|
||
Log cpu设置正确
|
||
Close Connection
|
||
sleep 40s
|
||
Comment 获取接管容灾机文件md5值
|
||
Open Connection ${Agent_HostIP} 22
|
||
SSHLibrary.Login ${Agent_User} ${Agent_Pwd}
|
||
Log 进入接管容灾机
|
||
sleep 5s
|
||
${recor_content} Execute Command cat /test/A.txt
|
||
Log 演练机的校验文件内容为:${recor_content}
|
||
${compare_result} Run Keyword And Return Status Should Contain ${origin_content} ${recor_content}
|
||
Run Keyword If ${compare_result}==True Log 校验成功,文本内容一致
|
||
... ELSE Fail 校验失败,文本内容不一致
|
||
Log 验证成功
|
||
Log 容灾机数据校验成功
|
||
Close Connection
|
||
|
||
校验容灾机(异地)
|
||
log 校验CPU、内存
|
||
Open Connection ${Target_BC_IP} 22
|
||
SSHLibrary.Login ${DR_BC_Name} ${DR_BC_PWD}
|
||
Log 进入黑方后台
|
||
Write virsh list --name
|
||
${output} read delay=5s
|
||
Should Contain ${output} ${PolicyName}
|
||
Log 容灾机开启成功
|
||
Write cd /etc/libvirt/qemu
|
||
Write cat *${PolicyName} *
|
||
${output} read delay=5s
|
||
${Memery_total} Evaluate ${Memory}*1024*1024
|
||
Should Contain ${output} <memory unit='KiB'>${Memery_total}</memory>
|
||
Log 内存设置正确
|
||
Should Contain ${output} sockets='${CPU_Num}'
|
||
Log cpu设置正确
|
||
Close Connection
|
||
log 获取生产机文件md5值
|
||
sleep 5
|
||
Open Connection ${Agent_HostIP} 22
|
||
SSHLibrary.Login ${Agent_User} ${Agent_Pwd} 20s
|
||
Log 进入生产机
|
||
write md5sum ${file_path1}
|
||
${output} read delay=5s
|
||
${text1} Get Substring ${output} 0 32
|
||
Log 获取生产机文件md5值
|
||
Comment write cat ${drillfile_path}
|
||
Comment ${output1} read delay=2s
|
||
Comment ${text2} ${output1} Get Line 9
|
||
Comment ${text3} ${text2} Get Substring 13 23
|
||
Comment Log 获取演练机IP
|
||
Close Connection
|
||
sleep 60s
|
||
Open Connection ${Add_IPV4_Address_Input} 22
|
||
SSHLibrary.Login ${Agent_User} ${Agent_Pwd} 20s
|
||
Log 进入演练机
|
||
write md5sum ${file_path1}
|
||
${output2} read delay=10s
|
||
${text4} Get Substring ${output2} 0 32
|
||
Log 获取演练机文件md5值
|
||
Should Be Equal ${text4} ${text1}
|
||
Log 验证成功
|
||
Close Connection
|
||
|
||
校验接管容灾机(异地)
|
||
log w32
|
||
Comment 校验CPU、内存
|
||
Open Connection ${Target_BC_IP} 22
|
||
SSHLibrary.Login ${DR_BC_Name} ${DR_BC_PWD}
|
||
Log 进入黑方后台
|
||
Write virsh list --name
|
||
${output} read delay=1s
|
||
Should Contain ${output} ${PolicyName}
|
||
Log 容灾机开启成功
|
||
Write cd /etc/libvirt/qemu
|
||
Write cat *${PolicyName}*
|
||
${output} read delay=1s
|
||
${Memery_total} Evaluate ${Memory}*1024*1024
|
||
Should Contain ${output} <memory unit='KiB'>${Memery_total}</memory>
|
||
Log 内存设置正确
|
||
Should Contain ${output} sockets='${CPU_Num}'
|
||
Should Contain ${output} cores='${CPU_Core}'
|
||
Log cpu设置正确
|
||
Close Connection
|
||
sleep 40s
|
||
Comment 获取接管容灾机文件md5值
|
||
Open Connection ${Agent_HostIP} 22
|
||
SSHLibrary.Login ${Agent_User} ${Agent_Pwd}
|
||
Log 进入接管容灾机
|
||
sleep 5s
|
||
Write md5sum ${file_path1}
|
||
${output} read delay=3s
|
||
${text1} Get Substring ${output} 0 32
|
||
Log 获取接管容灾机文件md5值
|
||
Should Be Equal ${text1} ${file_md5}
|
||
Close Connection
|
||
Log 容灾机数据校验成功
|
||
|
||
判断是否驱动注入成功
|
||
sleep 20s
|
||
元素点击 //span[text()="作业管理"] 作业管理点击成功 作业管理点击失败
|
||
元素点击 //*[@id="workManageTableDr"]/div[2]/table/tbody/tr[2]/td[7] 作业详情点击成功 作业详情点击失败
|
||
Comment ${status1} Run Keyword And Return Status Wait Until Page Contains Element xpath=//*[@id="drWorkDetails"]//span[contains(text(),"正在进行兼容性处理")] 5s 详情页面获取失败
|
||
${status2} Run Keyword And Return Status Wait Until Page Contains Element xpath=//*[@id="drWorkDetails"]//span[contains(text(),"兼容性处理结束")] 5s 详情页面获取失败
|
||
Run Keyword If '${status2}' == 'True' log 驱动1注入成功
|
||
... ELSE log 驱动注入失败
|
||
... AND 关闭浏览器
|
||
sleep 2s
|
||
元素点击 //*[@id="drWorkManageChildId"]/div[2]/button 关闭详情页成功 关闭详情页失败
|
||
sleep 2s
|
||
元素点击 //span[text()="策略管理"] 策略管理点击成功 策略管理点击失败
|
||
|
||
创建容灾策略(异地)
|
||
[Arguments] ${PolicyName} ${SourceType} ${DataSource} ${PDM_Type} ${Plafrom} ${coreCPU} ${numberCPU} ${Memory} ${Network} ${NetworkAdp} ${list} ${Auto_Switch} ${DrMode} ${DR_Type} ${Source} ${Auto_Type}
|
||
... ${DrPlatformType}='' ${DrVirtualHostInCDR}='' ${AgentTiming}='' #数据源类型|数据源|容灾平台类型|容灾平台|cpu内核|cpu数|内存|网络|网络适配器|服务列表|是否自动演练/接管|容灾模式|容灾类型
|
||
sleep 3s
|
||
元素点击 ${Btn_Add_Drpolicy} 点击创建容灾策略成功 创建容灾策略点击失败
|
||
元素输入 ${Input_DrPolicyName} ${PolicyName} 获取容灾策略名输入元素失败
|
||
comment 数据源类型 数据源
|
||
选择数据源 ${SourceType} ${DataSource} ${DrPlatformType} ${DrVirtualHostInCDR} ${AgentTiming}
|
||
鉴权
|
||
comment 容灾机类型 容灾平台 cpu核心数 cpu个数 内存 网络 网络适配器 服务端通道
|
||
容灾机配置(正确) ${PDM_Type} ${Plafrom} ${coreCPU} ${numberCPU} ${Memory} ${Network} ${NetworkAdp} ${Target_BC_IP} ${SourceType}
|
||
comment 容灾机模式
|
||
容灾机模式配置_win ${DrMode} ${Auto_Switch} ${list} ${Auto_Type}
|
||
容灾策略预览 ${PolicyName} ${Plafrom} ${coreCPU} ${numberCPU} 服务列表 ${Network} ${NetworkAdp} ${Data_Address_Transfer} ${DR_Type} ${Source}
|
||
|
||
创建容灾策略_异地
|
||
[Arguments] ${PolicyName} ${SourceType} ${DataSource} ${PDM_Type} ${Plafrom} ${coreCPU} ${numberCPU} ${Memory} ${Network} ${NetworkAdp} ${list} ${Auto_Switch} ${DrMode} ${DR_Type} ${Source} ${Auto_Type}
|
||
... ${Network_Configuration} ${DrPlatformType}='' ${DrVirtualHostInCDR}='' ${AgentTiming}='' #数据源类型|数据源|容灾平台类型|容灾平台|cpu内核|cpu数|内存|网络|网络适配器|服务列表|是否自动演练/接管|容灾模式|容灾类型
|
||
元素点击 ${Btn_Add_Drpolicy} 点击创建容灾策略成功 创建容灾策略点击失败
|
||
sleep 3s
|
||
元素输入 ${Input_DrPolicyName} ${PolicyName} 获取容灾策略名输入元素失败
|
||
comment 数据源类型 数据源
|
||
选择数据源 ${SourceType} ${DataSource} ${DrPlatformType} ${DrVirtualHostInCDR} ${AgentTiming}
|
||
鉴权
|
||
comment 容灾机类型 容灾平台 cpu核心数 cpu个数 内存 网络 网络适配器 服务端通道
|
||
容灾机配置(正确) ${PDM_Type} ${Plafrom} ${coreCPU} ${numberCPU} ${Memory} ${Network} ${NetworkAdp} ${Target_BC_IP} ${SourceType} ${Network_Configuration}
|
||
comment 容灾机模式
|
||
容灾机模式配置_win ${DrMode} ${Auto_Switch} ${list} ${Auto_Type}
|
||
容灾策略预览 ${PolicyName} ${Plafrom} ${coreCPU} ${numberCPU} 服务列表 ${Network} ${NetworkAdp} ${Target_BC_IP} ${DR_Type} ${Source}
|
||
|
||
校验接管容灾机_win(异地)
|
||
log w32
|
||
Comment 校验CPU、内存
|
||
Open Connection ${Target_BC_IP} 22
|
||
SSHLibrary.Login ${DR_BC_Name} ${DR_BC_PWD}
|
||
Log 进入黑方后台
|
||
sleep 5s
|
||
Write virsh list --name
|
||
${output} read delay=1s
|
||
Should Contain ${output} ${PolicyName}
|
||
Log 容灾机开启成功
|
||
Write cd /etc/libvirt/qemu
|
||
Write cat *${PolicyName}*
|
||
${output} read delay=1s
|
||
${Memery_total} Evaluate ${Memory}*1024*1024
|
||
Should Contain ${output} <memory unit='KiB'>${Memery_total}</memory>
|
||
Log 内存设置正确
|
||
Should Contain ${output} sockets='${CPU_Num}'
|
||
Should Contain ${output} cores='${CPU_Core}'
|
||
Log cpu设置正确
|
||
Close Connection
|
||
sleep 40s
|
||
Comment 获取接管容灾机文件md5值
|
||
Open Connection ${Agent_HostIP_win} 22
|
||
SSHLibrary.Login ${Agent_User_win} ${Agent_Pwd_win}
|
||
Log 进入接管容灾机
|
||
Start Command ${Windows_Python_Path} MD5.py
|
||
Sleep 3s
|
||
${recor_content} Read Command Output
|
||
Log 恢复机的校验文件内容为:${recor_content}
|
||
${compare_result} Run Keyword And Return Status Should Contain ${origin_content} ${recor_content}
|
||
Run Keyword If ${compare_result}==True Log 校验成功,文本内容一致
|
||
... ELSE Fail 校验失败,文本内容不一致
|
||
Log 验证成功
|
||
Close Connection
|
||
Log 容灾机数据校验成功
|
||
|
||
回迁源磁盘选择_lin
|
||
[Arguments] ${ip} ${user} ${pwd} ${disklist_lin} # ip地址 | 用户名 | 密码
|
||
Comment Open Connection ${ip}
|
||
Comment SSHLibrary.Login ${user} ${pwd}
|
||
Comment Log 进入linux后台
|
||
Comment Sleep 3s
|
||
Comment Write cd ${Linuxdisk_xml_Path}
|
||
Comment Sleep 3s
|
||
Comment Write ${Linux_Python_Path} getdisk_linux.py
|
||
Comment ${output1} Read delay=5s
|
||
Comment ${output2} Get Line ${output1} 0
|
||
Comment Log ${output2}
|
||
Comment ${disklist_lin} Evaluate list(${output2})
|
||
Comment Set Test Variable ${disklist_lin}
|
||
Log ${disklist_lin}
|
||
Comment Close Connection
|
||
log 选择已保护的磁盘
|
||
FOR ${diskno} IN @{disklist_lin}
|
||
log ${diskno}
|
||
元素点击 xpath=//td[@data-content="${diskno}"]/../td[1]/div/div/i 勾选已保护的分区 定位已保护的分区失败
|
||
Continue For Loop
|
||
END
|
||
[Teardown]
|
||
|
||
回迁目标端磁盘选择_lin
|
||
[Arguments] ${ip} ${user} ${pwd} ${disklist_lin} # ip地址 | 用户名 | 密码
|
||
Comment log 获取盘符
|
||
Comment Open Connection ${ip}
|
||
Comment SSHLibrary.Login ${user} ${pwd}
|
||
Comment Log 进入linux后台
|
||
Comment Sleep 3s
|
||
Comment Write cd ${Linuxdisk_xml_Path}
|
||
Comment Sleep 3s
|
||
Comment Write ${Linux_Python_Path} getdisk_linux.py
|
||
Comment ${output1} Read delay=5s
|
||
Comment ${output2} Get Line ${output1} 0
|
||
Comment Log ${output2}
|
||
Comment ${disklist_lin} Evaluate list(${output2})
|
||
Comment Set Test Variable ${disklist_lin}
|
||
Log ${disklist_lin}
|
||
log 选择恢复目标盘
|
||
FOR ${a} IN @{disklist_lin}
|
||
元素点击 //div[text()='${a}']/../../td[6]/div/a 点击目标端选择成功 定位目标端选择失败
|
||
sleep 5s
|
||
log ${a}
|
||
元素点击 //*[@id="drRelocationCdpTargetDisk"] 选择目标磁盘列表成功 选择目标磁盘列表失败
|
||
Run Keyword If '${a}'=='/dev/sda' 回迁目标盘选择第一个盘
|
||
... ELSE IF '${a}'=='/dev/sdb' 回迁目标盘选择第二个盘
|
||
... ELSE 回迁目标盘选择第三个盘
|
||
END
|
||
|
||
自定义网络配置_esxi
|
||
Wait Until Element Is Visible ${Network_Config} 60
|
||
元素点击 ${Network_Config} 网络配置 点击网络配置失败
|
||
元素点击 xpath=//*[@id="addPolicyDrNetworkConfigCDP"]/option[contains(text(),"自定义网络配置")] 选择自定义网络配置模式 自定义网络配置模式失败
|
||
元素点击 ${Network_Add} 添加网卡 添加网卡失败
|
||
元素点击 ${Select_Network} 点击网络 网络点击失败
|
||
log //select [@ng-model="addBridgeObj.network"]/option[contains(text(),"${Select_Network_Configuration_esxi}")]
|
||
元素点击 xpath=//select [@ng-model="addBridgeObj.network"]/option[contains(text(),"${Select_Network_Configuration_esxi}")] 选择网络 选择网络失败
|
||
元素点击 ${Select_Network_Adapter} 点击网络适配器 网络适配器选择失败
|
||
元素点击 xpath=//select [@ng-model="addBridgeObj.networkAdapter"]/option[contains(text(),"${Select_Network_Adapter_Configuration_esxi}")] 选择网络适配器 选择网络适配器失败
|
||
Wait Until Element Is Visible ${Add_IPV4_Address} 30
|
||
元素输入 ${Add_IPV4_Address} ${Add_IPV4_Address_Input} 定位IPV4地址输入框失败
|
||
元素输入 ${Add_IPV4_SubnetMask} ${Add_IPV4_SubnetMask_Input} 定位IPV4子网掩码输入框失败
|
||
元素输入 ${Add_IPV4_Gateway} ${Add_IPV4_Gateway_Input} 定位IPV4网关输入框失败
|
||
元素输入 ${Add_IPV6_Address} ${Add_IPV6_Address_Input} 定位IPV6地址输入框失败
|
||
元素输入 ${Add_IPV6_SubnetMask} ${Add_IPV6_SubnetMask_Input} 定位IPV6子网掩码输入框失败
|
||
元素输入 ${Add_IPV6_Gateway} ${Add_IPV6_Gateway_Input} 定位IPV6网关输入框失败
|
||
元素输入 ${Add_FirstDNS} ${Add_FirstDNS_Input} 定位首选DNS输入框失败
|
||
元素输入 ${Add_SecondDNS} ${Add_SecondDNS_Input} 定位备选DNS输入框失败
|
||
元素点击 ${Click_Sure_Button} 点击确认按钮 确认按钮点击失败
|
||
|
||
容灾机配置_外置
|
||
[Arguments] ${PDM_Type} ${Plafrom} ${coreCPU} ${numberCPU} ${Memory} ${Network} ${NetworkAdp} ${ChannelIP} ${SourceType}
|
||
Run Keyword If '${SourceType}'=='实时备份数据' Run Keywords Select PolicyDrMachineType ${PDM_Type}
|
||
... AND Log 选择容灾机类型
|
||
log 是否手动创建容灾机
|
||
sleep 5s
|
||
元素点击 ${Btn_Init} 自动创建容灾机 手动创建容灾机按钮定位失败
|
||
sleep 5s
|
||
Select DrPlatform ${Plafrom}
|
||
Log 选择容灾平台
|
||
元素输入 ${Input_Policy_CoreNumberCPU} ${coreCPU} CPU核心数元素获取失败
|
||
元素输入 ${Input_Policy_NumberCPU} ${numberCPU} CPU个数定位失败
|
||
元素输入 ${Input_Policy_Memory} ${Memory} 内存容量定位失败
|
||
Comment Run Keyword If '${Network_Configuration_default}'=='保持原有网络配置' 保持原有网络配置_esxi
|
||
... ELSE IF '${Network_Configuration_default}'=='自定义网络配置' 自定义网络配置_esxi
|
||
Select ServerChannelIP ${ChannelIP}
|
||
Log 设置服务端通道IP
|
||
Run Keyword If "${Plafrom}"=="10.10.15.229" 修改容灾机高级选项_外置 ${Agent_name}
|
||
元素点击 ${Add_Policy_step3} 容灾机配置下一步点击成功 下一步获取失败
|
||
|
||
保持原有网络配置_esxi
|
||
元素点击 ${Network_Config} 网络配置 点击网络配置失败
|
||
元素点击 xpath=//*[@id="addPolicyDrNetworkConfigCDP"]/option[contains(text(),"${Network_Configuration_default}")] 选择保持原有网络配置 保持原有网络配置模式失败
|
||
Comment 元素点击 //*[@id="addPolicyDrNetworkConfigCDP"]/../div[1]/span[1] 选择刷新网络网络配置 刷新网络配置失败
|
||
Run Keyword If '${SourceType}'=='实时备份数据' Run Keywords Select NetWork ${Select_Network_Configuration_esxi}
|
||
... AND Select NetWorkAdapter ${Select_Network_Adapter_Configuration_esxi}
|
||
... ELSE IF '${SourceType}'=='虚拟化快照数据' Run Keywords 元素点击 ${Btn_AddNetWork} 点击添加网络成功 添加网路定位失败
|
||
... AND Select NetWork2 ${Network}
|
||
... AND Select NetWorkAdapter2 ${NetworkAdp}
|
||
... AND 元素点击 xpath=//*[@id="addPolicyDrNetworkVirtualModal"]/div[2]/button[2] 网络添加成功 网络添加失败
|
||
|
||
校验容灾机(外置)_md5
|
||
Open Connection ${Agent_HostIP} 22
|
||
SSHLibrary.Login ${Agent_User} ${Agent_Pwd} 20s
|
||
Log 进入生产机
|
||
write md5sum ${file_path1}
|
||
${output} read delay=5s
|
||
${text1} Get Substring ${output} 0 32
|
||
Close Connection
|
||
Log 获取生产机文件md5值
|
||
Open Connection ${Add_IPV4_Address_Input} 22
|
||
SSHLibrary.Login ${Agent_User} ${Agent_Pwd} 20s
|
||
Log 进入演练机
|
||
write md5sum ${file_path1}
|
||
${output2} read delay=10s
|
||
${text4} Get Substring ${output2} 0 32
|
||
Log 获取演练机文件md5值
|
||
Should Be Equal ${text4} ${text1}
|
||
Log 验证成功
|
||
Close Connection
|
||
|
||
指定时间点
|
||
Comment Open Connection ${DR_BC_IP}
|
||
Comment SSHLibrary.Login ${DR_BC_Name} ${DR_BC_PWD}
|
||
Comment Log 获取服务器时间
|
||
Comment Write date +"%Y-%m-%d %H:%M:%S"
|
||
Comment ${time1} Read delay=2s
|
||
Comment ${time} Get Line ${time1} 0
|
||
Comment Close Connection
|
||
元素点击 ${Click_DrPolicy_LatestTimePoint} 选择最近时间点 选择最近时间点失败
|
||
${time1} Get Text //*[@id="drTakeOverRehearseId"]/div[1]/div[9]/div
|
||
${time2} Add Time To Date ${time1} -00:01:00
|
||
${time} Get Substring ${time2} 0 19
|
||
Comment ${time} Convert Date ${time2} exclude_millis=yes date_format=%m.%d.%Y %H:%M:%S
|
||
元素点击 ${Click_DrPolicy_TimePoint} 选择容灾数据时间点 容灾数据时间点定位失败
|
||
sleep 2s
|
||
元素点击 ${Click_DrPolicy_ChoiceTime} 选择时间点成功 选择时间点定位失败
|
||
sleep 2s
|
||
元素输入 xpath=//*[@id="takeOverRehearseSelectTime"] ${time} 输入时间
|
||
元素点击 ${Click_DrPolicy_ChoiceTime} 选择时间点成功 选择时间点定位失败
|
||
元素点击 //span[text()='清空']/../span[text()="确定"] 点击确定成功 定位确定失败
|
||
Sleep 2s
|
||
元素点击 ${Click_DrPolicy_ChoiceTime} 选择时间点1成功 选择时间点1定位失败
|
||
sleep 2s
|
||
Clear Element Text xpath=//*[@id="takeOverRehearseSelectTime"]
|
||
sleep 60s
|
||
Comment 等待60s模拟指定1分钟前的时间点
|
||
元素输入 xpath=//*[@id="takeOverRehearseSelectTime"] ${time} 输入时间
|
||
sleep 2s
|
||
元素输入 xpath=//*[@id="takeOverRehearseSelectTime"] ${time} 输入时间
|
||
sleep 2s
|
||
|
||
自动接管获取list
|
||
comment 服务列表
|
||
${list} Create List netprofm
|
||
comment
|
||
Set Test Variable ${list}
|
||
|
||
自动接管策略创建完成状态
|
||
[Arguments] ${PolicyName}
|
||
sleep 10s
|
||
${temp} Get Text xpath=//*[@id="disasterTable"]//tr[td[text()="${PolicyName}"]]//td[4]
|
||
Run Keyword If '${temp}'=="创建中" 自动接管策略创建完成状态 ${PolicyName}
|
||
... ELSE IF '${temp}'=="断开" log 自动接管策略创建完成
|
||
... ELSE 关闭浏览器
|
||
|
||
生产机关闭服务_win
|
||
[Arguments] ${ip} ${user} ${pwd} # ip地址|用户名|密码
|
||
Open Connection ${ip}
|
||
SSHLibrary.Login ${user} ${pwd}
|
||
Log 生产机关闭主题服务
|
||
Start Command chcp 65001
|
||
sleep 3s
|
||
Execute Command net stop netprofm
|
||
sleep 5s
|
||
Close Connection
|
||
|
||
等待生产机关机_win
|
||
[Arguments] ${IP}
|
||
Comment 如果online进行关机,否则执行策略
|
||
Log 查看生产机的状态
|
||
Open Connection ${DR_BC_IP} 22
|
||
SSHLibrary.Login ${DR_BC_Name} ${DR_BC_PWD}
|
||
Log 进入黑方后台
|
||
Write ping \ '${IP}'
|
||
${output} read delay=30s
|
||
${text2} Get Line ${output} 1
|
||
Close Connection
|
||
${flag} Evaluate 'Destination Host Unreachable' in $text2
|
||
Run Keyword If ${flag} log 生产机已关机
|
||
... ELSE 等待生产机关机_win ${IP}
|
||
|
||
自动接管开始_win
|
||
[Arguments] ${PolicyName}
|
||
FOR ${n} IN RANGE 20
|
||
Sleep 150s
|
||
Wait Until Element Is Visible xpath=//*[@id="disasterTable"]//tr[td[text()="${PolicyName}"]]//td[4] 10s 定位状态失败
|
||
${temp} Get Text xpath=//*[@id="disasterTable"]//tr[td[text()="${PolicyName}"]]//td[4]
|
||
Run Keyword If '${temp}'=="连接" EXIT FOR LOOP
|
||
END
|
||
Sleep 180s
|
||
|
||
创建接管策略_win_异地
|
||
[Arguments] ${PolicyName} ${SourceType} ${DataSource} ${PDM_Type} ${Plafrom} ${coreCPU} ${numberCPU} ${Memory} ${Network} ${NetworkAdp} ${list} ${Auto_Switch} ${DrMode} ${DR_Type} ${Source} ${Auto_Type}
|
||
... ${DrPlatformType}='' ${DrVirtualHostInCDR}='' ${AgentTiming}='' #数据源类型|数据源|容灾平台类型|容灾平台|cpu内核|cpu数|内存|网络|网络适配器|服务列表|是否自动演练/接管|容灾模式|容灾类型
|
||
sleep 3s
|
||
元素点击 ${Btn_Add_Drpolicy} 点击创建容灾策略成功 创建容灾策略点击失败
|
||
元素输入 ${Input_DrPolicyName} ${PolicyName} 获取容灾策略名输入元素失败
|
||
comment 数据源类型 数据源
|
||
选择数据源_win ${SourceType} ${DataSource} ${DrPlatformType} ${DrVirtualHostInCDR} ${AgentTiming}
|
||
鉴权
|
||
comment 容灾机类型 容灾平台 cpu核心数 cpu个数 内存 网络 网络适配器 服务端通道
|
||
Comment 接管机配置 ${PDM_Type} ${Plafrom} ${coreCPU} ${numberCPU} ${Memory} ${Network} ${NetworkAdp} ${Data_Address_Transfer} ${SourceType}
|
||
容灾机配置(正确) ${PDM_Type} ${Plafrom} ${coreCPU} ${numberCPU} ${Memory} ${Network} ${NetworkAdp} ${Data_Address_Transfer_dest} ${SourceType} ${Network_Configuration_default}
|
||
comment 容灾机模式
|
||
容灾机模式配置_win ${DrMode} ${Auto_Switch} ${list} ${Auto_Type}
|
||
容灾策略预览 ${PolicyName} ${Plafrom} ${coreCPU} ${numberCPU} 服务列表 ${Network} ${NetworkAdp} ${Data_Address_Transfer_dest} ${DR_Type} ${Source}
|
||
|
||
校验容灾机_win(外置)
|
||
[Arguments] ${v_name} ${mem} ${core} ${num} # 容灾机名 | 内存 | CPU核数 | CPU个数
|
||
Comment 校验CPU、内存
|
||
Open Connection ${DRESXi_IP} 22
|
||
SSHLibrary.Login ${DRESXi_user} ${DRESXi_PWD}
|
||
Log 进入ESXi后台
|
||
Write vim-cmd vmsvc/getallvms |grep drvm_${v_name} |awk '{print $1}' | xargs vim-cmd vmsvc/power.getstate | grep Powered |awk '{print $2}'
|
||
${output} read delay=5s
|
||
Should Contain ${output} on
|
||
Log 容灾机开启成功
|
||
Write cat /vmfs/volumes/data3/drvm_${v_name}*/drvm_${v_name}*.vmx
|
||
${output} read delay=5s
|
||
${Memery_total} Evaluate ${mem}*1024
|
||
Should Contain ${output} memSize = "${Memery_total}"
|
||
Log 内存设置正确
|
||
${cpu_total} Evaluate ${num} * ${core}
|
||
Should Contain ${output} numvcpus = "${cpu_total}"
|
||
Log cpu设置正确
|
||
Close Connection
|
||
Comment 获取容灾机文件md5值
|
||
Open Connection ${Add_IPV4_Address_Input} 22
|
||
SSHLibrary.Login ${Agent_User_win} ${Agent_Pwd_win}
|
||
Log 进入接管容灾机
|
||
Start Command ${Windows_Python_Path} MD5.py
|
||
Sleep 3s
|
||
${recor_content} Read Command Output
|
||
Log 恢复机的校验文件内容为:${recor_content}
|
||
${compare_result} Run Keyword And Return Status Should Contain ${origin_content} ${recor_content}
|
||
Run Keyword If ${compare_result}==True Log 校验成功,文本内容一致
|
||
... ELSE Fail 校验失败,文本内容不一致
|
||
Log 验证成功
|
||
Close Connection
|
||
Log 容灾机数据校验成功
|
||
|
||
校验接管容灾机_win(外置)
|
||
[Arguments] ${v_name} ${mem} ${core} ${num} # 容灾机名 | 内存 | CPU核数 | CPU个数
|
||
Comment 校验CPU、内存
|
||
Open Connection ${DRESXi_IP} 22
|
||
SSHLibrary.Login ${DRESXi_user} ${DRESXi_PWD}
|
||
Log 进入ESXi后台
|
||
Write vim-cmd vmsvc/getallvms |grep drvm_${v_name} |awk '{print $1}' | xargs vim-cmd vmsvc/power.getstate | grep Powered |awk '{print $2}'
|
||
${output} read delay=5s
|
||
Should Contain ${output} on
|
||
Log 容灾机开启成功
|
||
Write cat /vmfs/volumes/data3/drvm_${v_name}*/drvm_${v_name}*.vmx
|
||
${output} read delay=5s
|
||
${Memery_total} Evaluate ${mem}*1024
|
||
Should Contain ${output} memSize = "${Memery_total}"
|
||
Log 内存设置正确
|
||
${cpu_total} Evaluate ${num} * ${core}
|
||
Should Contain ${output} numvcpus = "${cpu_total}"
|
||
Log cpu设置正确
|
||
Close Connection
|
||
sleep 40s
|
||
Comment 获取接管容灾机文件md5值
|
||
Open Connection ${Agent_HostIP_win} 22
|
||
SSHLibrary.Login ${Agent_User_win} ${Agent_Pwd_win}
|
||
Log 进入接管容灾机
|
||
Start Command C:\\Agent\\ubackup\\uagent\\bin\\Python27\\python MD5.py
|
||
Sleep 3s
|
||
${recor_content} Read Command Output
|
||
Log 恢复机的校验文件内容为:${recor_content}
|
||
${compare_result} Run Keyword And Return Status Should Contain ${origin_content} ${recor_content}
|
||
Run Keyword If ${compare_result}==True Log 校验成功,文本内容一致
|
||
... ELSE Fail 校验失败,文本内容不一致
|
||
Log 验证成功
|
||
Close Connection
|
||
Log 容灾机数据校验成功
|
||
|
||
创建容灾策略_win(default)
|
||
[Arguments] ${PolicyName} ${SourceType} ${DataSource} ${PDM_Type} ${Plafrom} ${coreCPU} ${numberCPU} ${Memory} ${Network} ${NetworkAdp} ${list} ${Auto_Switch} ${DrMode} ${DR_Type} ${Source} ${Auto_Type}
|
||
... ${DrPlatformType}='' ${DrVirtualHostInCDR}='' ${AgentTiming}='' #数据源类型|数据源|容灾平台类型|容灾平台|cpu内核|cpu数|内存|网络|网络适配器|服务列表|是否自动演练/接管|容灾模式|容灾类型
|
||
sleep 3s
|
||
元素点击 ${Btn_Add_Drpolicy} 点击创建容灾策略成功 创建容灾策略点击失败
|
||
元素输入 ${Input_DrPolicyName} ${PolicyName} 获取容灾策略名输入元素失败
|
||
comment 数据源类型 数据源
|
||
选择数据源_win ${SourceType} ${DataSource} ${DrPlatformType} ${DrVirtualHostInCDR} ${AgentTiming}
|
||
comment 容灾机类型 容灾平台 cpu核心数 cpu个数 内存 网络 网络适配器 服务端通道
|
||
容灾机配置(正确) ${PDM_Type} ${Plafrom} ${coreCPU} ${numberCPU} ${Memory} ${Network} ${NetworkAdp} ${Data_Address_Transfer} ${SourceType} ${Network_Configuration_default}
|
||
comment 容灾机模式
|
||
容灾机模式配置_win ${DrMode} ${Auto_Switch} ${list} ${Auto_Type}
|
||
容灾策略预览 ${PolicyName} ${Plafrom} ${coreCPU} ${numberCPU} 服务列表 ${Network} ${NetworkAdp} ${Data_Address_Transfer} ${DR_Type} ${Source}
|
||
|
||
创建容灾策略_lin(default)
|
||
[Arguments] ${PolicyName} ${SourceType} ${DataSource} ${PDM_Type} ${Plafrom} ${coreCPU} ${numberCPU} ${Memory} ${Network} ${NetworkAdp} ${list} ${Auto_Switch} ${DrMode} ${DR_Type} ${Source} ${Auto_Type}
|
||
... ${DrPlatformType}='' ${DrVirtualHostInCDR}='' ${AgentTiming}='' #数据源类型|数据源|容灾平台类型|容灾平台|cpu内核|cpu数|内存|网络|网络适配器|服务列表|是否自动演练/接管|容灾模式|容灾类型
|
||
sleep 3s
|
||
元素点击 ${Btn_Add_Drpolicy} 点击创建容灾策略成功 创建容灾策略点击失败
|
||
元素输入 ${Input_DrPolicyName} ${PolicyName} 获取容灾策略名输入元素失败
|
||
comment 数据源类型 数据源
|
||
选择数据源 ${SourceType} ${DataSource} ${DrPlatformType} ${DrVirtualHostInCDR} ${AgentTiming}
|
||
comment 容灾机类型 容灾平台 cpu核心数 cpu个数 内存 网络 网络适配器 服务端通道
|
||
容灾机配置_外置 ${PDM_Type} ${Plafrom} ${coreCPU} ${numberCPU} ${Memory} ${Network} ${NetworkAdp} ${Data_Address_Transfer} ${SourceType}
|
||
comment 容灾机模式
|
||
容灾机模式配置_Lin ${DrMode} ${Auto_Switch} ${list} ${Auto_Type}
|
||
容灾策略预览 ${PolicyName} ${Plafrom} ${coreCPU} ${numberCPU} 服务列表 ${Network} ${NetworkAdp} ${Data_Address_Transfer} ${DR_Type} ${Source}
|
||
Sleep 100s
|
||
|
||
自动接管开始_lin
|
||
[Arguments] ${PolicyName}
|
||
FOR ${n} IN RANGE 20
|
||
Sleep 150s
|
||
Wait Until Element Is Visible xpath=//*[@id="disasterTable"]//tr[td[text()="${PolicyName}"]]//td[4] 10s 定位状态失败
|
||
${temp} Get Text xpath=//*[@id="disasterTable"]//tr[td[text()="${PolicyName}"]]//td[4]
|
||
Run Keyword If '${temp}'=="连接" EXIT FOR LOOP
|
||
END
|
||
Sleep 180s
|
||
|
||
自动接管获取list_lin
|
||
comment 服务列表
|
||
${list} Create List NetworkManager.service
|
||
comment
|
||
Set Test Variable ${list}
|
||
|
||
生产机关闭服务_lin
|
||
[Arguments] ${ip} ${user} ${pwd} # ip地址|用户名|密码
|
||
Open Connection ${ip}
|
||
SSHLibrary.Login ${user} ${pwd}
|
||
Log 生产机关闭NetworkManager服务
|
||
Execute Command service NetworkManager.service stop
|
||
sleep 5s
|
||
Close Connection
|
||
|
||
创建容灾策略_win(default异地)
|
||
[Arguments] ${PolicyName} ${SourceType} ${DataSource} ${PDM_Type} ${Plafrom} ${coreCPU} ${numberCPU} ${Memory} ${Network} ${NetworkAdp} ${list} ${Auto_Switch} ${DrMode} ${DR_Type} ${Source} ${Auto_Type}
|
||
... ${DrPlatformType}='' ${DrVirtualHostInCDR}='' ${AgentTiming}='' #数据源类型|数据源|容灾平台类型|容灾平台|cpu内核|cpu数|内存|网络|网络适配器|服务列表|是否自动演练/接管|容灾模式|容灾类型
|
||
sleep 3s
|
||
元素点击 ${Btn_Add_Drpolicy} 点击创建容灾策略成功 创建容灾策略点击失败
|
||
元素输入 ${Input_DrPolicyName} ${PolicyName} 获取容灾策略名输入元素失败
|
||
comment 数据源类型 数据源
|
||
选择数据源_win ${SourceType} ${DataSource} ${DrPlatformType} ${DrVirtualHostInCDR} ${AgentTiming}
|
||
鉴权
|
||
comment 容灾机类型 容灾平台 cpu核心数 cpu个数 内存 网络 网络适配器 服务端通道
|
||
容灾机配置(正确) ${PDM_Type} ${Plafrom} ${coreCPU} ${numberCPU} ${Memory} ${Network} ${NetworkAdp} ${Data_Address_Transfer_dest} ${SourceType} ${Network_Configuration_default}
|
||
comment 容灾机模式
|
||
容灾机模式配置_win ${DrMode} ${Auto_Switch} ${list} ${Auto_Type}
|
||
容灾策略预览 ${PolicyName} ${Plafrom} ${coreCPU} ${numberCPU} 服务列表 ${Network} ${NetworkAdp} ${Data_Address_Transfer_dest} ${DR_Type} ${Source}
|
||
sleep 360s
|
||
|
||
创建容灾策略_lin(default异地)
|
||
[Arguments] ${PolicyName} ${SourceType} ${DataSource} ${PDM_Type} ${Plafrom} ${coreCPU} ${numberCPU} ${Memory} ${Network} ${NetworkAdp} ${list} ${Auto_Switch} ${DrMode} ${DR_Type} ${Source} ${Auto_Type}
|
||
... ${DrPlatformType}='' ${DrVirtualHostInCDR}='' ${AgentTiming}='' #数据源类型|数据源|容灾平台类型|容灾平台|cpu内核|cpu数|内存|网络|网络适配器|服务列表|是否自动演练/接管|容灾模式|容灾类型
|
||
sleep 3s
|
||
元素点击 ${Btn_Add_Drpolicy} 点击创建容灾策略成功 创建容灾策略点击失败
|
||
元素输入 ${Input_DrPolicyName} ${PolicyName} 获取容灾策略名输入元素失败
|
||
comment 数据源类型 数据源
|
||
选择数据源 ${SourceType} ${DataSource} ${DrPlatformType} ${DrVirtualHostInCDR} ${AgentTiming}
|
||
鉴权
|
||
comment 容灾机类型 容灾平台 cpu核心数 cpu个数 内存 网络 网络适配器 服务端通道
|
||
容灾机配置_外置 ${PDM_Type} ${Plafrom} ${coreCPU} ${numberCPU} ${Memory} ${Network} ${NetworkAdp} ${Data_Address_Transfer_dest} ${SourceType}
|
||
comment 容灾机模式
|
||
容灾机模式配置_win ${DrMode} ${Auto_Switch} ${list} ${Auto_Type}
|
||
容灾策略预览 ${PolicyName} ${Plafrom} ${coreCPU} ${numberCPU} 服务列表 ${Network} ${NetworkAdp} ${Data_Address_Transfer_dest} ${DR_Type} ${Source}
|
||
|
||
创建容灾策略_default
|
||
[Arguments] ${PolicyName} ${SourceType} ${DataSource} ${PDM_Type} ${Plafrom} ${coreCPU} ${numberCPU} ${Memory} ${Network} ${NetworkAdp} ${list} ${Auto_Switch} ${DrMode} ${DR_Type} ${Source} ${Auto_Type}
|
||
... ${DrPlatformType}='' ${DrVirtualHostInCDR}='' ${AgentTiming}='' #数据源类型|数据源|容灾平台类型|容灾平台|cpu内核|cpu数|内存|网络|网络适配器|服务列表|是否自动演练/接管|容灾模式|容灾类型
|
||
sleep 3s
|
||
元素点击 ${Btn_Add_Drpolicy} 点击创建容灾策略成功 创建容灾策略点击失败
|
||
元素输入 ${Input_DrPolicyName} ${PolicyName} 获取容灾策略名输入元素失败
|
||
comment 数据源类型 数据源
|
||
选择数据源 ${SourceType} ${DataSource} ${DrPlatformType} ${DrVirtualHostInCDR} ${AgentTiming}
|
||
鉴权
|
||
comment 容灾机类型 容灾平台 cpu核心数 cpu个数 内存 网络 网络适配器 服务端通道
|
||
容灾机配置(正确) ${PDM_Type} ${Plafrom} ${coreCPU} ${numberCPU} ${Memory} ${Network} ${NetworkAdp} ${DR_BC_IP} ${SourceType} ${Network_Configuration_default}
|
||
comment 容灾机模式
|
||
容灾机模式配置_win ${DrMode} ${Auto_Switch} ${list} ${Auto_Type}
|
||
容灾策略预览 ${PolicyName} ${Plafrom} ${coreCPU} ${numberCPU} 服务列表 ${Network} ${NetworkAdp} ${Data_Address_Transfer} ${DR_Type} ${Source}
|
||
|
||
创建接管策略_lin_异地
|
||
[Arguments] ${PolicyName} ${SourceType} ${DataSource} ${PDM_Type} ${Plafrom} ${coreCPU} ${numberCPU} ${Memory} ${Network} ${NetworkAdp} ${list} ${Auto_Switch} ${DrMode} ${DR_Type} ${Source} ${Auto_Type}
|
||
... ${DrPlatformType}='' ${DrVirtualHostInCDR}='' ${AgentTiming}='' #数据源类型|数据源|容灾平台类型|容灾平台|cpu内核|cpu数|内存|网络|网络适配器|服务列表|是否自动演练/接管|容灾模式|容灾类型
|
||
sleep 3s
|
||
元素点击 ${Btn_Add_Drpolicy} 点击创建容灾策略成功 创建容灾策略点击失败
|
||
元素输入 ${Input_DrPolicyName} ${PolicyName} 获取容灾策略名输入元素失败
|
||
comment 数据源类型 数据源
|
||
选择数据源 ${SourceType} ${DataSource} ${DrPlatformType} ${DrVirtualHostInCDR} ${AgentTiming}
|
||
鉴权
|
||
comment 容灾机类型 容灾平台 cpu核心数 cpu个数 内存 网络 网络适配器 服务端通道
|
||
Comment 接管机配置 ${PDM_Type} ${Plafrom} ${coreCPU} ${numberCPU} ${Memory} ${Network} ${NetworkAdp} ${Data_Address_Transfer} ${SourceType}
|
||
容灾机配置(正确) ${PDM_Type} ${Plafrom} ${coreCPU} ${numberCPU} ${Memory} ${Network} ${NetworkAdp} ${Data_Address_Transfer_dest} ${SourceType} ${Network_Configuration_default}
|
||
comment 容灾机模式
|
||
容灾机模式配置_win ${DrMode} ${Auto_Switch} ${list} ${Auto_Type}
|
||
容灾策略预览 ${PolicyName} ${Plafrom} ${coreCPU} ${numberCPU} 服务列表 ${Network} ${NetworkAdp} ${Data_Address_Transfer_dest} ${DR_Type} ${Source}
|
||
|
||
渐进式回迁方式_lin
|
||
[Arguments] ${ip} ${user} ${pwd} ${drRelocationCdpPropertyWayList} ${drRelocationCdpDataTransferMode} ${PolicyName} #livecd ip |livecd 用户名| livecd密码 |回迁方式 |数据传输模式|分区名称|磁盘名称
|
||
sleep 20s
|
||
Comment 元素点击 ${Click_More} 点击更多按钮成功 定位更多元素失败
|
||
元素点击 xpath=//td[text()='${PolicyName}']/../td[9]//span[text()='更多'] 点击更多按钮成功 定位更多元素失败
|
||
元素点击 //*[@id="app"]/ul/li[2] 点击回迁按钮成功 点击回迁按钮失败
|
||
sleep 10s
|
||
元素点击 //*[@id="drRelocationCdpTargetMachine"] 点击选择目标机成功 点击选择目标机失败
|
||
元素点击 //option[text()='livecd.${LIVECD_IP}'] 选择目标livecd成功 定位目标livecd失败
|
||
元素点击 //*[@id="drRelocationCdpPropertyWayList"] 点击选择回迁方式成功 定位选择回迁方式失败
|
||
Run Keyword If "${drRelocationCdpPropertyWayList}"=="渐进式回迁" 选择渐进式回迁
|
||
... ELSE IF "${drRelocationCdpPropertyWayList}"=="仅恢复增量数据" 选择仅恢复增量数据回迁
|
||
元素点击 //*[@id="drRelocationCdpDataTransferMode"] 选择数据传输选择框成功 定位数据传输选择框失败
|
||
Run Keyword If "${drRelocationCdpDataTransferMode}"=="iSCSI" 选择iSCSI传输方式
|
||
... ELSE IF "${drRelocationCdpDataTransferMode}"=="FC" 选择FC传输方式
|
||
... ELSE IF "${drRelocationCdpDataTransferMode}"=="OSVI" 选择OSVI传输方式 0
|
||
... ELSE 关闭浏览器
|
||
sleep 2s
|
||
|
||
创建接管策略_lin
|
||
[Arguments] ${PolicyName} ${SourceType} ${DataSource} ${PDM_Type} ${Plafrom} ${coreCPU} ${numberCPU} ${Memory} ${Network} ${NetworkAdp} ${list} ${Auto_Switch} ${DrMode} ${DR_Type} ${Source} ${Auto_Type}
|
||
... ${DrPlatformType}='' ${DrVirtualHostInCDR}='' ${AgentTiming}='' #数据源类型|数据源|容灾平台类型|容灾平台|cpu内核|cpu数|内存|网络|网络适配器|服务列表|是否自动演练/接管|容灾模式|容灾类型
|
||
sleep 3s
|
||
元素点击 ${Btn_Add_Drpolicy} 点击创建容灾策略成功 创建容灾策略点击失败
|
||
元素输入 ${Input_DrPolicyName} ${PolicyName} 获取容灾策略名输入元素失败
|
||
comment 数据源类型 数据源
|
||
选择数据源 ${SourceType} ${DataSource} ${DrPlatformType} ${DrVirtualHostInCDR} ${AgentTiming}
|
||
comment 容灾机类型 容灾平台 cpu核心数 cpu个数 内存 网络 网络适配器 服务端通道
|
||
容灾机配置(正确) ${PDM_Type} ${Plafrom} ${coreCPU} ${numberCPU} ${Memory} ${Network} ${NetworkAdp} ${DR_BC_IP} ${SourceType} ${Network_Configuration_default}
|
||
comment 容灾机模式
|
||
容灾机模式配置_win ${DrMode} ${Auto_Switch} ${list} ${Auto_Type}
|
||
容灾策略预览 ${PolicyName} ${Plafrom} ${coreCPU} ${numberCPU} 服务列表 ${Network} ${NetworkAdp} ${Data_Address_Transfer} ${DR_Type} ${Source}
|
||
|
||
自动演练配置_自动循环模式win
|
||
元素点击 ${Auto_Drill_Time_Hour} 点击小时成功 自动演练定位小时失败
|
||
元素输入 ${Auto_Drill_Time_Hour_Input1} 1 输入1小时成功
|
||
自动演练配置_自动循环模式_设置时间_win
|
||
|
||
自动演练配置_自动循环模式_设置时间_win
|
||
Open Connection ${DR_BC_IP}
|
||
SSHLibrary.Login ${DR_BC_Name} ${DR_BC_PWD}
|
||
Log 获取服务器时间
|
||
Write date \ -d "5 minutes" +"%Y-%m-%d %H:%M:%S"\n
|
||
${time1} Read delay=2s
|
||
${time} Get Line ${time1} 0
|
||
Close Connection
|
||
Clear Element Text ${Auto_Drill_Time_Hour_StartTime}
|
||
sleep 2s
|
||
元素输入 ${Auto_Drill_Time_Hour_StartTime} ${time} 输入时间
|
||
|
||
容灾机模式配置_Lin
|
||
[Arguments] ${Mode} ${Auto_Switch} ${list} ${Auto_Type}
|
||
Select DRMode ${Mode}
|
||
log ${Mode}
|
||
Log 设置容灾机模式
|
||
Run Keyword If '${Auto_Switch}'=="是" and '${Mode}'=="演练模式" 自动演练配置lin_仅一次 ${list} ${Auto_Type}
|
||
... ELSE IF '${Auto_Switch}'=="是" and '${Mode}'=="接管模式" 自动接管配置 ${list} ${Auto_Type}
|
||
... ELSE 完成容灾模式配置
|
||
|
||
自动演练配置lin_仅一次
|
||
[Arguments] ${list} ${Auto_Type}
|
||
元素点击 ${Add_Policy_AutoSwitch} 开启自动演练成功 自动演练开启按钮获取失败
|
||
sleep 10s
|
||
Run Keyword If '${Auto_Type}'=='脚本' 选择脚本文件_lin
|
||
... ELSE IF '${Auto_Type}'=='服务' 自动演练服务选择 ${list}
|
||
完成容灾模式配置
|
||
|
||
选择脚本文件_lin
|
||
元素点击 ${DR_AutoDrill_ChooseScript} 点击选择脚本文件按钮成功 选择脚本按钮元素获取失败
|
||
元素点击 ${DR_AutoDrill_ChooseScript_7sh} 选择linux脚本文件成功 选择linux脚本文件元素获取失败
|
||
元素点击 ${Button_DR_AutoDrill_ChooseScript_Comfirm} 脚本选择导入成功 获取导入按钮元素失败
|
||
|
||
自动演练配置lin_小时
|
||
[Arguments] ${list} ${Auto_Type}
|
||
元素点击 ${Add_Policy_AutoSwitch} 开启自动演练成功 自动演练开启按钮获取失败
|
||
sleep 10s
|
||
Run Keyword If '${Auto_Type}'=='脚本' 选择脚本文件_lin
|
||
... ELSE IF '${Auto_Type}'=='服务' 自动演练服务选择 ${list}
|
||
自动演练配置_自动循环模式win
|
||
完成容灾模式配置
|
||
|
||
容灾机模式配置_Lin_小时
|
||
[Arguments] ${Mode} ${Auto_Switch} ${list} ${Auto_Type}
|
||
Select DRMode ${Mode}
|
||
log ${Mode}
|
||
Log 设置容灾机模式
|
||
Run Keyword If '${Auto_Switch}'=="是" and '${Mode}'=="演练模式" 自动演练配置lin_小时 ${list} ${Auto_Type}
|
||
... ELSE IF '${Auto_Switch}'=="是" and '${Mode}'=="接管模式" 自动接管配置 ${list} ${Auto_Type}
|
||
... ELSE 完成容灾模式配置
|
||
|
||
创建容灾策略_lin(default)_按小时
|
||
[Arguments] ${PolicyName} ${SourceType} ${DataSource} ${PDM_Type} ${Plafrom} ${coreCPU} ${numberCPU} ${Memory} ${Network} ${NetworkAdp} ${list} ${Auto_Switch} ${DrMode} ${DR_Type} ${Source} ${Auto_Type}
|
||
... ${DrPlatformType}='' ${DrVirtualHostInCDR}='' ${AgentTiming}='' #数据源类型|数据源|容灾平台类型|容灾平台|cpu内核|cpu数|内存|网络|网络适配器|服务列表|是否自动演练/接管|容灾模式|容灾类型
|
||
sleep 3s
|
||
元素点击 ${Btn_Add_Drpolicy} 点击创建容灾策略成功 创建容灾策略点击失败
|
||
元素输入 ${Input_DrPolicyName} ${PolicyName} 获取容灾策略名输入元素失败
|
||
comment 数据源类型 数据源
|
||
选择数据源 ${SourceType} ${DataSource} ${DrPlatformType} ${DrVirtualHostInCDR} ${AgentTiming}
|
||
comment 容灾机类型 容灾平台 cpu核心数 cpu个数 内存 网络 网络适配器 服务端通道
|
||
容灾机配置_外置 ${PDM_Type} ${Plafrom} ${coreCPU} ${numberCPU} ${Memory} ${Network} ${NetworkAdp} ${Data_Address_Transfer} ${SourceType}
|
||
comment 容灾机模式
|
||
容灾机模式配置_Lin_小时 ${DrMode} ${Auto_Switch} ${list} ${Auto_Type}
|
||
容灾策略预览 ${PolicyName} ${Plafrom} ${coreCPU} ${numberCPU} 服务列表 ${Network} ${NetworkAdp} ${Data_Address_Transfer} ${DR_Type} ${Source}
|
||
Sleep 300s
|
||
|
||
验证容灾机配置与高级选项_内置
|
||
[Arguments] ${IP} ${USER} ${PWD} ${PName} ${C_Num} ${C_Core} ${Mem} ${CPU_Model} ${GC} # 黑方IP|黑方用户名|黑方密码|容灾策略名|CPU个数|CPU核数|内存大小|CPU型号|显卡型号
|
||
Open Connection ${IP} 22
|
||
SSHLibrary.Login ${USER} ${PWD}
|
||
Log 进入黑方后台
|
||
Write virsh list --name
|
||
${output} read delay=5s
|
||
Should Contain ${output} ${PName}
|
||
Log 容灾机开启成功
|
||
Write cd /etc/libvirt/qemu
|
||
Write cat *${PName}*
|
||
${output} read delay=5s
|
||
${Memery_total} Evaluate ${Mem}*1024*1024
|
||
Should Contain ${output} <memory unit='KiB'>${Memery_total}</memory>
|
||
Log 内存设置正确
|
||
Should Contain ${output} sockets='${C_Num}'
|
||
Log cpu设置正确
|
||
Should Contain ${output} cpu mode='${CPU_Model}'
|
||
Log cpu型号正确
|
||
Should Contain ${output} model type='${GC}'
|
||
Log 显卡型号正确
|
||
Close Connection
|
||
|
||
容灾机内校验配置_win
|
||
[Arguments] ${IP} ${USER} ${PWD} ${C_Num} ${C_Core} ${Mem} # IP|用户名|密码|CPU个数|CPU核数|内存大小
|
||
Sleep 30s
|
||
Open Connection ${IP} 22
|
||
SSHLibrary.Login ${USER} ${PWD}
|
||
Log 进入容灾机后台
|
||
Start Command chcp 65001
|
||
Start Command Systeminfo
|
||
Sleep 10s
|
||
Comment Start Command PowerShell -Command "type tmp.txt | Out-File -Encoding "utf8" sysinfo.txt"
|
||
Comment Start Command findstr /c:"${C_Num} 个处理器" sysinfo.txt
|
||
${output} Read Command Output
|
||
Log 校验CPU数是否正确
|
||
${result} Run Keyword And Return Status Should Contain ${output} ${C_Num} Processor
|
||
Run Keyword If ${result}==True log CPU数正确
|
||
... ELSE fail CPU数错误
|
||
${tmp1} Evaluate ${Mem}*1024
|
||
${tmp} Evaluate str(${tmp1})
|
||
${text1} Get Substring ${tmp} 0 1
|
||
${text2} Get Substring ${tmp} 1
|
||
${Memory_total} Catenate SEPARATOR= ${text1} , ${text2}
|
||
Log 校验内存大小是否正确
|
||
${result} Run Keyword And Return Status Should Contain ${output} Total Physical Memory: \ \ \ \ ${Memory_total} MB
|
||
Run Keyword If ${result}==True log 内存正确
|
||
... ELSE fail 内存错误
|
||
Close Connection
|
||
|
||
修改容灾机配置和高级选项
|
||
[Arguments] ${Name} ${C_Num} ${C_Core} ${Mem} ${GC} # 代理名|CPU个数|CPU核数|内存大小|显卡型号
|
||
元素点击 xpath=//*[@id="disasterTable"]//td[text()="${Name}"]/../td[9]/div/span[3] 点击策略更多成功 定位策略更多失败
|
||
元素点击 xpath=//*[@id="app"]//li[text()="容灾机配置"] 点击容灾机配置成功 定位容灾机配置失败
|
||
元素点击 xpath=//*[@id="senior_edit"]/i 点击高级选项成功 定位高级选项失败
|
||
元素输入 ${Edit_CPU_Core} ${C_Core} CPU核心数元素获取失败
|
||
元素输入 ${Edit_CPU_Num} ${C_Num} CPU个数定位失败
|
||
元素输入 ${Edit_Memery} ${Mem} 内存容量定位失败
|
||
Select From List By Label xpath=//*[@id="editPolicyDrId"]/div[1]/div[3]/div[3]/div[2]/div[5]/div/select ${GC}
|
||
元素点击 xpath=//*[@id="editPolicyDrId"]/div[2]/button[2] 点击确定成功 定位确定失败
|
||
元素点击 xpath=//*[@id="tipsPop_define_btn"] 点击确定成功 定位确定失败
|
||
|
||
验证容灾机配置与高级选项_外置
|
||
[Arguments] ${IP} ${USER} ${PWD} ${v_Name} ${num} ${core} ${mem} ${v_hw_v} # 黑方IP|黑方用户名|黑方密码|容灾策略名|CPU个数|CPU核数|内存大小|虚拟机硬件版本
|
||
Open Connection ${IP} 22
|
||
SSHLibrary.Login ${USER} ${PWD}
|
||
Log 进入ESXi后台
|
||
Write vim-cmd vmsvc/getallvms |grep drvm_${v_name} |awk '{print $1}' | xargs vim-cmd vmsvc/power.getstate | grep Powered |awk '{print $2}'
|
||
${output} read delay=5s
|
||
Should Contain ${output} on
|
||
Log 容灾机开启成功
|
||
Write cat /vmfs/volumes/data/drvm_${v_name}*/drvm_${v_name}*.vmx
|
||
${output} read delay=5s
|
||
${Memery_total} Evaluate ${mem}*1024
|
||
Should Contain ${output} memSize = "${Memery_total}"
|
||
Log 内存设置正确
|
||
${cpu_total} Evaluate ${num} * ${core}
|
||
Should Contain ${output} vcpu.maxPerVirtualNode = "${cpu_total}"
|
||
Log cpu设置正确
|
||
Should Contain ${output} virtualHW.version = "${v_hw_v}"
|
||
Log 虚拟机硬件类型正确
|
||
Close Connection
|
||
|
||
容灾机内校验配置_lin
|
||
[Arguments] ${IP} ${USER} ${PWD} ${C_Num} ${C_Core} ${Mem} # IP|用户名|密码|CPU个数|CPU核数|内存大小
|
||
Sleep 30s
|
||
Open Connection ${IP} 22
|
||
SSHLibrary.Login ${USER} ${PWD}
|
||
Log 进入容灾机后台
|
||
Write lscpu
|
||
${output} Read delay=2s
|
||
Log 校验CPU数是否正确
|
||
${result} Run Keyword And Return Status Should Contain ${output} CPU(s): ${C_Num}
|
||
Run Keyword If ${result}==True log CPU数正确
|
||
... ELSE fail CPU数错误
|
||
${tmp1} Evaluate ${Mem}*1024
|
||
${Memory_total} Evaluate str(${tmp1})
|
||
Log 校验内存大小是否正确
|
||
Write dmidecode|grep -P -A5 "Memory\\s+Device"|grep Size|grep -v Range |grep -v "No Module Installed"
|
||
${output} Read delay=5s
|
||
${result} Run Keyword And Return Status Should Contain ${output} Size: ${Memory_total} MB
|
||
Run Keyword If ${result}==True log 内存正确
|
||
... ELSE fail 内存错误
|
||
Close Connection
|
||
|
||
修改容灾机配置和高级选项_外置
|
||
[Arguments] ${Name} ${C_Num} ${C_Core} ${Mem} ${v_hw_v} # 代理名|CPU个数|CPU核数|内存大小|虚拟机硬件版本
|
||
元素点击 xpath=//*[@id="disasterTable"]//td[text()="${Name}"]/../td[9]/div/span[3] 点击策略更多成功 定位策略更多失败
|
||
元素点击 xpath=//*[@id="app"]//li[text()="容灾机配置"] 点击容灾机配置成功 定位容灾机配置失败
|
||
元素点击 xpath=//*[@id="senior_edit"]/i 点击高级选项成功 定位高级选项失败
|
||
元素输入 ${Edit_CPU_Core} ${C_Core} CPU核心数元素获取失败
|
||
元素输入 ${Edit_CPU_Num} ${C_Num} CPU个数定位失败
|
||
元素输入 ${Edit_Memery} ${Mem} 内存容量定位失败
|
||
Select From List By Label xpath=//*[@id="editPolicyDrId"]/div[1]/div[3]/div[3]/div[3]/div[1]/div/select vmx-${v_hw_v}
|
||
元素点击 xpath=//*[@id="editPolicyDrId"]/div[2]/button[2] 点击确定成功 定位确定失败
|
||
Sleep 5s
|
||
元素点击 xpath=//*[@id="tipsPop_define_btn"] 点击确定成功 定位确定失败
|
||
|
||
自动演练获取list_ubuntu
|
||
comment 服务列表
|
||
${list} Create List ufw
|
||
comment
|
||
Set Test Variable ${list}
|
||
|
||
自动接管获取list_ubuntu
|
||
comment 服务列表
|
||
${list} Create List ufw
|
||
comment
|
||
Set Test Variable ${list}
|
||
|
||
生产机关闭服务_ubuntu
|
||
[Arguments] ${ip} ${user} ${pwd} # ip地址|用户名|密码
|
||
Open Connection ${ip}
|
||
SSHLibrary.Login ${user} ${pwd}
|
||
Log 生产机关闭ufw服务
|
||
Execute Command service ufw stop
|
||
sleep 5s
|
||
Close Connection
|
||
|
||
登录CAS
|
||
[Arguments] ${IPaddress} ${login_name} ${login_pwd} # 黑方服务器IP地址 \| 登录名称 \| 登录密码
|
||
Open Browser ${IPaddress} ff
|
||
Sleep 2s
|
||
Set Window Size 1920 1080
|
||
Log 切换浏览器窗口 1920*1080
|
||
Wait Until Element Is Visible //div[contains(text(),"新华三")] 60s 浏览器打开失败
|
||
Sleep 5s
|
||
元素输入 //label[text()='用户名']/../div/div/input ${login_name} 定位用户名输入框失败
|
||
元素输入 //label[text()='密码']/../div/div/input ${login_pwd} 定位用户密码输入框失败
|
||
元素点击 //span[text()='登 录']/.. 点击登录成功 定位登录失败
|
||
Sleep 2s
|
||
${flag} Run Keyword And Return Status Wait Until Element Is Visible //span[contains(text(),"以后再说")]
|
||
Run Keyword If "${flag}"=="True" Run Keywords 元素点击 //span[contains(text(),"以后再说")] 点击以后再说成功 定位以后再说失败
|
||
... AND 元素点击 //span[contains(text(),"以后再说")] 点击以后再说成功 定位以后再说失败
|
||
Wait Until Page Contains Element //p[text()='${login_name}'] 60s 用户登录失败
|
||
Log ${login_name}登录成功
|
||
Sleep 5s
|
||
|
||
修改CAS虚拟机内存优先级
|
||
[Arguments] ${pname}
|
||
元素点击 //div[contains(text(),"云资源")] 点击云资源成功 定位云资源失败
|
||
元素点击 //span[contains(text(),"${pname}")] 点击容灾机成功 定位容灾机失败
|
||
元素点击 //span[contains(text(),"快照管理")]/../../button[4] 点击修改成功 定位修改失败
|
||
Sleep 5s
|
||
元素点击 //*[@id="tab-memory"] 点击内存成功 定位内存失败
|
||
元素点击 //label[text()='限制']/../../../div[3]/div/div/div/i 展开高级设置成功 定位展开高级设置失败
|
||
元素点击 //label[text()='资源优先级']/../div/div/div/input 点击资源优先级下拉框成功 定位资源优先级下拉框失败
|
||
元素点击 //span[text()='高'] 选择高优先级成功 定位高优先级失败
|
||
元素点击 //span[text()='应用'] 点击应用成功 定位应用失败
|
||
Sleep 3s
|
||
修改容灾机高级选项_外置
|
||
[Arguments] ${Name} # 代理名
|
||
元素点击 xpath=//*[@id="senior"]/i 点击高级选项成功 定位高级选项失败
|
||
Select From List By Label xpath=//*[@id="dr_addPolicy_addPolicyDr_diskController_sel"] pvscsi
|
||
|
||
校验容灾机_CAS
|
||
[Arguments] ${v_name} ${mem} ${core} ${num} # 容灾机名 | 内存 | CPU核数 | CPU个数
|
||
Comment 校验CPU、内存
|
||
sleep 300s
|
||
Open Connection ${H3C_CAS_IP} 22 timeout=30
|
||
SSHLibrary.Login ${H3C_CAS_ROOT} ${H3C_CAS_ROOTPWD}
|
||
Log 进入CAS后台
|
||
Write virsh list --name
|
||
${output} read delay=5s
|
||
Should Contain ${output} ${PolicyName}
|
||
Log 容灾机开启成功
|
||
Write cd /etc/libvirt/qemu
|
||
Write cat *${PolicyName}*
|
||
${output} read delay=5s
|
||
${Memery_total} Evaluate ${mem}*1024*1024
|
||
Should Contain ${output} <memory unit='KiB'>${Memery_total}</memory>
|
||
Log 内存设置正确
|
||
${cpu_total} Evaluate ${num} * ${core}
|
||
Should Contain ${output} cores='${core}'
|
||
Log cpu设置正确
|
||
Close Connection
|
||
sleep 5s
|
||
log 登录容灾机开始校验
|
||
Open Connection ${DR_IP} 22 timeout=30
|
||
SSHLibrary.Login ${Agent_User} ${Agent_Pwd} 20s
|
||
Log 进入演练机
|
||
Sleep 5s
|
||
${recor_content} Execute Command cat /test/A.txt
|
||
Log 演练机的校验文件内容为:${recor_content}
|
||
${compare_result} Run Keyword And Return Status Should Contain ${origin_content} ${recor_content}
|
||
Run Keyword If ${compare_result}==True Log 校验成功,文本内容一致
|
||
... ELSE Fail 校验失败,文本内容不一致
|
||
Log 验证成功
|
||
Log 容灾机数据校验成功
|
||
Close Connection
|
||
|
||
校验接管容灾机_CAS
|
||
[Arguments] ${v_name} ${mem} ${core} ${num} # 容灾机名 | 内存 | CPU核数 | CPU个数
|
||
Comment 校验CPU、内存
|
||
Open Connection ${H3C_CAS_IP} 22
|
||
SSHLibrary.Login ${H3C_CAS_ROOT} ${H3C_CAS_ROOTPWD}
|
||
Log 进入CAS后台
|
||
Write virsh list --name
|
||
${output} read delay=5s
|
||
Should Contain ${output} ${PolicyName}
|
||
Log 容灾机开启成功
|
||
Write cd /etc/libvirt/qemu
|
||
Write cat *${PolicyName}*
|
||
${output} read delay=5s
|
||
${Memery_total} Evaluate ${mem}*1024*1024
|
||
Should Contain ${output} <memory unit='KiB'>${Memery_total}</memory>
|
||
Log 内存设置正确
|
||
${cpu_total} Evaluate ${num} * ${core}
|
||
Should Contain ${output} cores='${core}'
|
||
Log cpu设置正确
|
||
Close Connection
|
||
sleep 40s
|
||
Comment 获取接管容灾机文件md5值
|
||
Open Connection ${Agent_HostIP} 22
|
||
SSHLibrary.Login ${Agent_User} ${Agent_Pwd}
|
||
Log 进入接管容灾机
|
||
sleep 5s
|
||
${recor_content} Execute Command cat /test/A.txt
|
||
Log 演练机的校验文件内容为:${recor_content}
|
||
${compare_result} Run Keyword And Return Status Should Contain ${origin_content} ${recor_content}
|
||
Run Keyword If ${compare_result}==True Log 校验成功,文本内容一致
|
||
... ELSE Fail 校验失败,文本内容不一致
|
||
Log 验证成功
|
||
Log 容灾机数据校验成功
|
||
Close Connection
|