From 86cb9876787630582f68193690427ccc04f602b2 Mon Sep 17 00:00:00 2001 From: zhaome Date: Thu, 17 Jan 2019 11:26:26 +0000 Subject: [PATCH] add delete and changflavour workflow --- .../ChangeVNFFlavourWorkflow.robot | 63 +++++++++++++++++++ .../DeleteVNFWorkflow.robot | 47 ++++++++++++++ .../ScaleVNFToLevelWorkflow.robot | 6 +- .../VnfLcmMntOperationKeywords.robot | 19 ++++++ 4 files changed, 132 insertions(+), 3 deletions(-) create mode 100644 SOL003/VNFLifecycleManagement-API/ChangeVNFFlavourWorkflow.robot create mode 100644 SOL003/VNFLifecycleManagement-API/DeleteVNFWorkflow.robot diff --git a/SOL003/VNFLifecycleManagement-API/ChangeVNFFlavourWorkflow.robot b/SOL003/VNFLifecycleManagement-API/ChangeVNFFlavourWorkflow.robot new file mode 100644 index 00000000..d1595678 --- /dev/null +++ b/SOL003/VNFLifecycleManagement-API/ChangeVNFFlavourWorkflow.robot @@ -0,0 +1,63 @@ +*** Settings *** +Resource environment/configuration.txt +Resource environment/variables.txt +Resource environment/scaleVariables.txt +Resource VnfLcmMntOperationKeywords.robot +Resource SubscriptionKeywords.robot +Library REST ${VNFM_SCHEMA}://${VNFM_HOST}:${VNFM_PORT} +... spec=SOL003-VNFLifecycleManagement-API.yaml +Library OperatingSystem +Library BuiltIn +Library Collections +Library JSONLibrary +Library Process +Suite Setup Initialize System +Suite Teardown Terminate All Processes kill=true + + +*** Test Cases *** +Scale out a VNF Instance + [Documentation] Test ID: 5.x.y.x + ... Test title: Change VNF Flavour Operation + ... Test objective: The objective is to test a change flavour operation of an existing VNF instance + ... Pre-conditions: VNF instance in INSTANTIATED state (Test ID: 5.a.b.c) + ... Reference: section 5.3.3 - SOL003 v2.4.1 + ... Config ID: Config_prod_VNFM + ... Applicability: change flavour operation is supported for the VNF (as capability in the VNFD) + ... Post-Conditions: VNF instance still in INSTANTIATED state and the flavour is changed + Send VNF Scale Out Request + Check HTTP Response Status Code Is 202 + Check HTTP Response Header Contains Location + Check Operation Occurrence Id + Check Operation Notification For Change Flavour STARTING + Create a new Grant - Sync - CHANGE_FLAVOUR + Check Operation Notification For Change Flavour PROCESSING + Check Operation Notification For Change Flavour COMPLETED + Check Postcondition VNF CHANGE_FLAVOUR + +*** Keywords *** + +Initialize System + Create Sessions + ${body}= Get File json/changeVnfFlavourRequest.json + ${changeVnfFlavourRequest}= evaluate json.loads('''${body}''') json + ${requestedFlavour}= Get Value From Json ${changeVnfFlavourRequest} $..newFlavourId + +Precondition Checks + Check resource instantiated + ${LccnSubscriptions}= Check subscriptions about one VNFInstance and operation type ${vnfInstanceId} VnfLcmOperationOccurrenceNotification operationType=SCALE + ${scaleInfo}= Get Vnf Scale Info ${vnfInstanceId} + +Check Postcondition VNF + [Arguments] ${operation} + Check resource instantiated + ${newFlavour}= Get Vnf Flavour Info ${vnfInstanceId} + Should be Equal ${requestedFlavour} ${newFlavour} + +Create a new Grant - Sync - CHANGE_FLAVOUR + Create a new Grant - Synchronous mode ${vnfInstanceId} ${vnfLcmOpOccId} CHANGE_FLAVOUR + +Check Operation Notification For Change Flavour + [Arguments] ${status} + Check Operation Notification VnfLcmOperationOccurrenceNotification ${status} + \ No newline at end of file diff --git a/SOL003/VNFLifecycleManagement-API/DeleteVNFWorkflow.robot b/SOL003/VNFLifecycleManagement-API/DeleteVNFWorkflow.robot new file mode 100644 index 00000000..a50fe4e8 --- /dev/null +++ b/SOL003/VNFLifecycleManagement-API/DeleteVNFWorkflow.robot @@ -0,0 +1,47 @@ +*** Settings *** +Resource environment/configuration.txt +Resource environment/variables.txt +Resource environment/scaleVariables.txt +Resource VnfLcmMntOperationKeywords.robot +Resource SubscriptionKeywords.robot +Library REST ${VNFM_SCHEMA}://${VNFM_HOST}:${VNFM_PORT} +... spec=SOL003-VNFLifecycleManagement-API.yaml +Library OperatingSystem +Library BuiltIn +Library Collections +Library JSONLibrary +Library Process +Suite Setup Initialize System +Suite Teardown Terminate All Processes kill=true + + +*** Test Cases *** +Create a VNF Instance + [Documentation] Test ID: 5.x.y.x + ... Test title: Delete a VNF instance procedure + ... Test objective: The objective is to test the procedure for the deletion of a VNF instance resource. + ... Pre-conditions: The resource representing the VNF instance to be deleted needs to be in NOT_INSTANTIATED state + ... Reference: section 5.3.2 - SOL003 v2.4.1 + ... Config ID: Config_prod_VNFM + ... Applicability: + ... Post-Conditions: The resource representing the VNF instance has been removed from the list of VNF instance resources + Send VNF delete Request + Check HTTP Response Status Code Is 204 + Check Operation Notification For Create VnfIdentifierDeletionNotification + Check Postcondition VNF DELETE + +*** Keywords *** + +Initialize System + Create Sessions + +Check Postcondition VNF + [Arguments] ${operation} + Check VNF Instance ${vnfInstanceId} + Check HTTP Response Status Code Is 404 + +Check Operation Notification For Create + [Arguments] ${element} + ${json}= Get File schemas/${element}.schema.json + Configure Notification Handler ${notification_ep} + \ No newline at end of file diff --git a/SOL003/VNFLifecycleManagement-API/ScaleVNFToLevelWorkflow.robot b/SOL003/VNFLifecycleManagement-API/ScaleVNFToLevelWorkflow.robot index 2f600144..01880369 100644 --- a/SOL003/VNFLifecycleManagement-API/ScaleVNFToLevelWorkflow.robot +++ b/SOL003/VNFLifecycleManagement-API/ScaleVNFToLevelWorkflow.robot @@ -31,7 +31,7 @@ Scale out a VNF Instance Check HTTP Response Header Contains Location Check Operation Occurrence Id Check Operation Notification For Scale STARTING - Create a new Grant - Sync - Scale + Create a new Grant - Sync - ScaleToLevel Check Operation Notification For Scale PROCESSING Check Operation Notification For Scale COMPLETED Check Postcondition VNF @@ -63,8 +63,8 @@ Compare ScaleInfos Should be true ${old_level_value}==${new_level_value} -Create a new Grant - Sync - Scale - Create a new Grant - Synchronous mode ${vnfInstanceId} ${vnfLcmOpOccId} SCALE +Create a new Grant - Sync - ScaleToLevel + Create a new Grant - Synchronous mode ${vnfInstanceId} ${vnfLcmOpOccId} SCALE_TO_LEVEL Check Operation Notification For Scale [Arguments] ${status} diff --git a/SOL003/VNFLifecycleManagement-API/VnfLcmMntOperationKeywords.robot b/SOL003/VNFLifecycleManagement-API/VnfLcmMntOperationKeywords.robot index 6a25f699..49cc5cbb 100644 --- a/SOL003/VNFLifecycleManagement-API/VnfLcmMntOperationKeywords.robot +++ b/SOL003/VNFLifecycleManagement-API/VnfLcmMntOperationKeywords.robot @@ -60,6 +60,12 @@ Get Vnf Scale Info ${scaleInfo}= Get Value From Json ${vnfInstance} $..scaleStatus [Return] ${scaleInfo} +Get Vnf Flavour Info + [Arguments] ${vnfInstanceId} + ${vnfInstance}= Get Vnf Instance ${vnfInstanceId} + ${flavourInfo}= Get Value From Json ${vnfInstance} $..flavourId + [Return] ${flavourInfo} + Check HTTP Response Header Contains [Arguments] ${CONTENT_TYPE} Should Contain ${response.headers} ${CONTENT_TYPE} @@ -93,6 +99,19 @@ Send VNF Create Request Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} ${body}= Get File json/createVnfRequest.json ${response}= Post ${apiRoot}/${apiName}/${apiVersion}/vnf_instances ${body} + +Send VNF Delete Request + log Delete an individual VNF instance + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + ${response}= Delete ${apiRoot}/${apiName}/${apiVersion}/vnf_instances/${vnfInstanceId} + +Send Change VNF Flavour Request + Log Trying to change the deployment flavour of a VNF instance. + Set Headers {"Accept":"${ACCEPT}"} + Set Headers {"Content-Type": "${CONTENT_TYPE}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + ${body}= Get File json/changeVnfFlavourRequest.json + ${response}= Post ${apiRoot}/${apiName}/${apiVersion}/vnf_instances/${vnfInstanceId}/change_flavour ${body} Create a new Grant - Synchronous mode [Arguments] ${vnfInstanceId} ${vnfLcmOpOccId} ${operation} -- GitLab