Commit c8134dab authored by Giacomo Bernini's avatar Giacomo Bernini Committed by Giacomo Bernini
Browse files

added oauth scope tests for VNF Pkg mgmt vnfd in individual VNF Packages

parent b24891ed
Loading
Loading
Loading
Loading
+26 −1
Original line number Diff line number Diff line
@@ -150,6 +150,31 @@ Get VNFD in Individual VNF Package with security information
    Check HTTP Response Status Code Is    200
    Check HTTP Response Header Content-Type Is    application/zip

Get VNFD in Individual VNF Package in Zip Format with permitted authorization scope
    [Documentation]    Test ID: 5.3.5.3.13
    ...    Test title: Get VNFD in Individual VNF Package in Zip Format with permitted authorization scope
    ...    Test objective: The objective is to test the retrieval of the VNFD in zip format for an individual VNF package with permitted authorization scope
    ...    Pre-conditions: One or more VNF packages are onboarded in the NFVO.
    ...    Reference: Clause 9.4.4.3.2 - ETSI GS NFV-SOL 005 [3] v4.5.1
    ...    Config ID: Config_prod_NFVO
    ...    Applicability: none
    ...    Post-Conditions: none
    Get VNFD in Individual VNF Package in Zip Format with permitted authorization scope
    Check HTTP Response Status Code Is    200
    Check HTTP Response Header Content-Type Is    application/zip

Get VNFD in Individual VNF Package in Zip Format with not permitted authorization scope
    [Documentation]    Test ID: 5.3.5.3.14
    ...    Test title: Get VNFD in Individual VNF Package in Zip Format with not permitted authorization scope
    ...    Test objective: The objective is to test that the retrieval of the VNFD in zip format for an individual VNF package fails when using not permitted authorization scope
    ...    Pre-conditions: One or more VNF packages are onboarded in the NFVO.
    ...    Reference: Clause 9.4.4.3.2 - ETSI GS NFV-SOL 005 [3] v4.5.1
    ...    Config ID: Config_prod_NFVO
    ...    Applicability: none
    ...    Post-Conditions: none
    Get VNFD in Individual VNF Package in Zip Format with not permitted authorization scope
    Check HTTP Response Status Code Is    401

*** Keywords ***
Void
    log    do nothing
+22 −0
Original line number Diff line number Diff line
@@ -509,6 +509,28 @@ Send DELETE Request for Individual VNF Package used for instantiated VNF instanc
    Set Suite Variable    ${response}    ${output} 

Get VNFD in Individual VNF Package in Zip Format
    Log    Trying to get a VNFD from a given VNF Package present in the NFVO Catalogue
    Set Headers    {"Accept": "${ACCEPT_ZIP}"}
    ${scopeValue}=    Create Dictionary    scope=${VNFD_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/${vnfPkgZipVNFD}/vnfd
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output} 

Get VNFD in Individual VNF Package in Zip Format with permitted authorization scope
    Log    Trying to get a VNFD from a given VNF Package present in the NFVO Catalogue
    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/${vnfPkgZipVNFD}/vnfd
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output} 

Get VNFD in Individual VNF Package in Zip Format with not permitted authorization scope
    Log    Trying to get a VNFD from a given VNF Package present in the NFVO Catalogue
    Set Headers    {"Accept": "${ACCEPT_ZIP}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
+1 −0
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@ ${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

${NOT_PERMITTED_SCOPE}    vnfpkgm:v2::invalid