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

*** Test Cases ***
11
12
GET All Performance Thresholds
    [Documentation]    Test ID: 6.3.3.4.1
13
    ...    Test title: GET All Performance Thresholds
14
15
    ...    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
16
    ...    Reference: Clause 6.4.5.3.2 - ETSI GS NFV-SOL 002 [2] v2.6.1
17
18
19
20
21
22
23
24
25
    ...    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: 6.3.3.4.2
26
    ...    Test title: GET Performance Thresholds with attribute-based filter
27
28
    ...    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
29
    ...    Reference: Clause 6.4.5.3.2 - ETSI GS NFV-SOL 002 [2] v2.6.1
30
31
32
33
34
35
    ...    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
36
    Check HTTP Response Body Thresholds match the requested attribute-based filter
37
38
39

GET Performance Thresholds with invalid attribute-based filter
    [Documentation]    Test ID: 6.3.3.4.3
40
    ...    Test title: GET Performance Thresholds with invalid attribute-based filter
41
42
    ...    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
43
    ...    Reference: Clause 6.4.5.3.2 - ETSI GS NFV-SOL 002 [2] v2.6.1
44
45
46
47
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: none
    ...    Post-Conditions: none
    GET Performance Thresholds with invalid attribute-based filter
48
    Check HTTP Response Status Code Is    404
49
50
51

GET Performance Thresholds with invalid resource endpoint
    [Documentation]    Test ID: 6.3.3.4.4
52
    ...    Test title: GET Performance Thresholds with invalid resource endpoint
53
54
    ...    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
55
    ...    Reference: Clause 6.4.5.3.2 - ETSI GS NFV-SOL 002 [2] v2.6.1
56
57
58
59
60
61
62
63
64
    ...    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: 6.3.3.4.5
65
    ...    Test title:  Create new Performance Threshold
66
67
    ...    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
68
    ...    Reference: Clause 6.4.5.3.1 - ETSI GS NFV-SOL 002 [2] v2.6.1
69
70
71
72
73
74
75
76
77
78
    ...    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
Giacomo Bernini's avatar
upd    
Giacomo Bernini committed
79
    [Documentation]    Test ID: 6.3.3.4.6
80
    ...    Test title: PUT Performance Thresholds - Method not implemented
81
82
    ...    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
83
    ...    Reference: Clause 6.4.5.3.3 - ETSI GS NFV-SOL 002 [2] v2.6.1
84
85
86
87
88
89
90
    ...    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
Giacomo Bernini's avatar
upd    
Giacomo Bernini committed
91
    [Documentation]    Test ID: 6.3.3.4.7
92
    ...    Test title: PATCH Performance Thresholds - Method not implemented
93
94
    ...    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
95
    ...    Reference: Clause 6.4.5.3.4 - ETSI GS NFV-SOL 002 [2] v2.6.1
96
97
98
99
100
101
102
    ...    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
Giacomo Bernini's avatar
upd    
Giacomo Bernini committed
103
    [Documentation]    Test ID: 6.3.3.4.8
104
    ...    Test title: DELETE Performance Thresholds - Method not implemented
105
106
    ...    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
107
    ...    Reference: Clause 6.4.5.3.5 - ETSI GS NFV-SOL 002 [2] v2.6.1
108
109
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: none
110
    ...    Post-Conditions: The VNF performance thresholds are not deleted by the failed operation
111
112
113
114
    Send DELETE Request for all Performance Thresholds
    Check HTTP Response Status Code Is    405
    Check Postcondition Thresholds Exist

115
116
117
118
119
GET Performance Thresholds with Paged Response
    [Documentation]    Test ID: 6.3.3.4.9
    ...    Test title: GET Performance Thresholds with Paged Response
    ...    Test objective: The objective is to test the retrieval of all the available VNF performance thresholds with 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
120
    ...    Reference: Clause 6.4.5.3.2 - ETSI GS NFV-SOL 002 [2] v2.6.1
121
122
123
124
125
126
127
128
129
130
131
132
    ...    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 for Bad Request Response too big
    [Documentation]    Test ID: 6.3.3.4.10
    ...    Test title: GET Performance Thresholds for Bad Request Response too big
    ...    Test objective: The objective is to test that the retrieval of VNF performance thresholds 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 VNF performance thresholds are set in the VNFM.
