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

*** Test Cases ***
10
11
12
13
14
GET individual VNF Performance Job
    [Documentation]    Test ID: 7.3.4.2.1
    ...    Test title: Get individual VNF Performance Job
    ...    Test objective: The objective is to test the retrieval of an individual VNF performance monitoring job and perform a JSON schema and content validation of the collected job data structure
    ...    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
15
    ...    Reference: Clause 6.4.3.3.2 - ETSI GS NFV-SOL 003 [1] 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 Job
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is   PmJob
    Check HTTP Response Body Pm Job Identifier matches the requested Pm Job

GET individual VNF Performance Job with invalid resource identifier
    [Documentation]    Test ID: 7.3.4.2.2
    ...    Test title: Get individual VNF Performance Job with invalid resource identifier
    ...    Test objective: The objective is to test that the retrieval of an individual VNF performance monitoring job fails when using an invalid resource identifier, and perform the JSON schema validation of the failed operation HTTP response
    ...    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.3.3.2 - ETSI GS NFV-SOL 003 [1] v2.6.1
30
31
32
33
34
35
36
37
38
39
40
41
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: none
    ...    Post-Conditions: none
    GET individual VNF Performance Job with invalid resource identifier
    Check HTTP Response Status Code Is    404
    Check HTTP Response Body Json Schema Is   ProblemDetails

DELETE Individual VNF Performance Job
    [Documentation]    Test ID: 7.3.4.2.3
    ...    Test title: Delete Individual VNF Performance Job
    ...    Test objective: The objective is to test the deletion of an individual VNF performance monitoring job
    ...    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
42
    ...    Reference: Clause 6.4.3.3.5 - ETSI GS NFV-SOL 003 [1] v2.6.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 Job is no more available in the VNFM    
    Send Delete request for individual VNF Performance Job
    Check HTTP Response Status Code Is    204
    Check Postcondition VNF Pm Job is Deleted

DELETE Individual VNF Performance Job with invalid resource identifier
    [Documentation]    Test ID: 7.3.4.2.4
    ...    Test title: Delete individual VNF Performance Job with invalid resource identifier
    ...    Test objective: The objective is to test that the deletion of an individual VNF performance monitoring job 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
55
    ...    Reference: Clause 6.4.3.3.5 - ETSI GS NFV-SOL 003 [1] v2.6.1
56
57
58
59
60
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: none
    ...    Post-Conditions: none
    Send Delete request for individual VNF Performance Job 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 VNF Performance Job - Method not implemented
    [Documentation]    Test ID: 7.3.4.2.5
    ...    Test title: POST Individual VNF Performance Job - method not implemented
    ...    Test objective: The objective is to test that POST method is not allowed to create a new VNF Performance Monitoring Job
    ...    Pre-conditions: A VNF instance is instantiated
Michele Carignani's avatar
Michele Carignani committed
68
    ...    Reference: Clause 6.4.3.3.1 - ETSI GS NFV-SOL 003 [1] v2.6.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 Job
    Check HTTP Response Status Code Is    405

PUT Individual VNF Performance Job - Method not implemented
    [Documentation]    Test ID: 7.3.4.2.6
    ...    Test title: PUT Individual VNF Performance Job - method not implemented
    ...    Test objective: The objective is to test that PUT method is not allowed to update an existing VNF Performance Monitoring Job
    ...    Pre-conditions: A VNF instance is instantiated. One or more VNF performance jobs are set in the VNFM.
80
    ...    Reference: Clause 6.4.3.3.3 - ETSI GS NFV-SOL 003 [1] v2.6.1
81
82
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: none
83
    ...    Post-Conditions: none
84
85
86
    Send Put request for individual VNF Performance Job
    Check HTTP Response Status Code Is    405

87
PATCH Individual VNF Performance Job
88
    [Documentation]    Test ID: 7.3.4.2.7
89
    ...    Test title: PATCH Individual VNF Performance Job
90
    ...    Test objective: The objective is to test that PATCH method allows to modify individual performace management job
91
    ...    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
92
    ...    Reference: Clause 6.4.3.3.4 - ETSI GS NFV-SOL 003 [1] v2.6.1
