VNFIndicators.robot 18 KB
Newer Older
Elian Kraja's avatar
Elian Kraja committed
1
*** Settings ***
Michele Carignani's avatar
Michele Carignani committed
2
Documentation     This Clause defines all the resources and methods provided by the VNF Indicator interface. \
Elian Kraja's avatar
Elian Kraja committed
3
Library           JSONSchemaLibrary    schemas/
Elian Kraja's avatar
Elian Kraja committed
4
Resource          environment/variables.txt    # Generic Parameters
Elian Kraja's avatar
Elian Kraja committed
5
Library           JSONLibrary
6
Library           String
Elian Kraja's avatar
Elian Kraja committed
7
Resource          environment/vnfIndicators.txt
8
Library           REST    ${EM-VNF_SCHEMA}://${EM-VNF_HOST}:${EM-VNF_PORT}    ssl_verify=false
Elian Kraja's avatar
Elian Kraja committed
9
10

*** Test Cases ***
11
Get all VNF Indicators
12
    [Documentation]    Test ID: 6.3.2.1.1
13
    ...    Test title: Get all VNF Indicators
14
15
    ...    Test objective: The objective is to test the retrieval of all the available VNF indicators and perform a JSON schema validation of the collected indicators data structure
    ...    Pre-conditions: A VNF instance is instantiated. One or more measures of VNF performance indicators are available in the VNF.
Michele Carignani's avatar
Michele Carignani committed
16
    ...    Reference: Clause 8.4.2.3.2 - ETSI GS NFV-SOL 002 [2] v2.6.1
17
18
    ...    Config ID: Config_prod_VE
    ...    Applicability: The VNF supports the generation and maintenance of performance indicators.
19
    ...    Post-Conditions: none
20
21
22
23
24
    Get all VNF indicators
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is   vnfIndicators
    
Get VNF Indicators with attribute-based filter
25
    [Documentation]    Test ID: 6.3.2.1.2
26
    ...    Test title: Get VNF Indicators with attribute-based filter
27
28
    ...    Test objective: The objective is to test the retrieval of VNF indicators using attribute-based filter, perform a JSON schema validation of the collected indicators data structure, and verify that the retrieved information matches the issued attribute-based filters 
    ...    Pre-conditions: A VNF instance is instantiated. One or more measures of VNF performance indicators are available in the VNF.
Michele Carignani's avatar
Michele Carignani committed
29
    ...    Reference: Clause 8.4.2.3.2 - ETSI GS NFV-SOL 002 [2] v2.6.1
30
31
    ...    Config ID: Config_prod_VE
    ...    Applicability: The VNF supports the generation and maintenance of performance indicators.
32
    ...    Post-Conditions: none
33
34
35
    Get VNF indicators with filter
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is   vnfIndicators
36
    Check HTTP Response Body vnfIndicators Matches the requested attribute-based filter
37

38
Get VNF Indicators with invalid attribute-based filter
39
    [Documentation]    Test ID: 6.3.2.1.3
40
    ...    Test title: Get VNF Indicators with invalid attribute-based filter
41
    ...    Test objective: The objective is to test that the retrieval of VNF indicators fails when using invalid attribute-based filters, and perform the JSON schema validation of the failed operation HTTP response. 
42
    ...    Pre-conditions: A VNF instance is instantiated. One or more measures of VNF performance indicators are available in the VNF.
Michele Carignani's avatar
Michele Carignani committed
43
    ...    Reference: Clause 8.4.2.3.2 - ETSI GS NFV-SOL 002 [2] v2.6.1
44
45
    ...    Config ID: Config_prod_VE
    ...    Applicability: The VNF supports the generation and maintenance of performance indicators.
46
    ...    Post-Conditions: none
47
48
49
50
    Get VNF indicators with invalid filter
    Check HTTP Response Status Code Is    400
    Check HTTP Response Body Json Schema Is   ProblemDetails

51
Get all VNF Indicators with malformed authorization token
52
    [Documentation]    Test ID: 6.3.2.1.4
53
54
    ...    Test title: GET all VNF Indicators with malformed authrization token.
    ...    Test objective: The objective is to test that the retrieval of VNF indicators fails when using malformed authorization token
