Commit 7d895626 authored by Elian Kraja's avatar Elian Kraja
Browse files

Added json schema and modified checks on MethodNotImplemented

parent 9a6bc3f0
Loading
Loading
Loading
Loading
+10 −10
Original line number Diff line number Diff line
@@ -85,11 +85,11 @@ PUT Subscription - (Method not implemented)
    PUT    ${apiRoot}/${apiName}/${apiVersion}/subscriptions/${subscriptionId}
    Response Status Code Should Equal    405
    Log    Received 405 Method not implemented as expected
    ${problemDetails}=    Get Response Body
    Response Header Should Equal    Content-Type    ${CONTENT_TYPE_JSON}
    Log    Trying to validate ProblemDetails
    Validate Json    ProblemDetails.schema.json    ${problemDetails}
    Log    Validation OK
    #${problemDetails}=    Get Response Body
    #Response Header Should Equal    Content-Type    ${CONTENT_TYPE_JSON}
    #Log    Trying to validate ProblemDetails
    #Validate Json    ProblemDetails.schema.json    ${problemDetails}
    #Log    Validation OK

PATCH Subscription - (Method not implemented)
    Log    Trying to perform a PATCH. This method should not be implemented
@@ -100,8 +100,8 @@ PATCH Subscription - (Method not implemented)
    #PATCH    ${apiRoot}/${apiName}/${apiVersion}/subscriptions/${subscriptionId}
    Response Status Code Should Equal    405
    Log    Received 405 Method not implemented as expected
    ${problemDetails}=    Get Response Body
    Response Header Should Equal    Content-Type    ${CONTENT_TYPE_JSON}
    Log    Trying to validate ProblemDetails
    Validate Json    ProblemDetails.schema.json    ${problemDetails}
    Log    Validation OK
    #${problemDetails}=    Get Response Body
    #Response Header Should Equal    Content-Type    ${CONTENT_TYPE_JSON}
    #Log    Trying to validate ProblemDetails
    #Validate Json    ProblemDetails.schema.json    ${problemDetails}
    #Log    Validation OK
+20 −20
Original line number Diff line number Diff line
@@ -69,11 +69,11 @@ POST Individual VNF Package - (Method not implemented)
    POST    ${apiRoot}/${apiName}/${apiVersion}/vnf_packages/${vnfPackageId}
    Response Status Code Should Equal    405
    Log    Received 405 Method not implemented as expected
    ${problemDetails}=    Get Response Body
    Response Header Should Equal    Content-Type    ${CONTENT_TYPE_JSON}
    Log    Trying to validate ProblemDetails
    Validate Json    ProblemDetails.schema.json    ${problemDetails}
    Log    Validation OK
    #${problemDetails}=    Get Response Body
    #Response Header Should Equal    Content-Type    ${CONTENT_TYPE_JSON}
    #Log    Trying to validate ProblemDetails
    #Validate Json    ProblemDetails.schema.json    ${problemDetails}
    #Log    Validation OK

PUT Individual VNF Package - (Method not implemented)
    Log    Trying to perform a PUT. This method should not be implemented
@@ -83,11 +83,11 @@ PUT Individual VNF Package - (Method not implemented)
    PUT    ${apiRoot}/${apiName}/${apiVersion}/vnf_packages/${vnfPackageId}
    Response Status Code Should Equal    405
    Log    Received 405 Method not implemented as expected
    ${problemDetails}=    Get Response Body
    Response Header Should Equal    Content-Type    ${CONTENT_TYPE_JSON}
    Log    Trying to validate ProblemDetails
    Validate Json    ProblemDetails.schema.json    ${problemDetails}
    Log    Validation OK
    #${problemDetails}=    Get Response Body
    #Response Header Should Equal    Content-Type    ${CONTENT_TYPE_JSON}
    #Log    Trying to validate ProblemDetails
    #Validate Json    ProblemDetails.schema.json    ${problemDetails}
    #Log    Validation OK

PATCH Individual VNF Package - (Method not implemented)
    Log    Trying to perform a PATCH. This method should not be implemented
