diff --git a/doc/images/Invoker_discover.png b/doc/images/Invoker_discover.png index 5a8f06a01756ab1ea663a01f004fa78b0ea0ee3a..a0a2c3f03b0d507451a29357ffe251ad44193f00 100644 Binary files a/doc/images/Invoker_discover.png and b/doc/images/Invoker_discover.png differ diff --git a/doc/images/Invoker_onboarding.png b/doc/images/Invoker_onboarding.png index 630e203111151c7ad545bde0c5df91b192b3ff18..465a0a407d1121d48913b6dd6ed21a33b5a5109f 100644 Binary files a/doc/images/Invoker_onboarding.png and b/doc/images/Invoker_onboarding.png differ diff --git a/doc/images/OpenCAPIF-icon.jpg b/doc/images/OpenCAPIF-icon.jpg deleted file mode 100644 index 8ae5c10e186e12481f1e65f36b69ac722f057775..0000000000000000000000000000000000000000 Binary files a/doc/images/OpenCAPIF-icon.jpg and /dev/null differ diff --git a/doc/images/invoker_get_token.png b/doc/images/invoker_get_token.png index 4d88a9871b55a92dd28e2d03c15d68d76bb40cc6..761304e80aff761712cd189bae7a24e9583b6755 100644 Binary files a/doc/images/invoker_get_token.png and b/doc/images/invoker_get_token.png differ diff --git a/doc/images/invoker_update-offboard.png b/doc/images/invoker_update-offboard.png new file mode 100644 index 0000000000000000000000000000000000000000..1b0e2d7ee08a148b0bb39cfc5f7ad02835808787 Binary files /dev/null and b/doc/images/invoker_update-offboard.png differ diff --git a/doc/images/provider_onboarding.png b/doc/images/provider_onboarding.png index c904ccdddcff0286a776984cb1aef1da6fafd93e..fc746a7a80fdc14cd0ee21719ca742b55404ec79 100644 Binary files a/doc/images/provider_onboarding.png and b/doc/images/provider_onboarding.png differ diff --git a/doc/images/provider_publish.png b/doc/images/provider_publish.png index bb2c3b592ed48b37a44dd2358f66cf6c24da0731..53b8b3367bf87f22b398e7cf06e616bfa294e0b7 100644 Binary files a/doc/images/provider_publish.png and b/doc/images/provider_publish.png differ diff --git a/doc/images/provider_update-offboard.png b/doc/images/provider_update-offboard.png new file mode 100644 index 0000000000000000000000000000000000000000..c75d02eeec6fad923d873ca507441a1e707d9eca Binary files /dev/null and b/doc/images/provider_update-offboard.png differ diff --git a/doc/sdk-configuration.md b/doc/sdk-configuration.md index 08f23610b390005e4b9b607fbb72c29586c05fa5..6857357adf84fc27a0e922a72ee5b2eca5c871dc 100644 --- a/doc/sdk-configuration.md +++ b/doc/sdk-configuration.md @@ -67,14 +67,7 @@ For using the Publish Api function or the Update function the provider_api_descr **If the publisherAEFsids parameter don't match with the aefProfiles you will recieve an error** -### Important information for Provider consumer -In the `provider_folder`, it will be located several folders with each `capif_username` you have 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_provider_api_description_sample.json` : If it's already published or updated an API, It will be available a copy of your last payload. -- `Service_received.json` : If it's alread used the get an api or get all apis functionality, It will be available the response to your request. -- `Published-Apis.json` : Constains the currently published APIs with their ApiId #### **Configuration of Discover_filter.json** This file follows the parameters schema from the GET petition of [Discover Services API](https://github.com/jdegre/5GC_APIs/blob/Rel-18/TS29222_CAPIF_Discover_Service_API.yaml) @@ -83,15 +76,7 @@ To use this feature it has to be completed `Discover_filter.json` with the param To run the Invoker Service Discovery Functionality it has to be onboarded as an Invoker before the CAPIF user. -### Important information for Invoker consumer - -In the `invoker_folder`, it will be located several folders with each `capif_username` you have onboarded as a provider. For each folder, you could find: -- `Capif_api_security_context_details.json`: This file contains the information of your invoker. It will contain: - - 1. Your `api_invoker_id`. - 2. If you have already used the Service Discovery Functionality, you will find all the available APIs with their information. - 3. If you have already used the Service Get Token functionality, you will find your access token for using the APIs you have already discovered. diff --git a/doc/sdk-usage.md b/doc/sdk-usage.md index 49fa47462bff273c3dc7776b4e75fd1bee3f4bda..54fbba2926cfba716739c86855cd48188ea1b81b 100644 --- a/doc/sdk-usage.md +++ b/doc/sdk-usage.md @@ -10,12 +10,25 @@ This repository includes 2 different modes to test OpenCAPIF SDK: - **Development usage**: import SDK in your code and start ... Within nf-sample folder, it is provided a sample application leveraging +1 - First 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, + +2 - Then it is needed to fill out config files depending on the features required to be used from the SDK. + +CAPIF is designed to use using two different roles: + +- [As an invoker](#as-an-invoker) +- [As an provider](#as-an-provider) +- [Other features](#other-features) + # 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: - register_and_onboard_Invoker() // Script invoker_capif_connector.py +Simplifies the process of onboarding for Invoker users +  - discover() // Script invoker_service_discover.py @@ -25,13 +38,33 @@ In this functionality it could be used [Discover_filter.json](./sdk-configuratio - get_tokens() // Script invoker_service_get_token.py +After the Discovery, this functionality simplifies the way of getting created their propperly security context for each of the services and adquiring the access token to use the final APIs +  +- 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 onboard as an invoker previusly. + + + +## Important information for Invoker consumer + +In the `invoker_folder`, it will be located several folders with each `capif_username` you have onboarded as a provider. For each folder, you could find: + +- `Capif_api_security_context_details.json`: This file contains the information of your invoker. It will contain: + + 1. Your `api_invoker_id`. + 2. If you have already used the Service Discovery Functionality, you will find all the available APIs with their information. + 3. If you have already used the Service Get Token functionality, you will find your access token for using the APIs you have already discovered. + # As an provider The common path to follow using CAPIF in order to publish an API is by following this steps: - register_and_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 necesary +  [CAPIF_Publish_Service_API](https://github.com/jdegre/5GC_APIs/blob/Rel-18/TS29222_CAPIF_Publish_Service_API.yaml) @@ -40,12 +73,16 @@ For using the Publish Service is mandatory to fullfill certain fields of the [Pu - publish_services(service_api_description_json_full_path) // 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 + Mandatory fields: - PublisherAPFid - PublisherAEFsids - unpublish_service(service_api_description_json_full_path) // Script provider_unpublish_api.py + Simplifies the process of deleting an API + Mandatory fields: - ServiceApiId - PublisherAPFid @@ -53,6 +90,8 @@ For using the Publish Service is mandatory to fullfill certain fields of the [Pu - update_service(service_api_description_json_full_path) // 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 + Mandatory fields: - ServiceApiId - PublisherAPFid @@ -60,68 +99,52 @@ For using the Publish Service is mandatory to fullfill certain fields of the [Pu - get_service() // Script provider_get_published_api.py + Simplifies the process of recieving the information of One service published previously + Mandatory fields: - ServiceApiId - PublisherAPFid - get_all_services() // Script provider_get_all_published_api.py + Simplifies the process of recieving the information of all available services published previously + Mandatory fields: - PublisherAPFid  -# OpenCAPIF SDK scripts +- update_provider() and offboard_and_deregister_provider() // provider_capif_connector_update.py and provider_capif_connector_offboarding.py -This repository provides manual scripts to validate and demonstrate the integration to OpenCAPIF. Next are listed the behaviour of all of them available at /sctipts folder: -1. -2. -3. -4. +For using this features we must have onboard as a provider previusly. -Additional requests to CAPIF: -- Publisher: addionally a devoloper could retrieve data from ... - 1. - 2. + -- Events: blah blah +## Important information for Provider consumer -- Explore API directory: +In the `provider_folder`, it will be located several folders with each `capif_username` you have 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_provider_api_description_sample.json` : If it's already published or updated an API, It will be available a copy of your last payload. +- `Service_received.json` : If it's alread used the get an api or get all apis functionality, It will be available the response to your request. +- `Published-Apis.json` : Constains the currently published APIs with their ApiId -- **Invoker CAPIF connector**: Simplifies the process of onboarding for Invoker users, -- **Provider CAPIF connector**: Simplifies the process of onboarding for Provider users,also has the capability to register several APF's and AEF's if its necesary, -- **Invoker Service Discovery**: Facilitates making a Discovery request to CAPIF, also stores the API services recieved and has an option to filter them, -- **Invoker Service Get token**: After the Discovery, this functionality simplifies the way of getting created their propperly security context for each of the services and adquiring the access token to use the final APIs, -- **Provider Publish API**: 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, -- **Provider Unpublish API**: Simplifies the process of deleting an API, -- **Provider Update API**: 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, -- **Provider Get API**: Simplifies the process of recieving the information of One service published previously, -- **Provider Get all APIs**: Simplifies the process of recieving the information of all available services published previously, -- **Invoker CAPIF connector offboarding**: Simplifies the process of offboarding for Invoker users, -- **Provider CAPIF connector offboarding**: Simplifies the process of offboarding for Provider users. -[OPENCAPIF SDK CODE STRUCTURE] - -## Other features +# Other features Apart from the SDK core, there are available different functionalities for development purposes: - **Register and login**: Facilitates the logging process for admin users and creates a CAPIF user, - **Deregister and login**: Facilitates the logging process for admin users and eliminates a CAPIF user. - + + -# How to use OpenCAPIF SDK -1 - First 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, -- NOTE provider_exposer_get_sample_api_description_path is mandatory if publish functionalities are required. -2 - Then it is needed to fill out config files depending on the features required to be used from the SDK. diff --git a/scripts/provider_capif_connector_offboarding.py b/scripts/provider_capif_connector_offboarding.py index 93028bb5c1340be154de7a0e1d69747701610d75..96cae3fa469386a337eccfe8b09a31907426f22e 100755 --- a/scripts/provider_capif_connector_offboarding.py +++ b/scripts/provider_capif_connector_offboarding.py @@ -14,7 +14,7 @@ def offboard_capif_nef_connector(): """ """ capif_connector = CAPIFProviderConnector(config_file=utilities.get_config_file()) - capif_connector.offboard_and_deregister_nef() + capif_connector.offboard_and_deregister_provider() print("COMPLETED") if __name__ == "__main__": diff --git a/scripts/provider_capif_connector_update.py b/scripts/provider_capif_connector_update.py new file mode 100644 index 0000000000000000000000000000000000000000..c1ec26e4cfe386299a45e44514ec0f5b819e2492 --- /dev/null +++ b/scripts/provider_capif_connector_update.py @@ -0,0 +1,28 @@ +import sys +import os +import utilities + + + +# Añadir el directorio del SDK al PYTHONPATH usando una ruta relativa +script_dir = os.path.dirname(os.path.abspath(__file__)) # Directorio actual del script +sdk_path = os.path.join(script_dir, '..', 'sdk') # Subir un nivel y apuntar a 'sdk' +sys.path.insert(0, sdk_path) + +from sdk import CAPIFProviderConnector + + +def showcase_capif_nef_connector(): + """ + + """ + capif_connector = CAPIFProviderConnector(config_file=utilities.get_config_file()) + + capif_connector.update_provider() + + + print("COMPLETED") + +if __name__ == "__main__": + #Let's register a NEF to CAPIF. This should happen exactly once + showcase_capif_nef_connector() diff --git a/sdk/sdk.py b/sdk/sdk.py index 3429fd10d43d2272d9193a1b37d2fa557bd7ea6e..e3dc30331c4f27e22257b5defecf7f18c8d172ed 100644 --- a/sdk/sdk.py +++ b/sdk/sdk.py @@ -1310,7 +1310,7 @@ class CAPIFProviderConnector: self.logger.error(f"Unexpected error during service publication: {e}") raise - def offboard_and_deregister_nef(self) -> None: + def offboard_and_deregister_provider(self) -> None: """ Offboards and deregisters the NEF (Network Exposure Function). """