Commit ca78bbd5 authored by Eisha Ayaz's avatar Eisha Ayaz
Browse files

[test-upd][SOL025][TC-DATA-AN][v5.3.1][12.3.1.6.1,2...

[test-upd][SOL025][TC-DATA-AN][v5.3.1][12.3.1.6.1,2 Test-IDs][NFVSOL(26)000019r3​] Add support of received notification validation
parent c37da81d
Loading
Loading
Loading
Loading
+52 −2
Original line number Diff line number Diff line
*** Setting ***
*** Settings ***
Resource    environment/variables.txt
Suite Setup    Create Sessions
Suite Teardown    Terminate All Processes    kill=true
@@ -8,10 +8,24 @@ Library OperatingSystem
Library    BuiltIn
Library    Collections
Library    String
Library    REST    ${TCDAS_SCHEMA}://${TCDAS_HOST}:${TCDAS_PORT}    ssl_verify=false


*** Test Cases ***
Data Analytics Change Notification
Data Analytics Change Notification START
    [Documentation]    Test ID: 12.3.1.6.1
    ...    Test title: Data Analytics Start Notification
    ...    Test objective: The objective is to test the dispatch of Data Analytics Start Notification when the analytics process starts, and perform a JSON schema and content validation of the delivered notification. The action that triggers the notification under test is an explicit test step, but it is not performed by the test system.
    ...    Pre-conditions: A subscription for Data Analytics Start Notifications is available in the NFV-MANO.
    ...    Reference: clause 5.5.8.2.1 - ETSI GS NFV-SOL 025 [12] v5.3.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: none
    ...    Post-Conditions: none 
    Trigger the availability of Data Analytics Change Notification (external action) 
    Check Data Analytics Change Notification Available Http POST Request Body Json Schema Is    DataAnalyticsChangeNotification
    Check Data Analytics Change Notification Available Http POST Request Body notificationType attribute Is    DataAnalyticsChangeNotification
    Check Data Analytics Change Notification Available And Analytics State    START
Data Analytics Change Notification RESULT
    [Documentation]    Test ID: 12.3.1.6.1
    ...    Test title: Data Analytics Change Notification
    ...    Test objective: The objective is to test the dispatch of Data Analytics Change Notification when changes on the Telco-cloud data analytics occur, and perform a JSON schema and content validation of the delivered notification. The action that triggers the notification under test is an explicit test step, but it is not performed by the test system.
@@ -23,6 +37,7 @@ Data Analytics Change Notification
    Trigger the availability of Data Analytics Change Notification (external action) 
    Check Data Analytics Change Notification Available Http POST Request Body Json Schema Is    DataAnalyticsChangeNotification
    Check Data Analytics Change Notification Available Http POST Request Body notificationType attribute Is    DataAnalyticsChangeNotification
    Check Data Analytics Change Notification Available And Analytics State    RESULT   

*** Keywords ***
Trigger the availability of Data Analytics Change Notification (external action) 
@@ -64,3 +79,38 @@ Create Sessions
    Start Process  java  -jar  ${MOCK_SERVER_JAR}  -serverPort  ${callback_port}  alias=mockInstance
    Wait For Process  handle=mockInstance  timeout=5s  on_timeout=continue
    Create Mock Session  ${callback_uri}:${callback_port}
Check Data Analytics Change Notification Available And Analytics State
    [Arguments]    ${expected_status}
    ${requests}=    Retrieve Requests    ${callback_endpoint_fwd}
    Should Not Be Empty    ${requests}    msg=No notification received at callback endpoint!

    ${request_type}=    Evaluate    type(${requests})

    ${last_request}=    Run Keyword If    "${request_type}" == "<class 'list'>"
    ...    Get From List    ${requests}    -1
    ...    ELSE
    ...    Set Variable    ${requests}

    ${body}=    Get From Dictionary    ${last_request}    body
    ${body_text}=    Get From Dictionary    ${body}    string
    Log    Raw body: ${body_text}

    ${notification}=    Evaluate    json.loads(r'''${body_text}''')    json

    Should Be Equal As Strings    ${notification['notificationType']}    DataAnalyticsChangeNotification
    Should Be Equal As Strings    ${notification['notificationStatus']}    ${expected_status}

    ${analyticsId}=    Get From Dictionary    ${notification}    analyticsId
    ${analysisStatus}=    Get From Dictionary    ${notification}    analysisStatus

    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Run Keyword If    ${AUTH_USAGE} == 1
    ...    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}

    # Validate Analytics resource existence
    GET    ${apiRoot}/${apiName}/${apiMajorVersion}/analytics/${analyticsId}
    Integer    response status    200

    Clear Requests    ${callback_endpoint}
    Clear Requests    ${callback_endpoint_fwd}