ApiVersion.robot 9.21 KB
Newer Older
1
2
*** Settings ***
Resource    environment/variables.txt
3
Library    REST    ${EM-VNF_SCHEMA}://${EM-VNF_HOST}:${EM-VNF_PORT} 
4
5
6
7
8
9
Library    DependencyLibrary
Library    JSONLibrary
Library    JSONSchemaLibrary    schemas/

*** Test Cases ***
POST API Version - Method not implemented
10
    [Documentation]    Test ID: 6.3.1.2.1
11
12
13
    ...    Test title: POST API version - Method not implemented
    ...    Test objective: The objective is to test that POST method is not implemented
    ...    Pre-conditions: none
Michele Carignani's avatar
Michele Carignani committed
14
    ...    Reference: Clause 9.3.3.3.1 - ETSI GS NFV-SOL 013 v2.6.1
15
16
17
18
19
20
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: none
    ...    Post-Conditions: none    
    POST API Version
	Check HTTP Response Status Code Is    405
    
Najam UI Hassan's avatar
Najam UI Hassan committed
21
GET API Version
22
    [Documentation]    Test ID: 6.3.1.2.2
Najam UI Hassan's avatar
Najam UI Hassan committed
23
24
    ...    Test title: GET API Version
    ...    Test objective: The objective is to test that GET method successfully return ApiVersionInformation
25
    ...    Pre-conditions: none
Michele Carignani's avatar
Michele Carignani committed
26
    ...    Reference: Clause 9.3.3.3.2 - ETSI GS NFV-SOL 013 v2.6.1
27
28
29
30
31
32
33
34
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: none
    ...    Post-Conditions: none 
    GET API Version
	Check HTTP Response Status Code Is    200
	Check HTTP Response Body Json Schema Is    ApiVersionInformation

PUT API Version - Method not implemented
Michele Carignani's avatar
Michele Carignani committed
35
    [Documentation]    Test ID: 6.3.1.2.3
36
37
38
    ...    Test title: PUT API Version - Method not implemented
    ...    Test objective: The objective is to test that PUT method is not implemented
    ...    Pre-conditions: none
Michele Carignani's avatar
Michele Carignani committed
39
    ...    Reference: Clause 9.3.3.3.3 - ETSI GS NFV-SOL 013 v2.6.1
40
41
42
43
44
45
46
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: none
    ...    Post-Conditions: none 
    PUT API Version
	Check HTTP Response Status Code Is    405

PATCH API Version - Method not implemented
47
    [Documentation]    Test ID: 6.3.1.2.4
48
49
50
    ...    Test title: PATCH API Version - Method not implemented
    ...    Test objective: The objective is to test that PATCH method is not implemented
    ...    Pre-conditions: none
Michele Carignani's avatar
Michele Carignani committed
51
    ...    Reference: Clause 9.3.3.3.4 - ETSI GS NFV-SOL 013 v2.6.1
52
53
54
55
56
57
58
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: none
    ...    Post-Conditions: none 
    PATCH API Version
	Check HTTP Response Status Code Is    405
    
DELETE API Version - Method not implemented
59
    [Documentation]    Test ID: 6.3.1.2.5
60
61
62
    ...    Test title: DELETE API Version - Method not implemented
    ...    Test objective: The objective is to test that DELETE method is not implemented
    ...    Pre-conditions: none
Michele Carignani's avatar
Michele Carignani committed
63
    ...    Reference: Clause 9.3.3.3.5 - ETSI GS NFV-SOL 013 v2.6.1
64
65
66
67
68
69
70
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: none
    ...    Post-Conditions: none 
    DELETE API Version
	Check HTTP Response Status Code Is    405
	
POST API Version with apiMajorVerion - Method not implemented
71
    [Documentation]    Test ID: 6.3.1.2.6
72
73
74
    ...    Test title: POST API version with apiMajorVerion - Method not implemented
    ...    Test objective: The objective is to test that POST method is not implemented
    ...    Pre-conditions: none
Michele Carignani's avatar
Michele Carignani committed
75
    ...    Reference: Clause 9.3.3.3.1 - ETSI GS NFV-SOL 013 v2.6.1
76
77
78
79
80
81
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: none
    ...    Post-Conditions: none    
    POST API Version
	Check HTTP Response Status Code Is    405
    
Najam UI Hassan's avatar
Najam UI Hassan committed
82
GET API Version with apiMajorVerion
83
    [Documentation]    Test ID: 6.3.1.2.7
Najam UI Hassan's avatar
Najam UI Hassan committed
84
85
    ...    Test title: GET API Version with apiMajorVerion
    ...    Test objective: The objective is to test that GET method successfully return ApiVersionInformation
86
    ...    Pre-conditions: none
Michele Carignani's avatar
Michele Carignani committed
87
    ...    Reference: Clause 9.3.3.3.2 - ETSI GS NFV-SOL 013 v2.6.1
88
89
90
91
92
93
94
95
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: none
    ...    Post-Conditions: none 
    GET API Version
	Check HTTP Response Status Code Is    200
	Check HTTP Response Body Json Schema Is    ApiVersionInformation

PUT API Version with apiMajorVerion - Method not implemented
Michele Carignani's avatar
Michele Carignani committed
96
    [Documentation]    Test ID: 6.3.1.2.8
97
98
99
    ...    Test title: PUT API Version with apiMajorVerion - Method not implemented
    ...    Test objective: The objective is to test that PUT method is not implemented
    ...    Pre-conditions: none
Michele Carignani's avatar
Michele Carignani committed
100
    ...    Reference: Clause 9.3.3.3.3 - ETSI GS NFV-SOL 013 v2.6.1
