Newer
Older
Library REST ${NFVO_SCHEMA}://${NFVO_HOST}:${NFVO_PORT} ssl_verify=false
mengxuan.zhao
committed
Library OperatingSystem
Library JSONLibrary
Library JSONSchemaLibrary schemas/
Library Collections
Variables descriptors/SOL001/SOL002_VNFLifecycleManagement-API_descriptors_SOL001_reference_tst010_vnf_b_2vdu_SOL001.yaml
Variables descriptors/SOL006/SOL002_VNFLifecycleManagement-API_descriptors_SOL006_reference_tst010_vnf_b_2vdu_SOL006.yaml
Documentation This resource represents grants. The client can use this resource to obtain permission
... from the NFVO to perform a particular VNF lifecycle operation.
Requests a grant for a particular VNF lifecycle operation - Synchronous mode
[Documentation] Test ID: 7.3.2.1.1
... Test title: Requests a grant for a particular VNF lifecycle operation - Synchronous mode
... Test objective: The objective is to request a grant for a particular VNF lifecycle operation and perform a JSON schema validation on the returned grant data structure
... Reference: Clause 9.4.2.3.1 - ETSI GS NFV-SOL 003 [1] v2.7.1
... Applicability: The NFVO can decide immediately what to respond to a grant request
... Post-Conditions: The grant information is available to the VNFM.
Check HTTP Response Status Code Is 201
Requests a grant for a particular VNF lifecycle operation - Asynchronous mode
[Documentation] Test ID: 7.3.2.1.2
... Test title: Requests a grant for a particular VNF lifecycle operation - Asynchronous mode
... Test objective: The objective is to request a grant for a particular VNF lifecycle operation and perform a JSON schema validation on the returned grant data structure
... Reference: Clause 9.4.2.3.1 - ETSI GS NFV-SOL 003 [1] v2.7.1
... Applicability: The NFVO can not decide immediately what to respond to a grant request
... Post-Conditions: The grant information is available to the VNFM.
Check HTTP Response Status Code Is 202
Wait for individual grant successful notification
Requests a grant for a particular VNF lifecycle operation - Forbidden
[Documentation] Test ID: 7.3.2.1.3
... Test title: Requests a grant for a particular VNF lifecycle operation - Forbidden
... Test objective: The objective is to request a grant for a particular VNF lifecycle operation and the grant is rejected
... Reference: Clause 9.4.2.3.1 - ETSI GS NFV-SOL 003 [1] v2.7.1
Check HTTP Response Status Code Is 403
Check HTTP Response Body Json Schema Is ProblemDetails
GET Grants - Method not implemented
[Documentation] Test ID: 7.3.2.1.4
... Test title: GET Grants - Method not implemented
... Test objective: The objective is to test that GET method is not allowed for Life cycle operation granting
... Reference: Clause 9.4.2.3.2 - ETSI GS NFV-SOL 003 [1] v2.7.1
... Applicability: none
... Post-Conditions: none
Get Grants
Check HTTP Response Status Code Is 405
mengxuan.zhao
committed
PUT Grants - Method not implemented
[Documentation] Test ID: 7.3.2.1.5
... Test title: PUT Grants - Method not implemented
... Test objective: The objective is to test that PUT method is not allowed for Life cycle operation granting
... Reference: Clause 9.4.2.3.3 - ETSI GS NFV-SOL 003 [1] v2.7.1
... Applicability: none
... Post-Conditions: none
Put Grants
Check HTTP Response Status Code Is 405
mengxuan.zhao
committed
PATCH Grants - Method not implemented
[Documentation] Test ID: 7.3.2.1.6
... Test title: PATCH Grants - Method not implemented
... Test objective: The objective is to test that PATCH method is not allowed for Life cycle operation granting
... Reference: Clause 9.4.2.3.4 - ETSI GS NFV-SOL 003 [1] v2.7.1
... Applicability: none
... Post-Conditions: none
Patch Grants
Check HTTP Response Status Code Is 405
DELETE Grants - Method not implemented
[Documentation] Test ID: 7.3.2.1.7
... Test title: DELETE Grants - Method not implemented
... Test objective: The objective is to test that DELETE method is not allowed for Life cycle operation granting
... Reference: Clause 9.4.2.3.5 - ETSI GS NFV-SOL 003 [1] v2.7.1
Delete Grants
Check HTTP Response Status Code Is 405
Wait for individual grant successful notification
Wait Until Keyword Succeeds ${retry} ${polling} Get an individual grant - Successful
Log Request a new Grant for a VNF LCM operation by POST to ${apiRoot}/${apiName}/${apiMajorVersion}/grants
Pass Execution If ${SYNC_MODE} == 0 The Granting process is asynchronous mode. Skipping the test
Set Headers {"Accept": "${ACCEPT}"}
Set Headers {"Content-Type": "${CONTENT_TYPE}"}
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"}
Run Keyword If ${check_descriptors} == 1 Add VNF Descriptor Content to Grant Request
${template}= Get File jsons/grantRequest.json
${body}= Format String ${template} vnfInstanceId=${vnfInstanceId} vnfLcmOpOccId=${vnfLcmOpOccId} vnfdId=${Descriptor_ID} flavourId=${Flavour_ID}
Post ${apiRoot}/${apiName}/${apiMajorVersion}/grants ${body}
Set Suite Variable ${response} ${body}
Log Request a new Grant for a VNF LCM operation by POST to ${apiRoot}/${apiName}/${apiMajorVersion}/grants
Pass Execution If ${SYNC_MODE} == 1 The Granting process is synchronous mode. Skipping the test
Set Headers {"Accept": "${ACCEPT}"}
Set Headers {"Content-Type": "${CONTENT_TYPE}"}
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"}
Run Keyword If ${check_descriptors} == 1 Add VNF Descriptor Content to Grant Request
${template}= Get File jsons/grantRequest.json
${body}= Format String ${template} vnfInstanceId=${vnfInstanceId} vnfLcmOpOccId=${vnfLcmOpOccId} vnfdId=${Descriptor_ID} flavourId=${Flavour_ID}
Post ${apiRoot}/${apiName}/${apiMajorVersion}/grants ${body}
Set Suite Variable ${response} ${body}
Log Request a new Grant for a VNF LCM operation by POST to ${apiRoot}/${apiName}/${apiMajorVersion}/grants
Log The grant request should be rejected
Set Headers {"Accept": "${ACCEPT}"}
Set Headers {"Content-Type": "${CONTENT_TYPE}"}
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"}
Run Keyword If ${check_descriptors} == 1 Add VNF Descriptor Content to Grant Request
${template}= Get File jsons/grantRejectedRequest.json
${body}= Format String ${template} vnfInstanceId=${vnfInstanceId} vnfLcmOpOccId=${vnfLcmOpOccId} vnfdId=${Descriptor_ID} flavourId=${Flavour_ID}
Post ${apiRoot}/${apiName}/${apiMajorVersion}/grants ${body}
Set Suite Variable ${response} ${body}
Check HTTP Response Status Code Is
[Arguments] ${expected_status}
Should Be Equal As Strings ${response['status']} ${expected_status}
Check Operation Occurrence Id existence
${occId}= Get Value From Json ${response['headers']} $..Location
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}
${schema} = Catenate ${input} .schema.json
Validate Json ${schema} ${response['body']}
Get an individual grant - Successful
log Trying to read an individual grant
Set Headers {"Accept":"${ACCEPT}"}
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"}
Get ${response['headers']['Location']}
Log Validate Status code
Integer response status 200
Get Grants
Log Trying to perform a GET. This method should not be implemented
Set Headers {"Accept":"${ACCEPT}"}
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"}
Get ${apiRoot}/${apiName}/${apiMajorVersion}/grants
Set Suite Variable ${response} ${body}
Log Trying to perform a PUT. This method should not be implemented
Set Headers {"Accept":"${ACCEPT}"}
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"}
Put ${apiRoot}/${apiName}/${apiMajorVersion}/grants
Set Suite Variable ${response} ${body}
Log Trying to perform a PATCH. This method should not be implemented
Set Headers {"Accept":"${ACCEPT}"}
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"}
Patch ${apiRoot}/${apiName}/${apiMajorVersion}/grants
Set Suite Variable ${response} ${body}
Log Trying to perform a DELETE. This method should not be implemented
Set Headers {"Accept":"${ACCEPT}"}
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"}
Delete ${apiRoot}/${apiName}/${apiMajorVersion}/grants
Set Suite Variable ${response} ${body}
PARSE the Descriptor File
Run Keyword If '${descriptorType}'=='SOL001' Fetch Information from SOL001 descriptor file ELSE Fetch Information from SOL006 descriptor file
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
Fetch Information from SOL001 descriptor file
@{VNF_labels}= Create List
FOR ${key} IN @{topology_template.node_templates.keys()}
${key_type}= Get Variable Value ${topology_template.node_templates.${key}.type}
${VNF_check}= Run Keyword And Return Status Should Be Equal As Strings ${key_type} ${tosca_type_VNF}
Run Keyword If ${VNF_check} Append To List ${VNF_labels} ${key}
Run Keyword If ${VNF_check} Get VNF Attributes from SOL001 ${key}
END
Set Global Variable @{VNF_IDs} @{VNF_labels}
Get VNF Attributes from SOL001
[Arguments] ${VNF_label}
${descriptor_id}= Get Variable Value ${topology_template.node_templates.${VNF_label}.properties.descriptor_id}
${provider}= Get Variable Value ${topology_template.node_templates.${VNF_label}.properties.provider}
${product_name}= Get Variable Value ${topology_template.node_templates.${VNF_label}.properties.product_name}
${software_version}= Get Variable Value ${topology_template.node_templates.${VNF_label}.properties.software_version}
${descriptor_version}= Get Variable Value ${topology_template.node_templates.${VNF_label}.properties.descriptor_version}
${flavour_id}= Get Variable Value ${topology_template.node_templates.${VNF_label}.properties.flavour_id}
Set Global Variable ${Descriptor_ID} ${descriptor_id}
Set Global Variable ${Provider} ${provider}
Set Global Variable ${Product_Name} ${product_name}
Set Global Variable ${Software_Version} ${software_version}
Set Global Variable ${Descriptor_Version} ${descriptor_version}
Set Global Variable ${Flavour_ID} ${flavour_id}
Fetch Information from SOL006 descriptor file
${descriptor_id}= Get Variable Value ${nfv.vnfd[0].id}
${provider}= Get Variable Value ${nfv.vnfd[0].provider}
${product_name}= Get Variable Value ${nfv.vnfd[0]['product-name']}
${software_version}= Get Variable Value ${nfv.vnfd[0]['software-version']}
${descriptor_version}= Get Variable Value ${nfv.vnfd[0].version}
${VDUcount}= Get Length ${nfv.vnfd[0].vdu}
${extCP_count}= Get Length ${nfv.vnfd[0]['ext-cpd']}
${virtualLink_count}= Get length ${nfv.vnfd[0]['int-virtual-link-desc']}
${instantiation_levels}= Get Length ${nfv.vnfd[0].df['instantiation-level']}
Set Global Variable ${Descriptor_ID} ${descriptor_id}
Set Global Variable ${Provider} ${provider}
Set Global Variable ${Product_Name} ${product_name}
Set Global Variable ${Software_Version} ${software_version}
Set Global Variable ${Descriptor_Version} ${descriptor_version}