Commit 9b1e5c35 authored by Giacomo Bernini's avatar Giacomo Bernini Committed by Giacomo Bernini
Browse files

added oauth scope tests for VNF Pkg content

parent 5c7f7b06
Loading
Loading
Loading
Loading
+25 −0
Original line number Diff line number Diff line
@@ -147,3 +147,28 @@ DELETE Individual VNF Package Content - Method not implemented
    ...    Post-Conditions: none
    Send DELETE Request for individual VNF Package Content
    Check HTTP Response Status Code Is    405

Upload VNF Package Content with permitted authorization scope
    [Documentation]    Test ID: 5.3.5.4.12
    ...    Test title: Upload VNF Package Content with permitted authorization scope
    ...    Test objective: The objective is to test the upload of a VNF Package Content in Zip format with permitted authorization scope.
    ...    Pre-conditions: One or more VNF Packages are onboarded in the NFVO.
    ...    Reference: Clause 9.4.5.3.4 - ETSI GS NFV-SOL 005 [3] v4.5.1
    ...    Config ID: Config_prod_NFVO
    ...    Applicability: none
    ...    Post-Conditions: The VNF Package content is successfully uploaded and available in the NFVO
    Send PUT Request to upload VNF Package Content with permitted authorization scope
    Check HTTP Response Status Code Is    204
    Check Postcondition VNF Package Content is uploaded and available in the NFVO

Upload VNF Package Content with not permitted authorization scope
    [Documentation]    Test ID: 5.3.5.4.13
    ...    Test title: Upload VNF Package Content with not permitted authorization scope
    ...    Test objective: The objective is to test the upload of a VNF Package Content in Zip format fails when using not permitted authorization scope.
    ...    Pre-conditions: One or more VNF Packages are onboarded in the NFVO.
    ...    Reference: Clause 9.4.5.3.4 - ETSI GS NFV-SOL 005 [3] v4.5.1
    ...    Config ID: Config_prod_NFVO
    ...    Applicability: none
    ...    Post-Conditions: none
    Send PUT Request to upload VNF Package Content with not permitted authorization scope
    Check HTTP Response Status Code Is    401
 No newline at end of file
+26 −0
Original line number Diff line number Diff line
@@ -706,6 +706,32 @@ Send PUT Request to upload VNF Package Content
    ${response}=    Create Dictionary   status=${response.status_code}
    Set Suite Variable      ${response}     ${response}

Send PUT Request to upload VNF Package Content with not permitted authorization scope
    Log    Trying to perform a PUT. This method upload the content of a NSD
    Create Session      nbi     ${NFVO_SCHEMA}://${NFVO_HOST}:${NFVO_PORT}  headers={"Accept": "${ACCEPT_ZIP}", "Content-Type": "application/zip", "${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}      verify=False
    ${body}=  Get Binary File     ${contentZipVnfPackage}
    ${scopeValue}=    Create Dictionary    scope=${CONTENT_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}
    ${response}=    Put Request     nbi     ${apiRoot}/${apiName}/${apiMajorVersion}/vnf_packages/${newVnfPackageId}/package_content    data=${body}
    Should Be Empty     ${response.text}
    ${response}=    Create Dictionary   status=${response.status_code}
    Set Suite Variable      ${response}     ${response}

Send PUT Request to upload VNF Package Content with permitted authorization scope
    Log    Trying to perform a PUT. This method upload the content of a NSD
    Create Session      nbi     ${NFVO_SCHEMA}://${NFVO_HOST}:${NFVO_PORT}  headers={"Accept": "${ACCEPT_ZIP}", "Content-Type": "application/zip", "${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}      verify=False
    ${body}=  Get Binary File     ${contentZipVnfPackage}
    ${scopeValue}=    Create Dictionary    scope=${CONTENT_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}
    ${response}=    Put Request     nbi     ${apiRoot}/${apiName}/${apiMajorVersion}/vnf_packages/${newVnfPackageId}/package_content    data=${body}
    Should Be Empty     ${response.text}
    ${response}=    Create Dictionary   status=${response.status_code}
    Set Suite Variable      ${response}     ${response}


Check Postcondition VNF Package Content is uploaded and available in the NFVO
    Log    Trying to get a VNF Package Content
+2 −0
Original line number Diff line number Diff line
@@ -12,6 +12,8 @@ ${INFO_NOT_PERMITTED_SCOPE} vnfpkgm:v2:vnf_package_info:readonly
${VNFD_PERMITTED_SCOPE}    vnfpkgm:v2:vnfd:readonly
${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

${NOT_PERMITTED_SCOPE}    vnfpkgm:v2:invalid