@@ -98,11 +98,11 @@ PATCH Individual VNF Package - (Method not implemented)
    #PATCH    ${apiRoot}/${apiName}/${apiVersion}/vnf_packages/${vnfPackageId}
    Response Status Code Should Equal    405
    Log    Received 405 Method not implemented as expected
    ${problemDetails}=    Get Response Body
    Response Header Should Equal    Content-Type    ${CONTENT_TYPE_JSON}
    Log    Trying to validate ProblemDetails
    Validate Json    ProblemDetails.schema.json    ${problemDetails}
    Log    Validation OK
    #${problemDetails}=    Get Response Body
    #Response Header Should Equal    Content-Type    ${CONTENT_TYPE_JSON}
    #Log    Trying to validate ProblemDetails
    #Validate Json    ProblemDetails.schema.json    ${problemDetails}
    #Log    Validation OK

DELETE Individual VNF Package - (Method not implemented)
    Log    Trying to perform a DELETE. This method should not be implemented
@@ -112,8 +112,8 @@ DELETE Individual VNF Package - (Method not implemented)
    DELETE    ${apiRoot}/${apiName}/${apiVersion}/vnf_packages/${vnfPackageId}
    Response Status Code Should Equal    405
    Log    Received 405 Method not implemented as expected
    ${problemDetails}=    Get Response Body
    Response Header Should Equal    Content-Type    ${CONTENT_TYPE_JSON}
    Log    Trying to validate ProblemDetails
    Validate Json    ProblemDetails.schema.json    ${problemDetails}
    Log    Validation OK
    #${problemDetails}=    Get Response Body
    #Response Header Should Equal    Content-Type    ${CONTENT_TYPE_JSON}
    #Log    Trying to validate ProblemDetails
    #Validate Json    ProblemDetails.schema.json    ${problemDetails}
    #Log    Validation OK
+0 −125
Original line number Diff line number Diff line
*** Settings ***
Library           HttpLibrary.HTTP
Resource          ../variables.txt
Library           JSONSchemaLibrary    schemas/

*** Test Cases ***
VNF packages
    Log    Trying to get all VNF Packages present in the NFVO Catalogue
    Create HTTP Context    ${NFVO_HOST}:${NFVO_PORT}    ${NFVO_SCHEMA}
    Set Request Header    Accept    ${ACCEPT}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Request Header    Authorization    ${AUTHORIZATION}
    GET    ${apiRoot}/vnfpkgm/v1/vnf_packages
    Response Status Code Should Equal    200
    ${vnfPkgInfos}=    Get Response Body
    Response Header Should Equal    Content-Type    ${CONTENT_TYPE}
    Log    Trying to validate response
    Validate Json    vnfPkgInfo.schema.json    ${vnfPkgInfos}
    Log    Validation OK
    Log    Trying to generate a invalid request using invalid attribute filter
    Create HTTP Context    ${NFVO_HOST}:${NFVO_PORT}    ${NFVO_SCHEMA}
    Set Request Header    Accept    ${ACCEPT}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Request Header    Authorization    ${AUTHORIZATION}
    GET    ${apiRoot}/vnfpkgm/v1/vnf_packages?fields=wrong_field
    Response Status Code Should Equal    400
    Log    Response code il 400 as expected
    Log    Trying to generate an invalid request using an invalid token
    Create HTTP Context    ${NFVO_HOST}:${NFVO_PORT}    ${NFVO_SCHEMA}
    Set Request Header    Accept    ${ACCEPT}
    Set Request Header    Authorization    ${WRONG_AUTHORIZATION}
    GET    ${apiRoot}/vnfpkgm/v1/vnf_packages
    Response Status Code Should Equal    401
    Log    Response code is 401 as expected

Individual VNF package
    Log    Trying to get a VNF Package present in the NFVO Catalogue
    Create HTTP Context    ${NFVO_HOST}:${NFVO_PORT}    ${NFVO_SCHEMA}
    Set Request Header    Accept    ${ACCEPT}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Request Header    Authorization    ${AUTHORIZATION}
    GET    ${apiRoot}/vnfpkgm/v1/vnf_packages/${vnfPkgId}
    Response Status Code Should Equal    200
    ${vnfPkgInfo}=    Get Response Body
    Response Header Should Equal    Content-Type    ${CONTENT_TYPE}
    Log    Trying to validate response
    Validate Json    vnfPkgInfo.schema.json    ${vnfPkgInfo}
    Log    Validation OK

