From 1774783d80a7b619afdf9f9ba6d6e5a5f0fdc42a Mon Sep 17 00:00:00 2001 From: Elian Kraja <e.kraja@nextworks.it> Date: Tue, 12 Feb 2019 18:32:21 +0100 Subject: [PATCH] Fixing issues: #1, #2, #3 and #4 --- .../VNFConfiguration-API/Configuration.robot | 50 ++++++++++++------- .../environment/variables.txt | 25 +--------- .../IndividualSubscription.robot | 2 +- SOL002/VNFIndicator-API/Subscriptions.robot | 2 +- 4 files changed, 36 insertions(+), 43 deletions(-) diff --git a/SOL002/VNFConfiguration-API/Configuration.robot b/SOL002/VNFConfiguration-API/Configuration.robot index eea19e2a..a7405cdb 100644 --- a/SOL002/VNFConfiguration-API/Configuration.robot +++ b/SOL002/VNFConfiguration-API/Configuration.robot @@ -19,7 +19,7 @@ Set new VNF Configuration Send VNF configuration Check HTTP Response Status Code Is 200 Check HTTP Response Header Contains Etag - Check HTTP Response Body Json Schema Is vnfConfigModifications + Check HTTP Response Body Json Schema Is vnfConfigModifications.schema.json Check Postcondition VNF Is Configured Get information about a VNF configuration @@ -34,7 +34,7 @@ Get information about a VNF configuration ... Post-Conditions: The VNF configuration is not modified by the operation Get VNF configuration Check HTTP Response Status Code Is 200 - Check HTTP Response Body Json Schema Is vnfConfiguration + Check HTTP Response Body Json Schema Is vnfConfiguration.schema.json Check Postcondition VNF Configuration Untouched (Implicit) Get information about a VNF configuration - with HTTP Etag @@ -50,7 +50,7 @@ Get information about a VNF configuration - with HTTP Etag Get VNF configuration Check HTTP Response Status Code Is 200 Check HTTP Response Header Contains Etag - Check HTTP Response Body Json Schema Is vnfConfiguration + Check HTTP Response Body Json Schema Is vnfConfiguration.schema.json Check Postcondition VNF Configuration Untouched (Implicit) Set new VNF Configuration - HTTP Etag precondition failed @@ -114,7 +114,9 @@ Get VNF configuration Set Headers {"Content-Type": "${CONTENT_TYPE}"} Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} Log Execute Query and validate response - ${response}= Get ${apiRoot}/${apiName}/${apiVersion}/configuration + Get ${apiRoot}/${apiName}/${apiVersion}/configuration + ${output}= Output response + Set Suite Variable @{response} ${output} Send VNF configuration log Trying to perform a PATCH. This method modifies the configuration @@ -122,24 +124,28 @@ Send VNF configuration Set Headers {"Content-Type": "${CONTENT_TYPE}"} Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} ${body}= Get File jsons/vnfConfigModifications.json - ${response}= Patch ${apiRoot}/${apiName}/${apiVersion}/configuration ${body} + Patch ${apiRoot}/${apiName}/${apiVersion}/configuration ${body} + ${output}= Output response + Set Suite Variable @{response} ${output} Check HTTP Response Status Code Is [Arguments] ${expected_status} - Should Be Equal ${response.status_code} ${expected_status} + ${status}= Convert To Integer ${expected_status} + Should Be Equal ${response[0]['status']} ${status} Log Status code validated Check HTTP Response Header Contains [Arguments] ${CONTENT_TYPE} - Should Contain ${response.headers} ${CONTENT_TYPE} + Log ${response[0]['headers']} + Should Contain ${response[0]['headers']} ${CONTENT_TYPE} Log Header is present Check HTTP Response Body Json Schema Is [Arguments] ${schema} - ${contentType}= Get Value From Json ${response.headers} $..Content-Type - Should Be Equal ${contentType} ${CONTENT_TYPE} - ${json}= evaluate json.loads('''${response.body}''') json - Validate Json ${schema} ${json} + ${file_schema}= Get File ${schema} + ${json_schema}= evaluate json.loads('''${schema}''') json + Should Contain ${response[0]['headers']['Content-Type']} ${CONTENT_TYPE} + Validate Json ${schema} ${response[0]['body']} Log Json Schema Validation OK Check Postcondition VNF Configuration Untouched (Implicit) @@ -149,9 +155,9 @@ Check Postcondition VNF Configuration Untouched (Implicit) Check Postcondition VNF Is Configured Log Check Postcondition for VNF Configuration Get VNF configuration - ${output}= evaluate json.loads('''${response.body}''') json - ${input}= Get File jsons/vnfConfigModifications.json - Should Be Equal ${output} ${input} + ${input_file}= Get File jsons/vnfConfigModifications.json + ${input}= evaluate json.loads('''${input_file}''') json + Should Be Equal ${response[0]['body']} ${input} Send Duplicated VNF configuration Depends On Test PATCH Alarm # If the previous test scceeded, it means that Etag has been modified @@ -161,22 +167,30 @@ Send Duplicated VNF configuration Set Headers {"If-Match": "${Etag}"} Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} ${body}= Get File jsons/vnfConfigModifications.json - ${response}= Patch ${apiRoot}/${apiName}/${apiVersion}/configuration ${body} + Patch ${apiRoot}/${apiName}/${apiVersion}/configuration ${body} + ${output}= Output response + Set Suite Variable @{response} ${output} Send POST Request for VNF Configuration log Trying to perform a POST. This method should not be implemented Set Headers {"Accept":"${ACCEPT}"} Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} - ${response}= Post ${apiRoot}/${apiName}/${apiVersion}/configuration + Post ${apiRoot}/${apiName}/${apiVersion}/configuration + ${output}= Output response + Set Suite Variable @{response} ${output} Send PUT Request for VNF Configuration log Trying to perform a POST. This method should not be implemented Set Headers {"Accept":"${ACCEPT}"} Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} - ${response}= Put ${apiRoot}/${apiName}/${apiVersion}/configuration + Put ${apiRoot}/${apiName}/${apiVersion}/configuration + ${output}= Output response + Set Suite Variable @{response} ${output} Send DELETE Request for VNF Configuration log Trying to perform a POST. This method should not be implemented Set Headers {"Accept":"${ACCEPT}"} Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} - ${response}= Delete ${apiRoot}/${apiName}/${apiVersion}/configuration \ No newline at end of file + Delete ${apiRoot}/${apiName}/${apiVersion}/configuration + ${output}= Output response + Set Suite Variable @{response} ${output} \ No newline at end of file diff --git a/SOL002/VNFConfiguration-API/environment/variables.txt b/SOL002/VNFConfiguration-API/environment/variables.txt index c363e208..dec9d551 100644 --- a/SOL002/VNFConfiguration-API/environment/variables.txt +++ b/SOL002/VNFConfiguration-API/environment/variables.txt @@ -2,7 +2,7 @@ ${Etag}= an etag ${Etag_modified}= 12345 -${response}= httpresponse +@{response}= httpresponse ${EM-VNF_HOST} localhost # Hostname of the NFVO ${EM-VNF_PORT} 8081 # Listening port of the NFVO @@ -20,25 +20,4 @@ ${alarm_filter} managedObjectId ${managedObjectId} 007c111c-38a1-42c0-a666-7475ecb1567c ${invalid_alarm_filter} badFilter ${alarmId} 6fc3539c-e602-4afa-8e13-962fb5a7d81d -${vnfInstanceDescription} description vnf -${vnfInstanceDescription_Update} Updated description vnf -${SINGLE_FILE_VNFD} 1 # If VNFD is PLAIN TEXT -${ACCEPT_PLAIN} text/plain -${ACCEPT_ZIP} application/zip -${vnfPkgId_processing} 007c111c-38a1-42c0-a666-7475ecb1567c -${ARTIFACT_TYPE} application/octet-stream -${ARTIFACT_ID} artifactId -${WRONG_ACCEPT} application/json -${vnfLcmOpOccId} 6fc3539c-e602-4afa-8e13-962fb5a7d81d -${CancelMode} GRACEFUL -${LccnSubscriptionRequest} {} -${NVFM_DUPLICATION} 0 -${sub_filter} filter -${sub_filter_invalid} filter_invalid -${subscriptionId} 6fc3539c-e602-4afa-8e13-962fb5a7d81f -${notification_ep} /notification -${notification_port} 9091 -${AlarmNotification} {} -${AlarmClearedNotification} {} -${AlarmListRebuiltNotification} {} -${PerceivedSeverity} CRITICAL + diff --git a/SOL002/VNFIndicator-API/IndividualSubscription.robot b/SOL002/VNFIndicator-API/IndividualSubscription.robot index 0cef9b54..58a3c927 100644 --- a/SOL002/VNFIndicator-API/IndividualSubscription.robot +++ b/SOL002/VNFIndicator-API/IndividualSubscription.robot @@ -51,7 +51,7 @@ DELETE Subscription - Negative (Not Found) Log The subscriptionId is not present in database ${contentType}= Output response headers Content-Type Should Contain ${contentType} application/json - ${problemDetails}= Output + ${problemDetails}= Output response body Log Trying to validate ProblemDetails Validate Json ProblemDetails.schema.json ${problemDetails} Log Validation OK diff --git a/SOL002/VNFIndicator-API/Subscriptions.robot b/SOL002/VNFIndicator-API/Subscriptions.robot index a549a855..e33fa7eb 100644 --- a/SOL002/VNFIndicator-API/Subscriptions.robot +++ b/SOL002/VNFIndicator-API/Subscriptions.robot @@ -65,7 +65,7 @@ POST Subscription Log Trying to create a new subscription Set Headers {"Accept": "${ACCEPT_JSON}"} Set Headers {"Content-Type": "${CONTENT_TYPE_JSON}"} - ${body}= Get File json/subscriptions.json + ${body}= Get File jsons/subscriptions.json Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"} POST ${apiRoot}/${apiName}/${apiVersion}/subscriptions ${body} Integer response status 201 -- GitLab