Commit 6e009b9e authored by Giacomo Bernini's avatar Giacomo Bernini Committed by Giacomo Bernini
Browse files

added oauth scope tests for LogM compile log

parent 063cbdf8
Loading
Loading
Loading
Loading
+25 −0
Original line number Diff line number Diff line
@@ -105,3 +105,28 @@ DELETE Compiled Log Data - Method not implemented
    Send DELETE Compiled Log Data
    Check HTTP Response Status Code Is    405
    
Request to compile the logged data into a file with a permitted authorization scope - Synchronous mode
    [Documentation]    Test ID: 8.3.4.4.9
    ...    Test title: Request to compile the logged data into a file with a permitted authorization scope - Synchronous mode
    ...    Test objective: The objective is to request to compile the logged data into a file in synchronous mode with a permitted authorization scope
    ...    Pre-conditions: logging job is available
    ...    Reference: clause 8.5.6.3.1 - ETSI GS NFV-SOL 009 [7] v4.5.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: The NFV-MANO can decide immediately what to respond to a compile request
    ...    Post-Conditions: none
    Send Log data Request in Synchronous mode with permitted authorization scope
    Check HTTP Response Status Code Is    201
    Check HTTP Response Header Contains Location
    Check HTTP Response Body Json Schema Is    LogReport

Request to compile the logged data into a file with not permitted authorization scope - Synchronous mode
    [Documentation]    Test ID: 8.3.4.4.9
    ...    Test title: Request to compile the logged data into a file with not permitted authorization scope - Synchronous mode
    ...    Test objective: The objective is to test that requesting to compile the logged data into a file in synchronous mode fails when using not permitted authorization scope
    ...    Pre-conditions: logging job is available
    ...    Reference: clause 8.5.6.3.1 - ETSI GS NFV-SOL 009 [7] v4.5.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: The NFV-MANO can decide immediately what to respond to a compile request
    ...    Post-Conditions: none
    Send Log data Request in Synchronous mode with not permitted authorization scope
    Check HTTP Response Status Code Is    401
 No newline at end of file
+1 −2
Original line number Diff line number Diff line
@@ -111,5 +111,4 @@ Get Individual Log Report with not permitted authorization scope
    ...    Applicability: none
    ...    Post-Conditions: none
    Get Individual Log Report with not permitted authorization scope
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is   LogReport
 No newline at end of file
    Check HTTP Response Status Code Is    401
 No newline at end of file
+30 −0
Original line number Diff line number Diff line
@@ -379,6 +379,36 @@ Send Log data Request in Synchronous mode
    ${body}=    Output    response
    Set Suite Variable    &{response}    ${body}

Send Log data Request in Synchronous mode with permitted authorization scope
    Log    Request to compile the logged data into a file Synchronous mode
    Pass Execution If    ${SYNC_MODE} == 0    The compile process is asynchronous mode. Skipping the test
    Set Headers    {"Accept": "${ACCEPT}"}
    Set Headers    {"Content-Type": "${CONTENT_TYPE}"}
    ${scopeValue}=    Create Dictionary    scope=${JOB_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/compileLogRequest.json
    ${body}=        Format String   ${template}     objectInstanceId=${objectInstanceId} 
    Post    ${apiRoot}/${apiName}/${apiMajorVersion}/log_jobs/${logJobId}/compile_log    ${body}
    ${body}=    Output    response
    Set Suite Variable    &{response}    ${body}

Send Log data Request in Synchronous mode with not permitted authorization scope
    Log    Request to compile the logged data into a file Synchronous mode
    Pass Execution If    ${SYNC_MODE} == 0    The compile process is asynchronous mode. Skipping the test
    Set Headers    {"Accept": "${ACCEPT}"}
    Set Headers    {"Content-Type": "${CONTENT_TYPE}"}
    ${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}
    ${template}=    Get File    jsons/compileLogRequest.json
    ${body}=        Format String   ${template}     objectInstanceId=${objectInstanceId} 
    Post    ${apiRoot}/${apiName}/${apiMajorVersion}/log_jobs/${logJobId}/compile_log    ${body}
    ${body}=    Output    response
    Set Suite Variable    &{response}    ${body}

Check HTTP Response Header Contains Location
    ${vnfLcmOpOccId}=    Get Value From Json    ${response['headers']}    $..Location
    Should Not Be Empty    ${vnfLcmOpOccId}