diff --git a/01-TestCase/tsg_bfapi/policy_object/PolicyObjectTests.robot b/01-TestCase/tsg_bfapi/policy_object/PolicyObjectTests.robot index 7aa037e..fa36af2 100644 --- a/01-TestCase/tsg_bfapi/policy_object/PolicyObjectTests.robot +++ b/01-TestCase/tsg_bfapi/policy_object/PolicyObjectTests.robot @@ -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} diff --git a/02-Keyword/tsg_bfapi/policy_object/ProcessPolicyBody.robot b/02-Keyword/tsg_bfapi/policy_object/ProcessPolicyBody.robot index c9a3553..d85e319 100644 --- a/02-Keyword/tsg_bfapi/policy_object/ProcessPolicyBody.robot +++ b/02-Keyword/tsg_bfapi/policy_object/ProcessPolicyBody.robot @@ -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}