From 14a6ebacd69dc74810120b3e43353a05303e126f Mon Sep 17 00:00:00 2001 From: mxzhao <mengxuan.zhao@eglobalmark.com> Date: Wed, 19 Dec 2018 15:06:20 +0100 Subject: [PATCH] Update LCM --- .../ScaleVNFTaskWorkflow.robot | 27 ++++++++++++------- .../VnfLcmMntOperationKeywords.robot | 13 +++++---- .../environment/scaleVariables.txt | 7 +++++ 3 files changed, 32 insertions(+), 15 deletions(-) create mode 100644 SOL003/VNFLifecycleManagement-API/environment/scaleVariables.txt diff --git a/SOL003/VNFLifecycleManagement-API/ScaleVNFTaskWorkflow.robot b/SOL003/VNFLifecycleManagement-API/ScaleVNFTaskWorkflow.robot index 329b7b86..6f0f5b46 100644 --- a/SOL003/VNFLifecycleManagement-API/ScaleVNFTaskWorkflow.robot +++ b/SOL003/VNFLifecycleManagement-API/ScaleVNFTaskWorkflow.robot @@ -1,5 +1,6 @@ *** Settings *** 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 @@ -7,13 +8,9 @@ Library OperatingSystem Library BuiltIn Library Collections Library JSONLibrary +Suite Setup Initialize System Suite Teardown Terminate All Processes kill=true -*** variables *** -${LccnSubscriptions} -${scaleInfo} -${element} -${aspectId} *** Test Cases *** Scale out a VnFInstance @@ -26,11 +23,10 @@ Scale out a VnFInstance ... Applicability: Scale operation is supported for the VNF (as capability in the VNFD) ... NFVO is not subscribed for ... Post-Conditions: VNF instance still in INSTANTIATED state and VNF was scaled - Precondition Checks - ${response} ${aspectId}= Send VNFScaleOut request ${vnfInstanceId} - Check Response Status 202 ${response.status} - Check HTTP Response Header Contains Location ${response.headers} - ${vnfLcmOpOccId}= Get VnfLcmOpOccId ${response.headers} + Send VNFScaleOut request ${vnfInstanceId} + Check Response Status Is 202 + Check Scale HTTP Response Header Contains Location + ${vnfLcmOpOccId}= Get VnfLcmOpOccId ${scaleOutResponse.headers} Check Operation Notification STARTING ${notification_ep} ${vnfLcmOpOccId} Create a new Grant - Sync - Scale Check Operation Notification PROCESSING ${notification_ep} ${vnfLcmOpOccId} @@ -39,6 +35,9 @@ Scale out a VnFInstance *** Keywords *** +Initialize System + ${scaleInfo}= Get Vnf Scale Info ${vnfInstanceId} + Precondition Checks Check resource instantiated ${LccnSubscriptions}= Check subscriptions about one VNFInstance and operation type ${vnfInstanceId} VnfLcmOperationOccurrenceNotification operationType=SCALE @@ -64,4 +63,12 @@ Compare ScaleInfos Create a new Grant - Sync - Scale Create a new Grant - Synchronous mode ${vnfInstanceId} ${vnfLcmOpOccId} SCALE + +Check Response Status Is + [Arguments] ${expected_status} + Check Response Status ${expected_status} ${scaleOutResponse.status} + +Check Scale HTTP Response Header Contains + [Arguments] ${CONTENT_TYPE} + Check HTTP Response Header Contains ${scaleOutResponse.headers} ${CONTENT_TYPE} \ No newline at end of file diff --git a/SOL003/VNFLifecycleManagement-API/VnfLcmMntOperationKeywords.robot b/SOL003/VNFLifecycleManagement-API/VnfLcmMntOperationKeywords.robot index 6341b080..d0b1a7e2 100644 --- a/SOL003/VNFLifecycleManagement-API/VnfLcmMntOperationKeywords.robot +++ b/SOL003/VNFLifecycleManagement-API/VnfLcmMntOperationKeywords.robot @@ -1,5 +1,6 @@ *** Settings *** Resource environment/variables.txt +Resource environment/scaleVariables.txt Library REST ${VNFM_SCHEMA}://${VNFM_HOST}:${VNFM_PORT} spec=SOL003-VNFLifecycleManagement-API.yaml Library OperatingSystem Library BuiltIn @@ -18,7 +19,7 @@ Get Vnf Instance Get ${apiRoot}/${apiName}/${apiVersion}/vnf_instances/${vnfInstanceId} ${body}= Output response body ${json}= evaluate json.loads('''${body}''') json - [Return] ${json} ${body.aspectId} + [Return] ${json} Check resource Instantiated Set Headers {"Accept":"${ACCEPT}"} @@ -40,7 +41,7 @@ Check Response Status Log Status code validated Check HTTP Response Header Contains - [Arguments] ${CONTENT_TYPE} ${headers} + [Arguments] ${headers} ${CONTENT_TYPE} Should Contain ${headers} ${CONTENT_TYPE} Log Header is present @@ -50,9 +51,11 @@ Send VNFscaleOut Request Set Headers {"Accept":"${ACCEPT}"} Set Headers {"Content-Type": "${CONTENT_TYPE}"} Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} - ${body}= Get File json/scaleVnfOutRequest.json - ${response}= Post ${apiRoot}/${apiName}/${apiVersion}/vnf_instances/${vnfInstanceId}/scale ${body} - [Return] ${response} + ${body}= Get File json/scaleVnfOutRequest.json + ${json}= evaluate json.loads('''${body}''') json + ${aspectId}= Set Variable ${json.aspectId} + ${scaleOutResponse}= Post ${apiRoot}/${apiName}/${apiVersion}/vnf_instances/${vnfInstanceId}/scale ${body} + [Return] ${scaleOutResponse} Get VnfLcmOpOccId [Arguments] ${headers} diff --git a/SOL003/VNFLifecycleManagement-API/environment/scaleVariables.txt b/SOL003/VNFLifecycleManagement-API/environment/scaleVariables.txt new file mode 100644 index 00000000..3df4a927 --- /dev/null +++ b/SOL003/VNFLifecycleManagement-API/environment/scaleVariables.txt @@ -0,0 +1,7 @@ +*** variables *** +${LccnSubscriptions} +${scaleInfo} +${element} +${aspectId} +${scaleOutResponse} +${vnfLcmOpOccId} \ No newline at end of file -- GitLab