Commit 486e0970 authored by Giacomo Bernini's avatar Giacomo Bernini
Browse files

[test-upd][SOL009][NFV-MANO-FM][v5.3.1][NFVSOL(26)000019r3][8.3.3.5.x...

[test-upd][SOL009][NFV-MANO-FM][v5.3.1][NFVSOL(26)000019r3][8.3.3.5.x Test-IDs] implemented support for notification validation as per item 17-2
parent 1a1955dc
Loading
Loading
Loading
Loading
+116 −7
Original line number Diff line number Diff line
@@ -659,8 +659,8 @@ Check Alarm List Rebuilt Notification Http POST Request Body notificationType at
    [Arguments]    ${type}
    Configure Notification Alarm List Rebuilt Handler    ${callback_endpoint_fwd}    ${type}
    Wait Until Keyword Succeeds    ${total_polling_time}    ${polling_interval}    Verify Mock Expectation    ${notification_request}
    Clear Requests    ${callback_endpoint}
    Clear Requests    ${callback_endpoint_fwd}
    #Clear Requests    ${callback_endpoint}
    #Clear Requests    ${callback_endpoint_fwd}

Check Alarm Notification Http POST Request Body Json Schema Is    
    [Arguments]    ${element}
@@ -671,8 +671,8 @@ Check Alarm Notification Http POST Request Body notificationType attribute Is
    [Arguments]    ${type}
    Configure Notification Alarm Handler    ${callback_endpoint_fwd}    ${type}
    Wait Until Keyword Succeeds    ${total_polling_time}    ${polling_interval}    Verify Mock Expectation    ${notification_request}
    Clear Requests    ${callback_endpoint}
    Clear Requests    ${callback_endpoint_fwd}
    #Clear Requests    ${callback_endpoint}
    #Clear Requests    ${callback_endpoint_fwd}

Check Alarm cleared Notification Http POST Request Body Json Schema Is    
    [Arguments]    ${element}
@@ -684,8 +684,8 @@ Check Alarm cleared Notification Http POST Request Body notificationType attribu
    [Arguments]    ${type}
    Configure Notification Alarm Cleareance Handler    ${callback_endpoint_fwd}    ${type}
    Wait Until Keyword Succeeds    ${total_polling_time}    ${polling_interval}    Verify Mock Expectation    ${notification_request}
    Clear Requests    ${callback_endpoint}
    Clear Requests    ${callback_endpoint_fwd}
    #Clear Requests    ${callback_endpoint}
    #Clear Requests    ${callback_endpoint_fwd}
    
    
Check Alarm Clerance Notification Http POST Request Body changeType attribute Is
@@ -734,6 +734,115 @@ Configure Notification Forward
    &{notification_fwd}=  Create Mock Http Forward	${endpoint_fwd}
    Create Mock Expectation With Http Forward  ${notification_tmp}  ${notification_fwd}

Check Alarm Notification Validation
    [Arguments]    ${expected_notification_type}=alarmNotification
    ${requests}=    Retrieve Requests    ${callback_endpoint_fwd}
    Should Not Be Empty    ${requests}    msg=No notification received at callback endpoint!

    ${request_type}=    Evaluate    type(${requests})
    Log    Request type: ${request_type}

    ${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

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

    Should Be Equal As Strings    ${notification['notificationType']}    ${expected_notification_type}

    ${alarm}=    Get From Dictionary    ${notification}    alarm

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

    # Validate entity exists
    GET    ${apiRoot}/${apiName}/${apiMajorVersion}/alarms/${alarm['id']}
    Integer    response status    200
    ${output}=    Output    response
    Should Be Equal    ${output['body']['id']}    ${alarm['id']} 

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

Check Alarm cleared Notification Validation
    [Arguments]    ${expected_notification_type}=PerformanceInformationAvailableNotification
    ${requests}=    Retrieve Requests    ${callback_endpoint_fwd}
    Should Not Be Empty    ${requests}    msg=No notification received at callback endpoint!

    ${request_type}=    Evaluate    type(${requests})
    Log    Request type: ${request_type}

    ${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

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

    Should Be Equal As Strings    ${notification['notificationType']}    ${expected_notification_type}

    ${alarmId}=    Get From Dictionary    ${notification}    alarmId

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

    # Validate entity exists
    GET    ${apiRoot}/${apiName}/${apiMajorVersion}/pm_jobs/${alarmId}
    Integer    response status    200
    ${output}=    Output    response
    Should Be Equal    ${output['body']['id']}    ${alarmId} 

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

Check Alarm list rebuilt Notification Validation
    [Arguments]    ${expected_notification_type}=PerformanceInformationAvailableNotification
    ${requests}=    Retrieve Requests    ${callback_endpoint_fwd}
    Should Not Be Empty    ${requests}    msg=No notification received at callback endpoint!

    ${request_type}=    Evaluate    type(${requests})
    Log    Request type: ${request_type}

    ${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

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

    Should Be Equal As Strings    ${notification['notificationType']}    ${expected_notification_type}

    ${_links}=    Get From Dictionary    ${notification}    _links

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

    # Validate entity exists
    GET    ${_links['alarms']}
    Integer    response status    200

    Clear Requests    ${callback_endpoint}
    Clear Requests    ${callback_endpoint_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
+4 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@ NFV-MANO Fault Alarm Notification
    Trigger the fault of a virtualised resource in the NFV-MANO instance (external action) 
    Check Alarm Notification Http POST Request Body Json Schema Is    alarmNotification
    Check Alarm Notification Http POST Request Body notificationType attribute Is    alarmNotification
    Check Alarm Notification Validation

NFV-MANO Fault Alarm Cleared Notification
    [Documentation]    Test ID: 8.3.3.5.2
@@ -30,6 +31,8 @@ NFV-MANO Fault Alarm Cleared Notification
    Trigger the clear of a faulty virtualised resource in the NFV-MANO instance (external action)
    Check Alarm cleared Notification Http POST Request Body Json Schema Is    alarmClearedNotification
    Check Alarm cleared Notification Http POST Request Body notificationType attribute Is    alarmClearedNotification
    Check Alarm cleared Notification Validation


NFV-MANO Fault Alarm List Rebuilt Notification 
    [Documentation]    Test ID: 8.3.3.5.3
@@ -43,3 +46,4 @@ NFV-MANO Fault Alarm List Rebuilt Notification
    Trigger the NFV-MANO fault alarm list rebuild in the NFVO (external action) 
    Check Alarm list rebuilt Notification Http POST Request Body Json Schema Is    alarmListRebuiltNotification
    Check Alarm list rebuilt Notification Http POST Request Body notificationType attribute Is    alarmListRebuiltNotification
    Check Alarm list rebuilt Notification Validation
 No newline at end of file
+1 −0
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@ ${AUTHORIZATION_TOKEN} Bearer QWxhZGRpbjpvcGVuIHNlc2FtZQ==
${CONTENT_TYPE}    application/json
${ACCEPT}         application/json
${ACCEPT_JSON}         application/json
${API_VERSION}      1.2.0
${AUTH_USAGE}     1
${NEG_AUTHORIZATION_TOKEN}    Bearer negativetoken
${BAD_AUTHORIZATION_TOKEN}    Bear sometoken