VnfIndicatorsInVnfInstanceId.robot 14.8 KB
Newer Older
Elian Kraja's avatar
Elian Kraja committed
1
2
3
*** Settings ***
Documentation     This resource represents VNF indicators related to a VNF instance. The client can use this resource to query multiple VNF indicators that are related to a particular VNF instance.
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
6
Resource          environment/vnfIndicatorinVnfInstance.txt
Library           JSONLibrary
7
Library           String 
Elian Kraja's avatar
Elian Kraja committed
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
12
Get Indicators for VNF Instance
    [Documentation]    Test ID: 6.3.2.2.1
13
    ...    Test title: Get all performance indicators for a VNF instance
14
15
    ...    Test objective: The objective is to test the retrieval of all performance indicators for a given VNF instance and perform a JSON schema validation of the returned indicators data structure
    ...    Pre-conditions: A VNF instance is instantiated. One or more measures of performance indicators are available for the given VNF instance.
Michele Carignani's avatar
Michele Carignani committed
16
    ...    Reference: Clause 8.4.3.3.2 - ETSI GS NFV-SOL 002 [2] v2.6.1
17
18
19
20
21
22
    ...    Config ID: Config_prod_VE
    ...    Applicability: The VNF supports the generation and maintenance of performance indicators
    ...    Post-Conditions: none
    Get all indicators for a VNF instance
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is   vnfIndicators
23
    Check HTTP Response Body Includes Requested VNF Instance ID
24
25

GET Indicators for VNF Instance with attribute-based filter
Michele Carignani's avatar
Michele Carignani committed
26
    [Documentation]    Test ID: 6.3.2.2.2
27
    ...    Test title: Get all performance indicators for a VNF instance with attribute-based filter
28
29
    ...    Test objective: The objective is to test the retrieval of all performance indicators for a given VNF instance using attribute-based filter and perform a JSON schema validation of the returned indicators data structure
    ...    Pre-conditions: A VNF instance is instantiated. One or more measures of performance indicators are available for the given VNF instance.
Michele Carignani's avatar
Michele Carignani committed
30
    ...    Reference: Clause 8.4.3.3.2 - ETSI GS NFV-SOL 002 [2] v2.6.1
31
32
33
34
35
36
37
38
39
    ...    Config ID: Config_prod_VE
    ...    Applicability: The VNF supports the generation and maintenance of performance indicators
    ...    Post-Conditions: none
    Get all indicators for a VNF instance with filter
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is   vnfIndicators
    Check HTTP Response Body Matches Attribute-Based Filter

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

Get Indicators for VNF Instance with invalid resource identifier
Michele Carignani's avatar
Michele Carignani committed
53
    [Documentation]    Test ID: 6.3.2.2.4
54
    ...    Test title: Get all performance indicators for a VNF instance with invalid resource identifier
55
56
    ...    Test objective: The objective is to test that the retrieval of all performance indicators for a given VNF instance fails when using invalid resource identifier. The test also checks the JSON schema of the unsuccessful operation HTTP response.
    ...    Pre-conditions: A VNF instance is instantiated. One or more measures of performance indicators are available for the given VNF instance.
Michele Carignani's avatar
Michele Carignani committed
57
    ...    Reference: Clause 8.4.3.3.2 - ETSI GS NFV-SOL 002 [2] v2.6.1
58
59
60
61
62
63
64
65
    ...    Config ID: Config_prod_VE
    ...    Applicability: The VNF supports the generation and maintenance of performance indicators.
    ...    Post-Conditions: none
    Get all indicators for a VNF instance with invalid resource identifier
    Check HTTP Response Status Code Is    404
    Check HTTP Response Body Json Schema Is   ProblemDetails

POST Indicators for VNF instance - Method not implemented
Michele Carignani's avatar
Michele Carignani committed
66
    [Documentation]    Test ID: 6.3.2.2.5
67
68
    ...    Test title: POST performance indicators for VNF instance - Method not implemented
    ...    Test objective: The objective is to test that POST method is not allowed to create new performance indicators for a VNF instance