93
94
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: none
95
    ...    Post-Conditions: 
96
    Send Patch request for individual VNF Performance Job
97
98
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is    PMJobModifications
99
    
100
101
102
103
104
PATCH Individual VNF Performance Job - Precondition failed
    [Documentation]    Test ID: 7.3.4.2.8
    ...    Test title: PATCH Individual VNF Performance Job - Precondition failed
    ...    Test objective: The objective is to attempt to Modify an individual alarm 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.
105
    ...    Reference: Clause 6.4.3.3.4 - ETSI GS NFV-SOL 003 [1] v2.6.1
106
107
108
109
110
111
112
    ...    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 Job
    Check HTTP Response Status Code Is    412
    Check HTTP Response Body Json Schema Is   ProblemDetails
    Check Postcondition VNF Performance Job is Unmodified (Implicit)    
113
114
*** Keywords ***
GET individual VNF Performance Job
115
    Log    Trying to get a Pm Job present in the NFVO Catalogue
116
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
117
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
118
    GET    ${apiRoot}/${apiName}/${apiVersion}/pm_jobs/${pmJobId}
119
120
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}
121

122
GET individual VNF Performance Job with invalid resource identifier  
123
    Log    Trying to perform a negative get, using erroneous PM Job identifier
124
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
125
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
126
    GET    ${apiRoot}/${apiName}/${apiVersion}/pm_jobs/${erroneousPmJobId}
127
128
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}
129

130
Send Delete request for individual VNF Performance Job
131
132
    Log    Trying to delete an existing PM Job
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
133
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
134
    DELETE    ${apiRoot}/${apiName}/${apiVersion}/pm_jobs/${pmJobId}
135
136
137
138
139
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}
    
Send Delete request for individual VNF Performance Job with invalid resource identifier
    Log    Trying to perform a negative delete, using erroneous PM Job identifier
140
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
141
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
142
    DELETE    ${apiRoot}/${apiName}/${apiVersion}/pm_jobs/${erroneousPmJobId}
143
144
145
146
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}

Send Post request for individual VNF Performance Job    
147
    Log    Trying to perform a POST (method should not be implemented)
148
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
149
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
150
151
152
153
154
155
    POST    ${apiRoot}/${apiName}/${apiVersion}/pm_jobs/${newPmJobId}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}
    
Send Put request for individual VNF Performance Job    
    Log    Trying to perform a POST (method should not be implemented)
156
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
157
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
158
159
160
    GET    ${apiRoot}/${apiName}/${apiVersion}/pm_jobs/${pmJobId}
    ${origOutput}=    Output    response
    Set Suite Variable    ${origResponse}    ${origOutput}
161
    PUT    ${apiRoot}/${apiName}/${apiVersion}/pm_jobs/${pmJobId}
162
163
164
165
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}
    
Send Patch request for individual VNF Performance Job    
166
167
168
169
170
171
    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/PMJobModifications.json
    PATCH    ${apiRoot}/${apiName}/${apiVersion}/pm_jobs/${pmJobId}     ${body}

172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}

Check Postcondition VNF Performance Job is not Created
    Log    Trying to get a new Pm Job
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    GET    ${apiRoot}/${apiName}/${apiVersion}/pm_jobs/${newPmJobId}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}
    Check HTTP Response Status Code Is    404

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

Check Postcondition VNF Pm Job is Deleted
    Log    Check Postcondition
    GET individual VNF Performance Job
    Check HTTP Response Status Code Is    404

Check HTTP Response Body Pm Job Identifier matches the requested Pm Job
    Log    Going to validate Pm Job info retrieved
    Should Be Equal    ${response['body']['id']}    ${pmJobId} 
    Log    Pm Job identifier as expected
    
Check HTTP Response Status Code Is
    [Arguments]    ${expected_status}
    ${status}=    Convert To Integer    ${expected_status}    
206
    Should Be Equal As Strings    ${response['status']}    ${status} 
207
    Log    Status code validated
208

209
210
211
212
213
214
215
216
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
217
    ${schema} =    Catenate    SEPARATOR=    ${input}	.schema.json
218
219
    Validate Json    ${schema}    ${response['body']}
    Log    Json Schema Validation OK