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

*** Test Cases ***
GET Individual Threshold
11
12
13
14
    [Documentation]    Test ID: 7.3.4.5.1
    ...    Test title: GET Individual Threshold
    ...    Test objective: The objective is to test the retrieval of an individual VNF performance threshold and perform a JSON schema and content validation of the collected threshold data structure
    ...    Pre-conditions: A VNF instance is instantiated. One or more VNF performance thresholds are set in the VNFM.
Najam UI Hassan's avatar
Najam UI Hassan committed
15
    ...    Reference: Clause 6.4.6.3.2 - ETSI GS NFV-SOL 003 [1] v2.7.1
16
17
18
19
20
21
22
23
24
25
26
27
28
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: none
    ...    Post-Conditions: none
    GET individual VNF Performance Threshold
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is   Threshold
    Check HTTP Response Body Threshold Identifier matches the requested Threshold

GET Individual Threshold with invalid resource identifier
    [Documentation]    Test ID: 7.3.4.5.2
    ...    Test title: GET Individual Threshold with invalid resource identifier
    ...    Test objective: The objective is to test that the retrieval of an individual VNF performance threshold fails when using an invalid resource identifier
    ...    Pre-conditions: A VNF instance is instantiated. One or more VNF performance jobs are set in the VNFM.
Najam UI Hassan's avatar
Najam UI Hassan committed
29
    ...    Reference: Clause 6.4.6.3.2 - ETSI GS NFV-SOL 003 [1] v2.7.1
30
31
32
33
34
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: none
    ...    Post-Conditions: none
    GET individual VNF Performance Threshold with invalid resource identifier
    Check HTTP Response Status Code Is    404
35
    Check HTTP Response Body Json Schema Is   ProblemDetails
36
37
38
39
40
41

DELETE Individual Threshold
    [Documentation]    Test ID: 7.3.4.5.3
    ...    Test title: DELETE Individual Threshold
    ...    Test objective: The objective is to test the deletion of an individual VNF performance threshold
    ...    Pre-conditions: A VNF instance is instantiated. One or more VNF performance thresholds are set in the VNFM.
Najam UI Hassan's avatar
Najam UI Hassan committed
42
    ...    Reference: Clause 6.4.6.3.5 - ETSI GS NFV-SOL 003 [1] v2.7.1
43
44
45
46
47
48
49
50
51
52
53
54
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: none
    ...    Post-Conditions: The VNF Performance Threshold is not available anymore in the VNFM    
    Send Delete request for individual VNF Performance Threshold
    Check HTTP Response Status Code Is    204
    Check Postcondition VNF Performance Threshold is Deleted

DELETE Individual Threshold with invalid resource identifier
    [Documentation]    Test ID: 7.3.4.5.4
    ...    Test title: DELETE Individual Threshold with invalid resource identifier
    ...    Test objective: The objective is to test the deletion of an individual VNF performance threshold
    ...    Pre-conditions: A VNF instance is instantiated. One or more VNF performance thresholds are set in the VNFM.
Najam UI Hassan's avatar
Najam UI Hassan committed
55
    ...    Reference: Clause 6.4.6.3.5 - ETSI GS NFV-SOL 003 [1] v2.7.1
56
57
58
59
60
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: none
    ...    Post-Conditions: none   
    Send Delete request for individual VNF Performance Threshold with invalid resource identifier
    Check HTTP Response Status Code Is    404
61
    Check HTTP Response Body Json Schema Is   ProblemDetails
62
63
64
65
66
67

POST Individual Threshold - Method not implemented
    [Documentation]    Test ID: 7.3.4.5.5
    ...    Test title: POST Individual Threshold - Method not implemented
    ...    Test objective: The objective is to test that POST method is not allowed to create a new VNF Performance Threshold
    ...    Pre-conditions: A VNF instance is instantiated
Najam UI Hassan's avatar
Najam UI Hassan committed
68
    ...    Reference: Clause 6.4.6.3.1 - ETSI GS NFV-SOL 003 [1] v2.7.1
69
70
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: none
71
    ...    Post-Conditions: none
72
73
74
75
76
77
78
79
    Send Post request for individual VNF Performance Threshold
    Check HTTP Response Status Code Is    405

PUT Individual Threshold - Method not implemented
    [Documentation]    Test ID: 7.3.4.5.6
    ...    Test title: PUT Individual Threshold - Method not implemented
    ...    Test objective: The objective is to test that PUT method is not allowed to update an existing VNF Performance threshold
    ...    Pre-conditions: A VNF instance is instantiated. One or more VNF performance thresholds are set in the VNFM.
Najam UI Hassan's avatar
Najam UI Hassan committed
80
    ...    Reference: Clause 6.4.6.3.3 - ETSI GS NFV-SOL 003 [1] v2.7.1
81
82
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: none
83
    ...    Post-Conditions: none
84
85
86
    Send Put request for individual VNF Performance Threshold
    Check HTTP Response Status Code Is    405

87
PATCH Individual Threshold
88
    [Documentation]    Test ID: 7.3.4.5.7
89
90
    ...    Test title: PATCH Individual Threshold
    ...    Test objective: The objective is to test that PATCH method allows to modify an Individual threshold resource.
91
    ...    Pre-conditions: A VNF instance is instantiated. One or more VNF performance thresholds are set in the VNFM.
Najam UI Hassan's avatar
Najam UI Hassan committed
92
    ...    Reference: Clause 6.4.6.3.4 - ETSI GS NFV-SOL 003 [1] v2.7.1
93
94
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: none
95
    ...    Post-Conditions: 
96
    Send Patch request for individual VNF Performance Threshold
97
98
99
100
101
102
103
104
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is    ThresholdModifications
    
