From bc9dda726420eb2724116dbd2a8eb0eb19d1ca96 Mon Sep 17 00:00:00 2001 From: zafar Date: Mon, 1 Feb 2021 16:31:05 +0500 Subject: [PATCH 01/18] APIVersion.robot resource added in SOL012 --- SOL012/PolicyManagement-API/ApiVersion.robot | 131 ++++++++++++++++++ .../PolicyManagementKeywords.robot | 89 ++++++++++++ .../environment/variables.txt | 58 ++++++++ 3 files changed, 278 insertions(+) create mode 100644 SOL012/PolicyManagement-API/ApiVersion.robot create mode 100644 SOL012/PolicyManagement-API/PolicyManagementKeywords.robot create mode 100644 SOL012/PolicyManagement-API/environment/variables.txt diff --git a/SOL012/PolicyManagement-API/ApiVersion.robot b/SOL012/PolicyManagement-API/ApiVersion.robot new file mode 100644 index 000000000..eec5ed167 --- /dev/null +++ b/SOL012/PolicyManagement-API/ApiVersion.robot @@ -0,0 +1,131 @@ +*** Settings *** + +Resource environment/variables.txt + +#Library REST ${NFVO_SCHEMA}://${NFVO_HOST}:${NFVO_PORT} ssl_verify=false +Library DependencyLibrary +Library JSONLibrary +Library JSONSchemaLibrary schemas/ + +*** Test Cases *** +POST API Version - Method not implemented + [Documentation] Test ID: 10.3.1.1.1 + ... Test title: POST API version - Method not implemented + ... Test objective: The objective is to test that POST method is not implemented + ... Pre-conditions: none + ... Reference: Clause 9.3.3.3.1 - ETSI GS NFV-SOL 013 v3.3.1 + ... Config ID: Config_prod_NFVO + ... Applicability: none + ... Post-Conditions: none + POST API Version + Check HTTP Response Status Code Is 405 + +GET API Version + [Documentation] Test ID: 10.3.1.1.2 + ... Test title: GET API Version + ... Test objective: The objective is to test that GET method successfully return ApiVersionInformation + ... Pre-conditions: none + ... Reference: Clause 9.3.3.3.2 - ETSI GS NFV-SOL 013 v3.3.1 + ... Config ID: Config_prod_NFVO + ... Applicability: none + ... Post-Conditions: none + GET API Version + Check HTTP Response Status Code Is 200 + Check HTTP Response Body Json Schema Is ApiVersionInformation + +PUT API Version - Method not implemented + [Documentation] Test ID: 10.3.1.1.3 + ... Test title: PUT API Version - Method not implemented + ... Test objective: The objective is to test that PUT method is not implemented + ... Pre-conditions: none + ... Reference: Clause 9.3.3.3.3 - ETSI GS NFV-SOL 013 v3.3.1 + ... Config ID: Config_prod_NFVO + ... Applicability: none + ... Post-Conditions: none + PUT API Version + Check HTTP Response Status Code Is 405 + +PATCH API Version - Method not implemented + [Documentation] Test ID: 10.3.1.1.4 + ... Test title: PATCH API Version - Method not implemented + ... Test objective: The objective is to test that PATCH method is not implemented + ... Pre-conditions: none + ... Reference: Clause 9.3.3.3.4 - ETSI GS NFV-SOL 013 v3.3.1 + ... Config ID: Config_prod_NFVO + ... Applicability: none + ... Post-Conditions: none + PATCH API Version + Check HTTP Response Status Code Is 405 + +DELETE API Version - Method not implemented + [Documentation] Test ID: 10.3.1.1.5 + ... Test title: DELETE API Version - Method not implemented + ... Test objective: The objective is to test that DELETE method is not implemented + ... Pre-conditions: none + ... Reference: Clause 9.3.3.3.5 - ETSI GS NFV-SOL 013 v3.3.1 + ... Config ID: Config_prod_NFVO + ... Applicability: none + ... Post-Conditions: none + DELETE API Version + Check HTTP Response Status Code Is 405 + +POST API Version with apiMajorVerion - Method not implemented + [Documentation] Test ID: 10.3.1.1.6 + ... Test title: POST API version with apiMajorVerion - Method not implemented + ... Test objective: The objective is to test that POST method is not implemented + ... Pre-conditions: none + ... Reference: Clause 9.3.3.3.1 - ETSI GS NFV-SOL 013 v3.3.1 + ... Config ID: Config_prod_NFVO + ... Applicability: none + ... Post-Conditions: none + POST API Version + Check HTTP Response Status Code Is 405 + +GET API Version with apiMajorVerion + [Documentation] 10.3.1.1.7 + ... Test title: GET API Version with apiMajorVerion + ... Test objective: The objective is to test that GET method successfully return ApiVersionInformation + ... Pre-conditions: none + ... Reference: Clause 9.3.3.3.2 - ETSI GS NFV-SOL 013 v3.3.1 + ... Config ID: Config_prod_NFVO + ... Applicability: none + ... Post-Conditions: none + GET API Version + Check HTTP Response Status Code Is 200 + Check HTTP Response Body Json Schema Is ApiVersionInformation + +PUT API Version with apiMajorVerion - Method not implemented + [Documentation] Test ID: 10.3.1.1.8 + ... Test title: PUT API Version with apiMajorVerion - Method not implemented + ... Test objective: The objective is to test that PUT method is not implemented + ... Pre-conditions: none + ... Reference: Clause 9.3.3.3.3 - ETSI GS NFV-SOL 013 v3.3.1 + ... Config ID: Config_prod_NFVO + ... Applicability: none + ... Post-Conditions: none + PUT API Version + Check HTTP Response Status Code Is 405 + +PATCH API Version with apiMajorVerion - Method not implemented + [Documentation] Test ID: 10.3.1.1.9 + ... Test title: PATCH API Version with apiMajorVerion - Method not implemented + ... Test objective: The objective is to test that PATCH method is not implemented + ... Pre-conditions: none + ... Reference: Clause 9.3.3.3.4 - ETSI GS NFV-SOL 013 v3.3.1 + ... Config ID: Config_prod_NFVO + ... Applicability: none + ... Post-Conditions: none + PATCH API Version + Check HTTP Response Status Code Is 405 + +DELETE API Version with apiMajorVerion - Method not implemented + [Documentation] Test ID: 10.3.1.1.10 + ... Test title: DELETE API Version with apiMajorVerion - Method not implemented + ... Test objective: The objective is to test that DELETE method is not implemented + ... Pre-conditions: none + ... Reference: Clause 9.3.3.3.5 - ETSI GS NFV-SOL 013 v3.3.1 + ... Config ID: Config_prod_NFVO + ... Applicability: none + ... Post-Conditions: none + DELETE API Version + Check HTTP Response Status Code Is 405 \ No newline at end of file diff --git a/SOL012/PolicyManagement-API/PolicyManagementKeywords.robot b/SOL012/PolicyManagement-API/PolicyManagementKeywords.robot new file mode 100644 index 000000000..87400be8c --- /dev/null +++ b/SOL012/PolicyManagement-API/PolicyManagementKeywords.robot @@ -0,0 +1,89 @@ +*** Settings *** +Resource environment/variables.txt +Library REST ${NFVO_SCHEMA}://${NFVO_HOST}:${NFVO_PORT} ssl_verify=false +Library OperatingSystem +Library JSONLibrary +Library JSONSchemaLibrary schemas/ +Library String + +*** Keywords *** +POST API Version + Set Headers {"Accept":"${ACCEPT_JSON}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Post ${apiRoot}/${apiName}/api_versions + ${outputResponse}= Output response + Set Global Variable ${response} ${outputResponse} + +GET API Version + Set Headers {"Accept":"${ACCEPT_JSON}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Get ${apiRoot}/${apiName}/api_versions + ${outputResponse}= Output response + Set Global Variable ${response} ${outputResponse} + +PUT API Version + Set Headers {"Accept":"${ACCEPT_JSON}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Put ${apiRoot}/${apiName}/api_versions + ${outputResponse}= Output response + Set Global Variable ${response} ${outputResponse} + +PATCH API Version + Set Headers {"Accept":"${ACCEPT_JSON}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Patch ${apiRoot}/${apiName}/api_versions + ${outputResponse}= Output response + Set Global Variable ${response} ${outputResponse} + +DELETE API Version + Set Headers {"Accept":"${ACCEPT_JSON}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Delete ${apiRoot}/${apiName}/api_versions + ${outputResponse}= Output response + Set Global Variable ${response} ${outputResponse} + +POST API Version with apiMajorVersion + Set Headers {"Accept":"${ACCEPT_JSON}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Post ${apiRoot}/${apiName}/${apiVersion}/api_versions + ${outputResponse}= Output response + Set Global Variable ${response} ${outputResponse} + +GET API Version with apiMajorVersion + Set Headers {"Accept":"${ACCEPT_JSON}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Get ${apiRoot}/${apiName}/${apiVersion}/api_versions + ${outputResponse}= Output response + Set Global Variable ${response} ${outputResponse} + +PUT API Version with apiMajorVersion + Set Headers {"Accept":"${ACCEPT_JSON}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Put ${apiRoot}/${apiName}/${apiVersion}/api_versions + ${outputResponse}= Output response + Set Global Variable ${response} ${outputResponse} + +PATCH API Version with apiMajorVersion + Set Headers {"Accept":"${ACCEPT_JSON}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Patch ${apiRoot}/${apiName}/${apiVersion}/api_versions + ${outputResponse}= Output response + Set Global Variable ${response} ${outputResponse} + +DELETE API Version with apiMajorVersion + Set Headers {"Accept":"${ACCEPT_JSON}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Delete ${apiRoot}/${apiName}/${apiVersion}/api_versions + ${outputResponse}= Output response + Set Global Variable ${response} ${outputResponse} + +Check HTTP Response Status Code Is + [Arguments] ${expected_status} + Should Be Equal As Strings ${response['status']} ${expected_status} + Log Status code validated + +Check HTTP Response Body Json Schema Is + [Arguments] ${input} + ${schema} = Catenate ${input} .schema.json + Validate Json ${schema} ${response['body']} + Log Json Schema Validation OK \ No newline at end of file diff --git a/SOL012/PolicyManagement-API/environment/variables.txt b/SOL012/PolicyManagement-API/environment/variables.txt new file mode 100644 index 000000000..b9ab0f0f1 --- /dev/null +++ b/SOL012/PolicyManagement-API/environment/variables.txt @@ -0,0 +1,58 @@ +*** Variables *** +${NFVO_HOST} localhost # Hostname of the NFVO +${NFVO_PORT} 8081 # Listening port of the NFVO +${NFVO_SCHEMA} https +${AUTHORIZATION} Bearer QWxhZGRpbjpvcGVuIHNlc2FtZQ== +${CONTENT_TYPE} application/json +${CONTENT_TYPE_JSON} application/json +${ACCEPT} application/json +${AUTH_USAGE} 1 +${ACCEPT_JSON} application/json +${apiRoot} / +${apiName} nsiun +${apiVersion} v1 + +${SYNC_MODE} 1 + +${response} {} + +${NFVO_DUPLICATION} 1 + +${VNFM_HOST} localhost # Hostname of the VNFM +${VNFM_PORT} 8080 # Listening port of the VNFM +${VNFM_SCHEMA} https +${CONTENT_TYPE_PATCH} application/merge-patch+json +${WRONG_AUTHORIZATION} Bearer XXXXXWRONGXXXXX + +${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 + +${sub_filter} filter +${sub_filter_invalid} filter_invalid +${fields} criteria,objectInstanceIds +${subscriptionId} 6fc3539c-e602-4afa-8e13-962fb5a7d81f +${notification_ep} notification +${VrQuotaAvailNotification} {} + +${callback_uri} http://localhost +${callback_port} 9091 +${callback_endpoint} /endpoint +${callback_endpoint_fwd} /endpoint/check +${callback_endpoint_error} /endpoint_404 +${sleep_interval} 20s +${total_polling_time} 2 min +${polling_interval} 10 sec + +${notification_request} [] +${notification_response} [] + +${callbackResp} 127.0.0.1 + +${MOCK_SERVER_JAR} ../../../bin/mockserver-netty-5.5.0-jar-with-dependencies.jar -- GitLab From abffd705e8f0e418b5631759861c678ee67024e3 Mon Sep 17 00:00:00 2001 From: hammad zafar Date: Tue, 2 Feb 2021 14:47:10 +0500 Subject: [PATCH 02/18] APIVersion.robot resource added in SOL012 PM-API --- SOL012/PolicyManagement-API/ApiVersion.robot | 1 + 1 file changed, 1 insertion(+) diff --git a/SOL012/PolicyManagement-API/ApiVersion.robot b/SOL012/PolicyManagement-API/ApiVersion.robot index eec5ed167..3dbce790d 100644 --- a/SOL012/PolicyManagement-API/ApiVersion.robot +++ b/SOL012/PolicyManagement-API/ApiVersion.robot @@ -6,6 +6,7 @@ Resource environment/variables.txt Library DependencyLibrary Library JSONLibrary Library JSONSchemaLibrary schemas/ +Resource PolicyManagementKeywords.robot *** Test Cases *** POST API Version - Method not implemented -- GitLab From d728ada616ea22739c44cbba3d63c79876d2b538 Mon Sep 17 00:00:00 2001 From: hammad zafar Date: Thu, 4 Feb 2021 03:21:37 +0500 Subject: [PATCH 03/18] Subscriptions resource added in SOL012-PM-API --- SOL012/PolicyManagement-API/ApiVersion.robot | 25 +- .../PolicyManagementKeywords.robot | 167 +++++++++++++- .../PolicyManagement-API/Subscriptions.robot | 214 ++++++++++++++++++ .../environment/variables.txt | 21 +- .../jsons/PolicySubscriptionRequest.json | 9 + .../schemas/PolicySubscription.schema.json | 80 +++++++ .../PolicySubscriptionRequest.schema.json | 104 +++++++++ .../schemas/ProblemDetails.schema.json | 34 +++ .../schemas/subscriptions.schema.json | 109 +++++++++ 9 files changed, 734 insertions(+), 29 deletions(-) create mode 100644 SOL012/PolicyManagement-API/Subscriptions.robot create mode 100644 SOL012/PolicyManagement-API/jsons/PolicySubscriptionRequest.json create mode 100644 SOL012/PolicyManagement-API/schemas/PolicySubscription.schema.json create mode 100644 SOL012/PolicyManagement-API/schemas/PolicySubscriptionRequest.schema.json create mode 100644 SOL012/PolicyManagement-API/schemas/ProblemDetails.schema.json create mode 100644 SOL012/PolicyManagement-API/schemas/subscriptions.schema.json diff --git a/SOL012/PolicyManagement-API/ApiVersion.robot b/SOL012/PolicyManagement-API/ApiVersion.robot index 3dbce790d..a52617498 100644 --- a/SOL012/PolicyManagement-API/ApiVersion.robot +++ b/SOL012/PolicyManagement-API/ApiVersion.robot @@ -1,11 +1,6 @@ *** Settings *** - Resource environment/variables.txt - -#Library REST ${NFVO_SCHEMA}://${NFVO_HOST}:${NFVO_PORT} ssl_verify=false -Library DependencyLibrary -Library JSONLibrary -Library JSONSchemaLibrary schemas/ +Library DependencyLibrary Resource PolicyManagementKeywords.robot *** Test Cases *** @@ -15,7 +10,7 @@ POST API Version - Method not implemented ... Test objective: The objective is to test that POST method is not implemented ... Pre-conditions: none ... Reference: Clause 9.3.3.3.1 - ETSI GS NFV-SOL 013 v3.3.1 - ... Config ID: Config_prod_NFVO + ... Config ID: Config_prod_NFV-MANO ... Applicability: none ... Post-Conditions: none POST API Version @@ -27,7 +22,7 @@ GET API Version ... Test objective: The objective is to test that GET method successfully return ApiVersionInformation ... Pre-conditions: none ... Reference: Clause 9.3.3.3.2 - ETSI GS NFV-SOL 013 v3.3.1 - ... Config ID: Config_prod_NFVO + ... Config ID: Config_prod_NFV-MANO ... Applicability: none ... Post-Conditions: none GET API Version @@ -52,7 +47,7 @@ PATCH API Version - Method not implemented ... Test objective: The objective is to test that PATCH method is not implemented ... Pre-conditions: none ... Reference: Clause 9.3.3.3.4 - ETSI GS NFV-SOL 013 v3.3.1 - ... Config ID: Config_prod_NFVO + ... Config ID: Config_prod_NFV-MANO ... Applicability: none ... Post-Conditions: none PATCH API Version @@ -64,7 +59,7 @@ DELETE API Version - Method not implemented ... Test objective: The objective is to test that DELETE method is not implemented ... Pre-conditions: none ... Reference: Clause 9.3.3.3.5 - ETSI GS NFV-SOL 013 v3.3.1 - ... Config ID: Config_prod_NFVO + ... Config ID: Config_prod_NFV-MANO ... Applicability: none ... Post-Conditions: none DELETE API Version @@ -76,7 +71,7 @@ POST API Version with apiMajorVerion - Method not implemented ... Test objective: The objective is to test that POST method is not implemented ... Pre-conditions: none ... Reference: Clause 9.3.3.3.1 - ETSI GS NFV-SOL 013 v3.3.1 - ... Config ID: Config_prod_NFVO + ... Config ID: Config_prod_NFV-MANO ... Applicability: none ... Post-Conditions: none POST API Version @@ -88,7 +83,7 @@ GET API Version with apiMajorVerion ... Test objective: The objective is to test that GET method successfully return ApiVersionInformation ... Pre-conditions: none ... Reference: Clause 9.3.3.3.2 - ETSI GS NFV-SOL 013 v3.3.1 - ... Config ID: Config_prod_NFVO + ... Config ID: Config_prod_NFV-MANO ... Applicability: none ... Post-Conditions: none GET API Version @@ -101,7 +96,7 @@ PUT API Version with apiMajorVerion - Method not implemented ... Test objective: The objective is to test that PUT method is not implemented ... Pre-conditions: none ... Reference: Clause 9.3.3.3.3 - ETSI GS NFV-SOL 013 v3.3.1 - ... Config ID: Config_prod_NFVO + ... Config ID: Config_prod_NFV-MANO ... Applicability: none ... Post-Conditions: none PUT API Version @@ -113,7 +108,7 @@ PATCH API Version with apiMajorVerion - Method not implemented ... Test objective: The objective is to test that PATCH method is not implemented ... Pre-conditions: none ... Reference: Clause 9.3.3.3.4 - ETSI GS NFV-SOL 013 v3.3.1 - ... Config ID: Config_prod_NFVO + ... Config ID: Config_prod_NFV-MANO ... Applicability: none ... Post-Conditions: none PATCH API Version @@ -125,7 +120,7 @@ DELETE API Version with apiMajorVerion - Method not implemented ... Test objective: The objective is to test that DELETE method is not implemented ... Pre-conditions: none ... Reference: Clause 9.3.3.3.5 - ETSI GS NFV-SOL 013 v3.3.1 - ... Config ID: Config_prod_NFVO + ... Config ID: Config_prod_NFV-MANO ... Applicability: none ... Post-Conditions: none DELETE API Version diff --git a/SOL012/PolicyManagement-API/PolicyManagementKeywords.robot b/SOL012/PolicyManagement-API/PolicyManagementKeywords.robot index 87400be8c..72afd150d 100644 --- a/SOL012/PolicyManagement-API/PolicyManagementKeywords.robot +++ b/SOL012/PolicyManagement-API/PolicyManagementKeywords.robot @@ -1,6 +1,6 @@ *** Settings *** Resource environment/variables.txt -Library REST ${NFVO_SCHEMA}://${NFVO_HOST}:${NFVO_PORT} ssl_verify=false +Library REST ${NFVMANO_SCHEMA}://${NFVMANO_HOST}:${NFVMANO_PORT}" Library OperatingSystem Library JSONLibrary Library JSONSchemaLibrary schemas/ @@ -86,4 +86,167 @@ Check HTTP Response Body Json Schema Is [Arguments] ${input} ${schema} = Catenate ${input} .schema.json Validate Json ${schema} ${response['body']} - Log Json Schema Validation OK \ No newline at end of file + Log Json Schema Validation OK + +Check HTTP Response Header Contains + [Arguments] ${CONTENT_TYPE} + Should Contain ${response['headers']} ${CONTENT_TYPE} + Log Header is present + +Check subscription existence + Set Headers {"Accept":"${ACCEPT}"} + Set Headers {"Content-Type": "${CONTENT_TYPE}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Get ${apiRoot}/${apiName}/${apiVersion}/subscriptions/${subscriptionId} + Integer response status 200 + +Check Postcondition Individual Subscription Resource Returned in Location Header Is Available + Log Going to check postcondition + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"} + GET ${response['headers']['Location']} + Integer response status 200 + Log Received a 200 OK as expected + ${contentType}= Output response headers Content-Type + Should Contain ${contentType} application/json + ${result}= Output response body + Validate Json PolicySubscription.schema.json ${result} + Log Validated PolicySubscription schema + ${body}= Get File jsons/PolicySubscriptionRequest.json + ${subscription}= evaluate json.loads('''${body}''') json + Should Be Equal ${result['callbackUri']} ${subscription['callbackUri']} + Log Validated Issued subscription is same as original + +Check HTTP Response Header Contains Link + ${linkURL}= Get Value From Json ${response['headers']} $..Link + Should Not Be Empty ${linkURL} + +Check Postcondition Subscriptions Exist + Log Checking that subscriptions exists + Get Subscriptions + +POST subscriptions + Log Create subscription instance by POST to ${apiRoot}/${apiName}/${apiVersion}/subscriptions + Set Headers {"Accept":"${ACCEPT}"} + Set Headers {"Content-Type": "${CONTENT_TYPE}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + ${body}= Get File jsons/PolicySubscriptionRequest.json + Post ${apiRoot}/${apiName}/${apiVersion}/subscriptions ${body} + ${outputResponse}= Output response + Set Global Variable ${response} ${outputResponse} + +POST subscriptions NO DUPLICATION + Log Trying to create a subscription with an already created content + #Skip this test if NFVMANO allows creation of duplicate/redundant subscriptions + Pass Execution If ${NFVMANO_DUPLICATION} == 1 NFVMANO allows creation of redundant subscriptions + Set Headers {"Accept":"${ACCEPT}"} + Set Headers {"Content-Type": "${CONTENT_TYPE}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + ${body}= Get File jsons/PolicySubscriptionRequest.json + Post ${apiRoot}/${apiName}/${apiVersion}/subscriptions ${body} + ${outputResponse}= Output response + Set Global Variable ${response} ${outputResponse} + +POST subscriptions with Invalid Request + Log Trying to create a subscription with invalid request body + Set Headers {"Accept":"${ACCEPT}"} + Set Headers {"Content-Type": "${CONTENT_TYPE}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + ${body}= Get File jsons/InvalidPolicySubscriptionRequest.json + Post ${apiRoot}/${apiName}/${apiVersion}/subscriptions ${body} + ${outputResponse}= Output response + Set Global Variable ${response} ${outputResponse} + +GET Subscriptions + Log Get the list of active subscriptions + Set Headers {"Accept":"${ACCEPT}"} + Set Headers {"Content-Type": "${CONTENT_TYPE}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Log Execute Query and validate response + Get ${apiRoot}/${apiName}/${apiVersion}/subscriptions + ${outputResponse}= Output response + Set Global Variable ${response} ${outputResponse} + +Get subscriptions with all_fields attribute selector + Log Get the list of active subscriptions, using fields + Set Headers {"Accept": "${ACCEPT_JSON}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"} + GET ${apiRoot}/${apiName}/${apiVersion}/subscriptions?all_fields + ${output}= Output response + Set Suite Variable ${response} ${output} + +Get subscriptions with exclude_default attribute selector + Log Get the list of active subscriptions, using fields + Set Headers {"Accept": "${ACCEPT_JSON}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"} + GET ${apiRoot}/${apiName}/${apiVersion}/subscriptions?exclude_default + ${output}= Output response + Set Suite Variable ${response} ${output} + +Get subscriptions with fields attribute selector + Log Get the list of active subscriptions, using fields + Set Headers {"Accept": "${ACCEPT_JSON}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"} + GET ${apiRoot}/${apiName}/${apiVersion}/subscriptions?fields=${fields} + ${output}= Output response + Set Suite Variable ${response} ${output} + +Get subscriptions with exclude_fields attribute selector + Log Get the list of active subscriptions, using fields + Set Headers {"Accept": "${ACCEPT_JSON}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"} + GET ${apiRoot}/${apiName}/${apiVersion}/subscriptions?exclude_fields=${fields} + ${output}= Output response + Set Suite Variable ${response} ${output} + +GET subscriptions with filter + Log Get the list of active subscriptions using a filter + Set Headers {"Accept": "${ACCEPT}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"} + GET ${apiRoot}/${apiName}/${apiVersion}/subscriptions?${sub_filter} + ${outputResponse}= Output response + Set Global Variable ${response} ${outputResponse} + +Get subscriptions - invalid filter + Log Get the list of active subscriptions using an invalid filter + Set Headers {"Accept": "${ACCEPT}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"} + GET ${apiRoot}/${apiName}/${apiVersion}/subscriptions?${sub_filter_invalid} + ${outputResponse}= Output response + Set Global Variable ${response} ${outputResponse} + +Get subscriptions with exclude_default and fields attribute selector + Log Get the list of active subscriptions, using fields + Set Headers {"Accept": "${ACCEPT_JSON}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"} + GET ${apiRoot}/${apiName}/${apiVersion}/subscriptions?fields=${fields}&exclude_default + ${output}= Output response + Set Suite Variable ${response} ${output} + + +PUT subscriptions + Log Trying to perform a PUT. This method should not be implemented + Set Headers {"Accept":"${ACCEPT}"} + Set Headers {"Content-Type": "${CONTENT_TYPE}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Put ${apiRoot}/${apiName}/${apiVersion}/subscriptions + ${outputResponse}= Output response + Set Global Variable ${response} ${outputResponse} + +PATCH subscriptions + Log Trying to perform a PATCH. This method should not be implemented + Set Headers {"Accept":"${ACCEPT}"} + Set Headers {"Content-Type": "${CONTENT_TYPE}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Patch ${apiRoot}/${apiName}/${apiVersion}/subscriptions + ${outputResponse}= Output response + Set Global Variable ${response} ${outputResponse} + +DELETE subscriptions + Log Trying to perform a DELETE. This method should not be implemented + Set Headers {"Accept":"${ACCEPT}"} + Set Headers {"Content-Type": "${CONTENT_TYPE}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Delete ${apiRoot}/${apiName}/${apiVersion}/subscriptions + ${outputResponse}= Output response + Set Global Variable ${response} ${outputResponse} + diff --git a/SOL012/PolicyManagement-API/Subscriptions.robot b/SOL012/PolicyManagement-API/Subscriptions.robot new file mode 100644 index 000000000..b13fff0a6 --- /dev/null +++ b/SOL012/PolicyManagement-API/Subscriptions.robot @@ -0,0 +1,214 @@ +*** Settings *** +Resource environment/variables.txt +Resource PolicyManagementKeywords.robot + +*** Test Cases *** +POST Create a new subscription + [Documentation] Test ID: 10.3.1.2.1 + ... Test title: POST Create a new subscription + ... Test objective: The objective is to test that POST method creates a subscription. + ... Pre-conditions: none + ... Reference: Clause 5.5.7.3.1 - ETSI GS NFV-SOL 012 [7] v3.4.1 + ... Config ID: Config_prod_NFV-MANO + ... Applicability: none + ... Post-Conditions: Policy subscription is created. + POST subscriptions + Check HTTP Response Status Code Is 201 + Check HTTP Response Body Json Schema Is PolicySubscription + Check HTTP Response Header Contains Location + +POST Create a new Subscription - DUPLICATION NOT ALLOWED + [Documentation] Test ID: 10.3.1.2.2 + ... Test title: POST Create a new subscription - DUPLICATION NOT ALLOWED + ... Test objective: The objective is to test that POST method cannot create a duplicate subscription. + ... Pre-conditions: A subscription shall already exist. + ... Reference: Clause 5.5.7.3.1 - ETSI GS NFV-SOL 012 [7] v3.4.1 + ... Config ID: Config_prod_NFV-MANO + ... Applicability: Duplication is not supported by NFVMANO. + ... Post-Conditions: Individual subscription resource returned in the location header is available. + POST subscriptions NO DUPLICATION + Check Subscription Existence + Check HTTP Response Status Code Is 303 + Check HTTP Response Header Contains Location + Check Postcondition Individual Subscription Resource Returned in Location Header Is Available + + +POST Create a new Subscription - UNPROCESSABLE ENTITY + [Documentation] Test ID: 10.3.1.2.3 + ... Test title: POST Create a new Subscription - UNPROCESSABLE ENTITY + ... Test objective: The objective is to test that correct error code is generated when data in the request body cannot be processed. + ... Pre-conditions: Request body contains invalid schema. + ... Reference: Clause 5.5.7.3.1 - ETSI GS NFV-SOL 012 [7] v3.4.1 + ... Config ID: Config_prod_NFV-MANO + ... Applicability: none + ... Post-Conditions: none + POST subscriptions with Invalid Request + Check HTTP Response Status Code Is 422 + Check HTTP Response Body Json Schema Is ProblemDetails + +GET Subscriptions + [Documentation] Test ID: 10.3.1.2.4 + ... Test title: GET Subscriptions + ... Test objective: The objective is to test that GET method retrieves the list of existing subscriptions + ... Pre-conditions: none + ... Reference: Clause 5.5.7.3.2 - ETSI GS NFV-SOL 012 [7] v3.4.1 + ... Config ID: Config_prod_NFV-MANO + ... Applicability: none + ... Post-Conditions: none + GET Subscriptions + Check HTTP Response Status Code Is 200 + Check HTTP Response Body Json Schema Is subscriptions + +GET Subscription - Filter + [Documentation] Test ID: 10.3.1.2.5 + ... Test title: GET Subscription - Filter + ... Test objective: The objective is GET the list of active subscriptions using a filter + ... Pre-conditions: none + ... Reference: Clause 5.5.7.3.2 - ETSI GS NFV-SOL 012 [7] v3.4.1 + ... Config ID: Config_prod_NFV-MANO + ... Applicability: none + ... Post-Conditions: none + GET Subscriptions with filter + Check HTTP Response Status Code Is 200 + Check HTTP Response Body Json Schema Is subscriptions + +GET subscriptions - Bad Request Invalid attribute-based filtering parameters + [Documentation] Test ID: 10.3.1.2.6 + ... Test title: GET subscriptions - Bad Request Invalid attribute-based filtering parameters + ... Test objective: The objective is GET the list of active subscriptions using an invalid filter + ... Pre-conditions: none + ... Reference: Clause 5.5.7.3.2 - ETSI GS NFV-SOL 012 [7] v3.4.1 + ... Config ID: Config_prod_NFV-MANO + ... Applicability: none + ... Post-Conditions: none + Get subscriptions - invalid filter + Check HTTP Response Status Code Is 400 + Check HTTP Response Body Json Schema Is ProblemDetails + +GET subscriptions - Bad Request Response too Big + [Documentation] Test ID: 10.3.1.2.7 + ... Test title: GET subscriptions - Bad Request Response too Big + ... Test objective: The objective is test that the retrieval of active subscriptions list fails because response is too big, and perform the JSON schema validation of the failed operation HTTP response. + ... Pre-conditions: none + ... Reference: Clause 5.5.7.3.2 - ETSI GS NFV-SOL 012 [7] v3.4.1 + ... Config ID: Config_prod_NFV-MANO + ... Applicability: none + ... Post-Conditions: none + GET Subscriptions + Check HTTP Response Status Code Is 400 + Check HTTP Response Body Json Schema Is ProblemDetails + +GET subscriptions with "all_fields" attribute selector + [Documentation] Test ID: 10.3.1.2.8 + ... Test title: GET subscriptions with "all_fields" attribute selector + ... Test objective: The objective is to retrieve the list of active subscriptions with "all_fields" attribute selector + ... Pre-conditions: none + ... Reference: Clause 5.5.7.3.2 - ETSI GS NFV-SOL 012 [7] v3.4.1 + ... Config ID: Config_prod_NFV-MANO + ... Applicability: none + ... Post-Conditions: none + Get subscriptions with all_fields attribute selector + Check HTTP Response Status Code Is 200 + Check HTTP Response Body Json Schema Is subscriptions + +GET subscriptions with "exclude_default" attribute selector + [Documentation] Test ID: 10.3.1.2.9 + ... Test title: GET subscriptions with "exclude_default" attribute selector + ... Test objective: The objective is to retrieve the list of active subscriptions with "exclude_default"s attribute selector + ... Pre-conditions: none + ... Reference: Clause 5.5.7.3.2 - ETSI GS NFV-SOL 012 [7] v3.4.1 + ... Config ID: Config_prod_NFV-MANO + ... Applicability: none + ... Post-Conditions: none + Get subscriptions with exclude_default attribute selector + Check HTTP Response Status Code Is 200 + Check HTTP Response Body Json Schema Is subscriptions + +GET subscriptions with "fields" attribute selector + [Documentation] Test ID: 10.3.1.2.10 + ... Test title: GET subscriptions with "fields" attribute selector + ... Test objective: The objective is to retrieve the list of active subscriptions with "fields" attribute selector + ... Pre-conditions: none + ... Reference: Clause 5.5.7.3.2 - ETSI GS NFV-SOL 012 [7] v3.4.1 + ... Config ID: Config_prod_NFV-MANO + ... Applicability: none + ... Post-Conditions: none + Get subscriptions with fields attribute selector + Check HTTP Response Status Code Is 200 + Check HTTP Response Body Json Schema Is subscriptions + +GET subscriptions with "exclude_fields" attribute selector + [Documentation] Test ID: 10.3.1.2.11 + ... Test title: GET subscriptions with "exclude_fields" attribute selector + ... Test objective: The objective is to retrieve the list of active subscriptions with "exclude_fields" attribute selector + ... Pre-conditions: none + ... Reference: Clause 5.5.7.3.2 - ETSI GS NFV-SOL 012 [7] v3.4.1 + ... Config ID: Config_prod_NFV-MANO + ... Applicability: none + ... Post-Conditions: none + Get subscriptions with exclude_fields attribute selector + Check HTTP Response Status Code Is 200 + Check HTTP Response Body Json Schema Is subscriptions + +GET Subscriptions as Paged Response + [Documentation] Test ID: 10.3.1.2.12 + ... Test title: GET Subscriptions as Paged Response + ... Test objective: The objective is to test that GET method retrieve the list of existing subscriptions as paged response. + ... Pre-conditions: none + ... Reference: Clause 5.5.7.3.2 - ETSI GS NFV-SOL 012 [7] v3.4.1 + ... Config ID: Config_prod_NFV-MANO + ... Applicability: NFV-MANO supports paged response + ... Post-Conditions: none + GET Subscriptions + Check HTTP Response Status Code Is 200 + Check HTTP Response Header Contains Link + +PUT subscriptions - Method not implemented + [Documentation] Test ID: 10.3.1.2.13 + ... Test title: PUT subscriptions - Method not implemented + ... Test objective: The objective is to test that PUT method cannot modify a NS instance usage subscription + ... Pre-conditions: none + ... Reference: Clause 5.5.7.3.3 - ETSI GS NFV-SOL 012 [7] v3.4.1 + ... Config ID: Config_prod_NFV-MANO + ... Applicability: none + ... Post-Conditions: none + PUT subscriptions + Check HTTP Response Status Code Is 405 + +PATCH subscriptions - Method not implemented + [Documentation] Test ID: 10.3.1.2.14 + ... Test title: PATCH subscriptions - Method not implemented + ... Test objective: The objective is to test that PUT method cannot modify a NS instance usage subscription + ... Pre-conditions: none + ... Reference: Clause 5.5.7.3.4 - ETSI GS NFV-SOL 012 [7] v3.4.1 + ... Config ID: Config_prod_NFV-MANO + ... Applicability: none + ... Post-Conditions: none + PATCH subscriptions + Check HTTP Response Status Code Is 405 + +DELETE subscriptions - Method not implemented + [Documentation] Test ID: 10.3.1.2.15 + ... Test title: DELETE subscriptions - Method not implemented + ... Test objective: The objective is to test that DELETE method cannot delete a NS instance usage subscription + ... Pre-conditions: none + ... Reference: Clause 5.5.7.3.5 - ETSI GS NFV-SOL 012 [7] v3.4.1 + ... Config ID: Config_prod_NFV-MANO + ... Applicability: none + ... Post-Conditions: Subscriptions are not deleted + DELETE subscriptions + Check HTTP Response Status Code Is 405 + Check Postcondition Subscriptions Exist + +GET subscriptions with "exclude_default" and "fields" attribute selector + [Documentation] Test ID: 10.3.1.2.16 + ... Test title: GET subscriptions with "exclude_default" and "fields" attribute selector + ... Test objective: The objective is to retrieve the list of active subscriptions with "exclude_default" and "fields" attribute selector + ... Pre-conditions: + ... Reference: Clause 5.5.7.3.2 - ETSI GS NFV-SOL 012 [7] v3.4.1 + ... Config ID: Config_prod_NFV-MANO + ... Applicability: none + ... Post-Conditions: none + Get subscriptions with exclude_default and fields attribute selector + Check HTTP Response Status Code Is 200 + Check HTTP Response Body Json Schema Is subscriptions \ No newline at end of file diff --git a/SOL012/PolicyManagement-API/environment/variables.txt b/SOL012/PolicyManagement-API/environment/variables.txt index b9ab0f0f1..bb751852f 100644 --- a/SOL012/PolicyManagement-API/environment/variables.txt +++ b/SOL012/PolicyManagement-API/environment/variables.txt @@ -1,28 +1,25 @@ *** Variables *** -${NFVO_HOST} localhost # Hostname of the NFVO -${NFVO_PORT} 8081 # Listening port of the NFVO -${NFVO_SCHEMA} https +${NFVMANO_HOST} localhost # Hostname of the NFVO +${NFVMANO_PORT} 8081 # Listening port of the NFVO +${NFVMANO_SCHEMA} https ${AUTHORIZATION} Bearer QWxhZGRpbjpvcGVuIHNlc2FtZQ== +${WRONG_AUTHORIZATION} Bearer XXXXXWRONGXXXXX ${CONTENT_TYPE} application/json ${CONTENT_TYPE_JSON} application/json +${CONTENT_TYPE_PATCH} application/merge-patch+json ${ACCEPT} application/json -${AUTH_USAGE} 1 ${ACCEPT_JSON} application/json +${AUTH_USAGE} 1 + ${apiRoot} / -${apiName} nsiun +${apiName} nfvpolicy ${apiVersion} v1 ${SYNC_MODE} 1 ${response} {} -${NFVO_DUPLICATION} 1 - -${VNFM_HOST} localhost # Hostname of the VNFM -${VNFM_PORT} 8080 # Listening port of the VNFM -${VNFM_SCHEMA} https -${CONTENT_TYPE_PATCH} application/merge-patch+json -${WRONG_AUTHORIZATION} Bearer XXXXXWRONGXXXXX +${NFVMANO_DUPLICATION} 1 ${vnfInstanceDescription} description vnf ${vnfInstanceDescription_Update} Updated description vnf diff --git a/SOL012/PolicyManagement-API/jsons/PolicySubscriptionRequest.json b/SOL012/PolicyManagement-API/jsons/PolicySubscriptionRequest.json new file mode 100644 index 000000000..77348deb0 --- /dev/null +++ b/SOL012/PolicyManagement-API/jsons/PolicySubscriptionRequest.json @@ -0,0 +1,9 @@ +{ + "filter": { + "notificationTypes": "PolicyChangeNotification", + "policyIds": "", + "changeTypes": "CREATE_POLICY" + }, + "callbackUri": "http://127.0.0.1/subscribe", + "authentication": "" +} \ No newline at end of file diff --git a/SOL012/PolicyManagement-API/schemas/PolicySubscription.schema.json b/SOL012/PolicyManagement-API/schemas/PolicySubscription.schema.json new file mode 100644 index 000000000..388e5f92c --- /dev/null +++ b/SOL012/PolicyManagement-API/schemas/PolicySubscription.schema.json @@ -0,0 +1,80 @@ +{ + "description": "This type represents a subscription related to notifications about policy changes and policy conflicts. It shall comply with the provisions defined in table 5.6.2.6-1.\n", + "type": "object", + "properties": { + "id": { + "description": "An identifier with the intention of being globally unique.\n", + "type": "string" + }, + "filter": { + "description": "This type represents a subscription filter related to notifications about policy changes and policy conflicts. It shall comply with the provisions defined in table 5.6.3.2-1. At a particular nesting level in the filter structure, the following applies: All attributes shall match in order for the filter to match (logical \"and\" between different filter attributes). If an attribute is an array, the attribute shall match if at least one of the values in the array matches (logical \"or\" between the values of one filter attribute).\n", + "type": "object", + "properties": { + "notificationTypes": { + "description": "Match particular notification types. Permitted values: -\tPolicyChangeNotification -\tPolicyConflictNotification The permitted values of the \"notificationTypes\" attribute are spelled exactly as the names of the notification types to facilitate automated code generation systems.\n", + "type": "array", + "items": { + "type": "string", + "enum": [ + "PolicyChangeNotification", + "PolicyConflictNotification" + ] + } + }, + "policyIds": { + "description": "Match particular policy identifiers. For \"PolicyConflictNotification\", the notification is sent if any of the policies specified in the subscription is impacted by the conflict, as defined in clause 5.6.2.8.\n", + "type": "array", + "items": { + "description": "An identifier with the intention of being globally unique.\n", + "type": "string" + } + }, + "changeTypes": { + "description": "Match particular policy management operation types that cause the change of the policy.\n", + "type": "array", + "items": { + "description": "The enumeration PolicyOperationType shall comply with the provisions defined in table 5.6.4.4-1. It indicates the type of the policy change. Permitted values: * CREATE_POLICY:\tThe policy is created. * TRANSFER_POLICY:\tThe policy is transferred. * DELETE_POLICY:\tThe policy is deleted. * MODIFY_POLICY:\tThe policy is modified.\n", + "type": "string", + "enum": [ + "CREATE_POLICY", + "TRANSFER_POLICY", + "DELETE_POLICY", + "MODIFY_POLICY" + ] + } + } + } + }, + "callbackUri": { + "description": "String formatted according to IETF RFC 3986.\n", + "type": "string" + }, + "_links": { + "description": "Links for this resource.\n", + "type": "object", + "properties": { + "self": { + "description": "This type represents a link to a resource using an absolute URI.\n", + "type": "object", + "required": [ + "href" + ], + "properties": { + "href": { + "description": "String formatted according to IETF RFC 3986.\n", + "type": "string" + } + } + } + }, + "required": [ + "self" + ] + } + }, + "required": [ + "id", + "callbackUri", + "_links" + ] +} \ No newline at end of file diff --git a/SOL012/PolicyManagement-API/schemas/PolicySubscriptionRequest.schema.json b/SOL012/PolicyManagement-API/schemas/PolicySubscriptionRequest.schema.json new file mode 100644 index 000000000..48e0587c9 --- /dev/null +++ b/SOL012/PolicyManagement-API/schemas/PolicySubscriptionRequest.schema.json @@ -0,0 +1,104 @@ +{ + "description": "This type represents a subscription request related to notifications about policy changes and policy conflicts. It shall comply with the provisions defined in table 5.6.2.5-1.\n", + "type": "object", + "properties": { + "filter": { + "description": "This type represents a subscription filter related to notifications about policy changes and policy conflicts. It shall comply with the provisions defined in table 5.6.3.2-1. At a particular nesting level in the filter structure, the following applies: All attributes shall match in order for the filter to match (logical \"and\" between different filter attributes). If an attribute is an array, the attribute shall match if at least one of the values in the array matches (logical \"or\" between the values of one filter attribute).\n", + "type": "object", + "properties": { + "notificationTypes": { + "description": "Match particular notification types. Permitted values: -\tPolicyChangeNotification -\tPolicyConflictNotification The permitted values of the \"notificationTypes\" attribute are spelled exactly as the names of the notification types to facilitate automated code generation systems.\n", + "type": "array", + "items": { + "type": "string", + "enum": [ + "PolicyChangeNotification", + "PolicyConflictNotification" + ] + } + }, + "policyIds": { + "description": "Match particular policy identifiers. For \"PolicyConflictNotification\", the notification is sent if any of the policies specified in the subscription is impacted by the conflict, as defined in clause 5.6.2.8.\n", + "type": "array", + "items": { + "description": "An identifier with the intention of being globally unique.\n", + "type": "string" + } + }, + "changeTypes": { + "description": "Match particular policy management operation types that cause the change of the policy.\n", + "type": "array", + "items": { + "description": "The enumeration PolicyOperationType shall comply with the provisions defined in table 5.6.4.4-1. It indicates the type of the policy change. Permitted values: * CREATE_POLICY:\tThe policy is created. * TRANSFER_POLICY:\tThe policy is transferred. * DELETE_POLICY:\tThe policy is deleted. * MODIFY_POLICY:\tThe policy is modified.\n", + "type": "string", + "enum": [ + "CREATE_POLICY", + "TRANSFER_POLICY", + "DELETE_POLICY", + "MODIFY_POLICY" + ] + } + } + } + }, + "callbackUri": { + "description": "String formatted according to IETF RFC 3986.\n", + "type": "string" + }, + "authentication": { + "type": "object", + "required": [ + "authType" + ], + "properties": { + "authType": { + "description": "Defines the types of Authentication / Authorization which the API consumer is willing to accept when receiving a notification. Permitted values: * BASIC: In every HTTP request to the notification endpoint, use\n HTTP Basic authentication with the client credentials.\n* OAUTH2_CLIENT_CREDENTIALS: In every HTTP request to the\n notification endpoint, use an OAuth 2.0 Bearer token, obtained\n using the client credentials grant type.\n* TLS_CERT: Every HTTP request to the notification endpoint is sent\n over a mutually authenticated TLS session, i.e. not only the\n server is authenticated, but also the client is authenticated\n during the TLS tunnel setup.\n", + "type": "array", + "items": { + "type": "string", + "enum": [ + "BASIC", + "OAUTH2_CLIENT_CREDENTIALS", + "TLS_CERT" + ] + } + }, + "paramsBasic": { + "description": "Parameters for authentication/authorization using BASIC. Shall be present if authType is \"BASIC\" and the contained information has not been provisioned out of band. Shall be absent otherwise.\n", + "type": "object", + "properties": { + "userName": { + "description": "Username to be used in HTTP Basic authentication. Shall be present if it has not been provisioned out of band.\n", + "type": "string" + }, + "password": { + "description": "Password to be used in HTTP Basic authentication. Shall be present if it has not been provisioned out of band.\n", + "type": "string" + } + } + }, + "paramsOauth2ClientCredentials": { + "description": "Parameters for authentication/authorization using OAUTH2_CLIENT_CREDENTIALS. Shall be present if authType is \"OAUTH2_CLIENT_CREDENTIALS\" and the contained information has not been provisioned out of band. Shall be absent otherwise.\n", + "type": "object", + "properties": { + "clientId": { + "description": "Client identifier to be used in the access token request of the OAuth 2.0 client credentials grant type. Shall be present if it has not been provisioned out of band. The clientId and clientPassword passed in a subscription shall not be the same as the clientId and clientPassword that are used to obtain authorization for API requests. Client credentials may differ between subscriptions. The value of clientPassword should be generated by a random process.\n", + "type": "string" + }, + "clientPassword": { + "description": "Client password to be used in the access token request of the OAuth 2.0 client credentials grant type. Shall be present if it has not been provisioned out of band. The clientId and clientPassword passed in a subscription shall not be the same as the clientId and clientPassword that are used to obtain authorization for API requests. Client credentials may differ between subscriptions. The value of clientPassword should be generated by a random process.\n", + "type": "string" + }, + "tokenEndpoint": { + "description": "String formatted according to IETF RFC 3986.\n", + "type": "string" + } + } + } + } + } + }, + "required": [ + "callbackUri" + ] +} \ No newline at end of file diff --git a/SOL012/PolicyManagement-API/schemas/ProblemDetails.schema.json b/SOL012/PolicyManagement-API/schemas/ProblemDetails.schema.json new file mode 100644 index 000000000..62f176127 --- /dev/null +++ b/SOL012/PolicyManagement-API/schemas/ProblemDetails.schema.json @@ -0,0 +1,34 @@ +{ + "definitions": {}, + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "description": "The definition of the general \"ProblemDetails\" data structure from IETF RFC 7807 [19] is reproduced inthis structure. Compared to the general framework defined in IETF RFC 7807 [19], the \"status\" and \"detail\" attributes are mandated to be included by the present document, to ensure that the response contains additional textual information about an error. IETF RFC 7807 [19] foresees extensibility of the \"ProblemDetails\" type. It is possible that particular APIs in the present document, or particular implementations, define extensions to define additional attributes that provide more information about the error. The description column only provides some explanation of the meaning to Facilitate understanding of the design. For a full description, see IETF RFC 7807 [19].\n", + "properties": { + "type": { + "type": "string", + "description": "A URI reference according to IETF RFC 3986 [5] that identifies the problem type. It is encouraged that the URI provides human-readable documentation for the problem (e.g. using HTML) when dereferenced. When this member is not present, its value is assumed to be \"about:blank\".\n", + "format": "URI" + }, + "title": { + "type": "string", + "description": "A short, human-readable summary of the problem type. It should not change from occurrence to occurrence of the problem, except for purposes of localization. If type is given and other than \"about:blank\", this attribute shall also be provided. A short, human-readable summary of the problem type. It SHOULD NOT change from occurrence to occurrence of the problem, except for purposes of localization (e.g., using proactive content negotiation; see [RFC7231], Section 3.4).\n" + }, + "status": { + "type": "integer", + "description": "The HTTP status code for this occurrence of the problem. The HTTP status code ([RFC7231], Section 6) generated by the origin server for this occurrence of the problem.\n" + }, + "detail": { + "type": "string", + "description": "A human-readable explanation specific to this occurrence of the problem.\n" + }, + "instance": { + "type": "string", + "description": "A URI reference that identifies the specific occurrence of the problem. It may yield further information if dereferenced.\n", + "format": "URI" + } + }, + "required": [ + "status", + "detail" + ] +} \ No newline at end of file diff --git a/SOL012/PolicyManagement-API/schemas/subscriptions.schema.json b/SOL012/PolicyManagement-API/schemas/subscriptions.schema.json new file mode 100644 index 000000000..6cae848c3 --- /dev/null +++ b/SOL012/PolicyManagement-API/schemas/subscriptions.schema.json @@ -0,0 +1,109 @@ +{ + "type": "array", + "items": + { + "description": "This type represents a subscription request related to notifications about policy changes and policy conflicts. It shall comply with the provisions defined in table 5.6.2.5-1.\n", + "type": "object", + "properties": { + "filter": { + "description": "This type represents a subscription filter related to notifications about policy changes and policy conflicts. It shall comply with the provisions defined in table 5.6.3.2-1. At a particular nesting level in the filter structure, the following applies: All attributes shall match in order for the filter to match (logical \"and\" between different filter attributes). If an attribute is an array, the attribute shall match if at least one of the values in the array matches (logical \"or\" between the values of one filter attribute).\n", + "type": "object", + "properties": { + "notificationTypes": { + "description": "Match particular notification types. Permitted values: -\tPolicyChangeNotification -\tPolicyConflictNotification The permitted values of the \"notificationTypes\" attribute are spelled exactly as the names of the notification types to facilitate automated code generation systems.\n", + "type": "array", + "items": { + "type": "string", + "enum": [ + "PolicyChangeNotification", + "PolicyConflictNotification" + ] + } + }, + "policyIds": { + "description": "Match particular policy identifiers. For \"PolicyConflictNotification\", the notification is sent if any of the policies specified in the subscription is impacted by the conflict, as defined in clause 5.6.2.8.\n", + "type": "array", + "items": { + "description": "An identifier with the intention of being globally unique.\n", + "type": "string" + } + }, + "changeTypes": { + "description": "Match particular policy management operation types that cause the change of the policy.\n", + "type": "array", + "items": { + "description": "The enumeration PolicyOperationType shall comply with the provisions defined in table 5.6.4.4-1. It indicates the type of the policy change. Permitted values: * CREATE_POLICY:\tThe policy is created. * TRANSFER_POLICY:\tThe policy is transferred. * DELETE_POLICY:\tThe policy is deleted. * MODIFY_POLICY:\tThe policy is modified.\n", + "type": "string", + "enum": [ + "CREATE_POLICY", + "TRANSFER_POLICY", + "DELETE_POLICY", + "MODIFY_POLICY" + ] + } + } + } + }, + "callbackUri": { + "description": "String formatted according to IETF RFC 3986.\n", + "type": "string" + }, + "authentication": { + "type": "object", + "required": [ + "authType" + ], + "properties": { + "authType": { + "description": "Defines the types of Authentication / Authorization which the API consumer is willing to accept when receiving a notification. Permitted values: * BASIC: In every HTTP request to the notification endpoint, use\n HTTP Basic authentication with the client credentials.\n* OAUTH2_CLIENT_CREDENTIALS: In every HTTP request to the\n notification endpoint, use an OAuth 2.0 Bearer token, obtained\n using the client credentials grant type.\n* TLS_CERT: Every HTTP request to the notification endpoint is sent\n over a mutually authenticated TLS session, i.e. not only the\n server is authenticated, but also the client is authenticated\n during the TLS tunnel setup.\n", + "type": "array", + "items": { + "type": "string", + "enum": [ + "BASIC", + "OAUTH2_CLIENT_CREDENTIALS", + "TLS_CERT" + ] + } + }, + "paramsBasic": { + "description": "Parameters for authentication/authorization using BASIC. Shall be present if authType is \"BASIC\" and the contained information has not been provisioned out of band. Shall be absent otherwise.\n", + "type": "object", + "properties": { + "userName": { + "description": "Username to be used in HTTP Basic authentication. Shall be present if it has not been provisioned out of band.\n", + "type": "string" + }, + "password": { + "description": "Password to be used in HTTP Basic authentication. Shall be present if it has not been provisioned out of band.\n", + "type": "string" + } + } + }, + "paramsOauth2ClientCredentials": { + "description": "Parameters for authentication/authorization using OAUTH2_CLIENT_CREDENTIALS. Shall be present if authType is \"OAUTH2_CLIENT_CREDENTIALS\" and the contained information has not been provisioned out of band. Shall be absent otherwise.\n", + "type": "object", + "properties": { + "clientId": { + "description": "Client identifier to be used in the access token request of the OAuth 2.0 client credentials grant type. Shall be present if it has not been provisioned out of band. The clientId and clientPassword passed in a subscription shall not be the same as the clientId and clientPassword that are used to obtain authorization for API requests. Client credentials may differ between subscriptions. The value of clientPassword should be generated by a random process.\n", + "type": "string" + }, + "clientPassword": { + "description": "Client password to be used in the access token request of the OAuth 2.0 client credentials grant type. Shall be present if it has not been provisioned out of band. The clientId and clientPassword passed in a subscription shall not be the same as the clientId and clientPassword that are used to obtain authorization for API requests. Client credentials may differ between subscriptions. The value of clientPassword should be generated by a random process.\n", + "type": "string" + }, + "tokenEndpoint": { + "description": "String formatted according to IETF RFC 3986.\n", + "type": "string" + } + } + } + } + } + }, + "required": [ + "callbackUri" + ] +} + +} \ No newline at end of file -- GitLab From a8ea34444f70930a11ac50ad4e51b9068fd91fe2 Mon Sep 17 00:00:00 2001 From: hammad zafar Date: Thu, 4 Feb 2021 19:37:21 +0500 Subject: [PATCH 04/18] Individual Subscription resource added in SOL012 PM-API --- .../IndividualSubscription.robot | 79 +++++++++++++++++++ .../PolicyManagementKeywords.robot | 49 +++++++++++- .../PolicyManagement-API/Subscriptions.robot | 32 ++++---- .../InvalidPolicySubscriptionRequest.json | 7 ++ .../jsons/PolicySubscriptionRequest.json | 3 +- 5 files changed, 151 insertions(+), 19 deletions(-) create mode 100644 SOL012/PolicyManagement-API/IndividualSubscription.robot create mode 100644 SOL012/PolicyManagement-API/jsons/InvalidPolicySubscriptionRequest.json diff --git a/SOL012/PolicyManagement-API/IndividualSubscription.robot b/SOL012/PolicyManagement-API/IndividualSubscription.robot new file mode 100644 index 000000000..a21e06d6e --- /dev/null +++ b/SOL012/PolicyManagement-API/IndividualSubscription.robot @@ -0,0 +1,79 @@ +*** Settings *** +Resource environment/variables.txt +Resource PolicyManagementKeywords.robot + +*** Test Cases *** +POST Individual Subscription - Method not implemented + [Documentation] Test ID: 10.3.1.7.1 + ... Test title: POST Individual Subscription - Method not implemented + ... Test objective: The objective is to test that POST method is not implemented + ... Pre-conditions: none + ... Reference: Clause 5.5.8.3.1 - ETSI GS NFV-SOL 012 [7] v3.4.1 + ... Config ID: Config_prod_NFV-MANO + ... Applicability: none + ... Post-Conditions: none + POST Individual Subscription + Check HTTP Response Status Code Is 405 + +GET Information about an individual subscription - Successful + [Documentation] Test ID: 10.3.1.7.2 + ... Test title: GET Information about an individual subscription - Successful + ... Test objective: The objective is to test the retrieval of Policy Management subscription and perform a JSON schema validation of the returned subscription data structure + ... Pre-conditions: At least one policy management subscription is available in the NFV-MANO. + ... Reference: Clause 5.5.8.3.2 - ETSI GS NFV-SOL 012 [7] v3.4.1 + ... Config ID: Config_prod_NFV-MANO + ... Applicability: none + ... Post-Conditions: none + GET Individual subscription + Check HTTP Response Status Code Is 200 + Check HTTP Response Body Json Schema Is PolicySubscription + +PUT an individual subscription - Method not implemented + [Documentation] Test ID: 10.3.1.7.3 + ... Test title: PUT an individual subscription - Method not implemented + ... Test objective: The objective is to test that PUT method is not implemented + ... Pre-conditions: none + ... Reference: Clause 5.5.8.3.3 - ETSI GS NFV-SOL 012 [7] v3.4.1 + ... Config ID: Config_prod_NFV-MANO + ... Applicability: none + ... Post-Conditions: none + PUT Individual Subscription + Check HTTP Response Status Code Is 405 + +PATCH an individual subscription - Method not implemented + [Documentation] Test ID: 10.3.1.7.4 + ... Test title: PATCH an individual subscription - Method not implemented + ... Test objective: The objective is to test that PATCH method is not implemented + ... Pre-conditions: none + ... Reference: Clause 5.5.8.3.4 - ETSI GS NFV-SOL 012 [7] v3.4.1 + ... Config ID: Config_prod_NFV-MANO + ... Applicability: none + ... Post-Conditions: none + PATCH Individual Subscription + Check HTTP Response Status Code Is 405 + +DELETE an individual subscription + [Documentation] Test ID: 10.3.1.7.5 + ... Test title: DELETE an individual subscription + ... Test objective: The objective is to test that DELETE method deletes an individual subscription + ... Pre-conditions: At least one policy management subscription is available in the NFV-MANO. + ... Reference: Clause 5.5.8.3.5 - ETSI GS NFV-SOL 012 [7] v3.4.1 + ... Config ID: Config_prod_NFV-MANO + ... Applicability: none + ... Post-Conditions: The Policy Management subscription is not available anymore in the NFV-MANO. + DELETE Individual Subscription + Check HTTP Response Status Code Is 204 + Check Postcondition Individual Subscription is Deleted + +GET Information about an individual subscription - NOT FOUND + [Documentation] Test ID: 10.3.1.7.6 + ... Test title: GET Information about an individual subscription - NOT FOUND + ... Test objective: The objective is to test that the retrieval of individual Policy Management subscription fails when using an invalid resource identifier. + ... Pre-conditions: At least one Policy Management subscription is available in the NFV-MANO. + ... Reference: Clause 5.5.8.3.2 - ETSI GS NFV-SOL 012 [7] v3.4.1 + ... Config ID: Config_prod_NFV-MANO + ... Applicability: none + ... Post-Conditions: none + GET Individual subscription + Check HTTP Response Status Code Is 404 + Check HTTP Response Body Json Schema Is ProblemDetails \ No newline at end of file diff --git a/SOL012/PolicyManagement-API/PolicyManagementKeywords.robot b/SOL012/PolicyManagement-API/PolicyManagementKeywords.robot index 72afd150d..e62111a29 100644 --- a/SOL012/PolicyManagement-API/PolicyManagementKeywords.robot +++ b/SOL012/PolicyManagement-API/PolicyManagementKeywords.robot @@ -221,7 +221,6 @@ Get subscriptions with exclude_default and fields attribute selector GET ${apiRoot}/${apiName}/${apiVersion}/subscriptions?fields=${fields}&exclude_default ${output}= Output response Set Suite Variable ${response} ${output} - PUT subscriptions Log Trying to perform a PUT. This method should not be implemented @@ -250,3 +249,51 @@ DELETE subscriptions ${outputResponse}= Output response Set Global Variable ${response} ${outputResponse} +POST Individual Subscription + log Trying to perform a POST. This method should not be implemented + Set Headers {"Accept":"${ACCEPT}"} + Set Headers {"Content-Type": "${CONTENT_TYPE}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Post ${apiRoot}/${apiName}/${apiVersion}/subscriptions/${subscriptionId} + ${outputResponse}= Output response + Set Global Variable ${response} ${outputResponse} + +GET Individual subscription + log Trying to get information about an individual subscription + Set Headers {"Accept":"${ACCEPT}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Get ${apiRoot}/${apiName}/${apiVersion}/subscriptions/${subscriptionId} + ${outputResponse}= Output response + Set Global Variable ${response} ${outputResponse} + +PUT Individual Subscription + log Trying to perform a PUT. This method should not be implemented + Set Headers {"Accept":"${ACCEPT}"} + Set Headers {"Content-Type": "${CONTENT_TYPE}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Put ${apiRoot}/${apiName}/${apiVersion}/subscriptions/${subscriptionId} + ${outputResponse}= Output response + Set Global Variable ${response} ${outputResponse} + +PATCH Individual Subscription + log Trying to perform a PATCH. This method should not be implemented + Set Headers {"Accept":"${ACCEPT}"} + Set Headers {"Content-Type": "${CONTENT_TYPE}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Patch ${apiRoot}/${apiName}/${apiVersion}/subscriptions/${subscriptionId} + ${outputResponse}= Output response + Set Global Variable ${response} ${outputResponse} + +DELETE Individual subscription + log Trying to delete an individual subscription + Set Headers {"Accept":"${ACCEPT}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Delete ${apiRoot}/${apiName}/${apiVersion}/subscriptions/${subscriptionId} + ${outputResponse}= Output response + Set Global Variable ${response} ${outputResponse} + +Check Postcondition Individual Subscription is Deleted + Log Check Postcondition Subscription is deleted + GET individual Subscription + Check HTTP Response Status Code Is 404 + diff --git a/SOL012/PolicyManagement-API/Subscriptions.robot b/SOL012/PolicyManagement-API/Subscriptions.robot index b13fff0a6..ff7583b4c 100644 --- a/SOL012/PolicyManagement-API/Subscriptions.robot +++ b/SOL012/PolicyManagement-API/Subscriptions.robot @@ -4,7 +4,7 @@ Resource PolicyManagementKeywords.robot *** Test Cases *** POST Create a new subscription - [Documentation] Test ID: 10.3.1.2.1 + [Documentation] Test ID: 10.3.1.6.1 ... Test title: POST Create a new subscription ... Test objective: The objective is to test that POST method creates a subscription. ... Pre-conditions: none @@ -18,7 +18,7 @@ POST Create a new subscription Check HTTP Response Header Contains Location POST Create a new Subscription - DUPLICATION NOT ALLOWED - [Documentation] Test ID: 10.3.1.2.2 + [Documentation] Test ID: 10.3.1.6.2 ... Test title: POST Create a new subscription - DUPLICATION NOT ALLOWED ... Test objective: The objective is to test that POST method cannot create a duplicate subscription. ... Pre-conditions: A subscription shall already exist. @@ -34,7 +34,7 @@ POST Create a new Subscription - DUPLICATION NOT ALLOWED POST Create a new Subscription - UNPROCESSABLE ENTITY - [Documentation] Test ID: 10.3.1.2.3 + [Documentation] Test ID: 10.3.1.6.3 ... Test title: POST Create a new Subscription - UNPROCESSABLE ENTITY ... Test objective: The objective is to test that correct error code is generated when data in the request body cannot be processed. ... Pre-conditions: Request body contains invalid schema. @@ -47,7 +47,7 @@ POST Create a new Subscription - UNPROCESSABLE ENTITY Check HTTP Response Body Json Schema Is ProblemDetails GET Subscriptions - [Documentation] Test ID: 10.3.1.2.4 + [Documentation] Test ID: 10.3.1.6.4 ... Test title: GET Subscriptions ... Test objective: The objective is to test that GET method retrieves the list of existing subscriptions ... Pre-conditions: none @@ -60,7 +60,7 @@ GET Subscriptions Check HTTP Response Body Json Schema Is subscriptions GET Subscription - Filter - [Documentation] Test ID: 10.3.1.2.5 + [Documentation] Test ID: 10.3.1.6.5 ... Test title: GET Subscription - Filter ... Test objective: The objective is GET the list of active subscriptions using a filter ... Pre-conditions: none @@ -73,7 +73,7 @@ GET Subscription - Filter Check HTTP Response Body Json Schema Is subscriptions GET subscriptions - Bad Request Invalid attribute-based filtering parameters - [Documentation] Test ID: 10.3.1.2.6 + [Documentation] Test ID: 10.3.1.6.6 ... Test title: GET subscriptions - Bad Request Invalid attribute-based filtering parameters ... Test objective: The objective is GET the list of active subscriptions using an invalid filter ... Pre-conditions: none @@ -86,7 +86,7 @@ GET subscriptions - Bad Request Invalid attribute-based filtering parameters Check HTTP Response Body Json Schema Is ProblemDetails GET subscriptions - Bad Request Response too Big - [Documentation] Test ID: 10.3.1.2.7 + [Documentation] Test ID: 10.3.1.6.7 ... Test title: GET subscriptions - Bad Request Response too Big ... Test objective: The objective is test that the retrieval of active subscriptions list fails because response is too big, and perform the JSON schema validation of the failed operation HTTP response. ... Pre-conditions: none @@ -99,7 +99,7 @@ GET subscriptions - Bad Request Response too Big Check HTTP Response Body Json Schema Is ProblemDetails GET subscriptions with "all_fields" attribute selector - [Documentation] Test ID: 10.3.1.2.8 + [Documentation] Test ID: 10.3.1.6.8 ... Test title: GET subscriptions with "all_fields" attribute selector ... Test objective: The objective is to retrieve the list of active subscriptions with "all_fields" attribute selector ... Pre-conditions: none @@ -112,7 +112,7 @@ GET subscriptions with "all_fields" attribute selector Check HTTP Response Body Json Schema Is subscriptions GET subscriptions with "exclude_default" attribute selector - [Documentation] Test ID: 10.3.1.2.9 + [Documentation] Test ID: 10.3.1.6.9 ... Test title: GET subscriptions with "exclude_default" attribute selector ... Test objective: The objective is to retrieve the list of active subscriptions with "exclude_default"s attribute selector ... Pre-conditions: none @@ -125,7 +125,7 @@ GET subscriptions with "exclude_default" attribute selector Check HTTP Response Body Json Schema Is subscriptions GET subscriptions with "fields" attribute selector - [Documentation] Test ID: 10.3.1.2.10 + [Documentation] Test ID: 10.3.1.6.10 ... Test title: GET subscriptions with "fields" attribute selector ... Test objective: The objective is to retrieve the list of active subscriptions with "fields" attribute selector ... Pre-conditions: none @@ -138,7 +138,7 @@ GET subscriptions with "fields" attribute selector Check HTTP Response Body Json Schema Is subscriptions GET subscriptions with "exclude_fields" attribute selector - [Documentation] Test ID: 10.3.1.2.11 + [Documentation] Test ID: 10.3.1.6.11 ... Test title: GET subscriptions with "exclude_fields" attribute selector ... Test objective: The objective is to retrieve the list of active subscriptions with "exclude_fields" attribute selector ... Pre-conditions: none @@ -151,7 +151,7 @@ GET subscriptions with "exclude_fields" attribute selector Check HTTP Response Body Json Schema Is subscriptions GET Subscriptions as Paged Response - [Documentation] Test ID: 10.3.1.2.12 + [Documentation] Test ID: 10.3.1.6.12 ... Test title: GET Subscriptions as Paged Response ... Test objective: The objective is to test that GET method retrieve the list of existing subscriptions as paged response. ... Pre-conditions: none @@ -164,7 +164,7 @@ GET Subscriptions as Paged Response Check HTTP Response Header Contains Link PUT subscriptions - Method not implemented - [Documentation] Test ID: 10.3.1.2.13 + [Documentation] Test ID: 10.3.1.6.13 ... Test title: PUT subscriptions - Method not implemented ... Test objective: The objective is to test that PUT method cannot modify a NS instance usage subscription ... Pre-conditions: none @@ -176,7 +176,7 @@ PUT subscriptions - Method not implemented Check HTTP Response Status Code Is 405 PATCH subscriptions - Method not implemented - [Documentation] Test ID: 10.3.1.2.14 + [Documentation] Test ID: 10.3.1.6.14 ... Test title: PATCH subscriptions - Method not implemented ... Test objective: The objective is to test that PUT method cannot modify a NS instance usage subscription ... Pre-conditions: none @@ -188,7 +188,7 @@ PATCH subscriptions - Method not implemented Check HTTP Response Status Code Is 405 DELETE subscriptions - Method not implemented - [Documentation] Test ID: 10.3.1.2.15 + [Documentation] Test ID: 10.3.1.6.15 ... Test title: DELETE subscriptions - Method not implemented ... Test objective: The objective is to test that DELETE method cannot delete a NS instance usage subscription ... Pre-conditions: none @@ -201,7 +201,7 @@ DELETE subscriptions - Method not implemented Check Postcondition Subscriptions Exist GET subscriptions with "exclude_default" and "fields" attribute selector - [Documentation] Test ID: 10.3.1.2.16 + [Documentation] Test ID: 10.3.1.6.16 ... Test title: GET subscriptions with "exclude_default" and "fields" attribute selector ... Test objective: The objective is to retrieve the list of active subscriptions with "exclude_default" and "fields" attribute selector ... Pre-conditions: diff --git a/SOL012/PolicyManagement-API/jsons/InvalidPolicySubscriptionRequest.json b/SOL012/PolicyManagement-API/jsons/InvalidPolicySubscriptionRequest.json new file mode 100644 index 000000000..c4f1a5b73 --- /dev/null +++ b/SOL012/PolicyManagement-API/jsons/InvalidPolicySubscriptionRequest.json @@ -0,0 +1,7 @@ +{ + "id": "", + "timeStamp": "", + "status": "START", + "callbackUri": "http://127.0.0.1/subscribe", + "_links": "" +} \ No newline at end of file diff --git a/SOL012/PolicyManagement-API/jsons/PolicySubscriptionRequest.json b/SOL012/PolicyManagement-API/jsons/PolicySubscriptionRequest.json index 77348deb0..c6e6b6967 100644 --- a/SOL012/PolicyManagement-API/jsons/PolicySubscriptionRequest.json +++ b/SOL012/PolicyManagement-API/jsons/PolicySubscriptionRequest.json @@ -4,6 +4,5 @@ "policyIds": "", "changeTypes": "CREATE_POLICY" }, - "callbackUri": "http://127.0.0.1/subscribe", - "authentication": "" + "callbackUri": "http://127.0.0.1/subscribe" } \ No newline at end of file -- GitLab From f87f3c3c107e36af85a631528901248000482f96 Mon Sep 17 00:00:00 2001 From: hammad zafar Date: Thu, 4 Feb 2021 23:37:02 +0500 Subject: [PATCH 05/18] Notification Endpoint resource added in SOL012 PM-API --- .../NotificationEndpoint.robot | 79 +++++++++++ .../PolicyChangeNotification.schema.json | 127 ++++++++++++++++++ .../PolicyConflictNotification.schema.json | 96 +++++++++++++ 3 files changed, 302 insertions(+) create mode 100644 SOL012/PolicyManagement-API/NotificationEndpoint.robot create mode 100644 SOL012/PolicyManagement-API/schemas/PolicyChangeNotification.schema.json create mode 100644 SOL012/PolicyManagement-API/schemas/PolicyConflictNotification.schema.json diff --git a/SOL012/PolicyManagement-API/NotificationEndpoint.robot b/SOL012/PolicyManagement-API/NotificationEndpoint.robot new file mode 100644 index 000000000..faa5def16 --- /dev/null +++ b/SOL012/PolicyManagement-API/NotificationEndpoint.robot @@ -0,0 +1,79 @@ +*** Settings *** +Suite Setup Create Sessions +Suite Teardown Terminate All Processes kill=true +Resource environment/variables.txt +Library MockServerLibrary +Library Process +Library OperatingSystem +Library Collections + +*** Test Cases *** +Policy Change Notification + [Documentation] Test ID: 10.3.1.8.1 + ... Test title: Policy Change Notification + ... Test objective: The objective is to test the dispatch of Policy Change Notification when the policy is changed, and perform a JSON schema and content validation of the delivered notification. The action that triggers the notification under test is an explicit test step, but it is not performed by the test system. + ... Pre-conditions: A subscription for policy change notification is available in the NFV-MANO. + ... Reference: Clause 5.5.9.3.1 - ETSI GS NFV-SOL 012 [7] v3.4.1 + ... Config ID: Config_prod_NFV-MANO + ... Applicability: none + ... Post-Conditions: none + Trigger a change in Policy (external action) + Check Policy Management Notification Http POST Request Body Json Schema Is PolicyChangeNotification + Check Policy Management Notification Http POST Request Body notificationType attribute Is PolicyChangeNotification + +Policy Conflict Notification + [Documentation] Test ID: 10.3.1.8.2 + ... Test title: Policy Conflict Notification + ... Test objective: The objective is to test the dispatch of Policy Conflict Notification when a conflict in policy is detected, and perform a JSON schema and content validation of the delivered notification. The action that triggers the notification under test is an explicit test step, but it is not performed by the test system. + ... Pre-conditions: A subscription for policy conflict notification is available in the NFV-MANO. + ... Reference: Clause 5.5.9.3.1 - ETSI GS NFV-SOL 012 [7] v3.4.1 + ... Config ID: Config_prod_NFV-MANO + ... Applicability: none + ... Post-Conditions: none + Trigger a conflict in Policy (external action) + Check Policy Management Notification Http POST Request Body Json Schema Is PolicyConflictNotification + Check Policy Management Notification Http POST Request Body notificationType attribute Is PolicyConflictNotification + +*** Keywords *** +Create Sessions + Start Process java -jar ${MOCK_SERVER_JAR} -serverPort ${callback_port} alias=mockInstance + Wait For Process handle=mockInstance timeout=5s on_timeout=continue + Create Mock Session ${callback_uri}:${callback_port} + +Trigger a change in Policy (external action) + #do nothing + Log do nothing + +Trigger a conflict in Policy (external action) + #do nothing + Log do nothing + +Configure Notification Forward + [Arguments] ${schema} ${endpoint} ${endpoint_fwd} + Log Creating mock Http POST forward to handle ${schema} + &{notification_tmp}= Create Mock Request Matcher POST ${endpoint} body_type="JSON_SCHEMA" body=${schema} + &{notification_fwd}= Create Mock Http Forward ${endpoint_fwd} + Create Mock Expectation With Http Forward ${notification_tmp} ${notification_fwd} + +Configure Policy Management Notification Handler + [Arguments] ${endpoint} ${type} + ${json}= evaluate {} + set to dictionary ${json} notificationType ${type} + ${BODY}= evaluate json.dumps(${json}) json + Log Creating mock request and response to handle status notification + &{notification_request}= Create Mock Request Matcher POST ${endpoint} body_type="JSON" body=${BODY} + &{notification_response}= Create Mock Response headers="Content-Type: application/json" status_code=204 + Create Mock Expectation ${notification_request} ${notification_response} + +Check Policy Management Notification Http POST Request Body Json Schema Is + [Arguments] ${element} + ${schema}= Get File schemas/${element}.schema.json + Configure Notification Forward ${schema} ${callback_endpoint} ${callback_endpoint_fwd} + +Check Policy Management Notification Http POST Request Body notificationType attribute Is + [Arguments] ${type} + Configure Policy Management Notification Handler ${callback_endpoint_fwd} ${type} + Wait Until Keyword Succeeds 2 min 10 sec Verify Mock Expectation ${notification_request} + Clear Requests ${callback_endpoint} + Clear Requests ${callback_endpoint_fwd} + \ No newline at end of file diff --git a/SOL012/PolicyManagement-API/schemas/PolicyChangeNotification.schema.json b/SOL012/PolicyManagement-API/schemas/PolicyChangeNotification.schema.json new file mode 100644 index 000000000..83c997950 --- /dev/null +++ b/SOL012/PolicyManagement-API/schemas/PolicyChangeNotification.schema.json @@ -0,0 +1,127 @@ +{ + "description": "This type represents a notification about policy change. It shall comply with the provisions defined in table 5.6.2.7-1. This notification shall be triggered by the API producer when a policy has been changed as the result of an operation of creating, transferring, deleting or modifying a policy.\n", + "type": "object", + "properties": { + "id": { + "description": "An identifier with the intention of being globally unique.\n", + "type": "string" + }, + "notificationType": { + "description": "A string defined in IETF RFC 8259.\n", + "type": "string" + }, + "subscriptionId": { + "description": "An identifier with the intention of being globally unique.\n", + "type": "string" + }, + "timeStamp": { + "description": "Date-time stamp. Representation: String formatted according to IETF RFC 3339.\n", + "type": "string", + "format": "date-time" + }, + "policyId": { + "description": "An identifier with the intention of being globally unique.\n", + "type": "string" + }, + "affectedVersion": { + "description": "A version.\n", + "type": "string" + }, + "previousSelectedVersion": { + "description": "A version.\n", + "type": "string" + }, + "policyModifications": { + "description": "This type represents the parameters for modifying a policy. It shall comply with the provisions defined in table 5.6.2.4-1\n", + "type": "object", + "properties": { + "activationStatus": { + "description": "The enumeration ActivationStatus shall comply with the provisions defined in table 5.6.4.3-1. It indicates the activation status of a policy.\n", + "type": "string", + "enum": [ + "ACTIVATED", + "DEACTIVATED" + ] + }, + "selectedVersion": { + "description": "A version.\n", + "type": "string" + }, + "addAssociations": { + "description": "Identifiers of entities to be added to the “associations” attribute in the “Policy” data structure which represents the policy. The API producer shall ignore the identifiers that already exist in the \"associations\" attribute in the “Policy” data structure. Shall be absent when the association feature is not applicable for the PF.\n", + "type": "array", + "items": { + "description": "An identifier with the intention of being globally unique.\n", + "type": "string" + } + }, + "removeAssociations": { + "description": "Identifiers of entities to be removed from the “associations” attribute in the “Policy” data structure which represents the policy. The API producer shall ignore the identifiers that do not exist in the \"associations\" attribute in the “Policy” data structure. Shall be absent when the association feature is not applicable for the PF.\n", + "type": "array", + "items": { + "description": "An identifier with the intention of being globally unique.\n", + "type": "string" + } + }, + "removeAllAssociations": { + "description": "Shall be set to TRUE if the policy is no longer associated to any specific entities managed by the PF. Shall be absent when the association feature is not applicable for the PF. If \"removeAllAssociations\" is set to TRUE, neither \"addAssociations\" nor “removeAssociations” attributes shall be present. Once all associations have been removed, how the PF determines the scope of applicability of the policy is outside the scope of the present document.\n", + "type": "boolean" + } + } + }, + "changeType": { + "description": "The enumeration PolicyOperationType shall comply with the provisions defined in table 5.6.4.4-1. It indicates the type of the policy change. Permitted values: * CREATE_POLICY:\tThe policy is created. * TRANSFER_POLICY:\tThe policy is transferred. * DELETE_POLICY:\tThe policy is deleted. * MODIFY_POLICY:\tThe policy is modified.\n", + "type": "string", + "enum": [ + "CREATE_POLICY", + "TRANSFER_POLICY", + "DELETE_POLICY", + "MODIFY_POLICY" + ] + }, + "_links": { + "description": "Links to resources related to this notification.\n", + "type": "object", + "properties": { + "subscription": { + "description": "This type represents a link to a resource in a notification, using an absolute or relative URI.\n", + "type": "object", + "required": [ + "href" + ], + "properties": { + "href": { + "description": "String formatted according to IETF RFC 3986.\n", + "type": "string" + } + } + }, + "objectInstance": { + "description": "This type represents a link to a resource in a notification, using an absolute or relative URI.\n", + "type": "object", + "required": [ + "href" + ], + "properties": { + "href": { + "description": "String formatted according to IETF RFC 3986.\n", + "type": "string" + } + } + } + }, + "required": [ + "subscription" + ] + } + }, + "required": [ + "id", + "notificationType", + "subscriptionId", + "timeStamp", + "policyId", + "changeType", + "_links" + ] +} \ No newline at end of file diff --git a/SOL012/PolicyManagement-API/schemas/PolicyConflictNotification.schema.json b/SOL012/PolicyManagement-API/schemas/PolicyConflictNotification.schema.json new file mode 100644 index 000000000..38809bf97 --- /dev/null +++ b/SOL012/PolicyManagement-API/schemas/PolicyConflictNotification.schema.json @@ -0,0 +1,96 @@ +{ + "description": "This type represents a notification about policy conflict. It shall comply with the provisions defined in table 5.6.2.8-1. This notification shall be triggered by the API producer when a policy conflict is detected, and any of the policies specified in an associated notification subscription is impacted by the conflict.\n", + "type": "object", + "properties": { + "id": { + "description": "An identifier with the intention of being globally unique.\n", + "type": "string" + }, + "notificationType": { + "description": "A string defined in IETF RFC 8259.\n", + "type": "string" + }, + "subscriptionId": { + "description": "An identifier with the intention of being globally unique.\n", + "type": "string" + }, + "timeStamp": { + "description": "Date-time stamp. Representation: String formatted according to IETF RFC 3339.\n", + "type": "string", + "format": "date-time" + }, + "policyIds": { + "description": "Identifiers of the conflicting policies. The policy identifier and the corresponding selected version are mapped by the order in the array.\n", + "type": "array", + "items": { + "description": "An identifier with the intention of being globally unique.\n", + "type": "string" + }, + "minItems": 2 + }, + "selectedVersions": { + "description": "Selected versions of the conflicting policies. The policy identifier and the corresponding selected version are mapped by the order in the array.\n", + "type": "array", + "items": { + "description": "A version.\n", + "type": "string" + }, + "minItems": 2 + }, + "conflictDescription": { + "description": "A string defined in IETF RFC 8259.\n", + "type": "string" + }, + "_links": { + "description": "Links to resources related to this notification.\n", + "type": "object", + "properties": { + "subscription": { + "description": "This type represents a link to a resource in a notification, using an absolute or relative URI.\n", + "type": "object", + "required": [ + "href" + ], + "properties": { + "href": { + "description": "String formatted according to IETF RFC 3986.\n", + "type": "string" + } + } + }, + "objectInstances": { + "description": "Link to the resources representing the policies to which the notified conflict applies.\n", + "type": "array", + "items": { + "description": "This type represents a link to a resource in a notification, using an absolute or relative URI.\n", + "type": "object", + "required": [ + "href" + ], + "properties": { + "href": { + "description": "String formatted according to IETF RFC 3986.\n", + "type": "string" + } + } + }, + "minItems": 2 + } + }, + "required": [ + "subscription", + "objectInstances" + ] + } + }, + "required": [ + "id", + "notificationType", + "subscriptionId", + "timeStamp", + "policyIds", + "selectedVersions", + "conflictDescription", + "_links" + ] +} \ No newline at end of file -- GitLab From af6df61455876deada624edf1f609044102da804 Mon Sep 17 00:00:00 2001 From: hammad zafar Date: Fri, 5 Feb 2021 01:16:30 +0500 Subject: [PATCH 06/18] Notification Consumer resource added in PolicyManagement-API --- .../NotificationConsumer.robot | 29 ++++++++++++++++++ .../PolicyManagementKeywords.robot | 30 +++++++++++++++++++ .../environment/variables.txt | 5 ++-- .../jsons/PolicyChangeNotification.json | 10 +++++++ .../jsons/PolicyConflictNotification.json | 13 ++++++++ 5 files changed, 85 insertions(+), 2 deletions(-) create mode 100644 SOL012/PolicyManagement-API/NotificationConsumer.robot create mode 100644 SOL012/PolicyManagement-API/jsons/PolicyChangeNotification.json create mode 100644 SOL012/PolicyManagement-API/jsons/PolicyConflictNotification.json diff --git a/SOL012/PolicyManagement-API/NotificationConsumer.robot b/SOL012/PolicyManagement-API/NotificationConsumer.robot new file mode 100644 index 000000000..77a0136ee --- /dev/null +++ b/SOL012/PolicyManagement-API/NotificationConsumer.robot @@ -0,0 +1,29 @@ +*** Settings *** +Resource environment/variables.txt +Resource PolicyManagementKeywords.robot +Suite Setup Check resource existence and get CallbackUri + +*** Test Cases *** +Policy Change Notification + [Documentation] Test ID: 10.3.1.9.1 + ... Test title: Policy Change Notification + ... Test objective: The objective is to test that Policy Change Notification is delivered with success to the notification consumer. + ... Pre-conditions: A subscription for policy change notification is available in the NFV-MANO. + ... Reference: Clause 5.5.9.3.1 - ETSI GS NFV-SOL 012 [7] v3.4.1 + ... Config ID: Config_prod_Notif_Endpoint + ... Applicability: none + ... Post-Conditions: none + POST Policy Change Notification + Check HTTP Response Status Code Is 204 + +Policy Conflict Notification + [Documentation] Test ID: 10.3.1.9.2 + ... Test title: Policy Conflict Notification + ... Test objective: The objective is to test that Policy Conflict Notification is delivered with success to the notification consumer. + ... Pre-conditions: A subscription for policy conflict notification is available in the NFV-MANO. + ... Reference: Clause 5.5.9.3.1 - ETSI GS NFV-SOL 012 [7] v3.4.1 + ... Config ID: Config_prod_Notif_Endpoint + ... Applicability: none + ... Post-Conditions: none + POST Policy Conflict Notification + Check HTTP Response Status Code Is 204 \ No newline at end of file diff --git a/SOL012/PolicyManagement-API/PolicyManagementKeywords.robot b/SOL012/PolicyManagement-API/PolicyManagementKeywords.robot index e62111a29..7207987d6 100644 --- a/SOL012/PolicyManagement-API/PolicyManagementKeywords.robot +++ b/SOL012/PolicyManagement-API/PolicyManagementKeywords.robot @@ -297,3 +297,33 @@ Check Postcondition Individual Subscription is Deleted GET individual Subscription Check HTTP Response Status Code Is 404 +Check resource existence and get CallbackUri + Set Headers {"Accept":"${ACCEPT_JSON}"} + Set Headers {"Content-Type": "${CONTENT_TYPE_JSON}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Get ${apiRoot}/${apiName}/${apiVersion}/subscriptions/${subscriptionId} + Integer response status 200 + Validate Json response body PolicySubscription.schema.json + Set Global Variable ${callbackResp} response body callbackUri + +POST Policy Change Notification + log Trying to perform a POST to deliver notification + Set Headers {"Accept":"${ACCEPT_JSON}"} + Set Headers {"Content-Type": "${CONTENT_TYPE_JSON}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + ${template} = Get File jsons/PolicyChangeNotification.json + ${body}= Format String ${template} subscriptionId=${subscriptionId} + Post ${callbackResp} ${body} + ${outputResponse}= Output response + Set Global Variable ${response} ${outputResponse} + +POST Policy Conflict Notification + log Trying to perform a POST to deliver notification + Set Headers {"Accept":"${ACCEPT_JSON}"} + Set Headers {"Content-Type": "${CONTENT_TYPE_JSON}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + ${template} = Get File jsons/PolicyConflictNotification.json + ${body}= Format String ${template} subscriptionId=${subscriptionId} policyId1=${policyId1} policyId2=${policyId2} + Post ${callbackResp} ${body} + ${outputResponse}= Output response + Set Global Variable ${response} ${outputResponse} diff --git a/SOL012/PolicyManagement-API/environment/variables.txt b/SOL012/PolicyManagement-API/environment/variables.txt index bb751852f..04326e924 100644 --- a/SOL012/PolicyManagement-API/environment/variables.txt +++ b/SOL012/PolicyManagement-API/environment/variables.txt @@ -21,8 +21,6 @@ ${response} {} ${NFVMANO_DUPLICATION} 1 -${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 @@ -50,6 +48,9 @@ ${polling_interval} 10 sec ${notification_request} [] ${notification_response} [] +${policyId1} +${policyId2} + ${callbackResp} 127.0.0.1 ${MOCK_SERVER_JAR} ../../../bin/mockserver-netty-5.5.0-jar-with-dependencies.jar diff --git a/SOL012/PolicyManagement-API/jsons/PolicyChangeNotification.json b/SOL012/PolicyManagement-API/jsons/PolicyChangeNotification.json new file mode 100644 index 000000000..8c1d6417e --- /dev/null +++ b/SOL012/PolicyManagement-API/jsons/PolicyChangeNotification.json @@ -0,0 +1,10 @@ +{{ + "id": "", + "notificationType": "PolicyChangeNotification", + "subscriptionId": "{subscriptionId}", + "timeStamp": "", + "changeType": "", + "_links": {{ + "subscription": "" + }} +}} \ No newline at end of file diff --git a/SOL012/PolicyManagement-API/jsons/PolicyConflictNotification.json b/SOL012/PolicyManagement-API/jsons/PolicyConflictNotification.json new file mode 100644 index 000000000..f9ae3c61d --- /dev/null +++ b/SOL012/PolicyManagement-API/jsons/PolicyConflictNotification.json @@ -0,0 +1,13 @@ +{{ + "id": "", + "notificationType": "PolicyConflictNotification", + "subscriptionId": "{subscriptionId}", + "timeStamp": "", + "policyIds": ["{policyId1}","{policyId2}"], + "selectedVersions": ["v1","v1"], + "conflictDescription": "", + "_links": {{ + "subscription": "", + "objectInstances": [] + }} +}} \ No newline at end of file -- GitLab From 378baa79a87248fb29bec5d36b9160df81d8bf57 Mon Sep 17 00:00:00 2001 From: hammad zafar Date: Sat, 6 Feb 2021 02:59:54 +0500 Subject: [PATCH 07/18] Policies resource added in PolicyManagement-API --- SOL012/PolicyManagement-API/Policies.robot | 185 ++++++++++++++++++ .../PolicyManagementKeywords.robot | 107 ++++++++++ .../PolicyManagement-API/Subscriptions.robot | 6 +- .../jsons/CreatePolicyRequest.json | 6 + .../schemas/Policies.schema.json | 121 ++++++++++++ .../schemas/Policy.schema.json | 118 +++++++++++ 6 files changed, 540 insertions(+), 3 deletions(-) create mode 100644 SOL012/PolicyManagement-API/Policies.robot create mode 100644 SOL012/PolicyManagement-API/jsons/CreatePolicyRequest.json create mode 100644 SOL012/PolicyManagement-API/schemas/Policies.schema.json create mode 100644 SOL012/PolicyManagement-API/schemas/Policy.schema.json diff --git a/SOL012/PolicyManagement-API/Policies.robot b/SOL012/PolicyManagement-API/Policies.robot new file mode 100644 index 000000000..525036721 --- /dev/null +++ b/SOL012/PolicyManagement-API/Policies.robot @@ -0,0 +1,185 @@ +*** Settings *** +Resource environment/variables.txt +Resource PolicyManagementKeywords.robot + +*** Test Cases *** +POST Create a new Policy + [Documentation] Test ID: 10.3.1.2.1 + ... Test title: POST Create a new Policy + ... Test objective: The objective is to test that POST method creates a policy. + ... Pre-conditions: none + ... Reference: Clause 5.5.3.3.1 - ETSI GS NFV-SOL 012 [7] v3.4.1 + ... Config ID: Config_prod_NFV-MANO + ... Applicability: none + ... Post-Conditions: Policy is created. + POST Policies + Check HTTP Response Status Code Is 201 + Check HTTP Response Body Json Schema Is Policy + Check HTTP Response Header Contains Location + +GET Policies + [Documentation] Test ID: 10.3.1.2.2 + ... Test title: GET Policies + ... Test objective: The objective is to test that GET method retrieves the list of existing policies. + ... Pre-conditions: none + ... Reference: Clause 5.5.3.3.2 - ETSI GS NFV-SOL 012 [7] v3.4.1 + ... Config ID: Config_prod_NFV-MANO + ... Applicability: none + ... Post-Conditions: none + GET Policies + Check HTTP Response Status Code Is 200 + Check HTTP Response Body Json Schema Is Policies + +GET Policies - Filter + [Documentation] Test ID: 10.3.1.2.3 + ... Test title: GET Policies - Filter + ... Test objective: The objective is GET the list of existing policies using a filter. + ... Pre-conditions: none + ... Reference: Clause 5.5.3.3.2 - ETSI GS NFV-SOL 012 [7] v3.4.1 + ... Config ID: Config_prod_NFV-MANO + ... Applicability: none + ... Post-Conditions: none + GET Policies with filter + Check HTTP Response Status Code Is 200 + Check HTTP Response Body Json Schema Is Policies + +GET Policies - Bad Request Invalid attribute-based filtering parameters + [Documentation] Test ID: 10.3.1.2.4 + ... Test title: GET Policies - Bad Request Invalid attribute-based filtering parameters + ... Test objective: The objective is GET the list of existing policies using an invalid filter. + ... Pre-conditions: none + ... Reference: Clause 5.5.3.3.2 - ETSI GS NFV-SOL 012 [7] v3.4.1 + ... Config ID: Config_prod_NFV-MANO + ... Applicability: none + ... Post-Conditions: none + Get Policies - invalid filter + Check HTTP Response Status Code Is 400 + Check HTTP Response Body Json Schema Is ProblemDetails + +GET Policies - Bad Request Response too Big + [Documentation] Test ID: 10.3.1.2.5 + ... Test title: GET Policies - Bad Request Response too Big + ... Test objective: The objective is test that the retrieval of existing policies list fails because response is too big, and perform the JSON schema validation of the failed operation HTTP response. + ... Pre-conditions: none + ... Reference: Clause 5.5.3.3.2 - ETSI GS NFV-SOL 012 [7] v3.4.1 + ... Config ID: Config_prod_NFV-MANO + ... Applicability: none + ... Post-Conditions: none + GET Policies + Check HTTP Response Status Code Is 400 + Check HTTP Response Body Json Schema Is ProblemDetails + +GET Policies with "all_fields" attribute selector + [Documentation] Test ID: 10.3.1.2.6 + ... Test title: GET Policies with "all_fields" attribute selector + ... Test objective: The objective is to retrieve the list of existing policies with "all_fields" attribute selector. + ... Pre-conditions: none + ... Reference: Clause 5.5.3.3.2 - ETSI GS NFV-SOL 012 [7] v3.4.1 + ... Config ID: Config_prod_NFV-MANO + ... Applicability: none + ... Post-Conditions: none + Get Policies with all_fields attribute selector + Check HTTP Response Status Code Is 200 + Check HTTP Response Body Json Schema Is Policies + +GET Policies with "exclude_default" attribute selector + [Documentation] Test ID: 10.3.1.2.7 + ... Test title: GET policies with "exclude_default" attribute selector + ... Test objective: The objective is to retrieve the list of existing policies with "exclude_default"s attribute selector. + ... Pre-conditions: none + ... Reference: Clause 5.5.3.3.2 - ETSI GS NFV-SOL 012 [7] v3.4.1 + ... Config ID: Config_prod_NFV-MANO + ... Applicability: none + ... Post-Conditions: none + Get Policies with exclude_default attribute selector + Check HTTP Response Status Code Is 200 + Check HTTP Response Body Json Schema Is Policies + +GET Policies with "fields" attribute selector + [Documentation] Test ID: 10.3.1.2.8 + ... Test title: GET Policies with "fields" attribute selector + ... Test objective: The objective is to retrieve the list of existing policies with "fields" attribute selector. + ... Pre-conditions: none + ... Reference: Clause 5.5.3.3.2 - ETSI GS NFV-SOL 012 [7] v3.4.1 + ... Config ID: Config_prod_NFV-MANO + ... Applicability: none + ... Post-Conditions: none + Get Policies with fields attribute selector + Check HTTP Response Status Code Is 200 + Check HTTP Response Body Json Schema Is Policies + +GET Policies with "exclude_fields" attribute selector + [Documentation] Test ID: 10.3.1.2.9 + ... Test title: GET Policies with "exclude_fields" attribute selector + ... Test objective: The objective is to retrieve the list of existing policies with "exclude_fields" attribute selector. + ... Pre-conditions: none + ... Reference: Clause 5.5.3.3.2 - ETSI GS NFV-SOL 012 [7] v3.4.1 + ... Config ID: Config_prod_NFV-MANO + ... Applicability: none + ... Post-Conditions: none + Get Policies with exclude_fields attribute selector + Check HTTP Response Status Code Is 200 + Check HTTP Response Body Json Schema Is Policies + +GET Policies with "exclude_default" and "fields" attribute selector + [Documentation] Test ID: 10.3.1.2.10 + ... Test title: GET Policies with "exclude_default" and "fields" attribute selector + ... Test objective: The objective is to retrieve the list of existing policies with "exclude_default" and "fields" attribute selector + ... Pre-conditions: + ... Reference: Clause 5.5.3.3.2 - ETSI GS NFV-SOL 012 [7] v3.4.1 + ... Config ID: Config_prod_NFV-MANO + ... Applicability: none + ... Post-Conditions: none + Get Policies with exclude_default and fields attribute selector + Check HTTP Response Status Code Is 200 + Check HTTP Response Body Json Schema Is Policies + +GET Policies as Paged Response + [Documentation] Test ID: 10.3.1.2.11 + ... Test title: GET Policies as Paged Response + ... Test objective: The objective is to test that GET method retrieve the list of existing policies as paged response. + ... Pre-conditions: none + ... Reference: Clause 5.5.3.3.2 - ETSI GS NFV-SOL 012 [7] v3.4.1 + ... Config ID: Config_prod_NFV-MANO + ... Applicability: NFV-MANO supports paged response + ... Post-Conditions: none + GET Policies + Check HTTP Response Status Code Is 200 + Check HTTP Response Header Contains Link + +PUT Policies - Method not implemented + [Documentation] Test ID: 10.3.1.2.12 + ... Test title: PUT Policies - Method not implemented + ... Test objective: The objective is to test that PUT method cannot modify policies. + ... Pre-conditions: none + ... Reference: Clause 5.5.3.3.3 - ETSI GS NFV-SOL 012 [7] v3.4.1 + ... Config ID: Config_prod_NFV-MANO + ... Applicability: none + ... Post-Conditions: none + PUT Policies + Check HTTP Response Status Code Is 405 + +PATCH Policies - Method not implemented + [Documentation] Test ID: 10.3.1.2.13 + ... Test title: PATCH Policies - Method not implemented + ... Test objective: The objective is to test that PATCH method cannot modify policies. + ... Pre-conditions: none + ... Reference: Clause 5.5.3.3.4 - ETSI GS NFV-SOL 012 [7] v3.4.1 + ... Config ID: Config_prod_NFV-MANO + ... Applicability: none + ... Post-Conditions: none + PATCH Policies + Check HTTP Response Status Code Is 405 + +DELETE Policies - Method not implemented + [Documentation] Test ID: 10.3.1.2.14 + ... Test title: DELETE Policies - Method not implemented + ... Test objective: The objective is to test that DELETE method cannot delete policies. + ... Pre-conditions: none + ... Reference: Clause 5.5.3.3.5 - ETSI GS NFV-SOL 012 [7] v3.4.1 + ... Config ID: Config_prod_NFV-MANO + ... Applicability: none + ... Post-Conditions: Policies are not deleted + DELETE Policies + Check HTTP Response Status Code Is 405 + Check Postcondition Policies Exist diff --git a/SOL012/PolicyManagement-API/PolicyManagementKeywords.robot b/SOL012/PolicyManagement-API/PolicyManagementKeywords.robot index 7207987d6..235d5f124 100644 --- a/SOL012/PolicyManagement-API/PolicyManagementKeywords.robot +++ b/SOL012/PolicyManagement-API/PolicyManagementKeywords.robot @@ -327,3 +327,110 @@ POST Policy Conflict Notification Post ${callbackResp} ${body} ${outputResponse}= Output response Set Global Variable ${response} ${outputResponse} + +POST Policies + Log Create policy instance by POST to ${apiRoot}/${apiName}/${apiVersion}/policies + Set Headers {"Accept":"${ACCEPT}"} + Set Headers {"Content-Type": "${CONTENT_TYPE}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + ${body}= Get File jsons/CreatePolicyRequest.json + Post ${apiRoot}/${apiName}/${apiVersion}/policies ${body} + ${outputResponse}= Output response + Set Global Variable ${response} ${outputResponse} + +GET Policies + Log Get the list of existing policies + Set Headers {"Accept":"${ACCEPT}"} + Set Headers {"Content-Type": "${CONTENT_TYPE}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Log Execute Query and validate response + Get ${apiRoot}/${apiName}/${apiVersion}/policies + ${outputResponse}= Output response + Set Global Variable ${response} ${outputResponse} + +GET Policies with filter + Log Get the list of existing policies using a filter + Set Headers {"Accept": "${ACCEPT}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"} + GET ${apiRoot}/${apiName}/${apiVersion}/policies?${sub_filter} + ${outputResponse}= Output response + Set Global Variable ${response} ${outputResponse} + +Get Policies - invalid filter + Log Get the list of existing policies using an invalid filter + Set Headers {"Accept": "${ACCEPT}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"} + GET ${apiRoot}/${apiName}/${apiVersion}/policies?${sub_filter_invalid} + ${outputResponse}= Output response + Set Global Variable ${response} ${outputResponse} + +Get Policies with all_fields attribute selector + Log Get the list of existing policies, using fields + Set Headers {"Accept": "${ACCEPT_JSON}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"} + GET ${apiRoot}/${apiName}/${apiVersion}/policies?all_fields + ${output}= Output response + Set Suite Variable ${response} ${output} + +Get Policies with exclude_default attribute selector + Log Get the list of existing policies, using fields + Set Headers {"Accept": "${ACCEPT_JSON}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"} + GET ${apiRoot}/${apiName}/${apiVersion}/policies?exclude_default + ${output}= Output response + Set Suite Variable ${response} ${output} + +Get Policies with fields attribute selector + Log Get the list of existing policies, using fields + Set Headers {"Accept": "${ACCEPT_JSON}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"} + GET ${apiRoot}/${apiName}/${apiVersion}/policies?fields=${fields} + ${output}= Output response + Set Suite Variable ${response} ${output} + +Get Policies with exclude_fields attribute selector + Log Get the list of existing policies, using fields + Set Headers {"Accept": "${ACCEPT_JSON}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"} + GET ${apiRoot}/${apiName}/${apiVersion}/policies?exclude_fields=${fields} + ${output}= Output response + Set Suite Variable ${response} ${output} + +Get Policies with exclude_default and fields attribute selector + Log Get the list of existing policies, using fields + Set Headers {"Accept": "${ACCEPT_JSON}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"} + GET ${apiRoot}/${apiName}/${apiVersion}/policies?fields=${fields}&exclude_default + ${output}= Output response + Set Suite Variable ${response} ${output} + +PUT Policies + Log Trying to perform a PUT. This method should not be implemented + Set Headers {"Accept":"${ACCEPT}"} + Set Headers {"Content-Type": "${CONTENT_TYPE}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Put ${apiRoot}/${apiName}/${apiVersion}/policies + ${outputResponse}= Output response + Set Global Variable ${response} ${outputResponse} + +PATCH Policies + Log Trying to perform a PATCH. This method should not be implemented + Set Headers {"Accept":"${ACCEPT}"} + Set Headers {"Content-Type": "${CONTENT_TYPE}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Patch ${apiRoot}/${apiName}/${apiVersion}/policies + ${outputResponse}= Output response + Set Global Variable ${response} ${outputResponse} + +DELETE Policies + Log Trying to perform a DELETE. This method should not be implemented + Set Headers {"Accept":"${ACCEPT}"} + Set Headers {"Content-Type": "${CONTENT_TYPE}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Delete ${apiRoot}/${apiName}/${apiVersion}/policies + ${outputResponse}= Output response + Set Global Variable ${response} ${outputResponse} + +Check Postcondition Policies Exist + Log Checking that Policies exist + Get Policies \ No newline at end of file diff --git a/SOL012/PolicyManagement-API/Subscriptions.robot b/SOL012/PolicyManagement-API/Subscriptions.robot index ff7583b4c..978d94b88 100644 --- a/SOL012/PolicyManagement-API/Subscriptions.robot +++ b/SOL012/PolicyManagement-API/Subscriptions.robot @@ -166,7 +166,7 @@ GET Subscriptions as Paged Response PUT subscriptions - Method not implemented [Documentation] Test ID: 10.3.1.6.13 ... Test title: PUT subscriptions - Method not implemented - ... Test objective: The objective is to test that PUT method cannot modify a NS instance usage subscription + ... Test objective: The objective is to test that PUT method cannot modify a policy management subscription. ... Pre-conditions: none ... Reference: Clause 5.5.7.3.3 - ETSI GS NFV-SOL 012 [7] v3.4.1 ... Config ID: Config_prod_NFV-MANO @@ -178,7 +178,7 @@ PUT subscriptions - Method not implemented PATCH subscriptions - Method not implemented [Documentation] Test ID: 10.3.1.6.14 ... Test title: PATCH subscriptions - Method not implemented - ... Test objective: The objective is to test that PUT method cannot modify a NS instance usage subscription + ... Test objective: The objective is to test that PATCH method cannot modify a policy management subscription. ... Pre-conditions: none ... Reference: Clause 5.5.7.3.4 - ETSI GS NFV-SOL 012 [7] v3.4.1 ... Config ID: Config_prod_NFV-MANO @@ -190,7 +190,7 @@ PATCH subscriptions - Method not implemented DELETE subscriptions - Method not implemented [Documentation] Test ID: 10.3.1.6.15 ... Test title: DELETE subscriptions - Method not implemented - ... Test objective: The objective is to test that DELETE method cannot delete a NS instance usage subscription + ... Test objective: The objective is to test that DELETE method cannot delete a policy management subscription. ... Pre-conditions: none ... Reference: Clause 5.5.7.3.5 - ETSI GS NFV-SOL 012 [7] v3.4.1 ... Config ID: Config_prod_NFV-MANO diff --git a/SOL012/PolicyManagement-API/jsons/CreatePolicyRequest.json b/SOL012/PolicyManagement-API/jsons/CreatePolicyRequest.json new file mode 100644 index 000000000..4c0882406 --- /dev/null +++ b/SOL012/PolicyManagement-API/jsons/CreatePolicyRequest.json @@ -0,0 +1,6 @@ +{ + "designer": "", + "name": "", + "pfId": "", + "associations": [] +} \ No newline at end of file diff --git a/SOL012/PolicyManagement-API/schemas/Policies.schema.json b/SOL012/PolicyManagement-API/schemas/Policies.schema.json new file mode 100644 index 000000000..3e095ed9b --- /dev/null +++ b/SOL012/PolicyManagement-API/schemas/Policies.schema.json @@ -0,0 +1,121 @@ +{ "type": "array", + "items": + { + "description": "This type represents an individual policy. It shall comply with the provisions defined in table 5.6.2.3-1.", + "type": "object", + "properties": { + "id": { + "description": "An identifier with the intention of being globally unique.\n", + "type": "string" + }, + "designer": { + "description": "Human readable name of the designer of the policy.\n", + "type": "string" + }, + "name": { + "description": "Human readable name of the policy.\n", + "type": "string" + }, + "pfId": { + "description": "An identifier with the intention of being globally unique.\n", + "type": "string" + }, + "versions": { + "description": "Versions of the policy. Shall be present if at least one version of the policy has been transferred.\n", + "type": "array", + "items": { + "description": "A version.\n", + "type": "string" + } + }, + "selectedVersion": { + "description": "A version.\n", + "type": "string" + }, + "activationStatus": { + "description": "The enumeration ActivationStatus shall comply with the provisions defined in table 5.6.4.3-1. It indicates the activation status of a policy.\n", + "type": "string", + "enum": [ + "ACTIVATED", + "DEACTIVATED" + ] + }, + "transferStatus": { + "description": "The enumeration TransferStatus shall comply with the provisions defined in table 5.6.4.4-1. It indicates the transfer status of a policy\n", + "type": "string", + "enum": [ + "CREATED", + "TRANSFERRED" + ] + }, + "associations": { + "description": "Identifiers of the entities that the PF manages and to which the policy associates to. Shall be absent when the association feature is not applicable for the PF. The associations refer to identifiers of entities that the PF manages. E.g., if the PF is a VNFM, the policy can associate to VNF instances; if the PF is NFVO, the policy can associate to an NS instances. How the PF determines the scope of applicability of the policy when this attribute is absent is outside the scope of the present document.\n", + "type": "array", + "items": { + "description": "An identifier with the intention of being globally unique.\n", + "type": "string" + } + }, + "_links": { + "description": "Links for this resource\n", + "type": "object", + "properties": { + "self": { + "description": "This type represents a link to a resource using an absolute URI.\n", + "type": "object", + "required": [ + "href" + ], + "properties": { + "href": { + "description": "String formatted according to IETF RFC 3986.\n", + "type": "string" + } + } + }, + "selected": { + "description": "This type represents a link to a resource using an absolute URI.\n", + "type": "object", + "required": [ + "href" + ], + "properties": { + "href": { + "description": "String formatted according to IETF RFC 3986.\n", + "type": "string" + } + } + }, + "versions": { + "description": "URIs of all the transferred versions of this policy, if exists.\n", + "type": "array", + "items": { + "description": "This type represents a link to a resource using an absolute URI.\n", + "type": "object", + "required": [ + "href" + ], + "properties": { + "href": { + "description": "String formatted according to IETF RFC 3986.\n", + "type": "string" + } + } + } + } + }, + "required": [ + "self" + ] + } + }, + "required": [ + "id", + "designer", + "name", + "activationStatus", + "transferStatus", + "_links" + ] + } +} \ No newline at end of file diff --git a/SOL012/PolicyManagement-API/schemas/Policy.schema.json b/SOL012/PolicyManagement-API/schemas/Policy.schema.json new file mode 100644 index 000000000..fdcdea95a --- /dev/null +++ b/SOL012/PolicyManagement-API/schemas/Policy.schema.json @@ -0,0 +1,118 @@ +{ + "description": "This type represents an individual policy. It shall comply with the provisions defined in table 5.6.2.3-1.", + "type": "object", + "properties": { + "id": { + "description": "An identifier with the intention of being globally unique.\n", + "type": "string" + }, + "designer": { + "description": "Human readable name of the designer of the policy.\n", + "type": "string" + }, + "name": { + "description": "Human readable name of the policy.\n", + "type": "string" + }, + "pfId": { + "description": "An identifier with the intention of being globally unique.\n", + "type": "string" + }, + "versions": { + "description": "Versions of the policy. Shall be present if at least one version of the policy has been transferred.\n", + "type": "array", + "items": { + "description": "A version.\n", + "type": "string" + } + }, + "selectedVersion": { + "description": "A version.\n", + "type": "string" + }, + "activationStatus": { + "description": "The enumeration ActivationStatus shall comply with the provisions defined in table 5.6.4.3-1. It indicates the activation status of a policy.\n", + "type": "string", + "enum": [ + "ACTIVATED", + "DEACTIVATED" + ] + }, + "transferStatus": { + "description": "The enumeration TransferStatus shall comply with the provisions defined in table 5.6.4.4-1. It indicates the transfer status of a policy\n", + "type": "string", + "enum": [ + "CREATED", + "TRANSFERRED" + ] + }, + "associations": { + "description": "Identifiers of the entities that the PF manages and to which the policy associates to. Shall be absent when the association feature is not applicable for the PF. The associations refer to identifiers of entities that the PF manages. E.g., if the PF is a VNFM, the policy can associate to VNF instances; if the PF is NFVO, the policy can associate to an NS instances. How the PF determines the scope of applicability of the policy when this attribute is absent is outside the scope of the present document.\n", + "type": "array", + "items": { + "description": "An identifier with the intention of being globally unique.\n", + "type": "string" + } + }, + "_links": { + "description": "Links for this resource\n", + "type": "object", + "properties": { + "self": { + "description": "This type represents a link to a resource using an absolute URI.\n", + "type": "object", + "required": [ + "href" + ], + "properties": { + "href": { + "description": "String formatted according to IETF RFC 3986.\n", + "type": "string" + } + } + }, + "selected": { + "description": "This type represents a link to a resource using an absolute URI.\n", + "type": "object", + "required": [ + "href" + ], + "properties": { + "href": { + "description": "String formatted according to IETF RFC 3986.\n", + "type": "string" + } + } + }, + "versions": { + "description": "URIs of all the transferred versions of this policy, if exists.\n", + "type": "array", + "items": { + "description": "This type represents a link to a resource using an absolute URI.\n", + "type": "object", + "required": [ + "href" + ], + "properties": { + "href": { + "description": "String formatted according to IETF RFC 3986.\n", + "type": "string" + } + } + } + } + }, + "required": [ + "self" + ] + } + }, + "required": [ + "id", + "designer", + "name", + "activationStatus", + "transferStatus", + "_links" + ] +} \ No newline at end of file -- GitLab From b09ae9a9c794264c94865abf1869bebf96037308 Mon Sep 17 00:00:00 2001 From: hammad zafar Date: Sun, 7 Feb 2021 03:25:43 +0500 Subject: [PATCH 08/18] IndividualPolicy resource added in PolicyManagement-API --- .../IndividualPolicy.robot | 109 ++++++++++++++++++ .../PolicyManagementKeywords.robot | 62 +++++++++- .../environment/variables.txt | 1 + 3 files changed, 171 insertions(+), 1 deletion(-) create mode 100644 SOL012/PolicyManagement-API/IndividualPolicy.robot diff --git a/SOL012/PolicyManagement-API/IndividualPolicy.robot b/SOL012/PolicyManagement-API/IndividualPolicy.robot new file mode 100644 index 000000000..e523e8b1b --- /dev/null +++ b/SOL012/PolicyManagement-API/IndividualPolicy.robot @@ -0,0 +1,109 @@ +*** Settings *** +Resource environment/variables.txt +Resource PolicyManagementKeywords.robot + +*** Test Cases *** +POST Individual Policy - Method not implemented + [Documentation] Test ID: 10.3.1.3.1 + ... Test title: POST Individual Policy - Method not implemented + ... Test objective: The objective is to test that POST method is not implemented. + ... Pre-conditions: none + ... Reference: Clause 5.5.4.3.1 - ETSI GS NFV-SOL 012 [7] v3.4.1 + ... Config ID: Config_prod_NFV-MANO + ... Applicability: none + ... Post-Conditions: none + POST Individual Policy + Check HTTP Response Status Code Is 405 + +GET Information about an individual policy - Successful + [Documentation] Test ID: 10.3.1.3.2 + ... Test title: GET Information about an individual policy - Successful + ... Test objective: The objective is to test the retrieval of Individual Policy and perform a JSON schema validation of the returned Policy data structure. + ... Pre-conditions: At least one policy is available in the NFV-MANO. + ... Reference: Clause 5.5.4.3.2 - ETSI GS NFV-SOL 012 [7] v3.4.1 + ... Config ID: Config_prod_NFV-MANO + ... Applicability: none + ... Post-Conditions: none + GET Individual Policy + Check HTTP Response Status Code Is 200 + Check HTTP Response Body Json Schema Is Policy + +PUT an individual policy - Method not implemented + [Documentation] Test ID: 10.3.1.3.3 + ... Test title: PUT an individual policy - Method not implemented + ... Test objective: The objective is to test that PUT method is not implemented. + ... Pre-conditions: none + ... Reference: Clause 5.5.4.3.3 - ETSI GS NFV-SOL 012 [7] v3.4.1 + ... Config ID: Config_prod_NFV-MANO + ... Applicability: none + ... Post-Conditions: none + PUT Individual Policy + Check HTTP Response Status Code Is 405 + +PATCH an individual ploicy - Successful + [Documentation] Test ID: 10.3.1.3.4 + ... Test title: PATCH an individual ploicy - Successful + ... Test objective: The objective is to test that an individual policy is modified successfully when there is no conflict using PATCH method. + ... Pre-conditions: There should not exist a conflict as described in Reference. + ... Reference: Clause 5.5.4.3.4 - ETSI GS NFV-SOL 012 [7] v3.4.1 + ... Config ID: Config_prod_NFV-MANO + ... Applicability: none + ... Post-Conditions: none + PATCH Individual Policy + Check HTTP Response Status Code Is 200 + Check HTTP Response Body Json Schema Is PolicyModifications + +PATCH an individual ploicy - Conflict + [Documentation] Test ID: 10.3.1.3.5 + ... Test title: PATCH an individual ploicy - Conflict + ... Test objective: The objective is to test that an individual policy is not modified when there is a conflict using PATCH method. + ... Pre-conditions: There exists a conflict as described in Reference. + ... Reference: Clause 5.5.4.3.4 - ETSI GS NFV-SOL 012 [7] v3.4.1 + ... Config ID: Config_prod_NFV-MANO + ... Applicability: none + ... Post-Conditions: none + PATCH Individual Subscription + Check HTTP Response Status Code Is 409 + Check HTTP Response Body Json Schema Is ProblemDetails + + +DELETE an individual policy - Successful + [Documentation] Test ID: 10.3.1.3.6 + ... Test title: DELETE an individual policy - Successful + ... Test objective: The objective is to test that DELETE method deletes a deactivated individual policy. + ... Pre-conditions: The activation status of individual policy to be deleted is not set to ACTIVATED. + ... Reference: Clause 5.5.8.3.5 - ETSI GS NFV-SOL 012 [7] v3.4.1 + ... Config ID: Config_prod_NFV-MANO + ... Applicability: none + ... Post-Conditions: The individual policy is not available anymore in the NFV-MANO. + DELETE Individual Policy + Check HTTP Response Status Code Is 204 + Check Postcondition Individual Policy is Deleted + +DELETE an individual policy - CONFLICT + [Documentation] Test ID: 10.3.1.3.7 + ... Test title: DELETE an individual policy - CONFLICT + ... Test objective: The objective is to test that DELETE method does not delete an activated individual policy. + ... Pre-conditions: The activation status of individual policy to be deleted is set to ACTIVATED. + ... Reference: Clause 5.5.8.3.5 - ETSI GS NFV-SOL 012 [7] v3.4.1 + ... Config ID: Config_prod_NFV-MANO + ... Applicability: none + ... Post-Conditions: The individual policy is not deleted. + Check Activation Status of Policy Is ACTIVATED + DELETE Individual Policy + Check HTTP Response Status Code Is 409 + Check HTTP Response Body Json Schema Is ProblemDetails + Check Postcondition Individual Policy is Not Deleted + +GET Information about an individual policy - NOT FOUND + [Documentation] Test ID: 10.3.1.3.8 + ... Test title: GET Information about an individual policy - NOT FOUND + ... Test objective: The objective is to test that the retrieval of individual policy fails when using an invalid resource identifier. + ... Pre-conditions: At least one individual policy is available in the NFV-MANO. + ... Reference: Clause 5.5.8.3.2 - ETSI GS NFV-SOL 012 [7] v3.4.1 + ... Config ID: Config_prod_NFV-MANO + ... Applicability: none + ... Post-Conditions: none + GET Individual Policy + Check HTTP Response Status Code Is 404 + Check HTTP Response Body Json Schema Is ProblemDetails \ No newline at end of file diff --git a/SOL012/PolicyManagement-API/PolicyManagementKeywords.robot b/SOL012/PolicyManagement-API/PolicyManagementKeywords.robot index 235d5f124..6b256811b 100644 --- a/SOL012/PolicyManagement-API/PolicyManagementKeywords.robot +++ b/SOL012/PolicyManagement-API/PolicyManagementKeywords.robot @@ -433,4 +433,64 @@ DELETE Policies Check Postcondition Policies Exist Log Checking that Policies exist - Get Policies \ No newline at end of file + Get Policies + +POST Individual Policy + log Trying to perform a POST. This method should not be implemented + Set Headers {"Accept":"${ACCEPT}"} + Set Headers {"Content-Type": "${CONTENT_TYPE}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Post ${apiRoot}/${apiName}/${apiVersion}/policies/${policyId} + ${outputResponse}= Output response + Set Global Variable ${response} ${outputResponse} + +GET Individual Policy + log Trying to get information about an individual policy + Set Headers {"Accept":"${ACCEPT}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Get ${apiRoot}/${apiName}/${apiVersion}/policies/${policyId} + ${outputResponse}= Output response + Set Global Variable ${response} ${outputResponse} + +PUT Individual Policy + log Trying to perform a PUT. This method should not be implemented + Set Headers {"Accept":"${ACCEPT}"} + Set Headers {"Content-Type": "${CONTENT_TYPE}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Put ${apiRoot}/${apiName}/${apiVersion}/policies/${policyId} + ${outputResponse}= Output response + Set Global Variable ${response} ${outputResponse} + +PATCH Individual Policy + Log Modify individual policy instance by PATCH to ${apiRoot}/${apiName}/${apiVersion}/policies/${policyId} + Set Headers {"Accept":"${ACCEPT}"} + Set Headers {"Content-Type": "${CONTENT_TYPE}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + ${body}= Get File jsons/PolicyModifications.json + Patch ${apiRoot}/${apiName}/${apiVersion}/policies/${policyId} ${body} + ${outputResponse}= Output response + Set Global Variable ${response} ${outputResponse} + +DELETE Individual Policy + log Trying to delete an individual policy, no conflict + Set Headers {"Accept":"${ACCEPT}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Delete ${apiRoot}/${apiName}/${apiVersion}/policies/${policyId} + ${outputResponse}= Output response + Set Global Variable ${response} ${outputResponse} + +Check Postcondition Individual Policy is Deleted + Log Check Postcondition individual policy is deleted + GET individual Policy + Check HTTP Response Status Code Is 404 + +Check Activation Status of Policy Is + [Arguments] ${status} + Get Individual Policy + Check HTTP Response Body Json Schema Is Policy + Should be equal as strings ${response['body']['activationStatus']} ${status} + +Check Postcondition Individual Policy is Not Deleted + Log Check Postcondition individual policy is not deleted + GET individual Policy + Check HTTP Response Status Code Is 200 \ No newline at end of file diff --git a/SOL012/PolicyManagement-API/environment/variables.txt b/SOL012/PolicyManagement-API/environment/variables.txt index 04326e924..0c972cc6f 100644 --- a/SOL012/PolicyManagement-API/environment/variables.txt +++ b/SOL012/PolicyManagement-API/environment/variables.txt @@ -48,6 +48,7 @@ ${polling_interval} 10 sec ${notification_request} [] ${notification_response} [] +${policyId} ${policyId1} ${policyId2} -- GitLab From 16cf017457e015bb2db0388feb4a8c3d9627ef24 Mon Sep 17 00:00:00 2001 From: hammad zafar Date: Sun, 7 Feb 2021 03:36:23 +0500 Subject: [PATCH 09/18] added json body template and schema for PolicyModifications data type --- .../jsons/PolicyModifications.json | 7 +++ .../schemas/PolicyModifications.schema.json | 45 +++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 SOL012/PolicyManagement-API/jsons/PolicyModifications.json create mode 100644 SOL012/PolicyManagement-API/schemas/PolicyModifications.schema.json diff --git a/SOL012/PolicyManagement-API/jsons/PolicyModifications.json b/SOL012/PolicyManagement-API/jsons/PolicyModifications.json new file mode 100644 index 000000000..b04b57364 --- /dev/null +++ b/SOL012/PolicyManagement-API/jsons/PolicyModifications.json @@ -0,0 +1,7 @@ +{ + "activationStatus": "ACTIVATED", + "selectedVersion": "", + "addAssociations": [], + "removeAssociations": [], + "removeAllAssociations": "FALSE" +} \ No newline at end of file diff --git a/SOL012/PolicyManagement-API/schemas/PolicyModifications.schema.json b/SOL012/PolicyManagement-API/schemas/PolicyModifications.schema.json new file mode 100644 index 000000000..163171af8 --- /dev/null +++ b/SOL012/PolicyManagement-API/schemas/PolicyModifications.schema.json @@ -0,0 +1,45 @@ +{ + "description": "The parameter for the policy modifications, as defined in clause 5.6.2.4.\n", + "content": { + "application/json": { + "schema": { + "description": "This type represents the parameters for modifying a policy. It shall comply with the provisions defined in table 5.6.2.4-1\n", + "type": "object", + "properties": { + "activationStatus": { + "description": "The enumeration ActivationStatus shall comply with the provisions defined in table 5.6.4.3-1. It indicates the activation status of a policy.\n", + "type": "string", + "enum": [ + "ACTIVATED", + "DEACTIVATED" + ] + }, + "selectedVersion": { + "description": "A version.\n", + "type": "string" + }, + "addAssociations": { + "description": "Identifiers of entities to be added to the “associations” attribute in the “Policy” data structure which represents the policy. The API producer shall ignore the identifiers that already exist in the \"associations\" attribute in the “Policy” data structure. Shall be absent when the association feature is not applicable for the PF.\n", + "type": "array", + "items": { + "description": "An identifier with the intention of being globally unique.\n", + "type": "string" + } + }, + "removeAssociations": { + "description": "Identifiers of entities to be removed from the “associations” attribute in the “Policy” data structure which represents the policy. The API producer shall ignore the identifiers that do not exist in the \"associations\" attribute in the “Policy” data structure. Shall be absent when the association feature is not applicable for the PF.\n", + "type": "array", + "items": { + "description": "An identifier with the intention of being globally unique.\n", + "type": "string" + } + }, + "removeAllAssociations": { + "description": "Shall be set to TRUE if the policy is no longer associated to any specific entities managed by the PF. Shall be absent when the association feature is not applicable for the PF. If \"removeAllAssociations\" is set to TRUE, neither \"addAssociations\" nor “removeAssociations” attributes shall be present. Once all associations have been removed, how the PF determines the scope of applicability of the policy is outside the scope of the present document.\n", + "type": "boolean" + } + } + } + } + } +} \ No newline at end of file -- GitLab From 095be7440cdc21ca3b6527a61f3f7ca3580169a7 Mon Sep 17 00:00:00 2001 From: hammad zafar Date: Mon, 8 Feb 2021 14:56:59 +0500 Subject: [PATCH 10/18] New resource added in PolicyManagement-API --- .../PolicyManagementKeywords.robot | 54 ++++++++++- .../SelectedVersionOfAnIndividualPolicy.robot | 91 +++++++++++++++++++ 2 files changed, 144 insertions(+), 1 deletion(-) create mode 100644 SOL012/PolicyManagement-API/SelectedVersionOfAnIndividualPolicy.robot diff --git a/SOL012/PolicyManagement-API/PolicyManagementKeywords.robot b/SOL012/PolicyManagement-API/PolicyManagementKeywords.robot index 6b256811b..f73859f76 100644 --- a/SOL012/PolicyManagement-API/PolicyManagementKeywords.robot +++ b/SOL012/PolicyManagement-API/PolicyManagementKeywords.robot @@ -493,4 +493,56 @@ Check Activation Status of Policy Is Check Postcondition Individual Policy is Not Deleted Log Check Postcondition individual policy is not deleted GET individual Policy - Check HTTP Response Status Code Is 200 \ No newline at end of file + Check HTTP Response Status Code Is 200 + +POST Selected Version of an Individual Policy + Log Trying to perform a POST. This method should not be implemented + Set Headers {"Accept":"${ACCEPT}"} + Set Headers {"Content-Type": "${CONTENT_TYPE}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Post ${apiRoot}/${apiName}/${apiVersion}/policies/${policyId}/selected_version + ${outputResponse}= Output response + Set Global Variable ${response} ${outputResponse} + +GET Selected Version of an Individual Policy + log Trying to get information about the selected version of an individual policy + Set Headers {"Accept":"${ACCEPT}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Get ${apiRoot}/${apiName}/${apiVersion}/policies/${policyId}/selected_version + ${outputResponse}= Output response + Set Global Variable ${response} ${outputResponse} + +PUT Selected Version of an Individual Policy + log Trying to perform a PUT. This method should not be implemented + Set Headers {"Accept":"${ACCEPT}"} + Set Headers {"Content-Type": "${CONTENT_TYPE}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Put ${apiRoot}/${apiName}/${apiVersion}/policies/${policyId}/selected_version + ${outputResponse}= Output response + Set Global Variable ${response} ${outputResponse} + +PATCH Selected Version of an Individual Policy + log Trying to perform a PATCH. This method should not be implemented + Set Headers {"Accept":"${ACCEPT}"} + Set Headers {"Content-Type": "${CONTENT_TYPE}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Patch ${apiRoot}/${apiName}/${apiVersion}/policies/${policyId}/selected_version + ${outputResponse}= Output response + Set Global Variable ${response} ${outputResponse} + +DELETE Selected Version of an Individual Policy + log Trying to perform a DELETE. This method should not be implemented + Set Headers {"Accept":"${ACCEPT}"} + Set Headers {"Content-Type": "${CONTENT_TYPE}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Delete ${apiRoot}/${apiName}/${apiVersion}/policies/${policyId}/selected_version + ${outputResponse}= Output response + Set Global Variable ${response} ${outputResponse} + +Check HTTP Content-Type Is Set + Log Checking that the Content-Type HTTP header is set according to the type of policy content. + GET individual Policy + ${PolicyContentType}= Get Value From Json ${response['headers']} $..Content-Type + GET Selected Version of an Individual Policy + ${HTTPContentType}= Get Value From Json ${response['headers']} $..Content-Type + Should be equal as strings ${HTTPContentType} ${PolicyContentType} \ No newline at end of file diff --git a/SOL012/PolicyManagement-API/SelectedVersionOfAnIndividualPolicy.robot b/SOL012/PolicyManagement-API/SelectedVersionOfAnIndividualPolicy.robot new file mode 100644 index 000000000..9c9ae831b --- /dev/null +++ b/SOL012/PolicyManagement-API/SelectedVersionOfAnIndividualPolicy.robot @@ -0,0 +1,91 @@ +*** Settings *** +Resource environment/variables.txt +Resource PolicyManagementKeywords.robot + +*** Test Cases *** +POST Selected Version of an Individual Policy - Method not implemented + [Documentation] Test ID: 10.3.1.4.1 + ... Test title: POST Selected Version of an Individual Policy - Method not implemented + ... Test objective: The objective is to test that POST method is not implemented for this resource. + ... Pre-conditions: none + ... Reference: Clause 5.5.5.3.1 - ETSI GS NFV-SOL 012 [7] v3.4.1 + ... Config ID: Config_prod_NFV-MANO + ... Applicability: none + ... Post-Conditions: none + POST Selected Version of an Individual Policy + Check HTTP Response Status Code Is 405 + +GET Information about the Selected Version of an Individual Policy - Successful + [Documentation] Test ID: 10.3.1.4.2 + ... Test title: GET Information about the Selected Version of an Individual Policy - Successful + ... Test objective: The objective is to test The GET method fetches the content of the selected version of an individual policy. + ... Pre-conditions: Individual policy is available in the NFV-MANO. + ... Reference: Clause 5.5.4.3.2 - ETSI GS NFV-SOL 012 [7] v3.4.1 + ... Config ID: Config_prod_NFV-MANO + ... Applicability: none + ... Post-Conditions: none + GET Selected Version of an Individual Policy + Check HTTP Response Status Code Is 200 + Check HTTP Content-Type Is Set + +GET Information about the Selected Version of an Individual Policy - NOT FOUND + [Documentation] Test ID: 10.3.1.4.3 + ... Test title: GET Information about the Selected Version of an Individual Policy - NOT FOUND + ... Test objective: The objective is to test that the information about the selected version of an individual policy fails when using an invalid resource identifier. + ... Pre-conditions: The API producer did not find the current representation for the target resource. + ... Reference: Clause 5.5.4.3.2 - ETSI GS NFV-SOL 012 [7] v3.4.1 + ... Config ID: Config_prod_NFV-MANO + ... Applicability: none + ... Post-Conditions: none + GET Selected Version of an Individual Policy + Check HTTP Response Status Code Is 404 + Check HTTP Response Body Json Schema Is ProblemDetails + +GET Information about the Selected Version of an Individual Policy - CREATED STATE + [Documentation] Test ID: 10.3.1.4.4 + ... Test title: GET Information about the Selected Version of an Individual Policy - NOT FOUND + ... Test objective: The objective is to test that the information about the selected version of an individual policy is not retrieved when it is in CREATED state. + ... Pre-conditions: The individual policy is in CREATED state. + ... Reference: Clause 5.5.4.3.2 - ETSI GS NFV-SOL 012 [7] v3.4.1 + ... Config ID: Config_prod_NFV-MANO + ... Applicability: none + ... Post-Conditions: none + GET Selected Version of an Individual Policy + Check HTTP Response Status Code Is 404 + Check HTTP Response Body Json Schema Is ProblemDetails + +PUT Selected Version of an individual policy - Method not implemented + [Documentation] Test ID: 10.3.1.4.5 + ... Test title: PUT Selected Version of an individual policy - Method not implemented + ... Test objective: The objective is to test that PUT method is not implemented for this resource. + ... Pre-conditions: none + ... Reference: Clause 5.5.4.3.3 - ETSI GS NFV-SOL 012 [7] v3.4.1 + ... Config ID: Config_prod_NFV-MANO + ... Applicability: none + ... Post-Conditions: none + PUT Selected Version of an Individual Policy + Check HTTP Response Status Code Is 405 + +PATCH Selected Version of an individual policy - Method not implemented + [Documentation] Test ID: 10.3.1.4.6 + ... Test title: PATCH Selected Version of an individual policy - Method not implemented + ... Test objective: The objective is to test that PATCH method is not implemented for this resource. + ... Pre-conditions: none + ... Reference: Clause 5.5.4.3.4 - ETSI GS NFV-SOL 012 [7] v3.4.1 + ... Config ID: Config_prod_NFV-MANO + ... Applicability: none + ... Post-Conditions: none + PATCH Selected Version of an Individual Policy + Check HTTP Response Status Code Is 405 + +DELETE Selected Version of an individual policy - Method not implemented + [Documentation] Test ID: 10.3.1.4.7 + ... Test title: DELETE Selected Version of an individual policy - Method not implemented + ... Test objective: The objective is to test that DELETE method is not implemented for this resource. + ... Pre-conditions: none + ... Reference: Clause 5.5.4.3.5 - ETSI GS NFV-SOL 012 [7] v3.4.1 + ... Config ID: Config_prod_NFV-MANO + ... Applicability: none + ... Post-Conditions: none + DELETE Selected Version of an Individual Policy + Check HTTP Response Status Code Is 405 -- GitLab From ff421fe005a4430df463b649ce3c8f1a2658511b Mon Sep 17 00:00:00 2001 From: hammad zafar Date: Mon, 8 Feb 2021 20:33:36 +0500 Subject: [PATCH 11/18] New resource added in SOL012 PolicyManagement-API --- ...articularVersionOfAnIndividualPolicy.robot | 103 ++++++++++++++++++ .../PolicyManagementKeywords.robot | 59 ++++++++-- .../SelectedVersionOfAnIndividualPolicy.robot | 13 +-- .../environment/variables.txt | 15 +-- .../jsons/PolicyContent/policyContent.json | 10 ++ .../jsons/PolicyContent/policyContent.yaml | 10 ++ 6 files changed, 185 insertions(+), 25 deletions(-) create mode 100644 SOL012/PolicyManagement-API/ParticularVersionOfAnIndividualPolicy.robot create mode 100644 SOL012/PolicyManagement-API/jsons/PolicyContent/policyContent.json create mode 100644 SOL012/PolicyManagement-API/jsons/PolicyContent/policyContent.yaml diff --git a/SOL012/PolicyManagement-API/ParticularVersionOfAnIndividualPolicy.robot b/SOL012/PolicyManagement-API/ParticularVersionOfAnIndividualPolicy.robot new file mode 100644 index 000000000..2c094c95f --- /dev/null +++ b/SOL012/PolicyManagement-API/ParticularVersionOfAnIndividualPolicy.robot @@ -0,0 +1,103 @@ +*** Settings *** +Resource environment/variables.txt +Resource PolicyManagementKeywords.robot + +*** Test Cases *** +POST Particular Version of an Individual Policy - Method not implemented + [Documentation] Test ID: 10.3.1.5.1 + ... Test title: POST Particular Version of an Individual Policy - Method not implemented + ... Test objective: The objective is to test that POST method is not implemented for this resource. + ... Pre-conditions: none + ... Reference: Clause 5.5.6.3.1 - ETSI GS NFV-SOL 012 [7] v3.4.1 + ... Config ID: Config_prod_NFV-MANO + ... Applicability: none + ... Post-Conditions: none + POST Particular Version of an Individual Policy + Check HTTP Response Status Code Is 405 + +GET Information about the Particular Version of an Individual Policy - Successful + [Documentation] Test ID: 10.3.1.5.2 + ... Test title: GET Information about the Particular Version of an Individual Policy - Successful + ... Test objective: The objective is to test The GET method fetches the content of the Particular version of an individual policy. + ... Pre-conditions: Individual policy is available in the NFV-MANO. + ... Reference: Clause 5.5.6.3.2 - ETSI GS NFV-SOL 012 [7] v3.4.1 + ... Config ID: Config_prod_NFV-MANO + ... Applicability: none + ... Post-Conditions: none + GET Particular Version of an Individual Policy + Check HTTP Response Status Code Is 200 + +GET Information about the Particular Version of an Individual Policy - NOT FOUND + [Documentation] Test ID: 10.3.1.5.3 + ... Test title: GET Information about the Particular Version of an Individual Policy - NOT FOUND + ... Test objective: The objective is to test that the information about the Particular version of an individual policy fails when using an invalid resource identifier. + ... Pre-conditions: The API producer did not find the current representation for the target resource. + ... Reference: Clause 5.5.6.3.2 - ETSI GS NFV-SOL 012 [7] v3.4.1 + ... Config ID: Config_prod_NFV-MANO + ... Applicability: none + ... Post-Conditions: none + GET Particular Version of an Individual Policy + Check HTTP Response Status Code Is 404 + Check HTTP Response Body Json Schema Is ProblemDetails + +PUT Particular Version of an individual policy - Successful + [Documentation] Test ID: 10.3.1.5.4 + ... Test title: PUT Particular Version of an individual policy - Successful + ... Test objective: The objective is to test that the PUT method transfers the content of a particular version of an individual policy. + ... Pre-conditions: none + ... Reference: Clause 5.5.6.3.3 - ETSI GS NFV-SOL 012 [7] v3.4.1 + ... Config ID: Config_prod_NFV-MANO + ... Applicability: The policy content type is either JSON, YAML or ZIP. + ... Post-Conditions: none + PUT Particular Version of an Individual Policy + Check HTTP Response Status Code Is 201 + +PUT Particular Version of an individual policy - CONFLICT + [Documentation] Test ID: 10.3.1.5.5 + ... Test title: PUT Particular Version of an individual policy - CONFLICT + ... Test objective: The objective is to test that the PUT method does not transfer the content of a particular version in case of a conflict. + ... Pre-conditions: The particular version has already been transferred to the API producer. + ... Reference: Clause 5.5.6.3.3 - ETSI GS NFV-SOL 012 [7] v3.4.1 + ... Config ID: Config_prod_NFV-MANO + ... Applicability: The policy content type is either JSON, YAML or ZIP. + ... Post-Conditions: none + PUT Particular Version of an Individual Policy + Check HTTP Response Status Code Is 409 + Check HTTP Response Body Json Schema Is ProblemDetails + +PATCH Particular Version of an individual policy - Method not implemented + [Documentation] Test ID: 10.3.1.5.6 + ... Test title: PATCH Particular Version of an individual policy - Method not implemented + ... Test objective: The objective is to test that PATCH method is not implemented for this resource. + ... Pre-conditions: none + ... Reference: Clause 5.5.6.3.4 - ETSI GS NFV-SOL 012 [7] v3.4.1 + ... Config ID: Config_prod_NFV-MANO + ... Applicability: none + ... Post-Conditions: none + PATCH Particular Version of an Individual Policy + Check HTTP Response Status Code Is 405 + +DELETE Particular Version of an individual policy - Successful + [Documentation] Test ID: 10.3.1.5.7 + ... Test title: DELETE Particular Version of an individual policy - Successful + ... Test objective: The objective is to test that the DELETE method deletes a particular version of an individual policy. + ... Pre-conditions: none + ... Reference: Clause 5.5.6.3.5 - ETSI GS NFV-SOL 012 [7] v3.4.1 + ... Config ID: Config_prod_NFV-MANO + ... Applicability: none + ... Post-Conditions: none + DELETE Particular Version of an Individual Policy + Check HTTP Response Status Code Is 204 + +DELETE Particular Version of an individual policy - CONFLICT + [Documentation] Test ID: 10.3.1.5.8 + ... Test title: DELETE Particular Version of an individual policy - CONFLICT + ... Test objective: The objective is to test that the DELETE method does not delete a particular version of an individual policy in case of a conflict. + ... Pre-conditions: The requested version of the individual policy is the selected version. + ... Reference: Clause 5.5.6.3.5 - ETSI GS NFV-SOL 012 [7] v3.4.1 + ... Config ID: Config_prod_NFV-MANO + ... Applicability: none + ... Post-Conditions: none + DELETE Particular Version of an Individual Policy + Check HTTP Response Status Code Is 409 + Check HTTP Response Body Json Schema Is ProblemDetails diff --git a/SOL012/PolicyManagement-API/PolicyManagementKeywords.robot b/SOL012/PolicyManagement-API/PolicyManagementKeywords.robot index f73859f76..f261f073d 100644 --- a/SOL012/PolicyManagement-API/PolicyManagementKeywords.robot +++ b/SOL012/PolicyManagement-API/PolicyManagementKeywords.robot @@ -538,11 +538,56 @@ DELETE Selected Version of an Individual Policy Delete ${apiRoot}/${apiName}/${apiVersion}/policies/${policyId}/selected_version ${outputResponse}= Output response Set Global Variable ${response} ${outputResponse} + +POST Particular Version of an Individual Policy + Log Trying to perform a POST. This method should not be implemented + Set Headers {"Accept":"${ACCEPT}"} + Set Headers {"Content-Type": "${CONTENT_TYPE}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Post ${apiRoot}/${apiName}/${apiVersion}/policies/${policyId}/versions/${policyVersion} + ${outputResponse}= Output response + Set Global Variable ${response} ${outputResponse} -Check HTTP Content-Type Is Set - Log Checking that the Content-Type HTTP header is set according to the type of policy content. - GET individual Policy - ${PolicyContentType}= Get Value From Json ${response['headers']} $..Content-Type - GET Selected Version of an Individual Policy - ${HTTPContentType}= Get Value From Json ${response['headers']} $..Content-Type - Should be equal as strings ${HTTPContentType} ${PolicyContentType} \ No newline at end of file +GET Particular Version of an Individual Policy + log Trying to get information about a particular version of an individual policy + Set Headers {"Accept":"${ACCEPT}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Get ${apiRoot}/${apiName}/${apiVersion}/policies/${policyId}/versions/${policyVersion} + ${outputResponse}= Output response + Set Global Variable ${response} ${outputResponse} + +PUT Particular Version of an Individual Policy + Log Using PUT method to transfer the content of a particular version of an individual policy. + Set Headers {"Accept":"${ACCEPT}"} + Determine Policy Content Type + Set Headers {"Content-Type": "${POLICY_CONTENT_TYPE}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + ${body}= Get File ${POLICY_CONTENT_FILENAME} + Put ${apiRoot}/${apiName}/${apiVersion}/policies/${policyId}/versions/${policyVersion} ${body} + ${outputResponse}= Output response + Set Global Variable ${response} ${outputResponse} + +PATCH Particular Version of an Individual Policy + log Trying to perform a PATCH. This method should not be implemented + Set Headers {"Accept":"${ACCEPT}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Patch ${apiRoot}/${apiName}/${apiVersion}/policies/${policyId}/versions/${policyVersion} + ${outputResponse}= Output response + Set Global Variable ${response} ${outputResponse} + +DELETE Particular Version of an Individual Policy + Log Trying to DELETE a particular version of an individual policy. + Set Headers {"Accept":"${ACCEPT}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Delete ${apiRoot}/${apiName}/${apiVersion}/policies/${policyId}/versions/${policyVersion} + ${outputResponse}= Output response + Set Global Variable ${response} ${outputResponse} + +Determine Policy Content Type + ${json}= Run keyword and return status Should end with ${POLICY_CONTENT_FILENAME} .json + ${yaml}= Run keyword and return status Should end with ${POLICY_CONTENT_FILENAME} .yaml + ${zip}= Run keyword and return status Should end with ${POLICY_CONTENT_FILENAME} .zip + Run Keyword If ${json} Set Global Variable ${POLICY_CONTENT_TYPE} application/json + Run Keyword If ${yaml} Set Global Variable ${POLICY_CONTENT_TYPE} application/yaml + Run Keyword If ${zip} Set Global Variable ${POLICY_CONTENT_TYPE} application/zip + \ No newline at end of file diff --git a/SOL012/PolicyManagement-API/SelectedVersionOfAnIndividualPolicy.robot b/SOL012/PolicyManagement-API/SelectedVersionOfAnIndividualPolicy.robot index 9c9ae831b..a795fe5de 100644 --- a/SOL012/PolicyManagement-API/SelectedVersionOfAnIndividualPolicy.robot +++ b/SOL012/PolicyManagement-API/SelectedVersionOfAnIndividualPolicy.robot @@ -20,20 +20,19 @@ GET Information about the Selected Version of an Individual Policy - Successful ... Test title: GET Information about the Selected Version of an Individual Policy - Successful ... Test objective: The objective is to test The GET method fetches the content of the selected version of an individual policy. ... Pre-conditions: Individual policy is available in the NFV-MANO. - ... Reference: Clause 5.5.4.3.2 - ETSI GS NFV-SOL 012 [7] v3.4.1 + ... Reference: Clause 5.5.5.3.2 - ETSI GS NFV-SOL 012 [7] v3.4.1 ... Config ID: Config_prod_NFV-MANO ... Applicability: none ... Post-Conditions: none GET Selected Version of an Individual Policy Check HTTP Response Status Code Is 200 - Check HTTP Content-Type Is Set GET Information about the Selected Version of an Individual Policy - NOT FOUND [Documentation] Test ID: 10.3.1.4.3 ... Test title: GET Information about the Selected Version of an Individual Policy - NOT FOUND ... Test objective: The objective is to test that the information about the selected version of an individual policy fails when using an invalid resource identifier. ... Pre-conditions: The API producer did not find the current representation for the target resource. - ... Reference: Clause 5.5.4.3.2 - ETSI GS NFV-SOL 012 [7] v3.4.1 + ... Reference: Clause 5.5.5.3.2 - ETSI GS NFV-SOL 012 [7] v3.4.1 ... Config ID: Config_prod_NFV-MANO ... Applicability: none ... Post-Conditions: none @@ -46,7 +45,7 @@ GET Information about the Selected Version of an Individual Policy - CREATED STA ... Test title: GET Information about the Selected Version of an Individual Policy - NOT FOUND ... Test objective: The objective is to test that the information about the selected version of an individual policy is not retrieved when it is in CREATED state. ... Pre-conditions: The individual policy is in CREATED state. - ... Reference: Clause 5.5.4.3.2 - ETSI GS NFV-SOL 012 [7] v3.4.1 + ... Reference: Clause 5.5.5.3.2 - ETSI GS NFV-SOL 012 [7] v3.4.1 ... Config ID: Config_prod_NFV-MANO ... Applicability: none ... Post-Conditions: none @@ -59,7 +58,7 @@ PUT Selected Version of an individual policy - Method not implemented ... Test title: PUT Selected Version of an individual policy - Method not implemented ... Test objective: The objective is to test that PUT method is not implemented for this resource. ... Pre-conditions: none - ... Reference: Clause 5.5.4.3.3 - ETSI GS NFV-SOL 012 [7] v3.4.1 + ... Reference: Clause 5.5.5.3.3 - ETSI GS NFV-SOL 012 [7] v3.4.1 ... Config ID: Config_prod_NFV-MANO ... Applicability: none ... Post-Conditions: none @@ -71,7 +70,7 @@ PATCH Selected Version of an individual policy - Method not implemented ... Test title: PATCH Selected Version of an individual policy - Method not implemented ... Test objective: The objective is to test that PATCH method is not implemented for this resource. ... Pre-conditions: none - ... Reference: Clause 5.5.4.3.4 - ETSI GS NFV-SOL 012 [7] v3.4.1 + ... Reference: Clause 5.5.5.3.4 - ETSI GS NFV-SOL 012 [7] v3.4.1 ... Config ID: Config_prod_NFV-MANO ... Applicability: none ... Post-Conditions: none @@ -83,7 +82,7 @@ DELETE Selected Version of an individual policy - Method not implemented ... Test title: DELETE Selected Version of an individual policy - Method not implemented ... Test objective: The objective is to test that DELETE method is not implemented for this resource. ... Pre-conditions: none - ... Reference: Clause 5.5.4.3.5 - ETSI GS NFV-SOL 012 [7] v3.4.1 + ... Reference: Clause 5.5.5.3.5 - ETSI GS NFV-SOL 012 [7] v3.4.1 ... Config ID: Config_prod_NFV-MANO ... Applicability: none ... Post-Conditions: none diff --git a/SOL012/PolicyManagement-API/environment/variables.txt b/SOL012/PolicyManagement-API/environment/variables.txt index 0c972cc6f..dfbea0cf4 100644 --- a/SOL012/PolicyManagement-API/environment/variables.txt +++ b/SOL012/PolicyManagement-API/environment/variables.txt @@ -3,10 +3,8 @@ ${NFVMANO_HOST} localhost # Hostname of the NFVO ${NFVMANO_PORT} 8081 # Listening port of the NFVO ${NFVMANO_SCHEMA} https ${AUTHORIZATION} Bearer QWxhZGRpbjpvcGVuIHNlc2FtZQ== -${WRONG_AUTHORIZATION} Bearer XXXXXWRONGXXXXX ${CONTENT_TYPE} application/json ${CONTENT_TYPE_JSON} application/json -${CONTENT_TYPE_PATCH} application/merge-patch+json ${ACCEPT} application/json ${ACCEPT_JSON} application/json ${AUTH_USAGE} 1 @@ -15,20 +13,14 @@ ${apiRoot} / ${apiName} nfvpolicy ${apiVersion} v1 -${SYNC_MODE} 1 +#Add file name along with the full path containing policy contents +${POLICY_CONTENT_FILENAME} jsons/PolicyContent/policyContent.json +${POLICY_CONTENT_TYPE} application/json ${response} {} ${NFVMANO_DUPLICATION} 1 -${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 - ${sub_filter} filter ${sub_filter_invalid} filter_invalid ${fields} criteria,objectInstanceIds @@ -51,6 +43,7 @@ ${notification_response} [] ${policyId} ${policyId1} ${policyId2} +${policyVersion} ${callbackResp} 127.0.0.1 diff --git a/SOL012/PolicyManagement-API/jsons/PolicyContent/policyContent.json b/SOL012/PolicyManagement-API/jsons/PolicyContent/policyContent.json new file mode 100644 index 000000000..825e64360 --- /dev/null +++ b/SOL012/PolicyManagement-API/jsons/PolicyContent/policyContent.json @@ -0,0 +1,10 @@ +{ + "description": "This is a JSON example template for Policy content. Replace with your specific policy content.", + "type": "object", + "properties": { + "id": { + "description": "An identifier with the intention of being globally unique.\n", + "type": "string" + } + } +} \ No newline at end of file diff --git a/SOL012/PolicyManagement-API/jsons/PolicyContent/policyContent.yaml b/SOL012/PolicyManagement-API/jsons/PolicyContent/policyContent.yaml new file mode 100644 index 000000000..07bb74b2e --- /dev/null +++ b/SOL012/PolicyManagement-API/jsons/PolicyContent/policyContent.yaml @@ -0,0 +1,10 @@ +--- + name: "use you own yaml policy content" + designer: "just replace this YAML structure with your policy content" + policy-id: 12345 + some-flag: true + some-paramter: 3 + associations: + - a1 + - a2 + - a3 \ No newline at end of file -- GitLab From b4fd4c758024948b9da307cc34551aa39a7d2e6f Mon Sep 17 00:00:00 2001 From: hammad zafar Date: Tue, 9 Feb 2021 16:18:03 +0500 Subject: [PATCH 12/18] minor fixes and additional test cases added for PolicyManagement-API --- .../IndividualPolicy.robot | 38 +++++------ .../IndividualSubscription.robot | 34 +++++----- .../NotificationConsumer.robot | 63 ++++++++++++++++++- ...articularVersionOfAnIndividualPolicy.robot | 5 +- SOL012/PolicyManagement-API/Policies.robot | 19 +++++- .../PolicyManagementKeywords.robot | 44 ++++++++++++- .../SelectedVersionOfAnIndividualPolicy.robot | 5 +- .../PolicyManagement-API/Subscriptions.robot | 50 +++++++++------ 8 files changed, 192 insertions(+), 66 deletions(-) diff --git a/SOL012/PolicyManagement-API/IndividualPolicy.robot b/SOL012/PolicyManagement-API/IndividualPolicy.robot index e523e8b1b..fe814c8c2 100644 --- a/SOL012/PolicyManagement-API/IndividualPolicy.robot +++ b/SOL012/PolicyManagement-API/IndividualPolicy.robot @@ -28,8 +28,21 @@ GET Information about an individual policy - Successful Check HTTP Response Status Code Is 200 Check HTTP Response Body Json Schema Is Policy -PUT an individual policy - Method not implemented +GET Information about an individual policy - NOT FOUND [Documentation] Test ID: 10.3.1.3.3 + ... Test title: GET Information about an individual policy - NOT FOUND + ... Test objective: The objective is to test that the retrieval of individual policy fails when using an invalid resource identifier. + ... Pre-conditions: At least one individual policy is available in the NFV-MANO. + ... Reference: Clause 5.5.8.3.2 - ETSI GS NFV-SOL 012 [7] v3.4.1 + ... Config ID: Config_prod_NFV-MANO + ... Applicability: none + ... Post-Conditions: none + GET Individual Policy + Check HTTP Response Status Code Is 404 + Check HTTP Response Body Json Schema Is ProblemDetails + +PUT an individual policy - Method not implemented + [Documentation] Test ID: 10.3.1.3.4 ... Test title: PUT an individual policy - Method not implemented ... Test objective: The objective is to test that PUT method is not implemented. ... Pre-conditions: none @@ -41,7 +54,7 @@ PUT an individual policy - Method not implemented Check HTTP Response Status Code Is 405 PATCH an individual ploicy - Successful - [Documentation] Test ID: 10.3.1.3.4 + [Documentation] Test ID: 10.3.1.3.5 ... Test title: PATCH an individual ploicy - Successful ... Test objective: The objective is to test that an individual policy is modified successfully when there is no conflict using PATCH method. ... Pre-conditions: There should not exist a conflict as described in Reference. @@ -54,7 +67,7 @@ PATCH an individual ploicy - Successful Check HTTP Response Body Json Schema Is PolicyModifications PATCH an individual ploicy - Conflict - [Documentation] Test ID: 10.3.1.3.5 + [Documentation] Test ID: 10.3.1.3.6 ... Test title: PATCH an individual ploicy - Conflict ... Test objective: The objective is to test that an individual policy is not modified when there is a conflict using PATCH method. ... Pre-conditions: There exists a conflict as described in Reference. @@ -68,7 +81,7 @@ PATCH an individual ploicy - Conflict DELETE an individual policy - Successful - [Documentation] Test ID: 10.3.1.3.6 + [Documentation] Test ID: 10.3.1.3.7 ... Test title: DELETE an individual policy - Successful ... Test objective: The objective is to test that DELETE method deletes a deactivated individual policy. ... Pre-conditions: The activation status of individual policy to be deleted is not set to ACTIVATED. @@ -81,7 +94,7 @@ DELETE an individual policy - Successful Check Postcondition Individual Policy is Deleted DELETE an individual policy - CONFLICT - [Documentation] Test ID: 10.3.1.3.7 + [Documentation] Test ID: 10.3.1.3.8 ... Test title: DELETE an individual policy - CONFLICT ... Test objective: The objective is to test that DELETE method does not delete an activated individual policy. ... Pre-conditions: The activation status of individual policy to be deleted is set to ACTIVATED. @@ -93,17 +106,4 @@ DELETE an individual policy - CONFLICT DELETE Individual Policy Check HTTP Response Status Code Is 409 Check HTTP Response Body Json Schema Is ProblemDetails - Check Postcondition Individual Policy is Not Deleted - -GET Information about an individual policy - NOT FOUND - [Documentation] Test ID: 10.3.1.3.8 - ... Test title: GET Information about an individual policy - NOT FOUND - ... Test objective: The objective is to test that the retrieval of individual policy fails when using an invalid resource identifier. - ... Pre-conditions: At least one individual policy is available in the NFV-MANO. - ... Reference: Clause 5.5.8.3.2 - ETSI GS NFV-SOL 012 [7] v3.4.1 - ... Config ID: Config_prod_NFV-MANO - ... Applicability: none - ... Post-Conditions: none - GET Individual Policy - Check HTTP Response Status Code Is 404 - Check HTTP Response Body Json Schema Is ProblemDetails \ No newline at end of file + Check Postcondition Individual Policy is Not Deleted \ No newline at end of file diff --git a/SOL012/PolicyManagement-API/IndividualSubscription.robot b/SOL012/PolicyManagement-API/IndividualSubscription.robot index a21e06d6e..177c5c6a3 100644 --- a/SOL012/PolicyManagement-API/IndividualSubscription.robot +++ b/SOL012/PolicyManagement-API/IndividualSubscription.robot @@ -27,9 +27,22 @@ GET Information about an individual subscription - Successful GET Individual subscription Check HTTP Response Status Code Is 200 Check HTTP Response Body Json Schema Is PolicySubscription + +GET Information about an individual subscription - NOT FOUND + [Documentation] Test ID: 10.3.1.7.3 + ... Test title: GET Information about an individual subscription - NOT FOUND + ... Test objective: The objective is to test that the retrieval of individual Policy Management subscription fails when using an invalid resource identifier. + ... Pre-conditions: At least one Policy Management subscription is available in the NFV-MANO. + ... Reference: Clause 5.5.8.3.2 - ETSI GS NFV-SOL 012 [7] v3.4.1 + ... Config ID: Config_prod_NFV-MANO + ... Applicability: none + ... Post-Conditions: none + GET Individual subscription + Check HTTP Response Status Code Is 404 + Check HTTP Response Body Json Schema Is ProblemDetails PUT an individual subscription - Method not implemented - [Documentation] Test ID: 10.3.1.7.3 + [Documentation] Test ID: 10.3.1.7.4 ... Test title: PUT an individual subscription - Method not implemented ... Test objective: The objective is to test that PUT method is not implemented ... Pre-conditions: none @@ -41,7 +54,7 @@ PUT an individual subscription - Method not implemented Check HTTP Response Status Code Is 405 PATCH an individual subscription - Method not implemented - [Documentation] Test ID: 10.3.1.7.4 + [Documentation] Test ID: 10.3.1.7.5 ... Test title: PATCH an individual subscription - Method not implemented ... Test objective: The objective is to test that PATCH method is not implemented ... Pre-conditions: none @@ -53,7 +66,7 @@ PATCH an individual subscription - Method not implemented Check HTTP Response Status Code Is 405 DELETE an individual subscription - [Documentation] Test ID: 10.3.1.7.5 + [Documentation] Test ID: 10.3.1.7.6 ... Test title: DELETE an individual subscription ... Test objective: The objective is to test that DELETE method deletes an individual subscription ... Pre-conditions: At least one policy management subscription is available in the NFV-MANO. @@ -63,17 +76,4 @@ DELETE an individual subscription ... Post-Conditions: The Policy Management subscription is not available anymore in the NFV-MANO. DELETE Individual Subscription Check HTTP Response Status Code Is 204 - Check Postcondition Individual Subscription is Deleted - -GET Information about an individual subscription - NOT FOUND - [Documentation] Test ID: 10.3.1.7.6 - ... Test title: GET Information about an individual subscription - NOT FOUND - ... Test objective: The objective is to test that the retrieval of individual Policy Management subscription fails when using an invalid resource identifier. - ... Pre-conditions: At least one Policy Management subscription is available in the NFV-MANO. - ... Reference: Clause 5.5.8.3.2 - ETSI GS NFV-SOL 012 [7] v3.4.1 - ... Config ID: Config_prod_NFV-MANO - ... Applicability: none - ... Post-Conditions: none - GET Individual subscription - Check HTTP Response Status Code Is 404 - Check HTTP Response Body Json Schema Is ProblemDetails \ No newline at end of file + Check Postcondition Individual Subscription is Deleted \ No newline at end of file diff --git a/SOL012/PolicyManagement-API/NotificationConsumer.robot b/SOL012/PolicyManagement-API/NotificationConsumer.robot index 77a0136ee..55050f1a4 100644 --- a/SOL012/PolicyManagement-API/NotificationConsumer.robot +++ b/SOL012/PolicyManagement-API/NotificationConsumer.robot @@ -26,4 +26,65 @@ Policy Conflict Notification ... Applicability: none ... Post-Conditions: none POST Policy Conflict Notification - Check HTTP Response Status Code Is 204 \ No newline at end of file + Check HTTP Response Status Code Is 204 + +Test the Notification Endpoint - Successful + [Documentation] Test ID: 10.3.1.9.3 + ... Test title: Test the Notification Endpoint - Successful + ... Test objective: The objective is to test the Notification Endpoint provided by the notification consumer. + ... Pre-conditions: A notification endpoint is provided by the API consumer upon subscription. + ... Reference: Clause 5.5.9.3.2 - ETSI GS NFV-SOL 012 [7] v3.4.1 + ... Config ID: Config_prod_Notif_Endpoint + ... Applicability: none + ... Post-Conditions: none + Get reach the notification endpoint + Check HTTP Response Status Code Is 204 + +Test the Notification Endpoint - UNREACHABLE + [Documentation] Test ID: 10.3.1.9.4 + ... Test title: Test the Notification Endpoint - UNREACHABLE + ... Test objective: The objective is to test the Notification Endpoint provided by the notification consumer. + ... Pre-conditions: A notification endpoint is provided by the API consumer upon subscription. + ... Reference: Clause 5.5.7.3.1 - ETSI GS NFV-SOL 012 [7] v3.4.1 + ... Config ID: Config_prod_Notif_Endpoint + ... Applicability: The notification endpoint is unreachable by the API producer. + ... Post-Conditions: none + GET reach the notification endpoint + Check HTTP Response Status Code Is 422 + Check HTTP Response Body Json Schema Is ProblemDetails + +PUT Notification endpoint - Method Not Implemented + [Documentation] Test ID: 10.3.1.9.5 + ... Test title: PUT Notification endpoint - Method Not Implemented + ... Test objective: The objective is to test the PUT method for Notification Endpoint provided by the consumer is not implemented. + ... Pre-conditions: A notification endpoint is provided by the API consumer upon subscription. + ... Reference: Clause 5.5.9.3.3 - ETSI GS NFV-SOL 012 [7] v3.4.1 + ... Config ID: Config_prod_Notif_Endpoint + ... Applicability: none + ... Post-Conditions: none + PUT notification endpoint + Check HTTP Response Status Code Is 405 + +PATCH Notification endpoint - Method Not Implemented + [Documentation] Test ID: 10.3.1.9.6 + ... Test title: PATCH Notification endpoint - Method Not Implemented + ... Test objective: The objective is to test the PATCH method for Notification Endpoint provided by the consumer is not implemented. + ... Pre-conditions: A notification endpoint is provided by the API consumer upon subscription. + ... Reference: Clause 5.5.9.3.4 - ETSI GS NFV-SOL 012 [7] v3.4.1 + ... Config ID: Config_prod_Notif_Endpoint + ... Applicability: none + ... Post-Conditions: none + PATCH notification endpoint + Check HTTP Response Status Code Is 405 + +DELETE Notification endpoint - Method Not Implemented + [Documentation] Test ID: 10.3.1.9.7 + ... Test title: DELETE Notification endpoint - Method Not Implemented + ... Test objective: The objective is to test the DELETE method for Notification Endpoint provided by the consumer is not implemented. + ... Pre-conditions: A notification endpoint is provided by the API consumer upon subscription. + ... Reference: Clause 5.5.9.3.5 - ETSI GS NFV-SOL 012 [7] v3.4.1 + ... Config ID: Config_prod_Notif_Endpoint + ... Applicability: none + ... Post-Conditions: none + DELETE notification endpoint + Check HTTP Response Status Code Is 405 \ No newline at end of file diff --git a/SOL012/PolicyManagement-API/ParticularVersionOfAnIndividualPolicy.robot b/SOL012/PolicyManagement-API/ParticularVersionOfAnIndividualPolicy.robot index 2c094c95f..9894f0274 100644 --- a/SOL012/PolicyManagement-API/ParticularVersionOfAnIndividualPolicy.robot +++ b/SOL012/PolicyManagement-API/ParticularVersionOfAnIndividualPolicy.robot @@ -19,13 +19,14 @@ GET Information about the Particular Version of an Individual Policy - Successfu [Documentation] Test ID: 10.3.1.5.2 ... Test title: GET Information about the Particular Version of an Individual Policy - Successful ... Test objective: The objective is to test The GET method fetches the content of the Particular version of an individual policy. - ... Pre-conditions: Individual policy is available in the NFV-MANO. + ... Pre-conditions: Individual policy is available in the NFV-MANO. Policy contents are provided in the json/PolicyContent folder. ... Reference: Clause 5.5.6.3.2 - ETSI GS NFV-SOL 012 [7] v3.4.1 ... Config ID: Config_prod_NFV-MANO - ... Applicability: none + ... Applicability: The policy content type is either JSON, YAML or ZIP. ... Post-Conditions: none GET Particular Version of an Individual Policy Check HTTP Response Status Code Is 200 + Check that the Content-Type Header Is Set GET Information about the Particular Version of an Individual Policy - NOT FOUND [Documentation] Test ID: 10.3.1.5.3 diff --git a/SOL012/PolicyManagement-API/Policies.robot b/SOL012/PolicyManagement-API/Policies.robot index 525036721..9c3c13f63 100644 --- a/SOL012/PolicyManagement-API/Policies.robot +++ b/SOL012/PolicyManagement-API/Policies.robot @@ -146,9 +146,22 @@ GET Policies as Paged Response GET Policies Check HTTP Response Status Code Is 200 Check HTTP Response Header Contains Link + +GET Policies - NOT FOUND + [Documentation] Test ID: 10.3.1.2.12 + ... Test title: GET Policies - NOT FOUND + ... Test objective: The objective is to test that the retrieval of list of policies fails when using an invalid resource identifier. + ... Pre-conditions: none + ... Reference: Clause 5.5.3.3.2 - ETSI GS NFV-SOL 012 [7] v3.4.1 + ... Config ID: Config_prod_NFV-MANO + ... Applicability: none + ... Post-Conditions: none + GET Policies + Check HTTP Response Status Code Is 404 + Check HTTP Response Body Json Schema Is ProblemDetails PUT Policies - Method not implemented - [Documentation] Test ID: 10.3.1.2.12 + [Documentation] Test ID: 10.3.1.2.13 ... Test title: PUT Policies - Method not implemented ... Test objective: The objective is to test that PUT method cannot modify policies. ... Pre-conditions: none @@ -160,7 +173,7 @@ PUT Policies - Method not implemented Check HTTP Response Status Code Is 405 PATCH Policies - Method not implemented - [Documentation] Test ID: 10.3.1.2.13 + [Documentation] Test ID: 10.3.1.2.14 ... Test title: PATCH Policies - Method not implemented ... Test objective: The objective is to test that PATCH method cannot modify policies. ... Pre-conditions: none @@ -172,7 +185,7 @@ PATCH Policies - Method not implemented Check HTTP Response Status Code Is 405 DELETE Policies - Method not implemented - [Documentation] Test ID: 10.3.1.2.14 + [Documentation] Test ID: 10.3.1.2.15 ... Test title: DELETE Policies - Method not implemented ... Test objective: The objective is to test that DELETE method cannot delete policies. ... Pre-conditions: none diff --git a/SOL012/PolicyManagement-API/PolicyManagementKeywords.robot b/SOL012/PolicyManagement-API/PolicyManagementKeywords.robot index f261f073d..92ff97890 100644 --- a/SOL012/PolicyManagement-API/PolicyManagementKeywords.robot +++ b/SOL012/PolicyManagement-API/PolicyManagementKeywords.robot @@ -307,7 +307,7 @@ Check resource existence and get CallbackUri Set Global Variable ${callbackResp} response body callbackUri POST Policy Change Notification - log Trying to perform a POST to deliver notification + log Trying to perform a POST to deliver notification. Set Headers {"Accept":"${ACCEPT_JSON}"} Set Headers {"Content-Type": "${CONTENT_TYPE_JSON}"} Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} @@ -318,7 +318,7 @@ POST Policy Change Notification Set Global Variable ${response} ${outputResponse} POST Policy Conflict Notification - log Trying to perform a POST to deliver notification + log Trying to perform a POST to deliver notification. Set Headers {"Accept":"${ACCEPT_JSON}"} Set Headers {"Content-Type": "${CONTENT_TYPE_JSON}"} Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} @@ -328,6 +328,39 @@ POST Policy Conflict Notification ${outputResponse}= Output response Set Global Variable ${response} ${outputResponse} +GET reach the notification endpoint + Log Trying to reach the notification endpoint using GET method. + Set Headers {"Accept": "${ACCEPT}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"} + GET ${callbackResp} + ${outputResponse}= Output response + Set Global Variable ${response} ${outputResponse} + +PUT notification endpoint + Log Trying to perform a PUT. This method should not be implemented. + Set Headers {"Accept": "${ACCEPT}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"} + Put ${callbackResp} + ${outputResponse}= Output response + Set Global Variable ${response} ${outputResponse} + +PATCH notification endpoint + Log Trying to perform a PATCH. This method should not be implemented. + Set Headers {"Accept": "${ACCEPT}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"} + Patch ${callbackResp} + ${outputResponse}= Output response + Set Global Variable ${response} ${outputResponse} + +DELETE notification endpoint + Log Trying to perform a DELETE. This method should not be implemented. + Set Headers {"Accept": "${ACCEPT}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"} + Delete ${callbackResp} + ${outputResponse}= Output response + Set Global Variable ${response} ${outputResponse} + + POST Policies Log Create policy instance by POST to ${apiRoot}/${apiName}/${apiVersion}/policies Set Headers {"Accept":"${ACCEPT}"} @@ -590,4 +623,9 @@ Determine Policy Content Type Run Keyword If ${json} Set Global Variable ${POLICY_CONTENT_TYPE} application/json Run Keyword If ${yaml} Set Global Variable ${POLICY_CONTENT_TYPE} application/yaml Run Keyword If ${zip} Set Global Variable ${POLICY_CONTENT_TYPE} application/zip - \ No newline at end of file + +Check that the Content-Type Header Is Set + Determine Policy Content Type + Log Validating content type + Should Be Equal ${response['headers']['Content-Type']} ${POLICY_CONTENT_TYPE} + Log Content Type validated \ No newline at end of file diff --git a/SOL012/PolicyManagement-API/SelectedVersionOfAnIndividualPolicy.robot b/SOL012/PolicyManagement-API/SelectedVersionOfAnIndividualPolicy.robot index a795fe5de..8e2603f4d 100644 --- a/SOL012/PolicyManagement-API/SelectedVersionOfAnIndividualPolicy.robot +++ b/SOL012/PolicyManagement-API/SelectedVersionOfAnIndividualPolicy.robot @@ -19,13 +19,14 @@ GET Information about the Selected Version of an Individual Policy - Successful [Documentation] Test ID: 10.3.1.4.2 ... Test title: GET Information about the Selected Version of an Individual Policy - Successful ... Test objective: The objective is to test The GET method fetches the content of the selected version of an individual policy. - ... Pre-conditions: Individual policy is available in the NFV-MANO. + ... Pre-conditions: Individual policy is available in the NFV-MANO. Policy contents are provided in the json/PolicyContent folder. ... Reference: Clause 5.5.5.3.2 - ETSI GS NFV-SOL 012 [7] v3.4.1 ... Config ID: Config_prod_NFV-MANO - ... Applicability: none + ... Applicability: The policy content type is either JSON, YAML or ZIP. ... Post-Conditions: none GET Selected Version of an Individual Policy Check HTTP Response Status Code Is 200 + Check that the Content-Type Header Is Set GET Information about the Selected Version of an Individual Policy - NOT FOUND [Documentation] Test ID: 10.3.1.4.3 diff --git a/SOL012/PolicyManagement-API/Subscriptions.robot b/SOL012/PolicyManagement-API/Subscriptions.robot index 978d94b88..7345df8c5 100644 --- a/SOL012/PolicyManagement-API/Subscriptions.robot +++ b/SOL012/PolicyManagement-API/Subscriptions.robot @@ -31,7 +31,6 @@ POST Create a new Subscription - DUPLICATION NOT ALLOWED Check HTTP Response Status Code Is 303 Check HTTP Response Header Contains Location Check Postcondition Individual Subscription Resource Returned in Location Header Is Available - POST Create a new Subscription - UNPROCESSABLE ENTITY [Documentation] Test ID: 10.3.1.6.3 @@ -162,9 +161,35 @@ GET Subscriptions as Paged Response GET Subscriptions Check HTTP Response Status Code Is 200 Check HTTP Response Header Contains Link - + +GET subscriptions with "exclude_default" and "fields" attribute selector + [Documentation] Test ID: 10.3.1.6.13 + ... Test title: GET subscriptions with "exclude_default" and "fields" attribute selector + ... Test objective: The objective is to retrieve the list of active subscriptions with "exclude_default" and "fields" attribute selector + ... Pre-conditions: + ... Reference: Clause 5.5.7.3.2 - ETSI GS NFV-SOL 012 [7] v3.4.1 + ... Config ID: Config_prod_NFV-MANO + ... Applicability: none + ... Post-Conditions: none + Get subscriptions with exclude_default and fields attribute selector + Check HTTP Response Status Code Is 200 + Check HTTP Response Body Json Schema Is subscriptions + +GET subscriptions - NOT FOUND + [Documentation] Test ID: 10.3.1.6.14 + ... Test title: GET subscriptions - NOT FOUND + ... Test objective: The objective is to test that the retrieval of list of subscriptions fails when using an invalid resource identifier. + ... Pre-conditions: none + ... Reference: Clause 5.5.7.3.2 - ETSI GS NFV-SOL 012 [7] v3.4.1 + ... Config ID: Config_prod_NFV-MANO + ... Applicability: none + ... Post-Conditions: none + GET Subscriptions + Check HTTP Response Status Code Is 404 + Check HTTP Response Body Json Schema Is ProblemDetails + PUT subscriptions - Method not implemented - [Documentation] Test ID: 10.3.1.6.13 + [Documentation] Test ID: 10.3.1.6.15 ... Test title: PUT subscriptions - Method not implemented ... Test objective: The objective is to test that PUT method cannot modify a policy management subscription. ... Pre-conditions: none @@ -176,7 +201,7 @@ PUT subscriptions - Method not implemented Check HTTP Response Status Code Is 405 PATCH subscriptions - Method not implemented - [Documentation] Test ID: 10.3.1.6.14 + [Documentation] Test ID: 10.3.1.6.16 ... Test title: PATCH subscriptions - Method not implemented ... Test objective: The objective is to test that PATCH method cannot modify a policy management subscription. ... Pre-conditions: none @@ -188,7 +213,7 @@ PATCH subscriptions - Method not implemented Check HTTP Response Status Code Is 405 DELETE subscriptions - Method not implemented - [Documentation] Test ID: 10.3.1.6.15 + [Documentation] Test ID: 10.3.1.6.17 ... Test title: DELETE subscriptions - Method not implemented ... Test objective: The objective is to test that DELETE method cannot delete a policy management subscription. ... Pre-conditions: none @@ -198,17 +223,4 @@ DELETE subscriptions - Method not implemented ... Post-Conditions: Subscriptions are not deleted DELETE subscriptions Check HTTP Response Status Code Is 405 - Check Postcondition Subscriptions Exist - -GET subscriptions with "exclude_default" and "fields" attribute selector - [Documentation] Test ID: 10.3.1.6.16 - ... Test title: GET subscriptions with "exclude_default" and "fields" attribute selector - ... Test objective: The objective is to retrieve the list of active subscriptions with "exclude_default" and "fields" attribute selector - ... Pre-conditions: - ... Reference: Clause 5.5.7.3.2 - ETSI GS NFV-SOL 012 [7] v3.4.1 - ... Config ID: Config_prod_NFV-MANO - ... Applicability: none - ... Post-Conditions: none - Get subscriptions with exclude_default and fields attribute selector - Check HTTP Response Status Code Is 200 - Check HTTP Response Body Json Schema Is subscriptions \ No newline at end of file + Check Postcondition Subscriptions Exist \ No newline at end of file -- GitLab From 4cba18a961235f60011d19524a7559100a63e103 Mon Sep 17 00:00:00 2001 From: Giacomo Bernini Date: Tue, 9 Feb 2021 15:26:26 +0100 Subject: [PATCH 13/18] fixed typo --- SOL012/PolicyManagement-API/IndividualPolicy.robot | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/SOL012/PolicyManagement-API/IndividualPolicy.robot b/SOL012/PolicyManagement-API/IndividualPolicy.robot index fe814c8c2..af7f59525 100644 --- a/SOL012/PolicyManagement-API/IndividualPolicy.robot +++ b/SOL012/PolicyManagement-API/IndividualPolicy.robot @@ -53,9 +53,9 @@ PUT an individual policy - Method not implemented PUT Individual Policy Check HTTP Response Status Code Is 405 -PATCH an individual ploicy - Successful +PATCH an individual policy - Successful [Documentation] Test ID: 10.3.1.3.5 - ... Test title: PATCH an individual ploicy - Successful + ... Test title: PATCH an individual policy - Successful ... Test objective: The objective is to test that an individual policy is modified successfully when there is no conflict using PATCH method. ... Pre-conditions: There should not exist a conflict as described in Reference. ... Reference: Clause 5.5.4.3.4 - ETSI GS NFV-SOL 012 [7] v3.4.1 @@ -66,9 +66,9 @@ PATCH an individual ploicy - Successful Check HTTP Response Status Code Is 200 Check HTTP Response Body Json Schema Is PolicyModifications -PATCH an individual ploicy - Conflict +PATCH an individual policy - Conflict [Documentation] Test ID: 10.3.1.3.6 - ... Test title: PATCH an individual ploicy - Conflict + ... Test title: PATCH an individual policy - Conflict ... Test objective: The objective is to test that an individual policy is not modified when there is a conflict using PATCH method. ... Pre-conditions: There exists a conflict as described in Reference. ... Reference: Clause 5.5.4.3.4 - ETSI GS NFV-SOL 012 [7] v3.4.1 -- GitLab From 6177d4645bec199b019f42bc1bc2c5f7d5e52973 Mon Sep 17 00:00:00 2001 From: Giacomo Bernini Date: Tue, 9 Feb 2021 15:56:28 +0100 Subject: [PATCH 14/18] updated policy related tests (subscriptions, ..) --- .../IndividualPolicy.robot | 5 +- .../PolicyManagementKeywords.robot | 56 +++++++++++++++++-- .../PolicyManagement-API/Subscriptions.robot | 4 ++ .../environment/variables.txt | 1 + .../InvalidPolicySubscriptionRequest.json | 11 ++-- .../jsons/PolicySubscriptionRequest.json | 2 +- 6 files changed, 66 insertions(+), 13 deletions(-) diff --git a/SOL012/PolicyManagement-API/IndividualPolicy.robot b/SOL012/PolicyManagement-API/IndividualPolicy.robot index af7f59525..193b9464a 100644 --- a/SOL012/PolicyManagement-API/IndividualPolicy.robot +++ b/SOL012/PolicyManagement-API/IndividualPolicy.robot @@ -75,7 +75,7 @@ PATCH an individual policy - Conflict ... Config ID: Config_prod_NFV-MANO ... Applicability: none ... Post-Conditions: none - PATCH Individual Subscription + PATCH Individual Policy Check HTTP Response Status Code Is 409 Check HTTP Response Body Json Schema Is ProblemDetails @@ -102,8 +102,7 @@ DELETE an individual policy - CONFLICT ... Config ID: Config_prod_NFV-MANO ... Applicability: none ... Post-Conditions: The individual policy is not deleted. - Check Activation Status of Policy Is ACTIVATED - DELETE Individual Policy + DELETE Individual Policy in status ACTIVATED Check HTTP Response Status Code Is 409 Check HTTP Response Body Json Schema Is ProblemDetails Check Postcondition Individual Policy is Not Deleted \ No newline at end of file diff --git a/SOL012/PolicyManagement-API/PolicyManagementKeywords.robot b/SOL012/PolicyManagement-API/PolicyManagementKeywords.robot index 92ff97890..50d69ad24 100644 --- a/SOL012/PolicyManagement-API/PolicyManagementKeywords.robot +++ b/SOL012/PolicyManagement-API/PolicyManagementKeywords.robot @@ -5,8 +5,15 @@ Library OperatingSystem Library JSONLibrary Library JSONSchemaLibrary schemas/ Library String +Library MockServerLibrary +Library Process *** Keywords *** +Create Sessions + Start Process java -jar ../../bin/mockserver-netty-5.5.0-jar-with-dependencies.jar -serverPort ${callback_port} alias=mockInstance + Wait For Process handle=mockInstance timeout=5s on_timeout=continue + Create Mock Session ${callback_uri}:${callback_port} + POST API Version Set Headers {"Accept":"${ACCEPT_JSON}"} Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} @@ -116,6 +123,13 @@ Check Postcondition Individual Subscription Resource Returned in Location Header Should Be Equal ${result['callbackUri']} ${subscription['callbackUri']} Log Validated Issued subscription is same as original +Check Postcondition Policy subscription is created + Log Going to check postcondition + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"} + GET ${apiRoot}/${apiName}/${apiVersion}/subscriptions/${response['body']['id']} + Integer response status 200 + Log Received a 200 OK as expected + Check HTTP Response Header Contains Link ${linkURL}= Get Value From Json ${response['headers']} $..Link Should Not Be Empty ${linkURL} @@ -130,9 +144,19 @@ POST subscriptions Set Headers {"Content-Type": "${CONTENT_TYPE}"} Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} ${body}= Get File jsons/PolicySubscriptionRequest.json + ${body}= Replace String ${body} \${callback_uri} ${callback_uri} + ${body}= Replace String ${body} \${callback_port} ${callback_port} + ${body}= Replace String ${body} \${callback_endpoint} ${callback_endpoint} + Log Creating mock request and response to handle GET operation on notification endpoint + &{notification_request}= Create Mock Request Matcher GET ${callback_endpoint} + &{notification_response}= Create Mock Response status_code=204 + Log Issue the subscription request + Create Mock Expectation ${notification_request} ${notification_response} Post ${apiRoot}/${apiName}/${apiVersion}/subscriptions ${body} ${outputResponse}= Output response Set Global Variable ${response} ${outputResponse} + Clear Requests ${callback_endpoint} + POST subscriptions NO DUPLICATION Log Trying to create a subscription with an already created content @@ -140,11 +164,19 @@ POST subscriptions NO DUPLICATION Pass Execution If ${NFVMANO_DUPLICATION} == 1 NFVMANO allows creation of redundant subscriptions Set Headers {"Accept":"${ACCEPT}"} Set Headers {"Content-Type": "${CONTENT_TYPE}"} - Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} ${body}= Get File jsons/PolicySubscriptionRequest.json + ${body}= Replace String ${body} \${callback_uri} ${callback_uri} + ${body}= Replace String ${body} \${callback_port} ${callback_port} + ${body}= Replace String ${body} \${callback_endpoint} ${callback_endpoint} + Log Creating mock request and response to handle GET operation on notification endpoint + &{notification_request}= Create Mock Request Matcher GET ${callback_endpoint} + &{notification_response}= Create Mock Response status_code=204 + Log Issue the subscription request + Create Mock Expectation ${notification_request} ${notification_response} Post ${apiRoot}/${apiName}/${apiVersion}/subscriptions ${body} ${outputResponse}= Output response Set Global Variable ${response} ${outputResponse} + Clear Requests ${callback_endpoint} POST subscriptions with Invalid Request Log Trying to create a subscription with invalid request body @@ -467,7 +499,7 @@ DELETE Policies Check Postcondition Policies Exist Log Checking that Policies exist Get Policies - + POST Individual Policy log Trying to perform a POST. This method should not be implemented Set Headers {"Accept":"${ACCEPT}"} @@ -511,7 +543,17 @@ DELETE Individual Policy Delete ${apiRoot}/${apiName}/${apiVersion}/policies/${policyId} ${outputResponse}= Output response Set Global Variable ${response} ${outputResponse} - + +DELETE Individual Policy in status ACTIVATED + Check Activation Status of Policy Is ACTIVATED + log Trying to delete an individual policy, no conflict + Set Headers {"Accept":"${ACCEPT}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Delete ${apiRoot}/${apiName}/${apiVersion}/policies/${policyId} + ${outputResponse}= Output response + Set Global Variable ${response} ${outputResponse} + + Check Postcondition Individual Policy is Deleted Log Check Postcondition individual policy is deleted GET individual Policy @@ -519,7 +561,13 @@ Check Postcondition Individual Policy is Deleted Check Activation Status of Policy Is [Arguments] ${status} - Get Individual Policy + Log Check Activation Status + Set Headers {"Accept":"${ACCEPT}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Get ${apiRoot}/${apiName}/${apiVersion}/policies/${policyIdInActivatedStatus} + ${outputResponse}= Output response + Set Global Variable ${response} ${outputResponse} + Check HTTP Response Status Code Is 200 Check HTTP Response Body Json Schema Is Policy Should be equal as strings ${response['body']['activationStatus']} ${status} diff --git a/SOL012/PolicyManagement-API/Subscriptions.robot b/SOL012/PolicyManagement-API/Subscriptions.robot index 7345df8c5..19636e128 100644 --- a/SOL012/PolicyManagement-API/Subscriptions.robot +++ b/SOL012/PolicyManagement-API/Subscriptions.robot @@ -1,4 +1,7 @@ *** Settings *** +Suite Setup Create Sessions +Suite Teardown Terminate All Processes kill=true +Library Process Resource environment/variables.txt Resource PolicyManagementKeywords.robot @@ -16,6 +19,7 @@ POST Create a new subscription Check HTTP Response Status Code Is 201 Check HTTP Response Body Json Schema Is PolicySubscription Check HTTP Response Header Contains Location + Check Postcondition Policy subscription is created POST Create a new Subscription - DUPLICATION NOT ALLOWED [Documentation] Test ID: 10.3.1.6.2 diff --git a/SOL012/PolicyManagement-API/environment/variables.txt b/SOL012/PolicyManagement-API/environment/variables.txt index dfbea0cf4..28310dd86 100644 --- a/SOL012/PolicyManagement-API/environment/variables.txt +++ b/SOL012/PolicyManagement-API/environment/variables.txt @@ -44,6 +44,7 @@ ${policyId} ${policyId1} ${policyId2} ${policyVersion} +${policyIdInActivatedStatus} ${callbackResp} 127.0.0.1 diff --git a/SOL012/PolicyManagement-API/jsons/InvalidPolicySubscriptionRequest.json b/SOL012/PolicyManagement-API/jsons/InvalidPolicySubscriptionRequest.json index c4f1a5b73..56d3a51dd 100644 --- a/SOL012/PolicyManagement-API/jsons/InvalidPolicySubscriptionRequest.json +++ b/SOL012/PolicyManagement-API/jsons/InvalidPolicySubscriptionRequest.json @@ -1,7 +1,8 @@ { - "id": "", - "timeStamp": "", - "status": "START", - "callbackUri": "http://127.0.0.1/subscribe", - "_links": "" + "filter": { + "notificationTypes": "PolicyChangeNotification", + "policyIds": "", + "changeTypes": "CREATE_POLICY" + }, + "callbackUri": "http://not-reachable-uri" } \ No newline at end of file diff --git a/SOL012/PolicyManagement-API/jsons/PolicySubscriptionRequest.json b/SOL012/PolicyManagement-API/jsons/PolicySubscriptionRequest.json index c6e6b6967..a743a5540 100644 --- a/SOL012/PolicyManagement-API/jsons/PolicySubscriptionRequest.json +++ b/SOL012/PolicyManagement-API/jsons/PolicySubscriptionRequest.json @@ -4,5 +4,5 @@ "policyIds": "", "changeTypes": "CREATE_POLICY" }, - "callbackUri": "http://127.0.0.1/subscribe" + "callbackUri": "${callback_uri}:${callback_port$}{callback_endpoint}" } \ No newline at end of file -- GitLab From e099e99e6d558c6e4b9d4dd3e367ce7b7fba508a Mon Sep 17 00:00:00 2001 From: Giacomo Bernini Date: Tue, 9 Feb 2021 16:04:08 +0100 Subject: [PATCH 15/18] updated config and usage of auth header --- .../PolicyManagementKeywords.robot | 94 +++++++++---------- .../environment/variables.txt | 3 +- 2 files changed, 49 insertions(+), 48 deletions(-) diff --git a/SOL012/PolicyManagement-API/PolicyManagementKeywords.robot b/SOL012/PolicyManagement-API/PolicyManagementKeywords.robot index 50d69ad24..5307989f8 100644 --- a/SOL012/PolicyManagement-API/PolicyManagementKeywords.robot +++ b/SOL012/PolicyManagement-API/PolicyManagementKeywords.robot @@ -16,70 +16,70 @@ Create Sessions POST API Version Set Headers {"Accept":"${ACCEPT_JSON}"} - Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"} Post ${apiRoot}/${apiName}/api_versions ${outputResponse}= Output response Set Global Variable ${response} ${outputResponse} GET API Version Set Headers {"Accept":"${ACCEPT_JSON}"} - Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"} Get ${apiRoot}/${apiName}/api_versions ${outputResponse}= Output response Set Global Variable ${response} ${outputResponse} PUT API Version Set Headers {"Accept":"${ACCEPT_JSON}"} - Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"} Put ${apiRoot}/${apiName}/api_versions ${outputResponse}= Output response Set Global Variable ${response} ${outputResponse} PATCH API Version Set Headers {"Accept":"${ACCEPT_JSON}"} - Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"} Patch ${apiRoot}/${apiName}/api_versions ${outputResponse}= Output response Set Global Variable ${response} ${outputResponse} DELETE API Version Set Headers {"Accept":"${ACCEPT_JSON}"} - Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"} Delete ${apiRoot}/${apiName}/api_versions ${outputResponse}= Output response Set Global Variable ${response} ${outputResponse} POST API Version with apiMajorVersion Set Headers {"Accept":"${ACCEPT_JSON}"} - Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"} Post ${apiRoot}/${apiName}/${apiVersion}/api_versions ${outputResponse}= Output response Set Global Variable ${response} ${outputResponse} GET API Version with apiMajorVersion Set Headers {"Accept":"${ACCEPT_JSON}"} - Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"} Get ${apiRoot}/${apiName}/${apiVersion}/api_versions ${outputResponse}= Output response Set Global Variable ${response} ${outputResponse} PUT API Version with apiMajorVersion Set Headers {"Accept":"${ACCEPT_JSON}"} - Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"} Put ${apiRoot}/${apiName}/${apiVersion}/api_versions ${outputResponse}= Output response Set Global Variable ${response} ${outputResponse} PATCH API Version with apiMajorVersion Set Headers {"Accept":"${ACCEPT_JSON}"} - Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"} Patch ${apiRoot}/${apiName}/${apiVersion}/api_versions ${outputResponse}= Output response Set Global Variable ${response} ${outputResponse} DELETE API Version with apiMajorVersion Set Headers {"Accept":"${ACCEPT_JSON}"} - Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"} Delete ${apiRoot}/${apiName}/${apiVersion}/api_versions ${outputResponse}= Output response Set Global Variable ${response} ${outputResponse} @@ -103,7 +103,7 @@ Check HTTP Response Header Contains Check subscription existence Set Headers {"Accept":"${ACCEPT}"} Set Headers {"Content-Type": "${CONTENT_TYPE}"} - Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"} Get ${apiRoot}/${apiName}/${apiVersion}/subscriptions/${subscriptionId} Integer response status 200 @@ -142,7 +142,7 @@ POST subscriptions Log Create subscription instance by POST to ${apiRoot}/${apiName}/${apiVersion}/subscriptions Set Headers {"Accept":"${ACCEPT}"} Set Headers {"Content-Type": "${CONTENT_TYPE}"} - Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"} ${body}= Get File jsons/PolicySubscriptionRequest.json ${body}= Replace String ${body} \${callback_uri} ${callback_uri} ${body}= Replace String ${body} \${callback_port} ${callback_port} @@ -182,7 +182,7 @@ POST subscriptions with Invalid Request Log Trying to create a subscription with invalid request body Set Headers {"Accept":"${ACCEPT}"} Set Headers {"Content-Type": "${CONTENT_TYPE}"} - Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"} ${body}= Get File jsons/InvalidPolicySubscriptionRequest.json Post ${apiRoot}/${apiName}/${apiVersion}/subscriptions ${body} ${outputResponse}= Output response @@ -192,7 +192,7 @@ GET Subscriptions Log Get the list of active subscriptions Set Headers {"Accept":"${ACCEPT}"} Set Headers {"Content-Type": "${CONTENT_TYPE}"} - Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"} Log Execute Query and validate response Get ${apiRoot}/${apiName}/${apiVersion}/subscriptions ${outputResponse}= Output response @@ -258,7 +258,7 @@ PUT subscriptions Log Trying to perform a PUT. This method should not be implemented Set Headers {"Accept":"${ACCEPT}"} Set Headers {"Content-Type": "${CONTENT_TYPE}"} - Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"} Put ${apiRoot}/${apiName}/${apiVersion}/subscriptions ${outputResponse}= Output response Set Global Variable ${response} ${outputResponse} @@ -267,7 +267,7 @@ PATCH subscriptions Log Trying to perform a PATCH. This method should not be implemented Set Headers {"Accept":"${ACCEPT}"} Set Headers {"Content-Type": "${CONTENT_TYPE}"} - Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"} Patch ${apiRoot}/${apiName}/${apiVersion}/subscriptions ${outputResponse}= Output response Set Global Variable ${response} ${outputResponse} @@ -276,7 +276,7 @@ DELETE subscriptions Log Trying to perform a DELETE. This method should not be implemented Set Headers {"Accept":"${ACCEPT}"} Set Headers {"Content-Type": "${CONTENT_TYPE}"} - Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"} Delete ${apiRoot}/${apiName}/${apiVersion}/subscriptions ${outputResponse}= Output response Set Global Variable ${response} ${outputResponse} @@ -285,7 +285,7 @@ POST Individual Subscription log Trying to perform a POST. This method should not be implemented Set Headers {"Accept":"${ACCEPT}"} Set Headers {"Content-Type": "${CONTENT_TYPE}"} - Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"} Post ${apiRoot}/${apiName}/${apiVersion}/subscriptions/${subscriptionId} ${outputResponse}= Output response Set Global Variable ${response} ${outputResponse} @@ -293,7 +293,7 @@ POST Individual Subscription GET Individual subscription log Trying to get information about an individual subscription Set Headers {"Accept":"${ACCEPT}"} - Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"} Get ${apiRoot}/${apiName}/${apiVersion}/subscriptions/${subscriptionId} ${outputResponse}= Output response Set Global Variable ${response} ${outputResponse} @@ -302,7 +302,7 @@ PUT Individual Subscription log Trying to perform a PUT. This method should not be implemented Set Headers {"Accept":"${ACCEPT}"} Set Headers {"Content-Type": "${CONTENT_TYPE}"} - Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"} Put ${apiRoot}/${apiName}/${apiVersion}/subscriptions/${subscriptionId} ${outputResponse}= Output response Set Global Variable ${response} ${outputResponse} @@ -311,7 +311,7 @@ PATCH Individual Subscription log Trying to perform a PATCH. This method should not be implemented Set Headers {"Accept":"${ACCEPT}"} Set Headers {"Content-Type": "${CONTENT_TYPE}"} - Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"} Patch ${apiRoot}/${apiName}/${apiVersion}/subscriptions/${subscriptionId} ${outputResponse}= Output response Set Global Variable ${response} ${outputResponse} @@ -319,7 +319,7 @@ PATCH Individual Subscription DELETE Individual subscription log Trying to delete an individual subscription Set Headers {"Accept":"${ACCEPT}"} - Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"} Delete ${apiRoot}/${apiName}/${apiVersion}/subscriptions/${subscriptionId} ${outputResponse}= Output response Set Global Variable ${response} ${outputResponse} @@ -332,7 +332,7 @@ Check Postcondition Individual Subscription is Deleted Check resource existence and get CallbackUri Set Headers {"Accept":"${ACCEPT_JSON}"} Set Headers {"Content-Type": "${CONTENT_TYPE_JSON}"} - Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"} Get ${apiRoot}/${apiName}/${apiVersion}/subscriptions/${subscriptionId} Integer response status 200 Validate Json response body PolicySubscription.schema.json @@ -342,7 +342,7 @@ POST Policy Change Notification log Trying to perform a POST to deliver notification. Set Headers {"Accept":"${ACCEPT_JSON}"} Set Headers {"Content-Type": "${CONTENT_TYPE_JSON}"} - Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"} ${template} = Get File jsons/PolicyChangeNotification.json ${body}= Format String ${template} subscriptionId=${subscriptionId} Post ${callbackResp} ${body} @@ -353,7 +353,7 @@ POST Policy Conflict Notification log Trying to perform a POST to deliver notification. Set Headers {"Accept":"${ACCEPT_JSON}"} Set Headers {"Content-Type": "${CONTENT_TYPE_JSON}"} - Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"} ${template} = Get File jsons/PolicyConflictNotification.json ${body}= Format String ${template} subscriptionId=${subscriptionId} policyId1=${policyId1} policyId2=${policyId2} Post ${callbackResp} ${body} @@ -397,7 +397,7 @@ POST Policies Log Create policy instance by POST to ${apiRoot}/${apiName}/${apiVersion}/policies Set Headers {"Accept":"${ACCEPT}"} Set Headers {"Content-Type": "${CONTENT_TYPE}"} - Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"} ${body}= Get File jsons/CreatePolicyRequest.json Post ${apiRoot}/${apiName}/${apiVersion}/policies ${body} ${outputResponse}= Output response @@ -407,7 +407,7 @@ GET Policies Log Get the list of existing policies Set Headers {"Accept":"${ACCEPT}"} Set Headers {"Content-Type": "${CONTENT_TYPE}"} - Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"} Log Execute Query and validate response Get ${apiRoot}/${apiName}/${apiVersion}/policies ${outputResponse}= Output response @@ -473,7 +473,7 @@ PUT Policies Log Trying to perform a PUT. This method should not be implemented Set Headers {"Accept":"${ACCEPT}"} Set Headers {"Content-Type": "${CONTENT_TYPE}"} - Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"} Put ${apiRoot}/${apiName}/${apiVersion}/policies ${outputResponse}= Output response Set Global Variable ${response} ${outputResponse} @@ -482,7 +482,7 @@ PATCH Policies Log Trying to perform a PATCH. This method should not be implemented Set Headers {"Accept":"${ACCEPT}"} Set Headers {"Content-Type": "${CONTENT_TYPE}"} - Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"} Patch ${apiRoot}/${apiName}/${apiVersion}/policies ${outputResponse}= Output response Set Global Variable ${response} ${outputResponse} @@ -491,7 +491,7 @@ DELETE Policies Log Trying to perform a DELETE. This method should not be implemented Set Headers {"Accept":"${ACCEPT}"} Set Headers {"Content-Type": "${CONTENT_TYPE}"} - Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"} Delete ${apiRoot}/${apiName}/${apiVersion}/policies ${outputResponse}= Output response Set Global Variable ${response} ${outputResponse} @@ -504,7 +504,7 @@ POST Individual Policy log Trying to perform a POST. This method should not be implemented Set Headers {"Accept":"${ACCEPT}"} Set Headers {"Content-Type": "${CONTENT_TYPE}"} - Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"} Post ${apiRoot}/${apiName}/${apiVersion}/policies/${policyId} ${outputResponse}= Output response Set Global Variable ${response} ${outputResponse} @@ -512,7 +512,7 @@ POST Individual Policy GET Individual Policy log Trying to get information about an individual policy Set Headers {"Accept":"${ACCEPT}"} - Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"} Get ${apiRoot}/${apiName}/${apiVersion}/policies/${policyId} ${outputResponse}= Output response Set Global Variable ${response} ${outputResponse} @@ -521,7 +521,7 @@ PUT Individual Policy log Trying to perform a PUT. This method should not be implemented Set Headers {"Accept":"${ACCEPT}"} Set Headers {"Content-Type": "${CONTENT_TYPE}"} - Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"} Put ${apiRoot}/${apiName}/${apiVersion}/policies/${policyId} ${outputResponse}= Output response Set Global Variable ${response} ${outputResponse} @@ -530,7 +530,7 @@ PATCH Individual Policy Log Modify individual policy instance by PATCH to ${apiRoot}/${apiName}/${apiVersion}/policies/${policyId} Set Headers {"Accept":"${ACCEPT}"} Set Headers {"Content-Type": "${CONTENT_TYPE}"} - Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"} ${body}= Get File jsons/PolicyModifications.json Patch ${apiRoot}/${apiName}/${apiVersion}/policies/${policyId} ${body} ${outputResponse}= Output response @@ -539,7 +539,7 @@ PATCH Individual Policy DELETE Individual Policy log Trying to delete an individual policy, no conflict Set Headers {"Accept":"${ACCEPT}"} - Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"} Delete ${apiRoot}/${apiName}/${apiVersion}/policies/${policyId} ${outputResponse}= Output response Set Global Variable ${response} ${outputResponse} @@ -548,7 +548,7 @@ DELETE Individual Policy in status ACTIVATED Check Activation Status of Policy Is ACTIVATED log Trying to delete an individual policy, no conflict Set Headers {"Accept":"${ACCEPT}"} - Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"} Delete ${apiRoot}/${apiName}/${apiVersion}/policies/${policyId} ${outputResponse}= Output response Set Global Variable ${response} ${outputResponse} @@ -563,7 +563,7 @@ Check Activation Status of Policy Is [Arguments] ${status} Log Check Activation Status Set Headers {"Accept":"${ACCEPT}"} - Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"} Get ${apiRoot}/${apiName}/${apiVersion}/policies/${policyIdInActivatedStatus} ${outputResponse}= Output response Set Global Variable ${response} ${outputResponse} @@ -580,7 +580,7 @@ POST Selected Version of an Individual Policy Log Trying to perform a POST. This method should not be implemented Set Headers {"Accept":"${ACCEPT}"} Set Headers {"Content-Type": "${CONTENT_TYPE}"} - Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"} Post ${apiRoot}/${apiName}/${apiVersion}/policies/${policyId}/selected_version ${outputResponse}= Output response Set Global Variable ${response} ${outputResponse} @@ -588,7 +588,7 @@ POST Selected Version of an Individual Policy GET Selected Version of an Individual Policy log Trying to get information about the selected version of an individual policy Set Headers {"Accept":"${ACCEPT}"} - Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"} Get ${apiRoot}/${apiName}/${apiVersion}/policies/${policyId}/selected_version ${outputResponse}= Output response Set Global Variable ${response} ${outputResponse} @@ -597,7 +597,7 @@ PUT Selected Version of an Individual Policy log Trying to perform a PUT. This method should not be implemented Set Headers {"Accept":"${ACCEPT}"} Set Headers {"Content-Type": "${CONTENT_TYPE}"} - Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"} Put ${apiRoot}/${apiName}/${apiVersion}/policies/${policyId}/selected_version ${outputResponse}= Output response Set Global Variable ${response} ${outputResponse} @@ -606,7 +606,7 @@ PATCH Selected Version of an Individual Policy log Trying to perform a PATCH. This method should not be implemented Set Headers {"Accept":"${ACCEPT}"} Set Headers {"Content-Type": "${CONTENT_TYPE}"} - Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"} Patch ${apiRoot}/${apiName}/${apiVersion}/policies/${policyId}/selected_version ${outputResponse}= Output response Set Global Variable ${response} ${outputResponse} @@ -615,7 +615,7 @@ DELETE Selected Version of an Individual Policy log Trying to perform a DELETE. This method should not be implemented Set Headers {"Accept":"${ACCEPT}"} Set Headers {"Content-Type": "${CONTENT_TYPE}"} - Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"} Delete ${apiRoot}/${apiName}/${apiVersion}/policies/${policyId}/selected_version ${outputResponse}= Output response Set Global Variable ${response} ${outputResponse} @@ -624,7 +624,7 @@ POST Particular Version of an Individual Policy Log Trying to perform a POST. This method should not be implemented Set Headers {"Accept":"${ACCEPT}"} Set Headers {"Content-Type": "${CONTENT_TYPE}"} - Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"} Post ${apiRoot}/${apiName}/${apiVersion}/policies/${policyId}/versions/${policyVersion} ${outputResponse}= Output response Set Global Variable ${response} ${outputResponse} @@ -632,7 +632,7 @@ POST Particular Version of an Individual Policy GET Particular Version of an Individual Policy log Trying to get information about a particular version of an individual policy Set Headers {"Accept":"${ACCEPT}"} - Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"} Get ${apiRoot}/${apiName}/${apiVersion}/policies/${policyId}/versions/${policyVersion} ${outputResponse}= Output response Set Global Variable ${response} ${outputResponse} @@ -642,7 +642,7 @@ PUT Particular Version of an Individual Policy Set Headers {"Accept":"${ACCEPT}"} Determine Policy Content Type Set Headers {"Content-Type": "${POLICY_CONTENT_TYPE}"} - Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"} ${body}= Get File ${POLICY_CONTENT_FILENAME} Put ${apiRoot}/${apiName}/${apiVersion}/policies/${policyId}/versions/${policyVersion} ${body} ${outputResponse}= Output response @@ -651,7 +651,7 @@ PUT Particular Version of an Individual Policy PATCH Particular Version of an Individual Policy log Trying to perform a PATCH. This method should not be implemented Set Headers {"Accept":"${ACCEPT}"} - Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"} Patch ${apiRoot}/${apiName}/${apiVersion}/policies/${policyId}/versions/${policyVersion} ${outputResponse}= Output response Set Global Variable ${response} ${outputResponse} @@ -659,7 +659,7 @@ PATCH Particular Version of an Individual Policy DELETE Particular Version of an Individual Policy Log Trying to DELETE a particular version of an individual policy. Set Headers {"Accept":"${ACCEPT}"} - Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"} Delete ${apiRoot}/${apiName}/${apiVersion}/policies/${policyId}/versions/${policyVersion} ${outputResponse}= Output response Set Global Variable ${response} ${outputResponse} diff --git a/SOL012/PolicyManagement-API/environment/variables.txt b/SOL012/PolicyManagement-API/environment/variables.txt index 28310dd86..0ed28acac 100644 --- a/SOL012/PolicyManagement-API/environment/variables.txt +++ b/SOL012/PolicyManagement-API/environment/variables.txt @@ -2,7 +2,8 @@ ${NFVMANO_HOST} localhost # Hostname of the NFVO ${NFVMANO_PORT} 8081 # Listening port of the NFVO ${NFVMANO_SCHEMA} https -${AUTHORIZATION} Bearer QWxhZGRpbjpvcGVuIHNlc2FtZQ== +${AUTHORIZATION_HEADER} Authorization +${AUTHORIZATION_TOKEN} Bearer QWxhZGRpbjpvcGVuIHNlc2FtZQ== ${CONTENT_TYPE} application/json ${CONTENT_TYPE_JSON} application/json ${ACCEPT} application/json -- GitLab From 80050ae90bc79d9ade9bd7f2e7af8baa2b875517 Mon Sep 17 00:00:00 2001 From: hammad zafar Date: Wed, 10 Feb 2021 12:49:36 +0500 Subject: [PATCH 16/18] updated usage of auth header --- .../PolicyManagementKeywords.robot | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/SOL012/PolicyManagement-API/PolicyManagementKeywords.robot b/SOL012/PolicyManagement-API/PolicyManagementKeywords.robot index 5307989f8..8dcd82f0f 100644 --- a/SOL012/PolicyManagement-API/PolicyManagementKeywords.robot +++ b/SOL012/PolicyManagement-API/PolicyManagementKeywords.robot @@ -109,7 +109,7 @@ Check subscription existence Check Postcondition Individual Subscription Resource Returned in Location Header Is Available Log Going to check postcondition - Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"} GET ${response['headers']['Location']} Integer response status 200 Log Received a 200 OK as expected @@ -125,7 +125,7 @@ Check Postcondition Individual Subscription Resource Returned in Location Header Check Postcondition Policy subscription is created Log Going to check postcondition - Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"} GET ${apiRoot}/${apiName}/${apiVersion}/subscriptions/${response['body']['id']} Integer response status 200 Log Received a 200 OK as expected @@ -201,7 +201,7 @@ GET Subscriptions Get subscriptions with all_fields attribute selector Log Get the list of active subscriptions, using fields Set Headers {"Accept": "${ACCEPT_JSON}"} - Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"} GET ${apiRoot}/${apiName}/${apiVersion}/subscriptions?all_fields ${output}= Output response Set Suite Variable ${response} ${output} @@ -209,7 +209,7 @@ Get subscriptions with all_fields attribute selector Get subscriptions with exclude_default attribute selector Log Get the list of active subscriptions, using fields Set Headers {"Accept": "${ACCEPT_JSON}"} - Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"} GET ${apiRoot}/${apiName}/${apiVersion}/subscriptions?exclude_default ${output}= Output response Set Suite Variable ${response} ${output} @@ -217,7 +217,7 @@ Get subscriptions with exclude_default attribute selector Get subscriptions with fields attribute selector Log Get the list of active subscriptions, using fields Set Headers {"Accept": "${ACCEPT_JSON}"} - Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"} GET ${apiRoot}/${apiName}/${apiVersion}/subscriptions?fields=${fields} ${output}= Output response Set Suite Variable ${response} ${output} @@ -225,7 +225,7 @@ Get subscriptions with fields attribute selector Get subscriptions with exclude_fields attribute selector Log Get the list of active subscriptions, using fields Set Headers {"Accept": "${ACCEPT_JSON}"} - Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"} GET ${apiRoot}/${apiName}/${apiVersion}/subscriptions?exclude_fields=${fields} ${output}= Output response Set Suite Variable ${response} ${output} @@ -233,7 +233,7 @@ Get subscriptions with exclude_fields attribute selector GET subscriptions with filter Log Get the list of active subscriptions using a filter Set Headers {"Accept": "${ACCEPT}"} - Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"} GET ${apiRoot}/${apiName}/${apiVersion}/subscriptions?${sub_filter} ${outputResponse}= Output response Set Global Variable ${response} ${outputResponse} @@ -241,7 +241,7 @@ GET subscriptions with filter Get subscriptions - invalid filter Log Get the list of active subscriptions using an invalid filter Set Headers {"Accept": "${ACCEPT}"} - Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"} GET ${apiRoot}/${apiName}/${apiVersion}/subscriptions?${sub_filter_invalid} ${outputResponse}= Output response Set Global Variable ${response} ${outputResponse} @@ -249,7 +249,7 @@ Get subscriptions - invalid filter Get subscriptions with exclude_default and fields attribute selector Log Get the list of active subscriptions, using fields Set Headers {"Accept": "${ACCEPT_JSON}"} - Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"} GET ${apiRoot}/${apiName}/${apiVersion}/subscriptions?fields=${fields}&exclude_default ${output}= Output response Set Suite Variable ${response} ${output} @@ -363,7 +363,7 @@ POST Policy Conflict Notification GET reach the notification endpoint Log Trying to reach the notification endpoint using GET method. Set Headers {"Accept": "${ACCEPT}"} - Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"} GET ${callbackResp} ${outputResponse}= Output response Set Global Variable ${response} ${outputResponse} @@ -371,7 +371,7 @@ GET reach the notification endpoint PUT notification endpoint Log Trying to perform a PUT. This method should not be implemented. Set Headers {"Accept": "${ACCEPT}"} - Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"} Put ${callbackResp} ${outputResponse}= Output response Set Global Variable ${response} ${outputResponse} @@ -379,7 +379,7 @@ PUT notification endpoint PATCH notification endpoint Log Trying to perform a PATCH. This method should not be implemented. Set Headers {"Accept": "${ACCEPT}"} - Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"} Patch ${callbackResp} ${outputResponse}= Output response Set Global Variable ${response} ${outputResponse} @@ -387,7 +387,7 @@ PATCH notification endpoint DELETE notification endpoint Log Trying to perform a DELETE. This method should not be implemented. Set Headers {"Accept": "${ACCEPT}"} - Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"} Delete ${callbackResp} ${outputResponse}= Output response Set Global Variable ${response} ${outputResponse} @@ -416,7 +416,7 @@ GET Policies GET Policies with filter Log Get the list of existing policies using a filter Set Headers {"Accept": "${ACCEPT}"} - Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"} GET ${apiRoot}/${apiName}/${apiVersion}/policies?${sub_filter} ${outputResponse}= Output response Set Global Variable ${response} ${outputResponse} @@ -424,7 +424,7 @@ GET Policies with filter Get Policies - invalid filter Log Get the list of existing policies using an invalid filter Set Headers {"Accept": "${ACCEPT}"} - Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"} GET ${apiRoot}/${apiName}/${apiVersion}/policies?${sub_filter_invalid} ${outputResponse}= Output response Set Global Variable ${response} ${outputResponse} @@ -432,7 +432,7 @@ Get Policies - invalid filter Get Policies with all_fields attribute selector Log Get the list of existing policies, using fields Set Headers {"Accept": "${ACCEPT_JSON}"} - Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"} GET ${apiRoot}/${apiName}/${apiVersion}/policies?all_fields ${output}= Output response Set Suite Variable ${response} ${output} @@ -440,7 +440,7 @@ Get Policies with all_fields attribute selector Get Policies with exclude_default attribute selector Log Get the list of existing policies, using fields Set Headers {"Accept": "${ACCEPT_JSON}"} - Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"} GET ${apiRoot}/${apiName}/${apiVersion}/policies?exclude_default ${output}= Output response Set Suite Variable ${response} ${output} @@ -448,7 +448,7 @@ Get Policies with exclude_default attribute selector Get Policies with fields attribute selector Log Get the list of existing policies, using fields Set Headers {"Accept": "${ACCEPT_JSON}"} - Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"} GET ${apiRoot}/${apiName}/${apiVersion}/policies?fields=${fields} ${output}= Output response Set Suite Variable ${response} ${output} @@ -456,7 +456,7 @@ Get Policies with fields attribute selector Get Policies with exclude_fields attribute selector Log Get the list of existing policies, using fields Set Headers {"Accept": "${ACCEPT_JSON}"} - Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"} GET ${apiRoot}/${apiName}/${apiVersion}/policies?exclude_fields=${fields} ${output}= Output response Set Suite Variable ${response} ${output} @@ -464,7 +464,7 @@ Get Policies with exclude_fields attribute selector Get Policies with exclude_default and fields attribute selector Log Get the list of existing policies, using fields Set Headers {"Accept": "${ACCEPT_JSON}"} - Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"} GET ${apiRoot}/${apiName}/${apiVersion}/policies?fields=${fields}&exclude_default ${output}= Output response Set Suite Variable ${response} ${output} -- GitLab From 99fc4a871fdd227f1aa6459884dd3457c30892f6 Mon Sep 17 00:00:00 2001 From: hammad zafar Date: Wed, 10 Feb 2021 14:16:57 +0500 Subject: [PATCH 17/18] updated paged response test cases for Policies and Subscriptions resources --- .../IndividualPolicy.robot | 2 +- .../IndividualSubscription.robot | 2 +- SOL012/PolicyManagement-API/Policies.robot | 27 +++++------------- .../PolicyManagementKeywords.robot | 28 +++++++++++++++++++ .../PolicyManagement-API/Subscriptions.robot | 27 +++++------------- .../environment/variables.txt | 4 +++ 6 files changed, 48 insertions(+), 42 deletions(-) diff --git a/SOL012/PolicyManagement-API/IndividualPolicy.robot b/SOL012/PolicyManagement-API/IndividualPolicy.robot index 193b9464a..7deca87f0 100644 --- a/SOL012/PolicyManagement-API/IndividualPolicy.robot +++ b/SOL012/PolicyManagement-API/IndividualPolicy.robot @@ -37,7 +37,7 @@ GET Information about an individual policy - NOT FOUND ... Config ID: Config_prod_NFV-MANO ... Applicability: none ... Post-Conditions: none - GET Individual Policy + GET Individual Policy with Invalid URI Check HTTP Response Status Code Is 404 Check HTTP Response Body Json Schema Is ProblemDetails diff --git a/SOL012/PolicyManagement-API/IndividualSubscription.robot b/SOL012/PolicyManagement-API/IndividualSubscription.robot index 177c5c6a3..234802422 100644 --- a/SOL012/PolicyManagement-API/IndividualSubscription.robot +++ b/SOL012/PolicyManagement-API/IndividualSubscription.robot @@ -37,7 +37,7 @@ GET Information about an individual subscription - NOT FOUND ... Config ID: Config_prod_NFV-MANO ... Applicability: none ... Post-Conditions: none - GET Individual subscription + GET Individual subscription with Invalid URI Check HTTP Response Status Code Is 404 Check HTTP Response Body Json Schema Is ProblemDetails diff --git a/SOL012/PolicyManagement-API/Policies.robot b/SOL012/PolicyManagement-API/Policies.robot index 9c3c13f63..88678f31c 100644 --- a/SOL012/PolicyManagement-API/Policies.robot +++ b/SOL012/PolicyManagement-API/Policies.robot @@ -63,9 +63,9 @@ GET Policies - Bad Request Response too Big ... Pre-conditions: none ... Reference: Clause 5.5.3.3.2 - ETSI GS NFV-SOL 012 [7] v3.4.1 ... Config ID: Config_prod_NFV-MANO - ... Applicability: none + ... Applicability: NFV-MANO does not support paged response. ... Post-Conditions: none - GET Policies + GET Policies without Paging support Check HTTP Response Status Code Is 400 Check HTTP Response Body Json Schema Is ProblemDetails @@ -141,27 +141,14 @@ GET Policies as Paged Response ... Pre-conditions: none ... Reference: Clause 5.5.3.3.2 - ETSI GS NFV-SOL 012 [7] v3.4.1 ... Config ID: Config_prod_NFV-MANO - ... Applicability: NFV-MANO supports paged response + ... Applicability: NFV-MANO supports paged response. ... Post-Conditions: none - GET Policies + GET Policies with Paging support Check HTTP Response Status Code Is 200 Check HTTP Response Header Contains Link -GET Policies - NOT FOUND - [Documentation] Test ID: 10.3.1.2.12 - ... Test title: GET Policies - NOT FOUND - ... Test objective: The objective is to test that the retrieval of list of policies fails when using an invalid resource identifier. - ... Pre-conditions: none - ... Reference: Clause 5.5.3.3.2 - ETSI GS NFV-SOL 012 [7] v3.4.1 - ... Config ID: Config_prod_NFV-MANO - ... Applicability: none - ... Post-Conditions: none - GET Policies - Check HTTP Response Status Code Is 404 - Check HTTP Response Body Json Schema Is ProblemDetails - PUT Policies - Method not implemented - [Documentation] Test ID: 10.3.1.2.13 + [Documentation] Test ID: 10.3.1.2.12 ... Test title: PUT Policies - Method not implemented ... Test objective: The objective is to test that PUT method cannot modify policies. ... Pre-conditions: none @@ -173,7 +160,7 @@ PUT Policies - Method not implemented Check HTTP Response Status Code Is 405 PATCH Policies - Method not implemented - [Documentation] Test ID: 10.3.1.2.14 + [Documentation] Test ID: 10.3.1.2.13 ... Test title: PATCH Policies - Method not implemented ... Test objective: The objective is to test that PATCH method cannot modify policies. ... Pre-conditions: none @@ -185,7 +172,7 @@ PATCH Policies - Method not implemented Check HTTP Response Status Code Is 405 DELETE Policies - Method not implemented - [Documentation] Test ID: 10.3.1.2.15 + [Documentation] Test ID: 10.3.1.2.14 ... Test title: DELETE Policies - Method not implemented ... Test objective: The objective is to test that DELETE method cannot delete policies. ... Pre-conditions: none diff --git a/SOL012/PolicyManagement-API/PolicyManagementKeywords.robot b/SOL012/PolicyManagement-API/PolicyManagementKeywords.robot index 8dcd82f0f..3a14187ef 100644 --- a/SOL012/PolicyManagement-API/PolicyManagementKeywords.robot +++ b/SOL012/PolicyManagement-API/PolicyManagementKeywords.robot @@ -254,6 +254,12 @@ Get subscriptions with exclude_default and fields attribute selector ${output}= Output response Set Suite Variable ${response} ${output} +Get subscriptions without Paging support + Run Keyword If ${PAGING_SUPPORTED} == 0 Get subscriptions + +Get subscriptions with Paging support + Run Keyword If ${PAGING_SUPPORTED} == 1 Get subscriptions + PUT subscriptions Log Trying to perform a PUT. This method should not be implemented Set Headers {"Accept":"${ACCEPT}"} @@ -298,6 +304,14 @@ GET Individual subscription ${outputResponse}= Output response Set Global Variable ${response} ${outputResponse} +GET Individual subscription with Invalid URI + log Trying to get information about an individual subscription with invalid subscription ID + Set Headers {"Accept":"${ACCEPT}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"} + Get ${apiRoot}/${apiName}/${apiVersion}/subscriptions/${invalidSubscriptionId} + ${outputResponse}= Output response + Set Global Variable ${response} ${outputResponse} + PUT Individual Subscription log Trying to perform a PUT. This method should not be implemented Set Headers {"Accept":"${ACCEPT}"} @@ -468,6 +482,12 @@ Get Policies with exclude_default and fields attribute selector GET ${apiRoot}/${apiName}/${apiVersion}/policies?fields=${fields}&exclude_default ${output}= Output response Set Suite Variable ${response} ${output} + +GET Policies without Paging support + Run Keyword If ${PAGING_SUPPORTED} == 0 Get Policies + +GET Policies with Paging support + Run Keyword If ${PAGING_SUPPORTED} == 1 Get Policies PUT Policies Log Trying to perform a PUT. This method should not be implemented @@ -517,6 +537,14 @@ GET Individual Policy ${outputResponse}= Output response Set Global Variable ${response} ${outputResponse} +GET Individual Policy with Invalid URI + log Trying to get information about an individual policy with invalid policy ID + Set Headers {"Accept":"${ACCEPT}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"} + Get ${apiRoot}/${apiName}/${apiVersion}/policies/${invalidPolicyId} + ${outputResponse}= Output response + Set Global Variable ${response} ${outputResponse} + PUT Individual Policy log Trying to perform a PUT. This method should not be implemented Set Headers {"Accept":"${ACCEPT}"} diff --git a/SOL012/PolicyManagement-API/Subscriptions.robot b/SOL012/PolicyManagement-API/Subscriptions.robot index 19636e128..ccbaa5620 100644 --- a/SOL012/PolicyManagement-API/Subscriptions.robot +++ b/SOL012/PolicyManagement-API/Subscriptions.robot @@ -95,9 +95,9 @@ GET subscriptions - Bad Request Response too Big ... Pre-conditions: none ... Reference: Clause 5.5.7.3.2 - ETSI GS NFV-SOL 012 [7] v3.4.1 ... Config ID: Config_prod_NFV-MANO - ... Applicability: none + ... Applicability: NFV-MANO does not support paged response. ... Post-Conditions: none - GET Subscriptions + GET Subscriptions without Paging support Check HTTP Response Status Code Is 400 Check HTTP Response Body Json Schema Is ProblemDetails @@ -160,9 +160,9 @@ GET Subscriptions as Paged Response ... Pre-conditions: none ... Reference: Clause 5.5.7.3.2 - ETSI GS NFV-SOL 012 [7] v3.4.1 ... Config ID: Config_prod_NFV-MANO - ... Applicability: NFV-MANO supports paged response + ... Applicability: NFV-MANO supports paged response. ... Post-Conditions: none - GET Subscriptions + GET Subscriptions with Paging support Check HTTP Response Status Code Is 200 Check HTTP Response Header Contains Link @@ -178,22 +178,9 @@ GET subscriptions with "exclude_default" and "fields" attribute selector Get subscriptions with exclude_default and fields attribute selector Check HTTP Response Status Code Is 200 Check HTTP Response Body Json Schema Is subscriptions - -GET subscriptions - NOT FOUND - [Documentation] Test ID: 10.3.1.6.14 - ... Test title: GET subscriptions - NOT FOUND - ... Test objective: The objective is to test that the retrieval of list of subscriptions fails when using an invalid resource identifier. - ... Pre-conditions: none - ... Reference: Clause 5.5.7.3.2 - ETSI GS NFV-SOL 012 [7] v3.4.1 - ... Config ID: Config_prod_NFV-MANO - ... Applicability: none - ... Post-Conditions: none - GET Subscriptions - Check HTTP Response Status Code Is 404 - Check HTTP Response Body Json Schema Is ProblemDetails PUT subscriptions - Method not implemented - [Documentation] Test ID: 10.3.1.6.15 + [Documentation] Test ID: 10.3.1.6.14 ... Test title: PUT subscriptions - Method not implemented ... Test objective: The objective is to test that PUT method cannot modify a policy management subscription. ... Pre-conditions: none @@ -205,7 +192,7 @@ PUT subscriptions - Method not implemented Check HTTP Response Status Code Is 405 PATCH subscriptions - Method not implemented - [Documentation] Test ID: 10.3.1.6.16 + [Documentation] Test ID: 10.3.1.6.15 ... Test title: PATCH subscriptions - Method not implemented ... Test objective: The objective is to test that PATCH method cannot modify a policy management subscription. ... Pre-conditions: none @@ -217,7 +204,7 @@ PATCH subscriptions - Method not implemented Check HTTP Response Status Code Is 405 DELETE subscriptions - Method not implemented - [Documentation] Test ID: 10.3.1.6.17 + [Documentation] Test ID: 10.3.1.6.16 ... Test title: DELETE subscriptions - Method not implemented ... Test objective: The objective is to test that DELETE method cannot delete a policy management subscription. ... Pre-conditions: none diff --git a/SOL012/PolicyManagement-API/environment/variables.txt b/SOL012/PolicyManagement-API/environment/variables.txt index 0ed28acac..6665d6f96 100644 --- a/SOL012/PolicyManagement-API/environment/variables.txt +++ b/SOL012/PolicyManagement-API/environment/variables.txt @@ -21,11 +21,14 @@ ${POLICY_CONTENT_TYPE} application/json ${response} {} ${NFVMANO_DUPLICATION} 1 +${PAGING_SUPPORTED} 1 ${sub_filter} filter ${sub_filter_invalid} filter_invalid ${fields} criteria,objectInstanceIds ${subscriptionId} 6fc3539c-e602-4afa-8e13-962fb5a7d81f +${invalidSubscriptionId} invalid-subscription-id + ${notification_ep} notification ${VrQuotaAvailNotification} {} @@ -46,6 +49,7 @@ ${policyId1} ${policyId2} ${policyVersion} ${policyIdInActivatedStatus} +${invalidPolicyId} invalid-policy-id ${callbackResp} 127.0.0.1 -- GitLab From 13ccf83f3c66da7f72fcbf420d089e6c3f1eca96 Mon Sep 17 00:00:00 2001 From: hammad zafar Date: Wed, 10 Feb 2021 18:29:54 +0500 Subject: [PATCH 18/18] minor typo and bug fixes --- SOL012/PolicyManagement-API/ApiVersion.robot | 38 +++++++++---------- .../IndividualSubscription.robot | 10 ++--- .../NotificationConsumer.robot | 2 +- ...articularVersionOfAnIndividualPolicy.robot | 18 ++++----- SOL012/PolicyManagement-API/Policies.robot | 6 +-- .../PolicyManagementKeywords.robot | 35 +++++++++++++++++ .../SelectedVersionOfAnIndividualPolicy.robot | 6 +-- .../PolicyManagement-API/Subscriptions.robot | 12 +++--- .../environment/variables.txt | 3 ++ 9 files changed, 84 insertions(+), 46 deletions(-) diff --git a/SOL012/PolicyManagement-API/ApiVersion.robot b/SOL012/PolicyManagement-API/ApiVersion.robot index a52617498..142232e7c 100644 --- a/SOL012/PolicyManagement-API/ApiVersion.robot +++ b/SOL012/PolicyManagement-API/ApiVersion.robot @@ -7,7 +7,7 @@ Resource PolicyManagementKeywords.robot POST API Version - Method not implemented [Documentation] Test ID: 10.3.1.1.1 ... Test title: POST API version - Method not implemented - ... Test objective: The objective is to test that POST method is not implemented + ... Test objective: The objective is to test that POST method is not implemented for this resource. ... Pre-conditions: none ... Reference: Clause 9.3.3.3.1 - ETSI GS NFV-SOL 013 v3.3.1 ... Config ID: Config_prod_NFV-MANO @@ -19,7 +19,7 @@ POST API Version - Method not implemented GET API Version [Documentation] Test ID: 10.3.1.1.2 ... Test title: GET API Version - ... Test objective: The objective is to test that GET method successfully return ApiVersionInformation + ... Test objective: The objective is to test that GET method successfully returns ApiVersionInformation. ... Pre-conditions: none ... Reference: Clause 9.3.3.3.2 - ETSI GS NFV-SOL 013 v3.3.1 ... Config ID: Config_prod_NFV-MANO @@ -32,7 +32,7 @@ GET API Version PUT API Version - Method not implemented [Documentation] Test ID: 10.3.1.1.3 ... Test title: PUT API Version - Method not implemented - ... Test objective: The objective is to test that PUT method is not implemented + ... Test objective: The objective is to test that PUT method is not implemented for this resource. ... Pre-conditions: none ... Reference: Clause 9.3.3.3.3 - ETSI GS NFV-SOL 013 v3.3.1 ... Config ID: Config_prod_NFVO @@ -56,7 +56,7 @@ PATCH API Version - Method not implemented DELETE API Version - Method not implemented [Documentation] Test ID: 10.3.1.1.5 ... Test title: DELETE API Version - Method not implemented - ... Test objective: The objective is to test that DELETE method is not implemented + ... Test objective: The objective is to test that DELETE method is not implemented for this resource. ... Pre-conditions: none ... Reference: Clause 9.3.3.3.5 - ETSI GS NFV-SOL 013 v3.3.1 ... Config ID: Config_prod_NFV-MANO @@ -65,10 +65,10 @@ DELETE API Version - Method not implemented DELETE API Version Check HTTP Response Status Code Is 405 -POST API Version with apiMajorVerion - Method not implemented +POST API Version with apiMajorVersion - Method not implemented [Documentation] Test ID: 10.3.1.1.6 - ... Test title: POST API version with apiMajorVerion - Method not implemented - ... Test objective: The objective is to test that POST method is not implemented + ... Test title: POST API version with apiMajorVersion - Method not implemented + ... Test objective: The objective is to test that POST method is not implemented. ... Pre-conditions: none ... Reference: Clause 9.3.3.3.1 - ETSI GS NFV-SOL 013 v3.3.1 ... Config ID: Config_prod_NFV-MANO @@ -77,10 +77,10 @@ POST API Version with apiMajorVerion - Method not implemented POST API Version Check HTTP Response Status Code Is 405 -GET API Version with apiMajorVerion +GET API Version with apiMajorVersion [Documentation] 10.3.1.1.7 - ... Test title: GET API Version with apiMajorVerion - ... Test objective: The objective is to test that GET method successfully return ApiVersionInformation + ... Test title: GET API Version with apiMajorVersion + ... Test objective: The objective is to test that GET method successfully returns ApiVersionInformation. ... Pre-conditions: none ... Reference: Clause 9.3.3.3.2 - ETSI GS NFV-SOL 013 v3.3.1 ... Config ID: Config_prod_NFV-MANO @@ -90,10 +90,10 @@ GET API Version with apiMajorVerion Check HTTP Response Status Code Is 200 Check HTTP Response Body Json Schema Is ApiVersionInformation -PUT API Version with apiMajorVerion - Method not implemented +PUT API Version with apiMajorVersion - Method not implemented [Documentation] Test ID: 10.3.1.1.8 - ... Test title: PUT API Version with apiMajorVerion - Method not implemented - ... Test objective: The objective is to test that PUT method is not implemented + ... Test title: PUT API Version with apiMajorVersion - Method not implemented + ... Test objective: The objective is to test that PUT method is not implemented. ... Pre-conditions: none ... Reference: Clause 9.3.3.3.3 - ETSI GS NFV-SOL 013 v3.3.1 ... Config ID: Config_prod_NFV-MANO @@ -102,10 +102,10 @@ PUT API Version with apiMajorVerion - Method not implemented PUT API Version Check HTTP Response Status Code Is 405 -PATCH API Version with apiMajorVerion - Method not implemented +PATCH API Version with apiMajorVersion - Method not implemented [Documentation] Test ID: 10.3.1.1.9 - ... Test title: PATCH API Version with apiMajorVerion - Method not implemented - ... Test objective: The objective is to test that PATCH method is not implemented + ... Test title: PATCH API Version with apiMajorVersion - Method not implemented + ... Test objective: The objective is to test that PATCH method is not implemented. ... Pre-conditions: none ... Reference: Clause 9.3.3.3.4 - ETSI GS NFV-SOL 013 v3.3.1 ... Config ID: Config_prod_NFV-MANO @@ -114,10 +114,10 @@ PATCH API Version with apiMajorVerion - Method not implemented PATCH API Version Check HTTP Response Status Code Is 405 -DELETE API Version with apiMajorVerion - Method not implemented +DELETE API Version with apiMajorVersion - Method not implemented [Documentation] Test ID: 10.3.1.1.10 - ... Test title: DELETE API Version with apiMajorVerion - Method not implemented - ... Test objective: The objective is to test that DELETE method is not implemented + ... Test title: DELETE API Version with apiMajorVersion - Method not implemented + ... Test objective: The objective is to test that DELETE method is not implemented. ... Pre-conditions: none ... Reference: Clause 9.3.3.3.5 - ETSI GS NFV-SOL 013 v3.3.1 ... Config ID: Config_prod_NFV-MANO diff --git a/SOL012/PolicyManagement-API/IndividualSubscription.robot b/SOL012/PolicyManagement-API/IndividualSubscription.robot index 234802422..e7e3da0f7 100644 --- a/SOL012/PolicyManagement-API/IndividualSubscription.robot +++ b/SOL012/PolicyManagement-API/IndividualSubscription.robot @@ -6,7 +6,7 @@ Resource PolicyManagementKeywords.robot POST Individual Subscription - Method not implemented [Documentation] Test ID: 10.3.1.7.1 ... Test title: POST Individual Subscription - Method not implemented - ... Test objective: The objective is to test that POST method is not implemented + ... Test objective: The objective is to test that POST method is not implemented for this resource. ... Pre-conditions: none ... Reference: Clause 5.5.8.3.1 - ETSI GS NFV-SOL 012 [7] v3.4.1 ... Config ID: Config_prod_NFV-MANO @@ -18,7 +18,7 @@ POST Individual Subscription - Method not implemented GET Information about an individual subscription - Successful [Documentation] Test ID: 10.3.1.7.2 ... Test title: GET Information about an individual subscription - Successful - ... Test objective: The objective is to test the retrieval of Policy Management subscription and perform a JSON schema validation of the returned subscription data structure + ... Test objective: The objective is to test the retrieval of Policy Management subscription and perform a JSON schema validation of the returned PolicySubscription data structure ... Pre-conditions: At least one policy management subscription is available in the NFV-MANO. ... Reference: Clause 5.5.8.3.2 - ETSI GS NFV-SOL 012 [7] v3.4.1 ... Config ID: Config_prod_NFV-MANO @@ -44,7 +44,7 @@ GET Information about an individual subscription - NOT FOUND PUT an individual subscription - Method not implemented [Documentation] Test ID: 10.3.1.7.4 ... Test title: PUT an individual subscription - Method not implemented - ... Test objective: The objective is to test that PUT method is not implemented + ... Test objective: The objective is to test that PUT method is not implemented for this resource. ... Pre-conditions: none ... Reference: Clause 5.5.8.3.3 - ETSI GS NFV-SOL 012 [7] v3.4.1 ... Config ID: Config_prod_NFV-MANO @@ -56,7 +56,7 @@ PUT an individual subscription - Method not implemented PATCH an individual subscription - Method not implemented [Documentation] Test ID: 10.3.1.7.5 ... Test title: PATCH an individual subscription - Method not implemented - ... Test objective: The objective is to test that PATCH method is not implemented + ... Test objective: The objective is to test that PATCH method is not implemented for this resource. ... Pre-conditions: none ... Reference: Clause 5.5.8.3.4 - ETSI GS NFV-SOL 012 [7] v3.4.1 ... Config ID: Config_prod_NFV-MANO @@ -73,7 +73,7 @@ DELETE an individual subscription ... Reference: Clause 5.5.8.3.5 - ETSI GS NFV-SOL 012 [7] v3.4.1 ... Config ID: Config_prod_NFV-MANO ... Applicability: none - ... Post-Conditions: The Policy Management subscription is not available anymore in the NFV-MANO. + ... Post-Conditions: The Policy Management subscription is no longer available in the NFV-MANO. DELETE Individual Subscription Check HTTP Response Status Code Is 204 Check Postcondition Individual Subscription is Deleted \ No newline at end of file diff --git a/SOL012/PolicyManagement-API/NotificationConsumer.robot b/SOL012/PolicyManagement-API/NotificationConsumer.robot index 55050f1a4..80097e51a 100644 --- a/SOL012/PolicyManagement-API/NotificationConsumer.robot +++ b/SOL012/PolicyManagement-API/NotificationConsumer.robot @@ -49,7 +49,7 @@ Test the Notification Endpoint - UNREACHABLE ... Config ID: Config_prod_Notif_Endpoint ... Applicability: The notification endpoint is unreachable by the API producer. ... Post-Conditions: none - GET reach the notification endpoint + GET reach an unreachable notification endpoint Check HTTP Response Status Code Is 422 Check HTTP Response Body Json Schema Is ProblemDetails diff --git a/SOL012/PolicyManagement-API/ParticularVersionOfAnIndividualPolicy.robot b/SOL012/PolicyManagement-API/ParticularVersionOfAnIndividualPolicy.robot index 9894f0274..5c97dad14 100644 --- a/SOL012/PolicyManagement-API/ParticularVersionOfAnIndividualPolicy.robot +++ b/SOL012/PolicyManagement-API/ParticularVersionOfAnIndividualPolicy.robot @@ -15,10 +15,10 @@ POST Particular Version of an Individual Policy - Method not implemented POST Particular Version of an Individual Policy Check HTTP Response Status Code Is 405 -GET Information about the Particular Version of an Individual Policy - Successful +GET Information about a Particular Version of an Individual Policy - Successful [Documentation] Test ID: 10.3.1.5.2 - ... Test title: GET Information about the Particular Version of an Individual Policy - Successful - ... Test objective: The objective is to test The GET method fetches the content of the Particular version of an individual policy. + ... Test title: GET Information about a Particular Version of an Individual Policy - Successful + ... Test objective: The objective is to test that GET method fetches the content of a particular version of an individual policy. ... Pre-conditions: Individual policy is available in the NFV-MANO. Policy contents are provided in the json/PolicyContent folder. ... Reference: Clause 5.5.6.3.2 - ETSI GS NFV-SOL 012 [7] v3.4.1 ... Config ID: Config_prod_NFV-MANO @@ -28,16 +28,16 @@ GET Information about the Particular Version of an Individual Policy - Successfu Check HTTP Response Status Code Is 200 Check that the Content-Type Header Is Set -GET Information about the Particular Version of an Individual Policy - NOT FOUND +GET Information about a Particular Version of an Individual Policy - NOT FOUND [Documentation] Test ID: 10.3.1.5.3 - ... Test title: GET Information about the Particular Version of an Individual Policy - NOT FOUND - ... Test objective: The objective is to test that the information about the Particular version of an individual policy fails when using an invalid resource identifier. - ... Pre-conditions: The API producer did not find the current representation for the target resource. + ... Test title: GET Information about a Particular Version of an Individual Policy - NOT FOUND + ... Test objective: The objective is to test that the information about a particular version of an individual policy fails when using an invalid resource identifier. + ... Pre-conditions: none ... Reference: Clause 5.5.6.3.2 - ETSI GS NFV-SOL 012 [7] v3.4.1 ... Config ID: Config_prod_NFV-MANO ... Applicability: none ... Post-Conditions: none - GET Particular Version of an Individual Policy + GET Particular Version of an Individual Policy with Invalid URI Check HTTP Response Status Code Is 404 Check HTTP Response Body Json Schema Is ProblemDetails @@ -62,7 +62,7 @@ PUT Particular Version of an individual policy - CONFLICT ... Config ID: Config_prod_NFV-MANO ... Applicability: The policy content type is either JSON, YAML or ZIP. ... Post-Conditions: none - PUT Particular Version of an Individual Policy + PUT Particular Version of an Individual Policy CONFLICT Check HTTP Response Status Code Is 409 Check HTTP Response Body Json Schema Is ProblemDetails diff --git a/SOL012/PolicyManagement-API/Policies.robot b/SOL012/PolicyManagement-API/Policies.robot index 88678f31c..6e76d17b4 100644 --- a/SOL012/PolicyManagement-API/Policies.robot +++ b/SOL012/PolicyManagement-API/Policies.robot @@ -33,7 +33,7 @@ GET Policies GET Policies - Filter [Documentation] Test ID: 10.3.1.2.3 ... Test title: GET Policies - Filter - ... Test objective: The objective is GET the list of existing policies using a filter. + ... Test objective: The objective is to GET the list of existing policies using a filter. ... Pre-conditions: none ... Reference: Clause 5.5.3.3.2 - ETSI GS NFV-SOL 012 [7] v3.4.1 ... Config ID: Config_prod_NFV-MANO @@ -46,7 +46,7 @@ GET Policies - Filter GET Policies - Bad Request Invalid attribute-based filtering parameters [Documentation] Test ID: 10.3.1.2.4 ... Test title: GET Policies - Bad Request Invalid attribute-based filtering parameters - ... Test objective: The objective is GET the list of existing policies using an invalid filter. + ... Test objective: The objective is to GET the list of existing policies using an invalid filter. ... Pre-conditions: none ... Reference: Clause 5.5.3.3.2 - ETSI GS NFV-SOL 012 [7] v3.4.1 ... Config ID: Config_prod_NFV-MANO @@ -137,7 +137,7 @@ GET Policies with "exclude_default" and "fields" attribute selector GET Policies as Paged Response [Documentation] Test ID: 10.3.1.2.11 ... Test title: GET Policies as Paged Response - ... Test objective: The objective is to test that GET method retrieve the list of existing policies as paged response. + ... Test objective: The objective is to test that GET method retrieves the list of existing policies as paged response. ... Pre-conditions: none ... Reference: Clause 5.5.3.3.2 - ETSI GS NFV-SOL 012 [7] v3.4.1 ... Config ID: Config_prod_NFV-MANO diff --git a/SOL012/PolicyManagement-API/PolicyManagementKeywords.robot b/SOL012/PolicyManagement-API/PolicyManagementKeywords.robot index 3a14187ef..2de04c799 100644 --- a/SOL012/PolicyManagement-API/PolicyManagementKeywords.robot +++ b/SOL012/PolicyManagement-API/PolicyManagementKeywords.robot @@ -382,6 +382,14 @@ GET reach the notification endpoint ${outputResponse}= Output response Set Global Variable ${response} ${outputResponse} +GET reach an unreachable notification endpoint + Log Trying to reach the notification endpoint using GET method. + Set Headers {"Accept": "${ACCEPT}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"} + GET ${unreachable_uri} + ${outputResponse}= Output response + Set Global Variable ${response} ${outputResponse} + PUT notification endpoint Log Trying to perform a PUT. This method should not be implemented. Set Headers {"Accept": "${ACCEPT}"} @@ -621,6 +629,14 @@ GET Selected Version of an Individual Policy ${outputResponse}= Output response Set Global Variable ${response} ${outputResponse} +GET Selected Version of an Individual Policy in CREATED state + log Trying to get information about the selected version of an individual policy which is in CREATED state + Set Headers {"Accept":"${ACCEPT}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"} + Get ${apiRoot}/${apiName}/${apiVersion}/policies/${policyIdInCreatedState}/selected_version + ${outputResponse}= Output response + Set Global Variable ${response} ${outputResponse} + PUT Selected Version of an Individual Policy log Trying to perform a PUT. This method should not be implemented Set Headers {"Accept":"${ACCEPT}"} @@ -665,6 +681,14 @@ GET Particular Version of an Individual Policy ${outputResponse}= Output response Set Global Variable ${response} ${outputResponse} +GET Particular Version of an Individual Policy with Invalid URI + log Trying to get information about a particular version of an individual policy with invalid policyId + Set Headers {"Accept":"${ACCEPT}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"} + Get ${apiRoot}/${apiName}/${apiVersion}/policies/${invalidPolicyId}/versions/${policyVersion} + ${outputResponse}= Output response + Set Global Variable ${response} ${outputResponse} + PUT Particular Version of an Individual Policy Log Using PUT method to transfer the content of a particular version of an individual policy. Set Headers {"Accept":"${ACCEPT}"} @@ -676,6 +700,17 @@ PUT Particular Version of an Individual Policy ${outputResponse}= Output response Set Global Variable ${response} ${outputResponse} +PUT Particular Version of an Individual Policy CONFLICT + Log Using PUT method to transfer the content of a particular version of an already transferred policy. + Set Headers {"Accept":"${ACCEPT}"} + Determine Policy Content Type + Set Headers {"Content-Type": "${POLICY_CONTENT_TYPE}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"} + ${body}= Get File ${POLICY_CONTENT_FILENAME} + Put ${apiRoot}/${apiName}/${apiVersion}/policies/${policyIdAlreadyTransferred}/versions/${policyVersion} ${body} + ${outputResponse}= Output response + Set Global Variable ${response} ${outputResponse} + PATCH Particular Version of an Individual Policy log Trying to perform a PATCH. This method should not be implemented Set Headers {"Accept":"${ACCEPT}"} diff --git a/SOL012/PolicyManagement-API/SelectedVersionOfAnIndividualPolicy.robot b/SOL012/PolicyManagement-API/SelectedVersionOfAnIndividualPolicy.robot index 8e2603f4d..8a3c163ab 100644 --- a/SOL012/PolicyManagement-API/SelectedVersionOfAnIndividualPolicy.robot +++ b/SOL012/PolicyManagement-API/SelectedVersionOfAnIndividualPolicy.robot @@ -18,7 +18,7 @@ POST Selected Version of an Individual Policy - Method not implemented GET Information about the Selected Version of an Individual Policy - Successful [Documentation] Test ID: 10.3.1.4.2 ... Test title: GET Information about the Selected Version of an Individual Policy - Successful - ... Test objective: The objective is to test The GET method fetches the content of the selected version of an individual policy. + ... Test objective: The objective is to test The GET method fetches contents of the selected version of an individual policy and check that the HTTP Content-Type header is set according to the type of content. ... Pre-conditions: Individual policy is available in the NFV-MANO. Policy contents are provided in the json/PolicyContent folder. ... Reference: Clause 5.5.5.3.2 - ETSI GS NFV-SOL 012 [7] v3.4.1 ... Config ID: Config_prod_NFV-MANO @@ -45,12 +45,12 @@ GET Information about the Selected Version of an Individual Policy - CREATED STA [Documentation] Test ID: 10.3.1.4.4 ... Test title: GET Information about the Selected Version of an Individual Policy - NOT FOUND ... Test objective: The objective is to test that the information about the selected version of an individual policy is not retrieved when it is in CREATED state. - ... Pre-conditions: The individual policy is in CREATED state. + ... Pre-conditions: none ... Reference: Clause 5.5.5.3.2 - ETSI GS NFV-SOL 012 [7] v3.4.1 ... Config ID: Config_prod_NFV-MANO ... Applicability: none ... Post-Conditions: none - GET Selected Version of an Individual Policy + GET Selected Version of an Individual Policy in CREATED STATE Check HTTP Response Status Code Is 404 Check HTTP Response Body Json Schema Is ProblemDetails diff --git a/SOL012/PolicyManagement-API/Subscriptions.robot b/SOL012/PolicyManagement-API/Subscriptions.robot index ccbaa5620..2e10d4b89 100644 --- a/SOL012/PolicyManagement-API/Subscriptions.robot +++ b/SOL012/PolicyManagement-API/Subscriptions.robot @@ -40,10 +40,10 @@ POST Create a new Subscription - UNPROCESSABLE ENTITY [Documentation] Test ID: 10.3.1.6.3 ... Test title: POST Create a new Subscription - UNPROCESSABLE ENTITY ... Test objective: The objective is to test that correct error code is generated when data in the request body cannot be processed. - ... Pre-conditions: Request body contains invalid schema. + ... Pre-conditions: none ... Reference: Clause 5.5.7.3.1 - ETSI GS NFV-SOL 012 [7] v3.4.1 ... Config ID: Config_prod_NFV-MANO - ... Applicability: none + ... Applicability: Callback URI is not reachable by the API producer. ... Post-Conditions: none POST subscriptions with Invalid Request Check HTTP Response Status Code Is 422 @@ -52,7 +52,7 @@ POST Create a new Subscription - UNPROCESSABLE ENTITY GET Subscriptions [Documentation] Test ID: 10.3.1.6.4 ... Test title: GET Subscriptions - ... Test objective: The objective is to test that GET method retrieves the list of existing subscriptions + ... Test objective: The objective is to test that GET method retrieves the list of existing subscriptions. ... Pre-conditions: none ... Reference: Clause 5.5.7.3.2 - ETSI GS NFV-SOL 012 [7] v3.4.1 ... Config ID: Config_prod_NFV-MANO @@ -65,7 +65,7 @@ GET Subscriptions GET Subscription - Filter [Documentation] Test ID: 10.3.1.6.5 ... Test title: GET Subscription - Filter - ... Test objective: The objective is GET the list of active subscriptions using a filter + ... Test objective: The objective is to GET the list of active subscriptions using a filter. ... Pre-conditions: none ... Reference: Clause 5.5.7.3.2 - ETSI GS NFV-SOL 012 [7] v3.4.1 ... Config ID: Config_prod_NFV-MANO @@ -78,7 +78,7 @@ GET Subscription - Filter GET subscriptions - Bad Request Invalid attribute-based filtering parameters [Documentation] Test ID: 10.3.1.6.6 ... Test title: GET subscriptions - Bad Request Invalid attribute-based filtering parameters - ... Test objective: The objective is GET the list of active subscriptions using an invalid filter + ... Test objective: The objective is to GET the list of active subscriptions using an invalid filter. ... Pre-conditions: none ... Reference: Clause 5.5.7.3.2 - ETSI GS NFV-SOL 012 [7] v3.4.1 ... Config ID: Config_prod_NFV-MANO @@ -156,7 +156,7 @@ GET subscriptions with "exclude_fields" attribute selector GET Subscriptions as Paged Response [Documentation] Test ID: 10.3.1.6.12 ... Test title: GET Subscriptions as Paged Response - ... Test objective: The objective is to test that GET method retrieve the list of existing subscriptions as paged response. + ... Test objective: The objective is to test that GET method retrieves the list of existing subscriptions as paged response. ... Pre-conditions: none ... Reference: Clause 5.5.7.3.2 - ETSI GS NFV-SOL 012 [7] v3.4.1 ... Config ID: Config_prod_NFV-MANO diff --git a/SOL012/PolicyManagement-API/environment/variables.txt b/SOL012/PolicyManagement-API/environment/variables.txt index 6665d6f96..edba991e9 100644 --- a/SOL012/PolicyManagement-API/environment/variables.txt +++ b/SOL012/PolicyManagement-API/environment/variables.txt @@ -41,6 +41,7 @@ ${sleep_interval} 20s ${total_polling_time} 2 min ${polling_interval} 10 sec +${unreachable_uri} http://not-reachable-uri ${notification_request} [] ${notification_response} [] @@ -49,6 +50,8 @@ ${policyId1} ${policyId2} ${policyVersion} ${policyIdInActivatedStatus} +${policyIdInCreatedState} +${policyIdAlreadyTransferred} ${invalidPolicyId} invalid-policy-id ${callbackResp} 127.0.0.1 -- GitLab