From 1c4a49293d73e4fe6dd1b1af267a4b248b576693 Mon Sep 17 00:00:00 2001 From: zulfiqar Date: Thu, 21 Jan 2021 11:11:13 +0100 Subject: [PATCH] Descriptor checks added for 7.3.2.1.1-3 --- .../Grants.robot | 63 +++++++++++++++---- 1 file changed, 52 insertions(+), 11 deletions(-) diff --git a/SOL003/VNFLifecycleOperationGranting-API/Grants.robot b/SOL003/VNFLifecycleOperationGranting-API/Grants.robot index 6b6cdc04..bb1ad698 100644 --- a/SOL003/VNFLifecycleOperationGranting-API/Grants.robot +++ b/SOL003/VNFLifecycleOperationGranting-API/Grants.robot @@ -117,7 +117,7 @@ Send Request Grant Request in Synchronous mode 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=${vnfdId} flavourId=${flavourId} + ${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} @@ -130,7 +130,7 @@ Send Request Grant Request in Asynchronous mode 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=${vnfdId} flavourId=${flavourId} + ${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} @@ -143,7 +143,7 @@ Send Request for a new Grant Forbiden Operation 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=${vnfdId} flavourId=${flavourId} + ${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} @@ -197,8 +197,7 @@ Patch Grants Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} Patch ${apiRoot}/${apiName}/${apiMajorVersion}/grants ${body}= Output response - Set Suite Variable ${response} ${body} - + Set Suite Variable ${response} ${body} Delete Grants Log Trying to perform a DELETE. This method should not be implemented @@ -209,12 +208,54 @@ Delete Grants Set Suite Variable ${response} ${body} Add VNF Descriptor Content to Grant Request - Run Keyword If '${descriptorType}'=='SOL001' Parse SOL001 Grant Request ELSE Parse SOL006 Grant Request + PARSE the Descriptor File -Parse SOL001 Grant Request - Get key for VNF Descriptor - ${flavourId}= Get Variable Value ${topology_template.node_templates.${vnfKey}.properties.flavour_id} +PARSE the Descriptor File + Run Keyword If '${descriptorType}'=='SOL001' Fetch Information from SOL001 descriptor file ELSE Fetch Information from SOL006 descriptor file -Parse SOL006 Grant Request - Log flavour id is not present in SOL006 descriptors +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} + -- GitLab