ApiVersion.robot 9.41 KB
Newer Older
1
*** Settings ***
Giacomo Bernini's avatar
Giacomo Bernini committed
2

3
Resource    environment/variables.txt
Giacomo Bernini's avatar
Giacomo Bernini committed
4

5
Library    REST    ${VNFM_SCHEMA}://${VNFM_HOST}:${VNFM_PORT}     ssl_verify=false
6
7
8
9
10
11
12
13
14
15
Library    DependencyLibrary
Library    JSONLibrary
Library    JSONSchemaLibrary    schemas/

*** Test Cases ***
POST API Version - Method not implemented
    [Documentation]    Test ID: 7.3.5.6.1
    ...    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
16
    ...    Reference: Clause 9.3.3.3.1 - ETSI GS NFV-SOL 013 v2.6.1
17
18
19
20
21
22
23
24
25
26
27
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: none
    ...    Post-Conditions: none    
    POST API Version
	Check HTTP Response Status Code Is    405
    
GET API Version
    [Documentation]    Test ID: 7.3.5.6.2
    ...    Test title: GET API Version
    ...    Test objective: The objective is to test that GET method successfully return ApiVersionInformation
    ...    Pre-conditions: none
Michele Carignani's avatar
Michele Carignani committed
28
    ...    Reference: Clause 9.3.3.3.2 - ETSI GS NFV-SOL 013 v2.6.1
29
30
31
32
33
34
35
36
    ...    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
37
    [Documentation]    Test ID: 7.3.5.6.3
38
39
40
    ...    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
41
    ...    Reference: Clause 9.3.3.3.3 - ETSI GS NFV-SOL 013 v2.6.1
42
43
44
45
46
47
48
49
50
51
52
    ...    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
    [Documentation]    Test ID: 7.3.5.6.4
    ...    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
53
    ...    Reference: Clause 9.3.3.3.4 - ETSI GS NFV-SOL 013 v2.6.1
54
55
56
57
58
59
60
61
62
63
64
    ...    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
    [Documentation]    Test ID: 7.3.5.6.5
    ...    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
65
    ...    Reference: Clause 9.3.3.3.5 - ETSI GS NFV-SOL 013 v2.6.1
66
67
68
69
70
71
72
73
74
75
76
    ...    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
    [Documentation]    Test ID: 7.3.5.6.6
    ...    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
77
    ...    Reference: Clause 9.3.3.3.1 - ETSI GS NFV-SOL 013 v2.6.1
78
79
80
81
82
83
84
85
86
87
88
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: none
    ...    Post-Conditions: none    
    POST API Version
	Check HTTP Response Status Code Is    405
    
GET API Version with apiMajorVerion
    [Documentation]    Test ID: 7.3.5.6.7
    ...    Test title: GET API Version with apiMajorVerion
    ...    Test objective: The objective is to test that GET method successfully return ApiVersionInformation
    ...    Pre-conditions: none
Michele Carignani's avatar
Michele Carignani committed
89
    ...    Reference: Clause 9.3.3.3.2 - ETSI GS NFV-SOL 013 v2.6.1
90
91
92
93
94
95
96
97
    ...    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
98
    [Documentation]    Test ID: 7.3.5.6.8
99
100
101
    ...    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
102
    ...    Reference: Clause 9.3.3.3.3 - ETSI GS NFV-SOL 013 v2.6.1
103
104
105
106
107
108
109
110
111
112
113
    ...    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
    [Documentation]    Test ID: 7.3.5.6.9
    ...    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
114
    ...    Reference: Clause 9.3.3.3.4 - ETSI GS NFV-SOL 013 v2.6.1
115
116
117
118
119
120
121
122
123
124
125
    ...    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
    [Documentation]    Test ID: 7.3.5.6.10
    ...    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
126
    ...    Reference: Clause 9.3.3.3.5 - ETSI GS NFV-SOL 013 v2.6.1
127
128
129
130
131
132
133
134
135
    ...    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}"} 
136
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
137
    Post    ${apiRoot}/${apiName}/api_versions
138
    ${outputResponse}=    Output    response
139
	Set Global Variable    ${response}    ${outputResponse} 
140
141
142
	
GET API Version
    Set Headers    {"Accept":"${ACCEPT}"} 
143
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
144
    Get    ${apiRoot}/${apiName}/api_versions
145
    ${outputResponse}=    Output    response
146
	Set Global Variable    ${response}    ${outputResponse} 
147
148
149
	
PUT API Version
    Set Headers    {"Accept":"${ACCEPT}"} 
150
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
151
    Put    ${apiRoot}/${apiName}/api_versions
152
    ${outputResponse}=    Output    response
153
	Set Global Variable    ${response}    ${outputResponse} 
154
155
156
	
PATCH API Version
    Set Headers    {"Accept":"${ACCEPT}"} 
157
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
158
    Patch    ${apiRoot}/${apiName}/api_versions
159
    ${outputResponse}=    Output    response
160
	Set Global Variable    ${response}    ${outputResponse} 
161
162
163
	
DELETE API Version
    Set Headers    {"Accept":"${ACCEPT}"} 
164
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
165
    Delete    ${apiRoot}/${apiName}/api_versions
166
    ${outputResponse}=    Output    response
167
	Set Global Variable    ${response}    ${outputResponse} 
168
169
170
	
POST API Version with apiMajorVersion
    Set Headers    {"Accept":"${ACCEPT}"} 
171
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
172
    Post    ${apiRoot}/${apiName}/v1/api_versions
173
    ${outputResponse}=    Output    response
174
	Set Global Variable    ${response}    ${outputResponse} 
175
176
177
	
GET API Version with apiMajorVersion
    Set Headers    {"Accept":"${ACCEPT}"} 
178
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
179
    Get    ${apiRoot}/${apiName}/v1/api_versions
180
    ${outputResponse}=    Output    response
181
	Set Global Variable    ${response}    ${outputResponse} 
182
183
184
	
PUT API Version with apiMajorVersion
    Set Headers    {"Accept":"${ACCEPT}"} 
185
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
186
    Put    ${apiRoot}/${apiName}/v1/api_versions
187
    ${outputResponse}=    Output    response
188
	Set Global Variable    ${response}    ${outputResponse} 
189
190
191
	
PATCH API Version with apiMajorVersion
    Set Headers    {"Accept":"${ACCEPT}"} 
192
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
193
    Patch    ${apiRoot}/${apiName}/v1/api_versions
194
    ${outputResponse}=    Output    response
195
	Set Global Variable    ${response}    ${outputResponse} 
196
197
198
	
DELETE API Version with apiMajorVersion
    Set Headers    {"Accept":"${ACCEPT}"} 
199
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
200
    Delete    ${apiRoot}/${apiName}/v1/api_versions
201
    ${outputResponse}=    Output    response
202
	Set Global Variable    ${response}    ${outputResponse} 
Giacomo Bernini's avatar
Giacomo Bernini committed
203
204
205
	
Check HTTP Response Status Code Is
    [Arguments]    ${expected_status}    
206
    Should Be Equal As Strings   ${response['status']}    ${expected_status}
Giacomo Bernini's avatar
Giacomo Bernini committed
207
208
209
210
    Log    Status code validated 

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