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

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

[test-upd][SOL009][NFV-MANO-PM][v5.3.1][NFVSOL(26)000019r3][8.3.2.8.x Test-IDs] implemented support for notification validation as per item 17-2
parent 756e5768
Loading
Loading
Loading
Loading
+74 −0
Original line number Diff line number Diff line
@@ -897,6 +897,80 @@ Configure Notification Forward
    &{notification_fwd}=  Create Mock Http Forward	${endpoint_fwd}
    Create Mock Expectation With Http Forward  ${notification_tmp}  ${notification_fwd}

Check Performance Information 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}

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

    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/${pmJobId}
    Integer    response status    200
    ${output}=    Output    response
    Should Be Equal    ${output['body']['id']}    ${pmJobId} 

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

Check Threshold Crossed Notification Validation
    [Arguments]    ${expected_notification_type}=InformationChangedNotification
    ${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}

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

    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}/thresholds/${thresholdId}
    Integer    response status    200
    ${output}=    Output    response
    Should Be Equal    ${output['body']['id']}    ${thresholdId} 

    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
+2 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@ Performance Information Availability Notification
    Trigger the availability of Performance Information (external action) 
    Check Performance Information Available Notification Http POST Request Body Json Schema Is    PerformanceInformationAvailableNotification
    Check Performance Information Available Notification Http POST Request Body notificationType attribute Is    PerformanceInformationAvailableNotification
    Check Performance Information Notification Validation

Threshold Crossed Notification
    [Documentation]    Test ID: 8.3.2.8.2
@@ -29,3 +30,4 @@ Threshold Crossed Notification
    Trigger the cross of Performance Threshold (external action) 
    Check Threshold Crossed Notification Http POST Request Body Json Schema Is    ThresholdCrossedNotification
    Check Threshold Crossed Notification Http POST Request Body notificationType attribute Is    ThresholdCrossedNotification
    Check Threshold Crossed Notification Validation
+1 −2
Original line number Diff line number Diff line
@@ -24,8 +24,7 @@ ${AUTH_USAGE} 1
${FIELD_USAGE}    1
#${NFVMANO_CHECKS_NOTIF_ENDPOINT}    1        ## If true, during subscription, the FUT performs a get to the notification endpoint



${API_VERSION}    2.1.0
${apiRoot}        /
${apiMajorVersion}     v1
${apiName}        nfvmanopm