From df5d38505840b691b3c4b49684d9b8f254963963 Mon Sep 17 00:00:00 2001 From: JorgeEcheva26 Date: Mon, 30 Sep 2024 13:57:03 +0200 Subject: [PATCH] Passive voice and changes in netapp-role --- doc/sdk-configuration.md | 98 ++++++++++--------- doc/sdk-installation.md | 8 +- doc/sdk-issues.md | 8 +- doc/sdk-usage.md | 20 ++-- .../netapp-invoker-sample/netapp-invoker.py | 4 +- .../netapp-provider-sample/netapp-provider.py | 5 +- 6 files changed, 77 insertions(+), 66 deletions(-) diff --git a/doc/sdk-configuration.md b/doc/sdk-configuration.md index 2201924..5a8c2e1 100644 --- a/doc/sdk-configuration.md +++ b/doc/sdk-configuration.md @@ -2,44 +2,13 @@ Before configuration it's needed to have completed the [requirements](./sdk-prerequirements.md) section and the [installation](./sdk-installation.md) section. -- [Configuration via Config.json](#1-configuration-via-configjson) -- [Configuration via Register.json](#configuration-via-registerjson) +- [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) +- [Configuration via capif-sdk-register.json](#configuration-via-capif-sdk-registerjson) -# **1. Configuration via Config.json** - -This file could also be fulfilled by [environment variables](../samples/enviroment-variables-sample.txt) - -- invoker_folder: The path (relative or absolute) of the folder you want to store your invoker information - -- provider_folder:The path (relative or absolute) of the folder you want to store your provider information - -- capif_host:The domain name of your capif host - -- register_host:The domain name of your register host - -- capif_https_port: The port of your capif host - -- capif_register_port:The port of your register host - -- capif_callback_url:The Url you want to receive CAPIF notifications(This functionality is not currently available) - -- csr fields: Seven information fields for generating your invoker certificate(csr_country_name must be only two letters) - -- capif_username: CAPIF username - -- capif_password: CAPIF password - -- apfs: Number of APF's you want to onboard as a provider Example:5 - -- aefs: Number of AEF's you want to onboard as a provider Example:2 - -- debug_mode: Boolean | If you want to receive logs from SDK Example:True/False - -- [discover_filter](#2configuration-via-discover_filterjson) - -- [publish_req](#3-configuration-via-publishjson) - -- api_description_path : The path to the [ServiceAPIDescription](https://github.com/jdegre/5GC_APIs/blob/Rel-18/TS29222_CAPIF_Publish_Service_API.yaml) json +# **1. Configuration via capif-sdk-config.json** Mandatory fields no matter the target role to be onboarded, either invoker or provider: @@ -51,7 +20,9 @@ Mandatory fields no matter the target role to be onboarded, either invoker or pr - capif_password - debug_mode -If you want to use SDK as an **Invoker** is mandatory to fill out these fields +## Netapp invoker + +If it is wanted to use SDK as an **Invoker** is mandatory to fill out these fields - invoker_folder - capif_callback_url @@ -60,12 +31,14 @@ If you want to use SDK as an **Invoker** is mandatory to fill out these fields OPTIONAL: - [discover_filter](#2configuration-via-discover_filterjson) -If you want to use SDK as a **Provider** is mandatory to fill out these fields +## Netapp provider + +If it is wanted to use SDK as a **Provider** is mandatory to fill out these fields - provider_folder - APFs - AEFs - + Mandatory field for using [CAPIF Publish API specification](https://github.com/jdegre/5GC_APIs/blob/Rel-18/TS29222_CAPIF_Publish_Service_API.yaml) : - [publish_req](#3-configuration-via-publishjson) @@ -76,7 +49,7 @@ Mandatory field for using [CAPIF Publish API specification](https://github.com/j ## **Configuration of discover_filter** 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) -To use this feature it has to be completed `discover_filter` with the parameters you want to be filtered in order to run the Invoker Service Discovery Functionality. +To use this feature it has to be completed `discover_filter` with the parameters it is wanted to be filtered in order to run the Invoker Service Discovery Functionality. To run the Invoker Service Discovery Functionality it has to be onboarded as an Invoker before the CAPIF user. @@ -91,15 +64,48 @@ This configuration fields is only mandatory if we want to use the [CAPIF_Publish For using the Publish Api function or the Update function the api_description_path **must** have been modified with the path to the Publish API that is wanted to share following the standard schema for [ServiceAPIDescription](https://github.com/jdegre/5GC_APIs/blob/Rel-18/TS29222_CAPIF_Publish_Service_API.yaml) -**AefIds fields won't need to fill out the from aefProfiles** array because you would already be configuring this fields by completing publisherAEFsids parameter +**AefIds fields won't need to fill out the from aefProfiles** array because it would already be configuring this fields by completing publisherAEFsids parameter + +**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 + +This file could also be fulfilled by [environment variables](../samples/enviroment-variables-sample.txt) + +- invoker_folder: The path (relative or absolute) of the folder it is wanted to store the invoker information(Certifications,keys and important information for using CAPIF) + +- provider_folder:The path (relative or absolute) of the folder it is want to store it is provider information(Certifications,keys and important information for using CAPIF) + +- capif_host:The domain name of the capif host + +- register_host:The domain name of the register host -**If the publisherAEFsids parameter don't match with the aefProfiles in your [Api description](../api-samples/provider_api_description_sample.json) you will receive an error** +- capif_https_port: The port of the capif host +- capif_register_port:The port of the register host +- capif_callback_url:The Url it is wanted to receive CAPIF notifications(This functionality is not currently available) +- csr fields: Seven information fields for generating the invoker certificate(csr_country_name must be only two letters) + +- capif_username: CAPIF username + +- capif_password: CAPIF password + +- apfs: Number of APF's it is wanted to onboard as a provider Example:5 + - The [APF](https://www.3gpp.org/technologies/rnaa) is what connects to the Capif Core Function to publish the service +- aefs: Number of AEF's it is wanted to onboard as a provider Example:2 + - The [AEF](https://www.3gpp.org/technologies/rnaa) is what enables to Invokers to connect to API's + +- debug_mode: Boolean | If it is wanted to receive logs from SDK Example:True/False + +- [discover_filter](#2configuration-via-discover_filterjson) + +- [publish_req](#3-configuration-via-publishjson) +- api_description_path : The path to the [ServiceAPIDescription](https://github.com/jdegre/5GC_APIs/blob/Rel-18/TS29222_CAPIF_Publish_Service_API.yaml) json -# **Configuration via Register.json** +# **Configuration via capif-sdk-register.json** In order to use this SDK in a Local environment and creating and removing users, its mandatory to fulfil this fields. @@ -107,8 +113,8 @@ This Feature is not included in the SDK. [Here](https://labs.etsi.org/rep/ocf/capif/-/tree/REL1?ref_type=heads) is the link to the CAPIF official repository if it's wanted to create the Local environment -- register_host:The domain name of your register host -- capif_register_port: The port of your register host +- register_host:The domain name of the register host +- capif_register_port: The port of the register host - capif_register_username: CAPIF admin username - capif_register_password: CAPIF admin password - capif_username: CAPIF user username diff --git a/doc/sdk-installation.md b/doc/sdk-installation.md index aef29d1..50c46de 100644 --- a/doc/sdk-installation.md +++ b/doc/sdk-installation.md @@ -14,8 +14,8 @@ Follow next steps to perform OpenCAPIF SDK installation: #Commands to install the Python environment pyenv install 3.12 pyenv virtualenv 3.12 pesp_sdk_env -#Activate your environment -source your/path/to/.pyenv/versions/pesp_sdk_env/bin/activate +#Activate the environment +source the/path/to/.pyenv/versions/pesp_sdk_env/bin/activate ``` OPTIONAL step: sometimes Apple Mac shells raise issues while finding the shell path. If this happens, try this command: @@ -55,7 +55,7 @@ git clone -b sdk_v0.1 --single-branch https://github.com/Telefonica/pesp_capif_s ```console #Then move to the pesp_capif_sdk folder -cd /your/path/to/pesp_capif_sdk +cd /the/path/to/pesp_capif_sdk ``` 3. Install the Python requirements listed in requirements.txt file: @@ -68,4 +68,4 @@ python -m pip install --upgrade pip pip install -r requirements.txt ``` -**Congratulations!** You have finalized the installation of OpenCAPIF SDK. \ No newline at end of file +**Congratulations!** The installation of OpenCAPIF SDK has finished. \ No newline at end of file diff --git a/doc/sdk-issues.md b/doc/sdk-issues.md index f9c23a0..6c3a25c 100644 --- a/doc/sdk-issues.md +++ b/doc/sdk-issues.md @@ -1,3 +1,9 @@ # OpenCAPIF SDK known issues -[TO PUT HERE ALL KNOWN ISSUES OR BACKLOG] \ No newline at end of file +1. In the actual version of CAPIF-SDK these features are not currently available: + - [CAPIF Access control policy specification](https://github.com/jdegre/5GC_APIs/blob/Rel-18/TS29222_CAPIF_Access_Control_Policy_API.yaml) + - [CAPIF Auditing API specification](https://github.com/jdegre/5GC_APIs/blob/Rel-18/TS29222_CAPIF_Auditing_API.yaml) + - [CAPIF Events API specification](https://github.com/jdegre/5GC_APIs/blob/Rel-18/TS29222_CAPIF_Events_API.yaml) + - [CAPIF Logging API specification](https://github.com/jdegre/5GC_APIs/blob/Rel-18/TS29222_CAPIF_Logging_API_Invocation_API.yaml) + - [CAPIF Routing info API specification](https://github.com/jdegre/5GC_APIs/blob/Rel-18/TS29222_CAPIF_Routing_Info_API.yaml) + - [Part of CAPIF Security API specification](https://github.com/jdegre/5GC_APIs/blob/Rel-18/TS29222_CAPIF_Security_API.yaml) \ No newline at end of file diff --git a/doc/sdk-usage.md b/doc/sdk-usage.md index 4c3788d..12330e5 100644 --- a/doc/sdk-usage.md +++ b/doc/sdk-usage.md @@ -9,7 +9,7 @@ Before using it, it is required to have fulfilled the [requirements](./sdk-prere This repository includes 2 different modes to test OpenCAPIF SDK: -- **Development usage**: import SDK in your code and start ... Within [nf-sample folder](../netapp-samples/), it is provided a sample application leveraging +- **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 @@ -17,7 +17,7 @@ This repository includes 2 different modes to test OpenCAPIF 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 you didn't fulfil this file, go to the [Configuration Section](./sdk-configuration.md) +**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 @@ -49,13 +49,13 @@ CAPIF is designed to use using two different roles: 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` you have onboarded as a provider. For each folder, you could find: +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 your invoker. It will contain: +- `Capif_api_security_context_details.json`: This file contains the information of the 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. + 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 @@ -96,11 +96,11 @@ The common path to follow using CAPIF in order to publish an API is by following ## 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: +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_.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 already used the get an api or get all apis functionality, It will be available the response to your request. +- `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 diff --git a/netapp-samples/netapp-invoker-sample/netapp-invoker.py b/netapp-samples/netapp-invoker-sample/netapp-invoker.py index 3288a34..63326f9 100644 --- a/netapp-samples/netapp-invoker-sample/netapp-invoker.py +++ b/netapp-samples/netapp-invoker-sample/netapp-invoker.py @@ -6,8 +6,8 @@ script_dir = os.path.dirname(os.path.abspath(__file__)) # Current script direct sdk_path = os.path.join(script_dir, '..', '..', 'sdk') # Go up two levels and point to 'sdk' sys.path.insert(0, sdk_path) from sdk import CAPIFInvokerConnector, ServiceDiscoverer -capif_sdk_config_path = "/Users/dgs/Downloads/capif_sdk/invoker/config.json" -capif_sdk_config_path = "/Users/IDB0128/git_repos/pesp_capif_sdk/netapp-samples/netapp-invoker-sample/capif-sdk-config-sample.json" + +capif_sdk_config_path = "./capif-sdk-config-sample.json" if __name__ == "__main__": diff --git a/netapp-samples/netapp-provider-sample/netapp-provider.py b/netapp-samples/netapp-provider-sample/netapp-provider.py index 25e2cd7..ffc0a8d 100644 --- a/netapp-samples/netapp-provider-sample/netapp-provider.py +++ b/netapp-samples/netapp-provider-sample/netapp-provider.py @@ -1,4 +1,3 @@ -from sdk import CAPIFProviderConnector import sys import os import json @@ -7,8 +6,8 @@ import json script_dir = os.path.dirname(os.path.abspath(__file__)) # Current script directory sdk_path = os.path.join(script_dir, '..', '..', 'sdk') # Go up two levels and point to 'sdk' sys.path.insert(0, sdk_path) +from sdk import CAPIFProviderConnector -# capif_sdk_config_path = "/Users/dgs/Downloads/capif_sdk/invoker/config.json" capif_sdk_config_path = "./capif-sdk-config-sample.json" if __name__ == "__main__": @@ -51,7 +50,7 @@ if __name__ == "__main__": print("Configuration file updated successfully.") # Reinitialize the connector with the updated configuration capif_connector = CAPIFProviderConnector(config_file=capif_sdk_config_path) - + capif_connector.publish_services() except FileNotFoundError as e: -- GitLab