101
102
103
104
105
106
107
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: none
    ...    Post-Conditions: none 
    PUT API Version
	Check HTTP Response Status Code Is    405

PATCH API Version with apiMajorVerion - Method not implemented
108
    [Documentation]    Test ID: 6.3.1.2.9
109
110
111
    ...    Test title: PATCH API Version with apiMajorVerion - Method not implemented
    ...    Test objective: The objective is to test that PATCH method is not implemented
    ...    Pre-conditions: none
Michele Carignani's avatar
Michele Carignani committed
112
    ...    Reference: Clause 9.3.3.3.4 - ETSI GS NFV-SOL 013 v2.6.1
113
114
115
116
117
118
119
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: none
    ...    Post-Conditions: none 
    PATCH API Version
	Check HTTP Response Status Code Is    405
    
DELETE API Version with apiMajorVerion - Method not implemented
120
    [Documentation]    Test ID: 6.3.1.2.10
121
122
123
    ...    Test title: DELETE API Version with apiMajorVerion - Method not implemented
    ...    Test objective: The objective is to test that DELETE method is not implemented
    ...    Pre-conditions: none
Michele Carignani's avatar
Michele Carignani committed
124
    ...    Reference: Clause 9.3.3.3.5 - ETSI GS NFV-SOL 013 v2.6.1
125
126
127
128
129
130
131
132
133
134
135
136
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: none
    ...    Post-Conditions: none 
    DELETE API Version
	Check HTTP Response Status Code Is    405

*** Keywords ***
POST API Version
    Set Headers    {"Accept":"${ACCEPT}"} 
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Post    ${apiRoot}/${apiName}/api_version
    ${outputResponse}=    Output    response
Elian Kraja's avatar
Elian Kraja committed
137
	Set Global Variable    ${response}    ${outputResponse} 
138
139
140
141
142
143
	
GET API Version
    Set Headers    {"Accept":"${ACCEPT}"} 
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Get    ${apiRoot}/${apiName}/api_version
    ${outputResponse}=    Output    response
Elian Kraja's avatar
Elian Kraja committed
144
	Set Global Variable    ${response}    ${outputResponse} 
145
146
147
148
149
150
	
PUT API Version
    Set Headers    {"Accept":"${ACCEPT}"} 
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Put    ${apiRoot}/${apiName}/api_version
    ${outputResponse}=    Output    response
Elian Kraja's avatar
Elian Kraja committed
151
	Set Global Variable    ${response}    ${outputResponse} 
152
153
154
155
156
157
	
PATCH API Version
    Set Headers    {"Accept":"${ACCEPT}"} 
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Patch    ${apiRoot}/${apiName}/api_version
    ${outputResponse}=    Output    response
Elian Kraja's avatar
Elian Kraja committed
158
	Set Global Variable    ${response}    ${outputResponse} 
159
160
161
162
163
164
	
DELETE API Version
    Set Headers    {"Accept":"${ACCEPT}"} 
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Delete    ${apiRoot}/${apiName}/api_version
    ${outputResponse}=    Output    response
Elian Kraja's avatar
Elian Kraja committed
165
	Set Global Variable    ${response}    ${outputResponse} 
166
167
168
169
170
171
	
POST API Version with apiMajorVersion
    Set Headers    {"Accept":"${ACCEPT}"} 
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Post    ${apiRoot}/${apiName}/v1/api_version
    ${outputResponse}=    Output    response
Elian Kraja's avatar
Elian Kraja committed
172
	Set Global Variable    ${response}    ${outputResponse} 
173
174
175
176
177
178
	
GET API Version with apiMajorVersion
    Set Headers    {"Accept":"${ACCEPT}"} 
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Get    ${apiRoot}/${apiName}/v1/api_version
    ${outputResponse}=    Output    response
Elian Kraja's avatar
Elian Kraja committed
179
	Set Global Variable    ${response}    ${outputResponse} 
180
181
182
183
184
185
	
PUT API Version with apiMajorVersion
    Set Headers    {"Accept":"${ACCEPT}"} 
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Put    ${apiRoot}/${apiName}/v1/api_version
    ${outputResponse}=    Output    response
Elian Kraja's avatar
Elian Kraja committed
186
	Set Global Variable    ${response}    ${outputResponse} 
187
188
189
190
191
192
	
PATCH API Version with apiMajorVersion
    Set Headers    {"Accept":"${ACCEPT}"} 
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Patch    ${apiRoot}/${apiName}/v1/api_version
    ${outputResponse}=    Output    response
Elian Kraja's avatar
Elian Kraja committed
193
	Set Global Variable    ${response}    ${outputResponse} 
194
195
196
197
198
199
	
DELETE API Version with apiMajorVersion
    Set Headers    {"Accept":"${ACCEPT}"} 
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Delete    ${apiRoot}/${apiName}/v1/api_version
    ${outputResponse}=    Output    response
Elian Kraja's avatar
Elian Kraja committed
200
	Set Global Variable    ${response}    ${outputResponse} 
Giacomo Bernini's avatar
Giacomo Bernini committed
201
202
203

Check HTTP Response Status Code Is
    [Arguments]    ${expected_status}    
Elian Kraja's avatar
Elian Kraja committed
204
    Should Be Equal As Strings   ${response['status']}    ${expected_status}
Giacomo Bernini's avatar
Giacomo Bernini committed
205
206
207
208
209
    Log    Status code validated 

Check HTTP Response Body Json Schema Is
    [Arguments]    ${input}
    ${schema} =    Catenate    ${input}    .schema.json
Elian Kraja's avatar
Elian Kraja committed
210
    Validate Json    ${schema}    ${response['body']}
Giacomo Bernini's avatar
Giacomo Bernini committed
211
    Log    Json Schema Validation OK