Skip to content
This repository has been archived by the owner on Nov 26, 2024. It is now read-only.

Commit

Permalink
Update Test plan and fix error response in logging service (#81)
Browse files Browse the repository at this point in the history
* Update Test plan and fix error response in logging service

* New type for auditing and logging

* create logging test in robot

* finish logging test in robot

* create auditing test and update nginx config for check role in logging/auditing service

* update redis version to solve redis-py vulnerability rac e condition

* check aefId twice, fix CamelCase, return 404 when no logs, return one InvocationLog

* use __check_aef function, remove unnecessary logs

* Some minor fixes

* update auditing service

* minor fix audit/log and update test audit logging

* update README

---------

Co-authored-by: Jorge Moratinos Salcines <[email protected]>
Co-authored-by: Stavros Charismiadis <[email protected]>
  • Loading branch information
3 people authored Apr 12, 2023
1 parent 82978a6 commit af2d028
Show file tree
Hide file tree
Showing 28 changed files with 1,312 additions and 86 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,14 @@ Changes at Tests:
* Delete automatically the entry in the security info of the security context if the provider that has the aef that published the service is deleted
* Delete automatically the entry in the security info of the security context if the service on which that context was created is deleted

# CAPIF Tool Release 3.1.1

* Minor Fixes in Logging/Auditing Service
* Update redis version

Changes at Tests:
* Add test plan to logging/auditing service
* Add tests to cover logging/auditing test plan



Expand Down
2 changes: 2 additions & 0 deletions docs/test_plan/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ List of Common API Services implemented:
* [Api Discover Service](./api_discover_service/README.md)
* [Api Events Service](./api_events_service/README.md)
* [Api Security Service](./api_security_service/README.md)
* [Api Logging Service](./api_logging_service/README.md)
* [Api Auditing Service](./api_auditing_service/README.md)


[Return To Main]: ../../README.md#test-plan-documentation
244 changes: 244 additions & 0 deletions docs/test_plan/api_auditing_service/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,244 @@
[**[Return To All Test Plans]**]

- [Test Plan for CAPIF Api Auditing Service](#test-plan-for-capif-api-auditing-service)
- [Tests](#tests)
- [Test Case 1: Get a CAPIF Log Entry.](#test-case-1-creates-a-new-individual-capif-log-entry)


# Test Plan for CAPIF Api Auditing Service
At this documentation you will have all information and related files and examples of test plan for this API.

# Tests

## Test Case 1: Get CAPIF Log Entry.
* Test ID: ***capif_api_auditing-1***
* Description:

This test case will check that a CAPIF AMF can get log entry to Logging Service
* Pre-Conditions:

* CAPIF provider is pre-authorised (has valid AMF cert from CAPIF Authority)
* Service exist in CAPIF
* Invoker exist in CAPIF
* Log Entry exist in CAPIF

* Information of Test:

1. Perform [provider onboarding], [invoker onboarding]

2. 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

3. Create Log Entry:
- Send POST to *https://{CAPIF_HOSTNAME}/api-invocation-logs/v1/{aefId}/logs*
- body [log entry request body]
- Use AEF Certificate

4. Get Log:
1. Send GET to *https://{CAPIF_HOSTNAME}/logs/v1/apiInvocationLogs?aef-id={aefId}&api-invoker-id={api-invoker-id}*
2. Use AMF Certificate

* Execution Steps:
1. Register Provider and Invoker CCF
2. Publish Service
3. Create Log Entry
4. Get Log Entry

* Expected Result:

1. Response to Logging Service must accomplish:
1. **200 OK**
2. Response Body must follow **InvocationLog** data structure with:
* aefId
* apiInvokerId
* logs

## Test Case 2: Get CAPIF Log Entry With no Log entry in CAPIF.
* Test ID: ***capif_api_auditing-2***
* Description:

This test case will check that a CAPIF AEF can create log entry to Logging Service
* Pre-Conditions:

* CAPIF provider is pre-authorised (has valid AMF cert from CAPIF Authority)
* Service exist in CAPIF
* Invoker exist in CAPIF


* Information of Test:

1. Perform [provider onboarding], [invoker onboarding]

2. 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

4. Get Log:
1. Send GET to *https://{CAPIF_HOSTNAME}/logs/v1/apiInvocationLogs?aef-id={aefId}&api-invoker-id={api-invoker-id}*
2. Use AMF Certificate

* Execution Steps:
1. Register Provider and Invoker CCF
2. Publish Service
3. Get Log Entry

* Expected Result:

1. Response to Logging Service must accomplish:
1. **404 Not Found**
2. Error Response Body must accomplish with **ProblemDetails** data structure with:
* status 404
* title with message "Not Found Log Entry in CAPIF".
* cause with message "Not Exist Logs with the filters applied".


## Test Case 3: Get CAPIF Log Entry without aef-id and api-invoker-id.
* Test ID: ***capif_api_auditing-3***
* Description:

This test case will check that a CAPIF AEF can create log entry to Logging Service
* Pre-Conditions:

* CAPIF provider is no pre-authorised (has no valid AMF cert from CAPIF Authority)
* Service exist in CAPIF
* Invoker exist in CAPIF
* Log Entry exist in CAPIF

* Information of Test:

1. Perform [provider onboarding], [invoker onboarding]

2. 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

3. Create Log Entry:
- Send POST to *https://{CAPIF_HOSTNAME}/api-invocation-logs/v1/{aefId}/logs*
- body [log entry request body]
- Use AEF Certificate

4. Get Log:
1. Send GET to *https://{CAPIF_HOSTNAME}/logs/v1/apiInvocationLogs
2. Use AMF Certificate

* Execution Steps:
1. Register Provider and Invoker CCF
2. Publish Service
3. Create Log Entry
4. Get Log Entry

* Expected Result:

1. Response to Logging Service must accomplish:
1. **400 Bad Request**
2. Error Response Body must accomplish with **ProblemDetails** data structure with:
* status 400
* title with message "Bad Request"
* detail with message "aef_id and api_invoker_id parameters are mandatory".
* cause with message "Mandatory parameters missing".


## Test Case 4: Get CAPIF Log Entry with filtter api-version.
* Test ID: ***capif_api_auditing-4***
* Description:

This test case will check that a CAPIF AMF can get log entry to Logging Service
* Pre-Conditions:

* CAPIF provider is pre-authorised (has valid AMF cert from CAPIF Authority)
* Service exist in CAPIF
* Invoker exist in CAPIF
* Log Entry exist in CAPIF

* Information of Test:

1. Perform [provider onboarding], [invoker onboarding]

2. 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

3. Create Log Entry:
- Send POST to *https://{CAPIF_HOSTNAME}/api-invocation-logs/v1/{aefId}/logs*
- body [log entry request body]
- Use AEF Certificate

4. Get Log:
1. Send GET to *https://{CAPIF_HOSTNAME}/logs/v1/apiInvocationLogs?aef-id={aefId}&api-invoker-id={api-invoker-id}&api-version={v1}*
2. Use AMF Certificate

* Execution Steps:
1. Register Provider and Invoker CCF
2. Publish Service
3. Create Log Entry
4. Get Log Entry

* Expected Result:

1. Response to Logging Service must accomplish:
1. **200 OK**
2. Response Body must follow **InvocationLog** data structure with:
* aefId
* apiInvokerId
* logs


## Test Case 5: Get CAPIF Log Entry with filter api-version but not exist in log entry.
* Test ID: ***capif_api_auditing-4***
* Description:

This test case will check that a CAPIF AMF can get log entry to Logging Service
* Pre-Conditions:

* CAPIF provider is pre-authorised (has valid AMF cert from CAPIF Authority)
* Service exist in CAPIF
* Invoker exist in CAPIF
* Log Entry exist in CAPIF

* Information of Test:

1. Perform [provider onboarding], [invoker onboarding]

2. 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

3. Create Log Entry:
- Send POST to *https://{CAPIF_HOSTNAME}/api-invocation-logs/v1/{aefId}/logs*
- body [log entry request body]
- Use AEF Certificate

4. Get Log:
1. Send GET to *https://{CAPIF_HOSTNAME}/logs/v1/apiInvocationLogs?aef-id={aefId}&api-invoker-id={api-invoker-id}&api-version={v58}*
2. Use AMF Certificate

* Execution Steps:
1. Register Provider and Invoker CCF
2. Publish Service
3. Create Log Entry
4. Get Log Entry

* Expected Result:

1. Response to Logging Service must accomplish:
1. **404 Not Found**
2. Error Response Body must accomplish with **ProblemDetails** data structure with:
* status 404
* detail with message "Parameters do not match any log entry"
* cause with message "No logs found".



[log entry request body]: ../api_logging_service/invocation_log.json "Log Request Body"

[invoker onboarding]: ../common_operations/README.md#register-an-invoker "Invoker Onboarding"

[provider onboarding]: ../common_operations/README.md#register-a-provider "Provider Onboarding"

[Return To All Test Plans]: ../README.md
Loading

0 comments on commit af2d028

Please sign in to comment.