Commit 42a5953e authored by guillecxb's avatar guillecxb
Browse files

Merge remote-tracking branch 'origin/staging' into...

Merge remote-tracking branch 'origin/staging' into OCF115-create-table-in-database-for-dynamic-configuration
parents 1550b228 3cf0a31b
Loading
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -330,6 +330,7 @@ class SecurityOperations(Resource):
                    "Service api not found with id: " + api_invoker_id)
                return not_found_error(detail="Service API not existing", cause="Not exist securiy information for this invoker")

            update_acls=list()
            for service_instance in service_security.security_info:
                if service_instance.interface_details is not None:
                    security_methods = service_instance.interface_details.security_methods
@@ -356,14 +357,22 @@ class SecurityOperations(Resource):
                        valid_security_methods) & set(pref_security_methods)
                    service_instance.sel_security_method = list(
                        valid_security_method)[0]
                update_acls.append({"api_id": service_instance.api_id, "aef_id": service_instance.aef_id})

            service_security = service_security.to_dict()
            service_security = clean_empty(service_security)

            result = mycol.find_one_and_update(old_object, {"$set": service_security}, projection={
                                               '_id': 0, "api_invoker_id": 0}, return_document=ReturnDocument.AFTER, upsert=False)
            current_app.logger.debug(
                    "Inserted security context in database")

            # result = clean_empty(result)
            for update_acl in update_acls:
                # Send service instance to ACL
                current_app.logger.debug("Sending message to create ACL")
                publish_ops.publish_message("acls-messages", "create-acl:"+str(
                    api_invoker_id)+":"+str(update_acl['api_id'])+":"+str(update_acl['aef_id']))

            current_app.logger.debug("Updated security context")

+1 −1
Original line number Diff line number Diff line
@@ -9,7 +9,7 @@ export ROBOT_DOCKER_FILE_FOLDER=$CAPIF_BASE_DIR/tools/robot

# Image URL and version
export REGISTRY_BASE_URL="labs.etsi.org:5050/ocf/capif/prod"
export OCF_VERSION="v2.0.0-release"
export OCF_VERSION="v2.x.x-release"

# Capif hostname
export CAPIF_HOSTNAME=capifcore
+21 −33
Original line number Diff line number Diff line
@@ -167,7 +167,7 @@ Invoker receives Service API Invocation events
    ${events_list}=    Create List    SERVICE_API_INVOCATION_SUCCESS    SERVICE_API_INVOCATION_FAILURE
    ${aef_ids}=    Create List    ${register_user_info['aef_id']}
    ${event_filter}=    Create Capif Event Filter    aefIds=${aef_ids}
    ${event_filters}=    Create List    ${event_filter}
    ${event_filters}=    Create List    ${event_filter}  ${event_filter}

    ${request_body}=    Create Events Subscription
    ...    events=@{events_list}
@@ -238,14 +238,10 @@ Invoker subscribe to Service API Available and Unavailable events

    # Subscribe to events
    ${events_list}=    Create List    SERVICE_API_AVAILABLE    SERVICE_API_UNAVAILABLE
    ${aef_ids}=    Create List    ${register_user_info_provider['aef_id']}
    ${event_filter}=    Create Capif Event Filter    aefIds=${aef_ids}
    ${event_filters}=    Create List    ${event_filter}

    ${request_body}=    Create Events Subscription
    ...    events=@{events_list}
    ...    notification_destination=${NOTIFICATION_DESTINATION_URL}/testing
    # ...    event_filters=${event_filters}
    ...    supported_features=4
    ${resp}=    Post Request Capif
    ...    /capif-events/v1/${register_user_info_invoker['api_invoker_id']}/subscriptions
@@ -296,6 +292,7 @@ Invoker subscribe to Service API Update
    # Publish one api
    ${service_api_description_published}    ${resource_url}    ${request_body}=    Publish Service Api
    ...    ${register_user_info_provider}
    ${service_api_id_1}=    Set Variable    ${service_api_description_published['apiId']}

    # Register INVOKER
    ${register_user_info_invoker}    ${url}    ${request_body}=    Invoker Default Onboarding
