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

added oauth scope tests for VNF Pkg mgmt individual VNF Packages

parent a39581ac
Loading
Loading
Loading
Loading
+27 −1
Original line number Diff line number Diff line
@@ -152,3 +152,29 @@ DELETE Individual VNF Package used for instantiated VNF instances
    Check HTTP Response Status Code Is    409
    Check HTTP Response Body Json Schema Is   ProblemDetails
    Check Postcondition VNF Package Exists

Disable Individual VNF Package with permitted authorization scope
    [Documentation]    Test ID: 5.3.5.2.12
    ...    Test title: Disable Individual VNF Package with permitted authorization scope
    ...    Test objective: The objective is to test the disabling of an individual VNF Package with permitted authorization scope
    ...    Pre-conditions: One or more VNF Packages are onboarded in the NFVO in ENABLED operational state.
    ...    Reference: Clause 9.4.3.3.4 - ETSI GS NFV-SOL 005 [3] v4.5.1
    ...    Config ID: Config_prod_NFVO
    ...    Applicability: none
    ...    Post-Conditions: The VNF Package is in operational state DISABLED
    Send PATCH to disable Individual VNF Package with permitted authorization scope
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is   VnfPkgInfoModification
    Check Postcondition VNF Package is in operational state    DISABLED

Disable Individual VNF Package with not permitted authorization scope
    [Documentation]    Test ID: 5.3.5.2.13
    ...    Test title: Disable Individual VNF Package with not permitted authorization scope
    ...    Test objective: The objective is to test that the disabling of an individual VNF Package fails when using not permitted authorization scope
    ...    Pre-conditions: One or more VNF Packages are onboarded in the NFVO in ENABLED operational state.
    ...    Reference: Clause 9.4.3.3.4 - ETSI GS NFV-SOL 005 [3] v4.5.1
    ...    Config ID: Config_prod_NFVO
    ...    Applicability: none
    ...    Post-Conditions: none
    Send PATCH to disable Individual VNF Package 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
@@ -433,6 +433,32 @@ Send PATCH to disable Individual VNF Package
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}

Send PATCH to disable Individual VNF Package with permitted authorization scope
    Log    Trying to perform a PATCH. As prerequisite the nsdInfo shall be in enabled operational state
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Set Headers    {"Content-Type": "${CONTENT_TYPE_JSON}"}
    ${body}=    Get File    jsons/VnfPkgInfoModificationsDisabled.json
    ${scopeValue}=    Create Dictionary    scope=${INFO_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.PATCH    ${apiRoot}/${apiName}/${apiMajorVersion}/vnf_packages/${vnfPackageId}    ${body}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}

Send PATCH to disable Individual VNF Package with not permitted authorization scope
    Log    Trying to perform a PATCH. As prerequisite the nsdInfo shall be in enabled operational state
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Set Headers    {"Content-Type": "${CONTENT_TYPE_JSON}"}
    ${body}=    Get File    jsons/VnfPkgInfoModificationsDisabled.json
    ${scopeValue}=    Create Dictionary    scope=${INFO_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.PATCH    ${apiRoot}/${apiName}/${apiMajorVersion}/vnf_packages/${vnfPackageId}    ${body}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}

Check Postcondition VNF Package is in operational state
    [Arguments]    ${status}
    Log    Checking postcondition op status