summaryrefslogtreecommitdiff
path: root/case/multi_step/a_allow_http_tests.robot
blob: db555128cf91feb0743ab5c3e7b33dc17d4ba4e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
*** Settings ***
Force Tags        tsg_adc_wp    adc_api    security_policy
Library           OperatingSystem
Resource          ../../keyword/common/systemcommand.robot
Resource          ../../keyword/common/log_variable.robot
Resource          ../../keyword/common/file_operation.robot
Resource          ../../keyword/objects/object.robot
Resource          ../../keyword/policys/policy.robot
*** Test Cases ***
security_policy_allow_http-00001
    [Tags]    fqdn right match,whole world match,ip geo,url    
    Comment    创建fqdn
    ${addItemList1}    Create Dictionary    keywordArray=*clintonairport.com    isHexbin=${0}
    ${addItemLists}    Create list    ${addItemList1}
    ${objectDict}    Create Dictionary    objectType=fqdn    objectSubType=fqdn       isValid=${1}    addItemList=${addItemLists}    
    ${rescode}    ${objectId}    AddObjects    ${1}    ${objectDict}
    Comment    创建url
    ${addItemList1}    Create Dictionary    keywordArray=$clintonairport.com/airlines-flights/covid/   isHexbin=${0}
    ${addItemLists}    Create list    ${addItemList1}
    ${objectDict}    Create Dictionary    objectType=url    objectSubType=url       isValid=${1}    addItemList=${addItemLists}    
    ${rescode}    ${objectId1}    AddObjects    ${1}    ${objectDict}
    Comment    创建ip geo
    ${addItemList1}    Create Dictionary    keywordArray=XXG地区.*
    ${addItemLists}    Create list    ${addItemList1}
    ${objectDict}    Create Dictionary    objectType=ip     objectSubType=geo_location    isValid=${1}    addItemList=${addItemLists}    
    ${rescode}    ${objectId2}    AddObjects    ${1}    ${objectDict}
    Comment    创建fqdn2
    ${addItemList1}    Create Dictionary    keywordArray=$www.66rpg.com    isHexbin=${0}
    ${addItemLists}    Create list    ${addItemList1}
    ${objectDict}    Create Dictionary    objectType=fqdn    objectSubType=fqdn       isValid=${1}    addItemList=${addItemLists}    
    ${rescode}    ${objectId3}    AddObjects    ${1}    ${objectDict}
    Comment    创建url2
    ${addItemList1}    Create Dictionary    keywordArray=66rpg   isHexbin=${0}
    ${addItemLists}    Create list    ${addItemList1}
    ${objectDict}    Create Dictionary    objectType=url    objectSubType=url       isValid=${1}    addItemList=${addItemLists}    
    ${rescode}    ${objectId4}    AddObjects    ${1}    ${objectDict}
    Comment    创建categories
    ${addItemList1}    Create Dictionary    fqdn=*clintonairport.com
    ${addItemLists}    Create list    ${addItemList1}
    ${objectDict}    Create Dictionary    categoryType=fqdn    categoryName=feiji    objectSubType=category      isValid=${1}      fqdnList=${addItemLists}    
    ${rescode}    ${categoryObjId}    ${categoryId}       AddCategories    ${1}    ${objectDict}    add    200
    Comment    创建安全策略
    ${policyDict}    Create Dictionary    policyName=security_policy_allow_http-00001    policyType=tsg_security    policyDesc=autotest    action=allow    userRegion={"protocol":"HTTP"}      doLog=1      filterList=${objectId}|TSG_FIELD_HTTP_HOST,${objectId1}|TSG_FIELD_HTTP_URL,${categoryObjId}|TSG_FIELD_HTTP_HOST    isValid=${1}    appIdObjects=${HTTP_ID}
    log    ${policyDict}
    ${rescode}    ${policyId}    AddPolicies    1    ${policyDict}    v2
    ${policyId}    GetPids    ${policyId}
    ${policyId}    Set Variable    ${policyId}[0]
    InsertObjectIdToFile    allow_http_objectId    ${objectId}
    InsertObjectIdToFile    allow_http_objectId2    ${objectId1}
    InsertObjectIdToFile    allow_http_objectId3    ${objectId2}
    InsertObjectIdToFile    allow_http_objectId4    ${objectId3}
    InsertObjectIdToFile    allow_http_objectId5    ${objectId4}
    InsertObjectIdToFile    allow_http_policyId    ${policyId}
    InsertObjectIdToFile    allow_http_categoryId    ${categoryId}

