diff --git a/01-TestCase/tsg_adc/basic_function_check/a_Intercept_001.robot b/01-TestCase/tsg_adc/basic_function_check/a_Intercept_001.robot new file mode 100644 index 0000000..9cce9f3 --- /dev/null +++ b/01-TestCase/tsg_adc/basic_function_check/a_Intercept_001.robot @@ -0,0 +1,24 @@ +*** Settings *** +Force Tags basic_function_check adc_api security_policy check_intercept +Library OperatingSystem +Resource ../../../02-Keyword/tsg_adc/SystemCommand.robot +Resource ../../../02-Keyword/tsg_bfapi/PolicyObject.robot +Resource ../../../02-Keyword/tsg_bfapi/LogVariable.robot +Resource ../../../02-Keyword/tsg_adc/FileOperation.robot +Resource ../../../02-Keyword/tsg_adc/FileOperation.robot +Resource ../../../02-Keyword/tsg_bfapi/policy_object/Policy.robot +Resource ../../../03-Variable/ApplicationID.txt +Resource ../../../02-Keyword/tsg_bfapi/policy_object/ProcessPolicyBody.robot + +*** Variables *** + +*** Test Cases *** +SecurityPolicy-Intercept-001 + [Tags] update policy:source geo + Comment 创建安全策略 + ${policyDict} Create Dictionary policyName=SecurityPolicy-Intercept-001 policyType=tsg_security policyDesc=autotest action=intercept userRegion={"protocol":"SSL","keyring":1,"decryption":1,"decrypt_mirror":{"enable":0,"mirror_profile":null}} isValid=${1} appIdObjects=${SSL_ID},${HTTP_ID} + log ${policyDict} + ${rescode} ${policyId} AddPolicies 1 ${policyDict} v2 + ${policyId} Get-Pids ${policyId} + ${policyId} Set Variable ${policyId}[0] + insert_policyId_to_file1 intercept_ssl_policyId ${policyId} \ No newline at end of file diff --git a/01-TestCase/tsg_adc/basic_function_check/a_allow_Check_001.robot b/01-TestCase/tsg_adc/basic_function_check/a_allow_Check_001.robot new file mode 100644 index 0000000..ff5b2fd --- /dev/null +++ b/01-TestCase/tsg_adc/basic_function_check/a_allow_Check_001.robot @@ -0,0 +1,257 @@ +*** Settings *** +Force Tags basic_function_check adc_api security_policy check_allow +Library OperatingSystem +Resource ../../../02-Keyword/tsg_adc/SystemCommand.robot +Resource ../../../02-Keyword/tsg_bfapi/PolicyObject.robot +Resource ../../../02-Keyword/tsg_bfapi/LogVariable.robot +Resource ../../../02-Keyword/tsg_adc/FileOperation.robot +Resource ../../../02-Keyword/tsg_adc/FileOperation.robot +Resource ../../../02-Keyword/tsg_bfapi/policy_object/Policy.robot +Resource ../../../03-Variable/ApplicationID.txt +Resource ../../../02-Keyword/tsg_bfapi/policy_object/ProcessPolicyBody.robot + +*** Variables *** + +*** Test Cases *** +ProxyPolicy-allow-Check-001 + [Tags] fqdn完全匹配 URL子串匹配 请求头UA-子串匹配 请求头Cookie-子串匹配 应答头Content-Type-子串匹配 + Comment 创建fqdn + ${objectDict} Create Dictionary objectType=fqdn isValid=${1} addItemList=$www.52pojie.cn + ${rescode} ${objectId} AddObject2 ${1} ${objectDict} + + Comment 创建url + ${objectDict} Create Dictionary objectType=url isValid=${1} addItemList=misc.php + ${rescode} ${objectId1} AddObject2 ${1} ${objectDict} + + Comment 创建请求头UA + ${objectDict} Create Dictionary objectType=http_signature isValid=${1} addItemList=Mozilla/5.0|User-Agent + ${rescode} ${objectId2} AddObject2 ${1} ${objectDict} + + Comment 创建请求头Cookie + ${objectDict} Create Dictionary objectType=http_signature isValid=${1} addItemList=htVD_|Cookie + ${rescode} ${objectId3} AddObject2 ${1} ${objectDict} + + Comment 创建应答头Content-Type + ${objectDict} Create Dictionary objectType=http_signature isValid=${1} addItemList=text/html|Content-Type + ${rescode} ${objectId4} AddObject2 ${1} ${objectDict} + + + Comment 创建allow策略 + ${policyDict} Create Dictionary policyName=ProxyPolicy-allow-Check-001 policyType=pxy_manipulation policyDesc=autotest + ... action=allow userRegion={"method":"allow","protocol":"HTTP"} + ... filterList=${objectId}|TSG_FIELD_HTTP_HOST,${objectId1}|TSG_FIELD_HTTP_URL,${objectId2}|TSG_FIELD_HTTP_REQ_HDR,${objectId3}|TSG_FIELD_HTTP_REQ_HDR,${objectId4}|TSG_FIELD_HTTP_RES_HDR isValid=${1} appIdObjects=${HTTP_ID} + log ${policyDict} + + ${rescode} ${policyId2} AddPolicies 1 ${policyDict} v2 + ${policyId2} Get-Pids ${policyId2} + ${policyId2} Set Variable ${policyId2}[0] + + insert_policyId_to_file1 allow_objectId ${objectId} + insert_policyId_to_file1 allow_objectId39 ${objectId1} + insert_policyId_to_file1 allow_objectId40 ${objectId2} + insert_policyId_to_file1 allow_objectId41 ${objectId3} + insert_policyId_to_file1 allow_objectId42 ${objectId4} + insert_policyId_to_file1 allow_policyId ${policyId2} + + +ProxyPolicy-allow-Check-002 + [Tags] fqdn右匹配 URL左匹配 请求头UA-左匹配 应答头Set-Cookie-左匹配 应答头Content-Type-左匹配 + Comment 创建fqdn + ${objectDict} Create Dictionary objectType=fqdn isValid=${1} addItemList=*wancai.com + ${rescode} ${objectId} AddObject2 ${1} ${objectDict} + + Comment 创建url + ${objectDict} Create Dictionary objectType=url isValid=${1} addItemList=www.wancai* + ${rescode} ${objectId1} AddObject2 ${1} ${objectDict} + + Comment 创建请求头UA + ${objectDict} Create Dictionary objectType=http_signature isValid=${1} addItemList=Mozilla/5.0*|User-Agent + ${rescode} ${objectId2} AddObject2 ${1} ${objectDict} + + Comment 创建应答头Set-Cookie + ${objectDict} Create Dictionary objectType=http_signature isValid=${1} addItemList=SERVERID=1*|Set-Cookie + ${rescode} ${objectId3} AddObject2 ${1} ${objectDict} + + Comment 创建应答头Content-Type + ${objectDict} Create Dictionary objectType=http_signature isValid=${1} addItemList=text*|Content-Type + ${rescode} ${objectId4} AddObject2 ${1} ${objectDict} + + + Comment 创建allow策略 + ${policyDict} Create Dictionary policyName=ProxyPolicy-allow-Check-002 policyType=pxy_manipulation policyDesc=autotest action=allow userRegion={"method":"allow","protocol":"HTTP"} + ... filterList=${objectId}|TSG_FIELD_HTTP_HOST,${objectId1}|TSG_FIELD_HTTP_URL,${objectId2}|TSG_FIELD_HTTP_REQ_HDR,${objectId3}|TSG_FIELD_HTTP_REQ_HDR,${objectId4}|TSG_FIELD_HTTP_RES_HDR isValid=${1} appIdObjects=${HTTP_ID} + log ${policyDict} + + ${rescode} ${policyId2} AddPolicies 1 ${policyDict} v2 + ${policyId2} Get-Pids ${policyId2} + ${policyId2} Set Variable ${policyId2}[0] + insert_policyId_to_file1 allow_objectId ${objectId} + insert_policyId_to_file1 allow_objectId39 ${objectId1} + insert_policyId_to_file1 allow_objectId40 ${objectId2} + insert_policyId_to_file1 allow_objectId41 ${objectId3} + insert_policyId_to_file1 allow_objectId42 ${objectId4} + insert_policyId_to_file1 allow_policyId ${policyId2} + + +ProxyPolicy-allow-Check-003 + [Tags] fqdn完全匹配 URL右匹配 请求头UA-右匹配 应答头Set-Cookie-右匹配 应答头Content-Type-右匹配 + Comment 创建fqdn + ${objectDict} Create Dictionary objectType=fqdn isValid=${1} addItemList=$www.stonexp.com + ${rescode} ${objectId} AddObject2 ${1} ${objectDict} + + Comment 创建url + ${objectDict} Create Dictionary objectType=url isValid=${1} addItemList=stonexp + ${rescode} ${objectId1} AddObject2 ${1} ${objectDict} + + Comment 创建请求头UA + ${objectDict} Create Dictionary objectType=http_signature isValid=${1} addItemList=*Safari/537.36|User-Agent + ${rescode} ${objectId2} AddObject2 ${1} ${objectDict} + + Comment 创建应答头Set-Cookie + ${objectDict} Create Dictionary objectType=http_signature isValid=${1} addItemList=*path=/|Set-Cookie + ${rescode} ${objectId3} AddObject2 ${1} ${objectDict} + + Comment 创建应答头Content-Type + ${objectDict} Create Dictionary objectType=http_signature isValid=${1} addItemList=*utf-8|Content-Type + ${rescode} ${objectId4} AddObject2 ${1} ${objectDict} + + + Comment 创建allow策略 + ${policyDict} Create Dictionary policyName=ProxyPolicy-allow-Check-003 policyType=pxy_manipulation policyDesc=autotest action=allow userRegion={"method":"allow","protocol":"HTTP"} + ... filterList=${objectId}|TSG_FIELD_HTTP_HOST,${objectId1}|TSG_FIELD_HTTP_URL,${objectId2}|TSG_FIELD_HTTP_REQ_HDR,${objectId3}|TSG_FIELD_HTTP_REQ_HDR,${objectId4}|TSG_FIELD_HTTP_RES_HDR isValid=${1} appIdObjects=${HTTP_ID} + log ${policyDict} + + ${rescode} ${policyId2} AddPolicies 1 ${policyDict} v2 + ${policyId2} Get-Pids ${policyId2} + ${policyId2} Set Variable ${policyId2}[0] + insert_policyId_to_file1 allow_objectId ${objectId} + insert_policyId_to_file1 allow_objectId39 ${objectId1} + insert_policyId_to_file1 allow_objectId40 ${objectId2} + insert_policyId_to_file1 allow_objectId41 ${objectId3} + insert_policyId_to_file1 allow_objectId42 ${objectId4} + insert_policyId_to_file1 allow_policyId ${policyId2} + + +ProxyPolicy-allow-Check-004 + [Tags] fqdn完全匹配 URL完全匹配 请求头UA-完全匹配 应答头Content-Type-完全匹配 + Comment 创建fqdn + ${objectDict} Create Dictionary objectType=fqdn isValid=${1} addItemList=$www.qnly.com + ${rescode} ${objectId} AddObject2 ${1} ${objectDict} + + Comment 创建url + ${objectDict} Create Dictionary objectType=url isValid=${1} addItemList=$www.qnly.com/tours/ + ${rescode} ${objectId1} AddObject2 ${1} ${objectDict} + + Comment 创建请求头UA + ${objectDict} Create Dictionary objectType=http_signature isValid=${1} addItemList=$Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.182 Safari/537.36|User-Agent + log ${objectDict} + ${rescode} ${objectId2} AddObject2 ${1} ${objectDict} + log ${rescode} + + Comment 创建应答头Content-Type + ${objectDict} Create Dictionary objectType=http_signature isValid=${1} addItemList=$text/html|Content-Type + ${rescode} ${objectId3} AddObject2 ${1} ${objectDict} + + + Comment 创建allow策略 + ${policyDict} Create Dictionary policyName=ProxyPolicy-allow-Check-004 policyType=pxy_manipulation policyDesc=autotest action=allow userRegion={"method":"allow","protocol":"HTTP"} + ... filterList=${objectId}|TSG_FIELD_HTTP_HOST,${objectId1}|TSG_FIELD_HTTP_URL,${objectId2}|TSG_FIELD_HTTP_REQ_HDR,${objectId3}|TSG_FIELD_HTTP_RES_HDR isValid=${1} appIdObjects=${HTTP_ID} + log ${policyDict} + + ${rescode} ${policyId2} AddPolicies 1 ${policyDict} v2 + ${policyId2} Get-Pids ${policyId2} + ${policyId2} Set Variable ${policyId2}[0] + insert_policyId_to_file1 allow_objectId ${objectId} + insert_policyId_to_file1 allow_objectId39 ${objectId1} + insert_policyId_to_file1 allow_objectId40 ${objectId2} + insert_policyId_to_file1 allow_objectId42 ${objectId3} + insert_policyId_to_file1 allow_policyId ${policyId2} + + +ProxyPolicy-allow-Check-005 + [Tags] fqdn完全匹配 URL子串匹配 请求头UA-16进制 应答头Set-Cookie-16进制 应答头Content-Type-16进制 + # + # + # + #暂未找到16进制关键字 + # + Comment 创建fqdn + ${objectDict} Create Dictionary objectType=fqdn isValid=${1} addItemList=$www.5ytb.com + ${rescode} ${objectId} AddObject2 ${1} ${objectDict} + + Comment 创建url + ${objectDict} Create Dictionary objectType=url isValid=${1} addItemList=5ytb + ${rescode} ${objectId1} AddObject2 ${1} ${objectDict} + + Comment 创建请求头UA + ${objectDict} Create Dictionary objectType=http_signature isValid=${1} addItemList=4d6f7a696c6c612f352e30|User-Agent + ${rescode} ${objectId2} AddObject2 ${1} ${objectDict} + + Comment 创建请求头Set-Cookie + ${objectDict} Create Dictionary objectType=http_signature isValid=${1} addItemList=487474704f6e6c79|Set-Cookie + ${rescode} ${objectId3} AddObject2 ${1} ${objectDict} + + Comment 创建应答头Content-Type + ${objectDict} Create Dictionary objectType=http_signature isValid=${1} addItemList=74657874|Content-Type + ${rescode} ${objectId4} AddObject2 ${1} ${objectDict} + + + Comment 创建allow策略 + ${policyDict} Create Dictionary policyName=ProxyPolicy-allow-Check-005 policyType=pxy_manipulation policyDesc=autotest action=allow userRegion={"method":"allow","protocol":"HTTP"} + ... filterList=${objectId}|TSG_FIELD_HTTP_HOST,${objectId1}|TSG_FIELD_HTTP_URL,${objectId2}|TSG_FIELD_HTTP_REQ_HDR,${objectId3}|TSG_FIELD_HTTP_REQ_HDR,${objectId4}|TSG_FIELD_HTTP_RES_HDR isValid=${1} appIdObjects=${HTTP_ID} + log ${policyDict} + + ${rescode} ${policyId2} AddPolicies 1 ${policyDict} v2 + ${policyId2} Get-Pids ${policyId2} + ${policyId2} Set Variable ${policyId2}[0] + insert_policyId_to_file1 allow_objectId ${objectId} + insert_policyId_to_file1 allow_objectId39 ${objectId1} + insert_policyId_to_file1 allow_objectId40 ${objectId2} + insert_policyId_to_file1 allow_objectId41 ${objectId3} + insert_policyId_to_file1 allow_objectId42 ${objectId4} + insert_policyId_to_file1 allow_policyId ${policyId2} + + +ProxyPolicy-allow-Check-006 + [Tags] fqdn右匹配 URL子串匹配 请求头UA-16进制 应答头Set-Cookie-子串匹配 应答头Content-Type-16进制 + # + # + # + # + #暂未找到16进制 + # + Comment 创建fqdn + ${objectDict} Create Dictionary objectType=fqdn isValid=${1} addItemList=$www.52pojie.cn + ${rescode} ${objectId} AddObject2 ${1} ${objectDict} + + Comment 创建url + ${objectDict} Create Dictionary objectType=url isValid=${1} addItemList=misc.php + ${rescode} ${objectId1} AddObject2 ${1} ${objectDict} + + Comment 创建请求头UA + ${objectDict} Create Dictionary objectType=http_signature isValid=${1} addItemList=Mozilla/5.0|User-Agent + ${rescode} ${objectId2} AddObject2 ${1} ${objectDict} + + Comment 创建请求头Cookie + ${objectDict} Create Dictionary objectType=http_signature isValid=${1} addItemList=htVD_|Cookie + ${rescode} ${objectId3} AddObject2 ${1} ${objectDict} + + Comment 创建应答头Content-Type + ${objectDict} Create Dictionary objectType=http_signature isValid=${1} addItemList=text/html|Content-Type + ${rescode} ${objectId4} AddObject2 ${1} ${objectDict} + + + Comment 创建allow策略 + ${policyDict} Create Dictionary policyName=ProxyPolicy-allow-Check-006 policyType=pxy_manipulation policyDesc=autotest action=allow userRegion={"method":"allow","protocol":"HTTP"} + ... filterList=${objectId}|TSG_FIELD_HTTP_HOST,${objectId1}|TSG_FIELD_HTTP_URL,${objectId2}|TSG_FIELD_HTTP_REQ_HDR,${objectId3}|TSG_FIELD_HTTP_REQ_HDR,${objectId4}|TSG_FIELD_HTTP_RES_HDR isValid=${1} appIdObjects=${HTTP_ID} + log ${policyDict} + + ${rescode} ${policyId2} AddPolicies 1 ${policyDict} v2 + ${policyId2} Get-Pids ${policyId2} + ${policyId2} Set Variable ${policyId2}[0] + insert_policyId_to_file1 allow_objectId ${objectId} + insert_policyId_to_file1 allow_objectId39 ${objectId1} + insert_policyId_to_file1 allow_objectId40 ${objectId2} + insert_policyId_to_file1 allow_objectId41 ${objectId3} + insert_policyId_to_file1 allow_objectId42 ${objectId4} + insert_policyId_to_file1 allow_policyId ${policyId2} \ No newline at end of file