Test Plan for CAPIF Api Events Service
At this documentation you will have all information and related files and examples of test plan for this API.
Test Case 1: Creates a new individual CAPIF Event Subscription.
Test ID: capif_api_events-1
Description:
This test case will check that a CAPIF subscriber (Invoker or Publisher) can Subscribe to Events
Pre-Conditions:
- CAPIF subscriber is pre-authorised (has valid InvokerId or apfId from CAPIF Authority)
Execution Steps:
- Register Invoker and Onboard Invoker at CCF
- Subscribe to Events
- Retrieve {subscriberId} and {subscriptionId} from Location Header
Information of Test:
-
Perform Invoker Onboarding
-
Event Subscription:
- Send POST to https://{CAPIF_HOSTNAME}/capif-events/v1/{subscriberId}/subscriptions
- body event subscription request body
- Use Invoker Certificate
Expected Result:
-
Response to Onboard request must accomplish:
- 201 Created
- Response Body must follow APIInvokerEnrolmentDetails data structure with:
- apiInvokerId
- onboardingInformation->apiInvokerCertificate must contain the public key signed.
- Response Header Location must be received with URI to new resource created, following this structure: {apiRoot}/api-invoker-management/{apiVersion}/onboardedInvokers/{onboardingId}
-
Response to Event Subscription must accomplish:
- 201 Created
- The URI of the created resource shall be returned in the "Location" HTTP header, following this structure: {apiRoot}/capif-events/{apiVersion}/{subscriberId}/subscriptions/{subscriptionId}
- Response Body must follow EventSubscription data structure.
-
Event Subscriptions are stored in CAPIF Database
Test Case 2: Creates a new individual CAPIF Event Subscription with Invalid SubscriberId
Test ID: capif_api_events-2
Description:
This test case will check that a CAPIF subscriber (Invoker or Publisher) cannot Subscribe to Events without valid SubcriberId
Pre-Conditions:
- CAPIF subscriber is not pre-authorised (has invalid InvokerId or apfId)
Execution Steps:
- Register Invoker and Onboard Invoker at CCF
- Subscribe to Events
Information of Test:
-
Perform Invoker Onboarding
-
Event Subscription:
- Send POST to https://{CAPIF_HOSTNAME}/capif-events/v1/{SUBSCRIBER_NOT_REGISTERED}/subscriptions
- body event subscription request body
- Use Invoker Certificate
Expected Result:
-
Response to Onboard request must accomplish:
- 201 Created
- Response Body must follow APIInvokerEnrolmentDetails data structure with:
- apiInvokerId
- onboardingInformation->apiInvokerCertificate must contain the public key signed.
- Response Header Location must be received with URI to new resource created, following this structure: {apiRoot}/api-invoker-management/{apiVersion}/onboardedInvokers/{onboardingId}
-
Response to Event Subscription must accomplish:
- 404 Not Found
- Error Response Body must accomplish with ProblemDetails data structure with:
- status 404
- title with message "Not Found"
- detail with message "Invoker or APF or AEF or AMF Not found".
- cause with message "Subscriber Not Found".
-
Event Subscriptions are not stored in CAPIF Database
Test Case 3: Deletes an individual CAPIF Event Subscription
Test ID: capif_api_events-3
Description:
This test case will check that a CAPIF subscriber (Invoker or Publisher) can Delete an Event Subscription
Pre-Conditions:
- CAPIF subscriber is pre-authorised (has valid InvokerId or apfId from CAPIF Authority)
Execution Steps:
- Register Invoker and Onboard Invoker at CCF
- Subscribe to Events
- Retrieve {subscriberId} and {subscriptionId} from Location Header
- Remove Event Subscription
Information of Test:
-
Perform Invoker Onboarding
-
Event Subscription:
- Send POST to https://{CAPIF_HOSTNAME}/capif-events/v1/{subscriberId}/subscriptions
- body event subscription request body
- Use Invoker Certificate
-
Remove Event Subscription:
- Send DELETE to https://{CAPIF_HOSTNAME}/capif-events/v1/{subscriberId}/subscriptions
- Use Invoker Certificate
Expected Result:
-
Response to Onboard request must accomplish:
- 201 Created
- Response Body must follow APIInvokerEnrolmentDetails data structure with:
- apiInvokerId
- onboardingInformation->apiInvokerCertificate must contain the public key signed.
- Response Header Location must be received with URI to new resource created, following this structure: {apiRoot}/api-invoker-management/{apiVersion}/onboardedInvokers/{onboardingId}
-
Response to Event Subscription must accomplish:
- 201 Created
- The URI of the created resource shall be returned in the "Location" HTTP header, following this structure: {apiRoot}/capif-events/{apiVersion}/{subscriberId}/subscriptions/{subscriptionId}
- Response Body must follow EventSubscription data structure.
-
Event Subscriptions are stored in CAPIF Database
-
Remove Event Subscription:
- 204 No Content
-
Event Subscription is not present at CAPIF Database.
Test Case 4: Deletes an individual CAPIF Event Subscription with invalid SubscriberId
Test ID: capif_api_events-4
Description:
This test case will check that a CAPIF subscriber (Invoker or Publisher) cannot Delete to Events without valid SubcriberId
Pre-Conditions:
- CAPIF subscriber is pre-authorised (has valid InvokerId or apfId).
- CAPIF subscriber is subscribed to Events.
Execution Steps:
- Register Invoker and Onboard Invoker at CCF
- Subscribe to Events
- Retrieve Location Header with subscriptionId.
- Remove Event Subscribed with not valid Subscriber.
Information of Test:
-
Perform Invoker Onboarding
-
Event Subscription:
- Send POST to https://{CAPIF_HOSTNAME}/capif-events/v1/{subscriberId}/subscriptions
- body event subscription request body
- Use Invoker Certificate
-
Remove Event Subcription with not valid subscriber:
- Send DELETE to https://{CAPIF_HOSTNAME}/capif-events/v1/{SUBSCRIBER_ID_NOT_VALID}/subscriptions/{subcriptionId}
- Use Invoker Certificate
Expected Result:
-
Response to Onboard request must accomplish:
- 201 Created
- Response Body must follow APIInvokerEnrolmentDetails data structure with:
- apiInvokerId
- onboardingInformation->apiInvokerCertificate must contain the public key signed.
- Response Header Location must be received with URI to new resource created, following this structure: {apiRoot}/api-invoker-management/{apiVersion}/onboardedInvokers/{onboardingId}
-
Response to Event Subscription must accomplish:
- 201 Created
- The URI of the created resource shall be returned in the "Location" HTTP header, following this structure: {apiRoot}/capif-events/{apiVersion}/{subscriberId}/subscriptions/{subscriptionId}
- Response Body must follow EventSubscription data structure.
-
Event Subscriptions are stored in CAPIF Database
-
Error Response Body must accomplish with ProblemDetails data structure with:
- status 404
- title with message "Not Found"
- detail with message "Invoker or APF or AEF or AMF Not found".
- cause with message "Subscriber Not Found".
Test Case 5: Deletes an individual CAPIF Event Subscription with invalid SubscriptionId
Test ID: capif_api_events-5
Description:
This test case will check that a CAPIF subscriber (Invoker or Publisher) cannot Delete an Event Subscription without valid SubscriptionId
Pre-Conditions:
- CAPIF subscriber is pre-authorised (has invalid InvokerId or apfId).
- CAPIF subscriber is subscribed to Events.
Execution Steps:
- Register Invoker and Onboard Invoker at CCF
- Subscribe to Events
- Retrieve Location Header with subscriptionId.
- Remove Event Subscribed with not valid Subscriber.
Information of Test:
-
Perform Invoker Onboarding
-
Event Subscription:
- Send POST to https://{CAPIF_HOSTNAME}/capif-events/v1/{subscriberId}/subscriptions
- body event subscription request body
- Use Invoker Certificate
-
Remove Event Subcription with not valid subscriber:
- Send DELETE to to https://{CAPIF_HOSTNAME}/capif-events/v1/{subcriberId}/subscriptions/{SUBSCRIPTION_ID_NOT_VALID}
- Use Invoker Certificate
Expected Result:
-
Response to Onboard request must accomplish:
- 201 Created
- Response Body must follow APIInvokerEnrolmentDetails data structure with:
- apiInvokerId
- onboardingInformation->apiInvokerCertificate must contain the public key signed.
- Response Header Location must be received with URI to new resource created, following this structure: {apiRoot}/api-invoker-management/{apiVersion}/onboardedInvokers/{onboardingId}
-
Response to Event Subscription must accomplish:
- 201 Created
- The URI of the created resource shall be returned in the "Location" HTTP header, following this structure: {apiRoot}/capif-events/{apiVersion}/{subscriberId}/subscriptions/{subscriptionId}
- Response Body must follow EventSubscription data structure.
-
Event Subscriptions are stored in CAPIF Database
- Remove Event Subscription with not valid subscriber:
- 404 Not Found
- Error Response Body must accomplish with ProblemDetails data structure with:
- status 404
- detail with message "Service API not existing".
- cause with message "Event API subscription id not found".
Test Case 6: Invoker receives Service API Invocation events
Test ID: capif_api_events-6, mockserver
Description:
This test case will check that a CAPIF Invoker subscribed to SERVICE_API_INVOCATION_SUCCESS and SERVICE_API_INVOCATION_FAILURE, receive the notification when AEF Send TO logging service result of invocations to their APIs.
Pre-Conditions:
- CAPIF subscriber is pre-authorised (has valid InvokerId or apfId from CAPIF Authority)
- CAPIF provider is correctly registered and published APIs.
- API Provider had a Service API Published on CAPIF
- Mock Server is up and running to receive requests.
- Mock Server is clean.
Execution Steps:
- Register provider and publish one API at CCF
- Register Invoker and Onboard Invoker at CCF
- Discover published APIs and extract apiIds and apiNames
- Subscribe to SERVICE_API_INVOCATION_SUCCESS and SERVICE_API_INVOCATION_FAILURE event filtering by aefId.
- Retrieve {subscriberId} and {subscriptionId} from Location Header
- Emulate Success and Failure on API invocation of provider by Invoker, using Invocation Logs API.
Information of Test:
- Perform provider registration
-
Publish Service API at CCF:
- Send POST to ccf_publish_url https://{CAPIF_HOSTNAME}/published-apis/v1/{apfId}/service-apis
- body [service api description] with apiName service_1
- Store serviceApiId
- Use APF Certificate
-
Perform invoker onboarding
-
Discover published APIs:
- Get Api Ids And Api Names from response.
-
Event Subscription to SERVICE_API_INVOCATION_SUCCESS and SERVICE_API_INVOCATION_FAILURE of provider previously registered:
- Send POST to https://{CAPIF_HOSTNAME}/capif-events/v1/{subscriberId}/subscriptions
- body event subscription request body with:
- events: ['SERVICE_API_INVOCATION_SUCCESS','SERVICE_API_INVOCATION_FAILURE']
- eventFilter: only receive events from provider's aefId.
- Use Invoker Certificate
-
Create Log Entry emulating provider receive Success and Failure api invocation from invoker:
- Send POST to https://{CAPIF_HOSTNAME}/api-invocation-logs/v1/{aefId}/logs
- body log entry request body with:
- aefId from provider published.
- apiInvokerId from invoker onboarded.
- apiId of published API
- apiName of published API
- 200 and 400 results in two logs.
- Use AEF Certificate
Expected Result:
- Response to Event Subscription must accomplish:
- 201 Created
- The URI of the created resource shall be returned in the "Location" HTTP header, following this structure: {apiRoot}/capif-events/{apiVersion}/{subscriberId}/subscriptions/{subscriptionId}
- Response Body must follow EventSubscription data structure.
- Response to creation of log entry on CCF must accomplish:
- 201 Created
- The URI of the created resource shall be returned in the "Location" HTTP header, following this structure: {apiRoot}/api-invocation-logs/{apiVersion}/{aefId}/subscriptions/{logId}
- Mock Server received messages must accomplish:
- Two Events have been received.
- Validate received events follow EventNotification data structure, with invocationLog in eventDetail parameter.
- One should be SERVICE_API_INVOCATION_SUCCESS related with 200 result at Log.
- The other one must be SERVICE_API_INVOCATION_FAILURE related with 400 result at Log.
Test Case 7: Invoker subscribe to Service API Available and Unavailable events
Test ID: capif_api_events-7, mockserver
Description:
This test case will check that a CAPIF Invoker subscribed to SERVICE_API_AVAILABLE and SERVICE_API_UNAVAILABLE, receive the notification when AEF publish and remove it.
Pre-Conditions:
- CAPIF subscriber is pre-authorised (has valid InvokerId or apfId from CAPIF Authority)
- CAPIF provider is correctly registered and published APIs.
- Mock Server is up and running to receive requests.
- Mock Server is clean.
Execution Steps:
- Register provider and publish one API at CCF
- Register Invoker and Onboard Invoker at CCF
- Discover published APIs and extract apiIds and apiNames
- Subscribe to SERVICE_API_AVAILABLE and SERVICE_API_UNAVAILABLE event filtering by aefId.
- Retrieve {subscriberId} and {subscriptionId} from Location Header
- Provider publish new API.
- Provider remove published API.
Information of Test:
- Perform provider registration
-
Publish Service API at CCF:
- Send POST to ccf_publish_url https://{CAPIF_HOSTNAME}/published-apis/v1/{apfId}/service-apis
- body [service api description] with apiName service_1
- Store serviceApiId
- Use APF Certificate
-
Perform invoker onboarding
-
Discover published APIs:
- Get Api Ids And Api Names from response.
-
Event Subscription to SERVICE_API_AVAILABLE and SERVICE_API_UNAVAILABLE of provider previously registered:
- Send POST to https://{CAPIF_HOSTNAME}/capif-events/v1/{subscriberId}/subscriptions
- body event subscription request body with:
- events: ['SERVICE_API_AVAILABLE','SERVICE_API_UNAVAILABLE']
- eventFilter: only receive events from provider's aefId.
- Use Invoker Certificate
-
Publish new Service API at CCF:
- Send POST to ccf_publish_url https://{CAPIF_HOSTNAME}/published-apis/v1/{apfId}/service-apis
- body [service api description] with apiName service_2
- Store serviceApiId
- Use APF Certificate
-
Remove published Service API at CCF:
- Send DELETE to resource URL https://{CAPIF_HOSTNAME}/published-apis/v1/{apfId}/service-apis/{SERVICE_API_ID}
- Use APF Certificate
Expected Result:
-
Response to Event Subscription must accomplish:
- 201 Created
- The URI of the created resource shall be returned in the "Location" HTTP header, following this structure: {apiRoot}/capif-events/{apiVersion}/{subscriberId}/subscriptions/{subscriptionId}
- Response Body must follow EventSubscription data structure.
-
Mock Server received messages must accomplish:
- Two Events have been received.
- Validate received events follow EventNotification data structure, with apiIds in eventDetail parameter.
- One should be SERVICE_API_AVAILABLE apiId of service_2 published API.
- The other one must be SERVICE_API_UNAVAILABLE apiId of service_1 published API.
Test Case 8: Invoker subscribe to Service API Update
Test ID: capif_api_events-8, mockserver
Description:
This test case will check that a CAPIF Invoker subscribed to SERVICE_API_UPDATE, receive the notification when AEF Update some information on API Published.
Pre-Conditions:
- CAPIF subscriber is pre-authorised (has valid InvokerId or apfId from CAPIF Authority)
- CAPIF provider is correctly registered and published APIs.
- API Provider had a Service API Published on CAPIF
- Mock Server is up and running to receive requests.
- Mock Server is clean.
Execution Steps:
- Register Provider and publish one API at CCF
- Register Invoker and Onboard Invoker at CCF
- Discover published APIs and extract apiIds and apiNames
- Subscribe to SERVICE_API_UPDATE event filtering by aefId.
- Retrieve {subscriberId} and {subscriptionId} from Location Header at event subscription
- Provider update information of Service API Published.
Information of Test:
- Check and Clean Mock Server
- Perform provider registration
-
Publish Service API at CCF:
- Send POST to ccf_publish_url https://{CAPIF_HOSTNAME}/published-apis/v1/{apfId}/service-apis
- body [service api description] with apiName service_1
- Use APF Certificate
- Store serviceApiId
-
Perform invoker onboarding
-
Discover published APIs:
- Get Api Ids And Api Names from response.
-
Event Subscription to SERVICE_API_UPDATE of provider previously registered:
- Send POST to https://{CAPIF_HOSTNAME}/capif-events/v1/{subscriberId}/subscriptions
- body event subscription request body with:
- events: ['SERVICE_API_UPDATE']
- eventFilter: only receive events from provider's aefId.
- Use Invoker Certificate
-
Update published API at CCF:
- Send PUT to resource URL https://{CAPIF_HOSTNAME}/published-apis/v1/{apfId}/service-apis/{serivceApiId}
- body [service api description] with overrided apiName to service_1_modified**
- Use APF Certificate
Expected Result:
- Response to Event Subscription must accomplish:
- 201 Created
- The URI of the created resource shall be returned in the "Location" HTTP header, following this structure: {apiRoot}/capif-events/{apiVersion}/{subscriberId}/subscriptions/{subscriptionId}
- Response Body must follow EventSubscription data structure.
- Response to Update Published Service API:
- 200 OK
- Response Body must follow ServiceAPIDescription data structure with:
- apiName service_1_modified**
- Mock Server received messages must accomplish:
- One Event has been received.
- Validate received events follow EventNotification data structure, with serviceAPIDescriptions in eventDetail parameter.
- Event should be SERVICE_API_UPDATE with eventDetail with modified apiName.
Test Case 9: Provider subscribe to API Invoker events
Test ID: capif_api_events-9, mockserver
Description:
This test case will check that a CAPIF Provider subscribed to API Invoker events (API_INVOKER_ONBOARDED, API_INVOKER_UPDATED and API_INVOKER_OFFBOARDED), receive the notifications when Invoker is onboarded, updated and removed respectively.
Pre-Conditions:
- CAPIF subscriber is pre-authorised (has valid InvokerId or apfId from CAPIF Authority)
- CAPIF provider is correctly registered.
- Mock Server is up and running to receive requests.
- Mock Server is clean.
Execution Steps:
- Register Provider at CCF
- Subscribe Provider to API_INVOKER_ONBOARDED, API_INVOKER_UPDATED and API_INVOKER_OFFBOARDED events.
- Register Invoker and Onboard Invoker at CCF
- Update Onboarding Information at CCF with a minor change on "notificationDestination"
- Offboard Invoker
Information of Test:
- Check and Clean Mock Server
- Perform provider registration
- Event Subscription to API_INVOKER_ONBOARDED, API_INVOKER_UPDATED and API_INVOKER_OFFBOARDED events:
- Send POST to https://{CAPIF_HOSTNAME}/capif-events/v1/{subscriberId}/subscriptions
- body event subscription request body with:
- events: ['API_INVOKER_ONBOARDED', 'API_INVOKER_UPDATED', 'API_INVOKER_OFFBOARDED']
- Use Provider AMF Certificate
- Perform invoker onboarding
- Update information of previously onboarded Invoker:
- Send PUT to https://{CAPIF_HOSTNAME}/api-invoker-management/v1/onboardedInvokers/{onboardingId}
- Reference Request Body is: [put invoker onboarding body]
- "notificationDestination": "http://host.docker.internal:8086/netapp_new_callback",
- Offboard:
- Send DELETE to https://{CAPIF_HOSTNAME}/api-invoker-management/v1/onboardedInvokers/{onboardingId}
Expected Result:
- Response to Event Subscription must accomplish:
- 201 Created
- The URI of the created resource shall be returned in the "Location" HTTP header, following this structure: {apiRoot}/capif-events/{apiVersion}/{subscriberId}/subscriptions/{subscriptionId}
- Response Body must follow EventSubscription data structure.
- Response to Onboard request must accomplish:
- 201 Created
- Response Body must follow APIInvokerEnrolmentDetails data structure with:
- apiInvokerId
- onboardingInformation->apiInvokerCertificate must contain the public key signed.
- Response Header Location must be received with URI to new resource created, following this structure: {apiRoot}/api-invoker-management/{apiVersion}/onboardedInvokers/{onboardingId}
- Response to Update Request (PUT) with minor change must contain:
- 200 OK response.
- notificationDestination on response must contain the new value
- Response to Offboard Request (DELETE) must contain:
- 204 No Content
- Mock Server received messages must accomplish:
- Three Events have been received.
- Validate received events follow EventNotification data structure, with apiInvokerIds in eventDetail parameter.
- One Event should be API_INVOKER_ONBOARDED with eventDetail with modified apiInvokerId.
- One Event should be API_INVOKER_UPDATED with eventDetail with modified apiInvokerId.
- One Event should be API_INVOKER_OFFBOARDED with eventDetail with modified apiInvokerId.
Test Case 10: Provider subscribed to ACL update event
Test ID: capif_api_events-10, mockserver
Description:
This test case will check that a CAPIF Provider subscribed to ACCESS_CONTROL_POLICY_UPDATE receive a notification when ACL Changes.
Pre-Conditions:
- CAPIF subscriber is pre-authorised (has valid InvokerId or apfId from CAPIF Authority)
- CAPIF provider is correctly registered.
- API Provider had one Service API Published on CAPIF
- API Invoker had a Security Context for the Service API published by provider.
- Mock Server is up and running to receive requests.
- Mock Server is clean.
Execution Steps:
- Register Provider at CCF.
- Publish a provider API with name service_1.
- Register Invoker and Onboard Invoker at CCF.
- Subscribe Provider to ACCESS_CONTROL_POLICY_UPDATE event.
- Discover APIs filtered by aef_id
- Create Security Context for Invoker.
- Provider Retrieve ACL
Information of Test:
- Check and Clean Mock Server
- Perform provider registration
- Perform invoker onboarding
- Event Subscription to ACCESS_CONTROL_POLICY_UPDATE event:
- Send POST to https://{CAPIF_HOSTNAME}/capif-events/v1/{subscriberId}/subscriptions
- body event subscription request body with:
- events: ['ACCESS_CONTROL_POLICY_UPDATE']
- eventFilters: apiInvokerIds array with apiInvokerId of invoker
- Use Provider AMF Certificate
- Discover published APIs
- Create Security Context for Invoker
- Send PUT https://{CAPIF_HOSTNAME}/trustedInvokers/{apiInvokerId}
- body service security body
- Use Invoker Certificate
- Provider Retrieve ACL
- Send GET https://{CAPIF_HOSTNAME}/access-control-policy/v1/accessControlPolicyList/${serviceApiId}?aef-id=${aef_id}
- Use serviceApiId and aefId
- Use AEF Provider Certificate
Expected Result:
- Response to Event Subscription must accomplish:
- 201 Created
- The URI of the created resource shall be returned in the "Location" HTTP header, following this structure: {apiRoot}/capif-events/{apiVersion}/{subscriberId}/subscriptions/{subscriptionId}
- Response Body must follow EventSubscription data structure.
- Create security context:
- 201 Created response.
- body returned must accomplish ServiceSecurity data structure.
- Location Header must contain the new resource URL {apiRoot}/capif-security/v1/trustedInvokers/{apiInvokerId}
- ACL Response:
- 200 OK Response.
- body returned must accomplish AccessControlPolicyList data structure.
- apiInvokerPolicies must:
- contain only one object.
- apiInvokerId must match apiInvokerId registered previously.
- Mock Server received messages must accomplish:
- One Event has been received.
- Validate received event follow EventNotification data structure, with accCtrlPolListExt in eventDetail parameter.
- One Event should be ACCESS_CONTROL_POLICY_UPDATE with eventDetail with accCtrlPolListExt including the apiId and apiInvokerPolicies.
Test Case 11: Provider receives an ACL unavailable event when invoker remove Security Context.
Test ID: capif_api_events-11, mockserver
Description:
This test case will check that a CAPIF Invoker subscribed to ACCESS_CONTROL_POLICY_UNAVAILABLE will receive the notification when AEF remove Security Context created previously.
Pre-Conditions:
- CAPIF subscriber is pre-authorised (has valid InvokerId or apfId from CAPIF Authority)
- CAPIF provider is correctly registered.
- API Provider had one Service API Published on CAPIF
- Mock Server is up and running to receive requests.
- Mock Server is clean.
Execution Steps:
- Register Provider at CCF.
- Publish a provider API with name service_1.
- Register Invoker and Onboard Invoker at CCF.
- Subscribe Invoker to ACCESS_CONTROL_POLICY_UNAVAILABLE event.
- Discover APIs filtered by aef_id
- Create Security Context for Invoker.
- Provider Retrieve ACL.
- Remove Security Context for Invoker.
Information of Test:
- Check and Clean Mock Server
- Perform provider registration
- Perform invoker onboarding
- Event Subscription to ACCESS_CONTROL_POLICY_UNAVAILABLE event:
- Send POST to https://{CAPIF_HOSTNAME}/capif-events/v1/{subscriberId}/subscriptions
- body event subscription request body with:
- events: ['ACCESS_CONTROL_POLICY_UNAVAILABLE']
- eventFilters: apiInvokerIds array with apiInvokerId of invoker
- Use Invoker Certificate
- Discover published APIs
- Create Security Context for Invoker
- Send PUT https://{CAPIF_HOSTNAME}/trustedInvokers/{apiInvokerId}
- body service security body
- Use Invoker Certificate
- Provider Retrieve ACL
- Send GET https://{CAPIF_HOSTNAME}/access-control-policy/v1/accessControlPolicyList/${serviceApiId}?aef-id=${aef_id}
- Use serviceApiId and aefId
- Use AEF Provider Certificate
- Delete Security Context of Invoker by Provider:
- Send DELETE https://{CAPIF_HOSTNAME}/trustedInvokers/{apiInvokerId}
- Use AEF Certificate
Expected Result:
- Response to Event Subscription must accomplish:
- 201 Created
- The URI of the created resource shall be returned in the "Location" HTTP header, following this structure: {apiRoot}/capif-events/{apiVersion}/{subscriberId}/subscriptions/{subscriptionId}
- Response Body must follow EventSubscription data structure.
- Create security context:
- 201 Created response.
- body returned must accomplish ServiceSecurity data structure.
- Location Header must contain the new resource URL {apiRoot}/capif-security/v1/trustedInvokers/{apiInvokerId}
- ACL Response:
- 200 OK Response.
- body returned must accomplish AccessControlPolicyList data structure.
- apiInvokerPolicies must:
- contain only one object.
- apiInvokerId must match apiInvokerId registered previously.
- Delete security context:
- 204 No Content response.
- Mock Server received messages must accomplish:
- One Event has been received.
- Validate received event follow EventNotification data structure, without eventDetail parameter.
- One Event should be ACCESS_CONTROL_POLICY_UNAVAILABLE without eventDetail.
Test Case 12: Invoker receives an Invoker Authorization Revoked and ACL unavailable event when Provider revoke Invoker Authorization.
Test ID: capif_api_events-12, mockserver
Description:
This test case will check that a CAPIF Invoker subscribed to API_INVOKER_AUTHORIZATION_REVOKED and ACCESS_CONTROL_POLICY_UNAVAILABLE receive both notification when AEF revoke invoker's authorization.
Pre-Conditions:
- CAPIF subscriber is pre-authorised (has valid InvokerId or apfId from CAPIF Authority)
- CAPIF provider is correctly registered.
- API Provider had one Service API Published on CAPIF
- Mock Server is up and running to receive requests.
- Mock Server is clean.
Execution Steps:
- Register Provider at CCF.
- Publish a provider API with name service_1.
- Register Invoker and Onboard Invoker at CCF.
- Subscribe Invoker to ACCESS_CONTROL_POLICY_UNAVAILABLE and API_INVOKER_AUTHORIZATION_REVOKED events.
- Discover APIs filtered by aef_id
- Create Security Context for Invoker.
- Revoke Authorization by Provider.
Information of Test:
- Check and Clean Mock Server
- Perform provider registration
- Perform invoker onboarding
- Event Subscription to ACCESS_CONTROL_POLICY_UNAVAILABLE and API_INVOKER_AUTHORIZATION_REVOKED event:
- Send POST to https://{CAPIF_HOSTNAME}/capif-events/v1/{subscriberId}/subscriptions
- body event subscription request body with:
- events: ['ACCESS_CONTROL_POLICY_UNAVAILABLE','API_INVOKER_AUTHORIZATION_REVOKED']
- eventFilters: apiInvokerIds array with apiInvokerId of invoker
- Use Invoker Certificate
- Discover published APIs
- Create Security Context for Invoker
- Send PUT https://{CAPIF_HOSTNAME}/trustedInvokers/{apiInvokerId}
- body service security body
- Use Invoker Certificate
- Revoke Authorization by Provider:
- Send POST https://{CAPIF_HOSTNAME}/trustedInvokers/{apiInvokerId}/delete
- body security notification body
- Using AEF Certificate.
Expected Result:
- Response to Event Subscription must accomplish:
- 201 Created
- The URI of the created resource shall be returned in the "Location" HTTP header, following this structure: {apiRoot}/capif-events/{apiVersion}/{subscriberId}/subscriptions/{subscriptionId}
- Response Body must follow EventSubscription data structure.
- Create security context:
- 201 Created response.
- body returned must accomplish ServiceSecurity data structure.
- Location Header must contain the new resource URL {apiRoot}/capif-security/v1/trustedInvokers/{apiInvokerId}
- Revoke Authorization:
- 204 No Content response.
- Mock Server received messages must accomplish:
- Two Events has been received.
- Validate received event follow EventNotification data structure, without eventDetail parameter.
- One Event should be ACCESS_CONTROL_POLICY_UNAVAILABLE without eventDetail.
- One Event should be API_INVOKER_AUTHORIZATION_REVOKED without eventDetail.