@@ -310,14 +307,14 @@ Invoker subscribe to Service API Update

    # Subscribe to events
    ${events_list}=    Create List    SERVICE_API_UPDATE
    ${aef_ids}=    Create List    ${register_user_info_provider['aef_id']}
    ${event_filter}=    Create Capif Event Filter    aefIds=${aef_ids}
    ${api_ids}=    Create List    ${service_api_id_1}
    ${event_filter}=    Create Capif Event Filter    apiIds=${api_ids}
    ${event_filters}=    Create List    ${event_filter}

    ${request_body}=    Create Events Subscription
    ...    events=@{events_list}
    ...    notification_destination=${NOTIFICATION_DESTINATION_URL}/testing
    # ...    event_filters=${event_filters}
    ...    event_filters=${event_filters}
    ...    supported_features=4
    ${resp}=    Post Request Capif
    ...    /capif-events/v1/${register_user_info_invoker['api_invoker_id']}/subscriptions
@@ -378,7 +375,7 @@ Provider subscribe to API Invoker events
    ${subscriber_id}    ${subscription_id}=    Check Event Location Header    ${resp}

    # Register INVOKER
    ${register_user_info_invoker}    ${url}    ${request_body}=    Invoker Default Onboarding
    ${register_user_info_invoker}    ${invoker_url}    ${request_body}=    Invoker Default Onboarding

    # Update Invoker onboarded information
    ${new_notification_destination}=    Set Variable
@@ -387,7 +384,7 @@ Provider subscribe to API Invoker events
    ...    ${request_body}
    ...    notificationDestination=${new_notification_destination}
    ${resp}=    Put Request Capif
    ...    ${url.path}
    ...    ${invoker_url.path}
    ...    ${request_body}
    ...    server=${CAPIF_HTTPS_URL}
    ...    verify=ca.crt
@@ -399,21 +396,24 @@ Provider subscribe to API Invoker events

    # Remove Invoker from CCF
    ${resp}=    Delete Request Capif
    ...    ${url.path}
    ...    ${invoker_url.path}
    ...    server=${CAPIF_HTTPS_URL}
    ...    verify=ca.crt
    ...    username=${INVOKER_USERNAME}

    Call Method    ${CAPIF_USERS}    remove_capif_users_entry    ${url.path}
    Call Method    ${CAPIF_USERS}    remove_capif_users_entry    ${invoker_url.path}

    # Check Remove
    Should Be Equal As Strings    ${resp.status_code}    204

    # Check Event Notifications
    ## Create check Events to ensure all notifications were received
    ${invoker_urls}=    Create List    ${invoker_url}
    ${events_expected}=    Create Expected Api Invoker Events
    ...    ${subscription_id}
    ...    ${register_user_info_invoker['api_invoker_id']}
    ...    api_invoker_onboarded_resources=${invoker_urls}
    ...    api_invoker_updated_resources=${invoker_urls}
    ...    api_invoker_offboarded_resources=${invoker_urls}
    ## Check Events Expected towards received notifications at mock server
    Wait Until Keyword Succeeds    5x    5s    Check Mock Server Notification Events    ${events_expected}

@@ -710,14 +710,9 @@ Invoker receives Service API Invocation events without Enhanced Event Report

    # Subscribe to events
    ${events_list}=    Create List    SERVICE_API_INVOCATION_SUCCESS    SERVICE_API_INVOCATION_FAILURE
    ${aef_ids}=    Create List    ${register_user_info['aef_id']}
    ${event_filter}=    Create Capif Event Filter    aefIds=${aef_ids}
    ${event_filters}=    Create List    ${event_filter}

    ${request_body}=    Create Events Subscription
    ...    events=@{events_list}
    ...    notification_destination=${NOTIFICATION_DESTINATION_URL}/testing
    # ...    event_filters=${event_filters}
    ...    supported_features=0
    ${resp}=    Post Request Capif
    ...    /capif-events/v1/${register_user_info_invoker['api_invoker_id']}/subscriptions
