Thresholds.robot 13.1 KB
Newer Older
1
2
*** Settings ***
Library           JSONSchemaLibrary    schemas/
3
Resource          environment/variables.txt    # Generic Parameters
4
Library           JSONLibrary
Elian Kraja's avatar
Elian Kraja committed
5
Library           REST    ${VNFM_SCHEMA}://${VNFM_HOST}:${VNFM_PORT}    ssl_verify=false
6
7
8
9
Resource          environment/thresholds.txt
Library           OperatingSystem

*** Test Cases ***
10
11
12
13
14
GET All Performance Thresholds
    [Documentation]    Test ID: 7.3.4.4.1
    ...    Test title: GET All Performance Thresholds
    ...    Test objective: The objective is to test the retrieval of all the available VNF performance thresholds and perform a JSON schema validation of the collected thresholds data structure
    ...    Pre-conditions: A VNF instance is instantiated. One or more VNF performance thresholds are set in the VNFM.
Michele Carignani's avatar
Michele Carignani committed
15
    ...    Reference: Clause 6.4.5.3.2 - ETSI GS NFV-SOL 003 [1] v2.6.1
16
17
18
19
20
21
22
23
24
25
26
27
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: none
    ...    Post-Conditions: none
    GET all Performance Thresholds
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is   Thresholds

GET Performance Thresholds with attribute-based filter
    [Documentation]    Test ID: 7.3.4.4.2
    ...    Test title: GET Performance Thresholds with attribute-based filter
    ...    Test objective: The objective is to test the retrieval of all the available VNF performance thresholds when using attribute-based filters, perform a JSON schema validation of the collected thresholds data structure, and verify that the retrieved information matches the issued attribute-based filter
    ...    Pre-conditions: A VNF instance is instantiated. One or more VNF performance thresholds are set in the VNFM.
Michele Carignani's avatar
Michele Carignani committed
28
    ...    Reference: Clause 6.4.5.3.2 - ETSI GS NFV-SOL 003 [1] v2.6.1
29
30
31
32
33
34
35
36
37
38
39
40
41
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: none
    ...    Post-Conditions: none
    GET Performance Thresholds with attribute-based filter
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is   Thresholds
    Check HTTP Response Body Thresholds match the requested attribute-based filter

GET Performance Thresholds with invalid attribute-based filter
    [Documentation]    Test ID: 7.3.4.4.3
    ...    Test title: GET Performance Thresholds with invalid attribute-based filter
    ...    Test objective: The objective is to test that the retrieval of VNF performance thresholds fails when using invalid attribute-based filter, and perform the JSON schema validation of the failed operation HTTP response
    ...    Pre-conditions: A VNF instance is instantiated. One or more VNF performance thresholds are set in the VNFM.
Michele Carignani's avatar
Michele Carignani committed
42
    ...    Reference: Clause 6.4.5.3.2 - ETSI GS NFV-SOL 003 [1] v2.6.1
43
44
45
46
47
48
49
50
51
52
53
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: none
    ...    Post-Conditions: none
    GET Performance Thresholds with invalid attribute-based filter
    Check HTTP Response Status Code Is    404

GET Performance Thresholds with invalid resource endpoint
    [Documentation]    Test ID: 7.3.4.4.4
    ...    Test title: GET Performance Thresholds with invalid resource endpoint
    ...    Test objective: The objective is to test that the retrieval of VNF performance thresholds fails when using invalid resource endpoint, and perform the JSON schema validation of the failed operation HTTP response
    ...    Pre-conditions: A VNF instance is instantiated. One or more VNF performance thresholds are set in the VNFM.
Michele Carignani's avatar
Michele Carignani committed
54
    ...    Reference: Clause 6.4.5.3.2 - ETSI GS NFV-SOL 003 [1] v2.6.1
55
56
57
58
59
60
61
62
63
64
65
66
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: none
    ...    Post-Conditions: none
    GET VNF Performance Thresholds with invalid resource endpoint
    Check HTTP Response Status Code Is    400
    Check HTTP Response Body Json Schema Is   ProblemDetails

Create new Performance Threshold
    [Documentation]    Test ID: 7.3.4.4.5
    ...    Test title:  Create new Performance Threshold
    ...    Test objective: The objective is to test the creation of a new VNF performance threshold and perform the JSON schema validation of the returned threshold data structure
    ...    Pre-conditions: A VNF instance is instantiated.