VNFD of an individual VNF package
    Log    Trying to get the content of a VNFD within a VNF Package present in the NFVO Catalogue
    Log    Request to have a VNFD from a given VNF Package
    Create HTTP Context    ${NFVO_HOST}:${NFVO_PORT}    ${NFVO_SCHEMA}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Request Header    Authorization    ${AUTHORIZATION}
    Set Request Header    Accept    ${ACCEPT_PLAIN}
    Set Request Header    Accept    ${ACCEPT_ZIP}
    GET    ${apiRoot}/vnfpkgm/v1/vnf_packages/${vnfPkgId}/vnfd
    Response Status Code Should Equal    200
    ${vnfPkgInfo}=    Get Response Body
    #Run Keyword If    ${SINGLE_FILE_VNFD} == 1    Response Header Should Equal    Content-Type    ${ACCEPT_PLAIN}
    Run Keyword If    ${SINGLE_FILE_VNFD} == 0    Response Header Should Equal    Content-Type    ${ACCEPT_ZIP}
    Log    How to handle validation here? Are we going to check some fields from the json?
    Log    Request that will generate an error (406) using an Accept header as text/plain but the NFVO could not provide
    Create HTTP Context    ${NFVO_HOST}:${NFVO_PORT}    ${NFVO_SCHEMA}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Request Header    Authorization    ${AUTHORIZATION}
    Set Request Header    Accept    ${WRONG_ACCEPT}
    GET    ${apiRoot}/vnfpkgm/v1/vnf_packages/${vnfPkgId}/vnfd
    Response Status Code Should Equal    406
    Log    Received 406 Not Applicable

VNF package content
    Log    Trying to fetch the content of a VNF package identified by the VNF package identifier allocated by the NFVO
    Log    Request to have the whole VNF Package
    Create HTTP Context    ${NFVO_HOST}:${NFVO_PORT}    ${NFVO_SCHEMA}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Request Header    Authorization    ${AUTHORIZATION}
    Set Request Header    Accept    ${ACCEPT_ZIP}
    GET    ${apiRoot}/vnfpkgm/v1/vnf_packages/${vnfPkgId}/package_content
    Response Status Code Should Equal    200
    ${vnfPkgInfo}=    Get Response Body
    Response Header Should Equal    Content-Type    ${ACCEPT_ZIP}
    Log    Request to have the VNF Package using partial download
    Create HTTP Context    ${NFVO_HOST}:${NFVO_PORT}    ${NFVO_SCHEMA}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Request Header    Authorization    ${AUTHORIZATION}
    Set Request Header    Accept    ${ACCEPT_ZIP}
    Set Request Header    Range    bytes=0-1023
    GET    ${apiRoot}/vnfpkgm/v1/vnf_packages/${vnfPkgId}/package_content
    Response Header Should Equal    Content-Length    2048
    Response Header Should Equal    Content-Range    bytes 0-1023/2048
    Response Status Code Should Equal    206
    Log    Received 206 Partial Content
    Log    Request that will generate a 416 Error. Package length in bytes is 2048 and will be requested a range from 2048 to 2560
    Create HTTP Context    ${NFVO_HOST}:${NFVO_PORT}    ${NFVO_SCHEMA}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Request Header    Authorization    ${AUTHORIZATION}
    Set Request Header    Accept    ${ACCEPT_ZIP}
    Set Request Header    Range    bytes=2048-2560
    GET    ${apiRoot}/vnfpkgm/v1/vnf_packages/${vnfPkgId}/package_content
    Response Status Code Should Equal    416
    Log    Received 416 Range not satisfiable

