调整verify关键字,兼容和界面提交verify提交json串一致的json串;但是界面提交的json串和接口文档不一致

This commit is contained in:
dongxiaoyan
2020-07-28 17:46:33 +08:00
parent f42208a7ef
commit 8410b3c8de
2 changed files with 60 additions and 19 deletions

View File

@@ -476,11 +476,13 @@ Policy-Verify-v1-00020
${objectIds} Set Variable ${EMPTY}
Comment 创建对象
${ipValue} Create Dictionary ip=192.168.41.67 port=${1}
... addrType=${4} protocol=${6}
${ipObj} Create Dictionary attributeType=ip tableName=TSG_OBJ_IP_ADDR protocol=HTTP attributeName=source
... attributeValue=${ipValue}
${ipObj1} Create Dictionary attributeType=ip tableName=TSG_OBJ_IP_ADDR protocol=HTTP attributeName=destination
... attributeValue=${ipValue}
... addrType=${4} protocol=${6} tableName=TSG_SECURITY_SOURCE_ADDR
${ipValue1} Create Dictionary ip=192.168.41.687 port=${1}
... addrType=${4} protocol=${6} tableName=TSG_SECURITY_DESTINATION_ADDR
${ipObj} Create Dictionary attributeType=ip protocol=HTTP attributeName=source
... attributeValue=${ipValue}
${ipObj1} Create Dictionary attributeType=ip protocol=HTTP attributeName=destination
... attributeValue=${ipValue2}
${stringValue} Create Dictionary string=*baidu.com
${stringObj} Create Dictionary attributeType=string tableName=TSG_OBJ_URL protocol=HTTP attributeName=url
... attributeValue=${stringValue}
@@ -494,10 +496,10 @@ Policy-Verify-v1-00020
Policy-Verify-v1-00021
${objectIds} Set Variable ${EMPTY}
Comment 创建对象
${ipObj} Create Dictionary attributeType=ip tableName=TSG_OBJ_IP_ADDR protocol=HTTP attributeName=source
... attributeValue={"ip":"192.168.41.67","port":1,"addrType":4,"protocol":6}
${ipObj1} Create Dictionary attributeType=ip tableName=TSG_OBJ_IP_ADDR protocol=HTTP attributeName=destination
${ipObj} Create Dictionary attributeType=ip tableName=TSG_SECURITY_SOURCE_ADDR protocol=HTTP attributeName=source
... attributeValue={"ip":"192.168.41.67","port":1,"addrType":4,"protocol":6}
${ipObj1} Create Dictionary attributeType=ip tableName=TSG_SECURITY_DESTINATION_ADDR protocol=HTTP attributeName=destination
... attributeValue={"ip":"192.168.41.68","port":1,"addrType":4,"protocol":6}
${stringValue} Create Dictionary string=*baidu.com
${stringObj} Create Dictionary attributeType=string tableName=TSG_OBJ_URL protocol=HTTP attributeName=url
... attributeValue=${stringValue}
@@ -511,10 +513,10 @@ Policy-Verify-v1-00021
Policy-Verify-v1-00022
${objectIds} Set Variable ${EMPTY}
Comment 创建对象
${ipObj} Create Dictionary attributeType=ip tableName=TSG_OBJ_IP_ADDR protocol=HTTP attributeName=destination
... attributeValue={"ip":"192.168.41.67","port":1,"addrType":4,"protocol":6}
${ipObj1} Create Dictionary attributeType=ip tableName=TSG_OBJ_IP_ADDR protocol=HTTP attributeName=source
... attributeValue={"ip":"192.168.41.67","port":1,"addrType":4,"protocol":6}
${ipObj} Create Dictionary attributeType=ip protocol=HTTP attributeName=destination
... attributeValue={"ip":"192.168.41.67","port":1,"addrType":4,"protocol":6,"tableName":"TSG_SECURITY_DESTINATION_ADDR"}
${ipObj1} Create Dictionary attributeType=ip protocol=HTTP attributeName=source
... attributeValue={"ip":"192.168.41.68","port":1,"addrType":4,"protocol":6,"tableName":"TSG_SECURITY_SOURCE_ADDR"}
${stringObj} Create Dictionary attributeType=string tableName=TSG_OBJ_URL protocol=HTTP attributeName=url
... attributeValue={'string':'*baidu.com'}
${appIdValue} Create Dictionary string=http.
@@ -528,15 +530,38 @@ Policy-Verify-v1-00022
Policy-Verify-v1-00023
${objectIds} Set Variable ${EMPTY}
Comment 创建对象
${ipObj} Create Dictionary attributeType=ip tableName=TSG_OBJ_IP_ADDR protocol=HTTP attributeName=source
${ipObj} Create Dictionary attributeType=ip tableName=TSG_SECURITY_SOURCE_ADDR attributeName=source
... attributeValue=192.168.41.67|1|4|6
${ipObj1} Create Dictionary attributeType=ip tableName=TSG_SECURITY_DESTINATION_ADDR attributeName=destination
... attributeValue=192.168.41.68|1|4|6
${stringObj} Create Dictionary attributeType=string tableName=TSG_OBJ_URL protocol=HTTP attributeName=url
... attributeValue=*baidu.com
${stringObj1} Create Dictionary attributeType=string protocol=HTTP attributeName=url
... attributeValue=*jd.com
${appIdObj} Create Dictionary attributeType=string protocol=HTTP attributeName=app_id
... attributeValue=http.
${signatureObj} Create Dictionary attributeType=signature protocol=HTTP attributeName=req_body
... attributeValue=Content-Type|application/json
${attributes} Create List ${ipObj} ${stringObj} ${appIdObj} ${signatureObj}
${attributes} Create List ${ipObj} ${stringObj} ${appIdObj} ${signatureObj} ${ipObj1} ${stringObj1}
${verifySession} Create Dictionary attributes=${attributes}
${verifyList} Create Dictionary policyType=tsg_security verifySession=${verifySession}
${rescode} ${resData} VerifyPolicies ${verifyList}
Policy-Verify-v1dxy
${objectIds} Set Variable ${EMPTY}
Comment 创建对象
${ipObj} Create Dictionary attributeType=ip attributeName=source
... attributeValue=192.168.41.67|1|4|6|TSG_SECURITY_SOURCE_ADDR
${ipObj1} Create Dictionary attributeType=ip attributeName=destination
... attributeValue=192.168.41.68|1|4|6|TSG_SECURITY_DESTINATION_ADDR
${stringObj} Create Dictionary attributeType=string tableName=TSG_OBJ_URL protocol=HTTP attributeName=url
... attributeValue=*baidu.com
${stringObj1} Create Dictionary attributeType=string protocol=HTTP attributeName=url
... attributeValue=*jd.com
${appIdObj} Create Dictionary attributeType=string protocol=HTTP attributeName=app_id
... attributeValue=http.
${signatureObj} Create Dictionary attributeType=signature protocol=HTTP attributeName=req_body
... attributeValue=Content-Type|application/json
${attributes} Create List ${ipObj} ${stringObj} ${appIdObj} ${signatureObj} ${ipObj1} ${stringObj1}
${verifySession} Create Dictionary attributes=${attributes}
${verifyList} Create Dictionary policyType=tsg_security verifySession=${verifySession}
${rescode} ${resData} VerifyPolicies ${verifyList}

