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

*** Test Cases ***
9
GET individual VNF Performance Job
Giacomo Bernini's avatar
upd    
Giacomo Bernini committed
10
    [Documentation]    Test ID: 6.3.3.2.1
11
12
13
14
15
16
17
18
19
20
21
22
23
    ...    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.
    ...    Reference: section 6.4.3.3.2 - SOL002 v2.4.1
    ...    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

GET individual VNF Performance Job with invalid resource identifier
Giacomo Bernini's avatar
upd    
Giacomo Bernini committed
24
    [Documentation]    Test ID: 6.3.3.2.2
25
    ...    Test title: Get individual VNF Performance Job with invalid resource identifier
Giacomo Bernini's avatar
upd    
Giacomo Bernini committed
26
    ...    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
27
28
29
30
31
32
33
34
35
36
    ...    Pre-conditions: A VNF instance is instantiated. One or more VNF performance jobs are set in the VNFM.
    ...    Reference: section 6.4.3.3.2 - SOL002 v2.4.1
    ...    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
Giacomo Bernini's avatar
upd    
Giacomo Bernini committed
37
    [Documentation]    Test ID: 6.3.3.2.3
38
39
40
41
42
43
44
45
46
47
48
49
    ...    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.
    ...    Reference: section 6.4.3.3.5 - SOL002 v2.4.1
    ...    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
Giacomo Bernini's avatar
upd    
Giacomo Bernini committed
50
    [Documentation]    Test ID: 6.3.3.2.4
51
    ...    Test title: Delete individual VNF Performance Job with invalid resource identifier
Giacomo Bernini's avatar
upd    
Giacomo Bernini committed
52
    ...    Test objective: The objective is to test that the deletion 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
53
54
55
56
57
58
59
60
61
62
    ...    Pre-conditions: A VNF instance is instantiated. One or more VNF performance jobs are set in the VNFM.
    ...    Reference: section 6.4.3.3.5 - SOL002 v2.4.1
    ...    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
    Check HTTP Response Body Json Schema Is   ProblemDetails

POST Individual VNF Performance Job - Method not implemented
Giacomo Bernini's avatar
upd    
Giacomo Bernini committed
63
    [Documentation]    Test ID: 6.3.3.2.5
64
65
66
67
68
69
70
71
72
73
74
75
    ...    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
    ...    Reference: section 6.4.3.3.1 - SOL002 v2.4.1
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: none
    ...    Post-Conditions: The VNF Performance Job is not created on the VNFM
    Send Post request for individual VNF Performance Job
    Check HTTP Response Status Code Is    405
    Check Postcondition VNF Performance Job is not Created

PUT Individual VNF Performance Job - Method not implemented
Giacomo Bernini's avatar
upd    
Giacomo Bernini committed
76
    [Documentation]    Test ID: 6.3.3.2.6
77
78
79
80
81
82
83
84
85
86
87
88
    ...    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.
    ...    Reference: section 6.4.3.3.4 - SOL002 v2.4.1
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: none
    ...    Post-Conditions: The VNF Performance Job is not modified by the operation
    Send Put request for individual VNF Performance Job
    Check HTTP Response Status Code Is    405
    Check Postcondition VNF Performance Job is Unmodified (Implicit)

PATCH Individual VNF Performance Job - Method not implemented
Giacomo Bernini's avatar
upd    
Giacomo Bernini committed
89
    [Documentation]    Test ID: 6.3.3.2.7
90
91
92
93
94
95
96
97
98
99
100
101
102
    ...    Test title: PATCH Individual VNF Performance Job - method not implemented
    ...    Test objective: The objective is to test that PATCH method is not allowed to modify an existing new VNF Performance Monitoring Job
    ...    Pre-conditions: A VNF instance is instantiated. One or more VNF performance jobs are set in the VNFM.
    ...    Reference: section 6.4.3.3.5 - SOL002 v2.4.1
    ...    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    405
    Check Postcondition VNF Performance Job is Unmodified (Implicit)
    
*** Keywords ***
GET individual VNF Performance Job
103
104
    Log    Trying to get a Pm Job present in the NFVO Catalogue
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
Elian Kraja's avatar
Elian Kraja committed
105
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
106
    GET    ${apiRoot}/${apiName}/${apiVersion}/pm_jobs/${pmJobId}
107
108
109
110
    ${output}=    Output    response
    Set Suite Variable    @{response}    ${output}

GET individual VNF Performance Job with invalid resource identifier  
111
112
    Log    Trying to perform a negative get, using erroneous PM Job identifier
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
Elian Kraja's avatar
Elian Kraja committed
113
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
114
    GET    ${apiRoot}/${apiName}/${apiVersion}/pm_jobs/${erroneousPmJobId}
115
116
117
118
    ${output}=    Output    response
    Set Suite Variable    @{response}    ${output}

Send Delete request for individual VNF Performance Job
119
120
    Log    Trying to delete an existing PM Job
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
Elian Kraja's avatar
Elian Kraja committed
121
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
122
    DELETE    ${apiRoot}/${apiName}/${apiVersion}/pm_jobs/${pmJobId}
123
124
125
126
127
    ${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
128
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
Elian Kraja's avatar
Elian Kraja committed
129
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
130
    DELETE    ${apiRoot}/${apiName}/${apiVersion}/pm_jobs/${erroneousPmJobId}
131
132
    ${output}=    Output    response
    Set Suite Variable    @{response}    ${output}
133

134
Send Post request for individual VNF Performance Job    
135
136
    Log    Trying to perform a POST (method should not be implemented)
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
Elian Kraja's avatar
Elian Kraja committed
137
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
138
139
140
141
142
143
    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)
144
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
Elian Kraja's avatar
Elian Kraja committed
145
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
146
147
148
    GET    ${apiRoot}/${apiName}/${apiVersion}/pm_jobs/${pmJobId}
    ${origOutput}=    Output    response
    Set Suite Variable    @{origResponse}    ${origOutput}
149
    PUT    ${apiRoot}/${apiName}/${apiVersion}/pm_jobs/${pmJobId}
150
151
152
153
154
    ${output}=    Output    response
    Set Suite Variable    @{response}    ${output}
    
Send Patch request for individual VNF Performance Job    
    Log    Trying to perform a PATCH (method should not be implemented)
155
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
Elian Kraja's avatar
Elian Kraja committed
156
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
157
    PATCH    ${apiRoot}/${apiName}/${apiVersion}/pm_jobs/${pmJobId}
158
159
160
161
162
163
164
165
166
167
168
169
170
171
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
206
    ${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[0]['body']}''')    json
    Should Be Equal    ${origResponse[0]['body']['id']}    ${pmJob.id}
    Should Be Equal    ${origResponse[0]['body']['criteria']}    ${pmJob.criteria}
    Should Be Equal    ${origResponse[0]['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
    Log    Going to validate Pm Job info retrieved
    Should Be Equal    ${response[0]['body']['id']}    ${pmJobId} 
    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[0]['status']}    ${status} 
    Log    Status code validated

Check HTTP Response Header Contains
    [Arguments]    ${CONTENT_TYPE}
    Should Contain    ${response[0]['headers']}    ${CONTENT_TYPE}
    Log    Header is present
    
Check HTTP Response Body Json Schema Is
    [Arguments]    ${input}
    Should Contain    ${response[0]['headers']['Content-Type']}    application/json
    ${schema} =    Catenate    ${input}    .schema.json
    Validate Json    ${schema}    ${response[0]['body']}
    Log    Json Schema Validation OK