Commit 8b1c9431 authored by Giacomo Bernini's avatar Giacomo Bernini Committed by Giacomo Bernini
Browse files

added oauth scope tests for NSPM individual reports

parent 292352fc
Loading
Loading
Loading
Loading
+24 −0
Original line number Diff line number Diff line
@@ -80,3 +80,27 @@ DELETE Individual Performance Report - Method not implemented
    Send Delete request for Individual Performance Report
    Check HTTP Response Status Code Is    405

Get Individual Performance Report with permitted authorization scope
    [Documentation]    Test ID: 5.3.4.3.7
    ...    Test title: Get Individual Performance Report with permitted authorization scope
    ...    Test objective: The objective is to test the retrieval of an individual NS performance report associated to a monitoring job with permitted authorization scope
    ...    Pre-conditions: A NS instance is instantiated. One or more NS performance reports are set for a monitoring job in the NFVO.
    ...    Reference: Clause 7.4.4.3.2 - ETSI GS NFV-SOL 005 [3] v4.5.1
    ...    Config ID: Config_prod_NFVO
    ...    Applicability: none
    ...    Post-Conditions: none
    Get Individual Performance Report with permitted authorization scope
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is   PerformanceReport

Get Individual Performance Report with not permitted authorization scope
    [Documentation]    Test ID: 5.3.4.3.8
    ...    Test title: Get Individual Performance Report with not permitted authorization scope
    ...    Test objective: The objective is to test that the retrieval of an individual NS performance report associated to a monitoring job fails when using permitted authorization scope
    ...    Pre-conditions: A NS instance is instantiated. One or more NS performance reports are set for a monitoring job in the NFVO.
    ...    Reference: Clause 7.4.4.3.2 - ETSI GS NFV-SOL 005 [3] v4.5.1
    ...    Config ID: Config_prod_NFVO
    ...    Applicability: none
    ...    Post-Conditions: none
    Get Individual Performance Report with not permitted authorization scope
    Check HTTP Response Status Code Is    401
+23 −1
Original line number Diff line number Diff line
@@ -397,6 +397,28 @@ Check HTTP Response Body Pm Job Identifier matches the requested Pm Job
    Log    Pm Job identifier as expected

Get Individual Performance Report
    Log    Trying to get a performance report present in the NFVO
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    ${scopeValue}=    Create Dictionary    scope=${JOBS_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}
    GET    ${apiRoot}/${apiName}/${apiMajorVersion}/pm_jobs/${pmJobId}/reports/${reportId}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}

Get Individual Performance Report with permitted authorization scope
    Log    Trying to get a performance report present in the NFVO
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    ${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}
    GET    ${apiRoot}/${apiName}/${apiMajorVersion}/pm_jobs/${pmJobId}/reports/${reportId}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output} 

Get Individual Performance Report with not permitted authorization scope
    Log    Trying to get a performance report present in the NFVO
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}