PlatTrafficRules.robot 5.95 KB
Newer Older
1
2
3
4
5
6
*** Settings ***

Documentation
...    A test suite for validating Traffic rules (TRAF) operations.

Resource    ../../GenericKeywords.robot
Elian Kraja's avatar
Elian Kraja committed
7
8
9
Resource    environment/variables.txt
Library     REST    ${SCHEMA}://${HOST}:${PORT}    ssl_verify=false
Library     OperatingSystem 
10

Elian Kraja's avatar
Elian Kraja committed
11
Default Tags    TC_MEC_SRV_TRAF
12
13
14
15


*** Test Cases ***

Elian Kraja's avatar
Elian Kraja committed
16
TC_MEC_SRV_TRAF_001_OK
17
18
19
20
    [Documentation]
    ...    Check that the IUT responds with a list of available traffic rules
    ...    when queried by a MEC Application
    ...
21
22
    ...    Reference    ETSI GS MEC 011 V2.1.1, clause 7.2.7.3.1
    ...    OpenAPI    https://forge.etsi.org/rep/mec/gs011-app-enablement-api/blob/master/MecAppSupportApi.yaml#/definitions/TrafficRule
23
24

    [Tags]    PIC_MEC_PLAT    PIC_SERVICES
Elian Kraja's avatar
Elian Kraja committed
25
    Get list of traffic rules    ${APP_INSTANCE_ID}
26
27
28
29
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is    TrafficRuleList


Elian Kraja's avatar
Elian Kraja committed
30
TC_MEC_SRV_TRAF_001_NF
31
32
33
34
    [Documentation]
    ...    Check that the IUT responds with an error when
    ...    a request for an unknown URI is sent by a MEC Application
    ...
Elian Kraja's avatar
Elian Kraja committed
35
    ...    Reference    ETSI GS MEC 011 V2.0.9, clause 7.2.8.3.1
36
37

    [Tags]    PIC_MEC_PLAT    PIC_SERVICES
Elian Kraja's avatar
Elian Kraja committed
38
    Get list of traffic rules    ${NON_EXISTENT_APP_INSTANCE_ID}
39
40
41
    Check HTTP Response Status Code Is    404


Elian Kraja's avatar
Elian Kraja committed
42
TC_MEC_SRV_TRAF_002_OK
43
44
45
46
    [Documentation]
    ...    Check that the IUT responds with the information on a specific traffic rule
    ...    when queried by a MEC Application
    ...
47
48
    ...    Reference    ETSI GS MEC 011 V2.1.1, clause 7.2.8.3.1
    ...    OpenAPI    https://forge.etsi.org/rep/mec/gs011-app-enablement-api/blob/master/MecAppSupportApi.yaml#/definitions/TrafficRule
49
50

    [Tags]    PIC_MEC_PLAT    PIC_SERVICES
Elian Kraja's avatar
Elian Kraja committed
51
    Get individual traffic rule    ${APP_INSTANCE_ID}    ${TRAFFIC_RULE_ID}
52
53
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is    TrafficRule
Elian Kraja's avatar
Elian Kraja committed
54
    Check Response Contains    ${response['body']}    trafficRuleId    ${TRAFFIC_RULE_ID}
55
56


Elian Kraja's avatar
Elian Kraja committed
57
TC_MEC_SRV_TRAF_003_OK
58
59
60
61
    [Documentation]
    ...    Check that the IUT updates a specific traffic rule
    ...    when commanded by a MEC Application
    ...
62
63
    ...    Reference    ETSI GS MEC 011 V2.1.1, clause 7.2.8.3.2
    ...    OpenAPI    https://forge.etsi.org/rep/mec/gs011-app-enablement-api/blob/master/MecAppSupportApi.yaml#/definitions/TrafficRule
64
65

    [Tags]    PIC_MEC_PLAT    PIC_SERVICES
Elian Kraja's avatar
Elian Kraja committed
66
    Update a traffic rule    ${APP_INSTANCE_ID}    ${TRAFFIC_RULE_ID}    TrafficRuleUpdate
67
68
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is    TrafficRule
Elian Kraja's avatar
Elian Kraja committed
69
70
    Check Response Contains    ${response['body']}    trafficRuleId    ${TRAFFIC_RULE_ID} 
    Check Response Contains    ${response['body']}    action    DROP
71
72