PATCH Individual Threshold - Precondition failed
    [Documentation]    Test ID: 7.3.4.5.8
    ...    Test title: PATCH Individual Threshold - Preconition failed
    ...    Test objective: The objective is to attempt to modify an individual threshold resource, where the precondition was not met.
    ...    Pre-conditions:  A VNF instance is instantiated. One or more VNF performance jobs are set in the VNFM.
Najam UI Hassan's avatar
Najam UI Hassan committed
105
    ...    Reference: Clause 6.4.6.3.4 - ETSI GS NFV-SOL 003 [1] v2.7.1
106
107
108
109
110
111
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: none
    ...    Post-Conditions:  The VNF Performance Job is not modified by the operation
    Send Patch request for individual VNF Performance Threshold
    Check HTTP Response Status Code Is    412
    Check HTTP Response Body Json Schema Is   ProblemDetails
112
113
114
115
    Check Postcondition VNF Performance Threshold is Unmodified (Implicit)
*** Keywords ***
GET Individual VNF Performance Threshold
    Log    Trying to get a Threhsold present in the VNFM
116
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
117
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": ${AUTHORIZATION}"}
118
    GET    ${apiRoot}/${apiName}/${apiVersion}/thresholds/${thresholdId}
119
    ${output}=    Output    response
120
    Set Suite Variable    ${response}    ${output}
121
122
123

GET individual VNF Performance Threshold with invalid resource identifier
    Log    Trying to get a Threhsold with invalid resource endpoint
124
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
125
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": ${AUTHORIZATION}"}
126
    GET    ${apiRoot}/${apiName}/${apiVersion}/thresholds/${erroneousThresholdId}
127
    ${output}=    Output    response
128
    Set Suite Variable    ${response}    ${output}
129

130
131
Send Delete request for individual VNF Performance Threshold
    Log    Trying to delete a Threhsold in the VNFM
132
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": ${AUTHORIZATION}"}
133
    DELETE    ${apiRoot}/${apiName}/${apiVersion}/thresholds/${thresholdId}
134
    ${output}=    Output    response
135
    Set Suite Variable    ${response}    ${output}
136
137
138

Send Delete request for individual VNF Performance Threshold with invalid resource identifier
    Log    Trying to delete a Threhsold in the VNFM with invalid id
139
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": ${AUTHORIZATION}"}
140
    DELETE    ${apiRoot}/${apiName}/${apiVersion}/thresholds/${erroneousThresholdId}
141
    ${output}=    Output    response
142
    Set Suite Variable    ${response}    ${output}
143
144
145

Send Post request for individual VNF Performance Threshold
    Log    Trying to create new threshold
146
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": ${AUTHORIZATION}"}
147
148
    POST    ${apiRoot}/${apiName}/${apiVersion}/thresholds/${newThresholdId}
    ${output}=    Output    response
149
    Set Suite Variable    ${response}    ${output}
150

151
152
153
Send Put request for individual VNF Performance Threshold
    Log    Trying to PUT threshold
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
154
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": ${AUTHORIZATION}"}
155
156
157
158
159
    GET    ${apiRoot}/${apiName}/${apiVersion}/thresholds/${thresholdId}
    ${origOutput}=    Output    response
    Set Suite Variable    ${origResponse}    ${origOutput}
    PUT    ${apiRoot}/${apiName}/${apiVersion}/thresholds/${thresholdId}
    ${output}=    Output    response
160
    Set Suite Variable    ${response}    ${output}
161

162
163
Send Patch request for individual VNF Performance Threshold
    Log    Trying to PUT threshold
164
165
166
167
    Set Headers  {"Accept":"${ACCEPT_JSON}"} 
    Set Headers  {"Content-Type": "${CONTENT_TYPE_JSON}"} 
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    ${body}=    Get File    jsons/ThresholdModifications.json
168
169
    PATCH    ${apiRoot}/${apiName}/${apiVersion}/thresholds/${thresholdId}
    ${output}=    Output    response
170
    Set Suite Variable    ${response}    ${output}
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194

Check Postcondition VNF Performance Threshold is Unmodified (Implicit)
    Log    Check postconidtion threshold not modified
    GET individual VNF Performance Threshold
    Log    Check Response matches original VNF Threshold
    ${threshold}=    evaluate    json.loads('''${response['body']}''')    json
    Should Be Equal    ${origresponse['body']['id']}    ${threshold.id}
    Should Be Equal    ${origresponse['body']['criteria']}    ${threshold.criteria}

Check Postcondition VNF Performance Threshold is Deleted
    Log    Check Postcondition Threshold is deleted
    GET individual VNF Performance Threshold
    Check HTTP Response Status Code Is    404
    
Check HTTP Response Body Threshold Identifier matches the requested Threshold
    Log    Trying to check response ID
    Should Be Equal    ${response['body']['id']}    ${thresholdId} 
    Log    Pm Job identifier as expected
    
Check HTTP Response Status Code Is
    [Arguments]    ${expected_status}
    ${status}=    Convert To Integer    ${expected_status}    
    Should Be Equal    ${response['status']}    ${status} 
    Log    Status code validated
195

196
197
198
199
200
201
202
203
Check HTTP Response Header Contains
    [Arguments]    ${CONTENT_TYPE}
    Should Contain    ${response['headers']}    ${CONTENT_TYPE}
    Log    Header is present
    
Check HTTP Response Body Json Schema Is
    [Arguments]    ${input}
    Should Contain    ${response['headers']['Content-Type']}    application/json
204
    ${schema} =    Catenate    SEPARATOR=    ${input}    .schema.json
205
206
    Validate Json    ${schema}    ${response['body']}
    Log    Json Schema Validation OK