Skip to content
Snippets Groups Projects
Commit b3e55949 authored by zafar's avatar zafar Committed by Giacomo Bernini
Browse files

New Resource added in SOL011: Grants.robot

parent 38b9fe82
No related branches found
No related tags found
2 merge requests!199Merge "3.3.1 dev" into "release 3" master,!1733.3.1 dev sol011 final
*** 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
*** 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} {}
{
"nsInstanceId": "",
"nsdId": "",
"nsLcmOpOccId": "",
"lifecycleOperation": "SCALE"
}
\ No newline at end of file
{
"nsInstanceId": "",
"nsdId": "",
"nsLcmOpOccId": "",
"lifecycleOperation": "SCALE"
}
\ No newline at end of file
{
"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
{
"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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment