IndividualThreshold.robot 11.2 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
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: 6.3.3.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.
Michele Carignani's avatar
Michele Carignani committed
15
    ...    Reference: Clause 6.4.6.3.2 - ETSI GS NFV-SOL 002 [2] v2.6.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: 6.3.3.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.
Michele Carignani's avatar
Michele Carignani committed
29
    ...    Reference: Clause 6.4.6.3.2 - ETSI GS NFV-SOL 002 [2] v2.6.1
30
31
32
33
34
35
36
37
38
39
40
    ...    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

DELETE Individual Threshold
    [Documentation]    Test ID: 6.3.3.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.
Michele Carignani's avatar
Michele Carignani committed
41
    ...    Reference: Clause 6.4.6.3.5 - ETSI GS NFV-SOL 002 [2] v2.6.1
42
43
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: none
44
    ...    Post-Conditions: The VNF Performance Threshold is not available anymore in the VNFM    
45
46
47
48
    Send Delete request for individual VNF Performance Threshold
    Check HTTP Response Status Code Is    204
    Check Postcondition VNF Performance Threshold is Deleted

49
DELETE Individual Threshold with invalid resource identifier
50
    [Documentation]    Test ID: 6.3.3.5.4
51
    ...    Test title: DELETE Individual Threshold with invalid resource identifier
52
53
    ...    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.
Michele Carignani's avatar
Michele Carignani committed
54
    ...    Reference: Clause 6.4.6.3.5 - ETSI GS NFV-SOL 002 [2] v2.6.1
55
56
57
58
59
60
61
62
63
64
65
    ...    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

POST Individual Threshold - Method not implemented
    [Documentation]    Test ID: 6.3.3.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
Michele Carignani's avatar
Michele Carignani committed
66
    ...    Reference: Clause 6.4.6.3.1 - ETSI GS NFV-SOL 002 [2] v2.6.1
67
68
69
70
71
72
73
74
75
76
77
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: none
    ...    Post-Conditions: The VNF Performance Threshold is not created on the VNFM
    Send Post request for individual VNF Performance Threshold
    Check HTTP Response Status Code Is    405
    Check Postcondition VNF Performance Threshold is not Created

PUT Individual Threshold - Method not implemented
    [Documentation]    Test ID: 6.3.3.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
78
    ...    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
79
    ...    Reference: Clause 6.4.6.3.3 - ETSI GS NFV-SOL 002 [2] v2.6.1
80
81
82
83
84
85
86
87
88
89
90
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: none
    ...    Post-Conditions: The VNF Performance Threshold is not modified by the operation
    Send Put request for individual VNF Performance Threshold
    Check HTTP Response Status Code Is    405
    Check Postcondition VNF Performance Threshold is Unmodified (Implicit)

PATCH Individual Threshold - Method not implemented
    [Documentation]    Test ID: 6.3.3.5.7
    ...    Test title: PATCH Individual Threshold - Method not implemented
    ...    Test objective: The objective is to test that PATCH method is not allowed to modify an existing VNF Performance threshold
91
    ...    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
92
    ...    Reference: Clause 6.4.6.3.4 - ETSI GS NFV-SOL 002 [2] v2.6.1
93
94
95
96
97
98
99
100
101
102
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: none
    ...    Post-Conditions: The VNF Performance Threshold is not modified by the operation
    Send Patch request for individual VNF Performance Threshold
    Check HTTP Response Status Code Is    405
    Check Postcondition VNF Performance Threshold is Unmodified (Implicit)

*** Keywords ***
GET Individual VNF Performance Threshold
    Log    Trying to get a Threhsold present in the VNFM
103
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
104
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
105
    GET    ${apiRoot}/${apiName}/${apiVersion}/thresholds/${thresholdId}
106
    ${output}=    Output    response
107
    Set Suite Variable    ${response}    ${output}
108
109
110

GET individual VNF Performance Threshold with invalid resource identifier
    Log    Trying to get a Threhsold with invalid resource endpoint
111
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
112
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
113
    GET    ${apiRoot}/${apiName}/${apiVersion}/thresholds/${erroneousThresholdId}
114
    ${output}=    Output    response
115
    Set Suite Variable    ${response}    ${output}
116

117
118
Send Delete request for individual VNF Performance Threshold
    Log    Trying to delete a Threhsold in the VNFM
119
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
120
    DELETE    ${apiRoot}/${apiName}/${apiVersion}/thresholds/${thresholdId}
121
    ${output}=    Output    response
122
    Set Suite Variable    ${response}    ${output}
123
124
125

Send Delete request for individual VNF Performance Threshold with invalid resource identifier
    Log    Trying to delete a Threhsold in the VNFM with invalid id
126
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
127
    DELETE    ${apiRoot}/${apiName}/${apiVersion}/thresholds/${erroneousThresholdId}
128
    ${output}=    Output    response
129
    Set Suite Variable    ${response}    ${output}
130
131
132

Send Post request for individual VNF Performance Threshold
    Log    Trying to create new threshold
133
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
134
135
    POST    ${apiRoot}/${apiName}/${apiVersion}/thresholds/${newThresholdId}
    ${output}=    Output    response
136
    Set Suite Variable    ${response}    ${output}
137

138
139
140
Send Put request for individual VNF Performance Threshold
    Log    Trying to PUT threshold
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
141
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
142
143
    GET    ${apiRoot}/${apiName}/${apiVersion}/thresholds/${thresholdId}
    ${origOutput}=    Output    response
Giacomo Bernini's avatar
Giacomo Bernini committed
144
    Set Suite Variable    ${origResponse}    ${origOutput}
145
146
    PUT    ${apiRoot}/${apiName}/${apiVersion}/thresholds/${thresholdId}
    ${output}=    Output    response
147
    Set Suite Variable    ${response}    ${output}
148

149
150
151
Send Patch request for individual VNF Performance Threshold
    Log    Trying to PUT threshold
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
152
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
153
154
    GET    ${apiRoot}/${apiName}/${apiVersion}/thresholds/${thresholdId}
    ${origOutput}=    Output    response
Giacomo Bernini's avatar
Giacomo Bernini committed
155
    Set Suite Variable    ${origResponse}    ${origOutput}
156
157
    PATCH    ${apiRoot}/${apiName}/${apiVersion}/thresholds/${thresholdId}
    ${output}=    Output    response
158
    Set Suite Variable    ${response}    ${output}
159
160
161
162
163

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
Giacomo Bernini's avatar
Giacomo Bernini committed
164
165
166
    ${threshold}=    evaluate    json.loads('''${response['body']}''')    json
    Should Be Equal    ${origresponse['body']['id']}    ${threshold.id}
    Should Be Equal    ${origresponse['body']['criteria']}    ${threshold.criteria}
167
168
169
170
    
Check Postcondition VNF Performance Threshold is not Created
    Log    Trying to get a new Threshold
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
171
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
172
173
    GET    ${apiRoot}/${apiName}/${apiVersion}/thresholds/${newThresholdId}
    ${output}=    Output    response
174
    Set Suite Variable    ${response}    ${output}
175
176
177
178
179
180
181
182
183
    Check HTTP Response Status Code Is    404

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
Giacomo Bernini's avatar
Giacomo Bernini committed
184
    Should Be Equal    ${response['body']['id']}    ${thresholdId} 
185
186
187
188
189
    Log    Pm Job identifier as expected
    
Check HTTP Response Status Code Is
    [Arguments]    ${expected_status}
    ${status}=    Convert To Integer    ${expected_status}    
Giacomo Bernini's avatar
Giacomo Bernini committed
190
    Should Be Equal    ${response['status']}    ${status} 
191
192
193
194
    Log    Status code validated

Check HTTP Response Header Contains
    [Arguments]    ${CONTENT_TYPE}
Giacomo Bernini's avatar
Giacomo Bernini committed
195
    Should Contain    ${response['headers']}    ${CONTENT_TYPE}
196
197
198
199
    Log    Header is present
    
Check HTTP Response Body Json Schema Is
    [Arguments]    ${input}
200
201
    Run Keyword If    '${input}' == 'ProblemDetails'    Should Contain    ${response['headers']['Content-Type']}    application/problem+json
    ...    ELSE    Should Contain    ${response['headers']['Content-Type']}    application/json
202
    ${schema} =    Catenate    SEPARATOR=    ${input}	.schema.json
Giacomo Bernini's avatar
Giacomo Bernini committed
203
    Validate Json    ${schema}    ${response['body']}
204
205
206
    Log    Json Schema Validation OK