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

added oauth scope tests for Individual NS Descriptors

parent 49331e07
Loading
Loading
Loading
Loading
+28 −1
Original line number Diff line number Diff line
@@ -181,6 +181,33 @@ PUT Individual Network Service Descriptor - Method not implemented
    Send PUT Request for Individual Network Service Descriptor
    Check HTTP Response Status Code Is    405

DELETE Individual Network Service Descriptor with permitted authorization scope
    [Documentation]    Test ID: 5.3.1.2.13
    ...    Test title:  DELETE Individual Network Service Descriptor with permitted authorization scope
    ...    Test objective: The objective is to test the deletion of an individual Network Service Descriptor with permitted authorization scope.
    ...    Pre-conditions: One or more Network Service Descriptors are onboarded in the NFVO in DISABLED operational state and NOT_IN_USE usage state.
    ...    Reference: Clause 5.4.3.3.5 - ETSI GS NFV-SOL 005 [3] v4.5.1
    ...    Config ID: Config_prod_NFVO
    ...    Applicability: none
    ...    Post-Conditions: The Network Service Descriptor is not available anymore in the NFVO 
    Send DELETE Request for Individual Network Service Descriptor with permitted authorization scope
    Check HTTP Response Status Code Is    204
    Check Postcondition Network Service Descriptor is Deleted


DELETE Individual Network Service Descriptor with not permitted authorization scope
    [Documentation]    Test ID: 5.3.1.2.14
    ...    Test title:  DELETE Individual Network Service Descriptor with not permitted authorization scope
    ...    Test objective: The objective is to test that the deletion of an individual Network Service Descriptor fails when using a not permitted authorization scope.
    ...    Pre-conditions: One or more Network Service Descriptors are onboarded in the NFVO in DISABLED operational state and NOT_IN_USE usage state.
    ...    Reference: Clause 5.4.3.3.5 - ETSI GS NFV-SOL 005 [3] v4.5.1
    ...    Config ID: Config_prod_NFVO
    ...    Applicability: none
    ...    Post-Conditions: The Network Service Descriptor is not available anymore in the NFVO 
    Send DELETE Request for Individual Network Service Descriptor with not permitted authorization scope
    Check HTTP Response Status Code Is    401


*** Keywords ***
Void
    log    do nothing
+22 −2
Original line number Diff line number Diff line
@@ -157,7 +157,6 @@ Send Post Request to create new Network Service Descriptor Resource with permitt
    ${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.POST    ${apiRoot}/${apiName}/${apiMajorVersion}/ns_descriptors    ${body}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output} 
@@ -171,7 +170,6 @@ Send Post Request to create new Network Service Descriptor Resource with not per
    ${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.POST    ${apiRoot}/${apiName}/${apiMajorVersion}/ns_descriptors    ${body}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output} 
@@ -313,6 +311,28 @@ Send DELETE Request for Individual Network Service Descriptor
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}
 
Send DELETE Request for Individual Network Service Descriptor with permitted authorization scope
    Log    Trying to perform a DELETE nsdInfo. The nsdInfo should be in "NOT_USED" usageState and in "DISABLED" operationalState.
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    ${scopeValue}=    Create Dictionary    scope=${NSD_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.DELETE    ${apiRoot}/${apiName}/${apiMajorVersion}/ns_descriptors/${disabledNsdInfoId}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}

Send DELETE Request for Individual Network Service Descriptor with not permitted authorization scope
    Log    Trying to perform a DELETE nsdInfo. The nsdInfo should be in "NOT_USED" usageState and in "DISABLED" operationalState.
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    ${scopeValue}=    Create Dictionary    scope=${NSD_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.DELETE    ${apiRoot}/${apiName}/${apiMajorVersion}/ns_descriptors/${disabledNsdInfoId}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}

Check Postcondition Network Service Descriptor is Deleted
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}