Commit 2c9805f6 authored by JorgeEcheva26's avatar JorgeEcheva26
Browse files

Format and documentation

parent 76109c37
Loading
Loading
Loading
Loading
+19 −13
Original line number Diff line number Diff line
@@ -14,12 +14,12 @@ Current version of OpenCAPIF SDK is compatible with following publicly available
# Table of Contents
 1. [NetApp developers](#netapp-developers)
 2. [OpenCAPIF SDK summary](#opencapif-sdk-summary)
 3. [NetApp developer path](#netapp-developer-path)
 4. [OpenCAPIF SDK requirements](./doc/sdk-prerequirements.md)
 5. [OpenCAPIF SDK Installation](./doc/sdk-installation.md)
 6. [OpenCAPIF SDK Configuration](./doc/sdk-configuration.md)
 7. [OpenCAPIF SDK Usage](./doc/sdk-usage.md)
 8. [OpenCAPIF SDK known issues](./doc/sdk-issues.md)
 3. [OpenCAPIF SDK requirements](#opencapif-sdk-requirements)
 4. [NetApp developer path](#netapp-developer-path)
 5. [OpenCAPIF SDK Configuration](./doc/sdk-configuration.md)
 6. [OpenCAPIF SDK Usage](./doc/sdk-usage.md)
 7. [OpenCAPIF SDK known issues](./doc/sdk-issues.md)
 8. [OpenCAPIF SDK Developers](./doc/sdk-installation.md)

# NetApp developers

@@ -63,7 +63,12 @@ NOTE: Above mentioned CAPIF APIs are defined in these 3GPP references:
- [CAPIF Publish API specification](https://github.com/jdegre/5GC_APIs/blob/Rel-18/TS29222_CAPIF_Publish_Service_API.yaml) 
- [CAPIF Security API specification](https://github.com/jdegre/5GC_APIs/blob/Rel-18/TS29222_CAPIF_Security_API.yaml)

### Invoker NetApp
## 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).


## Invoker NetApp
 
A NetApp development running as an Invoker would usually follow this process step by step making use of SDK:

@@ -105,15 +110,15 @@ Then all information for using the available APIs would be at Capif_api_security

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 [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 sample of the implementation of these [functionality](./netapp-samples/netapp-invoker-sample/netapp-invoker.py)
Here is a code sample of the implementation of this hole [functionality](./netapp-samples/netapp-invoker-sample/netapp-invoker.py)

This image highlights Invoker path using SDK code:

![INVOKER_PATH](./doc/images/Flujo%20completo-INVOKER%20PATH.jpg)

### Provider NetApp
## Provider NetApp

A NetApp development running as a Provider would typically follow this process step by step, making use of the SDK:

@@ -132,7 +137,7 @@ A NetApp development running as a Provider would typically follow this process s
    ```

3. **Prepare API details:** \
   Locate the provider API details in the username folder. Choose the APF (Application Programming Function) and AEFs (Application Enabling Functions) identifiers, and fulfill the publish_req structure and the api_description_path:
   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 fulfill 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"/>
@@ -140,13 +145,14 @@ A NetApp development running as a Provider would typically follow this process s
</p>

4. **Publish the services:** \
   Use the publish_services() method to register the APIs with the CAPIF framework:
   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 these [functionality](./netapp-samples/netapp-provider-sample/netapp-provider.py)
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:

+0 −2
Original line number Diff line number Diff line
@@ -2,8 +2,6 @@

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)

+5 −7
Original line number Diff line number Diff line

# OpenCAPIF SDK installation
# OpenCAPIF SDK development environment installation

Before installation it's needed to have completed the [requirements](sdk-prerequirements.md) section.
Before installation it's needed to have completed the [requirements](../README.md) section.

## OpenCAPIF SDK consumer installation

SOON

## OpenCAPIF SDK development environment installation
Follow next steps to perform OpenCAPIF SDK installation:

- For developers installation is mandatory to have already installed:
    - pyenv

1. Create an enviroment with pyenv

```console
+11 −11
Original line number Diff line number Diff line
@@ -28,17 +28,17 @@ CAPIF is designed to use using two different roles:
- [As an Invoker](#as-an-invoker)
    - [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-and-offboard-invoker--scripts-invoker_capif_connector_updatepy-and-invoker_capif_connector_offboardingpy)
    - [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)
    - [Important Information for Invoker](#important-information-for-invoker-consumer)
- [As a Provider](#as-a-provider)
    - [Onboard Provider](#onboard-provider--script-provider_capif_connectorpy)
    - [Publish Services](#publish-services--script-provider_publish_apipy)
    - [Unpublish Services](#unpublish-services--script-provider_unpublish_apipy)
    - [Update Services](#update-services--script-provider_update_apipy)
    - [Get Published Services](#get-published-services--script-provider_get_published_apipy)
    - [Get All Published Services](#get-all-published-services--script-provider_get_all_published_apipy)
    - [Update and Offboard Provider](#update-and-offboard-provider--scripts-provider_capif_connector_updatepy-and-provider_capif_connector_offboardingpy)
- [As a Provider](#as-a-proxvider)
    - [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_provider-and-offboard_provider--provider_capif_connector_updatepy-and-provider_capif_connector_offboardingpy)
    - [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)
    - [Important Information for Provider](#important-information-for-provider-consumer)
- [Other Features](#other-features)
    - [Register and Login](#script-register_and_loginpy)
@@ -81,7 +81,7 @@ In the `invoker_folder`, it will be located several folders with each `capif_use
    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
# As a provider
The common path to follow using CAPIF in order to publish an API is by following this steps:

### onboard_provider() // Script provider_capif_connector.py
+50 −50
Original line number Diff line number Diff line
@@ -11,7 +11,7 @@ logging.basicConfig(
    level=logging.INFO,  # Nivel mínimo de severidad a registrar
    format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',  # Formato del mensaje de log
    handlers=[
        logging.FileHandler("register_logs.log"),  # Registra en un archivo
        logging.FileHandler("logs/register_logs.log"),  # Registra en un archivo
        logging.StreamHandler()  # También muestra en la consola
    ]
)
@@ -48,11 +48,11 @@ def __log_to_capif(variables):
        logger.error(f"Error during login to CAPIF: {e}")
        raise


def de_register_from_capif(admin_token, variables):
    logger.info("Deleting CAPIF user")
    capif_register_url = "https://" + variables["register_host"].strip() + ":" + variables["capif_register_port"] + "/"


    url = capif_register_url + "deleteUser/" + variables["uuid"]

    headers = {
@@ -69,6 +69,7 @@ def de_register_from_capif(admin_token,variables):
    response.raise_for_status()
    logger.info("User deleted")


def __load_config_file(config_file: str):
    """Carga el archivo de configuración."""
    try:
@@ -79,7 +80,6 @@ def __load_config_file(config_file: str):
        return {}



if __name__ == "__main__":
    logger = logging.getLogger("CAPIF Register")
    logger.info("Initializing CAPIF Register")
Loading