Commit 00027262 authored by Elian Kraja's avatar Elian Kraja
Browse files

Extension for jsonlibrary in case of python3. Small fixies. SOL005 completed

parent f8cc3de1
{
"changeStateTo": "STOPPED",
"stopType": "FORCEFUL"
"stopType": "FORCEFUL",
"additionalParams": {}
}
\ No newline at end of file
......@@ -7,7 +7,7 @@
"crossingDirection": "UP",
"objectInstanceId": "vnfID",
"performanceMetric": "performanceMetric",
"performanceValue": 7
"performanceValue": 7,
"_links": {
"subscription": "link to subscription",
"threshold": "link to threshold"
......
{
"changeStateTo": "STOPPED",
"stopType": "FORCEFUL"
"stopType": "FORCEFUL",
"additionalParams": {}
}
\ No newline at end of file
......@@ -9,7 +9,7 @@ Library REST ${NFVO_SCHEMA}://${NFVO_HOST}:${NFVO_PORT}
GET VNF Package Artifact
Log Trying to get a VNF Package Artifact
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"}
GET ${apiRoot}/${apiName}/${apiVersion}/vnf_packages/${vnfPkgId}/artifacts/{artifactPath}
GET ${apiRoot}/${apiName}/${apiVersion}/vnf_packages/${vnfPkgId}/artifacts/${artifactPath}
Integer response status 200
Log Received a 200 OK as expected
${contentType}= Output response headers Content-Type
......@@ -20,7 +20,7 @@ GET VNF Package Artifact - Range
Pass Execution If ${NFVO_RANGE_OK} == 0 Skipping this test as NFVO is not able to handle partial Requests.
Set Headers {"Range": "${range}"}
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"}
GET ${apiRoot}/${apiName}/${apiVersion}/vnf_packages/${vnfPkgId}/artifacts/{artifactPath}
GET ${apiRoot}/${apiName}/${apiVersion}/vnf_packages/${vnfPkgId}/artifacts/${artifactPath}
Integer response status 206
Log Received 206 Partial Content as expected.
${headers}= Output response headers
......@@ -32,7 +32,7 @@ GET VNF Package Artifact - NFVO No RANGE
Pass Execution If ${NFVO_RANGE_OK} == 1 Skipping this test as NFVO is able to handle partial Requests.
Set Headers {"Range": "${range}"}
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"}
GET ${apiRoot}/${apiName}/${apiVersion}/vnf_packages/${vnfPkgId}/artifacts/{artifactPath}
GET ${apiRoot}/${apiName}/${apiVersion}/vnf_packages/${vnfPkgId}/artifacts/${artifactPath}
Integer response status 200
Log Received 200 OK as expected. The content is all available on this request. RANGE request has been ignored.
......@@ -41,7 +41,7 @@ GET VNF Package Artifact - Negative Range
Pass Execution If ${NFVO_RANGE_OK} == 0 Skipping this test as NFVO is not able to handle partial Requests.
Set Headers {"Range": "${range}"}
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"}
GET ${apiRoot}/${apiName}/${apiVersion}/vnf_packages/${vnfPkgId}/artifacts/{artifactPath}
GET ${apiRoot}/${apiName}/${apiVersion}/vnf_packages/${vnfPkgId}/artifacts/${artifactPath}
Integer response status 416
Log Received 416 Range not satisfiable as expected.
${contentType}= Output response headers Content-Type
......@@ -55,7 +55,7 @@ GET VNF Package Artifact - Negative Range
GET VNF Package Artifact- Negative (Not Found)
Log Trying to perform a negative get, using an erroneous package ID
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"}
GET ${apiRoot}/${apiName}/${apiVersion}/vnf_packages/${erroneousVnfPkgId}/artifacts/{artifactPath}
GET ${apiRoot}/${apiName}/${apiVersion}/vnf_packages/${erroneousVnfPkgId}/artifacts/${artifactPath}
Integer response status 404
Log Received 404 Not Found as expected
${contentType}= Output response headers Content-Type
......@@ -69,7 +69,7 @@ GET VNF Package Artifact- Negative (Not Found)
GET VNF Package Artifact - Negative (onboardingState issue)
Log Trying to get a VNF Package artifact present in the NFVO Catalogue, but not in ONBOARDED operationalStatus
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"}
GET ${apiRoot}/${apiName}/${apiVersion}/vnf_packages/${erroneousVnfPkgId}/artifacts/{artifactPath}
GET ${apiRoot}/${apiName}/${apiVersion}/vnf_packages/${erroneousVnfPkgId}/artifacts/${artifactPath}
Integer response status 409
Log Received 409 Conflict as expected
${contentType}= Output response headers Content-Type
......@@ -83,27 +83,27 @@ GET VNF Package Artifact - Negative (onboardingState issue)
POST VNF Package Artifact - (Method not implemented)
Log Trying to perform a POST (method should not be implemented)
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"}
POST ${apiRoot}/${apiName}/${apiVersion}/vnf_packages/${vnfPkgId}/artifacts/{artifactPath}
POST ${apiRoot}/${apiName}/${apiVersion}/vnf_packages/${vnfPkgId}/artifacts/${artifactPath}
Integer response status 405
Log Received 405 Method not implemented as expected
PUT VNF Package Artifact - (Method not implemented)
Log Trying to perform a PUT. This method should not be implemented
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"}
PUT ${apiRoot}/${apiName}/${apiVersion}/vnf_packages/${vnfPkgId}/artifacts/{artifactPath}
PUT ${apiRoot}/${apiName}/${apiVersion}/vnf_packages/${vnfPkgId}/artifacts/${artifactPath}
Integer response status 405
Log Received 405 Method not implemented as expected
PATCH VNF Package Artifact - (Method not implemented)
Log Trying to perform a PATCH. This method should not be implemented
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"}
PATCH ${apiRoot}/${apiName}/${apiVersion}/vnf_packages/${vnfPkgId}/artifacts/{artifactPath}
PATCH ${apiRoot}/${apiName}/${apiVersion}/vnf_packages/${vnfPkgId}/artifacts/${artifactPath}
Integer response status 405
Log Received 405 Method not implemented as expected
DELETE VNF Package Artifact - (Method not implemented)
Log Trying to perform a DELETE. This method should not be implemented
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"}
DELETE ${apiRoot}/${apiName}/${apiVersion}/vnf_packages/${vnfPkgId}/artifacts/{artifactPath}
DELETE ${apiRoot}/${apiName}/${apiVersion}/vnf_packages/${vnfPkgId}/artifacts/${artifactPath}
Integer response status 405
Log Received 405 Method not implemented as expected
......@@ -49,8 +49,14 @@ DELETE Individual PM Job - Negative (Not Found)
Run Keyword If ${VNFM_AUTH_USAGE} == 1 Set Headers {"Authorization": "${VNFM_AUTHENTICATION}"}
DELETE ${apiRoot}/${apiName}/${apiVersion}/pm_jobs/${erroneousPmJobId}
Integer response status 404
Log Received 204 No Content as expected
Log Received 404 Not Found as expected
Log Trying to validate ProblemDetails
${problemDetails}= Output response body
${json}= evaluate json.loads('''${problemDetails}''') json
Validate Json ProblemDetails.schema.json ${json}
Log Validation OK
POST Individual PM Job - (Method not implemented)
Log Trying to perform a POST (method should not be implemented)
Set Headers {"Accept": "${ACCEPT_JSON}"}
......
......@@ -7,7 +7,7 @@
"crossingDirection": "UP",
"objectInstanceId": "vnfID",
"performanceMetric": "performanceMetric",
"performanceValue": 7
"performanceValue": 7,
"_links": {
"subscription": "link to subscription",
"threshold": "link to threshold"
......
......@@ -3,10 +3,12 @@ Documentation This clause defines all the resources and methods provided by
Library JSONSchemaLibrary schemas/
Resource environment/generic.txt # Generic Parameters
Resource environment/nsDescriptors.txt # Specific nsDescriptors Parameters
Library OperatingSystem
Library JSONLibrary
Library REST ${NFVO_SCHEMA}://${NFVO_HOST}:${NFVO_PORT}
Library OperatingSystem
Library JSONSchemaLibrary schemas/
*** Variable ***
*** Test Cases ***
GET Single Network Service Descriptor
[Documentation] The GET method reads information about an individual NS descriptor.
......@@ -44,6 +46,19 @@ GET Single Network Service Descriptor (Negative: Not found)
PATCH Single Network Service Descriptor - (Disabling a nsdInfo)
[Documentation] The PATCH method modifies the operational state and/or user defined data of an individual NS descriptor resource.
... This method can be used to:
...
... 1) Enable a previously disabled individual NS descriptor resource, allowing again its use for instantiation of new
... network service with this descriptor. The usage state (i.e. "IN_USE/NOT_IN_USE") shall not change as a
... result.
...
... 2) Disable a previously enabled individual NS descriptor resource, preventing any further use for instantiation of
... new network service(s) with this descriptor. The usage state (i.e. "IN_USE/NOT_IN_USE") shall not change
... as a result.
...
... 3) Modify the user defined data of an individual NS descriptor resource.
...
Log Trying to perform a PATCH. As prerequisite the nsdInfo shall be in enabled operational state
Set Headers {"Accept": "${ACCEPT_JSON}"}
Set Headers {"Content-Type": "${CONTENT_TYPE_JSON}"}
......@@ -66,12 +81,57 @@ PATCH Single Network Service Descriptor - (Enabling an previously disabled nsdIn
PATCH ${apiRoot}/${apiName}/${apiVersion}/ns_descriptors/${nsdInfoId} ${body}
Integer response status 200
Log Received 200 OK as expected
# ${result}= Output response body
# ${json}= evaluate json.loads('''${result}''') json
# Validate Json NsdInfoModification.schema.json ${json}
# Log Validation of NsdInfoModifications OK
${result}= Output response body
${json}= evaluate json.loads('''${result}''') json
Validate Json NsdInfoModification.schema.json ${json}
Log Validation of NsdInfoModifications OK
PATCH Single Network Service Descriptor - NEGATIVE (Trying to enable an previously enabled nsdInfo)
Log Trying to perform a PATCH. As prerequisite the nsdInfo shall be in enabled operational state
Set Headers {"Accept": "${ACCEPT_JSON}"}
Set Headers {"Content-Type": "${CONTENT_TYPE_JSON}"}
${body}= Get File json/NsdInfoModificationEnable.json
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"}
PATCH ${apiRoot}/${apiName}/${apiVersion}/ns_descriptors/${enabledNsdInfoId} ${body}
Integer response status 409
Log Received 409 Conflict as expected
${contentType}= Output response headers Content-Type
Should Contain ${contentType} application/json
Log Trying to validate ProblemDetails
${problemDetails}= Output response body
${json}= evaluate json.loads('''${problemDetails}''') json
Validate Json ProblemDetails.schema.json ${json}
Log Validation OK
PATCH Single Network Service Descriptor - NEGATIVE (Trying to get an ETag mismatch)
Log Trying to perform a PATCH. As prerequisite the nsdInfo shall be modified by another entity
Set Headers {"Accept": "${ACCEPT_JSON}"}
Set Headers {"Content-Type": "${CONTENT_TYPE_JSON}"}
Set Headers {"If-Match": "${Etag}"}
${body}= Get File json/NsdInfoModificationEnable.json
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"}
PATCH ${apiRoot}/${apiName}/${apiVersion}/ns_descriptors/${modifiedNsdInfoId} ${body}
Integer response status 412
Log Received 412 Precondition failed as expected
${returned_etag}= Output response headers Etag
Log Verify different etags
Should Not Be Equal ${Etag} ${returned_etag}
${contentType}= Output response headers Content-Type
Should Contain ${contentType} application/json
Log Trying to validate ProblemDetails
${problemDetails}= Output response body
${json}= evaluate json.loads('''${problemDetails}''') json
Validate Json ProblemDetails.schema.json ${json}
Log Validation OK
DELETE Single Network Service Descriptor
[Documentation] The DELETE method deletes an individual NS descriptor resource.
... An individual NS descriptor resource can only be deleted when there is no NS instance using it (i.e. usageState =
... NOT_IN_USE) and has been disabled already (i.e. operationalState = DISABLED). Otherwise, the DELETE method
... shall fail.
Log Trying to perform a DELETE nsdInfo. The nsdInfo should be in "NOT_USED" usageState and in "DISABLED" operationalState.
Set Headers {"Accept": "${ACCEPT_JSON}"}
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"}
......@@ -81,6 +141,10 @@ DELETE Single Network Service Descriptor
DELETE Single Network Service Descriptor (Negative: Trying to delete an enabled nsdInfo)
[Documentation] The DELETE method deletes an individual NS descriptor resource.
... An individual NS descriptor resource can only be deleted when there is no NS instance using it (i.e. usageState =
... NOT_IN_USE) and has been disabled already (i.e. operationalState = DISABLED). Otherwise, the DELETE method
... shall fail.
Log Trying to perform a DELETE nsdInfo in ENABLED operational state
Set Headers {"Accept": "${ACCEPT_JSON}"}
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"}
......
......@@ -20,11 +20,11 @@ GET Single PNF Descriptor
${contentType}= Output response headers Content-Type
Should Contain ${contentType} application/json
Log Validation of Content-Type : OK
# Log Trying to validate response
# ${result}= Output response body
# ${json}= evaluate json.loads('''${result}''') json
# Validate Json NsdInfo.schema.json ${json}
# Log Validation OK
Log Trying to validate response
${result}= Output response body
${json}= evaluate json.loads('''${result}''') json
Validate Json NsdInfo.schema.json ${json}
Log Validation OK
GET Single PNF Descriptor (Negative: Not found)
......@@ -55,10 +55,10 @@ PATCH Single PNF Descriptor - (Disabling a nsdInfo)
PATCH ${apiRoot}/${apiName}/${apiVersion}/pnf_descriptors/${pnfdInfoId} ${body}
Integer response status 200
Log Received 200 OK as expected
# ${result}= Output response body
# ${json}= evaluate json.loads('''${result}''') json
# Validate Json PnfdInfoModification.schema.json ${json}
# Log Validation of PnfdInfoModification OK
${result}= Output response body
${json}= evaluate json.loads('''${result}''') json
Validate Json PnfdInfoModification.schema.json ${json}
Log Validation of PnfdInfoModification OK
DELETE Single PNF Descriptor
......
*** Settings ***
Library JSONSchemaLibrary schemas/
Resource environment/generic.txt # Generic Parameters
Resource environment/individualSubscription.txt
Library OperatingSystem
Library JSONLibrary
Library REST ${NFVO_SCHEMA}://${NFVO_HOST}:${NFVO_PORT}
*** Test Cases ***
GET Individual Subscription
Log Trying to get a single subscription identified by subscriptionId
Set Headers {"Accept": "${ACCEPT_JSON}"}
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"}
GET ${apiRoot}/${apiName}/${apiVersion}/subscriptions/${subscriptionId}
Integer response status 200
Log Received a 200 OK as expected
${contentType}= Output response headers Content-Type
Should Contain ${contentType} ${CONTENT_TYPE_JSON}
${result}= Output response body
${json}= evaluate json.loads('''${result}''') json
Validate Json NsdmSubscription.schema.json ${json}
Log Validated NsdmSubscription schema
GET Subscription - Negative (Not Found)
Log Trying to perform a request on a subscriptionID which doesn't exist
Set Headers {"Accept": "${ACCEPT_JSON}"}
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"}
GET ${apiRoot}/${apiName}/${apiVersion}/subscriptions/${erroneousSubscriptionId}
Integer response status 404
Log Received 404 Not Found as expected
${contentType}= Output response headers Content-Type
Should Contain ${contentType} ${CONTENT_TYPE_JSON}
Log Trying to validate ProblemDetails
${problemDetails}= Output response body
${json}= evaluate json.loads('''${problemDetails}''') json
Validate Json ProblemDetails.schema.json ${json}
Log Validation OK
DELETE Subscription
Log Trying to perform a DELETE on a subscriptionId
Set Headers {"Accept": "${ACCEPT_JSON}"}
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"}
DELETE ${apiRoot}/${apiName}/${apiVersion}/subscriptions/${subscriptionId}
Integer response status 204
Log Received 204 No Content as expected
Comment Log Trying to get the deleted element
Comment Create HTTP Context ${NFVO_HOST}:${NFVO_PORT} ${NFVO_SCHEMA}
Comment Set Request Header Accept ${ACCEPT_JSON}
Comment Run Keyword If ${AUTH_USAGE} == 1 Set Request Header Authorization ${AUTHORIZATION}
Comment GET ${apiRoot}/${apiName}/${apiVersion}/subscriptions/${subscriptionId}
Comment Response Status Code Should Equal 404
Comment Log The subscriptionId is not present in database
DELETE Subscription - Negative (Not Found)
Log Trying to perform a DELETE on a subscriptionId which doesn't exist
Set Headers {"Accept": "${ACCEPT_JSON}"}
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"}
DELETE ${apiRoot}/${apiName}/${apiVersion}/subscriptions/${erroneousSubscriptionId}
Integer response status 404
Log The subscriptionId is not present in database
${contentType}= Output response headers Content-Type
Should Contain ${contentType} ${CONTENT_TYPE_JSON}
Log Trying to validate ProblemDetails
${problemDetails}= Output response body
${json}= evaluate json.loads('''${problemDetails}''') json
Validate Json ProblemDetails.schema.json ${json}
Log Validation OK
PUT Subscription - (Method not implemented)
Log Trying to perform a PUT. This method should not be implemented
Set Headers {"Accept": "${ACCEPT_JSON}"}
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"}
PUT ${apiRoot}/${apiName}/${apiVersion}/subscriptions/${subscriptionId}
Integer response status 405
Log Received 405 Method not implemented as expected
PATCH Subscription - (Method not implemented)
Log Trying to perform a PATCH. This method should not be implemented
Set Headers {"Accept": "${ACCEPT_JSON}"}
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"}
PATCH ${apiRoot}/${apiName}/${apiVersion}/subscriptions/${subscriptionId}
Integer response status 405
Log Received 405 Method not implemented as expected
POST Subscription - (Method not implemented)
Log Trying to perform a POST. This method should not be implemented
Set Headers {"Accept": "${ACCEPT_JSON}"}
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"}
POST ${apiRoot}/${apiName}/${apiVersion}/subscriptions/${subscriptionId}
Integer response status 405
Log Received 405 Method not implemented as expected
*** Settings ***
Documentation This clause defines the content of the individual NS descriptor, i.e. NSD content
Library JSONSchemaLibrary schemas/
Resource environment/generic.txt # Generic Parameters
Resource environment/nsDescriptors.txt # Specific nsDescriptors Parameters
Library JSONLibrary
Library REST ${NFVO_SCHEMA}://${NFVO_HOST}:${NFVO_PORT}
Library OperatingSystem
*** Test Cases ***
GET NSD Content
[Documentation] The GET method fetches the content of the NSD.
... The NSD can be implemented as a single file or as a collection of multiple files. If the NSD is implemented in the form
... of multiple files, a ZIP file embedding these files shall be returned. If the NSD is implemented as a single file, either
... that file or a ZIP file embedding that file shall be returned.
...
... The selection of the format is controlled by the "Accept" HTTP header passed in the GET request:
...
... - If the "Accept" header contains only "text/plain" and the NSD is implemented as a single file, the file shall be
... returned; otherwise, an error message shall be returned.
...
... - If the "Accept" header contains only "application/zip", the single file or the multiple files that make up the
... NSD shall be returned embedded in a ZIP file.
...
... - If the "Accept" header contains both "text/plain" and "application/zip", it is up to the NFVO to choose the
... format to return for a single-file NSD; for a multi-file NSD, a ZIP file shall be returned.
...
... NOTE: The structure of the NSD zip file is outside the scope of the present document.
...
... This method shall follow the provisions specified in the Tables 5.4.4.3.2-1 and 5.4.4.3.2-2 for URI query parameters,
... request and response data structures, and response codes.
Log The GET method queries multiple NS descriptors
Set Headers {"Accept": "${ACCEPT_ZIP}"}
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"}
GET ${apiRoot}/${apiName}/${apiVersion}/ns_descriptors/${nsdInfoId}/nsd_content
Integer response status 200
${contentType}= Output response headers Content-Type
Should Contain ${contentType} ${CONTENT_TYPE_ZIP}
GET NSD Content - Range
Log Trying to get a NSD Content using RANGE using an NFVO that can handle it
Pass Execution If ${NFVO_RANGE_OK} == 0 Skipping this test as NFVO is not able to handle partial Requests.
Set Headers {"Accept": "${ACCEPT_ZIP}"}
Set Headers {"Range": "${range}"}
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"}
GET ${apiRoot}/${apiName}/${apiVersion}/ns_descriptors/${nsdInfoId}/nsd_content
Integer response status 206
Log Received 206 Partial Content as expected.
${headers}= Output response headers
Should Contain ${headers} Content-Range
Log Header Content-Range is present
Should Contain ${headers} Content-Length
Log Header Content-Length is present
GET NSD Content - Range NFVO No RANGE
Log Trying to get a NSD Content using RANGE using an NFVO that can handle it
Pass Execution If ${NFVO_RANGE_OK} == 1 Skipping this test as NFVO is able to handle partial Requests.
Set Headers {"Accept": "${ACCEPT_ZIP}"}
Set Headers {"Range": "${range}"}
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"}
GET ${apiRoot}/${apiName}/${apiVersion}/ns_descriptors/${nsdInfoId}/nsd_content
Integer response status 200
Log Received 200 OK as expected. The content is all available on this request. RANGE request has been ignored.
GET NSD Content - Negative Range
Log Trying to get a range of bytes of the limit of the NSD Content
Pass Execution If ${NFVO_RANGE_OK} == 0 Skipping this test as NFVO is not able to handle partial Requests.
Set Headers {"Accept": "${ACCEPT_ZIP}"}
Set Headers {"Range": "${erroneousRange}"}
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"}
GET ${apiRoot}/${apiName}/${apiVersion}/ns_descriptors/${nsdInfoId}/nsd_content
Integer response status 416
Log Received 416 Range not satisfiable as expected.
${contentType}= Output response headers Content-Type
Should Contain ${contentType} ${CONTENT_TYPE_JSON}
Log Trying to validate ProblemDetails
${problemDetails}= Output response body
${json}= evaluate json.loads('''${problemDetails}''') json
Validate Json ProblemDetails.schema.json ${json}
Log Validation OK
GET NSD Content- Negative (Not Found)
Log Trying to perform a negative get, using an erroneous package ID
Set Headers {"Accept": "${ACCEPT_ZIP}"}
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"}
GET ${apiRoot}/${apiName}/${apiVersion}/ns_descriptors/${erroneous_nsdInfoId}/nsd_content
Integer response status 404
Log Received 404 Not Found as expected
${contentType}= Output response headers Content-Type
Should Contain ${contentType} ${CONTENT_TYPE_JSON}
Log Trying to validate ProblemDetails
${problemDetails}= Output response body
${json}= evaluate json.loads('''${problemDetails}''') json
Validate Json ProblemDetails.schema.json ${json}
Log Validation OK
GET NSD Content - Negative (onboardingState issue)
Log Trying to get a NSD content present in the NFVO Catalogue, but not in ONBOARDED operationalStatus
Set Headers {"Accept": "${ACCEPT_ZIP}"}
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"}
GET ${apiRoot}/${apiName}/${apiVersion}/ns_descriptors/${onboardingStateNsdInfoId}/nsd_content
Integer response status 409
Log Received 409 Conflict as expected
${contentType}= Output response headers Content-Type
Should Contain ${contentType} ${CONTENT_TYPE_JSON}
Log Trying to validate ProblemDetails
${problemDetails}= Output response body
${json}= evaluate json.loads('''${problemDetails}''') json
Validate Json ProblemDetails.schema.json ${json}
Log Validation OK
PUT a NSD Content - Asynchronous mode
[Documentation] The NSD to be uploaded can be implemented as a single file or as a collection of multiple files, as defined in
... clause 5.4.4.3.2. If the NSD is implemented in the form of multiple files, a ZIP file embedding these files shall be
... uploaded. If the NSD is implemented as a single file, either that file or a ZIP file embedding that file shall be uploaded.
... The "Content-Type" HTTP header in the PUT request shall be set accordingly based on the format selection of the
... NSD.
...
... - If the NSD to be uploaded is a text file, the "Content-Type" header is set to "text/plain".
...
... - If the NSD to be uploaded is a zip file, the "Content-Type" header is set to "application/zip".
...
... This method shall follow the provisions specified in the Tables 5.4.4.3.3-1 and 5.4.4.3.3-2 for URI query parameters,
... request and response data structures, and response codes.
Log Trying to perform a PUT. This method upload the content of a NSD
Set Headers {"Accept": "${ACCEPT_ZIP}"}
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"}
${body}= Get Binary File ${contentFile}
PUT ${apiRoot}/${apiName}/${apiVersion}/ns_descriptors/${nsdInfoId}/nsd_content ${body}
Integer response status 202
Log Received 202 Accepted as expected
${response}= Output response body
Should Be Empty ${response}
PUT a NSD Content - Synchronous mode
[Documentation] The NSD to be uploaded can be implemented as a single file or as a collection of multiple files, as defined in
... clause 5.4.4.3.2. If the NSD is implemented in the form of multiple files, a ZIP file embedding these files shall be
... uploaded. If the NSD is implemented as a single file, either that file or a ZIP file embedding that file shall be uploaded.
... The "Content-Type" HTTP header in the PUT request shall be set accordingly based on the format selection of the
... NSD.
...
... - If the NSD to be uploaded is a text file, the "Content-Type" header is set to "text/plain".
...
... - If the NSD to be uploaded is a zip file, the "Content-Type" header is set to "application/zip".
...
... This method shall follow the provisions specified in the Tables 5.4.4.3.3-1 and 5.4.4.3.3-2 for URI query parameters,
... request and response data structures, and response codes.
Log Trying to perform a PUT. This method upload the content of a NSD
Set Headers {"Accept": "${ACCEPT_ZIP}"}
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"}
${body}= Get Binary File ${contentFile}
PUT ${apiRoot}/${apiName}/${apiVersion}/ns_descriptors/${nsdInfoId}/nsd_content ${body}
Integer response status 200
Log Received 200 OK as expected
${response}= Output response body
Should Be Empty ${response}
PUT a NSD Content - Negative. Nsd in CREATING state
[Documentation] The NSD to be uploaded can be implemented as a single file or as a collection of multiple files, as defined in
... clause 5.4.4.3.2. If the NSD is implemented in the form of multiple files, a ZIP file embedding these files shall be
... uploaded. If the NSD is implemented as a single file, either that file or a ZIP file embedding that file shall be uploaded.
... The "Content-Type" HTTP header in the PUT request shall be set accordingly based on the format selection of the
... NSD.
...
... - If the NSD to be uploaded is a text file, the "Content-Type" header is set to "text/plain".
...
... - If the NSD to be uploaded is a zip file, the "Content-Type" header is set to "application/zip".
...
... This method shall follow the provisions specified in the Tables 5.4.4.3.3-1 and 5.4.4.3.3-2 for URI query parameters,
... request and response data structures, and response codes.
Log Trying to perform a PUT. This method upload the content of a NSD
Set Headers {"Accept": "${ACCEPT_ZIP}"}
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"}
${body}= Get Binary File ${contentFile}
PUT ${apiRoot}/${apiName}/${apiVersion}/ns_descriptors/${creatingNsdInfoId}/nsd_content ${body}
Integer response status 409
Log Received 409 Conflict as expected
${contentType}= Output response headers Content-Type
Should Contain ${contentType} application/json
Log Trying to validate ProblemDetails
${problemDetails}= Output response body
${json}= evaluate json.loads('''${problemDetails}''') json
Validate Json ProblemDetails.schema.json ${json}
Log Validation OK
POST a NSD Content (Method not implemented)
Log Trying to perform a PUT. This method should not be implemented
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"}
POST ${apiRoot}/${apiName}/${apiVersion}/ns_descriptors/${nsdInfoId}/nsd_content
Integer response status 405
Log Received 405 Method not implemented as expected