Commit 1acd09eb authored by Jorge Moratinos's avatar Jorge Moratinos
Browse files

new tests under development on event filter feature

parent c9eebc97
Loading
Loading
Loading
Loading
Loading
+24 −17
Original line number Diff line number Diff line
@@ -203,21 +203,22 @@ Invoker events filtered by invokerIds

    # Check Results
    Check Response Variable Type And Values    ${resp}    201    EventSubscription
    ${subscriber_id}    ${subscription_id}=    Check Event Location Header    ${resp}
    ${subscriber_id}    ${subscription_id_1}=    Check Event Location Header    ${resp}

    # Default Invoker Registration and Onboarding
    ${register_user_info_invoker_1}    ${invoker_url_1}    ${request_body_1}=    Invoker Default Onboarding  invoker_username=${INVOKER_USERNAME}_1
    ${register_user_info_invoker_1}    ${invoker_url_1}    ${invoker_request_body_1}=    Invoker Default Onboarding  invoker_username=${INVOKER_USERNAME}_1
    ${api_invoker_id_1}=   Set Variable    ${register_user_info_invoker_1['api_invoker_id']}

    # Default Invoker Registration and Onboarding
    ${register_user_info_invoker_2}    ${invoker_url_2}    ${request_body_2}=    Invoker Default Onboarding  invoker_username=${INVOKER_USERNAME}_1
    ${register_user_info_invoker_2}    ${invoker_url_2}    ${invoker_request_body_2}=    Invoker Default Onboarding  invoker_username=${INVOKER_USERNAME}_2
    ${api_invoker_id_2}=   Set Variable    ${register_user_info_invoker_2['api_invoker_id']}

    # Subscribe to events
    ${events_list}=    Create List    API_INVOKER_ONBOARDED   API_INVOKER_OFFBOARDED  API_INVOKER_UPDATED
    ${event_filter_empty}=    Create Capif Event Filter
    ${event_filter_invoker_id_1}=    Create Capif Event Filter    apiInvokersIds=${api_invoker_id_1}
    ${event_filters}=    Create List    ${event_filter_empty}    ${event_filter_invoker_id_1}    ${event_filter_invoker_id_1}
    ${event_filter_invoker_id_1}=    Create Capif Event Filter    apiInvokerIds=${api_invoker_id_1}
    ${event_filter_invoker_id_2}=    Create Capif Event Filter    apiInvokerIds=${api_invoker_id_2}
    ${event_filters}=    Create List    ${event_filter_empty}    ${event_filter_invoker_id_1}    ${event_filter_invoker_id_2}

    ${request_body}=    Create Events Subscription
    ...    events=@{events_list}
@@ -229,22 +230,22 @@ Invoker events filtered by invokerIds
    ...    json=${request_body}
    ...    server=${CAPIF_HTTPS_URL}
    ...    verify=ca.crt
    ...    username=${INVOKER_USERNAME}
    ...    username=${AMF_PROVIDER_USERNAME}

    # Check Results
    Check Response Variable Type And Values    ${resp}    201    EventSubscription
    ${subscriber_id}    ${subscription_id}=    Check Event Location Header    ${resp}
    ${subscriber_id}    ${subscription_id_2}=    Check Event Location Header    ${resp}

    # Update Invokers
    ## Update Invoker 1
    ${new_notification_destination}=    Set Variable
    ...    http://${CAPIF_CALLBACK_IP}:${CAPIF_CALLBACK_PORT}/netapp_new_callback_1
    Set To Dictionary
    ...    ${request_body}
    ...    ${invoker_request_body_1}
    ...    notificationDestination=${new_notification_destination}
    ${resp}=    Put Request Capif
    ...    ${invoker_url_1.path}
    ...    ${request_body}
    ...    ${invoker_request_body_1}
    ...    server=${CAPIF_HTTPS_URL}
    ...    verify=ca.crt
    ...    username=${INVOKER_USERNAME}_1
@@ -255,11 +256,11 @@ Invoker events filtered by invokerIds
    ${new_notification_destination}=    Set Variable
    ...    http://${CAPIF_CALLBACK_IP}:${CAPIF_CALLBACK_PORT}/netapp_new_callback_2
    Set To Dictionary
    ...    ${request_body}
    ...    ${invoker_request_body_2}
    ...    notificationDestination=${new_notification_destination}
    ${resp}=    Put Request Capif
    ...    ${invoker_url_2.path}
    ...    ${request_body}
    ...    ${invoker_request_body_2}
    ...    server=${CAPIF_HTTPS_URL}
    ...    verify=ca.crt
    ...    username=${INVOKER_USERNAME}_2
@@ -287,14 +288,20 @@ Invoker events filtered by invokerIds

    # Check Event Notifications
    ## Create check Events to ensure all notifications were received
    ${invoker_urls}=    Create List    ${invoker_url_1}
    ${invoker_urls_both}=   Create List    ${invoker_url_1}    ${invoker_url_2}
    ${invoker_urls_1}=    Create List    ${invoker_url_1}
    ${invoker_urls_2}=    Create List    ${invoker_url_2}
    ${empty_list}=    Create List
    ${events_expected}=    Create Expected Api Invoker Events
    ...    ${subscription_id}
    ...    api_invoker_onboarded_resources=${empty_list}
    ...    api_invoker_updated_resources=${invoker_url}
    ...    api_invoker_offboarded_resources=${invoker_url}
    ...    event_detail_expected=${FALSE}
    ...    ${subscription_id_1}
    ...    api_invoker_onboarded_resources=${invoker_urls_both}
    ...    event_detail_expected=${TRUE}
    ${events_expected}=    Create Expected Api Invoker Events
    ...    ${subscription_id_2}
    ...    events_expected=${events_expected}
    ...    api_invoker_updated_resources=${invoker_urls_2}
    ...    api_invoker_offboarded_resources=${invoker_urls_1}
    ...    event_detail_expected=${TRUE}
    Log List    ${events_expected}
    ## Check Events Expected towards received notifications at mock server
    Wait Until Keyword Succeeds    5x    5s    Check Mock Server Notification Events    ${events_expected}