69
    ...    Pre-conditions: A VNF instance is instantiated.
Michele Carignani's avatar
Michele Carignani committed
70
    ...    Reference: Clause 8.4.3.3.1 - ETSI GS NFV-SOL 002 [2] v2.6.1
71
72
73
74
75
76
77
    ...    Config ID: Config_prod_VE
    ...    Applicability: The VNF supports the generation and maintenance of performance indicators.
    ...    Post-Conditions: none
    Send POST Request for indicators in VNF instance
    Check HTTP Response Status Code Is    405

PUT Indicators for VNF instance - Method not implemented
Michele Carignani's avatar
Michele Carignani committed
78
    [Documentation]    Test ID: 6.3.2.2.6
79
80
81
    ...    Test title: PUT performance indicators for VNF instance - Method not implemented
    ...    Test objective: The objective is to test that PUT method is not allowed to modify existing performance indicators for a VNF instance
    ...    Pre-conditions: A VNF instance is instantiated. One or more measures of performance indicators are available for the given VNF instance.
Michele Carignani's avatar
Michele Carignani committed
82
    ...    Reference: Clause 8.4.3.3.3 - ETSI GS NFV-SOL 002 [2] v2.6.1
83
84
85
86
87
88
89
    ...    Config ID: Config_prod_VE
    ...    Applicability: The VNF supports the generation and maintenance of performance indicators.
    ...    Post-Conditions: none
    Send PUT Request for indicators in VNF instance
    Check HTTP Response Status Code Is    405

PATCH Indicators for VNF instance - Method not implemented
Michele Carignani's avatar
Michele Carignani committed
90
    [Documentation]    Test ID: 6.3.2.2.7
91
92
93
    ...    Test title: PATCH performance indicators for VNF instance - Method not implemented
    ...    Test objective: The objective is to test that PATCH method is not allowed to update existing performance indicators for a VNF instance
    ...    Pre-conditions: A VNF instance is instantiated. One or more measures of performance indicators are available for the given VNF instance.
Michele Carignani's avatar
Michele Carignani committed
94
    ...    Reference: Clause 8.4.3.3.4 - ETSI GS NFV-SOL 002 [2] v2.6.1
95
96
97
98
99
100
101
    ...    Config ID: Config_prod_VE
    ...    Applicability: The VNF supports the generation and maintenance of performance indicators.
    ...    Post-Conditions: none
    Send PATCH Request for indicators in VNF instance
    Check HTTP Response Status Code Is    405

DELETE Indicators for VNF instance - Method not implemented
Michele Carignani's avatar
Michele Carignani committed
102
    [Documentation]    Test ID: 6.3.2.2.8
103
104
    ...    Test title: DELETE performance indicators for VNF instance - Method not implemented
    ...    Test objective: The objective is to test that DELETE method is not allowed to delete performance indicators for a VNF instance
105
    ...    Pre-conditions: A VNF instance is instantiated. One or more measures of performance indicators are available for the given VNF instance.
Michele Carignani's avatar
Michele Carignani committed
106
    ...    Reference: Clause 8.4.3.3.5 - ETSI GS NFV-SOL 002 [2] v2.6.1
107
108
109
110
111
112
    ...    Config ID: Config_prod_VE
    ...    Applicability: The VNF supports the generation and maintenance of performance indicators.
    ...    Post-Conditions: The indicators for the VNF instance are not deleted by the unsuccessful operation
    Send DELETE Request for indicators in VNF instance
    Check HTTP Response Status Code Is    405
    Check Postcondition Indicators for VNF instance Exist
113
114
115
116
117
118
    
Get Indicators for VNF Instance to get Paged Response
    [Documentation]    Test ID: 6.3.2.2.9
    ...    Test title: Get Indicators for VNF Instance to get Paged Response
    ...    Test objective: The objective is to test the retrieval of all performance indicators for a given VNF instance to get paged response.
    ...    Pre-conditions: A VNF instance is instantiated. One or more measures of performance indicators are available for the given VNF instance.
