Commit 16939ac1 authored by Giacomo Bernini's avatar Giacomo Bernini Committed by Giacomo Bernini
Browse files

added oauth scope tests for VNF Pkg content upload from uri

parent 41fb88a0
Loading
Loading
Loading
Loading
+27 −1
Original line number Diff line number Diff line
@@ -80,3 +80,29 @@ DELETE Individual VNF Package Content from URI - Method not implemented
    ...    Post-Conditions: none
    Send DELETE Request for individual VNF Package Content from URI
    Check HTTP Response Status Code Is    405

Upload VNF Package Content from URI with permitted authorization scope
    [Documentation]    Test ID: 5.3.5.5.6
    ...    Test title: Upload VNF Package Content from URI with permitted authorization scope
    ...    Test objective: The objective is to test the upload of a VNF Package Content from URI with permitted authorization scope.
    ...    Pre-conditions: One or more VNF Packages are in onboarding state CREATED in the NFVO.
    ...    Reference: Clause 9.4.6.3.1 - ETSI GS NFV-SOL 005 [3] v4.5.1
    ...    Config ID: Config_prod_NFVO
    ...    Applicability: none
    ...    Post-Conditions: none
    Send POST Request to upload VNF Package Content from URI with permitted authorization scope
    Check HTTP Response Status Code Is    202
    Check HTTP Response Body is Empty

Upload VNF Package Content from URI with not permitted authorization scope
    [Documentation]    Test ID: 5.3.5.5.7
    ...    Test title: Upload VNF Package Content from URI with not permitted authorization scope
    ...    Test objective: The objective is to test the upload of a VNF Package Content from URI fails when using not permitted authorization scope.
    ...    Pre-conditions: One or more VNF Packages are in onboarding state CREATED in the NFVO.
    ...    Reference: Clause 9.4.6.3.1 - ETSI GS NFV-SOL 005 [3] v4.5.1
    ...    Config ID: Config_prod_NFVO
    ...    Applicability: none
    ...    Post-Conditions: none
    Send POST Request to upload VNF Package Content from URI with not permitted authorization scope
    Check HTTP Response Status Code Is    202
    Check HTTP Response Body is Empty
 No newline at end of file
+26 −0
Original line number Diff line number Diff line
@@ -876,6 +876,32 @@ Send POST Request to upload VNF Package Content from URI
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}

Send POST Request to upload VNF Package Content from URI with permitted authorization scope
    Log    Trying to perform a POST. The POST method provides the information for the NFVO to get the content of a VNF package.
    Set Headers    {"Content-Type": "${CONTENT_TYPE_JSON}"}
    ${scopeValue}=    Create Dictionary    scope=${URI_PERMITTED_SCOPE} 
    ${authorizationToken}=    JWT Encode    payload=${scopeValue}    key=''    algorithm=${OAUTH_ENCRIPTION_ALGORITHM}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${authorizationToken}"}
    Log    Authorization Token: ${authorizationToken}
    ${template}=    Get File    jsons/UploadVnfPkgFromUriRequest.json
    ${body}=        Format String   ${template}     vnfPkgUri=${vnfPkgUri}
    REST.POST    ${apiRoot}/${apiName}/${apiMajorVersion}/vnf_packages/${vnfPkgViaUriId}/package_content/upload_from_uri    ${body}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}

Send POST Request to upload VNF Package Content from URI with not permitted authorization scope
    Log    Trying to perform a POST. The POST method provides the information for the NFVO to get the content of a VNF package.
    Set Headers    {"Content-Type": "${CONTENT_TYPE_JSON}"}
    ${scopeValue}=    Create Dictionary    scope=${NOT_PERMITTED_SCOPE} 
    ${authorizationToken}=    JWT Encode    payload=${scopeValue}    key=''    algorithm=${OAUTH_ENCRIPTION_ALGORITHM}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${authorizationToken}"}
    Log    Authorization Token: ${authorizationToken}
    ${template}=    Get File    jsons/UploadVnfPkgFromUriRequest.json
    ${body}=        Format String   ${template}     vnfPkgUri=${vnfPkgUri}
    REST.POST    ${apiRoot}/${apiName}/${apiMajorVersion}/vnf_packages/${vnfPkgViaUriId}/package_content/upload_from_uri    ${body}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}

Send POST Request to upload VNF Package Content from URI with conflict due to onboarding state
    Log    Trying to perform a POST. The POST method provides the information for the NFVO to get the content of a VNF package.
    Set Headers    {"Content-Type": "${CONTENT_TYPE_JSON}"}
+1 −1
Original line number Diff line number Diff line
@@ -16,7 +16,7 @@ ${CONTENT_PERMITTED_SCOPE} vnfpkgm:v2:vnf_package_content
${CONTENT_NOT_PERMITTED_SCOPE}    vnfpkgm:v2:vnf_package_content:readonly
${BULK_PERMITTED_SCOPE}    vnfpkgm:v2:bulk_artifacts:readonly
${ARTIFACT_PERMITTED_SCOPE}    vnfpkgm:v2:artifact:readonly

${URI_PERMITTED_SCOPE}    vnfpkgm:v2:artifact::upload_from_uri
${NOT_PERMITTED_SCOPE}    vnfpkgm:v2:invalid