Individual VNF package artifact
    Log    Trying to get an individual artifact contained in a VNF package
    Log    Request to have the whole VNF Package
    Create HTTP Context    ${NFVO_HOST}:${NFVO_PORT}    ${NFVO_SCHEMA}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Request Header    Authorization    ${AUTHORIZATION}
    Set Request Header    Accept    ${ARTIFACT_TYPE}
    GET    ${apiRoot}/vnfpkgm/v1/vnf_packages/${vnfPkgId}/artifacts/${ARTIFACT_ID}
    Response Status Code Should Equal    200
    ${vnfPkgInfo}=    Get Response Body
    Response Header Should Equal    Content-Type    ${ARTIFACT_TYPE}
    Log    How to handle validation here? The object returned is a zip file
    Log    Trying to get \ with partial download an individual artifact contained in a VNF package
    Create HTTP Context    ${NFVO_HOST}:${NFVO_PORT}    ${NFVO_SCHEMA}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Request Header    Authorization    ${AUTHORIZATION}
    Set Request Header    Accept    ${ARTIFACT_TYPE}
    Set Request Header    Range    bytes=0-1023
    GET    ${apiRoot}/vnfpkgm/v1/vnf_packages/${vnfPkgId}/artifacts/${ARTIFACT_ID}
    Response Header Should Equal    Content-Length    2048
    Response Header Should Equal    Content-Range    bytes 0-1023/2048
    Response Status Code Should Equal    206
    Log    Received 206 Partial Content
    Log    Request that will generate a 416 Error. Artifact length in bytes is 2048 and will be requested a range from 2048 to 2560
    Create HTTP Context    ${NFVO_HOST}:${NFVO_PORT}    ${NFVO_SCHEMA}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Request Header    Authorization    ${AUTHORIZATION}
    Set Request Header    Accept    ${ARTIFACT_TYPE}
    Set Request Header    Range    bytes=2048-2560
    GET    ${apiRoot}/vnfpkgm/v1/vnf_packages/${vnfPkgId}/artifacts/${ARTIFACT_ID}
    Response Status Code Should Equal    416
    Log    Received 416 Range not satisfiable
+15 −15
Original line number Diff line number Diff line
@@ -136,11 +136,11 @@ PUT Subscription - (Method not implemented)
    PUT    ${apiRoot}/${apiName}/${apiVersion}/subscriptions
    Response Status Code Should Equal    405
    Log    Received 405 Method not implemented as expected
    ${problemDetails}=    Get Response Body
    Response Header Should Equal    Content-Type    ${CONTENT_TYPE_JSON}
    Log    Trying to validate ProblemDetails
    Validate Json    ProblemDetails.schema.json    ${problemDetails}
    Log    Validation OK
    #${problemDetails}=    Get Response Body
    #Response Header Should Equal    Content-Type    ${CONTENT_TYPE_JSON}
    #Log    Trying to validate ProblemDetails
    #Validate Json    ProblemDetails.schema.json    ${problemDetails}
    #Log    Validation OK

PATCH Subscription - (Method not implemented)
    Log    Trying to perform a PATCH. This method should not be implemented
@@ -151,11 +151,11 @@ PATCH Subscription - (Method not implemented)
    #PATCH    ${apiRoot}/${apiName}/${apiVersion}/subscriptions
    Response Status Code Should Equal    405
    Log    Received 405 Method not implemented as expected
    ${problemDetails}=    Get Response Body
    Response Header Should Equal    Content-Type    ${CONTENT_TYPE_JSON}
    Log    Trying to validate ProblemDetails
    Validate Json    ProblemDetails.schema.json    ${problemDetails}
    Log    Validation OK
    #${problemDetails}=    Get Response Body
    #Response Header Should Equal    Content-Type    ${CONTENT_TYPE_JSON}
    #Log    Trying to validate ProblemDetails
    #Validate Json    ProblemDetails.schema.json    ${problemDetails}
    #Log    Validation OK

DELETE Subscription - (Method not implemented)
    Log    Trying to perform a DELETE. This method should not be implemented
@@ -165,8 +165,8 @@ DELETE Subscription - (Method not implemented)
    DELETE    ${apiRoot}/${apiName}/${apiVersion}/subscriptions
    Response Status Code Should Equal    405
    Log    Received 405 Method not implemented as expected
    ${problemDetails}=    Get Response Body
    Response Header Should Equal    Content-Type    ${CONTENT_TYPE_JSON}
    Log    Trying to validate ProblemDetails
    Validate Json    ProblemDetails.schema.json    ${problemDetails}
    Log    Validation OK
    #${problemDetails}=    Get Response Body
    #Response Header Should Equal    Content-Type    ${CONTENT_TYPE_JSON}
    #Log    Trying to validate ProblemDetails
    #Validate Json    ProblemDetails.schema.json    ${problemDetails}
    #Log    Validation OK