Michele Carignani's avatar
Michele Carignani committed
119
    ...    Reference: Clause 8.4.3.3.2 - ETSI GS NFV-SOL 002 [2] v2.6.1
120
121
122
123
124
125
126
127
    ...    Config ID: Config_prod_VE
    ...    Applicability: The VNF supports the generation and maintenance of performance indicators
    ...    Post-Conditions: none
    Get all indicators for a VNF instance
    Check HTTP Response Status Code Is    200
    Check LINK in Header
    
Get Indicators for VNF Instance - Bad Request Response too Big
Michele Carignani's avatar
Michele Carignani committed
128
    [Documentation]    Test ID: 6.3.2.2.10
129
130
131
    ...    Test title: Get Indicators for VNF Instance - Bad Request Response too Big
    ...    Test objective: The objective is to test that the retrieval of all performance indicators for a given VNF instance fails when response is too big. The test also checks the JSON schema of the unsuccessful operation HTTP response.
    ...    Pre-conditions: A VNF instance is instantiated. One or more measures of performance indicators are available for the given VNF instance.
Michele Carignani's avatar
Michele Carignani committed
132
    ...    Reference: Clause 8.4.3.3.2 - ETSI GS NFV-SOL 002 [2] v2.6.1
133
134
135
136
137
138
    ...    Config ID: Config_prod_VE
    ...    Applicability: The VNF supports the generation and maintenance of performance indicators.
    ...    Post-Conditions: none
    Get all indicators for a VNF instance
    Check HTTP Response Status Code Is    400
    Check HTTP Response Body Json Schema Is   ProblemDetails
139
140
141

*** Keywords ***
Get all indicators for a VNF instance
Elian Kraja's avatar
Elian Kraja committed
142
143
144
145
    Log    This resource represents VNF indicators related to a VNF instance.
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    GET    ${apiRoot}/${apiName}/${apiVersion}/indicators/${vnfInstanceId}
146
    ${output}=    Output    response
Giacomo Bernini's avatar
Giacomo Bernini committed
147
    Set Suite Variable    ${response}    ${output}
148
149
    
Get all indicators for a VNF instance with filter  
Elian Kraja's avatar
Elian Kraja committed
150
151
152
153
    Log    This resource represents VNF indicators related to a VNF instance.
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    GET    ${apiRoot}/${apiName}/${apiVersion}/indicators/${vnfInstanceId}?${POS_FIELDS}
154
    ${output}=    Output    response
Giacomo Bernini's avatar
Giacomo Bernini committed
155
    Set Suite Variable    ${response}    ${output}
156
157
       
Get all indicators for a VNF instance with invalid filter
Elian Kraja's avatar
Elian Kraja committed
158
159
160
161
    Log    This resource represents VNF indicators related to a VNF instance.
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    GET    ${apiRoot}/${apiName}/${apiVersion}/indicators/${vnfInstanceId}?${NEG_FIELDS}
162
    ${output}=    Output    response
Giacomo Bernini's avatar
Giacomo Bernini committed
163
    Set Suite Variable    ${response}    ${output}
164
165
166

Get all indicators for a VNF instance with invalid resource identifier
    Log    Trying to perform a negative get, using wrong identifier
Elian Kraja's avatar
Elian Kraja committed
167
168
169
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    GET    ${apiRoot}/${apiName}/${apiVersion}/indicators/${erroneousVnfInstanceId}
170
    ${output}=    Output    response
Giacomo Bernini's avatar
Giacomo Bernini committed
171
    Set Suite Variable    ${response}    ${output}
172
173

Send POST Request for indicators in VNF instance
Elian Kraja's avatar
Elian Kraja committed
174
175
176
177
    Log    Trying to perform a POST (method should not be implemented)
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    POST    ${apiRoot}/${apiName}/${apiVersion}/indicators/${vnfInstanceId}
178
    ${output}=    Output    response