Michele Carignani's avatar
Michele Carignani committed
67
    ...    Reference: Clause 6.4.5.3.1 - ETSI GS NFV-SOL 003 [1] v2.6.1
68
69
70
71
72
73
74
75
76
77
78
79
80
81
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: none
    ...    Post-Conditions: The VNF Performance Threshold is successfully created on the VNFM
    Send Post Request Create new Performance Threshold
    Check HTTP Response Status Code Is    201
    Check HTTP Response Body Json Schema Is   Threshold
    Check HTTP Response Header Contains    Location
    Check Postcondition Threshold Exists

PUT Performance Thresholds - Method not implemented
    [Documentation]    Test ID: 7.3.4.4.6
    ...    Test title: PUT Performance Thresholds - Method not implemented
    ...    Test objective: The objective is to test that PUT method is not allowed to modify VNF Performance Thresholds
    ...    Pre-conditions: A VNF instance is instantiated. One or more VNF performance thresholds are set in the VNF.
Michele Carignani's avatar
Michele Carignani committed
82
    ...    Reference: Clause 6.4.5.3.3 - ETSI GS NFV-SOL 003 [1] v2.6.1
83
84
85
86
87
88
89
90
91
92
93
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: none
    ...    Post-Conditions: none
    Send PUT Request for all Performance Thresholds
    Check HTTP Response Status Code Is    405

PATCH Performance Thresholds - Method not implemented
    [Documentation]    Test ID: 7.3.4.4.7
    ...    Test title: PATCH Performance Thresholds - Method not implemented
    ...    Test objective: The objective is to test that PATCH method is not allowed to modify VNF Performance Thresholds
    ...    Pre-conditions: A VNF instance is instantiated. One or more VNF performance thresholds are set in the VNFM.
Michele Carignani's avatar
Michele Carignani committed
94
    ...    Reference: Clause 6.4.5.3.4 - ETSI GS NFV-SOL 003 [1] v2.6.1
95
96
97
98
99
100
101
102
103
104
105
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: none
    ...    Post-Conditions: none
    Send PATCH Request for all Performance Thresholds
    Check HTTP Response Status Code Is    405

DELETE Performance Thresholds - Method not implemented
    [Documentation]    Test ID: 7.3.4.4.8
    ...    Test title: DELETE Performance Thresholds - Method not implemented
    ...    Test objective: The objective is to test that DELETE method is not allowed to update VNF Performance Thresholds
    ...    Pre-conditions: A VNF instance is instantiated. One or more VNF performance thresholds are set in the VNFM.
Michele Carignani's avatar
Michele Carignani committed
106
    ...    Reference: Clause 6.4.5.3.5 - ETSI GS NFV-SOL 003 [1] v2.6.1
107
108
109
110
111
112
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: none
    ...    Post-Conditions: The VNF performance thresholds are not deleted by the failed operation
    Send DELETE Request for all Performance Thresholds
    Check HTTP Response Status Code Is    405
    Check Postcondition Thresholds Exist
113
114
115
116
117
118
    
GET All Performance Thresholds as Paged Response
    [Documentation]    Test ID: 7.3.4.4.9
    ...    Test title: GET All Performance Thresholds as Paged Response
    ...    Test objective: The objective is to test the retrieval of all the available VNF performance thresholds as a Paged Response.
    ...    Pre-conditions: A VNF instance is instantiated. One or more VNF performance thresholds are set in the VNFM.
Michele Carignani's avatar
Michele Carignani committed
119
    ...    Reference: Clause 6.4.5.3.2 - ETSI GS NFV-SOL 003 [1] v2.6.1
120
121
122
123
124
125
126
127
128
129
130
131
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: none
    ...    Post-Conditions: none
    GET all Performance Thresholds
    Check HTTP Response Status Code Is    200
    Check LINK in Header
    
GET Performance Thresholds - Bad Request Response too Big
    [Documentation]    Test ID: 7.3.4.4.10
    ...    Test title: GET Performance Thresholds - Bad Request Response too Big
    ...    Test objective: The objective is to test that the retrieval of VNF performance thresholds fails because response is too big, and perform the JSON schema validation of the failed operation HTTP response
    ...    Pre-conditions: A VNF instance is instantiated. One or more VNF performance thresholds are set in the VNFM.
Michele Carignani's avatar
Michele Carignani committed
132
    ...    Reference: Clause 6.4.5.3.2 - ETSI GS NFV-SOL 003 [1] v2.6.1
133
134
135
136
137
138
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: none
    ...    Post-Conditions: none
    GET all Performance Thresholds
    Check HTTP Response Status Code Is    400
    Check HTTP Response Body Json Schema Is   ProblemDetails
139
140
141
*** Keywords ***
GET all Performance Thresholds
    Log    Trying to get all thresholds present in the VNFM    
142
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
143
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": ${AUTHORIZATION}"}
144
    GET    ${apiRoot}/${apiName}/${apiVersion}/thresholds
145
146
147
148
149
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}

GET Performance Thresholds with attribute-based filter
    Log    Trying to get thresholds present in the VNFM with filter
150
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
151
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": ${AUTHORIZATION}"}
152
    GET    ${apiRoot}/${apiName}/${apiVersion}/thresholds?${FILTER_OK}
153
154
155
156
157
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}

GET Performance Thresholds with invalid attribute-based filter
    Log    Trying to get thresholds present in the VNFM with invalid filter
158
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
159
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": ${AUTHORIZATION}"}
160
    GET    ${apiRoot}/${apiName}/${apiVersion}/thresholds?${FILTER_KO}
161
162
163
164
165
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}
    
GET VNF Performance Thresholds with invalid resource endpoint
    Log    Trying to get thresholds present in the VNFM with invalid resource endpoint
166
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
167
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": ${AUTHORIZATION}"}
168
    GET    ${apiRoot}/${apiName}/${apiVersion}/threshold
169
170
171
172
173
174
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}

Send Post Request Create new Performance Threshold
    Log    Creating a new THreshold
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": ${AUTHORIZATION}"}
175
176
177
178
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Set Headers    {"Content-Type": "${CONTENT_TYPE_JSON}"}
    ${request}=    Get File    jsons/CreateThresholdRequest.json
    POST    ${apiRoot}/${apiName}/${apiVersion}/thresholds    ${request}
179
180
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}
181

182
183
184
185
186
187
188
189
190
191
192
193
194
195
Send PUT Request for all Performance Thresholds
    Log    PUT THresholds
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": ${AUTHORIZATION}"}
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Set Headers    {"Content-Type": "${CONTENT_TYPE_JSON}"}
    PUT    ${apiRoot}/${apiName}/${apiVersion}/thresholds
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}
    
Send PATCH Request for all Performance Thresholds
    Log    PUT THresholds
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": ${AUTHORIZATION}"}
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Set Headers    {"Content-Type": "${CONTENT_TYPE_JSON}"}
196
    PATCH    ${apiRoot}/${apiName}/${apiVersion}/thresholds
197
198
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}
199

200
201
202
Send DELETE Request for all Performance Thresholds
    Log    DELETE THresholds
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": ${AUTHORIZATION}"}
203
    DELETE    ${apiRoot}/${apiName}/${apiVersion}/thresholds
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}

Check Postcondition Thresholds Exist
    Log    Checking that Thresholds still exists
    GET all Performance Thresholds
    
Check Postcondition Threshold Exists
    Log    Checking that Threshold exists
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    GET    ${apiRoot}/${apiName}/${apiVersion}/thresholds/${response['body']['id']}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is    Threshold
        
Check HTTP Response Body Thresholds match the requested attribute-based filter
    Log    Checking that attribute-based filter is matched
    #todo
    
Check HTTP Response Status Code Is
    [Arguments]    ${expected_status}
    ${status}=    Convert To Integer    ${expected_status}    
Elian Kraja's avatar
Elian Kraja committed
228
    Should Be Equal As Strings   ${response['status']}    ${status} 
229
230
231
232
233
234
235
236
237
238
    Log    Status code validated

Check HTTP Response Header Contains
    [Arguments]    ${CONTENT_TYPE}
    Should Contain    ${response['headers']}    ${CONTENT_TYPE}
    Log    Header is present
    
Check HTTP Response Body Json Schema Is
    [Arguments]    ${input}
    Should Contain    ${response['headers']['Content-Type']}    application/json
239
    ${schema} =    Catenate    SEPARATOR=    ${input}    .schema.json
240
241
242
    Validate Json    ${schema}    ${response['body']}
    Log    Json Schema Validation OK

243
Check LINK in Header
Elian Kraja's avatar
Elian Kraja committed
244
    ${linkURL}=    Get Value From Json    ${response['headers']}    $..Link
245
    Should Not Be Empty    ${linkURL}
246