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

[test-new][SOL025][DATA-ANALYTICS][v5.2.1][12.3.1.6.1 Test-IDs] Implemented...

[test-new][SOL025][DATA-ANALYTICS][v5.2.1][12.3.1.6.1 Test-IDs] Implemented new test for dispatch of Data Analytics Change Notification
parent 83541ca2
Loading
Loading
Loading
Loading
+66 −0
Original line number Diff line number Diff line
*** Setting ***
Resource    environment/variables.txt
Suite Setup    Create Sessions
Suite Teardown    Terminate All Processes    kill=true
Library    MockServerLibrary
Library    Process
Library    OperatingSystem
Library    BuiltIn
Library    Collections
Library    String


*** Test Cases ***
Data Analytics Change Notification
    [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.
    ...    Pre-conditions: A subscription for Data Analytics Change Notifications is available in the NFV-MANO.
    ...    Reference: clause 5.5.8.2.1 - ETSI GS NFV-SOL 025 [12] v5.2.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

*** Keywords ***
Trigger the availability of Data Analytics Change Notification (external action) 
    #do nothing
    Log    do nothing
  
Check Data Analytics Change Notification Available Http POST Request Body Json Schema Is    
    [Arguments]    ${element}
    ${schema}=  Get File    schemas/${element}.schema.json
    Configure Notification Forward    ${schema}    ${callback_endpoint}    ${callback_endpoint_fwd}

Check Data Analytics Change Notification Available Http POST Request Body notificationType attribute Is
    [Arguments]    ${type}
    Configure Notification Data Analytics Change Notification Available Handler    ${callback_endpoint_fwd}    ${type}
    Wait Until Keyword Succeeds    2 min   10 sec   Verify Mock Expectation    ${notification_request}
    Clear Requests    ${callback_endpoint}
    Clear Requests    ${callback_endpoint_fwd}    
    
    
Configure Notification Data Analytics Change Notification Available Handler
    [Arguments]    ${endpoint}    ${type}
    ${json}=    evaluate    {}
    set to dictionary    ${json}    notificationType    ${type}    
    ${BODY}=    evaluate    json.dumps(${json})    json
    Log  Creating mock request and response to handle status notification
    &{req}=  Create Mock Request Matcher    POST  ${endpoint}  body_type="JSON"    body=${BODY}
    Set Global Variable    ${notification_request}    ${req}   
    &{notification_response}=  Create Mock Response    status_code=204
    Create Mock Expectation  ${notification_request}  ${notification_response}
  
Configure Notification Forward
    [Arguments]    ${schema}    ${endpoint}    ${endpoint_fwd}    
    Log  Creating mock Http POST forward to handle ${schema}
    &{notification_tmp}=  Create Mock Request Matcher   POST  ${endpoint}  body_type="JSON_SCHEMA"    body=${schema}
    &{notification_fwd}=  Create Mock Http Forward  ${endpoint_fwd}
    Create Mock Expectation With Http Forward  ${notification_tmp}  ${notification_fwd}

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}
+19 −0
Original line number Diff line number Diff line
@@ -26,3 +26,22 @@ ${analyticsId} analyticsID
${reportId}      reportID
${original_etag}    some_etag

${subscriptionId}     yoursubscriptionid

${callbackResp}     http://localhost

{callback_port}    9091
${callback_uri}    http://localhost:${callback_port}
${unreachable_callback_uri}   http://unreachable_callback_uri-error-code-422
${callback_endpoint}    /subscriptions
${filter_ok}      callbackUri=${callbackUri}
${filter_ko}      erroneousFilter=erroneous
${callback_endpoint_fwd}    /endpoint/check

${total_polling_time}   2 min
${polling_interval}     10 sec

${notification_request}    []
${notification_response}    []

${MOCK_SERVER_JAR}    ../../../bin/mockserver-netty-5.5.0-jar-with-dependencies.jar
 No newline at end of file
+12 −0
Original line number Diff line number Diff line
{{
  "id": "",
  "notificationType": "DataAnalyticsChangeNotification",
  "analyticsId": "{analyticsId}",
  "timeStamp": "",
  "notificationStatus": "",
  "analysisStatus": "",
  "failureReason": "",
  "_links": {{
  	"analytics": ""
  }} 
}}
 No newline at end of file
+348 −0

File added.

Preview size limit exceeded, changes collapsed.

+348 −0

File added.

Preview size limit exceeded, changes collapsed.