Giacomo Bernini's avatar
Giacomo Bernini committed
179
    Set Suite Variable    ${response}    ${output}
Elian Kraja's avatar
Elian Kraja committed
180

181
Send PUT Request for indicators in VNF instance
Elian Kraja's avatar
Elian Kraja committed
182
183
184
185
    Log    Trying to perform a PUT. This method should not be implemented
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    PUT    ${apiRoot}/${apiName}/${apiVersion}/indicators/${vnfInstanceId}
186
    ${output}=    Output    response
Giacomo Bernini's avatar
Giacomo Bernini committed
187
    Set Suite Variable    ${response}    ${output}
188
189
    
Send PATCH Request for indicators in VNF instance
Elian Kraja's avatar
Elian Kraja committed
190
191
192
193
    Log    Trying to perform a PATCH. This method should not be implemented
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    PATCH    ${apiRoot}/${apiName}/${apiVersion}/indicators/${vnfInstanceId}
194
    ${output}=    Output    response
Giacomo Bernini's avatar
Giacomo Bernini committed
195
    Set Suite Variable    ${response}    ${output} 
196
197
     
Send DELETE Request for indicators in VNF instance
Elian Kraja's avatar
Elian Kraja committed
198
199
200
201
    Log    Trying to perform a DELETE. This method should not be implemented
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    DELETE    ${apiRoot}/${apiName}/${apiVersion}/indicators/${vnfInstanceId}
202
    ${output}=    Output    response
Giacomo Bernini's avatar
Giacomo Bernini committed
203
    Set Suite Variable    ${response}    ${output} 
204
205
206
207

Check HTTP Response Status Code Is
    [Arguments]    ${expected_status}    
    ${status}=    Convert To Integer    ${expected_status}    
Giacomo Bernini's avatar
Giacomo Bernini committed
208
    Should Be Equal    ${response['status']}    ${status}
209
210
211
212
    Log    Status code validated

Check HTTP Response Header Contains
    [Arguments]    ${CONTENT_TYPE}
Giacomo Bernini's avatar
Giacomo Bernini committed
213
214
    Log    ${response['headers']}
    Should Contain    ${response['headers']}    ${CONTENT_TYPE}
215
216
217
    Log    Header is present
    
Check HTTP Response Body Json Schema Is
218
    [Arguments]    ${input}
Giacomo Bernini's avatar
Giacomo Bernini committed
219
    Should Contain    ${response['headers']['Content-Type']}    application/json
220
    ${schema} =    Catenate    SEPARATOR=    ${input}    .schema.json
Giacomo Bernini's avatar
Giacomo Bernini committed
221
    Validate Json    ${schema}    ${response['body']}
222
223
    Log    Json Schema Validation OK

224
Check HTTP Response Body Includes Requested VNF Instance ID
225
    Log    Check Response includes Indicators according to resource identifier
root's avatar
root committed
226
    Should Be Equal As Strings   ${response['body']['vnfInstanceId']}    ${vnfInstanceId}
227
228
229
    
Check HTTP Response Body Matches Attribute-Based Filter
    Log    Check Response includes VNF Indicators according to filter
Najam UI Hassan's avatar
Najam UI Hassan committed
230
231
    @{words} =  Split String    ${POS_FIELDS}       ,${SEPERATOR} 
    Should Be Equal As Strings    ${response['body'][0]['name']}    @{words}[1]
232
233

Check Postcondition Indicators for VNF instance Exist
root's avatar
root committed
234
235
236
237
    Log    Check Postcondition Indicators for VNF instance Exist
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    GET    ${apiRoot}/${apiName}/${apiVersion}/indicators/${vnfInstanceId}
Elian Kraja's avatar
Elian Kraja committed
238
    Should Be Equal    ${response['status']}    200
root's avatar
root committed
239
    
240
Check LINK in Header
Elian Kraja's avatar
Elian Kraja committed
241
    ${linkURL}=    Get Value From Json    ${response['headers']}    $..Link
242
    Should Not Be Empty    ${linkURL}