Skip to content
Snippets Groups Projects
Commit 1e6fd050 authored by Daniel García's avatar Daniel García
Browse files

Update spelling and some doc intros

parent 0329f488
No related branches found
No related tags found
No related merge requests found
......@@ -65,9 +65,61 @@ NOTE: Above mentioned CAPIF APIs are defined in these 3GPP references:
## OpenCAPIF SDK requirements
In order to leverage OpenCAPIF SDK it is required to have registered a user in the target CAPIF instance, so contact administrator to have required predefined credentials (username and password).
To leverage the OpenCAPIF SDK, you must have a registered user in the target CAPIF instance. **Please contact the administrator to obtain the necessary predefined credentials (username and password).**
# Netapp developer path
The NetApp Developer Path guides you through building and integrating NetApps using CAPIF. This path is divided into two key sections: Invoker NetApp and Provider NetApp. Each section covers the essential flow and functions for developing NetApps interaction with CAPIF, whether you’re acting as an invoker consuming services or a provider offering them. By following this path, developers will gain a comprehensive understanding of how to effectively use the SDK within the CAPIF ecosystem.
## Provider NetApp
A NetApp development running as a Provider would typically follow this process step by step, making use of the SDK:
1. **Create a Provider object:** \
Initialize the provider by creating an instance of the `CAPIFProviderConnector` class, passing the required configuration file:
```python
provider = CAPIFProviderConnector(config_file=utilities.get_config_file())
```
2. **Onboard the Provider:** \
Register the provider with the CAPIF system to enable the publication of APIs:
```python
provider.onboard_provider()
```
3. **Prepare API details:** \
Locate the provider API details in the provider_folder path, more specifically in the username folder. Choose the APF (Application Programming Function) and AEFs (Application Enabling Functions) identifiers, and fulfil the publish_req structure and the api_description_path:
<p align="center">
<img src="./doc/images/capif-provider-details-example.png" alt="example" width="400"/>
<img src="./doc/images/publish_req-example.png" alt="config-example" width="400"/>
</p>
4. **Publish the services:** \
Use the publish_services() method to register the APIs with the CAPIF framework(don't forget to update the CAPIFProviderConnector constructor in order to use the new APF and AEFs):
```python
provider = CAPIFProviderConnector(config_file=utilities.get_config_file())
provider.publish_services()
```
Here is a sample of the implementation of this whole [functionality](./netapp-samples/netapp-provider-sample/netapp-provider.py).
This image highlights Provider path using SDK code:
![PROVIDER_PATH](./doc/images/Flujo%20completo-PROVIDER%20PATH.jpg)
### Important information for Provider consumer
Within the `provider_folder`, the SDK will store some folders named with the provided `capif_username` you have had registered from administrator. At each folder, there will be found the following files:
- `capif_provider_details.json`: contains all the APFs and AEFs ids that have already onboarded with this `capif_username`,
- `CAPIF_<your_api_name><your_API_id>.json`: if it is already published or updated an API, it will contain a copy of the last payload,
- `service_received.json`: if it is already used to get an API or get all APIs functionality, it will contain the response of last request,
- `published-apis.json`: Contains the currently published APIs with their `ApiId`.
## Invoker NetApp
A NetApp development running as an Invoker would usually follow this process step by step making use of SDK:
......@@ -104,21 +156,19 @@ A NetApp development running as an Invoker would usually follow this process ste
service_discoverer.discover()
```
5. **Retrieve security tokens:** \
Use the get_tokens() method to obtain the necessary tokens for authenticating API requests:
```python
invoker.get_tokens()
```
Then all information for using the available APIs would be at Capif_api_security_context_details.json
Then all information for using the available APIs would be at capif_api_security_context_details.json
This file would be placed in the invoker_folder path, more specifically in the folder that corresponds of the capif_username used in the config_file.
Here is a sample of this Capif_api_security_context_details [file](./samples/capif_api_security_context_details-sample.json)
Here is a sample of this capif_api_security_context_details [file](./samples/capif_api_security_context_details-sample.json).
Here is a code sample of the implementation of this hole [functionality](./netapp-samples/netapp-invoker-sample/netapp-invoker.py)
Here is a code sample of the implementation of this whole [functionality](./netapp-samples/netapp-invoker-sample/netapp-invoker.py).
This image highlights Invoker path using SDK code:
......@@ -126,59 +176,11 @@ This image highlights Invoker path using SDK code:
### 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:
Within the `invoker_folder`, the SDK will store some folders named with the provided `capif_username` you have had registered from administrator. At each folder, there will be found the following files:
- `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 target 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.
## Provider NetApp
A NetApp development running as a Provider would typically follow this process step by step, making use of the SDK:
1. **Create a Provider object:** \
Initialize the provider by creating an instance of the `CAPIFProviderConnector` class, passing the required configuration file:
```python
provider = CAPIFProviderConnector(config_file=utilities.get_config_file())
```
2. **Onboard the Provider:** \
Register the provider with the CAPIF system to enable the publication of APIs:
```python
provider.onboard_provider()
```
3. **Prepare API details:** \
Locate the provider API details in the provider_folder path, more specifically in the username folder. Choose the APF (Application Programming Function) and AEFs (Application Enabling Functions) identifiers, and fulfil the publish_req structure and the api_description_path:
<p align="center">
<img src="./doc/images/capif-provider-details-example.png" alt="example" width="400"/>
<img src="./doc/images/publish_req-example.png" alt="config-example" width="400"/>
</p>
4. **Publish the services:** \
Use the publish_services() method to register the APIs with the CAPIF framework(don't forget to update the CAPIFProviderConnector constructor in order to use the new APF and AEFs):
```python
provider = CAPIFProviderConnector(config_file=utilities.get_config_file())
provider.publish_services()
```
Here is a sample of the implementation of this hole [functionality](./netapp-samples/netapp-provider-sample/netapp-provider.py)
This image highlights Provider path using SDK code:
![PROVIDER_PATH](./doc/images/Flujo%20completo-PROVIDER%20PATH.jpg)
### 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_<your_api_name><your_API_id>.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.
- `Published-Apis.json` : Contains the currently published APIs with their ApiId
\ No newline at end of file
......@@ -51,7 +51,7 @@ The common path to follow using CAPIF in order to get an API token of the servic
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:
- `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.
......@@ -73,7 +73,6 @@ DISCLAIMER: if it's the first time the user runs discover() it will appear a war
WARNING - Received 404 error, redirecting to register security service
![Invoker_discover](./images/Invoker_discover.png)
### get_tokens() // Script invoker_service_get_token.py
......@@ -98,10 +97,10 @@ The common path to follow using CAPIF in order to publish an API is by following
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_provider_details.json` : Contains all the APFs and AEFs ids that have already onboarded with this capif_username
- `CAPIF_<api_name><_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
- `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
......@@ -126,7 +125,7 @@ It is mandatory to have [onboarded as a provider](#onboard_provider--script-prov
### unpublish_service() // Script provider_unpublish_api.py
Simplifies the process of deleting an API
Simplifies the process of deleting an API available in CAPIF:
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
......@@ -148,7 +147,7 @@ It is mandatory to have onboarded as a [provider](#onboard_provider--script-prov
### get_service() // Script provider_get_published_api.py
Simplifies the process of receiving the information of One service published previously in Published-Apis.json
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
......@@ -158,7 +157,7 @@ It is mandatory to have onboarded as a [provider](#onboard_provider--script-prov
### 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
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
......
......@@ -38,7 +38,7 @@ if __name__ == "__main__":
AEF2 = details.get('AEF-2_api_prov_func_id')
if not APF or not AEF1 or not AEF2:
raise ValueError("Not all required values were found in 'Capif_provider_details.json'")
raise ValueError("Not all required values were found in 'capif_provider_details.json'")
# Update the configuration file
config['publish_req']['publisher_apf_id'] = APF
......
......@@ -504,7 +504,7 @@ class CAPIFProviderConnector:
outfile.write(capif_response_text)
self.logger.info(f"CAPIF response saved to {output_path}")
output_path = os.path.join(
self.provider_folder, "Published-Apis.json")
self.provider_folder, "published-apis.json")
# Leer el archivo existente de APIs publicados
published_apis = {}
......@@ -604,7 +604,7 @@ class CAPIFProviderConnector:
break
output_path = os.path.join(
self.provider_folder, "Published-Apis.json")
self.provider_folder, "published-apis.json")
# Leer el archivo existente de APIs publicados
published_apis = {}
......@@ -921,7 +921,7 @@ class CAPIFProviderConnector:
outfile.write(capif_response_text)
self.logger.info(f"CAPIF response saved to {output_path}")
output_path = os.path.join(
self.provider_folder, "Published-Apis.json")
self.provider_folder, "published-apis.json")
# Leer el archivo existente de APIs publicados
published_apis = {}
......
......@@ -52,7 +52,7 @@ def ensure_update(Chosen_apf, Chosen_aefs, second_netapp_api):
AEF3 = details.get(Chosen_aefs[2])
if not APF or not AEF1 or not AEF2:
raise ValueError("Not all necessary values were found in 'Capif_provider_details.json'")
raise ValueError("Not all necessary values were found in 'capif_provider_details.json'")
# Update configuration file
config['publish_req']['publisher_apf_id'] = APF
......@@ -83,7 +83,7 @@ def ensure_update(Chosen_apf, Chosen_aefs, second_netapp_api):
AEF2 = details.get('AEF-2_api_prov_func_id')
if not APF or not AEF1 or not AEF2:
raise ValueError("Not all necessary values were found in 'Capif_provider_details.json'")
raise ValueError("Not all necessary values were found in 'capif_provider_details.json'")
# Update configuration file
config['publish_req']['publisher_apf_id'] = APF
......@@ -100,7 +100,7 @@ def ensure_update(Chosen_apf, Chosen_aefs, second_netapp_api):
print("PROVIDER PUBLISH COMPLETED")
PublishedApis = os.path.join(provider_folder, username_folder, "Published-Apis.json")
PublishedApis = os.path.join(provider_folder, username_folder, "published-Apis.json")
if not os.path.exists(PublishedApis):
raise FileNotFoundError(f"File {PublishedApis} not found")
......@@ -164,7 +164,7 @@ if __name__ == "__main__":
AEF2 = details.get('AEF-2_api_prov_func_id')
if not APF or not AEF1 or not AEF2:
raise ValueError("Not all necessary values were found in 'Capif_provider_details.json'")
raise ValueError("Not all necessary values were found in 'capif_provider_details.json'")
# Update configuration file
config['publish_req']['publisher_apf_id'] = APF
......@@ -181,7 +181,7 @@ if __name__ == "__main__":
print("PROVIDER PUBLISH COMPLETED")
PublishedApis = os.path.join(provider_folder, username_folder, "Published-Apis.json")
PublishedApis = os.path.join(provider_folder, username_folder, "published-Apis.json")
if not os.path.exists(PublishedApis):
raise FileNotFoundError(f"File {PublishedApis} not found")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment