Commit c4a5a9d8 authored by Michele Carignani's avatar Michele Carignani
Browse files

fixes for asynch notification testing

parent 1c157541
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -38,7 +38,7 @@ Initialize System
Check Postcondition VNF Instance Created status is
    [Arguments]    ${status}
    Check VNF Instance    ${vnfInstanceId}
    Check HTTP Response Status Code Is    200
    Check HTTP Response Status Code Is    ${status}
    Check VNF Status    ${response['body']['instantiationState']}  ${status}  
     
Check Operation Notification For VNF Instance Creation
+20 −13
Original line number Diff line number Diff line
@@ -28,21 +28,26 @@ Create Sessions

Configure Notification Status Handler
    [Arguments]    ${endpoint}    ${status}=""
    Run Keyword If   ${status}!=""  set to dictionary    ${json["operationState"]}    dp=${status}    
    ${opst}=     Create Dictionary
    ${json}=     Create Dictionary  operationState=${opst}
    ${value}=    Run Keyword And Return Status    Should Not Be Equal As Strings    ${status}        ""
    Run Keyword If   ${value} == True      Set to dictionary    ${json["operationState"]}    dp=${status}
    ${BODY}=    evaluate    json.dumps(${json})    json
    Log  Creating mock request and response to handle ${element}
    &{notification_request}=  Create Mock Request Matcher	POST  ${endpoint}  body_type="JSON"    body=${BODY}
    &{notification_response}=  Create Mock Response	headers="Content-Type: application/json"  status_code=204
    ${headers}=  Create Dictionary  "Content-Type"="application/json"
    &{notification_response}=  Create Mock Response	headers=${headers}  status_code=204
    Create Mock Expectation  ${notification_request}  ${notification_response}

Configure Notification VNF Instance Handler
    [Arguments]    ${endpoint}    ${instanceId}=""
    Run Keyword If   ${instanceId}!=""  set to dictionary    ${json["vnfInstanceId"]}    dp=${instanceId}    
    Run Keyword If   "${instanceId}"!=""  set to dictionary    ${json['vnfInstanceId']}    dp=${instanceId}
    ${BODY}=    evaluate    json.dumps(${json})    json
    Log  Creating mock request and response to handle ${element}
    &{notification_request}=  Create Mock Request Matcher	POST  ${endpoint}  body_type="JSON"    body=${BODY}
    &{notification_response}=  Create Mock Response	headers="Content-Type: application/json"  status_code=204
    Create Mock Expectation  ${notification_request}  ${notification_response}
    &{headers}=  Create Dictionary  "Content-Type"="application/json"
    &{notification_response}=  Create Mock Response     headers=${headers}  status_code=204
    Create Mock Expectation  ${Notification_request}  ${notification_response}

Configure Notification Forward
    [Arguments]    ${element}    ${endpoint}    ${endpoint_fwd}
@@ -57,7 +62,8 @@ Check Operation Notification
    ${json}=	Get File	schemas/${element}.schema.json
    Configure Notification Forward    ${element}    ${callback_endpoint}    ${callback_endpoint_fwd}
    Configure Notification Status Handler    ${callback_endpoint_fwd}    ${status}
    Wait Until Keyword Succeeds    2 min   10 sec   Verify Mock Expectation    ${notification_request}
    ${verify}=   Create Dictionary
    Wait Until Keyword Succeeds    2 min   10 sec   Verify Mock Expectation    ${verify}
    Clear Requests    ${callback_endpoint}
    Clear Requests    ${callback_endpoint_fwd}

@@ -66,4 +72,5 @@ Check VNF Instance Operation Notification
    ${json}=	Get File	schemas/${element}.schema.json
    Configure Notification Forward    ${element}    ${callback_endpoint}    ${callback_endpoint_fwd}
    Configure Notification VNF Instance Handler    ${callback_endpoint_fwd}    ${instance_id}
    Check Operation Notification  vnfLcmOperationOccurrenceNotification  204