security_policy_allow_http-00002
    [Tags]    cat,fqdn 完全匹配,url左匹配       update policy:url右匹配
    Comment    创建fqdn
    ${addItemList1}    Create Dictionary    keywordArray=$scoutbahamas.org    isHexbin=${0}
    ${addItemLists}    Create list    ${addItemList1}
    ${objectDict}    Create Dictionary    objectType=fqdn    objectSubType=fqdn       isValid=${1}    addItemList=${addItemLists}    
    ${rescode}    ${objectId}    AddObjects    ${1}    ${objectDict}
    Comment    创建url
    ${addItemList1}    Create Dictionary    keywordArray=scoutbah*   isHexbin=${0}
    ${addItemLists}    Create list    ${addItemList1}
    ${objectDict}    Create Dictionary    objectType=url    objectSubType=url       isValid=${1}    addItemList=${addItemLists}    
    ${rescode}    ${objectId1}    AddObjects    ${1}    ${objectDict}
    Comment    创建fqdn2
    ${addItemList1}    Create Dictionary    keywordArray=*ang5.com    isHexbin=${0}
    ${addItemLists}    Create list    ${addItemList1}
    ${objectDict}    Create Dictionary    objectType=fqdn    objectSubType=fqdn       isValid=${1}    addItemList=${addItemLists}    
    ${rescode}    ${objectId2}    AddObjects    ${1}    ${objectDict}
    Comment    创建url2
    ${addItemList1}    Create Dictionary    keywordArray=*w.xiang5.com/  isHexbin=${0}
    ${addItemLists}    Create list    ${addItemList1}
    ${objectDict}    Create Dictionary    objectType=url    objectSubType=url       isValid=${1}    addItemList=${addItemLists}    
    ${rescode}    ${objectId3}    AddObjects    ${1}    ${objectDict}
    Comment    创建安全策略
    ${policyDict}    Create Dictionary    policyName=security_policy_allow_http-00002    policyType=tsg_security    policyDesc=autotest    action=allow    userRegion={"protocol":"HTTP"}    doLog=1    filterList=${objectId}|TSG_FIELD_HTTP_HOST,${objectId1}|TSG_FIELD_HTTP_URL    isValid=${1}    appIdObjects=${HTTP_ID}
    log    ${policyDict}
    ${rescode}    ${policyId}    AddPolicies    1    ${policyDict}    v2
    ${policyId}    GetPids    ${policyId}
    ${policyId}    Set Variable    ${policyId}[0]
    InsertObjectIdToFile    allow_http_objectId1    ${objectId}
    InsertObjectIdToFile    allow_http_objectId6    ${objectId1}
    InsertObjectIdToFile    allow_http_objectId7    ${objectId2}
    InsertObjectIdToFile    allow_http_objectId8    ${objectId3}
    InsertObjectIdToFile    allow_http_policyId1    ${policyId}
    
security_policy_allow_http-00003
    [Tags]    the minimum match
    Comment    与allow00002组合验证筛选条件优先级
    Comment    创建安全策略
    ${policyDict}    Create Dictionary    policyName=security_policy_allow_http-00003    policyType=tsg_security    policyDesc=autotest    action=allow    userRegion={"protocol":"HTTP"}    doLog=1      isValid=${0}    appIdObjects=${HTTP_ID}
    log    ${policyDict}
    ${rescode}    ${policyId}    AddPolicies    1    ${policyDict}    v2
    ${policyId}    GetPids    ${policyId}
    ${policyId}    Set Variable    ${policyId}[0]
    InsertObjectIdToFile    allow_http_policyId2    ${policyId}