Commit 2d75f3a6 authored by Najam UI Hassan's avatar Najam UI Hassan Committed by Giacomo Bernini
Browse files

Added Test Cases for CompileLogTask.robot

parent 2810f79a
Loading
Loading
Loading
Loading
+113 −0
Original line number Diff line number Diff line
*** Settings ***
Library           JSONSchemaLibrary    schemas/
Resource          environment/variables.txt
Resource          NFVMANOLogManagementKeywords.robot
Library           JSONLibrary
Library           OperatingSystem
Library           REST    ${NFVMANO_SCHEMA}://${NFVMANO_HOST}:${NFVMANO_PORT}    ssl_verify=false


*** Test Cases ***
Request to compile the logged data into a file - Synchronous mode
    [Documentation]    Test ID: 8.3.4.4.1
    ...    Test title: Request to compile the logged data into a file - Synchronous mode
    ...    Test objective: The objective is to request to compile the logged data into a file in synchronous mode and perform a JSON schema validation on the returned log report data structure
    ...    Pre-conditions: 
    ...    Reference: clause 8.5.6.3.1 - ETSI GS NFV-SOL 009 [5] V3.3.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: The NFV-MANO can decide immediately what to respond to a compile request
    ...    Post-Conditions: The compiled log information is available.
    Send Log data Request in Synchronous mode
    Check HTTP Response Status Code Is    201
    Check Operation Occurrence Id
    Check HTTP Response Body Json Schema Is    LogReport


Request to compile the logged data into a file - Asynchronous mode
    [Documentation]    Test ID: 8.3.4.4.2
    ...    Test title: Request to compile the logged data into a file - Asynchronous mode
    ...    Test objective: The objective is to request to compile the logged data into a file in asynchronous mode and perform a JSON schema validation on the returned log report data structure
    ...    Pre-conditions: 
    ...    Reference: clause 8.5.6.3.1 - ETSI GS NFV-SOL 009 [5] V3.3.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: The NFV-MANO can not decide immediately what to respond to a compile request
    ...    Post-Conditions: The compiled log information is available.
    Send Log data Request in Asynchronous mode
    Check HTTP Response Status Code Is    202
    Check Operation Occurrence Id
    Wait for compilation success notification 
    
Request to compile the logged data into a file - Already Processing
    [Documentation]    Test ID: 8.3.4.4.3
    ...    Test title: Request to compile the logged data into a file - Already Processing
    ...    Test objective: The objective is to request to compile the logged data into a file when a log data compilation and report creation is already ongoing, or a log report has just been created, for the specified logging job at the time of processing the request and perform a JSON schema validation on the returned log report data structure
    ...    Pre-conditions: 
    ...    Reference: clause 8.5.6.3.1 - ETSI GS NFV-SOL 009 [5] V3.3.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: 
    ...    Post-Conditions: 
    Send Log data Request
    Check HTTP Response Status Code Is    303
    Check Operation Occurrence Id
    
Request to compile the logged data into a file with unprocessable entity
        [Documentation]    Test ID: 8.3.4.4.4
    ...    Test title: Request to compile the logged data into a file with unprocessable entity
    ...    Test objective:  The objective is to test that the rrequest to compile the logged data into a file fails when error in request body. 
    ...    Pre-conditions: 
    ...    Reference: clause 8.5.6.3.1 - ETSI GS NFV-SOL 009 [5] V3.3.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: none
    ...    Post-Conditions: none
    Send Log data Request
    Check HTTP Response Status Code Is    422
    Check HTTP Response Body Json Schema Is    ProblemDetails 
    
GET Compiled Log Data - Method not implemented
    [Documentation]    Test ID: 8.3.4.4.5
    ...    Test title: GET Compiled Log Data - Method not implemented
    ...    Test objective: The objective is to test that GET method is not allowed to retrieve compiled log data.
    ...    Pre-conditions: 
    ...    Reference: clause 8.5.6.3.2 - ETSI GS NFV-SOL 009 [5] V3.3.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: none
    ...    Post-Conditions: 
    Send Get Compiled Log Data
    Check HTTP Response Status Code Is    405
    
PUT Compiled Log Data - Method not implemented
    [Documentation]    Test ID: 8.3.4.4.6
    ...    Test title: PUT Compiled Log Data - Method not implemented
    ...    Test objective: The objective is to test that PUT method is not allowed to update compiled log data.
    ...    Pre-conditions: 
    ...    Reference: clause 8.5.6.3.3 - ETSI GS NFV-SOL 009 [5] V3.3.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: none
    ...    Post-Conditions: 
    Send PUT Compiled Log Data
    Check HTTP Response Status Code Is    405
    
PATCH Compiled Log Data - Method not implemented
    [Documentation]    Test ID: 8.3.4.4.7
    ...    Test title: PATCH Compiled Log Data - Method not implemented
    ...    Test objective: The objective is to test that PATCH method is not allowed to update compiled log data.
    ...    Pre-conditions: 
    ...    Reference: clause 8.5.6.3.4 - ETSI GS NFV-SOL 009 [5] V3.3.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: none
    ...    Post-Conditions: 
    Send PATCH Compiled Log Data
    Check HTTP Response Status Code Is    405
    
