From 2f952ddf04f6e80e41e2a7bfa8895b59606c457c Mon Sep 17 00:00:00 2001 From: zafar <zafar@etsi.org> Date: Mon, 7 Dec 2020 21:00:46 +0500 Subject: [PATCH] New resource: IndividualSubscription added in NSIUN-API --- .../IndividualSubscription.robot | 69 ++++++ .../NSInstanceUsageNotificationKeywords.robot | 198 ++++++++++++++++++ .../Subscriptions.robot | 161 +------------- .../Grants.robot | 85 +------- .../IndividualGrant.robot | 54 +---- .../NSLCOperationGrantingKeywords.robot | 128 +++++++++++ 6 files changed, 403 insertions(+), 292 deletions(-) create mode 100644 SOL011/NSInstanceUsageNotification-API/IndividualSubscription.robot create mode 100644 SOL011/NSInstanceUsageNotification-API/NSInstanceUsageNotificationKeywords.robot create mode 100644 SOL011/NSLifecycleOperationGranting-API/NSLCOperationGrantingKeywords.robot diff --git a/SOL011/NSInstanceUsageNotification-API/IndividualSubscription.robot b/SOL011/NSInstanceUsageNotification-API/IndividualSubscription.robot new file mode 100644 index 00000000..25580082 --- /dev/null +++ b/SOL011/NSInstanceUsageNotification-API/IndividualSubscription.robot @@ -0,0 +1,69 @@ +*** Settings *** +Resource environment/variables.txt +Resource NSInstanceUsageNotificationKeywords.robot +Library REST ${NFVO_SCHEMA}://${NFVO_HOST}:${NFVO_PORT} ssl_verify=false +Library OperatingSystem +Library JSONLibrary +Library JSONSchemaLibrary schemas/ + +*** Test Cases *** +POST Individual Subscription - Method not implemented + [Documentation] Test ID: 9.3.4.2.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 8.5.4.3.1 - ETSI GS NFV-SOL 011 [6] v3.3.1 + ... Config ID: Config_prod_NFVO + ... Applicability: none + ... Post-Conditions: The NS instance usage notification subscription is not created on the NFVO + POST Individual Subscription + Check HTTP Response Status Code Is 405 + +GET Information about an individual subscription + [Documentation] Test ID: 9.3.4.2.2 + ... Test title: GET Information about an individual subscription + ... Test objective: The objective is to test the retrieval of NS instance usage notification subscription and perform a JSON schema validation of the returned subscription data structure + ... Pre-conditions: none + ... Reference: Clause 8.5.4.3.2 - ETSI GS NFV-SOL 011 [6] v3.3.1 + ... Config ID: Config_prod_NFVO + ... Applicability: none + ... Post-Conditions: none + GET Individual subscription + Check HTTP Response Status Code Is 200 + Check HTTP Response Body Json Schema Is subscription + +PUT an individual subscription - Method not implemented + [Documentation] Test ID: 9.3.4.2.3 + ... Test title: PUT an individual subscription - Method not implemented + ... Test objective: TThe objective is to test that PUT method is not implemented + ... Pre-conditions: none + ... Reference: Clause 8.5.4.3.3 - ETSI GS NFV-SOL 011 [6] v3.3.1 + ... Config ID: Config_prod_NFVO + ... Applicability: none + ... Post-Conditions: The NS instance usage notification subscription is not modified by the operation + PUT Individual Subscription + Check HTTP Response Status Code Is 405 + +PATCH an individual subscription - Method not implemented + [Documentation] Test ID: 9.3.4.2.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 8.5.4.3.4 - ETSI GS NFV-SOL 011 [6] v3.3.1 + ... Config ID: Config_prod_NFVO + ... Applicability: none + ... Post-Conditions: The NS instance usage notification subscription is not modified by the operation + PATCH Individual Subscription + Check HTTP Response Status Code Is 405 + +DELETE an individual subscription + [Documentation] Test ID: 9.3.4.2.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 instance usage notification subscription is available in the NFVO + ... Reference: Clause 8.5.4.3.5 - ETSI GS NFV-SOL 011 [6] v3.3.1 + ... Config ID: Config_prod_NFVO + ... Applicability: none + ... Post-Conditions: The NS instance usage notification subscription is not available anymore on NFVO + DELETE Individual Subscription + Check HTTP Response Status Code Is 204 \ No newline at end of file diff --git a/SOL011/NSInstanceUsageNotification-API/NSInstanceUsageNotificationKeywords.robot b/SOL011/NSInstanceUsageNotification-API/NSInstanceUsageNotificationKeywords.robot new file mode 100644 index 00000000..96aa0ed4 --- /dev/null +++ b/SOL011/NSInstanceUsageNotification-API/NSInstanceUsageNotificationKeywords.robot @@ -0,0 +1,198 @@ +*** Settings *** +Resource environment/variables.txt +Library REST ${NFVO_SCHEMA}://${NFVO_HOST}:${NFVO_PORT} ssl_verify=false +Library OperatingSystem +Library JSONLibrary +Library JSONSchemaLibrary schemas/ + +*** Keywords *** +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 Header Contains + [Arguments] ${CONTENT_TYPE} + Should Contain ${response['headers']} ${CONTENT_TYPE} + Log Header is present + +Check Resource URI + ${uri}= Get Value From Json ${response['headers']} $..Location + Should Not Be Empty ${uri} + Log URI 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 LINK in Header + ${linkURL}= Get Value From Json ${response['headers']} $..Link + Should Not Be Empty ${linkURL} + +Check HTTP Response Body Json Schema Is + [Arguments] ${input} + ${schema} = Catenate ${input} .schema.json + Validate Json ${schema} ${response['body']} + +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/NsInstanceUsageSubscriptionRequest.json + Post ${apiRoot}/${apiName}/${apiVersion}/subscriptions ${body} + ${outputResponse}= Output response + Set Global Variable ${response} ${outputResponse} + +POST subscriptions DUPLICATION + Log Trying to create a subscription with an already created content + Pass Execution If ${NFVO_DUPLICATION} == 1 NFVO is permitting duplication. Skipping the test + Set Headers {"Accept":"${ACCEPT}"} + Set Headers {"Content-Type": "${CONTENT_TYPE}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + ${body}= Get File jsons/NsInstanceUsageSubscriptionRequest.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 + Pass Execution If ${NFVO_DUPLICATION} == 0 NFVO is not permitting duplication. + Set Headers {"Accept":"${ACCEPT}"} + Set Headers {"Content-Type": "${CONTENT_TYPE}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + ${body}= Get File jsons/NsInstanceUsageSubscriptionRequest.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} + +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} + +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} \ No newline at end of file diff --git a/SOL011/NSInstanceUsageNotification-API/Subscriptions.robot b/SOL011/NSInstanceUsageNotification-API/Subscriptions.robot index 09442ac4..94f20c51 100644 --- a/SOL011/NSInstanceUsageNotification-API/Subscriptions.robot +++ b/SOL011/NSInstanceUsageNotification-API/Subscriptions.robot @@ -1,5 +1,6 @@ *** Settings *** Resource environment/variables.txt +Resource NSInstanceUsageNotificationKeywords.robot Library REST ${NFVO_SCHEMA}://${NFVO_HOST}:${NFVO_PORT} ssl_verify=false Library OperatingSystem Library JSONLibrary @@ -30,8 +31,8 @@ POST Create a new Subscription - DUPLICATION ... Config ID: Config_prod_NFVO ... Applicability: Duplication supported by NFVO-C ... Post-Conditions: Duplicate subscription is created in the NFVO - Check Subscription Existence POST subscriptions DUPLICATION + Check Subscription Existence Check HTTP Response Status Code Is 201 Check HTTP Response Header Contains Location Check HTTP Response Body Json Schema Is subscription @@ -45,8 +46,8 @@ POST Create a new Subscription - NO-DUPLICATION ... Config ID: Config_prod_NFVO ... Applicability: Duplication NOT supported by NFVO-C ... Post-Conditions: Duplicate subscription is not created in the NFVO - Check Subscription Existence POST subscriptions NO DUPLICATION + Check Subscription Existence Check HTTP Response Status Code Is 303 Check HTTP Response Header Contains Location @@ -201,158 +202,4 @@ DELETE subscriptions - Method not implemented ... Applicability: none ... Post-Conditions: Subscription is not deleted DELETE subscriptions - Check HTTP Response Status Code Is 405 - -*** Keywords *** -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 Header Contains - [Arguments] ${CONTENT_TYPE} - Should Contain ${response['headers']} ${CONTENT_TYPE} - Log Header is present - -Check Resource URI - ${uri}= Get Value From Json ${response['headers']} $..Location - Should Not Be Empty ${uri} - Log URI 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 - #more robust functionaity needed - -#Check URI is Of Existing Resource -# ${uri}= Get Value From Json ${response['headers']} $..Location -# Should Be Equal As Strings ${uri} ${} - -Check LINK in Header - ${linkURL}= Get Value From Json ${response['headers']} $..Link - Should Not Be Empty ${linkURL} - -Check HTTP Response Body Json Schema Is - [Arguments] ${input} - ${schema} = Catenate ${input} .schema.json - Validate Json ${schema} ${response['body']} - -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/NsInstanceUsageSubscriptionRequest.json - Post ${apiRoot}/${apiName}/${apiVersion}/subscriptions ${body} - ${outputResponse}= Output response - Set Global Variable ${response} ${outputResponse} - -POST subscriptions DUPLICATION - Log Trying to create a subscription with an already created content - Pass Execution If ${NFVO_DUPLICATION} == 1 NFVO is permitting duplication. Skipping the test - Set Headers {"Accept":"${ACCEPT}"} - Set Headers {"Content-Type": "${CONTENT_TYPE}"} - Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} - ${body}= Get File jsons/NsInstanceUsageSubscriptionRequest.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 - Pass Execution If ${NFVO_DUPLICATION} == 0 NFVO is not permitting duplication. - Set Headers {"Accept":"${ACCEPT}"} - Set Headers {"Content-Type": "${CONTENT_TYPE}"} - Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} - ${body}= Get File jsons/NsInstanceUsageSubscriptionRequest.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} - -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} \ No newline at end of file + Check HTTP Response Status Code Is 405 \ No newline at end of file diff --git a/SOL011/NSLifecycleOperationGranting-API/Grants.robot b/SOL011/NSLifecycleOperationGranting-API/Grants.robot index 4ef0f91e..3c6d92ec 100644 --- a/SOL011/NSLifecycleOperationGranting-API/Grants.robot +++ b/SOL011/NSLifecycleOperationGranting-API/Grants.robot @@ -1,5 +1,6 @@ *** Settings *** Resource environment/variables.txt +Resource NSLCOperationGrantingKeywords.robot Library REST ${NFVO_SCHEMA}://${NFVO_HOST}:${NFVO_PORT} ssl_verify=false Library OperatingSystem Library JSONLibrary @@ -81,86 +82,4 @@ DELETE Grants - Method not implemented ... Post-Conditions: resources are not deleted Delete Grants Check HTTP Response Status Code Is 405 - Get an individual grant - Successful - -*** Keywords *** -Send Post Request for Grant - Log Request a new Grant for an NS LCM operation by POST to ${apiRoot}/${apiName}/${apiVersion}/grants - Set Headers {"Accept": "${ACCEPT}"} - Set Headers {"Content-Type": "${CONTENT_TYPE}"} - Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"} - ${body}= Get File jsons/grantNSLifecycleOperationRequest.json - Post ${apiRoot}/${apiName}/${apiVersion}/grants ${body} - ${body}= Output response - Set Suite Variable ${response} ${body} - -Send Request for a new Grant Forbiden Operation - Log Request a new Grant for a NS LCM operation by POST to ${apiRoot}/${apiName}/${apiVersion}/grants - Log The grant request should be rejected - Set Headers {"Accept": "${ACCEPT}"} - Set Headers {"Content-Type": "${CONTENT_TYPE}"} - Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"} - ${body}= Get File jsons/grantRejected.json - Post ${apiRoot}/${apiName}/${apiVersion}/grants ${body} - ${body}= Output response - Set Suite Variable ${response} ${body} - -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 Header Contains - [Arguments] ${CONTENT_TYPE} - Should Contain ${response['headers']} ${CONTENT_TYPE} - Log Header is present - -Check Resource URI existence - ${uri}= Get Value From Json ${response['headers']} $..Location - Should Not Be Empty ${uri} - -Check HTTP Response Body Json Schema Is - [Arguments] ${input} - ${schema} = Catenate ${input} .schema.json - Validate Json ${schema} ${response['body']} - -Get Grants - Log Trying to perform a GET. This method should not be implemented - Set Headers {"Accept":"${ACCEPT}"} - Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} - Get ${apiRoot}/${apiName}/${apiVersion}/grants - ${body}= Output response - Set Suite Variable ${response} ${body} - -Put Grants - 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 ${apiRoot}/${apiName}/${apiVersion}/grants - ${body}= Output response - Set Suite Variable ${response} ${body} - -Patch Grants - 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}/grants - ${body}= Output response - Set Suite Variable ${response} ${body} - - -Delete Grants - 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 ${apiRoot}/${apiName}/${apiVersion}/grants - ${body}= Output response - Set Suite Variable ${response} ${body} - -Get an individual grant - Successful - log Trying to read an individual grant - Set Headers {"Accept":"${ACCEPT}"} - Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} - Get ${response['headers']['Location']} - Log Validate Status code - Integer response status 200 \ No newline at end of file + Get an individual grant - Successful \ No newline at end of file diff --git a/SOL011/NSLifecycleOperationGranting-API/IndividualGrant.robot b/SOL011/NSLifecycleOperationGranting-API/IndividualGrant.robot index af8da812..56c233e1 100644 --- a/SOL011/NSLifecycleOperationGranting-API/IndividualGrant.robot +++ b/SOL011/NSLifecycleOperationGranting-API/IndividualGrant.robot @@ -1,5 +1,6 @@ *** Settings *** Resource environment/variables.txt +Resource NSLCOperationGrantingKeywords.robot Library OperatingSystem Library JSONLibrary Library JSONSchemaLibrary schemas/ @@ -68,55 +69,4 @@ DELETE an individual grant - Method not implemented ... Applicability: none ... Post-Conditions: none Delete individual Grant - Check HTTP Response Status Code Is 405 - -*** Keywords *** -Get individual grant - log Trying to read an individual grant - Set Headers {"Accept":"${ACCEPT}"} - Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} - Get ${apiRoot}/${apiName}/${apiVersion}/grants/${grantId} - ${body}= Output response - Set Suite Variable ${response} ${body} - -Post individual Grant - log Trying to create an individual grant - Set Headers {"Accept":"${ACCEPT}"} - Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} - Get ${apiRoot}/${apiName}/${apiVersion}/grants/${grantId} - ${body}= Output response - Set Suite Variable ${response} ${body} - -Put individual Grant - Log Trying to update an individual grant. This method should not be implemented. - Set Headers {"Accept":"${ACCEPT}"} - Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} - Put ${apiRoot}/${apiName}/${apiVersion}/grants/${grantId} - ${body}= Output response - Set Suite Variable ${response} ${body} - -Patch individual Grant - Log Trying to update an individual grant. This method should not be implemented. - Set Headers {"Accept":"${ACCEPT}"} - Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} - Patch ${apiRoot}/${apiName}/${apiVersion}/grants/${grantId} - ${body}= Output response - Set Suite Variable ${response} ${body} - -Delete individual Grant - Log Trying to delete an individual grant. This method should not be implemented. - Set Headers {"Accept":"${ACCEPT}"} - Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} - Delete ${apiRoot}/${apiName}/${apiVersion}/grants/${grantId} - ${body}= Output response - Set Suite Variable ${response} ${body} - -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']} + Check HTTP Response Status Code Is 405 \ No newline at end of file diff --git a/SOL011/NSLifecycleOperationGranting-API/NSLCOperationGrantingKeywords.robot b/SOL011/NSLifecycleOperationGranting-API/NSLCOperationGrantingKeywords.robot new file mode 100644 index 00000000..e3b36304 --- /dev/null +++ b/SOL011/NSLifecycleOperationGranting-API/NSLCOperationGrantingKeywords.robot @@ -0,0 +1,128 @@ +*** Settings *** +Resource environment/variables.txt +Library REST ${NFVO_SCHEMA}://${NFVO_HOST}:${NFVO_PORT} ssl_verify=false +Library OperatingSystem +Library JSONLibrary +Library JSONSchemaLibrary schemas/ + +*** Keywords *** +Send Post Request for Grant + Log Request a new Grant for an NS LCM operation by POST to ${apiRoot}/${apiName}/${apiVersion}/grants + Set Headers {"Accept": "${ACCEPT}"} + Set Headers {"Content-Type": "${CONTENT_TYPE}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"} + ${body}= Get File jsons/grantNSLifecycleOperationRequest.json + Post ${apiRoot}/${apiName}/${apiVersion}/grants ${body} + ${body}= Output response + Set Suite Variable ${response} ${body} + +Send Request for a new Grant Forbiden Operation + Log Request a new Grant for a NS LCM operation by POST to ${apiRoot}/${apiName}/${apiVersion}/grants + Log The grant request should be rejected + Set Headers {"Accept": "${ACCEPT}"} + Set Headers {"Content-Type": "${CONTENT_TYPE}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"} + ${body}= Get File jsons/grantRejected.json + Post ${apiRoot}/${apiName}/${apiVersion}/grants ${body} + ${body}= Output response + Set Suite Variable ${response} ${body} + +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 Header Contains + [Arguments] ${CONTENT_TYPE} + Should Contain ${response['headers']} ${CONTENT_TYPE} + Log Header is present + +Check Resource URI existence + ${uri}= Get Value From Json ${response['headers']} $..Location + Should Not Be Empty ${uri} + +Check HTTP Response Body Json Schema Is + [Arguments] ${input} + ${schema} = Catenate ${input} .schema.json + Validate Json ${schema} ${response['body']} + +Get Grants + Log Trying to perform a GET. This method should not be implemented + Set Headers {"Accept":"${ACCEPT}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Get ${apiRoot}/${apiName}/${apiVersion}/grants + ${body}= Output response + Set Suite Variable ${response} ${body} + +Put Grants + 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 ${apiRoot}/${apiName}/${apiVersion}/grants + ${body}= Output response + Set Suite Variable ${response} ${body} + +Patch Grants + 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}/grants + ${body}= Output response + Set Suite Variable ${response} ${body} + + +Delete Grants + 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 ${apiRoot}/${apiName}/${apiVersion}/grants + ${body}= Output response + Set Suite Variable ${response} ${body} + +Get an individual grant - Successful + log Trying to read an individual grant + Set Headers {"Accept":"${ACCEPT}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Get ${response['headers']['Location']} + Log Validate Status code + Integer response status 200 + +Get individual grant + log Trying to read an individual grant + Set Headers {"Accept":"${ACCEPT}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Get ${apiRoot}/${apiName}/${apiVersion}/grants/${grantId} + ${body}= Output response + Set Suite Variable ${response} ${body} + +Post individual Grant + log Trying to create an individual grant + Set Headers {"Accept":"${ACCEPT}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Get ${apiRoot}/${apiName}/${apiVersion}/grants/${grantId} + ${body}= Output response + Set Suite Variable ${response} ${body} + +Put individual Grant + Log Trying to update an individual grant. This method should not be implemented. + Set Headers {"Accept":"${ACCEPT}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Put ${apiRoot}/${apiName}/${apiVersion}/grants/${grantId} + ${body}= Output response + Set Suite Variable ${response} ${body} + +Patch individual Grant + Log Trying to update an individual grant. This method should not be implemented. + Set Headers {"Accept":"${ACCEPT}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Patch ${apiRoot}/${apiName}/${apiVersion}/grants/${grantId} + ${body}= Output response + Set Suite Variable ${response} ${body} + +Delete individual Grant + Log Trying to delete an individual grant. This method should not be implemented. + Set Headers {"Accept":"${ACCEPT}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Delete ${apiRoot}/${apiName}/${apiVersion}/grants/${grantId} + ${body}= Output response + Set Suite Variable ${response} ${body} \ No newline at end of file -- GitLab