修改关键子和测试用例将创建策略和修改策略只使用一个关键字

This commit is contained in:
byb11
2021-03-12 14:08:57 +08:00
parent cc0443cf44
commit 2e9014d555
3 changed files with 210 additions and 191 deletions

View File

@@ -8,117 +8,121 @@ Resource ../../../03-Variable/PolicyObjectDefault.txt
Resource ../../../03-Variable/BifangApiVariable.txt
*** Keywords ***
UIAddPolicies
[Arguments] ${PolicyInfo} ${SourceInfo}=null ${DestinationInfo}=null ${FilterInfo}=null ${Subactionadd}=null ${Keyring}=null ${MirrorDecryptedTrafficInfo}=null ${DecryptionProfile}=null
# UIAddPolicies
# [Arguments] ${PolicyInfo} ${SourceInfo}=null ${DestinationInfo}=null ${FilterInfo}=null ${Subactionadd}=null ${Keyring}=null ${MirrorDecryptedTrafficInfo}=null ${DecryptionProfile}=null
# ... ${ProxyDenyadd}=null ${DenyRedirectadd}=null ${HTTPRedirectadd}=null ${ReplaceActionParameters}=null ${HijackFileadd}=null ${InsertScript}=null
# [Documentation] 创建策略
# ... 调用次关键字前需要添加参数:
# ... ${PolicyInfo}是个字典:实例 ${PolicyInfo} Create Dictionary PolicyType=Security Policy PolicyName=${TEST NAME} PolicyAction=deny PolicySubAction=RST ApplicationSearch=HTTP PolicyLogSession=1 PolicyEnabled=1
# ... ${SourceInfo}是个字典实例sourceAddIpList=${sourceAddIpList} ${sourceAddIpList}是个列表,${sourceAddIpList} Create List ${sip1} 列表中是个字典:,实例:${sip1} Create Dictionary Sordtype=Source Type1=Ip CreateOrSearch=Create Add=Address Name=${TEST NAME}_IP1 Ipclienttext1=192.168.40.11-192.168.40.110 Port=1-65535
# ... ${DestinationInfo}和${SourceInfo}格式一致
# ... ${FilterInfo}是个字典:实例${FilterInfo} Create Dictionary Filter=${filter} Hostname=${hostname} URLname=${urlname} Request Headername=${RequestHeadername} Response Headername=${ResponseHeadername} 其中${filter}是个列表:实例${filter} create list Host URL Request Header Response Header Request Content其中${xxxname}是对象的名字
# ... ${Subactionadd}是一个字典:在"${PolicyType}"=="Security Policy" and "${PolicyAction}"=="deny" 并且PolicySubAction为Block或Alert或Redirect时需要的一个参数例如PolicySubAction=Block时需要填入${Subactionadd} Create Dictionary code=403 Content=TEXT block-text=123456
# ... ${Keyring}是一个字典,在"${PolicyType}"=="Security Policy" and "${PolicyAction}"=="intercept" and "ApplicationSearchV"=="SSL" 时需要根据用例情况填入例如name=证书名字 ${File}=文件所在路径 ${File1}=文件所在路径 ExpiryHours1or2=1或其他 ${Type}=上传证书类型的元素 ${Type1}=上传证书加密解密算法的元素 ${Shift}=close或open ${PrivateKeyType}=HSM或其他
# ... ${MirrorDecryptedTrafficInfo}是个字典:在"${PolicyType}"=="Security Policy" and "${PolicyAction}"=="intercept" and "ApplicationSearchV"=="SSL" 时需要根据用例情况填入,例如:${MirrorDecryptedTraffic}=输入open代表开启按钮其他代表不开启${MirrorDecryptedTrafficSearchorCreate}=填入Create或Search${MirrorDecryptedTrafficname}=解密流量文件的name${Type}=是mac还是vlan的定位元素${Shuru}=输入mac或vlan的值
# ... ${DecryptionProfile}是个字典:在"${PolicyType}"=="Security Policy" and "${PolicyAction}"=="intercept" and "ApplicationSearchV"=="SSL" 时需要根据用例情况填入,例如:${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}=输入协议版本,
# ... ${ProxyDenyadd}是个字典:例如:${DenyCode}=填入403或404或451${Action}=填入deny${Code}=填入403或404${Content}=填入TEXT或Profile${SearchorCreate}=填入Search或Create${BlockText}=填入TEXT文本框内容${ProfileName}=Profile的名字${File}=上传文件路径,${TextValue}=填入text输入框内容
# ... ${DenyRedirectadd}是个字典:例如:${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值
# ... ${ReplaceActionParameters}是个字典:例如:${ParametersType}:列表格式Search 下拉框中内容 ${xxxFind}是Find输入框输入的值${XXXReplacewith}:是 Replacewith输入框中输入的值
# ... ${HijackFileadd}是个字典:例如:${SearchorCreate}:填入Search或Create${Hijackname}:填入新建hijack的name${Hijackfile}:填入新建hijack文件的路径${DowName}:根据情况填入close或open或其他${Input}填入shuru或其他${Hijacktype}:填入选择文件类型的元素
# ... ${InsertScript}是个字典:例如:${SearchorCreate}:填入Search或Create${Insertname}:填入新建insert的name${Insertfile}:填入新建insert文件的路径${Inserttype}:根据情况填入css或js${Insertjstype}填入Before Page Load或After Page Load
# ${emptyList} Create List
# ${return} ${PolicyType} Run Keyword And Ignore Error Get From Dictionary ${PolicyInfo} PolicyType
# ${PolicyType} Run Keyword If "${return}"=="FAIL" or "${PolicyType}"=="${EMPTY}" set variable ${Default_PolicyType}
# ... ELSE set variable ${PolicyType}
# ${return} ${PolicyName} Run Keyword And Ignore Error Get From Dictionary ${PolicyInfo} PolicyName
# ${PolicyName} Run Keyword If "${return}"=="FAIL" or "${PolicyName}"=="${EMPTY}" set variable ${Default_PolicyName}
# ... ELSE set variable ${PolicyName}
# ${return} ${PolicyAction} Run Keyword And Ignore Error Get From Dictionary ${PolicyInfo} PolicyAction
# ${PolicyAction} Run Keyword If "${return}"=="FAIL" or "${PolicyAction}"=="${EMPTY}" set variable ${Default_Action}
# ... ELSE set variable ${PolicyAction}
# ${return} ${PolicySubAction} Run Keyword And Ignore Error Get From Dictionary ${PolicyInfo} PolicySubAction
# ${PolicySubAction} Run Keyword If "${return}"=="FAIL" or "${PolicySubAction}"=="${EMPTY}" set variable ${Default_PolicySubAction}
# ... ELSE set variable ${PolicySubAction}
# ${return} ${ApplicationSearch} Run Keyword And Ignore Error Get From Dictionary ${PolicyInfo} ApplicationSearch
# ${ApplicationSearchV} Run Keyword If "${return}"!="FAIL" and "${ApplicationSearch}"!="${EMPTY}" and "${ApplicationSearch}"!="${None}" Evaluate list(re.split('[,]', '${ApplicationSearch}')) re
# ... ELSE Set Variable ${emptyList}
# ${return} ${PolicyLogSession} Run Keyword And Ignore Error Get From Dictionary ${PolicyInfo} PolicyLogSession
# ${PolicyLogSession} Run Keyword If "${return}"=="FAIL" or "${PolicyLogSession}"=="${EMPTY}" set variable ${Default_PolicyLogSession}
# ... ELSE set variable ${PolicyLogSession}
# ${return} ${LogOptions} Run Keyword And Ignore Error Get From Dictionary ${PolicyInfo} LogOptions
# ${LogOptions} Run Keyword If "${return}"=="FAIL" or "${LogOptions}"=="${EMPTY}" set variable 1
# ... ELSE set variable ${LogOptions}
# ${return} ${PolicyEnabled} Run Keyword And Ignore Error Get From Dictionary ${PolicyInfo} PolicyEnabled
# ${PolicyEnabled} Run Keyword If "${return}"=="FAIL" or "${PolicyEnabled}"=="${EMPTY}" set variable ${Default_PolicyEnabled}
# ... ELSE set variable ${PolicyEnabled}
# Comment 新建策略 打开菜单
# log ${PolicyType}
# Menu policys ${PolicyType}
# Comment 新建策略 打开安全策略列表上方的新建策略按钮
# UIPolicy.CreateButton
# UIPolicy.Create-name ${PolicyType} ${PolicyName}
# UIPolicy.Create-actions ${PolicyType} ${PolicyAction}
# #Create-Source-Button
# Run Keyword If "${SourceInfo}"=="${EMPTY}" log there is no SourceInfoDict
# ... ELSE UIPolicy. Create-Source-Button
# Run Keyword If "${SourceInfo}"=="${EMPTY}" log there is no SourceInfoDict
# ... ELSE UIPolicy.CreateEditDeleteSources ${SourceInfo}
# Run Keyword If "${DestinationInfo}"=="${EMPTY}" log there is no DestinationInfo
# ... ELSE UIPolicy.Create-Destination-Button
# Run Keyword If "${DestinationInfo}"=="${EMPTY}" log there is no DestinationInfo
# ... ELSE UIPolicy.CreateEditDeleteDestination ${DestinationInfo}
# UIPolicy.Create-Application-Button ${PolicyType} ${ApplicationSearchV} ${PolicyAction}
# #编辑filter
# Run Keyword If "${FilterInfo}"=="null" log there is no FilterInfo
# ... ELSE Create-Filter-SecurityOrProxy ${PolicyType} ${ApplicationSearchV}[0] ${FilterInfo} ${PolicyAction}
# Run Keyword If "${PolicyType}"=="Security Policy" and "${PolicyAction}"=="Deny" run keywords sleep ${sleep}
# ... AND Deny-subaction-1 ${PolicyAction} ${PolicySubAction} ${Subactionadd}
# Run Keyword If "${PolicyType}"=="Security Policy" and "${PolicyAction}"=="intercept" and "${ApplicationSearchV}"=="SSL" run keywords sleep ${sleep}
# ... AND Interceptadd ${Keyring} ${MirrorDecryptedTrafficInfo} ${DecryptionProfile}
# Run Keyword If "${PolicyType}"=="Proxy Policy" and "${PolicyAction}"=="Deny" run keywords sleep ${sleep}
# ... AND Proxy-Deny ${ProxyDenyadd}
# Run Keyword If "${PolicyType}"=="Proxy Policy" and "${PolicyAction}"=="Redirect" and "${ApplicationSearch}" == "DoH" run keywords sleep ${sleep}
# ... AND Deny-Redirect ${DenyRedirectadd}
# Run Keyword If "${PolicyType}"=="Proxy Policy" and "${PolicyAction}"=="Redirect" and "${ApplicationSearch}" == "HTTP" run keywords sleep ${sleep}
# ... AND ProxyHTTPRedirect ${HTTPRedirectadd}
# Run Keyword If "${PolicyType}"=="Proxy Policy" and "${PolicyAction}"=="Replace" run keywords sleep ${sleep}
# ... AND Replace-Action-Parameters-for1 ${ReplaceActionParameters}
# Run Keyword If "${PolicyType}"=="Proxy Policy" and "${PolicyAction}"=="Hijack" run keywords sleep ${sleep}
# ... AND HijackFile-SearchorCreate ${HijackFileadd}
# Run Keyword If "${PolicyType}"=="Proxy Policy" and "${PolicyAction}"=="Insert" run keywords sleep ${sleep}
# ... AND InsertScript-SearchorCreate ${InsertScript}
# Run Keyword If "${PolicyType}"=="Proxy Policy" run keywords ProxyLogSession ${PolicyLogSession}
# ... AND ProxyLogOptions ${LogOptions}
# ... ELSE LogSession ${PolicyLogSession}
# Run Keyword If "${PolicyType}"=="Security Policy" Enabled ${PolicyEnabled}
# ... ELSE ProxyEnabled ${PolicyEnabled}
# Run Keyword If "${PolicyType}"=="Security Policy" Security-Policies-OK
# ... ELSE Proxy-Policies-OK
# Wait Until Element Is Enabled id=app_create 20
# Security-Source Name ${PolicyName}
# Run Keyword If "${PolicyType}"=="Security Policy" SecurityAssert ${PolicyName}
# ... ELSE ProxyAssert ${PolicyName}
UIPolicies
[Arguments] ${PolicyInfo} ${SourceInfo}=null ${DestinationInfo}=null ${FilterInfo}=null ${EditFilterInfo}=null ${CreateOrDeleteFilterInfo}=null ${Subactionadd}=null ${Keyring}=null ${MirrorDecryptedTrafficInfo}=null ${DecryptionProfile}=null
... ${ProxyDenyadd}=null ${DenyRedirectadd}=null ${HTTPRedirectadd}=null ${ReplaceActionParameters}=null ${HijackFileadd}=null ${InsertScript}=null
[Documentation] 创建策略
... 调用次关键字前需要添加参数:
... ${PolicyInfo}是个字典:实例 ${PolicyInfo} Create Dictionary PolicyType=Security Policy PolicyName=${TEST NAME} PolicyAction=deny PolicySubAction=RST ApplicationSearch=HTTP PolicyLogSession=1 PolicyEnabled=1
... ${SourceInfo}是个字典实例sourceAddIpList=${sourceAddIpList} ${sourceAddIpList}是个列表,${sourceAddIpList} Create List ${sip1} 列表中是个字典:,实例:${sip1} Create Dictionary Sordtype=Source Type1=Ip CreateOrSearch=Create Add=Address Name=${TEST NAME}_IP1 Ipclienttext1=192.168.40.11-192.168.40.110 Port=1-65535
... ${DestinationInfo}和${SourceInfo}格式一致
... ${FilterInfo}是个字典:实例${FilterInfo} Create Dictionary Filter=${filter} Hostname=${hostname} URLname=${urlname} Request Headername=${RequestHeadername} Response Headername=${ResponseHeadername} 其中${filter}是个列表:实例${filter} create list Host URL Request Header Response Header Request Content其中${xxxname}是对象的名字
... ${Subactionadd}是一个字典:在"${PolicyType}"=="Security Policy" and "${PolicyAction}"=="deny" 并且PolicySubAction为Block或Alert或Redirect时需要的一个参数例如PolicySubAction=Block时需要填入${Subactionadd} Create Dictionary code=403 Content=TEXT block-text=123456
... ${Keyring}是一个字典,在"${PolicyType}"=="Security Policy" and "${PolicyAction}"=="intercept" and "ApplicationSearchV"=="SSL" 时需要根据用例情况填入例如name=证书名字 ${File}=文件所在路径 ${File1}=文件所在路径 ExpiryHours1or2=1或其他 ${Type}=上传证书类型的元素 ${Type1}=上传证书加密解密算法的元素 ${Shift}=close或open ${PrivateKeyType}=HSM或其他
... ${MirrorDecryptedTrafficInfo}是个字典:在"${PolicyType}"=="Security Policy" and "${PolicyAction}"=="intercept" and "ApplicationSearchV"=="SSL" 时需要根据用例情况填入,例如:${MirrorDecryptedTraffic}=输入open代表开启按钮其他代表不开启${MirrorDecryptedTrafficSearchorCreate}=填入Create或Search${MirrorDecryptedTrafficname}=解密流量文件的name${Type}=是mac还是vlan的定位元素${Shuru}=输入mac或vlan的值
... ${DecryptionProfile}是个字典:在"${PolicyType}"=="Security Policy" and "${PolicyAction}"=="intercept" and "ApplicationSearchV"=="SSL" 时需要根据用例情况填入,例如:${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}=输入协议版本,
... ${ProxyDenyadd}是个字典:例如:${DenyCode}=填入403或404或451${Action}=填入deny${Code}=填入403或404${Content}=填入TEXT或Profile${SearchorCreate}=填入Search或Create${BlockText}=填入TEXT文本框内容${ProfileName}=Profile的名字${File}=上传文件路径,${TextValue}=填入text输入框内容
... ${DenyRedirectadd}是个字典:例如:${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值
... ${ReplaceActionParameters}是个字典:例如:${ParametersType}:列表格式Search 下拉框中内容 ${xxxFind}是Find输入框输入的值${XXXReplacewith}:是 Replacewith输入框中输入的值
... ${HijackFileadd}是个字典:例如:${SearchorCreate}:填入Search或Create${Hijackname}:填入新建hijack的name${Hijackfile}:填入新建hijack文件的路径${DowName}:根据情况填入close或open或其他${Input}填入shuru或其他${Hijacktype}:填入选择文件类型的元素
... ${InsertScript}是个字典:例如:${SearchorCreate}:填入Search或Create${Insertname}:填入新建insert的name${Insertfile}:填入新建insert文件的路径${Inserttype}:根据情况填入css或js${Insertjstype}填入Before Page Load或After Page Load
${emptyList} Create List
${return} ${PolicyType} Run Keyword And Ignore Error Get From Dictionary ${PolicyInfo} PolicyType
${PolicyType} Run Keyword If "${return}"=="FAIL" or "${PolicyType}"=="${EMPTY}" set variable ${Default_PolicyType}
... ELSE set variable ${PolicyType}
${return} ${PolicyName} Run Keyword And Ignore Error Get From Dictionary ${PolicyInfo} PolicyName
${PolicyName} Run Keyword If "${return}"=="FAIL" or "${PolicyName}"=="${EMPTY}" set variable ${Default_PolicyName}
... ELSE set variable ${PolicyName}
${return} ${PolicyAction} Run Keyword And Ignore Error Get From Dictionary ${PolicyInfo} PolicyAction
${PolicyAction} Run Keyword If "${return}"=="FAIL" or "${PolicyAction}"=="${EMPTY}" set variable ${Default_Action}
... ELSE set variable ${PolicyAction}
${return} ${PolicySubAction} Run Keyword And Ignore Error Get From Dictionary ${PolicyInfo} PolicySubAction
${PolicySubAction} Run Keyword If "${return}"=="FAIL" or "${PolicySubAction}"=="${EMPTY}" set variable ${Default_PolicySubAction}
... ELSE set variable ${PolicySubAction}
${return} ${ApplicationSearch} Run Keyword And Ignore Error Get From Dictionary ${PolicyInfo} ApplicationSearch
${ApplicationSearchV} Run Keyword If "${return}"!="FAIL" and "${ApplicationSearch}"!="${EMPTY}" and "${ApplicationSearch}"!="${None}" Evaluate list(re.split('[,]', '${ApplicationSearch}')) re
... ELSE Set Variable ${emptyList}
${return} ${PolicyLogSession} Run Keyword And Ignore Error Get From Dictionary ${PolicyInfo} PolicyLogSession
${PolicyLogSession} Run Keyword If "${return}"=="FAIL" or "${PolicyLogSession}"=="${EMPTY}" set variable ${Default_PolicyLogSession}
... ELSE set variable ${PolicyLogSession}
${return} ${LogOptions} Run Keyword And Ignore Error Get From Dictionary ${PolicyInfo} LogOptions
${LogOptions} Run Keyword If "${return}"=="FAIL" or "${LogOptions}"=="${EMPTY}" set variable 1
... ELSE set variable ${LogOptions}
${return} ${PolicyEnabled} Run Keyword And Ignore Error Get From Dictionary ${PolicyInfo} PolicyEnabled
${PolicyEnabled} Run Keyword If "${return}"=="FAIL" or "${PolicyEnabled}"=="${EMPTY}" set variable ${Default_PolicyEnabled}
... ELSE set variable ${PolicyEnabled}
Comment 新建策略 打开菜单
Menu policys ${PolicyType}
Comment 新建策略 打开安全策略列表上方的新建策略按钮
UIPolicy.CreateButton
UIPolicy.Create-name ${PolicyType} ${PolicyName}
UIPolicy.Create-actions ${PolicyType} ${PolicyAction}
#Create-Source-Button
Run Keyword If "${SourceInfo}"=="${EMPTY}" log there is no SourceInfoDict
... ELSE UIPolicy. Create-Source-Button
Run Keyword If "${SourceInfo}"=="${EMPTY}" log there is no SourceInfoDict
... ELSE UIPolicy.CreateEditDeleteSources ${SourceInfo}
Run Keyword If "${DestinationInfo}"=="${EMPTY}" log there is no DestinationInfo
... ELSE UIPolicy.Create-Destination-Button
Run Keyword If "${DestinationInfo}"=="${EMPTY}" log there is no DestinationInfo
... ELSE UIPolicy.CreateEditDeleteDestination ${DestinationInfo}
UIPolicy.Create-Application-Button ${PolicyType} ${ApplicationSearchV} ${PolicyAction}
#编辑filter
Run Keyword If "${FilterInfo}"=="null" log there is no FilterInfo
... ELSE Create-Filter-SecurityOrProxy ${PolicyType} ${ApplicationSearchV}[0] ${FilterInfo} ${PolicyAction}
Run Keyword If "${PolicyType}"=="Security Policy" and "${PolicyAction}"=="Deny" run keywords sleep ${sleep}
... AND Deny-subaction-1 ${PolicyAction} ${PolicySubAction} ${Subactionadd}
Run Keyword If "${PolicyType}"=="Security Policy" and "${PolicyAction}"=="intercept" and "${ApplicationSearchV}"=="SSL" run keywords sleep ${sleep}
... AND Interceptadd ${Keyring} ${MirrorDecryptedTrafficInfo} ${DecryptionProfile}
Run Keyword If "${PolicyType}"=="Proxy Policy" and "${PolicyAction}"=="Deny" run keywords sleep ${sleep}
... AND Proxy-Deny ${ProxyDenyadd}
Run Keyword If "${PolicyType}"=="Proxy Policy" and "${PolicyAction}"=="Redirect" and "${ApplicationSearch}" == "DoH" run keywords sleep ${sleep}
... AND Deny-Redirect ${DenyRedirectadd}
Run Keyword If "${PolicyType}"=="Proxy Policy" and "${PolicyAction}"=="Redirect" and "${ApplicationSearch}" == "HTTP" run keywords sleep ${sleep}
... AND ProxyHTTPRedirect ${HTTPRedirectadd}
Run Keyword If "${PolicyType}"=="Proxy Policy" and "${PolicyAction}"=="Replace" run keywords sleep ${sleep}
... AND Replace-Action-Parameters-for1 ${ReplaceActionParameters}
Run Keyword If "${PolicyType}"=="Proxy Policy" and "${PolicyAction}"=="Hijack" run keywords sleep ${sleep}
... AND HijackFile-SearchorCreate ${HijackFileadd}
Run Keyword If "${PolicyType}"=="Proxy Policy" and "${PolicyAction}"=="Insert" run keywords sleep ${sleep}
... AND InsertScript-SearchorCreate ${InsertScript}
Run Keyword If "${PolicyType}"=="Proxy Policy" run keywords ProxyLogSession ${PolicyLogSession}
... AND ProxyLogOptions ${LogOptions}
... ELSE LogSession ${PolicyLogSession}
Run Keyword If "${PolicyType}"=="Security Policy" Enabled ${PolicyEnabled}
... ELSE ProxyEnabled ${PolicyEnabled}
Run Keyword If "${PolicyType}"=="Security Policy" Security-Policies-OK
... ELSE Proxy-Policies-OK
Wait Until Element Is Enabled id=app_create 20
Security-Source Name ${PolicyName}
Run Keyword If "${PolicyType}"=="Security Policy" SecurityAssert ${PolicyName}
... ELSE ProxyAssert ${PolicyName}
UIUpdataPolicies
[Arguments] ${PolicyInfo} ${SourceInfo}=null ${DestinationInfo}=null ${EditFilterInfo}=null ${CreateOrDeleteFilterInfo}=null ${Subactionadd}=null ${Keyring}=null ${MirrorDecryptedTrafficInfo}=null ${DecryptionProfile}=null
... ${ProxyDenyadd}=null ${DenyRedirectadd}=null ${ReplaceActionParameters}=null ${HijackFileadd}=null ${InsertScript}=null
[Documentation] 编辑策略
[Documentation] 创建编辑策略
${emptyList} Create List
${return} ${PolicyType} Run Keyword And Ignore Error Get From Dictionary ${PolicyInfo} PolicyType
${PolicyType} Run Keyword If "${return}"=="FAIL" or "${PolicyType}"=="${EMPTY}" set variable ${Default_PolicyType}
... ELSE set variable ${PolicyType}
${return} ${CreateorEdit} Run Keyword And Ignore Error Get From Dictionary ${PolicyInfo} CreateorEdit
${CreateorEdit} Run Keyword If "${return}"=="FAIL" or "${CreateorEdit}"=="${EMPTY}" set variable ${Default_PolicyType}
... ELSE set variable ${CreateorEdit}
${return} ${PolicyName} Run Keyword And Ignore Error Get From Dictionary ${PolicyInfo} PolicyName
${PolicyName} Run Keyword If "${return}"=="FAIL" or "${PolicyName}"=="${EMPTY}" set variable ${Default_PolicyName}
@@ -158,13 +162,17 @@ UIUpdataPolicies
... ELSE set variable ${PolicyEnabled}
Comment 新建策略 打开菜单
log ${PolicyType}
Menu policys ${PolicyType}
Comment 搜索要编辑的策略
Security-Source Name ${PolicyName}
Comment 点击编辑按钮Edit
EditButton
Comment 编辑name
UIPolicy.Create-name ${PolicyType} ${PolicyEditName}
run keyword if "${CreateorEdit}" == "Edit" run keywords sleep ${sleep_min}
... AND Security-Source Name ${PolicyName}
... AND Comment 点击编辑按钮Edit
... AND EditButton
... AND UIPolicy.Create-name ${PolicyType} ${PolicyEditName}
run keyword if "${CreateorEdit}" == "Create" run keywords sleep ${sleep_min}
... AND UIPolicy.CreateButton
... AND UIPolicy.Create-name ${PolicyType} ${PolicyName}
Comment 编辑action
UIPolicy.Create-actions ${PolicyType} ${PolicyAction}
Comment 编辑Source
@@ -180,9 +188,11 @@ UIUpdataPolicies
Comment 编辑Application
Run Keyword If "${ApplicationSearchV}"=="${emptyList}" or "${ApplicationSearchV}"=="null" log there is no ApplicationSearchV
... ELSE UIPolicy.Create-Application-Button ${PolicyType} ${ApplicationSearchV} ${PolicyAction}
#编辑filter
#编辑filter
Run Keyword If "${FilterInfo}"=="null" log there is no FilterInfo
... ELSE Create-Filter-SecurityOrProxy ${PolicyType} ${ApplicationSearchV}[0] ${FilterInfo} ${PolicyAction}
Run Keyword If "${EditFilterInfo}"=="${EMPTY}" or "${EditFilterInfo}"=="null" log there is no FilterInfo
... ELSE Create-Filter-SecurityOrProxy ${PolicyType} ${ApplicationFilter} ${EditFilterInfo}
... ELSE Create-Filter-SecurityOrProxy ${PolicyType} ${ApplicationFilter} ${EditFilterInfo} ${PolicyAction}
Run Keyword If "${CreateOrDeleteFilterInfo}"=="${EMPTY}" or "${CreateOrDeleteFilterInfo}"=="null" log there is no FilterInfo
... ELSE Edit-Filter-SecurityOrProxy ${PolicyType} ${CreateOrDeleteFilterInfo}
@@ -192,8 +202,10 @@ UIUpdataPolicies
... AND Interceptadd ${Keyring} ${MirrorDecryptedTrafficInfo} ${DecryptionProfile}
Run Keyword If "${PolicyType}"=="Proxy Policy" and "${PolicyAction}"=="Deny" run keywords sleep ${sleep}
... AND Proxy-Deny ${ProxyDenyadd}
Run Keyword If "${PolicyType}"=="Proxy Policy" and "${PolicyAction}"=="Redirect" run keywords sleep ${sleep}
Run Keyword If "${PolicyType}"=="Proxy Policy" and "${PolicyAction}"=="Redirect" and "${ApplicationSearch}" == "DoH" run keywords sleep ${sleep}
... AND Deny-Redirect ${DenyRedirectadd}
Run Keyword If "${PolicyType}"=="Proxy Policy" and "${PolicyAction}"=="Redirect" and "${ApplicationSearch}" == "HTTP" run keywords sleep ${sleep}
... AND ProxyHTTPRedirect ${HTTPRedirectadd}
Run Keyword If "${PolicyType}"=="Proxy Policy" and "${PolicyAction}"=="Replace" run keywords sleep ${sleep}
... AND Replace-Action-Parameters-for1 ${ReplaceActionParameters}
Run Keyword If "${PolicyType}"=="Proxy Policy" and "${PolicyAction}"=="Hijack" run keywords sleep ${sleep}
@@ -208,9 +220,13 @@ UIUpdataPolicies
Run Keyword If "${PolicyType}"=="Security Policy" Security-Policies-OK
... ELSE Proxy-Policies-OK
Wait Until Element Is Enabled id=app_create 20
Security-Source Name ${PolicyEditName}
Run Keyword If "${PolicyType}"=="Security Policy" SecurityAssert ${PolicyEditName}
... ELSE ProxyAssert ${PolicyEditName}
run keyword if "${CreateorEdit}" == "Edit" run keywords sleep ${sleep}
... AND Security-Source Name ${PolicyEditName}
... ELSE Security-Source Name ${PolicyName}
Run Keyword If "${PolicyType}"=="Security Policy" and "${CreateorEdit}" == "Edit" SecurityAssert ${PolicyEditName}
... ELSE IF "${PolicyType}"=="Security Policy" and "${CreateorEdit}" == "Create" SecurityAssert ${PolicyName}
... ELSE IF "${PolicyType}"=="Proxy Policy" and "${CreateorEdit}" == "Edit" ProxyAssert ${PolicyEditName}
... ELSE IF "${PolicyType}"=="Proxy Policy" and "${CreateorEdit}" == "Create" ProxyAssert ${PolicyName}
SecurityAssert
[Arguments] ${PolicyName}