Elian Kraja's avatar
Elian Kraja committed
73
TC_MEC_SRV_TRAF_003_BR
74
75
76
77
    [Documentation]
    ...    Check that the IUT responds with an error when
    ...    a request with incorrect parameters is sent by a MEC Application
    ...
78
79
    ...    Reference    ETSI GS MEC 011 V2.1.1, clause 7.2.8.3.2
    ...    OpenAPI    https://forge.etsi.org/rep/mec/gs011-app-enablement-api/blob/master/MecAppSupportApi.yaml#/definitions/TrafficRule
80
81

    [Tags]    PIC_MEC_PLAT    PIC_SERVICES
Elian Kraja's avatar
Elian Kraja committed
82
    Update a traffic rule    ${APP_INSTANCE_ID}    ${TRAFFIC_RULE_ID}    TrafficRuleUpdateError
83
84
85
    Check HTTP Response Status Code Is    400


Elian Kraja's avatar
Elian Kraja committed
86
TC_MEC_SRV_TRAF_003_NF
87
88
89
90
    [Documentation]
    ...    Check that the IUT responds with an error when
    ...    a request for an unknown URI is sent by a MEC Application
    ...
91
92
    ...    Reference    ETSI GS MEC 011 V2.1.1, clause 7.2.8.3.2
    ...    OpenAPI    https://forge.etsi.org/rep/mec/gs011-app-enablement-api/blob/master/MecAppSupportApi.yaml#/definitions/TrafficRule
93
94

    [Tags]    PIC_MEC_PLAT    PIC_SERVICES
Elian Kraja's avatar
Elian Kraja committed
95
    Update a traffic rule    ${APP_INSTANCE_ID}    ${NON_EXISTENT_TRAFFIC_RULE_ID}    TrafficRuleUpdate
96
97
98
    Check HTTP Response Status Code Is    404


Elian Kraja's avatar
Elian Kraja committed
99
TC_MEC_SRV_TRAF_003_PF
100
101
102
103
    [Documentation]
    ...    Check that the IUT responds with an error when
    ...    a request sent by a MEC Application doesn't comply with a required condition
    ...
104
105
    ...    Reference    ETSI GS MEC 011 V2.1.1, clause 7.2.8.3.2
    ...    OpenAPI    https://forge.etsi.org/rep/mec/gs011-app-enablement-api/blob/master/MecAppSupportApi.yaml#/definitions/TrafficRule
106
107

    [Tags]    PIC_MEC_PLAT    PIC_SERVICES
Elian Kraja's avatar
Elian Kraja committed
108
    Update a traffic rule with invalid etag   ${APP_INSTANCE_ID}    ${TRAFFIC_RULE_ID}    TrafficRuleUpdate
109
110
    Check HTTP Response Status Code Is    412

Elian Kraja's avatar
Elian Kraja committed
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
*** Keywords ***
Get list of traffic rules   
    [Arguments]     ${appInstanceId}
    Set Headers    {"Accept":"application/json"}
    Set Headers    {"Authorization":"${TOKEN}"}
    Get    ${apiRoot}/${apiName}/${apiVersion}/applications/${appInstanceId}/traffic_rules
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}
    
Get individual traffic rule    
    [Arguments]     ${appInstanceId}    ${trafficRuleId}
    Set Headers    {"Accept":"application/json"}
    Set Headers    {"Authorization":"${TOKEN}"}
    Get    ${apiRoot}/${apiName}/${apiVersion}/applications/${appInstanceId}/traffic_rules/${trafficRuleId}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}
    
Update a traffic rule    
    [Arguments]    ${appInstanceId}    ${trafficRuleId}    ${content}
    Set Headers    {"Accept":"application/json"}
    Set Headers    {"Content-Type":"application/json"}
    Set Headers    {"Authorization":"${TOKEN}"}
    ${file}=    Catenate    SEPARATOR=    jsons/    ${content}    .json
    ${body}=    Get File    ${file}
135
    PUT    ${apiRoot}/${apiName}/${apiVersion}/applications/${appInstanceId}/traffic_rules/${trafficRuleId}    ${body}
Elian Kraja's avatar
Elian Kraja committed
136
137
138
139
140
141
142
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}
    
Update a traffic rule with invalid etag
    [Arguments]    ${appInstanceId}    ${trafficRuleId}    ${content}
    Set Headers    {"If-Match": "${INVALID_ETAG}"}
    Update a traffic rule    ${appInstanceId}    ${trafficRuleId}    ${content}