Skip to content
README.md 11.1 KiB
Newer Older
JorgeEcheva26's avatar
JorgeEcheva26 committed


# OpenCAPIF SDK
JorgeEcheva26's avatar
JorgeEcheva26 committed

Daniel García's avatar
Daniel García committed
![OpenCAPIF icon](./doc/images/OpenCAPIF-icon.jpg)
This repository develop a Python Software Development Kit(SDK) whis focuses on connecting to OpenCAPIF in a simple way, lowering integration complexity and allowing developers to focus on Network Functions (NF) or services development. 
JorgeEcheva26's avatar
JorgeEcheva26 committed

OpentCAPIF SDK provides a set of libraries to enable either CAPIF provider and invoker roles, and other functions to simplify procedures calls towards OpenCAPIF.
JorgeEcheva26's avatar
JorgeEcheva26 committed

Current version of OpenCAPIF SDK is compatible with following publicly available releases:
- OpenCAPIF Release 1.0 [LINK TO OPENCAPIF RELEASE](https://ocf.etsi.org/documentation/v1.0.0-release/)
JorgeEcheva26's avatar
JorgeEcheva26 committed

# Table of Contents

 1. [OpenCAPIF SDK usage](#OpenCAPIF-SDK-usage)
 2. [OpenCAPIF SDK Features](#OpenCAPIF-SDK-Features)
 3. [OpenCAPIF SDK Installation](#OpenCAPIF-SDK-Installation)
 4. [How to use OpenCAPIF SDK](#How-to-use-OpenCAPIF-SDK)
 5. [OpenCAPIF SDK known issues](#OpenCAPIF-SDK-known-issues)
Daniel García's avatar
Daniel García committed
 6. [DEV ENVIRONMENT] (/doc/sdk-dev-env.md)

# 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.
JorgeEcheva26's avatar
JorgeEcheva26 committed

Daniel García's avatar
Daniel García committed
[GENERAL CAPIF USAGE FLOW]

This repository includes 2 different modes to test OpenCAPIF SDK:
- **Manual usage**: use a set of python scripts to test step by step all implemented procedures. All of them are provided at scripts folder,
[IMAGE OF ARCH APP ----> CAPIF WITH SCRIPTS]

- **Development usage**: import SDK in your code and start ... Within nf-sample folder, it is provided a sample application leveraging
[IMAGE OF ARCH APP ----> CAPIF WITH SDK INTEGRATION]

Daniel García's avatar
Daniel García committed
# OpenCAPIF SDK Features
LO QUE HE IMPLEMENTADO DE OPENCAPIF == RELEASE NOTES


# OpenCAPIF SDK scripts

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. 

Additional requests to CAPIF:
- Publisher: addionally a devoloper could retrieve data from ...
    1. 
    2. 

- Events: blah blah

- Explore API directory:


- **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.
JorgeEcheva26's avatar
JorgeEcheva26 committed

Daniel García's avatar
Daniel García committed
[OPENCAPIF SDK CODE STRUCTURE]

Daniel García's avatar
Daniel García committed
![Descripción de la imagen](./doc/images/Flujo%20completo-OPENCAPIF%20ACTUAL.jpg)
JorgeEcheva26's avatar
JorgeEcheva26 committed


## Other features
JorgeEcheva26's avatar
JorgeEcheva26 committed

Apart from the SDK core, there are available different functionalities for development purposes:
JorgeEcheva26's avatar
JorgeEcheva26 committed

- **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.
JorgeEcheva26's avatar
JorgeEcheva26 committed

Daniel García's avatar
Daniel García committed
![Descripción de la imagen](./doc/images/Flujo%20completo-SDK%20ACTUAL%20CON%20REGISTER.jpg)
JorgeEcheva26's avatar
JorgeEcheva26 committed

Daniel García's avatar
Daniel García committed
# How to use OpenCAPIF SDK
JorgeEcheva26's avatar
JorgeEcheva26 committed

Daniel García's avatar
Daniel García committed
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.
JorgeEcheva26's avatar
JorgeEcheva26 committed

Daniel García's avatar
Daniel García committed
2 - Then it is needed to fill out config files depending on the features required to be used from the SDK.
JorgeEcheva26's avatar
JorgeEcheva26 committed

Daniel García's avatar
Daniel García committed
## OpenCAPIF SDK prerequisites
JorgeEcheva26's avatar
JorgeEcheva26 committed

Daniel García's avatar
Daniel García committed
IMPORTANT: 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).
JorgeEcheva26's avatar
JorgeEcheva26 committed

Daniel García's avatar
Daniel García committed
## OpenCAPIF SDK configuration
JorgeEcheva26's avatar
JorgeEcheva26 committed

Daniel García's avatar
Daniel García committed
### 1. Configuration via Config.json
JorgeEcheva26's avatar
JorgeEcheva26 committed

Daniel García's avatar
Daniel García committed
This configuration could also be fullfilled by enviroment variables (EXAMPLE)
JorgeEcheva26's avatar
JorgeEcheva26 committed

Daniel García's avatar
Daniel García committed
Mandatory fields no matter the target role to be onboarded, either invoker or provider:
JorgeEcheva26's avatar
JorgeEcheva26 committed

Daniel García's avatar
Daniel García committed
- capif_host
- register_host
- capif_https_port
- capif_register_port
- capif_username
- capif_password
- debug_mode
JorgeEcheva26's avatar
JorgeEcheva26 committed

Daniel García's avatar
Daniel García committed
If you want to use SDK as an **Invoker** you need to fill out these fields
JorgeEcheva26's avatar
JorgeEcheva26 committed

Daniel García's avatar
Daniel García committed
- invoker_folder
- capif_callback_url
- csr_information(csr_common_name,csr_country_name...)
JorgeEcheva26's avatar
JorgeEcheva26 committed

Daniel García's avatar
Daniel García committed
If you want to use SDK as a **Provider** you need to fill out these fields
JorgeEcheva26's avatar
JorgeEcheva26 committed

Daniel García's avatar
Daniel García committed
- provider_folder
- APFs
- AEFs
JorgeEcheva26's avatar
JorgeEcheva26 committed


JorgeEcheva26's avatar
JorgeEcheva26 committed

    "invoker_folder": String | The path (relative or absolute) of the folder you want to store your invoker information

    "provider_folder": String | The path (relative or absolute) of the folder you want to store your invoker information

    "capif_host": String | The domain name of your capif host

    "register_host": String | The domain name of your register host

    "capif_https_port": Integer | The port of your capif host 

    "capif_register_port": Integer | The port of your register host

    "capif_callback_url": String | The Url you want to recieve CAPIF notifications(This functionality is not currently available) 

    "csr_common_name": String | Information for your invoker certificate 

    "csr_organizational_unit": String | Information for your invoker certificate

    "csr_organization": String | Information for your invoker certificate

    "crs_locality": String | Information for your invoker certificate 

    "csr_state_or_province_name": String |Information for your invoker certificate 

    "csr_country_name": String | Information for your invoker certificate 

    "csr_email_address": String | Information for your invoker certificate

    "capif_username": String | CAPIF username 

    "capif_password": String | CAPIF password 

    "APFs": Integer | Number of APF's you want to onboard as a provider Example:5 

    "AEFs": Integer | Number of AEF's you want to onboard as a provider Example:2

    "debug_mode": Boolean | If you want to recieve logs from SDK-S6G Example:True/False
    
Daniel García's avatar
Daniel García committed
### 2. Configuration of Publish.json
JorgeEcheva26's avatar
JorgeEcheva26 committed

    "serviceApiId": String | The Api id we want to use Example "02eff6e1b3a8f7c8044a92ee8a30bd"
    "publisherAPFid": String | APF id we chose to use Example : "APFa165364a379035d14311deadc04332"
    "publisherAEFsids": Array | Array of strings filled out of AEFs ids we want to use Example: ["AEFfa38f0e855bffb420e4994ecbc8fb9","AEFe8bfa711f4f0c95ba0b382508e6382"]

ServiceApiId is required in:
-  Provider Unpublish Api
-  Provider Update Api
-  Provider Get api

PublisherAPFid is required in:

-  Provider Publish Api
-  Provider Unpublish Api
-  Provider Update Api
-  Provider Get Api
-  Provider Get all Apis

PublisherAEFsids is required in:

-   Provider Publish Api
-   Provider Unpublish Api
-   Provider Update Api

For using the Publish Api function or the Update function you **must** modify the provider_api_description_sample.json with the Publish API that you want to share following the standard schema for [ServiceAPIDescription](https://github.com/jdegre/5GC_APIs/blob/Rel-18/TS29222_CAPIF_Publish_Service_API.yaml)

You won't need to fill out the aefIds fields from aefProfiles array because you would already be configurating this fields by completing publisherAEFsids parameter

If the publisherAEFsids parameter don't match with the aefProfiles you will recieve an error

Daniel García's avatar
Daniel García committed
### Important information for Provider consumer
JorgeEcheva26's avatar
JorgeEcheva26 committed

In the provider_folder, you will find several folders with each capif_username you have onboarded as a provider, for each folder you could find:

- Capif_provider_details.json : Contains all the APFs and AEFs ids you have already onboarded with this capif_username
- CAPIF_provider_api_description_sample.json : If you already published or updated an API, you will find a copy of your last payload.
- Service_received.json : If you already used the get an api or get all apis functionality, you will find the response to your request.
- Published-Apis.json : Constains the currently published APIs with their ApiId

Daniel García's avatar
Daniel García committed
#### Configuration of Discover_filter.json
JorgeEcheva26's avatar
JorgeEcheva26 committed
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 you must complete the file with the parameters you want to be filtered and then run the Invoker Service Discovery Functionality.

To run the Invoker Service Discovery Functionality you must have onboarded as an Invoker before.

Daniel García's avatar
Daniel García committed
### Important information for Invoker consumer
JorgeEcheva26's avatar
JorgeEcheva26 committed

In the `invoker_folder`, you will find 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.

By default, the Service Get Token will get the access token for using all the APIs that are available. So if you want to filter the APIs and reach only the API you want, you must:

1. Complete your `Discover_filter.json` file.
2. Use the Service Discovery Functionality.
3. Use the Service Get Token Functionality.

Daniel García's avatar
Daniel García committed
#### Configuration of Register.json
JorgeEcheva26's avatar
JorgeEcheva26 committed


    "register_host": String | The domain name of your register host
    "capif_register_port": Integer | The port of your register host
    "capif_register_username": String | CAPIF admin username
    "capif_register_password": String | CAPIF admin password
    "capif_username": String | CAPIF user username
    "capif_password": String | CAPIF user password
    "config_path": String | Absolute path to the Config_files folder
    "uuid": String | UUID for Deregistering the user


This file is only used for the Functionalities of :
- Register and login 
- Deregister and login

Each field is obligatory to complete except UUID, which is only obligatory in case of Deregistering the user.

Although this field is not obligatory we recomend to store the UUID parameter recieved by the Register and login functionality in this field.    

# OpenCAPIF SDK known issues

[TO PUT HERE ALL KNOWN ISSUES OR BACKLOG]