VnfIndicatorsInVnfInstanceId.robot 12.3 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
7
8
9
Resource          environment/vnfIndicatorinVnfInstance.txt
Library           JSONLibrary
Library           REST    ${EM-VNF_SCHEMA}://${EM-VNF_HOST}:${EM-VNF_PORT}

*** 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
15
16
17
18
19
20
21
    ...    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.
    ...    Reference:  section 8.4.3.3.2 - SOL002 v2.4.1
    ...    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
25

GET Indicators for VNF Instance with attribute-based filter
    [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
29
30
31
32
33
34
35
36
37
38
39
    ...    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.
    ...    Reference: section 8.4.3.3.2 - SOL002 v2.4.1
    ...    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
    [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
43
44
45
46
47
48
49
50
51
52
    ...    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.
    ...    Reference: section 8.4.3.3.2 - SOL002 v2.4.1
    ...    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
    [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
56
57
58
59
60
61
62
63
64
65
    ...    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.
    ...    Reference: section 8.4.3.3.2 - SOL002 v2.4.1
    ...    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
    [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
68
69
70
71
72
73
74
75
76
77
    ...    Pre-conditions: A VNF instance is instantiated.
    ...    Reference: section 8.4.3.3.1 - SOL002 v2.4.1
    ...    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
    [Documentation]    Test ID 6.3.2.2.6
78
79
80
    ...    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.
81
82
83
84
85
86
87
88
89
    ...    Reference: section 8.4.3.3.3 - SOL002 v2.4.1
    ...    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
    [Documentation]    Test ID 6.3.2.2.7
90
91
92
    ...    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.
93
94
95
96
97
98
99
100
101
    ...    Reference: section 8.4.3.3.4 - SOL002 v2.4.1
    ...    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
    [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
104
105
106
107
108
109
110
111
112
113
114
    ...    Pre-conditions: A VNF instance is instantiated. One or more measures of performance indicators are available for the given VNF instance.
    ...    Reference: section 8.4.3.3.5 - SOL002 v2.4.1
    ...    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

*** Keywords ***
Get all indicators for a VNF instance
Elian Kraja's avatar
Elian Kraja committed
115
116
117
118
    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}
119
    ${output}=    Output    response
Giacomo Bernini's avatar
Giacomo Bernini committed
120
    Set Suite Variable    ${response}    ${output}
121
122
    
Get all indicators for a VNF instance with filter  
Elian Kraja's avatar
Elian Kraja committed
123
124
125
126
    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}
127
    ${output}=    Output    response
Giacomo Bernini's avatar
Giacomo Bernini committed
128
    Set Suite Variable    ${response}    ${output}
129
130
       
Get all indicators for a VNF instance with invalid filter
Elian Kraja's avatar
Elian Kraja committed
131
132
133
134
    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}
135
    ${output}=    Output    response
Giacomo Bernini's avatar
Giacomo Bernini committed
136
    Set Suite Variable    ${response}    ${output}
137
138
139

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
140
141
142
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    GET    ${apiRoot}/${apiName}/${apiVersion}/indicators/${erroneousVnfInstanceId}
143
    ${output}=    Output    response
Giacomo Bernini's avatar
Giacomo Bernini committed
144
    Set Suite Variable    ${response}    ${output}
145
146

Send POST Request for indicators in VNF instance
Elian Kraja's avatar
Elian Kraja committed
147
148
149
150
    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}
151
    ${output}=    Output    response
Giacomo Bernini's avatar
Giacomo Bernini committed
152
    Set Suite Variable    ${response}    ${output}
Elian Kraja's avatar
Elian Kraja committed
153

154
Send PUT Request for indicators in VNF instance
Elian Kraja's avatar
Elian Kraja committed
155
156
157
158
    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}
159
    ${output}=    Output    response
Giacomo Bernini's avatar
Giacomo Bernini committed
160
    Set Suite Variable    ${response}    ${output}
161
162
    
Send PATCH Request for indicators in VNF instance
Elian Kraja's avatar
Elian Kraja committed
163
164
165
166
    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}
167
    ${output}=    Output    response
Giacomo Bernini's avatar
Giacomo Bernini committed
168
    Set Suite Variable    ${response}    ${output} 
169
170
     
Send DELETE Request for indicators in VNF instance
Elian Kraja's avatar
Elian Kraja committed
171
172
173
174
    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}
175
    ${output}=    Output    response
Giacomo Bernini's avatar
Giacomo Bernini committed
176
    Set Suite Variable    ${response}    ${output} 
177
178
179
180

Check HTTP Response Status Code Is
    [Arguments]    ${expected_status}    
    ${status}=    Convert To Integer    ${expected_status}    
Giacomo Bernini's avatar
Giacomo Bernini committed
181
    Should Be Equal    ${response['status']}    ${status}
182
183
184
185
    Log    Status code validated

Check HTTP Response Header Contains
    [Arguments]    ${CONTENT_TYPE}
Giacomo Bernini's avatar
Giacomo Bernini committed
186
187
    Log    ${response['headers']}
    Should Contain    ${response['headers']}    ${CONTENT_TYPE}
188
189
190
    Log    Header is present
    
Check HTTP Response Body Json Schema Is
191
    [Arguments]    ${input}
Giacomo Bernini's avatar
Giacomo Bernini committed
192
    Should Contain    ${response['headers']['Content-Type']}    application/json
193
    ${schema} =    Catenate    SEPARATOR=    ${input}    .schema.json
Giacomo Bernini's avatar
Giacomo Bernini committed
194
    Validate Json    ${schema}    ${response['body']}
195
196
    Log    Json Schema Validation OK

197
Check HTTP Response Body Includes Requested VNF Instance ID
198
199
200
201
202
203
204
205
206
    Log    Check Response includes Indicators according to resource identifier
    #todo
    
Check HTTP Response Body Matches Attribute-Based Filter
    Log    Check Response includes VNF Indicators according to filter
    #todo

Check Postcondition Indicators for VNF instance Exist
    Log    Check Response includes VNF Indicators according to filter
207
    #todo