From 2749be02f1fb007221dbfc07dfb3cee9a7d47fe6 Mon Sep 17 00:00:00 2001 From: Elian Kraja <e.kraja@nextworks.it> Date: Mon, 15 Oct 2018 10:42:01 +0200 Subject: [PATCH] Adding tests for exclude_fields and exclude_default where requested --- .../VNFPackages.robot | 59 +++++++++++++++++++ .../environment/generic.txt | 1 + .../PMJobs.robot | 47 ++++++++++++++- 3 files changed, 106 insertions(+), 1 deletion(-) diff --git a/SOL003/VNFPackageManagement-API_nxw/VNFPackages.robot b/SOL003/VNFPackageManagement-API_nxw/VNFPackages.robot index f945861d..b41a5bde 100644 --- a/SOL003/VNFPackageManagement-API_nxw/VNFPackages.robot +++ b/SOL003/VNFPackageManagement-API_nxw/VNFPackages.robot @@ -19,6 +19,18 @@ GET all Packages ${json}= evaluate json.loads('''${result}''') json Validate Json vnfPkgInfo.schema.json ${json} Log Validation OK + Log Checking missing information for softwareImages element + ${softwareImages}= Get Value From Json ${json} $..softwareImages + Should Be Empty ${softwareImages} + Log softwareImages element is missing as excepted + Log Checking missing information for additionalArtifact element + ${additional_artifacts}= Get Value From Json ${json} $..additionalArtifacts + Should Be Empty ${additional_artifacts} + Log additionalArtifact element is missing as excepted + Log Checking missing information for _links element + ${links}= Get Value From Json ${json} $.._links + Should Be Empty ${links} + Log _links element is missing as excepted GET all Packages - Filter Log Trying to get all VNF Packages present in the NFVO Catalogue, using filter params @@ -105,8 +117,35 @@ GET all Packages - all_fields Validate Json links.schema.json ${links[0]} Log Validation for _links schema OK +GET all Packages - exclude_default + Log Trying to get all VNF Packages present in the NFVO Catalogue, using exclude_default filter. + Set Headers {"Accept": "${ACCEPT_JSON}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"} + GET ${apiRoot}/${apiName}/${apiVersion}/vnf_packages?exclude_default + Integer response status 200 + ${contentType}= Output response headers Content-Type + Should Contain ${contentType} ${CONTENT_TYPE_JSON} + ${vnfPkgInfos}= Output response body + ${json}= evaluate json.loads('''${vnfPkgInfos}''') json + Log Trying to validate response + Validate Json vnfPkgInfo.schema.json ${json} + Log Validation OK + Log Checking missing information for softwareImages element + ${softwareImages}= Get Value From Json ${json} $..softwareImages + Should Be Empty ${softwareImages} + Log softwareImages element is missing as excepted + Log Checking missing information for additionalArtifact element + ${additional_artifacts}= Get Value From Json ${json} $..additionalArtifacts + Should Be Empty ${additional_artifacts} + Log additionalArtifact element is missing as excepted + Log Checking missing information for _links element + ${links}= Get Value From Json ${json} $.._links + Should Be Empty ${links} + Log _links element is missing as excepted + GET all Packages - fields Log Trying to get all VNF Packages present in the NFVO Catalogue, using filter params + Pass Execution If ${NFVO_FIELDS} == 0 The NFVO is not able to use fields parameter Set Headers {"Accept": "${ACCEPT_JSON}"} Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"} GET ${apiRoot}/${apiName}/${apiVersion}/vnf_packages?fields=${fields} @@ -127,6 +166,26 @@ GET all Packages - fields Validate Json additionalArtifacts.schema.json ${additional_artifacts[0]} Log Validation for additionalArtifacts schema OK +GET all Packages - exclude_fields + Log Trying to get all VNF Packages present in the NFVO Catalogue, using filter params + Pass Execution If ${NFVO_FIELDS} == 0 The NFVO is not able to use exclude_fields option + Set Headers {"Accept": "${ACCEPT_JSON}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"} + GET ${apiRoot}/${apiName}/${apiVersion}/vnf_packages?exlude_fields=${fields} + Integer response status 200 + ${contentType}= Output response headers Content-Type + Should Contain ${contentType} ${CONTENT_TYPE_JSON} + ${vnfPkgInfos}= Output response body + ${json}= evaluate json.loads('''${vnfPkgInfos}''') json + Log Checking missing information for softwareImages element + ${softwareImages}= Get Value From Json ${json} $..softwareImages + Should Be Empty ${softwareImages} + Log softwareImages element is missing as excepted + Log Checking missing information for additionalArtifact element + ${additional_artifacts}= Get Value From Json ${json} $..additionalArtifacts + Should Be Empty ${additional_artifacts} + Log additionalArtifact element is missing as excepted + GET all PACKAGE (Negative: Not found) Log Trying to perform a GET on a erroneous URI Set Headers {"Accept": "${ACCEPT_JSON}"} diff --git a/SOL003/VNFPackageManagement-API_nxw/environment/generic.txt b/SOL003/VNFPackageManagement-API_nxw/environment/generic.txt index 4a966862..d569bc82 100644 --- a/SOL003/VNFPackageManagement-API_nxw/environment/generic.txt +++ b/SOL003/VNFPackageManagement-API_nxw/environment/generic.txt @@ -15,3 +15,4 @@ ${apiVersion} v1 ${apiName} vnfpkgm ${FIELD_USAGE} 1 ${NFVO_PLAIN} 1 +${NFVO_FIELDS} 1 diff --git a/SOL003/VNFPerformanceManagement-API_nxw/PMJobs.robot b/SOL003/VNFPerformanceManagement-API_nxw/PMJobs.robot index 634e8b33..df214f4c 100644 --- a/SOL003/VNFPerformanceManagement-API_nxw/PMJobs.robot +++ b/SOL003/VNFPerformanceManagement-API_nxw/PMJobs.robot @@ -20,6 +20,10 @@ GET all Pm Jobs ${json}= evaluate json.loads('''${result}''') json Validate Json PmJob.schema.json ${json} Log Validation OK + Log Checking that reports element is missing + ${reports}= Get Value From Json ${json} $..reports + Should Be Empty ${reports} + Log Reports element is empty as expected GET all Pm Jobs - Filter Log Trying to get all PM Jobs present in the VNFM, using filter params @@ -61,9 +65,27 @@ GET all Pm Jobs - all_fields Validate Json links.schema.json ${links[0]} Log Validation for _links schema OK +GET all Pm Jobs - exclude_default + Log Trying to get all VNF Packages present in the VNFM, using filter params + Set Headers {"Accept": "${ACCEPT_JSON}"} + Run Keyword If ${VNFM_AUTH_USAGE} == 1 Set Headers {"Authorization": "${VNFM_AUTHENTICATION}"} + GET ${apiRoot}/${apiName}/${apiVersion}/pm_jobs?exclude_default + Integer response status 200 + ${contentType}= Output response headers Content-Type + Should Contain ${contentType} ${CONTENT_TYPE_JSON} + Log Trying to validate response + ${result}= Output response body + ${json}= evaluate json.loads('''${result}''') json + Validate Json PmJob.schema.json ${json} + Log Validation OK + Log Checking that reports element is missing + ${reports}= Get Value From Json ${json} $..reports + Should Be Empty ${reports} + Log Reports element is empty as expected + GET all Pm Jobs - fields Log Trying to get all VNF Packages present in the VNFM, using filter params - Pass Execution If ${VNFM_AUTH_USAGE} == 0 Skipping test as VNFM is not supporting 'fields' + Pass Execution If ${FIELDS_USAGE} == 0 Skipping test as VNFM is not supporting 'fields' Set Headers {"Accept": "${ACCEPT_JSON}"} Run Keyword If ${VNFM_AUTH_USAGE} == 1 Set Headers {"Authorization": "${VNFM_AUTHENTICATION}"} GET ${apiRoot}/${apiName}/${apiVersion}/pm_jobs?fields=${fields} @@ -84,6 +106,29 @@ GET all Pm Jobs - fields Validate Json reports.schema.json ${reports[0]} Log Validation for reports schema OK +GET all Pm Jobs - exclude_fields + Log Trying to get all VNF Packages present in the VNFM, using filter params + Pass Execution If ${FIELDS_USAGE} == 0 Skipping test as VNFM is not supporting 'fields' + Set Headers {"Accept": "${ACCEPT_JSON}"} + Run Keyword If ${VNFM_AUTH_USAGE} == 1 Set Headers {"Authorization": "${VNFM_AUTHENTICATION}"} + GET ${apiRoot}/${apiName}/${apiVersion}/pm_jobs?fields=${fields} + Integer response status 200 + ${contentType}= Output response headers Content-Type + Should Contain ${contentType} ${CONTENT_TYPE_JSON} + Log Trying to validate response + ${result}= Output response body + ${json}= evaluate json.loads('''${result}''') json + Validate Json PmJob.schema.json ${json} + Log Validation OK + Log Checking that reports element is missing + ${reports}= Get Value From Json ${json} $..reports + Should Be Empty ${reports} + Log Reports element is empty as expected + Log Checking that criteria element is missing + ${criteria}= Get Value From Json ${json} $..criteria + Should Be Empty ${criteria} + Log Criteria element is empty as expected + GET all Pm Jobs - Negative (wronge filter name) Log Trying to get all PM Jobs present in the VNFM, using an erroneous filter param Set Headers {"Accept": "${ACCEPT_JSON}"} -- GitLab