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

added oauth scope tests for PM thresholds

parent 02736883
Loading
Loading
Loading
Loading
+28 −0
Original line number Diff line number Diff line
@@ -408,6 +408,34 @@ Send Post Request Create new Performance Threshold
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}

Send Post Request Create new Performance Threshold with permitted authorization scope
    Log    Creating a new Threshold
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Set Headers    {"Content-Type": "${CONTENT_TYPE_JSON}"}
    ${scopeValue}=    Create Dictionary    scope=${THRESHOLD_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}
    ${template}=    Get File    jsons/CreateThresholdRequest.json
    ${body}=        Format String   ${template}     objectInstanceIds=${objectInstanceIds}    callbackUri=${callback_uri}
    POST    ${apiRoot}/${apiName}/${apiMajorVersion}/thresholds    ${body}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}

Send Post Request Create new Performance Threshold with not permitted authorization scope
    Log    Creating a new Threshold
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Set Headers    {"Content-Type": "${CONTENT_TYPE_JSON}"}
    ${scopeValue}=    Create Dictionary    scope=${THRESHOLD_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}
    ${template}=    Get File    jsons/CreateThresholdRequest.json
    ${body}=        Format String   ${template}     objectInstanceIds=${objectInstanceIds}    callbackUri=${callback_uri}
    POST    ${apiRoot}/${apiName}/${apiMajorVersion}/thresholds    ${body}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}

Send Post Request Create new Performance Threshold with unreachable notification endpoint
    Log    Creating a new Threshold
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":${AUTHORIZATION_TOKEN}"}
+27 −0
Original line number Diff line number Diff line
@@ -132,3 +132,30 @@ POST Create new Performance Threshold - Unprocessable content
    Send Post Request Create new Performance Threshold with unreachable notification endpoint
    Check HTTP Response Status Code Is    422
    Check HTTP Response Body Json Schema Is   ProblemDetails

POST Create new Performance Threshold with permitted authorization scope
    [Documentation]    Test ID: 8.3.2.4.11
    ...    Test title:  POST Create new Performance Threshold with permitted authorization scope
    ...    Test objective: The objective is to test the creation of a new NFV-MANO performance threshold with permitted authorization scope.
    ...    Pre-conditions: A NFV-MANO instance is instantiated.
    ...    Reference: clause 6.5.6.3.1 - ETSI GS NFV-SOL 009 [7] v4.5.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: none
    ...    Post-Conditions: The NFV-MANO Performance Threshold is successfully created on the NFV-MANO
    Send Post Request Create new Performance Threshold with permitted authorization scope
    Check HTTP Response Status Code Is    201
    Check HTTP Response Body Json Schema Is   Threshold
    Check HTTP Response Header Contains    Location
    Check Postcondition Threshold Exists

POST Create new Performance Threshold with not permitted authorization scope
    [Documentation]    Test ID: 8.3.2.4.12
    ...    Test title:  POST Create new Performance Threshold with not permitted authorization scope
    ...    Test objective: The objective is to test the creation of a new NFV-MANO performance threshold fails with not permitted authorization scope.
    ...    Pre-conditions: A NFV-MANO instance is instantiated.
    ...    Reference: clause 6.5.6.3.1 - ETSI GS NFV-SOL 009 [7] v4.5.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: none
    ...    Post-Conditions: The NFV-MANO Performance Threshold is successfully created on the NFV-MANO
    Send Post Request Create new Performance Threshold with not permitted authorization scope
    Check HTTP Response Status Code Is    401