55
    ...    Pre-conditions: A VNF instance is instantiated. One or more measures of VNF performance indicators are available in the VNF.
Michele Carignani's avatar
Michele Carignani committed
56
    ...    Reference: Clause 4.5.3.3, 8.4.2.3.2 - ETSI GS NFV-SOL 002 [2] v2.6.1
57
    ...    Config ID: Config_prod_VE
58
    ...    Applicability: The VNF supports the generation and maintenance of performance indicators. The VNF requires the usage of access tokens for authorizing the API requests.
59
    ...    Post-Conditions: none
60
61
    Get all VNF indicators with malformed authorization token
    Check HTTP Response Status Code Is    400
62
63

Get all VNF Indicators without authorization token
64
    [Documentation]    Test ID: 6.3.2.1.5
65
66
    ...    Test title: GET all VNF Indicators without authorization token
    ...    Test objective: The objective is to test that the retrieval of VNF indicators fails when omitting the authorization token
67
    ...    Pre-conditions: A VNF instance is instantiated. One or more measures of VNF performance indicators are available in the VNF.
Michele Carignani's avatar
Michele Carignani committed
68
    ...    Reference: Clause 4.5.3.3, 8.4.2.3.2 - ETSI GS NFV-SOL 002 [2] v2.6.1
69
    ...    Config ID: Config_prod_VE
70
    ...    Applicability: The VNF supports the generation and maintenance of performance indicators. The VNF requires the usage of access tokens for authorizing the API requests.
71
    ...    Post-Conditions: none
72
    Get all VNF indicators without authorization token
73
    Check HTTP Response Status Code Is    401
74

75
GET all VNF Indicators with expired or revoked authorization token
76
    [Documentation]    Test ID: 6.3.2.1.6
77
78
79
    ...    Test title: GET all VNF Indicators with expired or revoked authorization token
    ...    Test objective: The objective is to test that the retrieval of VNF indicators fails when using expired or revoked authorization token
    ...    Pre-conditions: A VNF instance is instantiated. One or more measures of VNF performance indicators are available in the VNF.
Michele Carignani's avatar
Michele Carignani committed
80
    ...    Reference: Clause 4.5.3.3, 8.4.2.3.2 - ETSI GS NFV-SOL 002 [2] v2.6.1
81
82
83
84
85
86
87
88
    ...    Config ID: Config_prod_VE
    ...    Applicability: The VNF supports the generation and maintenance of performance indicators. The VNF requires the usage of access tokens for authorizing the API requests.
    ...    Post-Conditions: none
    Get all VNF indicators with expired or revoked authorization token
    Check HTTP Response Status Code Is    401

Get all VNF Indicators with invalid resource endpoint
    [Documentation]    Test ID: 6.3.2.1.7
89
    ...    Test title: GET all VNF Indicators with invalid resource endpoint
90
    ...    Test objective: The objective is to test that the retrieval of VNF indicators fails when using invalid resource endpoint
91
    ...    Pre-conditions: A VNF instance is instantiated. One or more measures of VNF performance indicators are available in the VNF.
Michele Carignani's avatar
Michele Carignani committed
92
    ...    Reference: Clause 8.4.2.3.2 - ETSI GS NFV-SOL 002 [2] v2.6.1
93
    ...    Config ID: Config_prod_VE
94
    ...    Applicability: The VNF supports the generation and maintenance of performance indicators. 
95
    ...    Post-Conditions: none
96
97
98
99
    Get all VNF indicators with invalid resource endpoint
    Check HTTP Response Status Code Is    404

POST all VNF Indicators - Method not implemented
100
    [Documentation]    Test ID: 6.3.2.1.8
101
102
    ...    Test title: POST all VNF Indicators - Method not implemented
    ...    Test objective: The objective is to test that POST method is not allowed to create new VNF indicators
103
    ...    Pre-conditions: A VNF instance is instantiated. One or more measures of VNF performance indicators are available in the VNF
Michele Carignani's avatar
Michele Carignani committed
104
    ...    Reference: Clause 8.4.2.3.1 - ETSI GS NFV-SOL 002 [2] v2.6.1
105
106
    ...    Config ID: Config_prod_VE
    ...    Applicability: The VNF supports the generation and maintenance of performance indicators.