Michele Carignani's avatar
Michele Carignani committed
133
    ...    Reference: Clause 6.4.5.3.2 - ETSI GS NFV-SOL 002 [2] v2.6.1
134
135
136
137
138
139
140
    ...    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
    
141
142
143
*** Keywords ***
GET all Performance Thresholds
    Log    Trying to get all thresholds present in the VNFM    
144
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
Elian Kraja's avatar
Elian Kraja committed
145
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": ${AUTHORIZATION}"}
146
    GET    ${apiRoot}/${apiName}/${apiVersion}/thresholds
147
    ${output}=    Output    response
Giacomo Bernini's avatar
Giacomo Bernini committed
148
    Set Suite Variable    ${response}    ${output}
149
150
151

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

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

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

Send PUT Request for all Performance Thresholds
    Log    PUT THresholds
Elian Kraja's avatar
Elian Kraja committed
186
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": ${AUTHORIZATION}"}
187
188
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Set Headers    {"Content-Type": "${CONTENT_TYPE_JSON}"}
189
    PUT    ${apiRoot}/${apiName}/${apiVersion}/thresholds
190
    ${output}=    Output    response
Giacomo Bernini's avatar
Giacomo Bernini committed
191
    Set Suite Variable    ${response}    ${output}
192
193
194
    
Send PATCH Request for all Performance Thresholds
    Log    PUT THresholds
Elian Kraja's avatar
Elian Kraja committed
195
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": ${AUTHORIZATION}"}
196
197
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Set Headers    {"Content-Type": "${CONTENT_TYPE_JSON}"}
198
    PATCH    ${apiRoot}/${apiName}/${apiVersion}/thresholds
199
    ${output}=    Output    response
Giacomo Bernini's avatar
Giacomo Bernini committed
200
    Set Suite Variable    ${response}    ${output}
201

202
203
Send DELETE Request for all Performance Thresholds
    Log    DELETE THresholds
Elian Kraja's avatar
Elian Kraja committed
204
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": ${AUTHORIZATION}"}
205
    DELETE    ${apiRoot}/${apiName}/${apiVersion}/thresholds
206
    ${output}=    Output    response
Giacomo Bernini's avatar
Giacomo Bernini committed
207
    Set Suite Variable    ${response}    ${output}
208
209
210
211
212
213
214
215
216

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}"}
Giacomo Bernini's avatar
Giacomo Bernini committed
217
    GET    ${apiRoot}/${apiName}/${apiVersion}/thresholds/${response['body']['id']}
218
    ${output}=    Output    response
Giacomo Bernini's avatar
Giacomo Bernini committed
219
    Set Suite Variable    ${response}    ${output}
220
221
222
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is    Threshold
        
223
Check HTTP Response Body Thresholds match the requested attribute-based filter
224
    Log    Checking that attribute-based filter is matched
Najam UI Hassan's avatar
Najam UI Hassan committed
225
226
    @{words} =  Split String    ${FILTER_OK}       ,${SEPERATOR} 
    Should Be Equal As Strings    ${response['body'][0]['objectInstanceId']}    @{words}[1]
227
228
229
    
Check HTTP Response Status Code Is
    [Arguments]    ${expected_status}
Elian Kraja's avatar
Elian Kraja committed
230
    Should Be Equal As Strings    ${response['status']}    ${expected_status} 
231
232
233
234
    Log    Status code validated

Check HTTP Response Header Contains
    [Arguments]    ${CONTENT_TYPE}
Giacomo Bernini's avatar
Giacomo Bernini committed
235
    Should Contain    ${response['headers']}    ${CONTENT_TYPE}
236
237
238
239
    Log    Header is present
    
Check HTTP Response Body Json Schema Is
    [Arguments]    ${input}
Giacomo Bernini's avatar
Giacomo Bernini committed
240
    Should Contain    ${response['headers']['Content-Type']}    application/json
241
    ${schema} =    Catenate    SEPARATOR=    ${input}    .schema.json
Giacomo Bernini's avatar
Giacomo Bernini committed
242
    Validate Json    ${schema}    ${response['body']}
243
    Log    Json Schema Validation OK
244
245
    
Check LINK in Header
Elian Kraja's avatar
Elian Kraja committed
246
    ${linkURL}=    Get Value From Json    ${response['headers']}    $..Link
247
248
    Should Not Be Empty    ${linkURL}

249
250