Commit 3ba0e6aa authored by Giacomo Bernini's avatar Giacomo Bernini Committed by Giacomo Bernini
Browse files

added oauth scope tests for VNF Pkg mgmt access configuration

parent c8134dab
Loading
Loading
Loading
Loading
+26 −1
Original line number Diff line number Diff line
@@ -107,3 +107,28 @@ DELETE Access configuration for external artifacts - Method not implemented
    ...    Post-Conditions: none
    Send DELETE Request for Access configuration for external artifacts
    Check HTTP Response Status Code Is    405

Get Access configuration for external artifacts with permitted authorization scope
    [Documentation]    Test ID: 5.3.5.11.9
    ...    Test title: Get Access configuration for external artifacts with permitted authorization scope
    ...    Test objective: The objective is to test the GET method reads the access configuration information that is used by the NFVO to get the content of external VNF package artifacts with permitted authorization scope
    ...    Pre-conditions: One or more VNF packages are onboarded in the NFVO.
    ...    Reference: Clause 9.4.4a.3.2 - ETSI GS NFV-SOL 005 [3] v4.5.1
    ...    Config ID: Config_prod_NFVO
    ...    Applicability: none
    ...    Post-Conditions: none
    Get access configuration information for external artifacts with permitted authorization scope
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is   ExternalArtifactsAccessConfig

Get Access configuration for external artifacts with not permitted authorization scope
    [Documentation]    Test ID: 5.3.5.11.10
    ...    Test title: Get Access configuration for external artifacts with not permitted authorization scope
    ...    Test objective: The objective is to test that the GET method to read the access configuration information fails when using not permitted authorization scope
    ...    Pre-conditions: One or more VNF packages are onboarded in the NFVO.
    ...    Reference: Clause 9.4.4a.3.2 - ETSI GS NFV-SOL 005 [3] v4.5.1
    ...    Config ID: Config_prod_NFVO
    ...    Applicability: none
    ...    Post-Conditions: none
    Get access configuration information for external artifacts with not permitted authorization scope
    Check HTTP Response Status Code Is    401
 No newline at end of file
+18 −0
Original line number Diff line number Diff line
@@ -1161,6 +1161,24 @@ Get access configuration information for external artifacts
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}

Get access configuration information for external artifacts with permitted authorization scope
    ${scopeValue}=    Create Dictionary    scope=${ACCESS_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/${vnfPkgId}/ext_artifacts_access
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}

Get access configuration information for external artifacts with not permitted authorization scope
    ${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/${vnfPkgId}/ext_artifacts_access
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}
    
Send PUT Request to access configuration information for external artifacts
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
+5 −4
Original line number Diff line number Diff line
@@ -7,11 +7,12 @@ ${AUTHORIZATION_HEADER} Authorization
${AUTHORIZATION_TOKEN}    Bearer 0b79bab50daca910b000d4f1a2b675d604257e42

${OAUTH_ENCRIPTION_ALGORITHM}    HS256
${INFO_PERMITTED_SCOPE}    vnfpkgm:v2::vnf_package_info 
${INFO_NOT_PERMITTED_SCOPE}    vnfpkgm:v2::vnf_package_info:readonly
${VNFD_PERMITTED_SCOPE}    vnfpkgm:v2::vnfd:readonly
${INFO_PERMITTED_SCOPE}    vnfpkgm:v2:vnf_package_info 
${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

${NOT_PERMITTED_SCOPE}    vnfpkgm:v2::invalid 
${NOT_PERMITTED_SCOPE}    vnfpkgm:v2:invalid 


${CONTENT_TYPE_JSON}    application/json