107
    ...    Post-Conditions: none
108
109
110
111
    Send POST Request for all VNF indicators
    Check HTTP Response Status Code Is    405

PUT all VNF Indicators - Method not implemented
112
    [Documentation]    Test ID: 6.3.2.1.9
113
114
    ...    Test title: PUT all VNF Indicators - Method not implemented
    ...    Test objective: The objective is to test that PUT method is not allowed to modify VNF indicators
115
    ...    Pre-conditions: A VNF instance is instantiated. One or more measures of VNF performance indicators are available in the VNF
Michele Carignani's avatar
Michele Carignani committed
116
    ...    Reference: Clause 8.4.2.3.3 - ETSI GS NFV-SOL 002 [2] v2.6.1
117
118
    ...    Config ID: Config_prod_VE
    ...    Applicability: The VNF supports the generation and maintenance of performance indicators.
119
    ...    Post-Conditions: none
120
121
122
123
    Send PUT Request for all VNF indicators
    Check HTTP Response Status Code Is    405

PATCH all VNF Indicators - Method not implemented
124
     [Documentation]    Test ID: 6.3.2.1.10
125
    ...    Test title: PATCH all VNF Indicators - Method not implemented
126
    ...    Test objective: The objective is to test that PATCH method is not allowed to update VNF indicators
127
    ...    Pre-conditions: A VNF instance is instantiated. One or more measures of VNF performance indicators are available in the VNF
Michele Carignani's avatar
Michele Carignani committed
128
    ...    Reference: Clause 8.4.2.3.4 - ETSI GS NFV-SOL 002 [2] v2.6.1
129
130
    ...    Config ID: Config_prod_VE
    ...    Applicability: The VNF supports the generation and maintenance of performance indicators.
131
    ...    Post-Conditions: none
132
133
134
    Send PATCH Request for all VNF indicators
    Check HTTP Response Status Code Is    405

135
DELETE all VNF Indicators - Method not implemented
136
    [Documentation]    Test ID: 6.3.2.1.11
137
    ...    Test title: DELETE all VNF Indicators - Method not implemented
138
    ...    Test objective: The objective is to test that DELETE method is not allowed to delete VNF indicators
139
    ...    Pre-conditions: A VNF instance is instantiated. One or more measures of VNF performance indicators are available in the VNF
Michele Carignani's avatar
Michele Carignani committed
140
    ...    Reference: Clause 8.4.2.3.5 - ETSI GS NFV-SOL 002 [2] v2.6.1
141
142
    ...    Config ID: Config_prod_VE
    ...    Applicability: The VNF supports the generation and maintenance of performance indicators.
143
    ...    Post-Conditions: none
144
145
    Send DELETE Request for all VNF indicators
    Check HTTP Response Status Code Is    405
146
    Check Postcondition VNF Indicators Exist
147
    
148
149
150
151
152
Get VNF Indicators to get Paged Response
    [Documentation]    Test ID: 6.3.2.1.12
    ...    Test title: Get VNF Indicators to get Paged Response
    ...    Test objective: The objective is to test the retrieval of all the available VNF indicators with Paged Response.
    ...    Pre-conditions: A VNF instance is instantiated. One or more measures of VNF performance indicators are available in the VNF.
Michele Carignani's avatar
Michele Carignani committed
153
    ...    Reference: Clause 8.4.2.3.2 - ETSI GS NFV-SOL 002 [2] v2.6.1
154
155
156
157
158
159
160
161
162
163
164
165
    ...    Config ID: Config_prod_VE
    ...    Applicability: The VNF supports the generation and maintenance of performance indicators.
    ...    Post-Conditions: none
    Get all VNF indicators
    Check HTTP Response Status Code Is    200
    Check LINK in Header
    
Get VNF Indicators - Bad Request Response too Big
    [Documentation]    Test ID: 6.3.2.1.13
    ...    Test title: Get VNF Indicators - Bad Request Response too Big
    ...    Test objective: The objective is to test that the retrieval of VNF indicators fails when 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 measures of VNF performance indicators are available in the VNF.
Michele Carignani's avatar
Michele Carignani committed
166
    ...    Reference: Clause 8.4.2.3.2 - ETSI GS NFV-SOL 002 [2] v2.6.1