DELETE Compiled Log Data - Method not implemented
    [Documentation]    Test ID: 8.3.4.4.8
    ...    Test title: DELETE Compiled Log Data - Method not implemented
    ...    Test objective: The objective is to test that DELETE method is not allowed to update compiled log data.
    ...    Pre-conditions: 
    ...    Reference: clause 8.5.6.3.5 - ETSI GS NFV-SOL 009 [5] V3.3.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: none
    ...    Post-Conditions: 
    Send DELETE Compiled Log Data
    Check HTTP Response Status Code Is    405
    
 No newline at end of file
+84 −0
Original line number Diff line number Diff line
@@ -282,3 +282,87 @@ Check Postcondition Individual Log Report Exists
    Log    Checking that report still exists
    Get Individual Log Report
    Check HTTP Response Status Code Is    200
    
Send Log data Request in Synchronous mode
    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}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    ${body}=    Get File    jsons/compileLogRequest.json
    Post    ${apiRoot}/${apiName}/${apiMajorVersion}/log_jobs/${logJobId}/compile_log    ${body}
    ${body}=    Output    response
    Set Suite Variable    &{response}    ${body}

Check Operation Occurrence Id
    ${vnfLcmOpOccId}=    Get Value From Json    ${response['headers']}    $..Location
    Should Not Be Empty    ${vnfLcmOpOccId}

Send Log data Request in Asynchronous mode
    Log    Request to compile the logged data into a file Asynchronous mode
    Pass Execution If    ${SYNC_MODE} == 1    The compile process is synchronous mode. Skipping the test
    Set Headers    {"Accept": "${ACCEPT}"}
    Set Headers    {"Content-Type": "${CONTENT_TYPE}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    ${body}=    Get File    jsons/compileLogRequest.json
    Post    ${apiRoot}/${apiName}/${apiMajorVersion}/log_jobs/${logJobId}/compile_log    ${body}
    ${body}=    Output    response
    Set Suite Variable    &{response}    ${body}
    
 Wait for compilation success notification 
    Wait Until Keyword Succeeds    ${retry}   ${polling}    Get success notification
    
Get Success notification
    log    Trying to read an compiled file
    Set Headers    {"Accept":"${ACCEPT}"}  
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Get    ${response['headers']['Location']}
    Log    Validate Status code
    Integer    response status    200
    ${result}    Output    response body
    Validate Json   LogReport.schema.json    ${result}
    Log    Validation OK
    
Send Log data Request
    Set Headers  {"Accept":"${ACCEPT}"}  
    Set Headers  {"Content-Type": "${CONTENT_TYPE}"}
    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    ${body}=    Get File    jsons/createLoggingJobRequest.json
    Post    ${apiRoot}/${apiName}/${apiMajorVersion}/log_jobs/${logJobId}/compile_log    ${body}
    ${outputResponse}=    Output    response
	Set Global Variable    @{response}    ${outputResponse}

Send Get Compiled Log Data
    Log    Trying to delete log report   
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": ${AUTHORIZATION}"}
    DELETE    ${apiRoot}/${apiName}/${apiMajorVersion}/log_jobs/${logJobId}/compile_log
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}

Send Put Compiled Log Data
    Log    Trying to update log report
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": ${AUTHORIZATION}"}
    GET    ${apiRoot}/${apiName}/${apiMajorVersion}/log_jobs/${logJobId}/compile_log
    ${origOutput}=    Output    response
    Set Suite Variable    ${origResponse}    ${origOutput}
    PUT    ${apiRoot}/${apiName}/${apiMajorVersion}/log_jobs/${logJobId}/compile_log
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}
    
Send Patch Compiled Log Data
    Log    Trying to update log report
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": ${AUTHORIZATION}"}
    GET    ${apiRoot}/${apiName}/${apiMajorVersion}/log_jobs/${logJobId}/compile_log
    ${origOutput}=    Output    response
    Set Suite Variable    ${origResponse}    ${origOutput}
    PATCH    ${apiRoot}/${apiName}/${apiMajorVersion}/log_jobs/${logJobId}/compile_log
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}

Send Delete Compiled Log Data
    Log    Trying to delete log report   
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": ${AUTHORIZATION}"}
    DELETE    ${apiRoot}/${apiName}/${apiMajorVersion}/log_jobs/${logJobId}/compile_log
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}
    
 No newline at end of file
+6 −0
Original line number Diff line number Diff line
@@ -45,3 +45,9 @@ ${fields}
${reportId}       0fb4c875-e07f-46ca-a9dd-13907667a568
${erroneousReportId}    erroneousReportId
${newReportId}    newReportId

${SYNC_MODE}    1

${retry}   2 min
${polling}    10 sec
+3 −0
Original line number Diff line number Diff line
{
  "objectInstanceId":""
}
 No newline at end of file
+6 −6

File changed.

Contains only whitespace changes.