From a7a663f2706e31a3e9251de80914b4416bf2e8f4 Mon Sep 17 00:00:00 2001 From: lyf Date: Tue, 2 Feb 2021 18:27:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BF=AE=E6=94=B9=E5=AE=89?= =?UTF-8?q?=E5=85=A8=E7=AD=96=E7=95=A5=E6=96=B0=E5=A2=9E=E5=85=B3=E9=94=AE?= =?UTF-8?q?=E5=AD=97=E5=92=8C=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=90=86=E7=AD=96?= =?UTF-8?q?=E7=95=A5=E6=96=B0=E5=A2=9E=E5=85=B3=E9=94=AE=E5=AD=97=EF=BC=88?= =?UTF-8?q?=E6=9C=AA=E5=AE=8C=E6=88=90=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 01-TestCase/tsg_ui/ui_security/Security.robot | 29 +- .../tsg_ui/proxyPolicy/ProxyPolicy.robot | 952 ++++++++++++++++++ .../securityPolicy/SecurityPolicy.robot | 13 +- 3 files changed, 987 insertions(+), 7 deletions(-) create mode 100644 02-Keyword/tsg_ui/proxyPolicy/ProxyPolicy.robot diff --git a/01-TestCase/tsg_ui/ui_security/Security.robot b/01-TestCase/tsg_ui/ui_security/Security.robot index 6abb8f4..b480c3d 100644 --- a/01-TestCase/tsg_ui/ui_security/Security.robot +++ b/01-TestCase/tsg_ui/ui_security/Security.robot @@ -505,7 +505,7 @@ SecurityPolicy-Deny-FTP-MaxCombination-Drop CreatePage Key single zdhftpContent keywordtext=*pppp #新建Account Comment Account - CreatePage Key single zdhftpAccount keywordtext=*pppp + CreatePage Account single zdhftpAccount keywordtext=0000 #新建策略 Comment 新建策略 Menu policys Security Policy @@ -560,5 +560,30 @@ SecurityPolicy-Deny-FTP-MaxCombination-RST Enabled open Security-Policies-OK - +testq-2 + Menu policys Security Policy + #修改策略,修改策略相当于再进行一遍新增 + Comment 修改策略 + Security-Source Name SecurityPolicy-Deny-HTTP-MaxCombination + EditButton + Initialize-Policie Deny + #新建策略 + SecurityPolicy.Create-name SecurityPolicy-Deny-SSL-MaxCombination-Drop + SecurityPolicy.Create-action deny + SecurityPolicy.Create-Source-Button + SecurityPolicy.Create-Source type1=Ip CreateOrSearch=Create Add=Address name=zdhip001 ipclienttext1=192.168.100.2 post=1 + SecurityPolicy.Create-Destination-Button + SecurityPolicy.Create-Destination type1=Ip CreateOrSearch=Create Add=Address name=zdhip001 ipclienttext1=192.168.100.3 post=1 + ${fqdnname} create list zdhfqdn + ${filter} create list SNI CN SAN + Create-Application-Button + ApplicationSearch SSL + Create-Filter-judge Application=SSL Filter=${filter} SSLSNIname=${fqdnname} CNname=${fqdnname} SANname=${fqdnname} + Deny-subaction action=deny subaction=RST + LogSession 1 + Enabled open + Security-Policies-OK + Security-Source Name SecurityPolicy-Deny-SSL-MaxCombination-Drop + ${text} get text xpath=//*[@id="ly-table1-listcontent"]/div/div[3]/table/tbody/tr/td[2]/div/div/p + Should Be Equal As Strings ${text} SecurityPolicy-Deny-SSL-MaxCombination-Drop diff --git a/02-Keyword/tsg_ui/proxyPolicy/ProxyPolicy.robot b/02-Keyword/tsg_ui/proxyPolicy/ProxyPolicy.robot new file mode 100644 index 0000000..e176f12 --- /dev/null +++ b/02-Keyword/tsg_ui/proxyPolicy/ProxyPolicy.robot @@ -0,0 +1,952 @@ +*** Settings *** +Library Selenium2Library +Resource ../objects/NewObject.robot + +*** Keywords *** +CreateButton + [Documentation] 点击安全策略中的Create按钮 + Wait Until Element Is Enabled id=app_create + sleep 3 + click element id=app_create + +Create-name + [Arguments] ${name} + [Documentation] 输入name + sleep 2 + input text id=manipulation_elInput_policyName ${name} + +Create-action + [Arguments] ${action} + [Documentation] 调用次关键字前需要添加必填参数: + ... ${action}:填入allow或deny或monitor或intercept + ... 判断要创建什么动作的策略 + sleep 1 + run keyword if "${action}"=="allow" run keywords sleep 1 + ... AND click element id=proxyManipulationallow + ... ELSE IF "${action}"=="deny" run keywords sleep 1 + ... AND click element id=proxyManipulationdeny + ... ELSE IF "${action}"=="monitor" run keywords sleep 1 + ... AND click element id=proxyManipulationmonitor + ... ELSE IF "${action}"=="redirect" run keywords sleep 1 + ... AND click element id=proxyManipulationredirect + ... ELSE IF "${action}"=="replace" run keywords sleep 1 + ... AND click element id=proxyManipulationreplace + ... ELSE IF "${action}"=="hijack" run keywords sleep 1 + ... AND click element id=proxyManipulationhijack + ... ELSE IF "${action}"=="insert" run keywords sleep 1 + ... AND click element id=proxyManipulationinsert + +Create-Source-Button + [Documentation] 点击Source的加号 + sleep 2 + click element xpath=/html/body/div[1]/div/div[3]/div[2]/div/div[1]/form/div/div[4]/div[1]/div/div + +Create-Destination-Button + [Documentation] 点击Destination的加号 + Wait Until Element Is Enabled xpath=/html/body/div[1]/div/div[3]/div[2]/div/div[1]/form/div/div[5]/div[1]/div/div 10 + sleep 2 + click element xpath=/html/body/div[1]/div/div[3]/div[2]/div/div[1]/form/div/div[5]/div[1]/div/div + + +ApplicationSearch + [Arguments] ${Application} ${HttpOrDoh} + [Documentation] 调用次关键字前需要添加必填参数: + ... ${Application}:填入是Application的内容,例如SSL或HTTP + ... 选择search对象 + run keyword if "${Application}"=="redirect" run keywords sleep 1 + ... AND click element id=interceptionadd_application + ... AND sleep 1 + ... AND HttpOrDoh ${HttpOrDoh} + ... ELSE log 不操作 +HttpOrDoh + [Arguments] ${HttpOrDoh} + [Documentation] 调用次关键字前需要添加必填参数: + ... ${HttpOrDoh}:填入是Application的内容,例如SSL或HTTP + ... 选择search对象 + run keyword if "${HttpOrDoh}"=="HTTP" run keywords sleep 1 + ... AND click element id=interceptionadd_checkappshow1 + ... AND sleep 1 + ... AND click element xpath=/html/body/div[1]/div/div[3]/div[2]/div/div[7]/div[3]/div/button + ... ELSE IF "${HttpOrDoh}"=="Doh" run keywords sleep 1 + ... AND click element id=interceptionadd_checkappshow0 + ... AND sleep 1 + ... AND click element xpath=/html/body/div[1]/div/div[3]/div[2]/div/div[7]/div[3]/div/button +Create-Filter-judge + [Arguments] ${Application}=null ${Filter}=null ${Hostname}=null ${URLname}=null ${Request Headername}=null ${Response Headername}=null ${Request Contentname}=null + ... ${Response Contentname}=null ${SSLSNIname}=null ${CNname}=null ${SANname}=null ${QNAMEname}=null ${Subjectname}=null ${MAILContentname}=null ${Attachment Namename}=null + ... ${Attachment Contentname}=null ${Fromname}=null ${Toname}=null ${MAILAccountname}=null ${URIname}=null ${FTPContentname}=null ${FTPAccountname}=null ${QUICSNIname}=null + [Documentation] 调用次关键字前需要添加必填参数: + ... ${Application}:填入是Application的内容,例如SSL或HTTP + ... ${Filter}:是一个列表,列表中填入filter类型,例如Host或URL等 + ... name:各个对象名称的列表 + ... 判断filter是否可以点击 + ${class}= Get Element Attribute xpath=/html/body/div[1]/div/div[3]/div[2]/div/div[1]/form/div/div[8]/div[1]/div/div[1] class + run keyword if "${class}"=="addobject addobject-long-list obj-content-null filter-width-style cursor addobject-long-list-disabled" log filter不可点击,不可添加filter + run keyword if "${class}"=="addobject addobject-long-list obj-content-null filter-width-style cursor" run keywords sleep 1 + ... AND Create-Filter ${Application} ${Filter} ${Hostname} ${URLname} ${Request Headername} ${Response Headername} ${Request Contentname} + ... ${Response Contentname} ${SSLSNIname} ${CNname} ${SANname} ${QNAMEname} ${Subjectname} ${MAILContentname} ${Attachment Namename} + ... ${Attachment Contentname} ${Fromname} ${Toname} ${MAILAccountname} ${URIname} ${FTPContentname} ${FTPAccountname} ${QUICSNIname} + +Create-Filter + [Arguments] ${Application} ${Filter} ${Hostname} ${URLname} ${Request Headername} ${Response Headername} ${Request Contentname} + ... ${Response Contentname} ${SSLSNIname} ${CNname} ${SANname} ${QNAMEname} ${Subjectname} ${MAILContentname} ${Attachment Namename} + ... ${Attachment Contentname} ${Fromname} ${Toname} ${MAILAccountname} ${URIname} ${FTPContentname} ${FTPAccountname} ${QUICSNIname} + [Documentation] 调用次关键字前需要添加必填参数: + ... ${Application}:填入是Application的内容,例如SSL或HTTP + ... ${Filter}:是一个列表,列表中填入filter类型,例如Host或URL等 + ... name:各个对象名称的列表 + ... 判断添加filter类型 + sleep 2 + FOR ${i} IN @{Filter} + sleep 1 + click element id=interceptionadd_add_filter + sleep 1 + run keyword if "${Application}"=="HTTP" and "${i}"=="Host" run keywords sleep 1 + ... AND click element xpath=//*[@id="condistions_protocol"]/div/div[1]/div/div/div/ul/li[1] + ... AND Create-Object-Search ${Hostname} ${i} + run keyword if "${Application}"=="HTTP" and "${i}"=="URL" run keywords sleep 1 + ... AND click element xpath=//*[@id="condistions_protocol"]/div/div[1]/div/div/div/ul/li[2] + ... AND Create-Object-Search ${URLname} ${i} + run keyword if "${Application}"=="HTTP" and "${i}"=="Request Header" run keywords sleep 1 + ... AND click element xpath=//*[@id="condistions_protocol"]/div/div[1]/div/div/div/ul/li[3] + ... AND Create-Object-Search ${Request Headername} ${i} + run keyword if "${Application}"=="HTTP" and "${i}"=="Response Header" run keywords sleep 1 + ... AND click element xpath=//*[@id="condistions_protocol"]/div/div[1]/div/div/div/ul/li[4] + ... AND Create-Object-Search ${Response Headername} ${i} + run keyword if "${Application}"=="HTTP" and "${i}"=="Request Content" run keywords sleep 1 + ... AND click element xpath=//*[@id="condistions_protocol"]/div/div[1]/div/div/div/ul/li[5] + ... AND Create-Object-Search ${Request Contentname} ${i} + run keyword if "${Application}"=="HTTP" and "${i}"=="Response Content" run keywords sleep 1 + ... AND click element xpath=//*[@id="condistions_protocol"]/div/div[1]/div/div/div/ul/li[6] + ... AND Create-Object-Search ${Response Contentname} ${i} + run keyword if "${Application}"=="Doh" and "${i}"=="Host" run keywords sleep 1 + ... AND click element xpath=//*[@id="condistions_protocol"]/div/div[1]/div/div/div/ul/li[1] + ... AND Create-Object-Search ${DohHostname} ${i} + run keyword if "${Application}"=="Doh" and "${i}"=="QNAME" run keywords sleep 1 + ... AND click element xpath=//*[@id="condistions_protocol"]/div/div[1]/div/div/div/ul/li[2] + ... AND Create-Object-Search ${QNAMEname} ${i} + END +Deny-subaction + [Arguments] ${action}=null ${subaction}=null ${code}=null ${Content}=null ${block-text}=null ${SearchorCreate}=null + ... ${ProfileName}=null ${file}=null ${QType}=null ${Avalue}=null ${Attl}=null ${CNAMEvalue}=null ${CNAMEttl}=null + [Documentation] 调用次关键字前需要添加必填参数: + ... ${code}:填入403或404 + ... ${Content}:填入TEXT或Profile + ... ${SearchorCreate}:填入Search或Create + ... ${block-text}:填入TEXT文本框内容 + ... ${ProfileName}:Profile的名字 + ... ${file}:上传文件路径 + ... ${QType}:填入A或AAAA + ... ${Avalue}:根据${QType}填入IPV4或IPV6的值 + ... ${Attl}:根据${QType}填入A的ttl值或AAAA的ttl值 + ... ${CNAMEvalue}:根据${QType}填入A的CNAME的域名值或AAAA的CNAME域名值 + ... ${CNAMEttl}:根据${QType}填入A的CNAME的ttl值或AAAA的CNAME的ttl值 + ... 添加subaction + run keyword if "${action}"=="deny" and "${denycode}"=="403" run keywords sleep 1 + ... AND click element id=manipulation_select_addAction + ... AND sleep 1 + ... AND click element xpath=/html/body/div[10]/div[1]/div[1]/ul/li[1] + ... AND sleep 1 + run keyword if "${action}"=="deny" and "${subaction}"=="404" run keywords sleep 1 + ... AND click element id=manipulation_select_addAction + ... AND sleep 1 + ... AND click element xpath=/html/body/div[10]/div[1]/div[1]/ul/li[2] + ... AND sleep 1 + run keyword if "${action}"=="deny" and "${subaction}"=="451" run keywords sleep 1 + ... AND click element id=manipulation_select_addAction + ... AND sleep 1 + ... AND click element xpath=/html/body/div[10]/div[1]/div[1]/ul/li[2] + ... AND sleep 1 + ... AND +Deny-content + [Arguments] ${contenttype} ${SearchorCreate} ${ProfileName} ${file} + [Documentation] 调用次关键字前需要添加必填参数: + ... ${code}:填入403或404 + ... ${Content}:填入TEXT或Profile + ... ${SearchorCreate}:填入Search或Create + ... ${block-text}:填入TEXT文本框内容 + ... ${ProfileName}:Profile的名字 + ... ${file}:上传文件路径 + ... 添加block数据内容 + sleep 1 + click element id=denyUserRegionBlock_code + run keyword if "${contenttype}"=="File" run keywords sleep 1 + ... AND click element id=manipulation_select_blockInfo + ... AND sleep 1 + ... AND click element id=ResponseContentFile + ... AND sleep 1 + ... AND click element id=manipulation_select_htmlProfile + ... AND sleep 1 + ... AND Profile-SearchorCreate ${SearchorCreate} ${ProfileName} ${file} +Profile-SearchorCreate + [Arguments] ${SearchorCreate} ${ProfileName} ${file} + [Documentation] 调用次关键字前需要添加必填参数: + ... ${SearchorCreate}:填入Search或Create + ... ${ProfileName}:Profile的名字 + ... ${file}:上传文件路径 + ... 判断是新建还是搜索profile + sleep 1 + click element id=html_profile + sleep 1 + run keyword if "${SearchorCreate}"=="Search" run keywords sleep 1 + ... AND input text xapth=/html/body/div/div[1]/div[1]/ul/div[1]/div/input ${ProfileName} + ... AND sleep 1 + ... AND press keys xapth=/html/body/div/div[1]/div[1]/ul/div[1]/div/input ENTER + ... AND sleep 1 + ... AND click element xpath=/html/body/div/div[1]/div[1]/ul/div[2]/div/li[1] + ... AND sleep 1 + ... ELSE IF "${SearchorCreate}"=="Create" run keywords sleep 1 + ... AND click element xpath=/html/body/div/div[1]/div[1]/ul/div[1]/div/div/button + ... AND sleep 1 + ... AND input text id=responsepages_profileName ${ProfileName} + ... AND sleep 1 + ... AND Choose File xpath=//*[@id="policy_Manipulation_create6"]/div[2]/form/div[2]/div/div/div/input ${file} #上传文件 + ... AND sleep 1 + ... AND clcik element id=responseAddOk1 + ... AND sleep 1 + ... ELSE log 传入参数错误 +Deny-Redirect + [Arguments] ${QType} ${Avalue} ${Attl} ${CNAMEvalue} ${CNAMEttl} + [Documentation] 调用次关键字前需要添加必填参数: + ... ${QType}:填入A或AAAA + ... ${Avalue}:根据${QType}填入IPV4或IPV6的值 + ... ${Attl}:根据${QType}填入A的ttl值或AAAA的ttl值 + ... ${CNAMEvalue}:根据${QType}填入A的CNAME的域名值或AAAA的CNAME域名值 + ... ${CNAMEttl}:根据${QType}填入A的CNAME的ttl值或AAAA的CNAME的ttl值 + ... 新建Redirect + sleep 1 + click element id=interceptionadd_add_filter + sleep 1 + run keyword if "${QType}"=="A" run keywords sleep 1 + ... AND input text id=A00 ${Avalue} + ... AND sleep 1 + ... AND input text id=ttl00 ${Attl} + ... AND sleep 1 + ... AND click element id=interceptionadd_addForm + ... AND sleep 1 + ... AND input text id=Cname01 ${CNAMEvalue} + ... AND sleep 1 + ... AND input text id=ttl01 ${CNAMEttl} + run keyword if "${QType}"=="AAAA" run keywords sleep 1 + ... AND click element id=dns_qtype_radio01 + ... AND input text id=AAAA00 ${Avalue} + ... AND sleep 1 + ... AND input text id=ttl00 ${Attl} + ... AND sleep 1 + ... AND click element id=interceptionadd_addForm + ... AND sleep 1 + ... AND input text id=Cname01 ${CNAMEvalue} + ... AND sleep 1 + ... AND input text id=ttl01 ${CNAMEttl} + sleep 1 + click element id=interceptionadd_shezhidns + +Replace-Action-Parameters + sleep 1 + run keyword if "${ParametersNumber}"=="Search" run keywords sleep 1 + ... AND input text xapth=/html/body/div/div[1]/div[1]/ul/div[1]/div/input ${ProfileName} + ... AND sleep 1 + ... AND press keys xapth=/html/body/div/div[1]/div[1]/ul/div[1]/div/input ENTER + ... AND sleep 1 + ... AND click element xpath=/html/body/div/div[1]/div[1]/ul/div[2]/div/li[1] + ... AND sleep 1 + ... ELSE IF "${SearchorCreate}"=="Create" run keywords sleep 1 + ... AND click element xpath=/html/body/div/div[1]/div[1]/ul/div[1]/div/div/button + ... AND sleep 1 + +Intercept-SSL-Keyring-SearchorCreate + [Arguments] ${KeySearchorCreate} ${keyname} ${file}=null ${file1}=null ${ExpiryHours1or2}=null ${type}=null ${type1}=null + ... ${shift}=close ${PrivateKeyType}=PrivateKeyFile + [Documentation] 引用次关键字,填入必填参数 + ... 必填参数: + ... ${KeySearchorCreate}:填入Create或Search + ... ${name}:新建页面name输入框里的内容 + ... ${file}:上传文件所在本地的路径 + ... ${file1}:上传文件所在本地的路径 + ... ${ExpiryHours1or2}:根证书时间填入1:自定义定义 2:原时间 + ... ${type}:上传证书类型的元素 + ... ${type1}:上传证书加密解密算法的元素 + ... ${shift}:是否打开客户端包含证书按钮 + ... ${PrivateKeyType}:私钥类型 + sleep 1 + click element id=interceptionadd_eventkeying1 + sleep 1 + run keyword if "${KeySearchorCreate}"=="Create" run keywords sleep 1 + ... AND click element id=interceptionadd_keyadd + ... AND sleep 2 + ... AND Create-Keyring ${keyname} ${file} ${file1} ${ExpiryHours1or2} ${type} ${type1} + ... ${shift}=close ${PrivateKeyType}=PrivateKeyFile + run keyword if "${KeySearchorCreate}"=="Search" run keywords sleep 1 + ... AND input text id=card_keyringName1 ${keyname} + ... AND sleep 1 + ... AND press keys id=card_keyringName1 ENTER + ... AND sleep 1 + ... AND clcik element id=card_keylist0 + +Create-Keyring + [Arguments] ${name} ${file} ${file1} ${ExpiryHours1or2} ${type} ${type1} + ... ${shift}=close ${PrivateKeyType}=PrivateKeyFile + [Documentation] 引用次关键字,填入必填参数 + ... 必填参数: + ... ${name}:新建页面name输入框里的内容 + ... ${file}:上传文件所在本地的路径 + ... ${file1}:上传文件所在本地的路径 + ... ${ExpiryHours1or2}:根证书时间填入1:自定义定义 2:原时间 + ... ${type}:上传证书类型的元素 + ... ${type1}:上传证书加密解密算法的元素 + ... ${shift}:是否打开客户端包含证书按钮 + ... ${PrivateKeyType}:私钥类型 + Sleep 2 + input id=keyringsadd_name ${name} #输入name + Sleep 2 + Choose File xpath=//*[@id="app"]/div/div[3]/div[2]/div/div/div[2]/div[2]/form/div[2]/div/div/div/input ${file} #上传文件 + Sleep 2 + Choose File xpath=//*[@id="app"]/div/div[3]/div[2]/div/div/div[2]/div[2]/form/div[3]/div/div[2]/div/div/input ${file1} #上传文件 + ${select} Set Variable ${ExpiryHours1or2} + Run Keyword If '${select}'=='1' click element id=keyringsadd_customized + Run Keyword If '${select}'=='1' input text id=reissueExpiryDate 10 + sleep 1 + click element xpath=//*[@id="app"]/div/div[3]/div[2]/div/div/div[2]/div[2]/form/div[6]/div/div/div[1]/span/span/i #点击下拉框 + sleep 1 + click element ${type} #选择证书类型 + sleep 1 + click element xpath=//*[@id="app"]/div/div[3]/div[2]/div/div/div[2]/div[2]/form/div[7]/div/div/div[1]/span/span/i #点击下拉框 + sleep 1 + click element ${type1} #选择加密解密类型 + sleep 1 + ${root} Set Variable ${shift} + run keyword if "${root}"=="open" run keywords sleep 1 + ... AND click element xpath=//*[@id="app"]/div/div[3]/div[2]/div/div/div[2]/div[2]/form/div[9]/div/div/span + ... ELSE IF "${root}"=="close" log "go on" + Run Keyword If '${PrivateKeyType}'=='HSM' run keywords sleep 1 + ... AND click element id=privateHSM + ... AND sleep 1 + ... AND input text id=keyringsadd_slotid 10 + sleep 1 + click id=keyringsadd_sub #点击OK缇交 +Intercept-SSL-MirrorDecryptedTraffic-Open + [Arguments] ${MirrorDecryptedTraffic}=null ${MirrorDecryptedTrafficSearchorCreate}=null ${MirrorDecryptedTrafficname}=null ${type}=null ${shuru}=null + [Documentation] 引用次关键字,填入必填参数 + ... 必填参数: + ... ${MirrorDecryptedTraffic}:输入open代表开启按钮,其他代表不开启 + ... ${MirrorDecryptedTrafficSearchorCreate}:填入Create或Search + ... ${MirrorDecryptedTrafficname}:解密流量文件的name + ... ${type}:是mac还是vlan的定位元素 + ... ${shuru}:输入mac或vlan的值 + sleep 1 + run keyword if "${MirrorDecryptedTraffic}"=="open" run keywords sleep 1 + ... AND click element xpath=///*[@id="policy_paper_left"]/div[10]/div[2]/label[contains(text(), "Mirror Decrypted Traffic")]/following-sibling::div/div + ... AND sleep 1 + ... AND clcik element id=mirror_profile + ... AND MirrorDecryptedTraffic-SearchorCreate ${MirrorDecryptedTrafficSearchorCreate} ${MirrorDecryptedTrafficname} ${type} ${shuru} + ... ELSE log 不开启 +MirrorDecryptedTraffic-SearchorCreate + [Arguments] ${MirrorDecryptedTrafficSearchorCreate} ${MirrorDecryptedTrafficname} ${type} ${shuru} + [Documentation] 引用次关键字,填入必填参数 + ... 必填参数: + ... ${MirrorDecryptedTrafficSearchorCreate}:填入Create或Search + ... ${MirrorDecryptedTrafficname}:解密流量文件的name + ... ${type}:是mac还是vlan的定位元素 + ... ${shuru}:输入mac或vlan的值 + sleep 1 + run keyword if "${MirrorDecryptedTrafficSearchorCreate}"=="Create" run keywords sleep 1 + ... AND click element id=interceptionadd_trarightadd + ... AND sleep 2 + ... AND Create-MirrorDecryptedTraffic ${MirrorDecryptedTrafficname} ${type} ${shuru} + run keyword if "${MirrorDecryptedTrafficSearchorCreate}"=="Search" run keywords sleep 1 + ... AND input text id=tradata_profileName ${MirrorDecryptedTrafficname} + ... AND sleep 1 + ... AND press keys id=tradata_profileName ENTER + ... AND sleep 1 + ... AND clcik element id=tralist_length0 +Create-MirrorDecryptedTraffic + [Arguments] ${MirrorDecryptedTrafficname} ${type} ${shuru} + [Documentation] 引用次关键字,填入必填参数 + ... 必填参数: + ... ${MirrorDecryptedTrafficname}:解密流量文件的name + ... ${type}:是mac还是vlan的定位元素 + ... ${shuru}:输入mac或vlan的值 + Sleep 2 + input id=trafficmirror_profileName ${MirrorDecryptedTrafficname} #输入name + Sleep 2 + click id=addrTypeChoose #点击下拉框 + Sleep 2 + click ${type} #选择vlan或者mac + Sleep 1 + input id=trafficmirror_addrArray0 ${shuru} + sleep 2 + click xpath=//*[@id="app"]/div/div[3]/div[2]/div/div/div[2]/button[1] #点击OK +DecryptionProfile-SearchorCreate + [Arguments] ${DecryptionProfileSearchorCreate}=null ${DecryptionProfilename}=null ${dict1}=null ${fail1}=null ${min1}=null ${max1}=null + [Documentation] 引用次关键字,填入必填参数 + ... 必填参数: + ... ${DecryptionProfileSearchorCreate}:填入Create或Search + ... ${DecryptionProfilename}:文件name + ... ${dict1}:是个字典,等于1为开启,等于0为关闭,例如:Common Name=1 Issuer=1 Self-signed=1 Expiry Date=1 EV Certificat=1 + ... Certificate Transparency=1 Mutual Authentication=1 On Protocol Errors=1 Certificate Pinning=1 Certificate Not Installed=1 Mirror Client Versions=1 + ... Allow HTTP/2=1 + ... ${fail1} :输入Fail-close或Pass-through + ... ${min1}:输入协议版本, + ... ${max1}:输入协议版本, + sleep 1 + click element id=interceptionadd_eventkeying + sleep 1 + run keyword if "${DecryptionProfileSearchorCreate}"=="Create" run keywords sleep 1 + ... AND click element id=interceptionadd_decryptionProfileId + ... AND sleep 2 + ... AND Create-DecryptionProfile ${DecryptionProfilename} ${dict1} ${fail1} ${min1} ${max1} + run keyword if "${DecryptionProfileSearchorCreate}"=="Search" run keywords sleep 1 + ... AND input text id=card_keyringName ${DecryptionProfilename} + ... AND sleep 1 + ... AND press keys id=card_keyringName ENTER + ... AND sleep 1 + ... AND clcik element xpath=//*[@id="decryptionProfileList"]/following-sibling::li[2] +Create-DecryptionProfile + [Arguments] ${name} ${dict1} ${fail1} ${min1} ${max1} + Sleep 1 + input id=insert_profileName ${name} + Sleep 1 + DecryptionProfileButtonSwitch ${dict1} //*[@id="policy_Manipulation_create8"]/div[2]/form/div/div/label[contains(text(), " ")]/following-sibling::div/div el-switch is-checked el-switch + ${fail} Set Variable ${fail1} + run keyword if "${fail}"=="Fail-close" Run Keywords sleep 1 + ... AND click xpath=//*[@id="policy_Manipulation_create8"]/div[2]/form/div[3]/div[5]/div/div/label[1]/span + ... ELSE IF "${fail}"=="Pass-through" Run Keywords sleep 1 + ... AND click xpath=//*[@id="policy_Manipulation_create8"]/div[2]/form/div[3]/div[5]/div/div/label[2]/span + ... ELSE log 1111 + ${min} Set Variable ${min1} + ${max} Set Variable ${max1} + run keyword if "${min}"=="TLSv1.0" Run Keywords sleep 1 + ... AND click xpath=//*[@id="policy_Manipulation_create8"]/div[2]/form/div[7]/div[2]/div/div/div/span/span/i + ... AND sleep 1 + ... AND click id=pro_min1 + ... ELSE IF "${min}"=="TLSv1.1" Run Keywords sleep 1 + ... AND click xpath=//*[@id="policy_Manipulation_create8"]/div[2]/form/div[7]/div[2]/div/div/div/span/span/i + ... AND sleep 1 + ... AND click id=pro_min2 + ... ELSE IF "${min}"=="TLSv1.2" Run Keywords sleep 1 + ... AND click xpath=//*[@id="policy_Manipulation_create8"]/div[2]/form/div[7]/div[2]/div/div/div/span/span/i + ... AND sleep 1 + ... AND click id=pro_min3 + ... ELSE IF "${min}"=="TLSv1.3" Run Keywords sleep 1 + ... AND click xpath=//*[@id="policy_Manipulation_create8"]/div[2]/form/div[7]/div[2]/div/div/div/span/span/i + ... AND sleep 1 + ... AND click id=pro_min4 + ... ELSE IF "${min}"=="SSLv3.0" Run Keywords sleep 1 + ... AND click xpath=//*[@id="policy_Manipulation_create8"]/div[2]/form/div[7]/div[2]/div/div/div/span/span/i + ... AND sleep 1 + ... AND click id=pro_min0 + ... ELSE log 错误 + run keyword if "${max}"=="TLSv1.0" Run Keywords sleep 1 + ... AND click xpath=//*[@id="policy_Manipulation_create8"]/div[2]/form/div[7]/div[3]/div/div/div/span/span/i + ... AND sleep 1 + ... AND click id=pro_max1 + ... ELSE IF "${max}"=="TLSv1.1" Run Keywords sleep 1 + ... AND click xpath=//*[@id="policy_Manipulation_create8"]/div[2]/form/div[7]/div[3]/div/div/div/span/span/i + ... AND sleep 1 + ... AND click id=pro_max2 + ... ELSE IF "${max}"=="TLSv1.2" Run Keywords sleep 1 + ... AND click xpath=//*[@id="policy_Manipulation_create8"]/div[2]/form/div[7]/div[3]/div/div/div/span/span/i + ... AND sleep 1 + ... AND click id=pro_max3 + ... ELSE IF "${max}"=="TLSv1.3" Run Keywords sleep 1 + ... AND click xpath=//*[@id="policy_Manipulation_create8"]/div[2]/form/div[7]/div[3]/div/div/div/span/span/i + ... AND sleep 1 + ... AND click id=pro_max4 + ... ELSE IF "${max}"=="SSLv3.0" Run Keywords sleep 1 + ... AND click xpath=//*[@id="policy_Manipulation_create8"]/div[2]/form/div[7]/div[3]/div/div/div/span/span/i + ... AND sleep 1 + ... AND click id=pro_max0 + ... ELSE log 错误 + sleep 2 + click id=decryption-ok + sleep 2 + Settings-Search ${name} ${search} #搜索框的关键字 + sleep 2 + ${name1} get text xpath=//*[@id="app"]/div/div[3]/div[2]/div/div[3]/div/div/div[2]/div/div[3]/table/tbody/tr/td[2]/div/div/span + Should Be Equal As Strings ${name1} ${name} + + +DecryptionProfileButtonSwitch + [Arguments] ${dict1} ${xpath1} ${xpath2} ${open} ${close} + ${dict} Set Variable ${dict1} + FOR ${list} ${key} IN ENUMERATE @{dict} + ${class}= Get Element Attribute xpath=${xpath1}${key}${xpath2} class + run keyword if "${class}"=="${open}" and "${dict}[${key}]"=="1" log 默认开启,不进行操作 + run keyword if "${class}"=="${open}" and "${dict}[${key}]"=="0" Run Keywords log 默认开启,但需求需要关闭,进行点击关闭按钮 + ... AND sleep 1 + ... AND click xpath=${xpath1}${key}${xpath2}/span + run keyword if "${class}"=="${close}" and "${dict}[${key}]"=="1" Run Keywords log 默认关闭,但需求需要开启,进行点击开启按钮 + ... AND sleep 1 + ... AND click xpath=${xpath1}${key}${xpath2}/span + run keyword if "${class}"=="${close}" and "${dict}[${key}]"=="0" log 默认关闭,不进行操作 + END +LogSession + [Arguments] ${LogSession} + [Documentation] 调用次关键字前需要添加必填参数: + ... ${LogSession}:填入clcos或其他 + run keyword if "${LogSession}"=="close" run keywords sleep 1 + ... AND click element id=addlabel_labels_log + ... ELSE log 开启日志 +Enabled + [Arguments] ${Enabled} + [Documentation] 调用次关键字前需要添加必填参数: + ... ${Enabled}:填入open或其他 + run keyword if "${Enabled}"=="open" run keywords sleep 1 + ... AND click element xpath=//*[@id="policy_paper_left"]/div/label[contains(text(), "Enabled")]/following-sibling::div/div + ... AND sleep 2 + ... AND click element xpath=/html/body/div/div/div[3]/button[2] + ... ELSE log 开启日志 + +Security-Policies-OK + sleep 1 + click element id=interceptionadd_sub +Create-Object-Search + [Arguments] ${name} ${filter} + [Documentation] 调用次关键字前需要添加必填参数: + ... ${name}:填入是一个列表,列表内容为object的name + ... 选择search对象 + sleep 1 + click element xpath=//*[@id="policy_paper_left"]/div[8]/div/div[1]/label[contains(text(), "${filter}")]/following-sibling::div/div + sleep 1 + FOR ${i} IN @{name} + input text xpath=//*[@id="condistions_protocol"]/div[2]/p[contains(text(), "${filter}")]/following-sibling::div[2]/div/div[1]/input ${i} + sleep 1 + press keys xpath=//*[@id="condistions_protocol"]/div[2]/p[contains(text(), "${filter}")]/following-sibling::div[2]/div/div[1]/input ENTER + sleep 1 + click element xpath=//*[@id="condistions_protocol"]/div[2]/p[contains(text(), "${filter}")]/following-sibling::div[2]/div/div[2]/div/div/ul/li[1] + sleep 1 + END + +Create-Source + [Arguments] ${type1}=null ${CreateOrSearch}=null ${Add}=null ${name}=null + ... ${object_name}=null ${ipclienttext1}=null ${post}=null ${Country}=null ${City}=null + ... ${Protocols1}=null ${Degree}=null ${times}=null ${numbers}=null ${limits}=null ${keywordtext}=null + [Documentation] 调用次关键字前需要添加必填参数: + ... ${type1}:填入Ip或SUBID或Geography或IPLearning + ... ${CreateOrSearch}:填入Create或者Search + ... ${Add}:填入Address或Group + ... ${name}:名称 + ... ${ip_type}:填入Ip或者Geography或者IPLearning + ... ${ipclienttext1}:填入IPV4或6的值或range的ip段 + ... ${post}:填入端口 + ... ${Country}:列表形式,列表中是国家名字 + ... ${City}:列表形式,列表中是城市名字 + ... ${Protocols1}:填入HTTP或SSL或HTTPSSL + ... ${Degree}:填入1Degree或2Degree + ... ${times}:填入小时数,例如1或2 + ... ${numbers}:填入数值,例如1或10000 + ... ${limits}:填入数值,例如1或10000 + ... ${object_name}:列表形式,列表中是对象的名字 + ... ${keywordtext}:填入新建subid的内容 + ... 判断新建source选择用什么样的类型数据 + run keyword if "${type1}"=="Ip" run keywords sleep 2 + ... AND click element xpath=/html/body/div[1]/div/div[3]/div[2]/div/div[1]/form/div/div[4]/div[2]/div[1]/div[2]/div[1]/div/div/div/div[1]/div/div/div/div[1] + ... AND sleep 1 + ... AND sleep 1 + ... AND SourceIPCreateOrSearch ${CreateOrSearch} ${Add} ${type1} ${name} ${object_name} ${ipclienttext1} ${post} ${Country} ${City} ${Protocols1} ${Degree} ${times} ${numbers} ${limits} + ... ELSE IF "${type1}"=="SUBID" run keywords sleep 2 + ... AND click element xpath=/html/body/div[1]/div/div[3]/div[2]/div/div[1]/form/div/div[4]/div[2]/div[1]/div[2]/div[1]/div/div/div/div[1]/div/div/div/div[2] + ... AND sleep 1 + ... AND SUBIDCreateOrSearch ${name} ${keywordtext} ${object_name} + ... ELSE IF "${type1}"=="Geography" run keywords sleep 2 + ... AND click element xpath=/html/body/div[1]/div/div[3]/div[2]/div/div[1]/form/div/div[4]/div[2]/div[1]/div[2]/div[1]/div/div/div/div[1]/div/div/div/div[3] + ... AND sleep 1 + ... AND SourceIPCreateOrSearch ${CreateOrSearch} ${Add} ${type1} ${name} ${object_name} ${ipclienttext1} ${post} ${Country} ${City} ${Protocols1} ${Degree} ${times} ${numbers} ${limits} + ... ELSE IF "${type1}"=="IPLearning" run keywords sleep 2 + ... AND click element xpath=/html/body/div[1]/div/div[3]/div[2]/div/div[1]/form/div/div[4]/div[2]/div[1]/div[2]/div[1]/div/div/div/div[1]/div/div/div/div[4] + ... AND sleep 1 + ... AND SourceIPCreateOrSearch ${CreateOrSearch} ${Add} ${type1} ${name} ${object_name} ${ipclienttext1} ${post} ${Country} ${City} ${Protocols1} ${Degree} ${times} ${numbers} ${limits} + +Create-Destination + [Arguments] ${type1}=null ${CreateOrSearch}=null ${Add}=null ${name}=null + ... ${object_name}=null ${ipclienttext1}=null ${post}=null ${Country}=null ${City}=null + ... ${Protocols1}=null ${Degree}=null ${times}=null ${numbers}=null ${limits}=null ${keywordtext}=null + [Documentation] 调用次关键字前需要添加必填参数: + ... ${type1}:填入Ip或SUBID或Geography或IPLearning + ... ${CreateOrSearch}:填入Create或者Search + ... ${Add}:填入Address或Group + ... ${name}:名称 + ... ${ip_type}:填入Ip或者Geography或者IPLearning + ... ${ipclienttext1}:填入IPV4或6的值或range的ip段 + ... ${post}:填入端口 + ... ${Country}:列表形式,列表中是国家名字 + ... ${City}:列表形式,列表中是城市名字 + ... ${Protocols1}:填入HTTP或SSL或HTTPSSL + ... ${Degree}:填入1Degree或2Degree + ... ${times}:填入小时数,例如1或2 + ... ${numbers}:填入数值,例如1或10000 + ... ${limits}:填入数值,例如1或10000 + ... ${object_name}:列表形式,列表中是对象的名字 + ... ${keywordtext}:填入新建subid的内容 + ... 判断新建source选择用什么样的类型数据 + run keyword if "${type1}"=="Ip" run keywords sleep 1 + ... AND click element xpath=/html/body/div[1]/div/div[3]/div[2]/div/div[1]/form/div/div[5]/div[2]/div[1]/div[2]/div[1]/div/div/div/div[1]/div/div/div/div[1] + ... AND sleep 1 + ... AND sleep 1 + ... AND DestinationIPCreateOrSearch ${CreateOrSearch} ${Add} ${type1} ${name} ${object_name} ${ipclienttext1} ${post} ${Country} ${City} ${Protocols1} ${Degree} ${times} ${numbers} ${limits} + ... ELSE IF "${type1}"=="Geography" run keywords sleep 1 + ... AND click element xpath=/html/body/div[1]/div/div[3]/div[2]/div/div[1]/form/div/div[5]/div[2]/div[1]/div[2]/div[1]/div/div/div/div[1]/div/div/div/div[3] + ... AND sleep 1 + ... AND DestinationIPCreateOrSearch ${CreateOrSearch} ${Add} ${type1} ${name} ${object_name} ${ipclienttext1} ${post} ${Country} ${City} ${Protocols1} ${Degree} ${times} ${numbers} ${limits} + ... ELSE IF "${type1}"=="IPLearning" run keywords sleep 1 + ... AND click element xpath=/html/body/div[1]/div/div[3]/div[2]/div/div[1]/form/div/div[5]/div[2]/div[1]/div[2]/div[1]/div/div/div/div[1]/div/div/div/div[4] + ... AND sleep 1 + ... AND DestinationCreateOrSearch ${CreateOrSearch} ${Add} ${type1} ${name} ${object_name} ${ipclienttext1} ${post} ${Country} ${City} ${Protocols1} ${Degree} ${times} ${numbers} ${limits} + + +SourceIPCreateOrSearch + [Arguments] ${CreateOrSearch} ${Add} ${ip_type} ${name} ${object_name} ${ipclienttext1} + ... ${post} ${Country} ${City} ${Protocols1} ${Degree} ${times} ${numbers} ${limits} + [Documentation] 调用次关键字前需要添加必填参数: + ... ${CreateOrSearch}:填入Create或者Search + ... ${Add}:填入Address或Group + ... ${name}:名称 + ... ${ip_type}:填入Ip或者Geography或者IPLearning + ... ${ipclienttext1}:填入IPV4或6的值或range的ip段 + ... ${post}:填入端口 + ... ${Country}:列表形式,列表中是国家名字 + ... ${City}:列表形式,列表中是城市名字 + ... ${Protocols1}:填入HTTP或SSL或HTTPSSL + ... ${Degree}:填入1Degree或2Degree + ... ${times}:填入小时数,例如1或2 + ... ${numbers}:填入数值,例如1或10000 + ... ${limits}:填入数值,例如1或10000 + ... ${object_name}:列表形式,列表中是对象的名字 + ... 判断是新建ip还是搜索添加ip + run keyword if "${CreateOrSearch}"=="Create" run keywords sleep 1 + ... AND click element id=interceptionadd_proaddaddSource + ... AND SourceIPAdd ${Add} ${ip_type} ${name} ${object_name} ${ipclienttext1} ${post} ${Country} ${City} ${Protocols1} ${Degree} ${times} ${numbers} ${limits} + ... ELSE IF "${CreateOrSearch}"=="Search" run keywords sleep 1 + ... AND SourceSearchSearch ${object_name} +SUBIDCreateOrSearch + [Arguments] ${name} ${keywordtext} ${object_name} + [Documentation] 调用次关键字前需要添加必填参数: + ... ${CreateOrSearch}:填入Create或者Search + ... ${name}:名称 + ... ${keywordtext}:填入新建subid的内容 + ... ${object_name}:列表形式,列表中是对象的名字 + ... 判断是新建subid还是搜索添加subid + run keyword if "${CreateOrSearch}"=="Create" run keywords sleep 1 + ... AND click element id=interceptionadd_proaddaddSource + ... AND SUBIDAdd ${Add} ${name} ${keywordtext} ${object_name} + ... ELSE IF "${CreateOrSearch}"=="Search" run keywords sleep 1 + ... AND SourceSearchSearch ${object_name} +DestinationIPCreateOrSearch + [Arguments] ${CreateOrSearch} ${Add} ${ip_type} ${name} ${object_name} ${ipclienttext1} + ... ${post} ${Country} ${City} ${Protocols1} ${Degree} ${times} ${numbers} ${limits} + [Documentation] 调用次关键字前需要添加必填参数: + ... ${CreateOrSearch}:填入Create或者Search + ... ${Add}:填入Address或Group + ... ${name}:名称 + ... ${ip_type}:填入Ip或者Geography或者IPLearning + ... ${ipclienttext1}:填入IPV4或6的值或range的ip段 + ... ${post}:填入端口 + ... ${Country}:列表形式,列表中是国家名字 + ... ${City}:列表形式,列表中是城市名字 + ... ${Protocols1}:填入HTTP或SSL或HTTPSSL + ... ${Degree}:填入1Degree或2Degree + ... ${times}:填入小时数,例如1或2 + ... ${numbers}:填入数值,例如1或10000 + ... ${limits}:填入数值,例如1或10000 + ... ${object_name}:列表形式,列表中是对象的名字 + ... 判断是新建ip还是搜索添加ip + run keyword if "${CreateOrSearch}"=="Create" run keywords sleep 1 + ... AND click element id=interceptionadd_proaddaddDestination + ... AND DestinationIPAdd ${Add} ${ip_type} ${name} ${object_name} ${ipclienttext1} ${post} ${Country} ${City} ${Protocols1} ${Degree} ${times} ${numbers} ${limits} + ... ELSE IF "${CreateOrSearch}"=="Search" run keywords sleep 1 + ... AND DestinationSearch ${object_name} +SourceSearch + [Arguments] ${name} + [Documentation] 调用次关键字前需要添加必填参数: + ... ${name}:填入是一个列表,列表内容为source的name + ... 选择search对象 + FOR ${i} IN @{name} + input text xpath=/html/body/div[1]/div/div[3]/div[2]/div/div[1]/form/div/div[4]/div[2]/div[1]/div[2]/div[2]/div/div[1]/input ${i} + sleep 1 + press keys xpath=/html/body/div[1]/div/div[3]/div[2]/div/div[1]/form/div/div[4]/div[2]/div[1]/div[2]/div[2]/div/div[1]/input ENTER + sleep 1 + click element xpath=/html/body/div[1]/div/div[3]/div[2]/div/div[1]/form/div/div[4]/div[2]/div[1]/div[2]/div[2]/div/div[2]/div/div/ul/li[1] + sleep 1 + END +DestinationSearch + [Arguments] ${name} + [Documentation] 调用次关键字前需要添加必填参数: + ... ${name}:填入是一个列表,列表内容为source的name + ... 选择search对象 + FOR ${i} IN @{name} + input text xpath=/html/body/div[1]/div/div[3]/div[2]/div/div[1]/form/div/div[5]/div[2]/div[1]/div[2]/div[2]/div/div[1]/input ${i} + sleep 1 + press keys xpath=/html/body/div[1]/div/div[3]/div[2]/div/div[1]/form/div/div[5]/div[2]/div[1]/div[2]/div[2]/div/div[1]/input ENTER + sleep 1 + click element xpath=/html/body/div[1]/div/div[3]/div[2]/div/div[1]/form/div/div[5]/div[2]/div[1]/div[2]/div[2]/div/div[2]/div/div/ul/li[1] + sleep 1 + END + +SUBIDAdd + [Arguments] ${Add} ${name} ${keywordtext} ${object_name} + [Documentation] 调用次关键字前需要添加必填参数: + ... ${Add}:填入Address或Group + ... ${name}:名称 + ... ${keywordtext}:填入新建subid的内容 + ... ${object_name}:列表形式,列表中是对象的名字 + ... 判断是新建subid还是新建subid分组 + run keyword if "${Add}"=="Address" run keywords sleep 1 + ... AND click element xpath=/html/body/ul/li[1] + ... AND sleep 1 + ... AND SUBAddress ${name} ${keywordtext} + ... ELSE IF "${Add}"=="Group" run keywords sleep 1 + ... AND click element xpath=/html/body/ul/li[2] + ... AND sleep 1 + ... AND SUBGroupAdd ${name} ${object_name} +SUBAddress + [Arguments] ${name} ${keywordtext} + [Documentation] 调用次关键字前需要添加必填参数: + ... ${name}:名称 + ... ${keywordtext}:填入新建subid的内容 + ... 新建subid + SourceCreate-name ${name} + click element xpath=//*[@id="policy_Manipulation2"]/div[1]/div[1]/div[2]/form/div[3]/div/div[1]/i + sleep 1 + Create-SubscriberID-text ${keywordtext} + sleep 1 + +SUBGroupAdd + [Arguments] ${name} ${object_name} + [Documentation] 调用次关键字前需要添加必填参数: + ... ${name}:名称 + ... ${object_name}:列表形式,列表中是对象的名字 + ... 新建subid分组 + SourceCreate-name ${name} + click element xpath=//*[@id="policy_Manipulation2"]/div[1]/div[1]/div[2]/form/div[3]/div/div/div[2] + sleep 1 + Create-Sub-Objects ${object_name} + NewObject.Create-ok +SourceIPAdd + [Arguments] ${Add} ${ip_type} ${name} ${object_name} ${ipclienttext1} ${post} ${Country} ${City} ${Protocols1} ${Degree} ${times} ${numbers} ${limits} + [Documentation] 调用次关键字前需要添加必填参数: + ... ${Add}:填入Address或Group + ... ${ip_type}:填入IP或者Geography或者IPLearning + ... 判断是新建ip还是新建ip分组 + run keyword if "${Add}"=="Address" run keywords sleep 1 + ... AND click element xpath=/html/body/ul/li[1] + ... AND sleep 1 + ... AND SourceIPAddress ${name} ${ip_type} ${ipclienttext1} ${post} ${Country} ${City} ${Protocols1} ${Degree} ${times} ${numbers} ${limits} + ... ELSE IF "${Add}"=="Group" run keywords sleep 1 + ... AND click element xpath=/html/body/ul/li[2] + ... AND sleep 1 + ... AND SourceIPGroupAdd ${name} ${ip_type} ${object_name} +SourceIPAddress + [Arguments] ${name} ${ip_type} ${ipclienttext1} ${post} ${Country} ${City} ${Protocols1} ${Degree} ${times} ${numbers} ${limits} + [Documentation] 调用次关键字前需要添加必填参数: + ... ${name}:名称 + ... ${ip_type}:填入Ip或者Geography或者IPLearning + ... ${ipclienttext1}:填入IPV4或6的值或range的ip段 + ... ${post}:填入端口 + ... ${Country}:列表形式,列表中是国家名字 + ... ${City}:列表形式,列表中是城市名字 + ... ${Protocols1}:填入HTTP或SSL或HTTPSSL + ... ${Degree}:填入1Degree或2Degree + ... ${times}:填入小时数,例如1或2 + ... ${numbers}:填入数值,例如1或10000 + ... ${limits}:填入数值,例如1或10000 + ... 判断 新建选择用什么样的类型,并进行新建 + SourceCreate-name ${name} + sleep 1 + run keyword if "${ip_type}"=="Ip" run keywords click element xpath=//*[@id="policy_Manipulation2"]/div[1]/div[1]/div[2]/form/div[4]/div/div[1] + ... AND sleep 1 + ... AND NewObject.Create-ip-ClientIP-text ${ipclienttext1} ${post} + run keyword if "${ip_type}"=="Geography" run keywords click element id=objectAdd_ip1 + ... AND sleep 1 + ... AND click element xpath=//*[@id="policy_Manipulation2"]/div[1]/div[1]/div[2]/form/div[4]/div/div[1]/div[2] + ... AND sleep 1 + ... AND NewObject.Create-Geography ${Country} ${City} + ... AND sleep 1 + ... AND click element id=interceptionadd_allcancelobjec3t + ... AND sleep 1 + run keyword if "${ip_type}"=="IPLearning" run keywords click element id=objectAdd_ip2 + ... AND sleep 1 + ... AND click element xpath=//*[@id="policy_Manipulation2"]/div[1]/div[1]/div[2]/form/div[4]/div/div[1] + ... AND sleep 1 + ... AND input text xpath=//*[@id="policy_Manipulation2"]/div[1]/div[1]/div[2]/form/div[4]/div/div[4]/div/div[1]/div[2]/div[1]/div[1]/form/div[1]/div/div[1]/input ${fqdn} + ... AND sleep 1 + ... AND click element xpath=//*[@id="policy_Manipulation2"]/div[1]/div[1]/div[2]/form/div[5]/div[1]/div/div/div[2] + ... AND sleep 1 + ... AND Learn-From-Protocols ${Protocols1} + ... AND Learning-Depth ${Degree} + ... AND sleep 1 + ... AND input text xpath=//*[@id="policy_Manipulation2"]/div[1]/div[1]/div[2]/form/div[5]/div[3]/div/div[1]/input ${times} + ... AND sleep 1 + ... AND input text xpath=//*[@id="policy_Manipulation2"]/div[1]/div[1]/div[2]/form/div[5]/div[4]/div/div[1]/input ${numbers} + ... AND sleep 1 + ... AND input text xpath=//*[@id="policy_Manipulation2"]/div[1]/div[1]/div[2]/form/div[5]/div[5]/div/div[1]/input ${limits} + ... AND sleep 1 + sleep 1 + SourceCreate-ok + +DestinationIPAdd + [Arguments] ${Add} ${ip_type} ${name} ${object_name} ${ipclienttext1} ${post} ${Country} ${City} ${Protocols1} ${Degree} ${times} ${numbers} ${limits} + [Documentation] 调用次关键字前需要添加必填参数: + ... ${Add}:填入Address或Group + ... ${ip_type}:填入IP或者Geography或者IPLearning + ... 判断是新建ip还是新建ip分组 + run keyword if "${Add}"=="Address" run keywords sleep 1 + ... AND click element xpath=/html/body/ul[contains(@id,'dropdown-menu' )and @x-placement='bottom-start']/child::li[1] + ... AND sleep 1 + ... AND DestinationIPAddress ${name} ${ip_type} ${ipclienttext1} ${post} ${Country} ${City} ${Protocols1} ${Degree} ${times} ${numbers} ${limits} + ... ELSE IF "${Add}"=="Group" run keywords sleep 1 + ... AND click element xpath=/html/body/ul[contains(@id,'dropdown-menu' )and @x-placement='bottom-start']/child::li[2] + ... AND sleep 1 + ... AND IPGroupAdd ${name} ${ip_type} ${object_name} +DestinationIPAddress + [Arguments] ${name} ${ip_type} ${ipclienttext1} ${post} ${Country} ${City} ${Protocols1} ${Degree} ${times} ${numbers} ${limits} + [Documentation] 调用次关键字前需要添加必填参数: + ... ${name}:名称 + ... ${ip_type}:填入Ip或者Geography或者IPLearning + ... ${ipclienttext1}:填入IPV4或6的值或range的ip段 + ... ${post}:填入端口 + ... ${Country}:列表形式,列表中是国家名字 + ... ${City}:列表形式,列表中是城市名字 + ... ${Protocols1}:填入HTTP或SSL或HTTPSSL + ... ${Degree}:填入1Degree或2Degree + ... ${times}:填入小时数,例如1或2 + ... ${numbers}:填入数值,例如1或10000 + ... ${limits}:填入数值,例如1或10000 + ... 判断 新建选择用什么样的类型,并进行新建 + DestinationCreate-name ${name} + sleep 1 + run keyword if "${ip_type}"=="Ip" run keywords click element xpath=/html/body/div/div/div[3]/div[2]/div/div[1]/form/div/div[5]/div[2]/div[2]/div/div[1]/div[1]/div[2]/form/div[4]/div/div[1] + ... AND sleep 1 + ... AND NewObject.Create-ip-ClientIP-text ${ipclienttext1} ${post} + run keyword if "${ip_type}"=="Geography" run keywords click element xpath=/html/body/div[1]/div/div[3]/div[2]/div/div[1]/form/div/div[5]/div[2]/div[2]/div/div[1]/div[1]/div[2]/form/div[3]/div/div/label[2] + ... AND sleep 1 + ... AND click element xpath=/html/body/div/div/div[3]/div[2]/div/div[1]/form/div/div[5]/div[2]/div[2]/div/div[1]/div[1]/div[2]/form/div[4]/div/div[1]/div[2] + ... AND sleep 1 + ... AND NewObject.Create-Geography ${Country} ${City} + ... AND sleep 1 + ... AND click element id=interceptionadd_allcancelobjec3t + ... AND sleep 1 + run keyword if "${ip_type}"=="IPLearning" run keywords click element xpath=/html/body/div[1]/div/div[3]/div[2]/div/div[1]/form/div/div[5]/div[2]/div[2]/div/div[1]/div[1]/div[2]/form/div[3]/div/div/label[3] + ... AND sleep 1 + ... AND click element xpath=/html/body/div/div/div[3]/div[2]/div/div[1]/form/div/div[5]/div[2]/div[2]/div/div[1]/div[1]/div[2]/form/div[4]/div/div[1] + ... AND sleep 1 + ... AND input text xpath=/html/body/div/div/div[3]/div[2]/div/div[1]/form/div/div[5]/div[2]/div[2]/div/div[1]/div[1]/div[2]/form/div[4]/div/div[3]/div/div[1]/div[2]/div[1]/div[1]/form/div[1]/div/div[1]/input ${fqdn} + ... AND sleep 1 + ... AND click element xpath=/html/body/div/div/div[3]/div[2]/div/div[1]/form/div/div[5]/div[2]/div[2]/div/div[1]/div[1]/div[2]/form/div[5]/div[1]/div/div/div[2] + ... AND sleep 1 + ... AND Learn-From-Protocols ${Protocols1} + ... AND Learning-Depth ${Degree} + ... AND sleep 1 + ... AND input text xpath=/html/body/div/div/div[3]/div[2]/div/div[1]/form/div/div[5]/div[2]/div[2]/div/div[1]/div[1]/div[2]/form/div[5]/div[3]/div/div[1]/input ${times} + ... AND sleep 1 + ... AND input text xpath=/html/body/div/div/div[3]/div[2]/div/div[1]/form/div/div[5]/div[2]/div[2]/div/div[1]/div[1]/div[2]/form/div[5]/div[4]/div/div[1]/input ${numbers} + ... AND sleep 1 + ... AND input text xpath=/html/body/div/div/div[3]/div[2]/div/div[1]/form/div/div[5]/div[2]/div[2]/div/div[1]/div[1]/div[2]/form/div[5]/div[5]/div/div[1]/input ${limits} + ... AND sleep 1 + DestinationCreate-ok +Learn-From-Protocols + [Arguments] ${Protocols1} + [Documentation] 调用次关键字前需要添加必填参数: + ... ${Protocols1}:填入HTTP或SSL或者HTTPSSL + ... 判断选择用什么样的协议 + run keyword if "${Protocols1}"=="HTTP" run keywords sleep 1 + ... AND click element xpath=/html/body/div[6]/div[1]/div[1]/ul/li[1] + run keyword if "${Protocols1}"=="SSL" run keywords sleep 1 + ... AND click element xpath=/html/body/div[6]/div[1]/div[1]/ul/li[2] + run keyword if "${Protocols1}"=="HTTPSSL" run keywords sleep 1 + ... AND click element xpath=/html/body/div[6]/div[1]/div[1]/ul/li[1] + ... AND sleep 1 + ... AND click element xpath=/html/body/div[6]/div[1]/div[1]/ul/li[2] + +Learning-Depth + [Arguments] ${Degree} + [Documentation] 调用次关键字前需要添加必填参数: + ... ${Degree}:填入1Degree或2Degree + ... 判断是用1Degree或2Degree + run keyword if "${Degree}"=="1Degree" run keywords sleep 1 + ... AND click element xpath=/html/body/div/div/div[3]/div[2]/div/div[1]/form/div/div[5]/div[2]/div[2]/div/div[1]/div[1]/div[2]/form/div[5]/div[2]/div/div/label[1] + run keyword if "${Degree}"=="2Degree" run keywords sleep 1 + ... AND click element xpath=/html/body/div/div/div[3]/div[2]/div/div[1]/form/div/div[5]/div[2]/div[2]/div/div[1]/div[1]/div[2]/form/div[5]/div[2]/div/div/label[2] + +SourceIPGroupAdd + [Arguments] ${name} ${ip_type} ${object_name} + [Documentation] 调用次关键字前需要添加必填参数: + ... ${name}:名称 + ... ${ip_type}:填入Ip或者Geography + ... ${object_name}:列表形式,列表中是对象的名字 + SourceCreate-name ${name} + Select-ip_type ${ip_type} + sleep 1 + click element xpath=//*[@id="policy_Manipulation2"]/div[1]/div[1]/div[2]/form/div[4]/div/div/div[2] + Create-Sub-Objects ${object_name} + NewObject.Create-ok + +SourceCreate-name + [Arguments] ${objName} + sleep 2 + input text id=objectAdd_name ${objName} + +SourceCreate-ok + sleep 2 + click button id=objectAdd_ok + +DestinationCreate-name + [Arguments] ${objName} + sleep 2 + input text xpath=/html/body/div[1]/div/div[3]/div[2]/div/div[1]/form/div/div[5]/div[2]/div[2]/div/div[1]/div[1]/div[2]/form/div[1]/div/div[1]/input ${objName} + +DestinationCreate-ok + sleep 2 + click button xpath=/html/body/div[1]/div/div[3]/div[2]/div/div[1]/form/div/div[5]/div[2]/div[2]/div/div[2]/button[1] + + +Security-Source + [Arguments] ${SourceType} ${SourceValue} + Wait Until Element Is Enabled xpath=//*[@id="app"]/div/div[3]/div[2]/div/div[1]/div[1]/span/div/div/div[2]/div/div 10 + click element xpath=//*[@id="app"]/div/div[3]/div[2]/div/div[1]/div[1]/span/div/div/div[2]/div/div + sleep 1 + run keyword if "${SourceType}"=="ID" run keywords sleep 1 + ... AND click element xpath=/html/body/div/div[1]/div[1]/ul/li[2] + run keyword if "${SourceType}"=="Name" run keywords sleep 1 + ... AND click element xpath=/html/body/div/div[1]/div[1]/ul/li[3] + run keyword if "${SourceType}"=="Action" run keywords sleep 1 + ... AND click element xpath=/html/body/div/div[1]/div[1]/ul/li[4] + sleep 1 + input text xpath=//*[@id="app"]/div/div[3]/div[2]/div/div[1]/div[1]/span/div/div/div[2]/div/div[1]/div[3]/div/input ${SourceValue} + sleep 1 + click element xpath=//*[@id="app"]/div/div[3]/div[2]/div/div[1]/div[1]/span/div/i + sleep 1 + click element xpath=//*[@id="ly-table1-listcontent"]/div/div[3]/table/tbody/tr[1] + sleep 1 + +EditButton + sleep 1 + click element xpath=//*[@id="appEdit"]/span/div/div[2] + sleep 1 + +Initialize-Policie + [Arguments] ${InitializeAction} + [Documentation] 调用次关键字前需要添加必填参数: + ... ${InitializeAction}:根据用例进行填写,意思就是是那一个action就不要点击哪一个,以免初始化失败 + run keyword if "${InitializeAction}"=="Allow" run keywords sleep 1 + ... AND click element id=security_action_deny + ... AND sleep 1 + ... ELSE IF "${InitializeAction}"=="Deny" run keywords sleep 1 + ... AND click element id=security_action_allow + ... ELSE IF "${InitializeAction}"=="Monitor" run keywords sleep 1 + ... AND click element id=security_action_deny + ... ELSE IF "${InitializeAction}"=="Intercept" run keywords sleep 1 + ... AND click element id=security_action_deny + ... ELSE log 不修改 + sleep 1 + ${status} Run Keyword And Return Status Page should contain element xpath=/html/body/div[1]/div/div[3]/div[2]/div/div[1]/form[1]/div/div[4]/div[1]/div/div/div #判断页面是否包含该元素 + run keyword if "${status}"=="False" log go on + run keyword if "${status}"=="True" run keywords sleep 1 + ... AND click element xpath=/html/body/div[1]/div/div[3]/div[2]/div/div[1]/form[1]/div/div[4]/div[1]/div/div/div/p/span/span/i[2] + ... AND sleep 1 + ${status1} Run Keyword And Return Status Page should contain element xpath=/html/body/div[1]/div/div[3]/div[2]/div/div[1]/form[1]/div/div[5]/div[1]/div/div/div #判断页面是否包含该元素 + run keyword if "${status1}"=="False" log go on + run keyword if "${status1}"=="True" run keywords sleep 1 + ... AND click element xpath=/html/body/div[1]/div/div[3]/div[2]/div/div[1]/form[1]/div/div[5]/div[1]/div/div/div/p/span/span/i[2] + ... AND sleep 1 + + diff --git a/02-Keyword/tsg_ui/securityPolicy/SecurityPolicy.robot b/02-Keyword/tsg_ui/securityPolicy/SecurityPolicy.robot index 1f83fdb..271ca13 100644 --- a/02-Keyword/tsg_ui/securityPolicy/SecurityPolicy.robot +++ b/02-Keyword/tsg_ui/securityPolicy/SecurityPolicy.robot @@ -38,6 +38,7 @@ Create-Source-Button Create-Destination-Button [Documentation] 点击Destination的加号 Wait Until Element Is Enabled xpath=/html/body/div[1]/div/div[3]/div[2]/div/div[1]/form/div/div[5]/div[1]/div/div 10 + sleep 2 click element xpath=/html/body/div[1]/div/div[3]/div[2]/div/div[1]/form/div/div[5]/div[1]/div/div Create-Application-Button [Documentation] 点击Application的加号 @@ -220,10 +221,12 @@ Profile-SearchorCreate ... ${file}:上传文件路径 ... 判断是新建还是搜索profile sleep 1 + click element id=html_profile + sleep 1 run keyword if "${SearchorCreate}"=="Search" run keywords sleep 1 ... AND input text id=filedata_profileName ${ProfileName} ... AND sleep 1 - ... AND press keys id=filedata_profileName + ... AND press keys id=filedata_profileName ENTER ... AND sleep 1 ... AND click element id=filelist_select0 ... ELSE IF "${SearchorCreate}"=="Create" run keywords sleep 1 @@ -503,9 +506,9 @@ LogSession Enabled [Arguments] ${Enabled} [Documentation] 调用次关键字前需要添加必填参数: - ... ${Enabled}:填入open或其他 + ... ${Enabled}:填入open或其他 run keyword if "${Enabled}"=="open" run keywords sleep 1 - ... AND click element xpath=//*[@id="policy_paper_left"]/div[18]/label[contains(text(), "Enabled")]/following-sibling::div/div + ... AND click element xpath=//*[@id="policy_paper_left"]/div/label[contains(text(), "Enabled")]/following-sibling::div/div ... AND sleep 2 ... AND click element xpath=/html/body/div/div/div[3]/button[2] ... ELSE log 开启日志 @@ -951,12 +954,12 @@ Initialize-Policie ... AND click element id=security_action_deny ... ELSE log 不修改 sleep 1 - ${status} Run Keyword And Return Status Page should contain element /html/body/div[1]/div/div[3]/div[2]/div/div[1]/form[1]/div/div[4]/div[1]/div/div/div #判断页面是否包含该元素 + ${status} Run Keyword And Return Status Page should contain element xpath=/html/body/div[1]/div/div[3]/div[2]/div/div[1]/form[1]/div/div[4]/div[1]/div/div/div #判断页面是否包含该元素 run keyword if "${status}"=="False" log go on run keyword if "${status}"=="True" run keywords sleep 1 ... AND click element xpath=/html/body/div[1]/div/div[3]/div[2]/div/div[1]/form[1]/div/div[4]/div[1]/div/div/div/p/span/span/i[2] ... AND sleep 1 - ${status1} Run Keyword And Return Status Page should contain element /html/body/div[1]/div/div[3]/div[2]/div/div[1]/form[1]/div/div[5]/div[1]/div/div/div #判断页面是否包含该元素 + ${status1} Run Keyword And Return Status Page should contain element xpath=/html/body/div[1]/div/div[3]/div[2]/div/div[1]/form[1]/div/div[5]/div[1]/div/div/div #判断页面是否包含该元素 run keyword if "${status1}"=="False" log go on run keyword if "${status1}"=="True" run keywords sleep 1 ... AND click element xpath=/html/body/div[1]/div/div[3]/div[2]/div/div[1]/form[1]/div/div[5]/div[1]/div/div/div/p/span/span/i[2]