167
168
169
170
171
172
173
    ...    Config ID: Config_prod_VE
    ...    Applicability: The VNF supports the generation and maintenance of performance indicators.
    ...    Post-Conditions: none
    Get all VNF indicators
    Check HTTP Response Status Code Is    400
    Check HTTP Response Body Json Schema Is   ProblemDetails
    
174
175
*** Keywords ***
Get all VNF indicators
Elian Kraja's avatar
Elian Kraja committed
176
177
    Log    The GET method queries multiple VNF indicators
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
178
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
179
    Log    Execute Query and validate response
180
181
    Get    ${apiRoot}/${apiName}/${apiVersion}/indicators
    ${output}=    Output    response
Giacomo Bernini's avatar
Giacomo Bernini committed
182
    Set Suite Variable    ${response}    ${output}
183
184
    
Get VNF indicators with filter
Elian Kraja's avatar
Elian Kraja committed
185
186
    Log    The GET method queries multiple VNF indicators using Attribute-based filtering parameters
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
187
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
188
    Log    Execute Query and validate response
189
190
    Get    ${apiRoot}/${apiName}/${apiVersion}/indicators?${POS_FIELDS}
    ${output}=    Output    response
Giacomo Bernini's avatar
Giacomo Bernini committed
191
    Set Suite Variable    ${response}    ${output}
192
193
194

Get VNF indicators with invalid filter
    Log    The GET method queries multiple VNF indicators using invalid Attribute-based filtering parameters
Elian Kraja's avatar
Elian Kraja committed
195
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
196
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
197
    Log    Execute Query and validate response
198
199
    Get    ${apiRoot}/${apiName}/${apiVersion}/indicators?${NEG_FIELDS}
    ${output}=    Output    response
Giacomo Bernini's avatar
Giacomo Bernini committed
200
    Set Suite Variable    ${response}    ${output}
201

202
203
204
205
Get all VNF indicators with malformed authorization token
    Pass Execution If    ${AUTH_USAGE} == 0    Skipping test as EM/VNF is not supporting authentication
    Log    The GET method queries multiple VNF indicators using invalid token
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
206
    Set Headers    {"${AUTHORIZATION_HEADER}": "${BAD_AUTHORIZATION_TOKEN}"}
207
208
209
210
211
212
    Log    Execute Query and validate response
    Get    ${apiRoot}/${apiName}/${apiVersion}/indicators
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}

Get all VNF indicators with expired or revoked authorization token
Elian Kraja's avatar
Elian Kraja committed
213
    Pass Execution If    ${AUTH_USAGE} == 0    Skipping test as EM/VNF is not supporting authentication
214
    Log    The GET method queries multiple VNF indicators using invalid token
Elian Kraja's avatar
Elian Kraja committed
215
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
216
    Set Headers    {"${AUTHORIZATION_HEADER}":"${NEG_AUTHORIZATION_TOKEN}"}
217
    Log    Execute Query and validate response
218
219
    Get    ${apiRoot}/${apiName}/${apiVersion}/indicators
    ${output}=    Output    response
Giacomo Bernini's avatar
Giacomo Bernini committed
220
    Set Suite Variable    ${response}    ${output}
221
222

Get all VNF indicators without authorization token
Elian Kraja's avatar
Elian Kraja committed
223
    Pass Execution If    ${AUTH_USAGE} == 0    Skipping test as EM/VNF is not supporting authentication
224
    Log    The GET method queries multiple VNF indicators omitting token
Elian Kraja's avatar
Elian Kraja committed
225
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
226
    Log    Execute Query and validate response
227
228
    Get    ${apiRoot}/${apiName}/${apiVersion}/indicators
    ${output}=    Output    response
Giacomo Bernini's avatar
Giacomo Bernini committed
229
    Set Suite Variable    ${response}    ${output}
230
231
232
    
Get all VNF indicators with invalid resource endpoint
    Log    The GET method queries multiple VNF indicators omitting token
Elian Kraja's avatar
Elian Kraja committed
233
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
234
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
235
    Log    Execute Query and validate response
236
    Get    ${apiRoot}/${apiName}/${apiVersion}/indicator
237
    ${output}=    Output    response
