diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000000000000000000000000000000000000..ba00662d298726cbd83893822bfe43cb4b88adf0 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,21 @@ +{ + "cSpell.words": [ + "AEF's", + "aefs", + "APF's", + "apfs", + "CAPIF", + "detailspath", + "libintl", + "localeconv", + "localemodule", + "Offboard", + "offboarding", + "onboarded", + "pesp", + "pyenv", + "textdomain", + "Unpublish", + "virtualenv" + ] +} \ No newline at end of file diff --git a/doc/images/Flujo completo-INVOKER PATH.jpg b/doc/images/Flujo completo-INVOKER PATH.jpg index f931efbdcb537baa5fe6a11a8d0f900c124d122e..6866f19958296a19379bebd2ad7902b04045ebe8 100644 Binary files a/doc/images/Flujo completo-INVOKER PATH.jpg and b/doc/images/Flujo completo-INVOKER PATH.jpg differ diff --git a/doc/images/Flujo completo-OPENCAPIF ACTUAL.jpg b/doc/images/Flujo completo-OPENCAPIF ACTUAL.jpg index 3feecdcb61ce8e888b10fc32f52e602c9037b186..9a610b5143d004809318da06a3d24b0070fe83bb 100644 Binary files a/doc/images/Flujo completo-OPENCAPIF ACTUAL.jpg and b/doc/images/Flujo completo-OPENCAPIF ACTUAL.jpg differ diff --git a/doc/images/Flujo completo-PROVIDER PATH.jpg b/doc/images/Flujo completo-PROVIDER PATH.jpg index a09d3486032dc6cddfdfe79a562cfe6ec932fb99..0071bed417968e52a707b193af0d0d1733e0d30d 100644 Binary files a/doc/images/Flujo completo-PROVIDER PATH.jpg and b/doc/images/Flujo completo-PROVIDER PATH.jpg differ diff --git a/doc/images/Flujo completo-SDK ACTUAL CON REGISTER.jpg b/doc/images/Flujo completo-SDK ACTUAL CON REGISTER.jpg index dd3367e36c8ca739e8a4c931aad47e6f6c1c85ee..6672270064499194267ad1103921e75ee1038166 100644 Binary files a/doc/images/Flujo completo-SDK ACTUAL CON REGISTER.jpg and b/doc/images/Flujo completo-SDK ACTUAL CON REGISTER.jpg differ diff --git a/doc/images/Flujo completo-invoker_discover.jpg b/doc/images/Flujo completo-invoker_discover.jpg new file mode 100644 index 0000000000000000000000000000000000000000..8e39b8754ad8b5f0605c041dc679dd88c6d5e6ca Binary files /dev/null and b/doc/images/Flujo completo-invoker_discover.jpg differ diff --git a/doc/images/Flujo completo-invoker_get_tokens.jpg b/doc/images/Flujo completo-invoker_get_tokens.jpg new file mode 100644 index 0000000000000000000000000000000000000000..994e9f99501c9c451ac8019edef78ee7205edab1 Binary files /dev/null and b/doc/images/Flujo completo-invoker_get_tokens.jpg differ diff --git a/doc/images/Flujo completo-invoker_onboard.jpg b/doc/images/Flujo completo-invoker_onboard.jpg new file mode 100644 index 0000000000000000000000000000000000000000..ffd4a761144549e72a9091be24515dbc8947cd1a Binary files /dev/null and b/doc/images/Flujo completo-invoker_onboard.jpg differ diff --git a/doc/images/Flujo completo-invoker_update_offboard.jpg b/doc/images/Flujo completo-invoker_update_offboard.jpg new file mode 100644 index 0000000000000000000000000000000000000000..dcc3a6d6e8cf3b134a1562d4ed379a1508221f42 Binary files /dev/null and b/doc/images/Flujo completo-invoker_update_offboard.jpg differ diff --git a/doc/images/Flujo completo-provider_onboard.jpg b/doc/images/Flujo completo-provider_onboard.jpg new file mode 100644 index 0000000000000000000000000000000000000000..450e0d5d665d224ce6bd851cd395745eedf8f5a6 Binary files /dev/null and b/doc/images/Flujo completo-provider_onboard.jpg differ diff --git a/doc/images/Flujo completo-provider_publish_functions.jpg b/doc/images/Flujo completo-provider_publish_functions.jpg new file mode 100644 index 0000000000000000000000000000000000000000..135034ea3f250cd34c83a4b110725a5a3e4d6cc1 Binary files /dev/null and b/doc/images/Flujo completo-provider_publish_functions.jpg differ diff --git a/doc/images/Flujo completo-provider_update_offboard.jpg b/doc/images/Flujo completo-provider_update_offboard.jpg new file mode 100644 index 0000000000000000000000000000000000000000..93a7fa5267fe74b396dadb17883b166f72427a5a Binary files /dev/null and b/doc/images/Flujo completo-provider_update_offboard.jpg differ diff --git a/doc/images/Invoker_discover.png b/doc/images/Invoker_discover.png deleted file mode 100644 index 30fc740a976846395b3d5ff06881d2ac92b73643..0000000000000000000000000000000000000000 Binary files a/doc/images/Invoker_discover.png and /dev/null differ diff --git a/doc/images/Invoker_onboarding.png b/doc/images/Invoker_onboarding.png deleted file mode 100644 index 5c38a5799857816e561cb6ef82dc075efe202c73..0000000000000000000000000000000000000000 Binary files a/doc/images/Invoker_onboarding.png and /dev/null differ diff --git a/doc/images/invoker_get_token.png b/doc/images/invoker_get_token.png deleted file mode 100644 index aeeec2b18e72365f0315440a7d555193db4ef02a..0000000000000000000000000000000000000000 Binary files a/doc/images/invoker_get_token.png and /dev/null differ diff --git a/doc/images/invoker_update-offboard.png b/doc/images/invoker_update-offboard.png deleted file mode 100644 index 88ede4604f909e0dbc4692e2cb160c3a40806b2b..0000000000000000000000000000000000000000 Binary files a/doc/images/invoker_update-offboard.png and /dev/null differ diff --git a/doc/images/provider_onboarding.png b/doc/images/provider_onboarding.png deleted file mode 100644 index 19dce210daf484b5359dc8268edd113c995343cc..0000000000000000000000000000000000000000 Binary files a/doc/images/provider_onboarding.png and /dev/null differ diff --git a/doc/images/provider_publish.png b/doc/images/provider_publish.png deleted file mode 100644 index 949f5b5a63440a826c3b5525488a146b4fabb88b..0000000000000000000000000000000000000000 Binary files a/doc/images/provider_publish.png and /dev/null differ diff --git a/doc/images/provider_update-offboard.png b/doc/images/provider_update-offboard.png deleted file mode 100644 index 87830fe5d8a53a9550d086c3ab1ca1d59e2085e1..0000000000000000000000000000000000000000 Binary files a/doc/images/provider_update-offboard.png and /dev/null differ diff --git a/doc/sdk-configuration.md b/doc/sdk-configuration.md index 5a8c2e172a79015e03727f4490b84bc94845fee1..67407ec6e50b4512464af77841ea6a0fd39332e9 100644 --- a/doc/sdk-configuration.md +++ b/doc/sdk-configuration.md @@ -3,9 +3,9 @@ Before configuration it's needed to have completed the [requirements](./sdk-prerequirements.md) section and the [installation](./sdk-installation.md) section. - [Configuration via capif-sdk-config.json](#1-configuration-via-capif-sdk-configjson) - -[As a netapp invoker](#netapp-invoker) - -[As a netapp provider](#netapp-provider) - -[Descriptions of capif-sdk-config fields](#descriptions) + - [As a netapp invoker](#netapp-invoker) + - [As a netapp provider](#netapp-provider) + - [Descriptions of capif-sdk-config fields](#descriptions-of-capif-sdk-config-fields) - [Configuration via capif-sdk-register.json](#configuration-via-capif-sdk-registerjson) # **1. Configuration via capif-sdk-config.json** @@ -68,7 +68,7 @@ For using the Publish Api function or the Update function the api_description_pa **If the publisherAEFsids parameter don't match with the aefProfiles in the [Api description](../api-samples/provider_api_description_sample.json) SDK will raise an error** -# Descriptions +# Descriptions of capif-sdk-config fields This file could also be fulfilled by [environment variables](../samples/enviroment-variables-sample.txt) diff --git a/doc/sdk-usage.md b/doc/sdk-usage.md new file mode 100644 index 0000000000000000000000000000000000000000..9e56871b111cf12bbfd2f9c1767c60c4c550527e --- /dev/null +++ b/doc/sdk-usage.md @@ -0,0 +1,200 @@ +# OpenCAPIF SDK usage + +OpenCAPIF SDK implements this set of features to easily integrate an application with CAPIF NF either manually or integrating SDK library directly within app code. + +Before using it, it is required to have fulfilled the [requirements](./sdk-prerequirements.md) section, the [installation](./sdk-installation.md) section and the selected parts of the [configuration](./sdk-configuration.md) depending on the CAPIF role the NetApp is going to play. + + +![GENERAL CAPIF USAGE FLOW](./images/Flujo%20completo-OPENCAPIF%20ACTUAL.jpg) + +This repository includes 2 different modes to test OpenCAPIF SDK: + +- **Development usage**: import SDK in the code and start ... Within [nf-sample folder](../netapp-samples/), it is provided a sample application leveraging + +- **Manual usage**: use a set of python [scripts](../scripts/) to test step by step all implemented procedures. All of them are provided at scripts folder + + - For Manual usage it is required to complete the utilities file with the absolute paths of target environment in order to complete the configuration of the SDK: + +**NOTE**:register file is not needed for the use of the SDK + +**IMPORTANT**:It is needed to fill out config files depending on the features required to be used from the SDK.Please if it is not fulfilled this file, go to the [Configuration Section](./sdk-configuration.md) + +# Table of contents + +CAPIF is designed to use using two different roles: + + + +- [As an Invoker](#as-an-invoker) + - [Important Information for Invoker](#important-information-for-invoker-consumer) + - [Onboard Invoker](#onboard_invoker--script-invoker_capif_connectorpy) + - [Discover API](#discover--script-invoker_service_discoverpy) + - [Get Tokens](#get_tokens--script-invoker_service_get_tokenpy) + - [Update and Offboard Invoker](#update_invoker-and-offboard_and_deregister_invoker--invoker_capif_connector_updatepy-and-invoker_capif_connector_offboardingpy) +- [As a Provider](#as-a-proxvider) + - [Important Information for Provider](#important-information-for-provider-consumer) + - [Onboard Provider](#onboard_provider--script-provider_capif_connectorpy) + - [Publish Services](#publish_services--script-provider_publish_apipy) + - [Unpublish Services](#unpublish_service--script-provider_unpublish_apipy) + - [Update Services](#update_service--script-provider_update_apipy) + - [Get Published Services](#get_service--script-provider_get_published_apipy) + - [Get All Published Services](#get_all_services--script-provider_get_all_published_apipy) + - [Update and Offboard Provider](#update_provider-and-offboard_provider--provider_capif_connector_updatepy-and-provider_capif_connector_offboardingpy) +- [Other Features](#other-features) + - [Register and Login](#script-register_and_loginpy) + - [Deregister and Login](#script-deregister_and_loginpy) + +# As an invoker + +The common path to follow using CAPIF in order to get an API token of the service it's wanted to use is by following this steps: +## Important information for Invoker consumer + +In the `invoker_folder`, it will be located several folders with each `capif_username` that has onboarded as a provider. For each folder, it could be found: + +- `Capif_api_security_context_details.json`: This file contains the information of the invoker. It will contain: + + 1. The `api_invoker_id`. + 2. If it has already used the Service Discovery Functionality, it will be found all the available APIs with their information. + 3. If it has already used the Service Get Token functionality, it will be found the access token for using the APIs that has already been discovered. + + +### onboard_invoker() // Script invoker_capif_connector.py + +Simplifies the process of onboarding for Invoker users + +![Invoker_onboard](./images/Flujo%20completo-invoker_onboard.jpg) + +### discover() // Script invoker_service_discover.py +In this functionality it could be used [discover_filter](./sdk-configuration.md) to retrieve only the access of the API's it's wanted to query + +It is mandatory to have onboarded as a [invoker](#onboard_invoker--script-invoker_capif_connectorpy) before + +DISCLAIMER: if it's the first time the user runs discover() it will appear a warning alert like this + + WARNING - Received 404 error, redirecting to register security service + + +![Invoker_discover](./images/Flujo%20completo-invoker_discover.jpg) + +### get_tokens() // Script invoker_service_get_token.py + +This functionality simplifies the way of getting created their properly security context for each of the services and acquiring the access token to use the final APIs. + +This functionality **requires** to to have onboarded as a [invoker](#onboard_invoker--script-invoker_capif_connectorpy) before and run the [discover](#discover--script-invoker_service_discoverpy) function at least once before. + +![Invoker_get_token](./images/Flujo%20completo-invoker_get_tokens.jpg) + +### update_invoker() and offboard_and_deregister_Invoker() // invoker_capif_connector_update.py and invoker_capif_connector_offboarding.py + +For using this features we must have [onboarded as an invoker](#onboard_invoker--script-invoker_capif_connectorpy) previously. + +![Invoker_update-offboard](./images/Flujo%20completo-invoker_update_offboard.jpg) + + +# As a provider +The common path to follow using CAPIF in order to publish an API is by following this steps: + +## Important information for Provider consumer + +In the `provider_folder`, it will be located several folders with each `capif_username` that has onboarded as a provider, for each folder it is created by SDK this files: + +- `Capif_provider_details.json` : Contains all the APFs and AEFs ids that have already onboarded with this capif_username +- `CAPIF_<_API_id>.json` : If it's already published or updated an API, It will be available a copy of the last payload. +- `Service_received.json` : If it's already used the get an api or get all apis functionality, It will be available the response to the request. +- `Published-Apis.json` : Contains the currently published APIs with their ApiId + + +### onboard_provider() // Script provider_capif_connector.py + +Simplifies the process of onboarding for Provider users,also has the capability to register several APF's and AEF's if its necessary + +![Provider_onboard](./images/Flujo%20completo-provider_onboard.jpg) + +[CAPIF_Publish_Service_API](https://github.com/jdegre/5GC_APIs/blob/Rel-18/TS29222_CAPIF_Publish_Service_API.yaml) + +For using the Publish Service is mandatory to fulfil certain fields of the [Publish.json](./sdk-configuration.md) file + +### publish_services() // Script provider_publish_api.py + +Simplifies the process of publishing an API. Also has the capability to chose which APF and AEF's will be used to publish the API. + +It is mandatory to have [onboarded as a provider](#onboard_provider--script-provider_capif_connectorpy) before + + Mandatory fields: + - PublisherAPFid + - PublisherAEFsids + +### unpublish_service() // Script provider_unpublish_api.py + +Simplifies the process of deleting an API + +It is mandatory to have onboarded as a [provider](#onboard_provider--script-provider_capif_connectorpy) before and to have [published any service](#publish_services--script-provider_publish_apipy) before + + Mandatory fields: + - ServiceApiId + - PublisherAPFid + - PublisherAEFsids + +### update_service() // Script provider_update_api.py + +Simplifies the process of updating an API. Also has the capability to chose which APF and AEF's will be used to update the API. + +It is mandatory to have onboarded as a [provider](#onboard_provider--script-provider_capif_connectorpy) before and to have [published any service](#publish_services--script-provider_publish_apipy) before + + Mandatory fields: + - ServiceApiId + - PublisherAPFid + - PublisherAEFsids + +### get_service() // Script provider_get_published_api.py + +Simplifies the process of receiving the information of One service published previously in Published-Apis.json + +It is mandatory to have onboarded as a [provider](#onboard_provider--script-provider_capif_connectorpy) before and to have [published any service](#publish_services--script-provider_publish_apipy) before + + Mandatory fields: + - ServiceApiId + - PublisherAPFid + +### get_all_services() // Script provider_get_all_published_api.py + +Simplifies the process of receiving the information of all available services published previously in Published-Apis.json + +It is mandatory to have onboarded as a [provider](#onboard_provider--script-provider_capif_connectorpy) before and to have [published any service](#publish_services--script-provider_publish_apipy) before + + Mandatory fields: + - PublisherAPFid + +![Provider_publish](./images/Flujo%20completo-provider_publish_functions.jpg) + +### update_provider() and offboard_provider() // provider_capif_connector_update.py and provider_capif_connector_offboarding.py + +For using this features we must have onboard as a provider previously. + +It is mandatory to have onboarded as a [provider](#onboard_provider--script-provider_capif_connectorpy) before + +![Provider_update-offboard](./images/Flujo%20completo-provider_update_offboard.jpg) + + + +# Other features + +Apart from the SDK core, there are available different functionalities for development purposes: + +### Script register_and_login.py + +Facilitates the logging process for admin users and creates a CAPIF user, + + +### Script deregister_and_login.py + +Facilitates the logging process for admin users and eliminates a CAPIF user. + +![Register picture](./images/Flujo%20completo-SDK%20ACTUAL%20CON%20REGISTER.jpg) + + + + + + + diff --git a/netapp-samples/netapp-provider-sample/capif-sdk-config-sample.json b/netapp-samples/netapp-provider-sample/capif-sdk-config-sample.json index 14f28cbea7e8931b72d98435e04e130de5e723a7..3e25df13a1c2a0a0e18559e2d440dc66a6145cb2 100644 --- a/netapp-samples/netapp-provider-sample/capif-sdk-config-sample.json +++ b/netapp-samples/netapp-provider-sample/capif-sdk-config-sample.json @@ -35,10 +35,10 @@ }, "publish_req": { "service_api_id": "", - "publisher_apf_id": "APFa21b8720cb9f4625b8cbb182f72912", + "publisher_apf_id": "APFaa098af4b4a6b14e5a9b680997b5ee", "publisher_aefs_ids": [ - "AEFb02a55977008db414efd42dfe51537", - "AEF7245fec7c72bb670a70d907aa29430" + "AEF16f834e826860ad9314351e40bed14", + "AEFddf104340beca13b136050754c8324" ] }, "api_description_path": "./netapp-provider-api-spec.json" diff --git a/netapp-samples/netapp-provider-sample/netapp-provider-api-spec.json b/netapp-samples/netapp-provider-sample/netapp-provider-api-spec.json index c0465d7a6a95985532ce5b467b99d86123a5b5d1..2cb766539f2a9b6d40d8f843ffdadc792bcb9a63 100755 --- a/netapp-samples/netapp-provider-sample/netapp-provider-api-spec.json +++ b/netapp-samples/netapp-provider-sample/netapp-provider-api-spec.json @@ -1,8 +1,8 @@ { - "apiName": "Api-de-prueba-2", + "apiName": "Sample-API-2", "aefProfiles": [ { - "aefId": "AEFb02a55977008db414efd42dfe51537", + "aefId": "AEF16f834e826860ad9314351e40bed14", "versions": [ { "apiVersion": "v1", @@ -61,7 +61,7 @@ ] }, { - "aefId": "AEF7245fec7c72bb670a70d907aa29430", + "aefId": "AEFddf104340beca13b136050754c8324", "versions": [ { "apiVersion": "v1",