From b3e559495112e62ef44f26aa9fea687b514a6576 Mon Sep 17 00:00:00 2001 From: zafar Date: Mon, 30 Nov 2020 20:12:30 +0500 Subject: [PATCH 01/11] New Resource added in SOL011: Grants.robot --- .../Grants.robot | 165 ++++++++++++++++++ .../environment/variables.txt | 44 +++++ .../grantNSLifecycleOperationRequest.json | 6 + .../jsons/grantRejected.json | 6 + .../schemas/Grants.schema.json | 53 ++++++ .../schemas/ProblemDetails.schema.json | 34 ++++ 6 files changed, 308 insertions(+) create mode 100644 SOL011/NSLifecycleOperationGranting-API/Grants.robot create mode 100644 SOL011/NSLifecycleOperationGranting-API/environment/variables.txt create mode 100644 SOL011/NSLifecycleOperationGranting-API/jsons/grantNSLifecycleOperationRequest.json create mode 100644 SOL011/NSLifecycleOperationGranting-API/jsons/grantRejected.json create mode 100644 SOL011/NSLifecycleOperationGranting-API/schemas/Grants.schema.json create mode 100644 SOL011/NSLifecycleOperationGranting-API/schemas/ProblemDetails.schema.json diff --git a/SOL011/NSLifecycleOperationGranting-API/Grants.robot b/SOL011/NSLifecycleOperationGranting-API/Grants.robot new file mode 100644 index 000000000..65cd3d442 --- /dev/null +++ b/SOL011/NSLifecycleOperationGranting-API/Grants.robot @@ -0,0 +1,165 @@ +*** Settings *** +Resource environment/variables.txt +Library REST ${NFVO_SCHEMA}://${NFVO_HOST}:${NFVO_PORT} ssl_verify=false +Library OperatingSystem +Library JSONLibrary +Library JSONSchemaLibrary schemas/ + +*** Test Cases *** +Requests a grant for a particular NS lifecycle operation + [Documentation] Test ID: 9.3.3.1.1 + ... Test title: Requests a grant for a particular NS lifecycle operation + ... Test objective: The objective is to request a grant for a particular NS lifecycle operation and perform a JSON schema validation on the returned grant data structure + ... Pre-conditions: + ... Reference: Clause 7.5.3.3.1 - ETSI GS NFV-SOL 011 [6] v3.3.1 + ... Config ID: Config_prod_NFVO + ... Applicability: The NFVO can decide immediately what to respond to a grant request + ... Post-Conditions: The grant information is available to the NFVO. + Send Post Request for Grant + Check HTTP Response Status Code Is 201 + Check HTTP Response Body Json Schema Is Grant + Check Operation Occurrence Id existence + +Requests a grant for a particular NS lifecycle operation - Forbidden + [Documentation] Test ID: 9.3.3.1.2 + ... Test title: Requests a grant for a particular NS lifecycle operation - Forbidden + ... Test objective: The objective is to request a grant for a particular NS lifecycle operation and the grant is rejected + ... Pre-conditions: none + ... Reference: Clause 7.5.3.3.1 - ETSI GS NFV-SOL 011 [6] v3.3.1 + ... Config ID: Config_prod_NFVO + ... Applicability: none + ... Post-Conditions: none + Send Request for a new Grant Forbiden Operation + Check HTTP Response Status Code Is 403 + Check HTTP Response Body Json Schema Is ProblemDetails + +GET Grants - Method not implemented + [Documentation] Test ID: 9.3.3.1.3 + ... Test title: GET Grants - Method not implemented + ... Test objective: The objective is to test that GET method is not allowed for Life cycle operation granting + ... Pre-conditions: none + ... Reference: Clause 7.5.3.3.1 - ETSI GS NFV-SOL 011 [6] v3.3.1 + ... Config ID: Config_prod_NFVO + ... Applicability: none + ... Post-Conditions: none + Get Grants + Check HTTP Response Status Code Is 405 + +PUT Grants - Method not implemented + [Documentation] Test ID: 9.3.3.1.4 + ... Test title: PUT Grants - Method not implemented + ... Test objective: The objective is to test that PUT method is not allowed for Life cycle operation granting + ... Pre-conditions: none + ... Reference: Clause 7.5.3.3.1 - ETSI GS NFV-SOL 011 [6] v3.3.1 + ... Config ID: Config_prod_NFVO + ... Applicability: none + ... Post-Conditions: none + Put Grants + Check HTTP Response Status Code Is 405 + +PATCH Grants - Method not implemented + [Documentation] Test ID: 9.3.3.1.5 + ... Test title: PATCH Grants - Method not implemented + ... Test objective: The objective is to test that PATCH method is not allowed for Life cycle operation granting + ... Pre-conditions: none + ... Reference: Clause 7.5.3.3.1 - ETSI GS NFV-SOL 011 [6] v3.3.1 + ... Config ID: Config_prod_NFVO + ... Applicability: none + ... Post-Conditions: none + Patch Grants + Check HTTP Response Status Code Is 405 + +DELETE Grants - Method not implemented + [Documentation] Test ID: 9.3.3.1.6 + ... Test title: DELETE Grants - Method not implemented + ... Test objective: The objective is to test that DELETE method is not allowed for Life cycle operation granting + ... Pre-conditions: none + ... Reference: Clause 7.5.3.3.1 - ETSI GS NFV-SOL 011 [6] v3.3.1 + ... Config ID: Config_prod_NFVO + ... Applicability: none + ... 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 Operation Occurrence Id existence + ${occId}= Get Value From Json ${response['headers']} $..Location + Should Not Be Empty ${occId} + +Check HTTP Response Header Contains + [Arguments] ${CONTENT_TYPE} + Should Contain ${response['headers']} ${CONTENT_TYPE} + Log Header is present + +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 diff --git a/SOL011/NSLifecycleOperationGranting-API/environment/variables.txt b/SOL011/NSLifecycleOperationGranting-API/environment/variables.txt new file mode 100644 index 000000000..cfb446726 --- /dev/null +++ b/SOL011/NSLifecycleOperationGranting-API/environment/variables.txt @@ -0,0 +1,44 @@ +*** 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 +${ACCEPT} application/json +${AUTH_USAGE} 1 +${grantId} 6fc3539c-e602-4afa-8e13-962fb5a7d81d + +${apiRoot} / +${apiName} grant +${apiVersion} v1 + +${SYNC_MODE} 1 + + + + +${response} + + + +${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 +${subscriptionId} 6fc3539c-e602-4afa-8e13-962fb5a7d81f +${notification_ep} notification +${VrQuotaAvailNotification} {} diff --git a/SOL011/NSLifecycleOperationGranting-API/jsons/grantNSLifecycleOperationRequest.json b/SOL011/NSLifecycleOperationGranting-API/jsons/grantNSLifecycleOperationRequest.json new file mode 100644 index 000000000..df3d7bb4d --- /dev/null +++ b/SOL011/NSLifecycleOperationGranting-API/jsons/grantNSLifecycleOperationRequest.json @@ -0,0 +1,6 @@ +{ + "nsInstanceId": "", + "nsdId": "", + "nsLcmOpOccId": "", + "lifecycleOperation": "SCALE" +} \ No newline at end of file diff --git a/SOL011/NSLifecycleOperationGranting-API/jsons/grantRejected.json b/SOL011/NSLifecycleOperationGranting-API/jsons/grantRejected.json new file mode 100644 index 000000000..df3d7bb4d --- /dev/null +++ b/SOL011/NSLifecycleOperationGranting-API/jsons/grantRejected.json @@ -0,0 +1,6 @@ +{ + "nsInstanceId": "", + "nsdId": "", + "nsLcmOpOccId": "", + "lifecycleOperation": "SCALE" +} \ No newline at end of file diff --git a/SOL011/NSLifecycleOperationGranting-API/schemas/Grants.schema.json b/SOL011/NSLifecycleOperationGranting-API/schemas/Grants.schema.json new file mode 100644 index 000000000..05e5dfe39 --- /dev/null +++ b/SOL011/NSLifecycleOperationGranting-API/schemas/Grants.schema.json @@ -0,0 +1,53 @@ +{ + "Grant": { + "description": "This type represents a grant. It shall comply with the provisions defined in table 7.6.2.3-1.", + "type": "object", + "required": [ + "id", + "nsInstanceId", + "nsLcmOpOccId", + "_links" + ], + "properties": { + "id": { + "description": "Identifier of the grant.", + "$ref": "../components/SOL011_schemas.yaml#/components/schemas/Identifier" + }, + "nsInstanceId": { + "description": "Identifier of the NS instance which this grant request relates to.", + "$ref": "../components/SOL011_schemas.yaml#/components/schemas/Identifier" + }, + "nsLcmOpOccId": { + "description": "Identifier of the NS lifecycle management operation occurrence associated to the GrantRequest.", + "$ref": "../components/SOL011_schemas.yaml#/components/schemas/Identifier" + }, + "additionalParams": { + "description": "Additional parameters passed by NFVO-N, specific to the NS and the lifecycle management operation.", + "$ref": "../components/SOL011_schemas.yaml#/components/schemas/KeyValuePairs" + }, + "_links": { + "description": "Links to resources related to this resource.", + "type": "object", + "required": [ + "self", + "nsLcmOpOcc", + "nsInstance" + ], + "properties": { + "self": { + "description": "URI of this resource", + "$ref": "../components/SOL011_schemas.yaml#/components/schemas/Link" + }, + "nsLcmOpOcc": { + "description": "Related NS lifecycle management operation occurrence", + "$ref": "../components/SOL011_schemas.yaml#/components/schemas/Link" + }, + "nsInstance": { + "description": "Related NS instance.", + "$ref": "../components/SOL011_schemas.yaml#/components/schemas/Link" + } + } + } + } + } +} \ No newline at end of file diff --git a/SOL011/NSLifecycleOperationGranting-API/schemas/ProblemDetails.schema.json b/SOL011/NSLifecycleOperationGranting-API/schemas/ProblemDetails.schema.json new file mode 100644 index 000000000..62f176127 --- /dev/null +++ b/SOL011/NSLifecycleOperationGranting-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 -- GitLab From e52d714b6b79d7859233432a71187bcea60e7716 Mon Sep 17 00:00:00 2001 From: zafar Date: Tue, 1 Dec 2020 18:47:10 +0500 Subject: [PATCH 02/11] New Resource IndividualGrant added in SOL011 --- .../Grants.robot | 8 +- .../IndividualGrant.robot | 122 ++++++++++++++++++ .../environment/variables.txt | 2 +- .../schemas/Grant.schema.json | 51 ++++++++ .../schemas/Grants.schema.json | 53 -------- 5 files changed, 178 insertions(+), 58 deletions(-) create mode 100644 SOL011/NSLifecycleOperationGranting-API/IndividualGrant.robot create mode 100644 SOL011/NSLifecycleOperationGranting-API/schemas/Grant.schema.json delete mode 100644 SOL011/NSLifecycleOperationGranting-API/schemas/Grants.schema.json diff --git a/SOL011/NSLifecycleOperationGranting-API/Grants.robot b/SOL011/NSLifecycleOperationGranting-API/Grants.robot index 65cd3d442..172edd6dd 100644 --- a/SOL011/NSLifecycleOperationGranting-API/Grants.robot +++ b/SOL011/NSLifecycleOperationGranting-API/Grants.robot @@ -38,7 +38,7 @@ GET Grants - Method not implemented ... Test title: GET Grants - Method not implemented ... Test objective: The objective is to test that GET method is not allowed for Life cycle operation granting ... Pre-conditions: none - ... Reference: Clause 7.5.3.3.1 - ETSI GS NFV-SOL 011 [6] v3.3.1 + ... Reference: Clause 7.5.3.3.2 - ETSI GS NFV-SOL 011 [6] v3.3.1 ... Config ID: Config_prod_NFVO ... Applicability: none ... Post-Conditions: none @@ -50,7 +50,7 @@ PUT Grants - Method not implemented ... Test title: PUT Grants - Method not implemented ... Test objective: The objective is to test that PUT method is not allowed for Life cycle operation granting ... Pre-conditions: none - ... Reference: Clause 7.5.3.3.1 - ETSI GS NFV-SOL 011 [6] v3.3.1 + ... Reference: Clause 7.5.3.3.3 - ETSI GS NFV-SOL 011 [6] v3.3.1 ... Config ID: Config_prod_NFVO ... Applicability: none ... Post-Conditions: none @@ -62,7 +62,7 @@ PATCH Grants - Method not implemented ... Test title: PATCH Grants - Method not implemented ... Test objective: The objective is to test that PATCH method is not allowed for Life cycle operation granting ... Pre-conditions: none - ... Reference: Clause 7.5.3.3.1 - ETSI GS NFV-SOL 011 [6] v3.3.1 + ... Reference: Clause 7.5.3.3.4 - ETSI GS NFV-SOL 011 [6] v3.3.1 ... Config ID: Config_prod_NFVO ... Applicability: none ... Post-Conditions: none @@ -74,7 +74,7 @@ DELETE Grants - Method not implemented ... Test title: DELETE Grants - Method not implemented ... Test objective: The objective is to test that DELETE method is not allowed for Life cycle operation granting ... Pre-conditions: none - ... Reference: Clause 7.5.3.3.1 - ETSI GS NFV-SOL 011 [6] v3.3.1 + ... Reference: Clause 7.5.3.3.5 - ETSI GS NFV-SOL 011 [6] v3.3.1 ... Config ID: Config_prod_NFVO ... Applicability: none ... Post-Conditions: resources are not deleted diff --git a/SOL011/NSLifecycleOperationGranting-API/IndividualGrant.robot b/SOL011/NSLifecycleOperationGranting-API/IndividualGrant.robot new file mode 100644 index 000000000..af8da8128 --- /dev/null +++ b/SOL011/NSLifecycleOperationGranting-API/IndividualGrant.robot @@ -0,0 +1,122 @@ +*** Settings *** +Resource environment/variables.txt +Library OperatingSystem +Library JSONLibrary +Library JSONSchemaLibrary schemas/ +Library REST ${NFVO_SCHEMA}://${NFVO_HOST}:${NFVO_PORT} ssl_verify=false +Documentation This resource represents an individual grant. The client can use this resource to read the grant. +... It is determined by means outside the scope of the present document, such as configuration or policy, +... how long an individual grant is available. + +*** Test Cases *** +POST Individual Grant - Method not implemented + [Documentation] Test ID: 9.3.3.2.1 + ... Test title: POST Individual Grant - Method not implemented + ... Test objective: The objective is to test that POST method is not allowed for Life cycle operation granting + ... Pre-conditions: none + ... Reference: Clause 7.5.4.3.1 - ETSI GS NFV-SOL 011 [1] v3.3.1 + ... Config ID: Config_prod_NFVO + ... Applicability: none + ... Post-Conditions: none + Post individual Grant + Check HTTP Response Status Code Is 405 + +GET an individual grant - Successful + [Documentation] Test ID: 9.3.3.2.2 + ... Test title: GET an individual grant - Successful + ... Test objective: The objective is to retrieve a grant for a particular NS Lifecycle Operation. + ... Pre-conditions: The grant information is available to the NFVO + ... Reference: Clause 7.5.4.3.2 - ETSI GS NFV-SOL 011 [1] v3.3.1 + ... Config ID: Config_prod_NFVO + ... Applicability: none + ... Post-Conditions: none + Get individual grant + Check HTTP Response Status Code Is 200 + Check HTTP Response Body Json Schema Is Grant + +PUT an individual grant - Method not implemented + [Documentation] Test ID: 9.3.3.2.3 + ... Test title: PUT an individual grant - Method not implemented + ... Test objective: The objective is to test that PUT method is not allowed to for Life cycle operation granting + ... Pre-conditions: none + ... Reference: Clause 7.5.4.3.3 - ETSI GS NFV-SOL 011 [1] v3.3.1 + ... Config ID: Config_prod_NFVO + ... Applicability: none + ... Post-Conditions: none + PUT individual Grant + Check HTTP Response Status Code Is 405 + +PATCH an individual grant - Method not implemented + [Documentation] Test ID: 9.3.3.2.4 + ... Test title: PATCH an individual grant - Method not implemented + ... Test objective: The objective is to test that PATCH method is not allowed to for Life cycle operation granting + ... Pre-conditions: none + ... Reference: Clause 7.5.4.3.4 - ETSI GS NFV-SOL 011 [1] v3.3.1 + ... Config ID: Config_prod_NFVO + ... Applicability: none + ... Post-Conditions: none + Patch individual Grant + Check HTTP Response Status Code Is 405 + +DELETE an individual grant - Method not implemented + [Documentation] Test ID: 9.3.3.2.5 + ... Test title: DELETE an individual grant - Method not implemented + ... Test objective: The objective is to test that DELETE method is not allowed to for Life cycle operation granting + ... Pre-conditions: none + ... Reference: Clause 7.5.4.3.5 - ETSI GS NFV-SOL 011 [1] v3.3.1 + ... Config ID: Config_prod_NFVO + ... 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']} diff --git a/SOL011/NSLifecycleOperationGranting-API/environment/variables.txt b/SOL011/NSLifecycleOperationGranting-API/environment/variables.txt index cfb446726..1895ddcb8 100644 --- a/SOL011/NSLifecycleOperationGranting-API/environment/variables.txt +++ b/SOL011/NSLifecycleOperationGranting-API/environment/variables.txt @@ -14,7 +14,7 @@ ${apiVersion} v1 ${SYNC_MODE} 1 - +${grantId} ${response} diff --git a/SOL011/NSLifecycleOperationGranting-API/schemas/Grant.schema.json b/SOL011/NSLifecycleOperationGranting-API/schemas/Grant.schema.json new file mode 100644 index 000000000..021c90e68 --- /dev/null +++ b/SOL011/NSLifecycleOperationGranting-API/schemas/Grant.schema.json @@ -0,0 +1,51 @@ +{ + "description": "This type represents a grant. It shall comply with the provisions defined in table 7.6.2.3-1.", + "type": "object", + "required": [ + "id", + "nsInstanceId", + "nsLcmOpOccId", + "_links" + ], + "properties": { + "id": { + "description": "Identifier of the grant.", + "$ref": "../components/SOL011_schemas.yaml#/components/schemas/Identifier" + }, + "nsInstanceId": { + "description": "Identifier of the NS instance which this grant request relates to.", + "$ref": "../components/SOL011_schemas.yaml#/components/schemas/Identifier" + }, + "nsLcmOpOccId": { + "description": "Identifier of the NS lifecycle management operation occurrence associated to the GrantRequest.", + "$ref": "../components/SOL011_schemas.yaml#/components/schemas/Identifier" + }, + "additionalParams": { + "description": "Additional parameters passed by NFVO-N, specific to the NS and the lifecycle management operation.", + "$ref": "../components/SOL011_schemas.yaml#/components/schemas/KeyValuePairs" + }, + "_links": { + "description": "Links to resources related to this resource.", + "type": "object", + "required": [ + "self", + "nsLcmOpOcc", + "nsInstance" + ], + "properties": { + "self": { + "description": "URI of this resource", + "$ref": "../components/SOL011_schemas.yaml#/components/schemas/Link" + }, + "nsLcmOpOcc": { + "description": "Related NS lifecycle management operation occurrence", + "$ref": "../components/SOL011_schemas.yaml#/components/schemas/Link" + }, + "nsInstance": { + "description": "Related NS instance.", + "$ref": "../components/SOL011_schemas.yaml#/components/schemas/Link" + } + } + } + } +} \ No newline at end of file diff --git a/SOL011/NSLifecycleOperationGranting-API/schemas/Grants.schema.json b/SOL011/NSLifecycleOperationGranting-API/schemas/Grants.schema.json deleted file mode 100644 index 05e5dfe39..000000000 --- a/SOL011/NSLifecycleOperationGranting-API/schemas/Grants.schema.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "Grant": { - "description": "This type represents a grant. It shall comply with the provisions defined in table 7.6.2.3-1.", - "type": "object", - "required": [ - "id", - "nsInstanceId", - "nsLcmOpOccId", - "_links" - ], - "properties": { - "id": { - "description": "Identifier of the grant.", - "$ref": "../components/SOL011_schemas.yaml#/components/schemas/Identifier" - }, - "nsInstanceId": { - "description": "Identifier of the NS instance which this grant request relates to.", - "$ref": "../components/SOL011_schemas.yaml#/components/schemas/Identifier" - }, - "nsLcmOpOccId": { - "description": "Identifier of the NS lifecycle management operation occurrence associated to the GrantRequest.", - "$ref": "../components/SOL011_schemas.yaml#/components/schemas/Identifier" - }, - "additionalParams": { - "description": "Additional parameters passed by NFVO-N, specific to the NS and the lifecycle management operation.", - "$ref": "../components/SOL011_schemas.yaml#/components/schemas/KeyValuePairs" - }, - "_links": { - "description": "Links to resources related to this resource.", - "type": "object", - "required": [ - "self", - "nsLcmOpOcc", - "nsInstance" - ], - "properties": { - "self": { - "description": "URI of this resource", - "$ref": "../components/SOL011_schemas.yaml#/components/schemas/Link" - }, - "nsLcmOpOcc": { - "description": "Related NS lifecycle management operation occurrence", - "$ref": "../components/SOL011_schemas.yaml#/components/schemas/Link" - }, - "nsInstance": { - "description": "Related NS instance.", - "$ref": "../components/SOL011_schemas.yaml#/components/schemas/Link" - } - } - } - } - } -} \ No newline at end of file -- GitLab From f34f7996e5b648d2a69a5caef1fce54e80f4d776 Mon Sep 17 00:00:00 2001 From: zafar Date: Fri, 4 Dec 2020 21:42:22 +0500 Subject: [PATCH 03/11] New resource:Subscription.robot added in NSIUN-API --- .../Subscriptions.robot | 358 ++++++++++++++++++ .../environment/variables.txt | 42 ++ .../NsInstanceUsageSubscriptionRequest.json | 10 + .../schemas/ProblemDetails.schema.json | 34 ++ .../schemas/subscription.schema.json | 36 ++ .../schemas/subscriptions.schema.json | 39 ++ .../Grants.robot | 11 +- .../environment/variables.txt | 4 +- 8 files changed, 526 insertions(+), 8 deletions(-) create mode 100644 SOL011/NSInstanceUsageNotification-API/Subscriptions.robot create mode 100644 SOL011/NSInstanceUsageNotification-API/environment/variables.txt create mode 100644 SOL011/NSInstanceUsageNotification-API/jsons/NsInstanceUsageSubscriptionRequest.json create mode 100644 SOL011/NSInstanceUsageNotification-API/schemas/ProblemDetails.schema.json create mode 100644 SOL011/NSInstanceUsageNotification-API/schemas/subscription.schema.json create mode 100644 SOL011/NSInstanceUsageNotification-API/schemas/subscriptions.schema.json diff --git a/SOL011/NSInstanceUsageNotification-API/Subscriptions.robot b/SOL011/NSInstanceUsageNotification-API/Subscriptions.robot new file mode 100644 index 000000000..09442ac4b --- /dev/null +++ b/SOL011/NSInstanceUsageNotification-API/Subscriptions.robot @@ -0,0 +1,358 @@ +*** Settings *** +Resource environment/variables.txt +Library REST ${NFVO_SCHEMA}://${NFVO_HOST}:${NFVO_PORT} ssl_verify=false +Library OperatingSystem +Library JSONLibrary +Library JSONSchemaLibrary schemas/ + +*** Test Cases *** +POST Create a new subscription + [Documentation] Test ID: 9.3.4.1.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 8.5.3.3.1 - ETSI GS NFV-SOL 011 [6] v3.3.1 + ... Config ID: Config_prod_NFVO + ... Applicability: none + ... Post-Conditions: Subscription is created in the NFVO + POST subscriptions + Check HTTP Response Status Code Is 201 + Check HTTP Response Header Contains Location + Check HTTP Response Body Json Schema Is subscription + Check Resource URI + +POST Create a new Subscription - DUPLICATION + [Documentation] Test ID: 9.3.4.1.2 + ... Test title: POST Create a new subscription - DUPLICATION + ... Test objective: The objective is to test that POST method creates a duplicate subscription + ... Pre-conditions: A subscription shall already exist + ... Reference: Clause 8.5.3.3.1 - ETSI GS NFV-SOL 011 [6] v3.3.1 + ... 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 HTTP Response Status Code Is 201 + Check HTTP Response Header Contains Location + Check HTTP Response Body Json Schema Is subscription + +POST Create a new Subscription - NO-DUPLICATION + [Documentation] Test ID: 9.3.4.1.3 + ... Test title: POST Create a new subscription - NO-DUPLICATION + ... Test objective: The objective is to test that POST method cannot create a duplicate subscription + ... Pre-conditions: A subscription shall already exist + ... Reference: Clause 8.5.3.3.1 - ETSI GS NFV-SOL 011 [6] v3.3.1 + ... 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 HTTP Response Status Code Is 303 + Check HTTP Response Header Contains Location + +GET Subscriptions + [Documentation] Test ID: 9.3.4.1.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 8.5.3.3.2 - ETSI GS NFV-SOL 011 [6] v3.3.1 + ... Config ID: Config_prod_NFVO + ... 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: 9.3.4.1.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 8.5.3.3.2 - ETSI GS NFV-SOL 011 [6] v3.3.1 + ... Config ID: Config_prod_NFVO + ... 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: 9.3.4.1.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 8.5.3.3.2 - ETSI GS NFV-SOL 011 [6] v3.3.1 + ... Config ID: Config_prod_NFVO + ... 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: 9.3.4.1.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 8.5.3.3.2 - ETSI GS NFV-SOL 011 [6] v3.3.1 + ... Config ID: Config_prod_NFVO + ... 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: 9.3.4.1.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: + ... Reference: Clause 8.5.3.3.2 - ETSI GS NFV-SOL 011 [6] v3.3.1 + ... Config ID: Config_prod_NFVO + ... Applicability: + ... Post-Conditions: + 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: 9.3.4.1.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: + ... Reference: Clause 8.5.3.3.2 - ETSI GS NFV-SOL 011 [6] v3.3.1 + ... Config ID: Config_prod_NFVO + ... Applicability: + ... Post-Conditions: + 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: 9.3.4.1.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: + ... Reference: Clause 8.5.3.3.2 - ETSI GS NFV-SOL 011 [6] v3.3.1 + ... Config ID: Config_prod_NFVO + ... Applicability: + ... Post-Conditions: + 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: 9.3.4.1.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: + ... Reference: Clause 8.5.3.3.2 - ETSI GS NFV-SOL 011 [6] v3.3.1 + ... Config ID: Config_prod_NFVO + ... Applicability: + ... Post-Conditions: + 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: 9.3.4.1.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 8.5.3.3.2 - ETSI GS NFV-SOL 011 [6] v3.3.1 + ... Config ID: Config_prod_NFVO + ... Applicability: none + ... Post-Conditions: none + GET Subscriptions + Check HTTP Response Status Code Is 200 + Check LINK in Header + +PUT subscriptions - Method not implemented + [Documentation] Test ID: 9.3.4.1.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 8.5.3.3.3 - ETSI GS NFV-SOL 011 [6] v3.3.1 + ... Config ID: Config_prod_NFVO + ... Applicability: none + ... Post-Conditions: none + PUT subscriptions + Check HTTP Response Status Code Is 405 + +PATCH subscriptions - Method not implemented + [Documentation] Test ID: 9.3.4.1.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 8.5.3.3.4 - ETSI GS NFV-SOL 011 [6] v3.3.1 + ... Config ID: Config_prod_NFVO + ... Applicability: none + ... Post-Conditions: none + PATCH subscriptions + Check HTTP Response Status Code Is 405 + +DELETE subscriptions - Method not implemented + [Documentation] Test ID: 9.3.4.1.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 8.5.3.3.5 - ETSI GS NFV-SOL 011 [6] v3.3.1 + ... Config ID: Config_prod_NFVO + ... 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 diff --git a/SOL011/NSInstanceUsageNotification-API/environment/variables.txt b/SOL011/NSInstanceUsageNotification-API/environment/variables.txt new file mode 100644 index 000000000..fc5a4bc11 --- /dev/null +++ b/SOL011/NSInstanceUsageNotification-API/environment/variables.txt @@ -0,0 +1,42 @@ +*** 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 +${ACCEPT} application/json +${AUTH_USAGE} 1 +${ACCEPT_JSON} application/json +${apiRoot} / +${apiName} nsiun +${apiVersion} v1 + +${SYNC_MODE} 1 + + +${response} + +${NFVO_DUPLICATION} + +${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} {} diff --git a/SOL011/NSInstanceUsageNotification-API/jsons/NsInstanceUsageSubscriptionRequest.json b/SOL011/NSInstanceUsageNotification-API/jsons/NsInstanceUsageSubscriptionRequest.json new file mode 100644 index 000000000..b9203519e --- /dev/null +++ b/SOL011/NSInstanceUsageNotification-API/jsons/NsInstanceUsageSubscriptionRequest.json @@ -0,0 +1,10 @@ +{ + "filter": { + "nsInstanceUsageNotificationFilter": { + "nsInstanceId": "6fc3539c-e602-4afa-8e13-962fb5a7d81f", + "status": "START" + } + }, + "callbackUri": "http://127.0.0.1/subscribe", + "authentication": "" +} \ No newline at end of file diff --git a/SOL011/NSInstanceUsageNotification-API/schemas/ProblemDetails.schema.json b/SOL011/NSInstanceUsageNotification-API/schemas/ProblemDetails.schema.json new file mode 100644 index 000000000..62f176127 --- /dev/null +++ b/SOL011/NSInstanceUsageNotification-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/SOL011/NSInstanceUsageNotification-API/schemas/subscription.schema.json b/SOL011/NSInstanceUsageNotification-API/schemas/subscription.schema.json new file mode 100644 index 000000000..a4154156a --- /dev/null +++ b/SOL011/NSInstanceUsageNotification-API/schemas/subscription.schema.json @@ -0,0 +1,36 @@ +{ + "description": "This type represents a subscription related to notifications about NS instance usage. It shall comply with the provisions defined in table 8.6.2.3-1.", + "type": "object", + "required": [ + "id", + "callbackUri", + "_links" + ], + "properties": { + "id": { + "description": "Identifier that identifies the subscription.", + "$ref": "../components/SOL011_schemas.yaml#/components/schemas/Identifier" + }, + "filter": { + "description": "Filter settings for this subscription, to define the subset of all notifications this subscription relates to. A particular notification is sent to the subscriber if the filter matches, or if there is no filter.", + "$ref": "#/components/schemas/NsInstanceUsageNotificationsFilter" + }, + "callbackUri": { + "description": "The URI of the endpoint to send the notification to.", + "$ref": "../components/SOL011_schemas.yaml#/components/schemas/Uri" + }, + "_links": { + "description": "Links to resources related to this resource.", + "type": "object", + "required": [ + "self" + ], + "properties": { + "self": { + "description": "URI of this resource.", + "$ref": "../components/SOL011_schemas.yaml#/components/schemas/Link" + } + } + } + } +} \ No newline at end of file diff --git a/SOL011/NSInstanceUsageNotification-API/schemas/subscriptions.schema.json b/SOL011/NSInstanceUsageNotification-API/schemas/subscriptions.schema.json new file mode 100644 index 000000000..010b50b29 --- /dev/null +++ b/SOL011/NSInstanceUsageNotification-API/schemas/subscriptions.schema.json @@ -0,0 +1,39 @@ +{ + "type": "array", + "items": { + "description": "This type represents a subscription related to notifications about NS instance usage. It shall comply with the provisions defined in table 8.6.2.3-1.", + "type": "object", + "required": [ + "id", + "callbackUri", + "_links" + ], + "properties": { + "id": { + "description": "Identifier that identifies the subscription.", + "$ref": "../components/SOL011_schemas.yaml#/components/schemas/Identifier" + }, + "filter": { + "description": "Filter settings for this subscription, to define the subset of all notifications this subscription relates to. A particular notification is sent to the subscriber if the filter matches, or if there is no filter.", + "$ref": "#/components/schemas/NsInstanceUsageNotificationsFilter" + }, + "callbackUri": { + "description": "The URI of the endpoint to send the notification to.", + "$ref": "../components/SOL011_schemas.yaml#/components/schemas/Uri" + }, + "_links": { + "description": "Links to resources related to this resource.", + "type": "object", + "required": [ + "self" + ], + "properties": { + "self": { + "description": "URI of this resource.", + "$ref": "../components/SOL011_schemas.yaml#/components/schemas/Link" + } + } + } + } + } +} \ No newline at end of file diff --git a/SOL011/NSLifecycleOperationGranting-API/Grants.robot b/SOL011/NSLifecycleOperationGranting-API/Grants.robot index 172edd6dd..4ef0f91eb 100644 --- a/SOL011/NSLifecycleOperationGranting-API/Grants.robot +++ b/SOL011/NSLifecycleOperationGranting-API/Grants.robot @@ -18,7 +18,8 @@ Requests a grant for a particular NS lifecycle operation Send Post Request for Grant Check HTTP Response Status Code Is 201 Check HTTP Response Body Json Schema Is Grant - Check Operation Occurrence Id existence + Check HTTP Response Header Contains Location + Check Resource URI existence Requests a grant for a particular NS lifecycle operation - Forbidden [Documentation] Test ID: 9.3.3.1.2 @@ -109,15 +110,15 @@ Check HTTP Response Status Code Is Should Be Equal As Strings ${response['status']} ${expected_status} Log Status code validated -Check Operation Occurrence Id existence - ${occId}= Get Value From Json ${response['headers']} $..Location - Should Not Be Empty ${occId} - 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 diff --git a/SOL011/NSLifecycleOperationGranting-API/environment/variables.txt b/SOL011/NSLifecycleOperationGranting-API/environment/variables.txt index 1895ddcb8..e69f12ee2 100644 --- a/SOL011/NSLifecycleOperationGranting-API/environment/variables.txt +++ b/SOL011/NSLifecycleOperationGranting-API/environment/variables.txt @@ -9,13 +9,11 @@ ${AUTH_USAGE} 1 ${grantId} 6fc3539c-e602-4afa-8e13-962fb5a7d81d ${apiRoot} / -${apiName} grant +${apiName} nslcog ${apiVersion} v1 ${SYNC_MODE} 1 -${grantId} - ${response} -- GitLab From 2f952ddf04f6e80e41e2a7bfa8895b59606c457c Mon Sep 17 00:00:00 2001 From: zafar Date: Mon, 7 Dec 2020 21:00:46 +0500 Subject: [PATCH 04/11] 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 000000000..255800825 --- /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 000000000..96aa0ed49 --- /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 09442ac4b..94f20c513 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 4ef0f91eb..3c6d92ec8 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 af8da8128..56c233e18 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 000000000..e3b363042 --- /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 From 77e0ea048ac7f86bec2cd59ecca18427be22bbf5 Mon Sep 17 00:00:00 2001 From: zafar Date: Wed, 9 Dec 2020 11:58:13 +0500 Subject: [PATCH 05/11] NotificationEndpoint and NotificationConsumer resources added in NSIUN-API --- .../NSInstanceUsageNotificationKeywords.robot | 25 +++- .../NotificationConsumer.robot | 21 ++++ .../NotificationEndpoint.robot | 112 ++++++++++++++++++ .../environment/variables.txt | 22 +++- .../jsons/NsInstanceUsageNotification.json | 9 ++ .../NsInstanceUsageNotification.schema.json | 43 +++++++ 6 files changed, 228 insertions(+), 4 deletions(-) create mode 100644 SOL011/NSInstanceUsageNotification-API/NotificationConsumer.robot create mode 100644 SOL011/NSInstanceUsageNotification-API/NotificationEndpoint.robot create mode 100644 SOL011/NSInstanceUsageNotification-API/jsons/NsInstanceUsageNotification.json create mode 100644 SOL011/NSInstanceUsageNotification-API/schemas/NsInstanceUsageNotification.schema.json diff --git a/SOL011/NSInstanceUsageNotification-API/NSInstanceUsageNotificationKeywords.robot b/SOL011/NSInstanceUsageNotification-API/NSInstanceUsageNotificationKeywords.robot index 96aa0ed49..199ad8c4b 100644 --- a/SOL011/NSInstanceUsageNotification-API/NSInstanceUsageNotificationKeywords.robot +++ b/SOL011/NSInstanceUsageNotification-API/NSInstanceUsageNotificationKeywords.robot @@ -4,6 +4,7 @@ Library REST ${NFVO_SCHEMA}://${NFVO_HOST}:${NFVO_PORT} ssl_verify=fals Library OperatingSystem Library JSONLibrary Library JSONSchemaLibrary schemas/ +Library String *** Keywords *** Check HTTP Response Status Code Is @@ -195,4 +196,26 @@ DELETE Individual subscription 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 + Set Global Variable ${response} ${outputResponse} + +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 subscription.schema.json + Set Global Variable ${callbackResp} response body callbackUri + +POST NS Instance Usage 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/NSInstanceUsageNotification.json + ${body}= Format String ${template} subscriptionId=${subscriptionId} + Post ${callbackResp} ${body} + ${outputResponse}= Output response + Set Global Variable ${response} ${outputResponse} + + \ No newline at end of file diff --git a/SOL011/NSInstanceUsageNotification-API/NotificationConsumer.robot b/SOL011/NSInstanceUsageNotification-API/NotificationConsumer.robot new file mode 100644 index 000000000..00985877f --- /dev/null +++ b/SOL011/NSInstanceUsageNotification-API/NotificationConsumer.robot @@ -0,0 +1,21 @@ +*** Settings *** +Library JSONSchemaLibrary schemas/ +Resource environment/variables.txt +Resource NSInstanceUsageNotificationKeywords.robot +Library REST ${NFVO_SCHEMA}://${NFVO_HOST}:${NFVO_PORT} ssl_verify=false +Library OperatingSystem +Library JSONLibrary +Suite Setup Check resource existence and get CallbackUri + +*** Test Cases *** +NS Instance Usage Notification + [Documentation] Test ID: 9.3.4.4.1 + ... Test title: NS Instance Usage Notification + ... Test objective: The objective is to test that NS Instance Usage Notification is delivered with success to the notification consumer + ... Pre-conditions: A subscription for instance usage notification is available in the NFVO. + ... Reference: Clause 8.5.5.3.1 - ETSI GS NFV-SOL 011 [6] v3.3.1 + ... Config ID: Config_prod_Notif_Endpoint + ... Applicability: none + ... Post-Conditions: none + POST NS Instance Usage Notification + Check HTTP Response Status Code Is 204 \ No newline at end of file diff --git a/SOL011/NSInstanceUsageNotification-API/NotificationEndpoint.robot b/SOL011/NSInstanceUsageNotification-API/NotificationEndpoint.robot new file mode 100644 index 000000000..311997a7d --- /dev/null +++ b/SOL011/NSInstanceUsageNotification-API/NotificationEndpoint.robot @@ -0,0 +1,112 @@ +*** 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 *** +NS Instance Usage START Notification + [Documentation] Test ID: 9.3.4.3.1 + ... Test title: NS Instance Usage START Notification + ... Test objective: The objective is to test the dispatch of NS Instance Usage Start Notification when the usage of an NS instance is started, 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 NS instance usage notification is available in the NFVO. + ... Reference: Clause 8.5.5.3.1 - ETSI GS NFV-SOL 011 [6] v3.3.1 + ... Config ID: Config_prod_NFVO + ... Applicability: none + ... Post-Conditions: none + Trigger a change in NS instance usage START (external action) + Check NS Instance Usage Start Notification Http POST Request Body Json Schema Is NsInstanceUsageNotification + Check NS Instance Usage Start Notification Http POST Request Body notificationType attribute Is NsInstanceUsageNotification + Check NS Instance Usage Start Notification Http POST Request Body notificationStatus attribute Is START + +NS Instance Usage END Notification + [Documentation] Test ID: 9.3.4.3.2 + ... Test title: NS Instance Usage END Notification + ... Test objective: The objective is to test the dispatch of NS Instance Usage End Notification when the usage of an NS instance is ended, 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 NS instance usage notification is available in the NFVO. + ... Reference: Clause 8.5.5.3.1 - ETSI GS NFV-SOL 011 [6] v3.3.1 + ... Config ID: Config_prod_NFVO + ... Applicability: none + ... Post-Conditions: none + Trigger a change in NS instance usage END (external action) + Check NS Instance Usage End Notification Http POST Request Body Json Schema Is NsInstanceUsageNotification + Check NS Instance Usage End Notification Http POST Request Body notificationType attribute Is NsInstanceUsageNotification + Check NS Instance Usage End Notification Http POST Request Body notificationStatus attribute Is END + +*** 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 NS instance usage START (external action) + #do nothing + Log do nothing + +Trigger a change in NS instance usage END (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 Notification NS Instance Usage Start Handler + [Arguments] ${endpoint} ${type} ${status} + ${json}= evaluate {} + set to dictionary ${json} notificationType ${type} changeType ${status} + ${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} + +Configure Notification NS Instance Usage End Handler + [Arguments] ${endpoint} ${type} ${status} + ${json}= evaluate {} + set to dictionary ${json} notificationType ${type} changeType ${status} + ${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 NS Instance Usage Start 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 NS Instance Usage Start Notification Http POST Request Body notificationType attribute Is + [Arguments] ${type} + Configure Notification NS Instance Usage Start Handler ${callback_endpoint_fwd} ${type} START + Wait Until Keyword Succeeds 2 min 10 sec Verify Mock Expectation ${notification_request} + Clear Requests ${callback_endpoint} + Clear Requests ${callback_endpoint_fwd} + +Check NS Instance Usage Start Notification Http POST Request Body notificationStatus attribute Is + [Arguments] ${type} + #do nothing + Log do nothing + +Check NS Instance Usage End 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 NS Instance Usage End Notification Http POST Request Body notificationType attribute Is + [Arguments] ${type} + Configure Notification NS Instance Usage End Handler ${callback_endpoint_fwd} ${type} START + Wait Until Keyword Succeeds 2 min 10 sec Verify Mock Expectation ${notification_request} + Clear Requests ${callback_endpoint} + Clear Requests ${callback_endpoint_fwd} + +Check NS Instance Usage End Notification Http POST Request Body notificationStatus attribute Is + [Arguments] ${type} + #do nothing + Log do nothing \ No newline at end of file diff --git a/SOL011/NSInstanceUsageNotification-API/environment/variables.txt b/SOL011/NSInstanceUsageNotification-API/environment/variables.txt index fc5a4bc11..b9ab0f0f1 100644 --- a/SOL011/NSInstanceUsageNotification-API/environment/variables.txt +++ b/SOL011/NSInstanceUsageNotification-API/environment/variables.txt @@ -4,6 +4,7 @@ ${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 @@ -13,10 +14,9 @@ ${apiVersion} v1 ${SYNC_MODE} 1 +${response} {} -${response} - -${NFVO_DUPLICATION} +${NFVO_DUPLICATION} 1 ${VNFM_HOST} localhost # Hostname of the VNFM ${VNFM_PORT} 8080 # Listening port of the VNFM @@ -40,3 +40,19 @@ ${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 diff --git a/SOL011/NSInstanceUsageNotification-API/jsons/NsInstanceUsageNotification.json b/SOL011/NSInstanceUsageNotification-API/jsons/NsInstanceUsageNotification.json new file mode 100644 index 000000000..984f3ddd9 --- /dev/null +++ b/SOL011/NSInstanceUsageNotification-API/jsons/NsInstanceUsageNotification.json @@ -0,0 +1,9 @@ +{{ + "id": "", + "notificationType": "NSInstanceUsageNotification", + "subscriptionId": "{subscriptionId}", + "timeStamp": "", + "nsInstanceId": "", + "status": "START", + "_links": "" +}} \ No newline at end of file diff --git a/SOL011/NSInstanceUsageNotification-API/schemas/NsInstanceUsageNotification.schema.json b/SOL011/NSInstanceUsageNotification-API/schemas/NsInstanceUsageNotification.schema.json new file mode 100644 index 000000000..4e4df8609 --- /dev/null +++ b/SOL011/NSInstanceUsageNotification-API/schemas/NsInstanceUsageNotification.schema.json @@ -0,0 +1,43 @@ +{ + "description": "This type represents an NS instance usage notification, which indicates the start or end of usage of an NS instance as a part of a composite NS managed by the NFVO-C. It shall comply with the provisions defined in table 8.6.2.4-1.", + "type": "object", + "required": [ + "id", + "notificationType", + "subscriptionId", + "timeStamp", + "nsInstanceId", + "status", + "_links" + ], + "properties": { + "id": { + "description": "Identifier of this notification. If a notification is sent multiple times due to multiple subscriptions, the \"id\" attribute of all these notifications shall have the same value.", + "$ref": "../components/SOL011_schemas.yaml#/components/schemas/Identifier" + }, + "notificationType": { + "description": "Discriminator for the different notification types. Shall be set to \"NsInstanceUsageNotification\" for this notification type.", + "type": "string" + }, + "subscriptionId": { + "description": "Identifier of the subscription that this notification relates to.", + "$ref": "../components/SOL011_schemas.yaml#/components/schemas/Identifier" + }, + "timeStamp": { + "description": "Date and time of the generation of the notification.", + "$ref": "../components/SOL011_schemas.yaml#/components/schemas/DateTime" + }, + "nsInstanceId": { + "description": "Identifier of the NS instance affected.", + "$ref": "../components/SOL011_schemas.yaml#/components/schemas/Identifier" + }, + "status": { + "description": "Indicates whether this notification reports about the start of the usage of an NS instance or about the end of the usage of an NS instance.", + "$ref": "#/components/schemas/NsInstanceUsageStatusType" + }, + "_links": { + "description": "Links to resources related to this notification.", + "$ref": "../components/SOL011_schemas.yaml#/components/schemas/NotificationLink" + } + } +} \ No newline at end of file -- GitLab From e490aec370c253e5c1ee3b2b8a7b9464c867fef9 Mon Sep 17 00:00:00 2001 From: zafar Date: Fri, 11 Dec 2020 18:22:02 +0500 Subject: [PATCH 06/11] New test cases added --- .../IndividualSubscription.robot | 29 ++++++++---- .../NSInstanceUsageNotificationKeywords.robot | 12 +++-- .../Subscriptions.robot | 45 ++++++++++++------- .../Grants.robot | 2 +- .../IndividualGrant.robot | 17 ++++++- 5 files changed, 75 insertions(+), 30 deletions(-) diff --git a/SOL011/NSInstanceUsageNotification-API/IndividualSubscription.robot b/SOL011/NSInstanceUsageNotification-API/IndividualSubscription.robot index 255800825..c742db50a 100644 --- a/SOL011/NSInstanceUsageNotification-API/IndividualSubscription.robot +++ b/SOL011/NSInstanceUsageNotification-API/IndividualSubscription.robot @@ -15,15 +15,15 @@ POST Individual Subscription - Method not implemented ... 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-Conditions: none POST Individual Subscription Check HTTP Response Status Code Is 405 -GET Information about an individual subscription +GET Information about an individual subscription - Successful [Documentation] Test ID: 9.3.4.2.2 - ... Test title: GET Information about an individual subscription + ... Test title: GET Information about an individual subscription - Successful ... 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 + ... Pre-conditions: An NS instance is instantiated. At least one NS instance usage notification subscription is available in the NFVO. ... Reference: Clause 8.5.4.3.2 - ETSI GS NFV-SOL 011 [6] v3.3.1 ... Config ID: Config_prod_NFVO ... Applicability: none @@ -35,12 +35,12 @@ GET Information about an individual 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 + ... Test objective: The 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 + ... Post-Conditions: none PUT Individual Subscription Check HTTP Response Status Code Is 405 @@ -52,7 +52,7 @@ PATCH an individual subscription - Method not implemented ... 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 + ... Post-Conditions: none PATCH Individual Subscription Check HTTP Response Status Code Is 405 @@ -66,4 +66,17 @@ DELETE an individual subscription ... 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 + Check HTTP Response Status Code Is 204 + +GET Information about an individual subscription - NOT FOUND + [Documentation] Test ID: 9.3.4.2.6 + ... Test title: GET Information about an individual subscription - NOT FOUND + ... Test objective: The objective is to test that the retrieval of individual NS instance usage notification subscription fails when using an invalid resource identifier. + ... Pre-conditions: An NS instance is instantiated. At least one NS instance usage notification subscription is available in the NFVO. + ... 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 404 + Check HTTP Response Body Json Schema Is ProblemDetails \ No newline at end of file diff --git a/SOL011/NSInstanceUsageNotification-API/NSInstanceUsageNotificationKeywords.robot b/SOL011/NSInstanceUsageNotification-API/NSInstanceUsageNotificationKeywords.robot index 199ad8c4b..0a71abbbc 100644 --- a/SOL011/NSInstanceUsageNotification-API/NSInstanceUsageNotificationKeywords.robot +++ b/SOL011/NSInstanceUsageNotification-API/NSInstanceUsageNotificationKeywords.robot @@ -17,7 +17,7 @@ Check HTTP Response Header Contains Should Contain ${response['headers']} ${CONTENT_TYPE} Log Header is present -Check Resource URI +Check HTTP Response Header Contains Resource URI ${uri}= Get Value From Json ${response['headers']} $..Location Should Not Be Empty ${uri} Log URI is present @@ -29,7 +29,7 @@ Check subscription existence Get ${apiRoot}/${apiName}/${apiVersion}/subscriptions/${subscriptionId} Integer response status 200 -Check LINK in Header +Check HTTP Response Header Contains Link ${linkURL}= Get Value From Json ${response['headers']} $..Link Should Not Be Empty ${linkURL} @@ -218,4 +218,10 @@ POST NS Instance Usage Notification ${outputResponse}= Output response Set Global Variable ${response} ${outputResponse} - \ No newline at end of file +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} diff --git a/SOL011/NSInstanceUsageNotification-API/Subscriptions.robot b/SOL011/NSInstanceUsageNotification-API/Subscriptions.robot index 94f20c513..dd9d259e1 100644 --- a/SOL011/NSInstanceUsageNotification-API/Subscriptions.robot +++ b/SOL011/NSInstanceUsageNotification-API/Subscriptions.robot @@ -20,7 +20,7 @@ POST Create a new subscription Check HTTP Response Status Code Is 201 Check HTTP Response Header Contains Location Check HTTP Response Body Json Schema Is subscription - Check Resource URI + Check HTTP Response Header Contains Resource URI POST Create a new Subscription - DUPLICATION [Documentation] Test ID: 9.3.4.1.2 @@ -107,11 +107,11 @@ GET subscriptions with "all_fields" attribute selector [Documentation] Test ID: 9.3.4.1.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: + ... Pre-conditions: none ... Reference: Clause 8.5.3.3.2 - ETSI GS NFV-SOL 011 [6] v3.3.1 ... Config ID: Config_prod_NFVO - ... Applicability: - ... Post-Conditions: + ... 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 @@ -120,11 +120,11 @@ GET subscriptions with "exclude_default" attribute selector [Documentation] Test ID: 9.3.4.1.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: + ... Pre-conditions: none ... Reference: Clause 8.5.3.3.2 - ETSI GS NFV-SOL 011 [6] v3.3.1 ... Config ID: Config_prod_NFVO - ... Applicability: - ... Post-Conditions: + ... 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 @@ -133,11 +133,11 @@ GET subscriptions with "fields" attribute selector [Documentation] Test ID: 9.3.4.1.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: + ... Pre-conditions: none ... Reference: Clause 8.5.3.3.2 - ETSI GS NFV-SOL 011 [6] v3.3.1 ... Config ID: Config_prod_NFVO - ... Applicability: - ... Post-Conditions: + ... 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 @@ -146,11 +146,11 @@ GET subscriptions with "exclude_fields" attribute selector [Documentation] Test ID: 9.3.4.1.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: + ... Pre-conditions: none ... Reference: Clause 8.5.3.3.2 - ETSI GS NFV-SOL 011 [6] v3.3.1 ... Config ID: Config_prod_NFVO - ... Applicability: - ... Post-Conditions: + ... 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 @@ -166,7 +166,7 @@ GET Subscriptions as Paged Response ... Post-Conditions: none GET Subscriptions Check HTTP Response Status Code Is 200 - Check LINK in Header + Check HTTP Response Header Contains Link PUT subscriptions - Method not implemented [Documentation] Test ID: 9.3.4.1.13 @@ -200,6 +200,19 @@ DELETE subscriptions - Method not implemented ... Reference: Clause 8.5.3.3.5 - ETSI GS NFV-SOL 011 [6] v3.3.1 ... Config ID: Config_prod_NFVO ... Applicability: none - ... Post-Conditions: Subscription is not deleted + ... Post-Conditions: Subscriptions are not deleted DELETE subscriptions - Check HTTP Response Status Code Is 405 \ No newline at end of file + Check HTTP Response Status Code Is 405 + +GET subscriptions with "exclude_default" and "fields" attribute selector + [Documentation] Test ID: 9.3.4.1.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 8.5.3.3.2 - ETSI GS NFV-SOL 011 [6] v3.3.1 + ... Config ID: Config_prod_NFVO + ... Applicability: + ... Post-Conditions: + 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/SOL011/NSLifecycleOperationGranting-API/Grants.robot b/SOL011/NSLifecycleOperationGranting-API/Grants.robot index 3c6d92ec8..8b5cd238c 100644 --- a/SOL011/NSLifecycleOperationGranting-API/Grants.robot +++ b/SOL011/NSLifecycleOperationGranting-API/Grants.robot @@ -79,7 +79,7 @@ DELETE Grants - Method not implemented ... Reference: Clause 7.5.3.3.5 - ETSI GS NFV-SOL 011 [6] v3.3.1 ... Config ID: Config_prod_NFVO ... Applicability: none - ... Post-Conditions: resources are not deleted + ... Post-Conditions: Resources are not deleted Delete Grants Check HTTP Response Status Code Is 405 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 56c233e18..e85fd0dff 100644 --- a/SOL011/NSLifecycleOperationGranting-API/IndividualGrant.robot +++ b/SOL011/NSLifecycleOperationGranting-API/IndividualGrant.robot @@ -67,6 +67,19 @@ DELETE an individual grant - Method not implemented ... Reference: Clause 7.5.4.3.5 - ETSI GS NFV-SOL 011 [1] v3.3.1 ... Config ID: Config_prod_NFVO ... Applicability: none - ... Post-Conditions: none + ... Post-Conditions: Grant is not deleted Delete individual Grant - Check HTTP Response Status Code Is 405 \ No newline at end of file + Check HTTP Response Status Code Is 405 + +GET an individual grant - NOT FOUND + [Documentation] Test ID: 9.3.3.2.6 + ... Test title: GET an individual grant - NOT FOUND + ... Test objective: The objective is to test that the retrieval of individual grant for a particular Lifecycle operation fails when using an invalid resource identifier + ... Pre-conditions: The grant information is available to the NFVO + ... Reference: Clause 7.5.4.3.2 - ETSI GS NFV-SOL 011 [1] v3.3.1 + ... Config ID: Config_prod_NFVO + ... Applicability: Invalid resource identifier is used + ... Post-Conditions: none + Get individual grant + Check HTTP Response Status Code Is 404 + Check HTTP Response Body Json Schema Is ProblemDetails \ No newline at end of file -- GitLab From 6c270925e3d1ab640cdf0fddda86bee9e3ca498f Mon Sep 17 00:00:00 2001 From: Giacomo Bernini Date: Wed, 13 Jan 2021 12:01:19 +0100 Subject: [PATCH 07/11] added API Version tests --- .../ApiVersion.robot | 213 ++++++++++++++++++ .../ApiVersion.robot | 213 ++++++++++++++++++ 2 files changed, 426 insertions(+) create mode 100644 SOL011/NSInstanceUsageNotification-API/ApiVersion.robot create mode 100644 SOL011/NSLifecycleOperationGranting-API/ApiVersion.robot diff --git a/SOL011/NSInstanceUsageNotification-API/ApiVersion.robot b/SOL011/NSInstanceUsageNotification-API/ApiVersion.robot new file mode 100644 index 000000000..35b99e089 --- /dev/null +++ b/SOL011/NSInstanceUsageNotification-API/ApiVersion.robot @@ -0,0 +1,213 @@ +*** 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: 9.3.4.5.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: 9.3.4.5.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: 9.3.4.5.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: 9.3.4.5.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: 9.3.4.5.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: 9.3.4.5.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] Test ID: 9.3.4.5.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: 9.3.4.5.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: 9.3.4.5.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: 9.3.4.5.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 + +*** 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}/v1/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}/v1/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}/v1/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}/v1/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}/v1/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/SOL011/NSLifecycleOperationGranting-API/ApiVersion.robot b/SOL011/NSLifecycleOperationGranting-API/ApiVersion.robot new file mode 100644 index 000000000..6bfc8a1a9 --- /dev/null +++ b/SOL011/NSLifecycleOperationGranting-API/ApiVersion.robot @@ -0,0 +1,213 @@ +*** 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: 9.3.3.2.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: 9.3.3.2.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: 9.3.3.2.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: 9.3.3.2.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: 9.3.3.2.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: 9.3.3.2.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] Test ID: 9.3.3.2.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: 9.3.3.2.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: 9.3.3.2.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: 9.3.3.2.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 + +*** Keywords *** +POST API Version + Set Headers {"Accept":"${ACCEPT}"} + 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}"} + 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}"} + 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}"} + 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}"} + 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}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Post ${apiRoot}/${apiName}/v1/api_versions + ${outputResponse}= Output response + Set Global Variable ${response} ${outputResponse} + +GET API Version with apiMajorVersion + Set Headers {"Accept":"${ACCEPT}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Get ${apiRoot}/${apiName}/v1/api_versions + ${outputResponse}= Output response + Set Global Variable ${response} ${outputResponse} + +PUT API Version with apiMajorVersion + Set Headers {"Accept":"${ACCEPT}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Put ${apiRoot}/${apiName}/v1/api_versions + ${outputResponse}= Output response + Set Global Variable ${response} ${outputResponse} + +PATCH API Version with apiMajorVersion + Set Headers {"Accept":"${ACCEPT}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Patch ${apiRoot}/${apiName}/v1/api_versions + ${outputResponse}= Output response + Set Global Variable ${response} ${outputResponse} + +DELETE API Version with apiMajorVersion + Set Headers {"Accept":"${ACCEPT}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Delete ${apiRoot}/${apiName}/v1/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 -- GitLab From 40eb3a885893603374d73f664fc1c142aa0473b8 Mon Sep 17 00:00:00 2001 From: Giacomo Bernini Date: Wed, 13 Jan 2021 12:01:45 +0100 Subject: [PATCH 08/11] fixes to NSInstanceUsageNotification-API --- .../IndividualSubscription.robot | 1 + .../NSInstanceUsageNotificationKeywords.robot | 35 +++++++++++++++++++ .../Subscriptions.robot | 8 +++-- 3 files changed, 42 insertions(+), 2 deletions(-) diff --git a/SOL011/NSInstanceUsageNotification-API/IndividualSubscription.robot b/SOL011/NSInstanceUsageNotification-API/IndividualSubscription.robot index c742db50a..5f8fa000b 100644 --- a/SOL011/NSInstanceUsageNotification-API/IndividualSubscription.robot +++ b/SOL011/NSInstanceUsageNotification-API/IndividualSubscription.robot @@ -67,6 +67,7 @@ DELETE an individual subscription ... Post-Conditions: The NS instance usage notification subscription is not available anymore on NFVO 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: 9.3.4.2.6 diff --git a/SOL011/NSInstanceUsageNotification-API/NSInstanceUsageNotificationKeywords.robot b/SOL011/NSInstanceUsageNotification-API/NSInstanceUsageNotificationKeywords.robot index 0a71abbbc..dd6194450 100644 --- a/SOL011/NSInstanceUsageNotification-API/NSInstanceUsageNotificationKeywords.robot +++ b/SOL011/NSInstanceUsageNotification-API/NSInstanceUsageNotificationKeywords.robot @@ -225,3 +225,38 @@ 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} + +Check Postcondition Individual Subscription is Deleted + Log Check Postcondition Subscription is deleted + GET individual Subscription + Check HTTP Response Status Code Is 404 + +Check Postcondition Subscription Is Set + Log Check Postcondition subscription exist + Log Trying to get the subscription + Set Headers {"Accept": "${ACCEPT_JSON}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"} + GET ${apiRoot}/${apiName}/${apiVersion}/subscriptions/${response['body']['id']} + ${output}= Output response + Set Suite Variable ${response} ${output} + Check HTTP Response Status Code Is 200 + +Check Postcondition 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 NsdmSubscription.schema.json ${result} + Log Validated NsdmSubscription schema + ${body}= Get File jsons/subscriptions.json + ${subscription}= evaluate json.loads('''${body}''') json + Should Be Equal ${result['callbackUri']} ${subscription['callbackUri']} + Log Validated Issued subscription is same as original + +Check Postcondition Subscriptions Exist + Log Checking that subscriptions exists + Get Subscriptions \ No newline at end of file diff --git a/SOL011/NSInstanceUsageNotification-API/Subscriptions.robot b/SOL011/NSInstanceUsageNotification-API/Subscriptions.robot index dd9d259e1..efde683fa 100644 --- a/SOL011/NSInstanceUsageNotification-API/Subscriptions.robot +++ b/SOL011/NSInstanceUsageNotification-API/Subscriptions.robot @@ -21,6 +21,7 @@ POST Create a new subscription Check HTTP Response Header Contains Location Check HTTP Response Body Json Schema Is subscription Check HTTP Response Header Contains Resource URI + Check Postcondition Subscription Is Set POST Create a new Subscription - DUPLICATION [Documentation] Test ID: 9.3.4.1.2 @@ -36,6 +37,7 @@ POST Create a new Subscription - DUPLICATION Check HTTP Response Status Code Is 201 Check HTTP Response Header Contains Location Check HTTP Response Body Json Schema Is subscription + Check Postcondition Subscription Resource Returned in Location Header Is Available POST Create a new Subscription - NO-DUPLICATION [Documentation] Test ID: 9.3.4.1.3 @@ -50,6 +52,7 @@ POST Create a new Subscription - NO-DUPLICATION Check Subscription Existence Check HTTP Response Status Code Is 303 Check HTTP Response Header Contains Location + Check Postcondition Subscription Is Set GET Subscriptions [Documentation] Test ID: 9.3.4.1.4 @@ -203,6 +206,7 @@ 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: 9.3.4.1.16 @@ -211,8 +215,8 @@ GET subscriptions with "exclude_default" and "fields" attribute selector ... Pre-conditions: ... Reference: Clause 8.5.3.3.2 - ETSI GS NFV-SOL 011 [6] v3.3.1 ... Config ID: Config_prod_NFVO - ... Applicability: - ... Post-Conditions: + ... 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 -- GitLab From c0a1eacddc89d957bfaa84daea9c0d11688e89a3 Mon Sep 17 00:00:00 2001 From: Giacomo Bernini Date: Wed, 13 Jan 2021 12:02:00 +0100 Subject: [PATCH 09/11] fixes to NSLifecycleOperationGranting-API --- .../Grants.robot | 12 ++++++------ .../IndividualGrant.robot | 10 +++++----- .../NSLCOperationGrantingKeywords.robot | 16 +++++++++++++++- 3 files changed, 26 insertions(+), 12 deletions(-) diff --git a/SOL011/NSLifecycleOperationGranting-API/Grants.robot b/SOL011/NSLifecycleOperationGranting-API/Grants.robot index 8b5cd238c..55efdec90 100644 --- a/SOL011/NSLifecycleOperationGranting-API/Grants.robot +++ b/SOL011/NSLifecycleOperationGranting-API/Grants.robot @@ -20,7 +20,7 @@ Requests a grant for a particular NS lifecycle operation Check HTTP Response Status Code Is 201 Check HTTP Response Body Json Schema Is Grant Check HTTP Response Header Contains Location - Check Resource URI existence + Check Postcondition Grant Is Set Requests a grant for a particular NS lifecycle operation - Forbidden [Documentation] Test ID: 9.3.3.1.2 @@ -38,7 +38,7 @@ Requests a grant for a particular NS lifecycle operation - Forbidden GET Grants - Method not implemented [Documentation] Test ID: 9.3.3.1.3 ... Test title: GET Grants - Method not implemented - ... Test objective: The objective is to test that GET method is not allowed for Life cycle operation granting + ... Test objective: The objective is to test that GET method is not allowed for Lifecycle operation granting ... Pre-conditions: none ... Reference: Clause 7.5.3.3.2 - ETSI GS NFV-SOL 011 [6] v3.3.1 ... Config ID: Config_prod_NFVO @@ -50,7 +50,7 @@ GET Grants - Method not implemented PUT Grants - Method not implemented [Documentation] Test ID: 9.3.3.1.4 ... Test title: PUT Grants - Method not implemented - ... Test objective: The objective is to test that PUT method is not allowed for Life cycle operation granting + ... Test objective: The objective is to test that PUT method is not allowed for Lifecycle operation granting ... Pre-conditions: none ... Reference: Clause 7.5.3.3.3 - ETSI GS NFV-SOL 011 [6] v3.3.1 ... Config ID: Config_prod_NFVO @@ -62,7 +62,7 @@ PUT Grants - Method not implemented PATCH Grants - Method not implemented [Documentation] Test ID: 9.3.3.1.5 ... Test title: PATCH Grants - Method not implemented - ... Test objective: The objective is to test that PATCH method is not allowed for Life cycle operation granting + ... Test objective: The objective is to test that PATCH method is not allowed for Lifecycle operation granting ... Pre-conditions: none ... Reference: Clause 7.5.3.3.4 - ETSI GS NFV-SOL 011 [6] v3.3.1 ... Config ID: Config_prod_NFVO @@ -74,7 +74,7 @@ PATCH Grants - Method not implemented DELETE Grants - Method not implemented [Documentation] Test ID: 9.3.3.1.6 ... Test title: DELETE Grants - Method not implemented - ... Test objective: The objective is to test that DELETE method is not allowed for Life cycle operation granting + ... Test objective: The objective is to test that DELETE method is not allowed for Lifecycle operation granting ... Pre-conditions: none ... Reference: Clause 7.5.3.3.5 - ETSI GS NFV-SOL 011 [6] v3.3.1 ... Config ID: Config_prod_NFVO @@ -82,4 +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 \ No newline at end of file + Check Postcondition Grants Exist \ No newline at end of file diff --git a/SOL011/NSLifecycleOperationGranting-API/IndividualGrant.robot b/SOL011/NSLifecycleOperationGranting-API/IndividualGrant.robot index e85fd0dff..3b05958c4 100644 --- a/SOL011/NSLifecycleOperationGranting-API/IndividualGrant.robot +++ b/SOL011/NSLifecycleOperationGranting-API/IndividualGrant.robot @@ -13,7 +13,7 @@ Documentation This resource represents an individual grant. The client can us POST Individual Grant - Method not implemented [Documentation] Test ID: 9.3.3.2.1 ... Test title: POST Individual Grant - Method not implemented - ... Test objective: The objective is to test that POST method is not allowed for Life cycle operation granting + ... Test objective: The objective is to test that POST method is not allowed for Lifecycle operation granting ... Pre-conditions: none ... Reference: Clause 7.5.4.3.1 - ETSI GS NFV-SOL 011 [1] v3.3.1 ... Config ID: Config_prod_NFVO @@ -38,7 +38,7 @@ GET an individual grant - Successful PUT an individual grant - Method not implemented [Documentation] Test ID: 9.3.3.2.3 ... Test title: PUT an individual grant - Method not implemented - ... Test objective: The objective is to test that PUT method is not allowed to for Life cycle operation granting + ... Test objective: The objective is to test that PUT method is not allowed to for Lifecycle operation granting ... Pre-conditions: none ... Reference: Clause 7.5.4.3.3 - ETSI GS NFV-SOL 011 [1] v3.3.1 ... Config ID: Config_prod_NFVO @@ -50,7 +50,7 @@ PUT an individual grant - Method not implemented PATCH an individual grant - Method not implemented [Documentation] Test ID: 9.3.3.2.4 ... Test title: PATCH an individual grant - Method not implemented - ... Test objective: The objective is to test that PATCH method is not allowed to for Life cycle operation granting + ... Test objective: The objective is to test that PATCH method is not allowed to for Lifecycle operation granting ... Pre-conditions: none ... Reference: Clause 7.5.4.3.4 - ETSI GS NFV-SOL 011 [1] v3.3.1 ... Config ID: Config_prod_NFVO @@ -62,12 +62,12 @@ PATCH an individual grant - Method not implemented DELETE an individual grant - Method not implemented [Documentation] Test ID: 9.3.3.2.5 ... Test title: DELETE an individual grant - Method not implemented - ... Test objective: The objective is to test that DELETE method is not allowed to for Life cycle operation granting + ... Test objective: The objective is to test that DELETE method is not allowed to for Lifecycle operation granting ... Pre-conditions: none ... Reference: Clause 7.5.4.3.5 - ETSI GS NFV-SOL 011 [1] v3.3.1 ... Config ID: Config_prod_NFVO ... Applicability: none - ... Post-Conditions: Grant is not deleted + ... Post-Conditions: none Delete individual Grant Check HTTP Response Status Code Is 405 diff --git a/SOL011/NSLifecycleOperationGranting-API/NSLCOperationGrantingKeywords.robot b/SOL011/NSLifecycleOperationGranting-API/NSLCOperationGrantingKeywords.robot index e3b363042..9d29ab9d9 100644 --- a/SOL011/NSLifecycleOperationGranting-API/NSLCOperationGrantingKeywords.robot +++ b/SOL011/NSLifecycleOperationGranting-API/NSLCOperationGrantingKeywords.robot @@ -125,4 +125,18 @@ Delete individual Grant 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 + Set Suite Variable ${response} ${body} + +Check Postcondition Grants Exist + Log Checking that grants exists + Get Grants + +Check Postcondition Grant Is Set + Log Check Postcondition subscription exist + Log Trying to get the subscription + Set Headers {"Accept": "${ACCEPT}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"} + GET ${apiRoot}/${apiName}/${apiVersion}/grants/${response['body']['id']} + ${output}= Output response + Set Suite Variable ${response} ${output} + Check HTTP Response Status Code Is 200 \ No newline at end of file -- GitLab From 14606a75868b868857f52b6cda06f3fbd2b72e2d Mon Sep 17 00:00:00 2001 From: Giacomo Bernini Date: Wed, 13 Jan 2021 12:44:49 +0100 Subject: [PATCH 10/11] fixed test ids --- .../ApiVersion.robot | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/SOL011/NSLifecycleOperationGranting-API/ApiVersion.robot b/SOL011/NSLifecycleOperationGranting-API/ApiVersion.robot index 6bfc8a1a9..501c850e3 100644 --- a/SOL011/NSLifecycleOperationGranting-API/ApiVersion.robot +++ b/SOL011/NSLifecycleOperationGranting-API/ApiVersion.robot @@ -9,7 +9,7 @@ Library JSONSchemaLibrary schemas/ *** Test Cases *** POST API Version - Method not implemented - [Documentation] Test ID: 9.3.3.2.1 + [Documentation] Test ID: 9.3.3.3.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 @@ -21,7 +21,7 @@ POST API Version - Method not implemented Check HTTP Response Status Code Is 405 GET API Version - [Documentation] Test ID: 9.3.3.2.2 + [Documentation] Test ID: 9.3.3.3.2 ... Test title: GET API Version ... Test objective: The objective is to test that GET method successfully return ApiVersionInformation ... Pre-conditions: none @@ -34,7 +34,7 @@ GET API Version Check HTTP Response Body Json Schema Is ApiVersionInformation PUT API Version - Method not implemented - [Documentation] Test ID: 9.3.3.2.3 + [Documentation] Test ID: 9.3.3.3.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 @@ -46,7 +46,7 @@ PUT API Version - Method not implemented Check HTTP Response Status Code Is 405 PATCH API Version - Method not implemented - [Documentation] Test ID: 9.3.3.2.4 + [Documentation] Test ID: 9.3.3.3.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 @@ -58,7 +58,7 @@ PATCH API Version - Method not implemented Check HTTP Response Status Code Is 405 DELETE API Version - Method not implemented - [Documentation] Test ID: 9.3.3.2.5 + [Documentation] Test ID: 9.3.3.3.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 @@ -70,7 +70,7 @@ DELETE API Version - Method not implemented Check HTTP Response Status Code Is 405 POST API Version with apiMajorVerion - Method not implemented - [Documentation] Test ID: 9.3.3.2.6 + [Documentation] Test ID: 9.3.3.3.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 @@ -82,7 +82,7 @@ POST API Version with apiMajorVerion - Method not implemented Check HTTP Response Status Code Is 405 GET API Version with apiMajorVerion - [Documentation] Test ID: 9.3.3.2.7 + [Documentation] Test ID: 9.3.3.3.7 ... Test title: GET API Version with apiMajorVerion ... Test objective: The objective is to test that GET method successfully return ApiVersionInformation ... Pre-conditions: none @@ -95,7 +95,7 @@ GET API Version with apiMajorVerion Check HTTP Response Body Json Schema Is ApiVersionInformation PUT API Version with apiMajorVerion - Method not implemented - [Documentation] Test ID: 9.3.3.2.8 + [Documentation] Test ID: 9.3.3.3.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 @@ -107,7 +107,7 @@ PUT API Version with apiMajorVerion - Method not implemented Check HTTP Response Status Code Is 405 PATCH API Version with apiMajorVerion - Method not implemented - [Documentation] Test ID: 9.3.3.2.9 + [Documentation] Test ID: 9.3.3.3.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 @@ -119,7 +119,7 @@ PATCH API Version with apiMajorVerion - Method not implemented Check HTTP Response Status Code Is 405 DELETE API Version with apiMajorVerion - Method not implemented - [Documentation] Test ID: 9.3.3.2.10 + [Documentation] Test ID: 9.3.3.3.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 -- GitLab From 2cea6039b6abd3bc0ba3ea3e01973ae42962f97f Mon Sep 17 00:00:00 2001 From: Giacomo Bernini Date: Wed, 13 Jan 2021 12:45:03 +0100 Subject: [PATCH 11/11] added SOL011 index file --- indexes/sol_011_index.csv | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 indexes/sol_011_index.csv diff --git a/indexes/sol_011_index.csv b/indexes/sol_011_index.csv new file mode 100644 index 000000000..c9cc67aea --- /dev/null +++ b/indexes/sol_011_index.csv @@ -0,0 +1,11 @@ +9, Or-Or Reference Point, SOL011 +9.3.3,NS Lifecycle Operation Granting interface +9.3.3.1,Grants Endpoint, Grants.robot +9.3.3.2,Individual Grant Endpoint, IndividualGrant.robot +9.3.3.3,API Version Endpoint, ApiVersion.robot +9.3.4,NS Instance Usage Notification interface +9.3.4.1,Subscriptions Endpoint, Subscriptions.robot +9.3.4.2,Individual Subscription Endpoint, IndividualSubscription.robot +9.3.4.3,Notifications Endpoint, NotificationEndpoint.robot +9.3.4.4,Notification Consumer Endpoint, NotificationConsumer.robot +9.3.4.5,API Version Endpoint, ApiVersion.robot -- GitLab