VnfIndicatorsInVnfInstanceId.robot 14.2 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
Library           JSONLibrary
6
Library           String 
Elian Kraja's avatar
Elian Kraja committed
7
Library           REST    ${EM-VNF_SCHEMA}://${EM-VNF_HOST}:${EM-VNF_PORT}    ssl_verify=false
Elian Kraja's avatar
Elian Kraja committed
8
9

*** Test Cases ***
10
11
Get Indicators for VNF Instance
    [Documentation]    Test ID: 6.3.2.2.1
12
    ...    Test title: Get all performance indicators for a VNF instance
13
14
    ...    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.
15
    ...    Reference: Clause 8.4.3.3.2 - ETSI GS NFV-SOL 002 [2] v2.8.1
16
17
18
19
20
21
    ...    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
22
    Check HTTP Response Body Includes Requested VNF Instance ID
23
24

GET Indicators for VNF Instance with attribute-based filter
Michele Carignani's avatar
Michele Carignani committed
25
    [Documentation]    Test ID: 6.3.2.2.2
26
    ...    Test title: Get all performance indicators for a VNF instance with attribute-based filter
27
28
    ...    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.
29
    ...    Reference: Clause 8.4.3.3.2 - ETSI GS NFV-SOL 002 [2] v2.8.1
30
31
32
33
34
35
36
37
38
    ...    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
39
    [Documentation]    Test ID: 6.3.2.2.3
40
    ...    Test title: Get all performance indicators for a VNF instance with invalid attribute-based filter
41
42
    ...    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.
43
    ...    Reference: Clause 8.4.3.3.2 - ETSI GS NFV-SOL 002 [2] v2.8.1
44
45
46
47
48
49
50
51
    ...    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
52
    [Documentation]    Test ID: 6.3.2.2.4
53
    ...    Test title: Get all performance indicators for a VNF instance with invalid resource identifier
54
55
    ...    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.
56
    ...    Reference: Clause 8.4.3.3.2 - ETSI GS NFV-SOL 002 [2] v2.8.1
57
58
59
60
61
62
63
64
    ...    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
65
    [Documentation]    Test ID: 6.3.2.2.5
66
67
    ...    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
Najam UI Hassan's avatar
Najam UI Hassan committed
68
    ...    Pre-conditions: none
69
    ...    Reference: Clause 8.4.3.3.1 - ETSI GS NFV-SOL 002 [2] v2.8.1
70
71
72
73
74
75
76
    ...    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
77
    [Documentation]    Test ID: 6.3.2.2.6
78
79
    ...    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
Najam UI Hassan's avatar
Najam UI Hassan committed
80
    ...    Pre-conditions: none
81
    ...    Reference: Clause 8.4.3.3.3 - ETSI GS NFV-SOL 002 [2] v2.8.1
82
83
84
85
86
87
88
    ...    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
89
    [Documentation]    Test ID: 6.3.2.2.7
90
91
    ...    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
Najam UI Hassan's avatar
Najam UI Hassan committed
92
    ...    Pre-conditions: none
93
    ...    Reference: Clause 8.4.3.3.4 - ETSI GS NFV-SOL 002 [2] v2.8.1
94
95
96
97
98
99
100
    ...    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
101
    [Documentation]    Test ID: 6.3.2.2.8
102
103
    ...    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
Najam UI Hassan's avatar
Najam UI Hassan committed
104
    ...    Pre-conditions: none
105
    ...    Reference: Clause 8.4.3.3.5 - ETSI GS NFV-SOL 002 [2] v2.8.1
106
107
    ...    Config ID: Config_prod_VE
    ...    Applicability: The VNF supports the generation and maintenance of performance indicators.
Najam UI Hassan's avatar
Najam UI Hassan committed
108
    ...    Post-Conditions: none
109
110
    Send DELETE Request for indicators in VNF instance
    Check HTTP Response Status Code Is    405
111
112
113
114
115
116
    
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.
117
    ...    Reference: Clause 8.4.3.3.2 - ETSI GS NFV-SOL 002 [2] v2.8.1
118
119
120
121
122
    ...    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
Najam UI Hassan's avatar
Najam UI Hassan committed
123
    Check HTTP Response Header Contain Link
124
125
    
Get Indicators for VNF Instance - Bad Request Response too Big
Michele Carignani's avatar
Michele Carignani committed
126
    [Documentation]    Test ID: 6.3.2.2.10
127
128
129
    ...    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.
130
    ...    Reference: Clause 8.4.3.3.2 - ETSI GS NFV-SOL 002 [2] v2.8.1
131
132
133
134
135
136
    ...    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
137
138
139

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

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
165
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
166
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
Najam UI Hassan's avatar
Najam UI Hassan committed
167
    GET    ${apiRoot}/${apiName}/${apiMajorVersion}/indicators/${erroneousVnfInstanceId}
168
    ${output}=    Output    response
Giacomo Bernini's avatar
Giacomo Bernini committed
169
    Set Suite Variable    ${response}    ${output}
170
171

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

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

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

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

223
Check HTTP Response Body Includes Requested VNF Instance ID
224
    Log    Check Response includes Indicators according to resource identifier
root's avatar
root committed
225
    Should Be Equal As Strings   ${response['body']['vnfInstanceId']}    ${vnfInstanceId}
226
227
228
    
Check HTTP Response Body Matches Attribute-Based Filter
    Log    Check Response includes VNF Indicators according to filter
Elian Kraja's avatar
Elian Kraja committed
229
    @{words} =  Split String    ${POS_FIELDS}       ${SEPARATOR} 
Najam UI Hassan's avatar
Najam UI Hassan committed
230
    Should Be Equal As Strings    ${response['body'][0]['name']}    @{words}[1]
root's avatar
root committed
231
    
Najam UI Hassan's avatar
Najam UI Hassan committed
232
Check HTTP Response Header Contain Link
233
234
    ${linkURL}=    Get Value From Json    ${response['headers']}    $..Link
    Should Not Be Empty    ${linkURL}