+20 −20
Original line number Diff line number Diff line
@@ -132,11 +132,11 @@ POST all PACKAGE (Method not implemented)
    POST    ${apiRoot}/${apiName}/${apiVersion}/vnf_packages/${vnfPackageId}/vnfd
    Response Status Code Should Equal    405
    Log    Received 405 Method not implemented as expected
    ${problemDetails}=    Get Response Body
    Response Header Should Equal    Content-Type    ${CONTENT_TYPE_JSON}
    Log    Trying to validate ProblemDetails
    Validate Json    ProblemDetails.schema.json    ${problemDetails}
    Log    Validation OK
    #${problemDetails}=    Get Response Body
    #Response Header Should Equal    Content-Type    ${CONTENT_TYPE_JSON}
    #Log    Trying to validate ProblemDetails
    #Validate Json    ProblemDetails.schema.json    ${problemDetails}
    #Log    Validation OK

PUT all PACKAGE (Method not implemented)
    Log    Trying to perform a PUT. This method should not be implemented
@@ -146,11 +146,11 @@ PUT all PACKAGE (Method not implemented)
    PUT    ${apiRoot}/${apiName}/${apiVersion}/vnf_packages/${vnfPackageId}/vnfd
    Response Status Code Should Equal    405
    Log    Received 405 Method not implemented as expected
    ${problemDetails}=    Get Response Body
    Response Header Should Equal    Content-Type    ${CONTENT_TYPE_JSON}
    Log    Trying to validate ProblemDetails
    Validate Json    ProblemDetails.schema.json    ${problemDetails}
    Log    Validation OK
    #${problemDetails}=    Get Response Body
    #Response Header Should Equal    Content-Type    ${CONTENT_TYPE_JSON}
    #Log    Trying to validate ProblemDetails
    #Validate Json    ProblemDetails.schema.json    ${problemDetails}
    #Log    Validation OK

PATCH all PACKAGE (Method not implemented)
    Log    Trying to perform a PATCH. This method should not be implemented
@@ -161,11 +161,11 @@ PATCH all PACKAGE (Method not implemented)
    #PATCH    ${apiRoot}/${apiName}/${apiVersion}/vnf_packages/${vnfPackageId}/vnfd
    Response Status Code Should Equal    405
    Log    Received 405 Method not implemented as expected
    ${problemDetails}=    Get Response Body
    Response Header Should Equal    Content-Type    ${CONTENT_TYPE_JSON}
    Log    Trying to validate ProblemDetails
    Validate Json    ProblemDetails.schema.json    ${problemDetails}
    Log    Validation OK
    #${problemDetails}=    Get Response Body
    #Response Header Should Equal    Content-Type    ${CONTENT_TYPE_JSON}
    #Log    Trying to validate ProblemDetails
    #Validate Json    ProblemDetails.schema.json    ${problemDetails}
    #Log    Validation OK

DELETE all PACKAGE (Method not implemented)
    Log    Trying to perform a DELETE. This method should not be implemented
@@ -175,8 +175,8 @@ DELETE all PACKAGE (Method not implemented)
    DELETE    ${apiRoot}/${apiName}/${apiVersion}/vnf_packages/${vnfPackageId}
    Response Status Code Should Equal    405
    Log    Received 405 Method not implemented as expected
    ${problemDetails}=    Get Response Body
    Response Header Should Equal    Content-Type    ${CONTENT_TYPE_JSON}
    Log    Trying to validate ProblemDetails
    Validate Json    ProblemDetails.schema.json    ${problemDetails}
    Log    Validation OK
    #${problemDetails}=    Get Response Body
    #Response Header Should Equal    Content-Type    ${CONTENT_TYPE_JSON}
    #Log    Trying to validate ProblemDetails
    #Validate Json    ProblemDetails.schema.json    ${problemDetails}
    #Log    Validation OK
Loading