提交tcp策略编辑关键字和用例示例

This commit is contained in:
lyf
2021-03-09 09:34:18 +08:00
parent 267af61972
commit 813738e1e9
3 changed files with 163 additions and 23 deletions

View File

@@ -1,6 +1,6 @@
*** Settings ***
Test Teardown run keywords Delete-Proxy-estimate ${PolicyName}
... AND Delete-object-estimate ${ObjName}
# Test Teardown run keywords Delete-Proxy-estimate ${PolicyName}
# ... AND Delete-object-estimate ${ObjName}
Force Tags tsg-ui settings TCPProxy
Resource ../../../02-Keyword/tsg_ui/proxyTCPOptions/ProxyTCPOptions.robot
Library OperatingSystem
@@ -42,16 +42,41 @@ Proxy-TCP-Options001
${SNIname} create list ${TEST NAME}_FQDN
${IPname} create list ${TEST NAME}_IP1
${Filter} create list SNI
${FilterInfo} Create Dictionary Filtercreate=${Filter} SNIname=${SNIname}
${PolicyName} set variable ${TCPProxy}[Tcpname]
${ObjName} Create Dictionary IP=${IPname} FQDN=${SNIname}
UIAddProxyTCPOptions ${TCPProxy} ${TCPClientDict} ${TCPServerDict} SourceInfo=${SourceInfo} DestinationInfo=${DestinationInfo} FilterInfo=${FilterInfo}
#编辑策略
${EditTCPProxy} Create Dictionary Tcpname=${TEST NAME}_TCPName Edittcpname=${TEST NAME}_EditTCPname
${Sip2} Create Dictionary Sordtype=Source Type1=Ip CreateOrSearch=Create Add=Address Name=${TEST NAME}_IP2 Ipclienttext1=192.168.40.11-192.168.40.200 Port=100
${Sip3} Create Dictionary Sordtype=Source Type1=Ip CreateOrSearch=Search ObjectName=${Ip_name1}
${Ip_name2} create list ${TEST NAME}_IP1 ${TEST NAME}_IP2
${EditSourceAddIpList} Create List ${Sip2} ${Sip3}
${EditSourceInfo} Create Dictionary sourceAddIpList=${EditSourceAddIpList}
${Dip2} Create Dictionary Sordtype=Destination Type1=Ip CreateOrSearch=Search ObjectName=${Ip_name2}
${EditDestinationAddIpList} Create List ${Dip2}
${EditDestinationInfo} Create Dictionary destinationAddIpList=${EditDestinationAddIpList}
${EditTCPClientDict} Create Dictionary ClientOverrideMSS=open ClientMSSvalue=801 ClientNoDelay=open Clientttlvalue=101 ClientKeepalive=open ClientProbeNumber=31
... ClientIdleTime=31 ClientInterval=31 ClientUserTimeout=501
${EditTCPServerDict} Create Dictionary ServerOverrideMSS=open ServerMSSvalue=801 ServerNoDelay=open Serverttlvalue=101 ServerKeepalive=open ServerProbeNumber=31
... ServerIdleTime=31 ServerInterval=31 ServerUserTimeout=501
${PolicyName} set variable ${EditTCPProxy}[Edittcpname]
${ObjName} Create Dictionary IP=${Ip_name2} FQDN=${SNIname}
UIUpdateProxyTCPOptions ${EditTCPProxy} ${EditTCPClientDict} ${EditTCPServerDict} SourceInfo=${EditSourceInfo} DestinationInfo=${EditDestinationInfo} FilterInfo=${FilterInfo}

View File

@@ -43,7 +43,7 @@ SelectObj
Create-name
[Arguments] ${objName}
sleep 2
input text id=objectAdd_name ${objName}
input text id=objectAdd_name1 ${objName}
Create-name-groupadd
[Arguments] ${objName}
sleep 2

View File

@@ -8,7 +8,7 @@ Resource ../objects/NewObject.robot
UIAddProxyTCPOptions
[Arguments] ${TCPProxy} ${TCPClientDict} ${TCPServerDict} ${SourceInfo}=null ${DestinationInfo}=null ${FilterInfo}=null
${return} ${Tcpname} Run Keyword And Ignore Error Get From Dictionary ${TCPProxy} Tcpname
${Tcpname} Run Keyword If "${return}"=="FAIL" or "${Tcpname}}"=="${EMPTY}" set variable null
${Tcpname} Run Keyword If "${return}"=="FAIL" or "${Tcpname}"=="${EMPTY}" set variable null
... ELSE set variable ${Tcpname}
${return} ${EnableTCPPassthrough} Run Keyword And Ignore Error Get From Dictionary ${TCPProxy} EnableTCPPassthrough
@@ -42,6 +42,47 @@ UIAddProxyTCPOptions
TCP-OK
TCP-Assertion ${Tcpname}
UIUpdateProxyTCPOptions
[Arguments] ${TCPProxy} ${TCPClientDict} ${TCPServerDict} ${SourceInfo}=null ${DestinationInfo}=null ${FilterInfo}=null
${return} ${Tcpname} Run Keyword And Ignore Error Get From Dictionary ${TCPProxy} Tcpname
${Tcpname} Run Keyword If "${return}"=="FAIL" or "${Tcpname}"=="${EMPTY}" set variable null
... ELSE set variable ${Tcpname}
${return} ${Edittcpname} Run Keyword And Ignore Error Get From Dictionary ${TCPProxy} Edittcpname
${Edittcpname} Run Keyword If "${return}"=="FAIL" or "${Edittcpname}"=="${EMPTY}" set variable ${Tcpname}
... ELSE set variable ${Edittcpname}
${return} ${EnableTCPPassthrough} Run Keyword And Ignore Error Get From Dictionary ${TCPProxy} EnableTCPPassthrough
${EnableTCPPassthrough} Run Keyword If "${return}"=="FAIL" or "${EnableTCPPassthrough}}"=="${EMPTY}" set variable null
... ELSE set variable ${EnableTCPPassthrough}
${return} ${BypassDuplicatedPacket} Run Keyword And Ignore Error Get From Dictionary ${TCPProxy} BypassDuplicatedPacket
${BypassDuplicatedPacket} Run Keyword If "${return}"=="FAIL" or "${BypassDuplicatedPacket}}"=="${EMPTY}" set variable null
... ELSE set variable ${BypassDuplicatedPacket}
Edit-Proxy-TCP-Options ${Tcpname}
Run Keyword If "${Edittcpname}"=="${EMPTY}" or "${Edittcpname}"=="null" log there is no Edittcpname
... ELSE Edit-Proxy-TCP-Name ${Edittcpname}
Run Keyword If "${SourceInfo}"=="${EMPTY}" or "${SourceInfo}"=="null" log there is no SourceInfoDict
... ELSE Create-Source-Button
Run Keyword If "${SourceInfo}"=="${EMPTY}" or "${SourceInfo}"=="null" log there is no SourceInfoDict
... ELSE CreateEditDeleteSources ${SourceInfo}
Run Keyword If "${DestinationInfo}"=="${EMPTY}" or "${DestinationInfo}"=="null" log there is no DestinationInfo
... ELSE Create-Destination-Button
Run Keyword If "${DestinationInfo}"=="${EMPTY}" or "${DestinationInfo}"=="null" log there is no DestinationInfo
... ELSE CreateEditDeleteDestination ${DestinationInfo}
Run Keyword If "${FilterInfo}"=="${EMPTY}" log there is no FilterInfo
... ELSE Filter-create ${FilterInfo}
Run Keyword If "${EnableTCPPassthrough}"=="${EMPTY}" or "${EnableTCPPassthrough}"=="null" log there is no EnableTCPPassthrough
... ELSE TCP-Enable-TCP-Passthrough ${EnableTCPPassthrough}
Run Keyword If "${BypassDuplicatedPacket}"=="${EMPTY}" or "${BypassDuplicatedPacket}"=="null" log there is no BypassDuplicatedPacket
... ELSE TCP-Bypass-Duplicated-Packet ${BypassDuplicatedPacket}
TCP-Client-side-Parameters ${TCPClientDict}
TCP-Server-side-Parameters ${TCPServerDict}
TCP-OK
TCP-Assertion ${Edittcpname}
Create-Source-Button
click element xpath=/html/body/div[1]/div/div[3]/div[2]/div/div/div[1]/div[1]/div/div[2]/form/div[2]/div[1]/div/div #点击添加源ip
@@ -60,6 +101,21 @@ Create-Proxy-TCP-Options
input text id=advancedAdd_policyName ${tcpname} #输入name
sleep ${sleep}
Edit-Proxy-TCP-Options
[Arguments] ${tcpname}
sleep ${sleep}
Menu settings Advanced
sleep ${sleep}
click element id=Advanced/advanced #点击Proxy-TCP-Options
sleep ${sleep}
Proxy-TCP-Options-Search ${tcpname} Name #搜索策略
sleep ${sleep}
click element id=proxyTCPEdit #点击Edit按钮
sleep ${sleep}
Edit-Proxy-TCP-Name
[Arguments] ${Edittcpname}
input text id=advancedAdd_policyName ${Edittcpname} #输入name
CreateEditDeleteSources
[Arguments] ${SourceInfoDict}
[Documentation] 策略源条件处理、包括增加create、searchupdate、delete几个列表;
@@ -218,7 +274,7 @@ CreateSource
${return} ${Keywordtext} Run Keyword And Ignore Error Get From Dictionary ${AddDict} Keywordtext
${Keywordtext} Run Keyword If "${return}"=="FAIL" or "${Keywordtext}"=="${EMPTY}" set variable null
... ELSE set variable ${Keywordtext}
run keyword if "${Type1}"=="Ip" run keywords sleep ${sleep}
run keyword if "${Type1}"=="Ip" run keywords sleep ${sleep}
... AND click element xpath=${typepath}/div[2]/div[1]/div[2]/div[1]/div/div/div/div[1]/div/div/div/div[1]
... AND sleep ${sleep}
... AND sleep ${sleep}
@@ -628,7 +684,7 @@ DestinationIPGroupAdd
SourceCreate-name
[Arguments] ${ObjName}
sleep ${sleep}
input text id=objectAdd_name ${ObjName}
input text id=objectAdd_name1 ${ObjName}
SourceCreate-ok
sleep ${sleep}
@@ -666,6 +722,10 @@ Filter-create
... AND click element id=interceptionadd_checkappshow0
... AND Create-Object-Search ${SNIname} ${i}
... AND sleep ${sleep}
${class}= Get Element Attribute xpath=//*[@id="policy_paper_left"]/div[2]/form/div[5]/div[1]/div[1]/label[contains(text(), "${i}")]/following-sibling::div/div class
run keyword if "${class}"=="addobject addobject-long-list float-left" log 不操作
run keyword if "${class}"=="addobject addobject-long-list float-left obj-content-null" run keywords sleep ${sleep}
... AND click element xpath=//*[@id="policy_paper_left"]/div[2]/form/div[5]/div[1]/div[1]/label[contains(text(), "${i}")]/following-sibling::div/div[2]/i
END
Create-Object-Search
[Arguments] ${name} ${filter}
@@ -742,22 +802,37 @@ TCP-Client-side-Parameters
sleep ${sleep}
click element id=tab-first #点击Client-side Parameters
sleep ${sleep}
${class}= Get Element Attribute xpath=${Clientelement}/div/form/div/label[contains(text(), "Override MSS")]/following-sibling::div/div class
#判断是否开启Override MSS按钮${Override-MSS}=open,为开启,否则不添开启
run keyword if "${ClientOverrideMSS}"=="open" run keywords sleep ${sleep}
run keyword if "${class}"=="el-switch" and "${ClientOverrideMSS}"=="open" run keywords sleep ${sleep}
... AND click element xpath=${Clientelement}/div/form/div/label[contains(text(), "Override MSS")]/following-sibling::div/div #点击Override-MSS按钮开启
... AND sleep ${sleep}
... AND input text xpath=${Clientelement}/div/form/div[2]/div/div/input ${ClientMSSvalue} #输入MSS内容
... AND sleep ${sleep}
... ELSE log 不开启
run keyword if "${class}"=="el-switch is-checked" and "${ClientOverrideMSS}"=="open" run keywords sleep ${sleep}
... AND input text xpath=${Clientelement}/div/form/div[2]/div/div/input ${ClientMSSvalue} #输入MSS内容
... AND sleep ${sleep}
... ELSE log 不操作
run keyword if "${class}"=="el-switch is-checked" and "${ClientOverrideMSS}"!="open" run keywords sleep ${sleep}
... AND click element xpath=${Clientelement}/div/form/div/label[contains(text(), "Override MSS")]/following-sibling::div/div #点击Override-MSS按钮关闭
... AND sleep ${sleep}
... ELSE log 不操作
#判断是否开启No Delay按钮${No-Delay}=open,为开启,否则不添开启
run keyword if "${ClientNoDelay}"=="open" run keywords sleep ${sleep}
${class1}= Get Element Attribute xpath=${Clientelement}/div/form/div/label[contains(text(), "No Delay")]/following-sibling::div/div class
run keyword if "${class1}"=="el-switch" and "${ClientNoDelay}"=="open" run keywords sleep ${sleep}
... AND click element xpath=${Clientelement}/div/form/div/label[contains(text(), "No Delay")]/following-sibling::div/div #点击No-Delay按钮开启
... AND sleep ${sleep}
... ELSE log 不开启
run keyword if "${class1}"=="el-switch is-checked" and "${ClientNoDelay}"!="open" run keywords sleep ${sleep}
... AND click element xpath=${Clientelement}/div/form/div/label[contains(text(), "No Delay")]/following-sibling::div/div #点击No-Delay按钮关闭
... AND sleep ${sleep}
... ELSE log 不操作
input text xpath=${Clientelement}/div/form/div/label[contains(text(), "TTL")]/following-sibling::div/div/input ${Clientttlvalue} #输入ttl内容
sleep ${sleep}
#判断是否开启Keepalive按钮${Keepalive}=open,为开启,否则不添开启
run keyword if "${ClientKeepalive}"=="open" run keywords sleep ${sleep}
${class2}= Get Element Attribute xpath=${Clientelement}/div/form/div/label[contains(text(), "Keepalive")]/following-sibling::div/div class
run keyword if "${class2}"=="el-switch" and "${ClientKeepalive}"=="open" run keywords sleep ${sleep}
... AND click element xpath=${Clientelement}/div/form/div/label[contains(text(), "Keepalive")]/following-sibling::div/div #点击Keepalive按钮开启
... AND sleep ${sleep}
... AND input text xpath=${Clientelement}/div/form/div/div/form/div[1]/label[contains(text(), "Probe Number")]/following-sibling::div/div/input ${ClientProbeNumber} #输入Probe Number内容
@@ -767,6 +842,18 @@ TCP-Client-side-Parameters
... AND input text xpath=${Clientelement}/div/form/div/div/form/div[3]/label[contains(text(), "Interval")]/following-sibling::div/div/input ${ClientInterval} #输入Interval内容
... AND sleep ${sleep}
... ELSE log 不开启
run keyword if "${class2}"=="el-switch is-checked" and "${ClientKeepalive}"=="open" run keywords sleep ${sleep}
... AND input text xpath=${Clientelement}/div/form/div/div/form/div[1]/label[contains(text(), "Probe Number")]/following-sibling::div/div/input ${ClientProbeNumber} #输入Probe Number内容
... AND sleep ${sleep}
... AND input text xpath=${Clientelement}/div/form/div/div/form/div[2]/label[contains(text(), "Idle Time")]/following-sibling::div/div/input ${ClientIdleTime} #输入Idle Time内容
... AND sleep ${sleep}
... AND input text xpath=${Clientelement}/div/form/div/div/form/div[3]/label[contains(text(), "Interval")]/following-sibling::div/div/input ${ClientInterval} #输入Interval内容
... AND sleep ${sleep}
... ELSE log 不开启
run keyword if "${class2}"=="el-switch is-checked" and "${ClientKeepalive}"!="open" run keywords sleep ${sleep}
... AND click element xpath=${Clientelement}/div/form/div/label[contains(text(), "Keepalive")]/following-sibling::div/div #点击Keepalive按钮关闭
... AND sleep ${sleep}
... ELSE log 不开启
input text xpath=${Clientelement}/div/form/div/label[contains(text(), "User Timeout")]/following-sibling::div/div/input ${ClientUserTimeout} #输入User Timeout内容
sleep ${sleep}
TCP-Server-side-Parameters
@@ -813,28 +900,56 @@ TCP-Server-side-Parameters
click element id=tab-second #点击Server-side Parameters
sleep ${sleep}
#判断是否开启Override MSS按钮${Override-MSS}=open,为开启,否则不添开启
run keyword if "${ServerOverrideMSS}"=="open" run keywords sleep ${sleep}
... AND click element xpath=${Serverelement}/div/form/div/label[contains(text(), "Override MSS")]/following-sibling::div/div #点击Override-MSS按钮开启
${class}= Get Element Attribute xpath=${Serverelement}/div/form/div/label[contains(text(), "Override MSS")]/following-sibling::div/div class
#判断是否开启Override MSS按钮${Override-MSS}=open,为开启,否则不添开启
run keyword if "${class}"=="el-switch" and "${ServerOverrideMSS}"=="open" run keywords sleep ${sleep}
... AND click element xpath=${Serverelement}/div/form/div/label[contains(text(), "Override MSS")]/following-sibling::div/div #点击Override-MSS按钮开启
... AND sleep ${sleep}
... AND input text xpath=${Serverelement}/div/form/div[2]/div/div/input ${ServerMSSvalue} #输入MSS内容
... AND input text xpath=${Serverelement}/div/form/div[2]/div/div/input ${ServerMSSvalue} #输入MSS内容
... AND sleep ${sleep}
... ELSE log 不开启
run keyword if "${class}"=="el-switch is-checked" and "${ServerOverrideMSS}"=="open" run keywords sleep ${sleep}
... AND input text xpath=${Serverelement}/div/form/div[2]/div/div/input ${ServerMSSvalue} #输入MSS内容
... AND sleep ${sleep}
... ELSE log 不操作
run keyword if "${class}"=="el-switch is-checked" and "${ServerOverrideMSS}"!="open" run keywords sleep ${sleep}
... AND click element xpath=${Serverelement}/div/form/div/label[contains(text(), "Override MSS")]/following-sibling::div/div #点击Override-MSS按钮关闭
... AND sleep ${sleep}
... ELSE log 不操作
#判断是否开启No Delay按钮${No-Delay}=open,为开启,否则不添开启
run keyword if "${ServerNoDelay}"=="open" run keywords sleep ${sleep}
... AND click element xpath=${Serverelement}/div/form/div/label[contains(text(), "No Delay")]/following-sibling::div/div #点击No-Delay按钮开启
${class1}= Get Element Attribute xpath=${Serverelement}/div/form/div/label[contains(text(), "No Delay")]/following-sibling::div/div class
run keyword if "${class1}"=="el-switch" and "${ServerNoDelay}"=="open" run keywords sleep ${sleep}
... AND click element xpath=${Serverelement}/div/form/div/label[contains(text(), "No Delay")]/following-sibling::div/div #点击No-Delay按钮开启
... AND sleep ${sleep}
... ELSE log 不开启
run keyword if "${class1}"=="el-switch is-checked" and "${ServerNoDelay}"!="open" run keywords sleep ${sleep}
... AND click element xpath=${Serverelement}/div/form/div/label[contains(text(), "No Delay")]/following-sibling::div/div #点击No-Delay按钮关闭
... AND sleep ${sleep}
... ELSE log 不操作
input text xpath=${Serverelement}/div/form/div/label[contains(text(), "TTL")]/following-sibling::div/div/input ${Serverttlvalue} #输入ttl内容
sleep ${sleep}
#判断是否开启Keepalive按钮${Keepalive}=open,为开启,否则不添开启
run keyword if "${ServerKeepalive}"=="open" run keywords sleep ${sleep}
${class2}= Get Element Attribute xpath=${Serverelement}/div/form/div/label[contains(text(), "Keepalive")]/following-sibling::div/div class
run keyword if "${class2}"=="el-switch" and "${ServerKeepalive}"=="open" run keywords sleep ${sleep}
... AND click element xpath=${Serverelement}/div/form/div/label[contains(text(), "Keepalive")]/following-sibling::div/div #点击Keepalive按钮开启
... AND sleep ${sleep}
... AND input text xpath=${Serverelement}/div/form/div/div/form/div[1]/label[contains(text(), "Probe Number")]/following-sibling::div/div/input ${ServerProbeNumber} #输入Probe Number内容
... AND sleep ${sleep}
... AND input text xpath=${Serverelement}/div/form/div/div/form/div[2]/label[contains(text(), "Idle Time")]/following-sibling::div/div/input ${ServerIdleTime} #输入Idle Time内容
... AND input text xpath=${Serverelement}/div/form/div/div/form/div[2]/label[contains(text(), "Idle Time")]/following-sibling::div/div/input ${ServerIdleTime} #输入Idle Time内容
... AND sleep ${sleep}
... AND input text xpath=${Serverelement}/div/form/div/div/form/div[3]/label[contains(text(), "Interval")]/following-sibling::div/div/input ${ServerInterval} #输入Interval内容
... AND input text xpath=${Serverelement}/div/form/div/div/form/div[3]/label[contains(text(), "Interval")]/following-sibling::div/div/input ${ServerInterval} #输入Interval内容
... AND sleep ${sleep}
... ELSE log 不开启
run keyword if "${class2}"=="el-switch is-checked" and "${ServerKeepalive}"=="open" run keywords sleep ${sleep}
... AND input text xpath=${Serverelement}/div/form/div/div/form/div[1]/label[contains(text(), "Probe Number")]/following-sibling::div/div/input ${ServerProbeNumber} #输入Probe Number内容
... AND sleep ${sleep}
... AND input text xpath=${Serverelement}/div/form/div/div/form/div[2]/label[contains(text(), "Idle Time")]/following-sibling::div/div/input ${ServerIdleTime} #输入Idle Time内容
... AND sleep ${sleep}
... AND input text xpath=${Serverelement}/div/form/div/div/form/div[3]/label[contains(text(), "Interval")]/following-sibling::div/div/input ${ServerInterval} #输入Interval内容
... AND sleep ${sleep}
... ELSE log 不开启
run keyword if "${class2}"=="el-switch is-checked" and "${ServerKeepalive}"!="open" run keywords sleep ${sleep}
... AND click element xpath=${Serverelement}/div/form/div/label[contains(text(), "Keepalive")]/following-sibling::div/div #点击Keepalive按钮关闭
... AND sleep ${sleep}
... ELSE log 不开启
sleep ${sleep}