@@ -784,14 +779,9 @@ Invoker subscribe to Service API Available and Unavailable events without Enhanc

    # Subscribe to events
    ${events_list}=    Create List    SERVICE_API_AVAILABLE    SERVICE_API_UNAVAILABLE
    ${aef_ids}=    Create List    ${register_user_info_provider['aef_id']}
    ${event_filter}=    Create Capif Event Filter    aefIds=${aef_ids}
    ${event_filters}=    Create List    ${event_filter}

    ${request_body}=    Create Events Subscription
    ...    events=@{events_list}
    ...    notification_destination=${NOTIFICATION_DESTINATION_URL}/testing
    # ...    event_filters=${event_filters}
    ...    supported_features=0
    ${resp}=    Post Request Capif
    ...    /capif-events/v1/${register_user_info_invoker['api_invoker_id']}/subscriptions
@@ -856,14 +846,9 @@ Invoker subscribe to Service API Update without Enhanced Event Report

    # Subscribe to events
    ${events_list}=    Create List    SERVICE_API_UPDATE
    ${aef_ids}=    Create List    ${register_user_info_provider['aef_id']}
    ${event_filter}=    Create Capif Event Filter    aefIds=${aef_ids}
    ${event_filters}=    Create List    ${event_filter}

    ${request_body}=    Create Events Subscription
    ...    events=@{events_list}
    ...    notification_destination=${NOTIFICATION_DESTINATION_URL}/testing
    # ...    event_filters=${event_filters}
    ...    supported_features=0
    ${resp}=    Post Request Capif
    ...    /capif-events/v1/${register_user_info_invoker['api_invoker_id']}/subscriptions
@@ -925,7 +910,7 @@ Provider subscribe to API Invoker events without Enhanced Event Report
    ${subscriber_id}    ${subscription_id}=    Check Event Location Header    ${resp}

    # Register INVOKER
    ${register_user_info_invoker}    ${url}    ${request_body}=    Invoker Default Onboarding
    ${register_user_info_invoker}    ${invoker_url}    ${request_body}=    Invoker Default Onboarding

    # Update Invoker onboarded information
    ${new_notification_destination}=    Set Variable
@@ -934,7 +919,7 @@ Provider subscribe to API Invoker events without Enhanced Event Report
    ...    ${request_body}
    ...    notificationDestination=${new_notification_destination}
    ${resp}=    Put Request Capif
    ...    ${url.path}
    ...    ${invoker_url.path}
    ...    ${request_body}
    ...    server=${CAPIF_HTTPS_URL}
    ...    verify=ca.crt
@@ -946,21 +931,24 @@ Provider subscribe to API Invoker events without Enhanced Event Report

    # Remove Invoker from CCF
    ${resp}=    Delete Request Capif
    ...    ${url.path}
    ...    ${invoker_url.path}
    ...    server=${CAPIF_HTTPS_URL}
    ...    verify=ca.crt
    ...    username=${INVOKER_USERNAME}

    Call Method    ${CAPIF_USERS}    remove_capif_users_entry    ${url.path}
    Call Method    ${CAPIF_USERS}    remove_capif_users_entry    ${invoker_url.path}

    # Check Remove
    Should Be Equal As Strings    ${resp.status_code}    204

    # Check Event Notifications
    ## Create check Events to ensure all notifications were received
    ${invoker_urls}=    Create List    ${invoker_url}
    ${events_expected}=    Create Expected Api Invoker Events
    ...    ${subscription_id}
    ...    ${register_user_info_invoker['api_invoker_id']}
    ...    api_invoker_onboarded_resources=${invoker_urls}
    ...    api_invoker_updated_resources=${invoker_urls}
    ...    api_invoker_offboarded_resources=${invoker_urls}
    ...    event_detail_expected=${FALSE}
    ## Check Events Expected towards received notifications at mock server
    Wait Until Keyword Succeeds    5x    5s    Check Mock Server Notification Events    ${events_expected}
+2 −0
Original line number Diff line number Diff line
*** Settings ***
Force Tags    event_filter
 No newline at end of file
+1031 −0

File added.

Preview size limit exceeded, changes collapsed.

Loading