Giacomo Bernini's avatar
Giacomo Bernini committed
238
    Set Suite Variable    ${response}    ${output}
Elian Kraja's avatar
Elian Kraja committed
239

240
241
242
Send POST Request for all VNF indicators
    log    Trying to perform a POST. This method should not be implemented
    Set Headers  {"Accept":"${ACCEPT_JSON}"}  
243
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
244
245
    Post    ${apiRoot}/${apiName}/${apiVersion}/indicators
    ${output}=    Output    response
Giacomo Bernini's avatar
Giacomo Bernini committed
246
    Set Suite Variable    ${response}    ${output}
247
248
249
250
    
Send PUT Request for all VNF indicators
    log    Trying to perform a PUT. This method should not be implemented
    Set Headers  {"Accept":"${ACCEPT_JSON}"}  
251
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
252
253
    Post    ${apiRoot}/${apiName}/${apiVersion}/indicators
    ${output}=    Output    response
Giacomo Bernini's avatar
Giacomo Bernini committed
254
    Set Suite Variable    ${response}    ${output}
255
256
257
258
    
Send PATCH Request for all VNF indicators
    log    Trying to perform a PATCH. This method should not be implemented
    Set Headers  {"Accept":"${ACCEPT_JSON}"}  
259
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
260
261
    Post    ${apiRoot}/${apiName}/${apiVersion}/indicators
    ${output}=    Output    response
Giacomo Bernini's avatar
Giacomo Bernini committed
262
    Set Suite Variable    ${response}    ${output}
263
264
265
266
    
Send DELETE Request for all VNF indicators
    log    Trying to perform a DELETE. This method should not be implemented
    Set Headers  {"Accept":"${ACCEPT_JSON}"}  
267
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
268
269
    Post    ${apiRoot}/${apiName}/${apiVersion}/indicators
    ${output}=    Output    response
Giacomo Bernini's avatar
Giacomo Bernini committed
270
    Set Suite Variable    ${response}    ${output}
Elian Kraja's avatar
Elian Kraja committed
271

272
Check HTTP Response Status Code Is
273
274
    [Arguments]    ${expected_status}
    ${status}=    Convert To Integer    ${expected_status}    
Giacomo Bernini's avatar
Giacomo Bernini committed
275
    Should Be Equal    ${response['status']}    ${status} 
276
    Log    Status code validated
277
278
    Run Keyword If    ${status} == 401
    ...    Check HTTP Response Header Contains    "WWW-Authenticate"    
Elian Kraja's avatar
Elian Kraja committed
279

280
281
Check HTTP Response Header Contains
    [Arguments]    ${CONTENT_TYPE}
Giacomo Bernini's avatar
Giacomo Bernini committed
282
    Should Contain    ${response['headers']}    ${CONTENT_TYPE}
283
284
285
286
    Log    Header is present
    
Check HTTP Response Body Json Schema Is
    [Arguments]    ${schema}
287
288
    Run Keyword If    '${input}' == 'ProblemDetails'    Should Contain    ${response['headers']['Content-Type']}    application/problem+json
    ...    ELSE    Should Contain    ${response['headers']['Content-Type']}    application/json
289
290
    ${jsonSchema}=    Catenate    SEPARATOR=    ${schema}    .schema.json
    Validate Json    ${jsonSchema}    ${response['body']}
291
292
    Log    Json Schema Validation OK

293
Check Postcondition VNF Indicators Exist
294
    Log    Check Postcondition indicators exist
295
    Get all VNF indicators
296
297
    Check HTTP Response Status Code Is    200
    
298
Check HTTP Response Body vnfIndicators Matches the requested attribute-based filter
299
    Log    Check Response includes VNF Indicators according to filter
Elian Kraja's avatar
Elian Kraja committed
300
301
302
    @{attr} =  Split String    ${POS_FILTER}       ${VAR_SEPARATOR} 
    @{var_name} =    Split String    @{attr}[0]       ${SEPARATOR}
    @{var_id} =    Split String    @{attr}[1]       ${SEPARATOR}
303
    Should Be True     "${response['body'][0]['name']}"=="@{var_name}[1]" and "${response['body'][0]['vnfInstanceId']}"=="@{var_id}[1]"
304
305

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