View File

@@ -436,15 +436,31 @@ ManageIpAttributeValue
Run Keyword If "${port}"=="${EMPTY}" and "${attributeName}"=="destination" Should Not Be Empty ${port}
Set To Dictionary ${dict} port=${port}
${return} ${addrType} Run Keyword And Ignore Error Set Variable ${attributeValue['addrType']}
Run Keyword If "${port}"=="${EMPTY}" and "${attributeName}"=="source" Should Not Be Empty ${addrType}
Run Keyword If "${port}"=="${EMPTY}" and "${attributeName}"=="destination" Should Not Be Empty ${addrType}
Run Keyword If "${addrType}"=="${EMPTY}" and "${attributeName}"=="source" Should Not Be Empty ${addrType}
Run Keyword If "${addrType}"=="${EMPTY}" and "${attributeName}"=="destination" Should Not Be Empty ${addrType}
Set To Dictionary ${dict} addrType=${addrType}
${return} ${protocol} Run Keyword And Ignore Error Set Variable ${attributeValue['protocol']}
Run Keyword If "${port}"=="${EMPTY}" and "${attributeName}"=="source" Should Not Be Empty ${protocol}
Run Keyword If "${port}"=="${EMPTY}" and "${attributeName}"=="destination" Should Not Be Empty ${protocol}
Set To Dictionary ${dict} protocol=${protocol}
Run Keyword If "${protocol}"=="${EMPTY}" and "${attributeName}"=="source" Should Not Be Empty ${protocol}
Run Keyword If "${protocol}"=="${EMPTY}" and "${attributeName}"=="destination" Should Not Be Empty ${protocol}
Set To Dictionary ${dict} protocol=${protocol}
${return} ${tableName} Run Keyword And Ignore Error Set Variable ${attributeValue['tableName']}
Run Keyword If "${tableName}"=="${EMPTY}" and "${attributeName}"=="source" Should Not Be Empty ${tableName}
Run Keyword If "${tableName}"=="${EMPTY}" and "${attributeName}"=="destination" Should Not Be Empty ${tableName}
Set To Dictionary ${dict} tableName=${tableName}
[Return] ${dict}
ExtractIpAttributeValue
[Arguments] ${attributeValue}
${list} Split String ${attributeValue} |
${len} Get Length ${list}
Should Be Equal As Integers ${len} 5
${addrType} Evaluate int(${list}[2])
${protocol} Set Variable ${list}[3]
${tableName} Set Variable ${list}[4]
${dict} Create Dictionary ip=${list}[0] port=${list}[1] tableName=${tableName}
... addrType=${addrType} protocol=${protocol}
[Return] ${dict}
ExtractIpAttributeValue_bak
[Arguments] ${attributeValue}
${list} Split String ${attributeValue} |
${len} Get Length ${list}