Commit 40e538f6 authored by Giacomo Bernini's avatar Giacomo Bernini Committed by Giacomo Bernini
Browse files

added oauth scope tests for VNF Pkg content artifacts

parent 9b1e5c35
Loading
Loading
Loading
Loading
+25 −0
Original line number Diff line number Diff line
@@ -211,3 +211,28 @@ Get VNF Package Artifact with "include_external_artifacts" parameter
    Get Artifact in VNF Package with include_external_artifacts parameter
    Check HTTP Response Status Code Is    200
    Check HTTP Response Header Content-Type Is    application/zip

Get VNF Package Artifact with permitted authorization scope
    [Documentation]    Test ID: 5.3.5.13.17
    ...    Test title: Get VNF Package Artifact with permitted authorization scope
    ...    Test objective: The objective is to test that the GET request read the whole content of the archive containing the artifact files successfully with permitted authorization scope
    ...    Pre-conditions: One or more VNF packages are onboarded in the NFVO.
    ...    Reference: Clause 9.4.5a.3.2 - ETSI GS NFV-SOL 005 [3] v4.5.1
    ...    Config ID: Config_prod_NFVO
    ...    Applicability: none
    ...    Post-Conditions: none
    Get Artifact in VNF Package with permitted authorization scope
    Check HTTP Response Status Code Is    200
    Check HTTP Response Header Content-Type Is    application/zip

Get VNF Package Artifact with not permitted authorization scope
    [Documentation]    Test ID: 5.3.5.13.18
    ...    Test title: Get VNF Package Artifact with not permitted authorization scope
    ...    Test objective: The objective is to test that the GET request read the whole content of the archive containing the artifact files fails when using not permitted authorization scope
    ...    Pre-conditions: One or more VNF packages are onboarded in the NFVO.
    ...    Reference: Clause 9.4.5a.3.2 - ETSI GS NFV-SOL 005 [3] v4.5.1
    ...    Config ID: Config_prod_NFVO
    ...    Applicability: none
    ...    Post-Conditions: none
    Get Artifact in VNF Package with not permitted authorization scope
    Check HTTP Response Status Code Is    401
 No newline at end of file
+22 −0
Original line number Diff line number Diff line
@@ -1325,6 +1325,28 @@ Get Artifact in VNF Package
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}

Get Artifact in VNF Package with permitted authorization scope
    Log    Trying to get Artifact in VNF Package
    Set Headers    {"Accept": "${ACCEPT_ZIP}"}
    ${scopeValue}=    Create Dictionary    scope=${BULK_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}
    REST.GET    ${apiRoot}/${apiName}/${apiMajorVersion}/vnf_packages/${vnfPackageId}/artifacts
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}

Get Artifact in VNF Package with not permitted authorization scope
    Log    Trying to get Artifact in VNF Package
    Set Headers    {"Accept": "${ACCEPT_ZIP}"}
    ${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}
    REST.GET    ${apiRoot}/${apiName}/${apiMajorVersion}/vnf_packages/${vnfPackageId}/artifacts
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}

Get Artifact in VNF Package with exclude_all_mano_artifacts parameter
    Log    Trying to get Artifact in VNF Package with exclude_all_mano_artifacts
    Set Headers    {"Accept": "${ACCEPT_ZIP}"}
+1 −0
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@ ${ACCESS_PERMITTED_SCOPE} vnfpkgm:v2:ext_artifacts_access
${MANIFEST_PERMITTED_SCOPE}    vnfpkgm:v2:manifest:readonly
${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

${NOT_PERMITTED_SCOPE}    vnfpkgm:v2:invalid