Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
NFV - Network Functions Virtualisation
api-tests
Commits
d61a1faf
Commit
d61a1faf
authored
Sep 27, 2021
by
Muhammad Hamza
Committed by
Giacomo Bernini
Oct 05, 2021
Browse files
fixed VNFD parsing in SOL003 APIs
parent
4e774dd7
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
477 additions
and
314 deletions
+477
-314
SOL002/VNFLifecycleManagement-API/environment/variables.txt
SOL002/VNFLifecycleManagement-API/environment/variables.txt
+1
-0
SOL003/VNFLifecycleManagement-API/VnfLcmMntOperationKeywords.robot
...FLifecycleManagement-API/VnfLcmMntOperationKeywords.robot
+17
-9
SOL003/VNFLifecycleManagement-API/descriptors/SOL001/VNFD/vnfd_SOL001.yaml
...leManagement-API/descriptors/SOL001/VNFD/vnfd_SOL001.yaml
+1
-3
SOL003/VNFLifecycleManagement-API/environment/variables.txt
SOL003/VNFLifecycleManagement-API/environment/variables.txt
+4
-2
SOL003/VNFLifecycleOperationGranting-API/Grants.robot
SOL003/VNFLifecycleOperationGranting-API/Grants.robot
+3
-138
SOL003/VNFLifecycleOperationGranting-API/IndividualGrant.robot
...3/VNFLifecycleOperationGranting-API/IndividualGrant.robot
+3
-145
SOL003/VNFLifecycleOperationGranting-API/VNFLifecycleOperationGrantingKeywords.robot
...nGranting-API/VNFLifecycleOperationGrantingKeywords.robot
+311
-0
SOL003/VNFLifecycleOperationGranting-API/descriptors/SOL001/VNFD/vnfd_SOL001.yaml
...tionGranting-API/descriptors/SOL001/VNFD/vnfd_SOL001.yaml
+1
-3
SOL003/VNFLifecycleOperationGranting-API/environment/variables.txt
...FLifecycleOperationGranting-API/environment/variables.txt
+9
-1
SOL003/VNFPackageManagement-API/VNFPackageManagementKeywords.robot
...FPackageManagement-API/VNFPackageManagementKeywords.robot
+109
-8
SOL003/VNFPackageManagement-API/descriptors/SOL001/VNFD/vnfd_SOL001.yaml
...geManagement-API/descriptors/SOL001/VNFD/vnfd_SOL001.yaml
+1
-3
SOL003/VNFPackageManagement-API/environment/variables.txt
SOL003/VNFPackageManagement-API/environment/variables.txt
+17
-2
No files found.
SOL002/VNFLifecycleManagement-API/environment/variables.txt
View file @
d61a1faf
...
...
@@ -87,6 +87,7 @@ ${check_descriptors} 1
${descriptorType} SOL006
${check_multiple_instances} 0
#############internal variables used for descriptor parsing################
${tosca_type_VDU_compute} tosca.nodes.nfv.Vdu.Compute
${tosca_type_VNF} tosca.nodes.nfv.VNF
${tosca_type_virtual_link} tosca.nodes.nfv.VnfVirtualLink
...
...
SOL003/VNFLifecycleManagement-API/VnfLcmMntOperationKeywords.robot
View file @
d61a1faf
...
...
@@ -1530,14 +1530,22 @@ PARSE the Descriptor File
Run Keyword If
'
${descriptorType}
'=='SOL001'
Fetch Information from SOL001 descriptor file
ELSE
Fetch Information from SOL006 descriptor file
Fetch Information from SOL001 descriptor file
Import Variables
${CURDIR}
/descriptors/SOL00
1
/VNFD/vnfd_SOL001.yaml
Import Variables
${CURDIR}
/descriptors/SOL00
6
/VNFD/vnfd_SOL001.yaml
@{VDU_labels}
=
Create List
@{VNF_labels}
=
Create List
@{VirtualLink_labels}
=
Create List
@{CP_labels}
=
Create List
@{Storage_labels}
=
Create List
FOR
${key}
IN
@{node_types.keys()}
${node_type}
=
Get Variable Value
${node_types['${key}']['derived_from']}
${is_VNF}
=
Run Keyword And Return Status
Should Be Equal As Strings
${node_type}
${tosca_type_VNF}
Run Keyword If
${is_VNF}
Set Global Variable
${tosca_type_derived_from_VNF}
${key}
END
${derived_type_is_used}
=
Run Keyword And Return Status
Should not be empty
${tosca_type_derived_from_VNF}
Run Keyword If
${derived_type_is_used}
Set Global Variable
${tosca_type_VNF}
${tosca_type_derived_from_VNF}
FOR
${key}
IN
@{topology_template.node_templates.keys()}
${key_type}
=
Get Variable Value
${topology_template.node_templates
.
${key}.type}
${key_type}
=
Get Variable Value
${topology_template.node_templates
['
${key}
']
.type}
${VDU_check}
=
Run Keyword And Return Status
Should Be Equal As Strings
${key_type}
${tosca_type_VDU_compute}
${VNF_check}
=
Run Keyword And Return Status
Should Be Equal As Strings
${key_type}
${tosca_type_VNF}
${Link_check}
=
Run Keyword And Return Status
Should Be Equal As Strings
${key_type}
${tosca_type_virtual_link}
...
...
@@ -1558,13 +1566,13 @@ Fetch Information from SOL001 descriptor file
Get VNF Attributes from SOL001
[
Arguments
]
${VNF_label}
Import Variables
${CURDIR}
/descriptors/SOL00
1
/VNFD/vnfd_SOL001.yaml
${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}
Import Variables
${CURDIR}
/descriptors/SOL00
6
/VNFD/vnfd_SOL001.yaml
${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}
...
...
SOL003/VNFLifecycleManagement-API/descriptors/SOL001/VNFD/vnfd_SOL001.yaml
View file @
d61a1faf
...
...
@@ -90,7 +90,6 @@ topology_template:
order
:
1
requirements
:
-
virtual_binding
:
VDU-B
vdu-b-1-vsd
:
management
:
type
:
"
tosca.nodes.nfv.VduCp"
properties
:
...
...
@@ -98,7 +97,6 @@ topology_template:
order
:
0
requirements
:
-
virtual_binding
:
VDU-B
vdu-b-1-vsd
:
left
:
type
:
"
tosca.nodes.nfv.VduCp"
properties
:
...
...
@@ -164,4 +162,4 @@ topology_template:
terminate
:
implementation
:
terminate-example.yaml
operate
:
implementation
:
operate-example.yaml
implementation
:
operate-example.yaml
\ No newline at end of file
SOL003/VNFLifecycleManagement-API/environment/variables.txt
View file @
d61a1faf
...
...
@@ -110,12 +110,14 @@ ${callbackResp} localhost
${descriptorType} SOL001
${check_descriptors} 1
#############internal variables used for descriptor parsing################
${tosca_type_VDU_compute} tosca.nodes.nfv.Vdu.Compute
${tosca_type_VNF} t
st010.vnf.simple # custom tosca type defined in the descriptor vnfd_SOL001.yaml in descriptors folder
${tosca_type_VNF} t
osca.nodes.nfv.VNF
${tosca_type_virtual_link} tosca.nodes.nfv.VnfVirtualLink
${tosca_type_VDU_cp} tosca.nodes.nfv.VduCp
${tosca_type_storage} tosca.nodes.nfv.Vdu.VirtualBlockStorage
${tosca_type_derived_from_VNF}
${VDU_IDs}
${VNF_IDs}
${virtualLink_IDs}
...
...
SOL003/VNFLifecycleOperationGranting-API/Grants.robot
View file @
d61a1faf
*** Settings ***
Library
String
Resource
environment/variables.txt
Resource
environment/variables.txt
Resource
VNFLifecycleOperationGrantingKeywords.robot
Library
REST
${NFVO_SCHEMA}
://
${NFVO_HOST}
:
${NFVO_PORT}
ssl_verify=false
Library
OperatingSystem
Library
JSONLibrary
...
...
@@ -12,7 +13,6 @@ Documentation This resource represents grants. The client can use this resour
...
from the NFVO to perform a particular VNF lifecycle operation.
*** Variables ***
${response}
{}
${retry}
2 min
${polling}
10 sec
...
...
@@ -110,139 +110,4 @@ DELETE Grants - Method not implemented
*** Keywords ***
Wait for individual grant successful notification
Wait Until Keyword Succeeds
${retry}
${polling}
Get an individual grant - Successful
Send Request Grant Request in Synchronous mode
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_HEADER}
":"
${AUTHORIZATION_TOKEN}
"}
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}
${body}
=
Output
response
Set Suite Variable
${response}
${body}
Send Request Grant Request in Asynchronous mode
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_HEADER}
":"
${AUTHORIZATION_TOKEN}
"}
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}
${body}
=
Output
response
Set Suite Variable
${response}
${body}
Send Request for a new Grant Forbiden Operation
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_HEADER}
":"
${AUTHORIZATION_TOKEN}
"}
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}
${body}
=
Output
response
Set Suite Variable
${response}
${body}
Check HTTP Response Status Code Is
[
Arguments
]
${expected_status}
Should Be Equal As Strings
${response['status']}
${expected_status}
Log
Status code validated
Check Operation Occurrence Id existence
${occId}
=
Get Value From Json
${response['headers']}
$..Location
Should Not Be Empty
${occId}
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}
Run Keyword If
'
${input}
' == 'ProblemDetails'
Should Contain
${response['headers']['Content-Type']}
application/problem+json
...
ELSE
Should Contain
${response['headers']['Content-Type']}
application/json
${schema}
=
Catenate
SEPARATOR=
${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_HEADER}
":"
${AUTHORIZATION_TOKEN}
"}
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_HEADER}
":"
${AUTHORIZATION_TOKEN}
"}
Get
${apiRoot}
/
${apiName}
/
${apiMajorVersion}
/grants
${body}
=
Output
response
Set Suite Variable
${response}
${body}
Put Grants
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_HEADER}
":"
${AUTHORIZATION_TOKEN}
"}
Put
${apiRoot}
/
${apiName}
/
${apiMajorVersion}
/grants
${body}
=
Output
response
Set Suite Variable
${response}
${body}
Patch Grants
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_HEADER}
":"
${AUTHORIZATION_TOKEN}
"}
Patch
${apiRoot}
/
${apiName}
/
${apiMajorVersion}
/grants
${body}
=
Output
response
Set Suite Variable
${response}
${body}
Delete Grants
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_HEADER}
":"
${AUTHORIZATION_TOKEN}
"}
Delete
${apiRoot}
/
${apiName}
/
${apiMajorVersion}
/grants
${body}
=
Output
response
Set Suite Variable
${response}
${body}
Add VNF Descriptor Content to Grant Request
PARSE the Descriptor File
PARSE the Descriptor File
Run Keyword If
'
${descriptorType}
'=='SOL001'
Fetch Information from SOL001 descriptor file
ELSE
Fetch Information from SOL006 descriptor file
Fetch Information from SOL001 descriptor file
Import Variables
${CURDIR}
/descriptors/SOL001/VNFD/vnfd_SOL001.yaml
${descriptor_id}
=
Get Variable Value
${topology_template.node_templates.properties.descriptor_id}
${provider}
=
Get Variable Value
${topology_template.node_templates.properties.provider}
${product_name}
=
Get Variable Value
${topology_template.node_templates.properties.product_name}
${software_version}
=
Get Variable Value
${topology_template.node_templates.properties.software_version}
${descriptor_version}
=
Get Variable Value
${topology_template.node_templates.properties.descriptor_version}
${flavour_id}
=
Get Variable Value
${topology_template.node_templates.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
Import Variables
${CURDIR}
/descriptors/SOL006/VNFD/vnfd_SOL006.yaml
${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}
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}
Wait Until Keyword Succeeds
${retry}
${polling}
Get an individual grant - Successful
\ No newline at end of file
SOL003/VNFLifecycleOperationGranting-API/IndividualGrant.robot
View file @
d61a1faf
*** Settings ***
Resource
environment/variables.txt
Resource
environment/variables.txt
Resource
VNFLifecycleOperationGrantingKeywords.robot
Library
OperatingSystem
Library
JSONLibrary
Library
JSONSchemaLibrary
schemas/
...
...
@@ -100,147 +101,4 @@ DELETE an individual grant - Method not implemented
...
Applicability: none
...
Post-Conditions: none
Delete individual Grant
Check HTTP Response Status Code Is
405
*** Keywords ***
Get individual grant
log
Trying to read an individual grant
Set Headers
{"Accept":"
${ACCEPT}
"}
Run Keyword If
${AUTH_USAGE}
=
= 1
Set Headers
{"
${AUTHORIZATION_HEADER}
":"
${AUTHORIZATION_TOKEN}
"}
Get
${apiRoot}
/
${apiName}
/
${apiMajorVersion}
/grants/
${grantId}
${body}
=
Output
response
Set Suite Variable
${response}
${body}
Check resource existence
Set Headers
{"Accept":"
${ACCEPT}
"}
Run Keyword If
${AUTH_USAGE}
=
= 1
Set Headers
{"
${AUTHORIZATION_HEADER}
":"
${AUTHORIZATION_TOKEN}
"}
Get
${apiRoot}
/
${apiName}
/
${apiMajorVersion}
/subscriptions/
${subscriptionId}
Integer
response status
200
Post individual Grant
log
Trying to read an individual grant
Pass Execution If
${SYNC_MODE}
=
= 1
Skipping. Synchronous mode is supported
Set Headers
{"Accept":"
${ACCEPT}
"}
Run Keyword If
${AUTH_USAGE}
=
= 1
Set Headers
{"
${AUTHORIZATION_HEADER}
":"
${AUTHORIZATION_TOKEN}
"}
Get
${apiRoot}
/
${apiName}
/
${apiMajorVersion}
/grants/
${grantId}
${body}
=
Output
response
Set Suite Variable
${response}
${body}
Put individual Grant
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_HEADER}
":"
${AUTHORIZATION_TOKEN}
"}
Put
${apiRoot}
/
${apiName}
/
${apiMajorVersion}
/grants/
${grantId}
${body}
=
Output
response
Set Suite Variable
${response}
${body}
Patch individual Grant
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_HEADER}
":"
${AUTHORIZATION_TOKEN}
"}
Patch
${apiRoot}
/
${apiName}
/
${apiMajorVersion}
/grants/
${grantId}
${body}
=
Output
response
Set Suite Variable
${response}
${body}
Delete individual Grant
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_HEADER}
":"
${AUTHORIZATION_TOKEN}
"}
Delete
${apiRoot}
/
${apiName}
/
${apiMajorVersion}
/grants/
${grantId}
${body}
=
Output
response
Set Suite Variable
${response}
${body}
Check HTTP Response Status Code Is
[
Arguments
]
${expected_status}
Should Be Equal As Strings
${response['status']}
${expected_status}
Log
Status code validated
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}
Run Keyword If
'
${input}
' == 'ProblemDetails'
Should Contain
${response['headers']['Content-Type']}
application/problem+json
...
ELSE
Should Contain
${response['headers']['Content-Type']}
application/json
${schema}
=
Catenate
SEPARATOR=
${input}
.schema.json
Validate Json
${schema}
${response['body']}
Check HTTP Response Body grant content against VNF Descriptor
Run Keyword If
${check_descriptors}
=
= 1
Check Individual grant Content
Check Individual grant Content
PARSE the Descriptor File
Match the grant Response Attributes with Descriptors
PARSE the Descriptor File
Run Keyword If
'
${descriptorType}
'=='SOL001'
Fetch Information from SOL001 descriptor file
ELSE
Fetch Information from SOL006 descriptor file
Fetch Information from SOL001 descriptor file
Import Variables
${CURDIR}
/descriptors/SOL001/VNFD/vnfd_SOL001.yaml
@{VDU_labels}
=
Create List
@{VirtualLink_labels}
=
Create List
@{CP_labels}
=
Create List
FOR
${key}
IN
@{topology_template.node_templates.keys()}
${key_type}
=
Get Variable Value
${topology_template.node_templates.${key}.type}
${VDU_check}
=
Run Keyword And Return Status
Should Be Equal As Strings
${key_type}
${tosca_type_VDU_compute}
${Link_check}
=
Run Keyword And Return Status
Should Be Equal As Strings
${key_type}
${tosca_type_virtual_link}
${VDUcp_check}
=
Run Keyword And Return Status
Should Be Equal As Strings
${key_type}
${tosca_type_VDU_cp}
Run Keyword If
${VDU_check}
Append To List
${VDU_labels}
${key}
Run Keyword If
${Link_check}
Append To List
${VirtualLink_labels}
${key}
Run Keyword If
${VDUcp_check}
Append To List
${CP_labels}
${key}
END
Set Global Variable
@{VDU_IDs}
@{VDU_labels}
Set Global Variable
@{VirtualLink_IDs}
@{VirtualLink_labels}
Set Global Variable
@{CP_IDs}
@{CP_labels}
Fetch Information from SOL006 descriptor file
Import Variables
${CURDIR}
/descriptors/SOL006/VNFD/vnfd_SOL006.yaml
${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']}
FOR
${key}
IN
@{nfv.vnfd[0].keys()}
${VDU_check}
=
Run Keyword And Return Status
Should Be Equal As Strings
${key}
vdu
Run Keyword If
${VDU_check}
Get VDU IDs
${VDUcount}
${extCP_check}
=
Run Keyword And Return Status
Should Be Equal As Strings
${key}
ext-cpd
Run Keyword If
${extCP_check}
Get External CP IDs
${extCP_count}
${virtualLink_check}
=
Run Keyword And Return Status
Should Be Equal As Strings
${key}
int-virtual-link-desc
Run Keyword If
${virtualLink_check}
Get Virtual Link IDs
${virtualLink_count}
END
Get VDU IDs
[
Arguments
]
${count}
Import Variables
${CURDIR}
/descriptors/SOL006/VNFD/vnfd_SOL006.yaml
@{VDU_labels}
=
Create List
@{Compute_labels}
=
Create List
FOR
${i}
IN RANGE
${count}
Append To List
${VDU_labels}
${nfv.vnfd[0].vdu[${i}]['id']}
Append To List
${Compute_labels}
${nfv.vnfd[0].vdu[${i}]['virtual-compute-desc']}
END
Set Global Variable
${VDU_IDs}
${VDU_labels}
Set Global Variable
${Compute_IDs}
${Compute_labels}
Get External CP IDs
[
Arguments
]
${count}
Import Variables
${CURDIR}
/descriptors/SOL006/VNFD/vnfd_SOL006.yaml
@{external_CPs}
=
Create List
FOR
${i}
IN RANGE
${count}
Append To List
${external_CPs}
${nfv.vnfd[0].ext_cpd[${i}].id}
END
Set Global Variable
${externalCP_IDs}
${external_CPs}
Get Virtual Link IDs
[
Arguments
]
${count}
Import Variables
${CURDIR}
/descriptors/SOL006/VNFD/vnfd_SOL006.yaml
${VirtualLink_labels}
=
Create List
FOR
${i}
IN RANGE
${count}
Append To List
${VirtualLink_labels}
${nfv.vnfd[0]['int-virtual-link-desc'][${i}]['id']}
END
Set Global Variable
${VirtualLink_IDs}
${VirtualLink_labels}
Match the grant Response Attributes with Descriptors
Run Keyword If
'
${descriptorType}
'=='SOL006'
List Should Contain Value
${externalCP_IDs}
${response['body']['extVirtualLinks'][0]['extCps'][0]['cpdId']}
Run Keyword If
'
${descriptorType}
'=='SOL001'
List Should Contain Value
@{CP_IDs}
${response['body']['extVirtualLinks'][0]['extCps'][0]['cpdId']}
List Should Contain Value
${VirtualLink_IDs}
${response['body']['extManagedVirtualLinkData'][0]['vnfVirtualLinkDescId']}
List Should Contain value
${Compute_IDs}
${response['body']['vimAssets']['computeResourceFlavours'][0]['vnfdVirtualComputeDescId']}
Check HTTP Response Status Code Is
405
\ No newline at end of file
SOL003/VNFLifecycleOperationGranting-API/VNFLifecycleOperationGrantingKeywords.robot
0 → 100644
View file @
d61a1faf
*** Settings ***
Library
String
Resource
environment/variables.txt
Library
REST
${NFVO_SCHEMA}
://
${NFVO_HOST}
:
${NFVO_PORT}
ssl_verify=false
Library
OperatingSystem
Library
JSONLibrary
Library
JSONSchemaLibrary
schemas/
Library
Collections
*** Variables ***
${retry}
2 min
${polling}
10 sec
*** Keywords ***
Wait for individual grant successful notification
Wait Until Keyword Succeeds
${retry}
${polling}
Get an individual grant - Successful
Send Request Grant Request in Synchronous mode
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_HEADER}
":"
${AUTHORIZATION_TOKEN}
"}
Run Keyword If
${check_descriptors}
=
= 1
PARSE the Descriptor File
${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}
${body}
=
Output
response
Set Suite Variable
${response}
${body}
Send Request Grant Request in Asynchronous mode
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_HEADER}
":"
${AUTHORIZATION_TOKEN}
"}
Run Keyword If
${check_descriptors}
=
= 1
PARSE the Descriptor File
${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}
${body}
=
Output
response
Set Suite Variable
${response}
${body}
Send Request for a new Grant Forbiden Operation
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_HEADER}
":"
${AUTHORIZATION_TOKEN}
"}
Run Keyword If
${check_descriptors}
=
= 1
PARSE the Descriptor File
${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}
${body}
=
Output
response
Set Suite Variable
${response}
${body}
Check HTTP Response Status Code Is
[
Arguments
]
${expected_status}
Should Be Equal As Strings
${response['status']}
${expected_status}
Log
Status code validated
Check Operation Occurrence Id existence
${occId}
=
Get Value From Json
${response['headers']}
$..Location
Should Not Be Empty
${occId}
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}
Run Keyword If
'
${input}
' == 'ProblemDetails'
Should Contain
${response['headers']['Content-Type']}
application/problem+json
...
ELSE
Should Contain
${response['headers']['Content-Type']}
application/json
${schema}
=
Catenate
SEPARATOR=
${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_HEADER}
":"
${AUTHORIZATION_TOKEN}
"}
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_HEADER}
":"
${AUTHORIZATION_TOKEN}
"}
Get
${apiRoot}
/
${apiName}
/
${apiMajorVersion}
/grants
${body}
=
Output
response
Set Suite Variable
${response}
${body}
Put Grants
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_HEADER}
":"
${AUTHORIZATION_TOKEN}
"}
Put
${apiRoot}
/
${apiName}
/
${apiMajorVersion}
/grants
${body}
=
Output
response
Set Suite Variable
${response}
${body}
Patch Grants
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_HEADER}
":"
${AUTHORIZATION_TOKEN}
"}
Patch
${apiRoot}
/
${apiName}
/
${apiMajorVersion}
/grants
${body}
=
Output
response
Set Suite Variable
${response}
${body}
Delete Grants
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_HEADER}
":"
${AUTHORIZATION_TOKEN}
"}
Delete
${apiRoot}
/
${apiName}
/
${apiMajorVersion}
/grants
${body}
=
Output
response
Set Suite Variable
${response}
${body}
Get individual grant
log
Trying to read an individual grant
Set Headers
{"Accept":"
${ACCEPT}
"}
Run Keyword If
${AUTH_USAGE}
=
= 1
Set Headers
{"
${AUTHORIZATION_HEADER}
":"
${AUTHORIZATION_TOKEN}
"}
Get
${apiRoot}
/
${apiName}
/
${apiMajorVersion}
/grants/
${grantId}
${body}
=
Output
response
Set Suite Variable
${response}
${body}
Check resource existence
Set Headers
{"Accept":"
${ACCEPT}
"}
Run Keyword If
${AUTH_USAGE}
=
= 1
Set Headers
{"
${AUTHORIZATION_HEADER}
":"
${AUTHORIZATION_TOKEN}
"}
Get
${apiRoot}
/
${apiName}
/
${apiMajorVersion}
/subscriptions/
${subscriptionId}
Integer
response status
200
Post individual Grant
log
Trying to read an individual grant
Pass Execution If
${SYNC_MODE}
=
= 1
Skipping. Synchronous mode is supported
Set Headers
{"Accept":"
${ACCEPT}
"}
Run Keyword If
${AUTH_USAGE}
=
= 1
Set Headers
{"
${AUTHORIZATION_HEADER}
":"
${AUTHORIZATION_TOKEN}
"}
Get
${apiRoot}
/
${apiName}
/
${apiMajorVersion}
/grants/
${grantId}
${body}
=
Output
response
Set Suite Variable
${response}
${body}
Put individual Grant
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_HEADER}
":"
${AUTHORIZATION_TOKEN}
"}
Put
${apiRoot}
/
${apiName}
/
${apiMajorVersion}
/grants/
${grantId}
${body}
=
Output
response
Set Suite Variable
${response}
${body}
Patch individual Grant
Log
Trying to perform a GET. This method should not be implemented
Set Headers
{"Accept":"