Commit 0b5172f6 authored by Giacomo Bernini's avatar Giacomo Bernini Committed by Giacomo Bernini
Browse files

added oauth scope tests for Individual PNF Descriptors

parent c751c16c
Loading
Loading
Loading
Loading
+27 −1
Original line number Diff line number Diff line
@@ -110,3 +110,29 @@ DELETE Individual PNF Descriptor
    Send DELETE Request for Individual PNF Descriptor
    Check HTTP Response Status Code Is    204
    Check Postcondition PNF Descriptor is Deleted

Update Individual PNF Descriptor with permitted authorization scope
    [Documentation]    Test ID: 5.3.1.5.8
    ...    Test title: Update Individual PNF Descriptor with permitted authorization scope
    ...    Test objective: The objective is to test the update of an individual PNF Descriptor with permitted authorization scope
    ...    Pre-conditions: One or more PNF Descriptors are onboarded in the NFVO.
    ...    Reference: Clause 5.4.6.3.4 - ETSI GS NFV-SOL 005 [3] v4.5.1
    ...    Config ID: Config_prod_NFVO
    ...    Applicability: none
    ...    Post-Conditions: The PNF Descriptor is modified according to the update request
    Send PATCH to update Individual PNF Descriptor with permitted authorization scope
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is   PnfdInfoModification
    Check Postcondition PNF Descriptor is modified according to the requested update  

Update Individual PNF Descriptor with not permitted authorization scope
    [Documentation]    Test ID: 5.3.1.5.9
    ...    Test title: Update Individual PNF Descriptor with not permitted authorization scope
    ...    Test objective: The objective is to test that the update of an individual PNF Descriptor fails when using not permitted authorization scope
    ...    Pre-conditions: One or more PNF Descriptors are onboarded in the NFVO.
    ...    Reference: Clause 5.4.6.3.4 - ETSI GS NFV-SOL 005 [3] v4.5.1
    ...    Config ID: Config_prod_NFVO
    ...    Applicability: none
    ...    Post-Conditions: The PNF Descriptor is modified according to the update request
    Send PATCH to update Individual PNF Descriptor with not permitted authorization scope
    Check HTTP Response Status Code Is    401  
 No newline at end of file
+29 −0
Original line number Diff line number Diff line
@@ -710,6 +710,35 @@ Send PATCH to update Individual PNF Descriptor
    Set Suite Variable    ${response}    ${output}
    Set Suite Variable    ${body["userDefinedData"]}    ${userDefinedDataSet}

Send PATCH to update Individual PNF Descriptor with permitted authorization scope
    Log    Trying to perform a PATCH.
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Set Headers    {"Content-Type": "${CONTENT_TYPE_JSON}"}
    ${body}=    Get File    jsons/PnfdInfoModification.json
    ${scopeValue}=    Create Dictionary    scope=${PNFD_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}/pnf_descriptors/${pnfdInfoId}    ${body}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}
    Set Suite Variable    ${body["userDefinedData"]}    ${userDefinedDataSet}


Send PATCH to update Individual PNF Descriptor with not permitted authorization scope
    Log    Trying to perform a PATCH.
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Set Headers    {"Content-Type": "${CONTENT_TYPE_JSON}"}
    ${body}=    Get File    jsons/PnfdInfoModification.json
    ${scopeValue}=    Create Dictionary    scope=${PNFD_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}/pnf_descriptors/${pnfdInfoId}    ${body}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}
    Set Suite Variable    ${body["userDefinedData"]}    ${userDefinedDataSet}

Check Postcondition PNF Descriptor is modified according to the requested update
    Log    Checking postcondition op status
    Should Be Equal   ${response['body']['userDefinedData']}    ${userDefinedDataSet}