# OpenCAPIF SDK configuration

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

- [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 capif-sdk-config.json**

Mandatory fields no matter the target role to be onboarded, either invoker or provider:

- capif_host
- register_host
- capif_https_port
- capif_register_port
- capif_username
- capif_password
- debug_mode

## Netapp invoker

If it is wanted to use SDK as an **Invoker** is mandatory to fill out these fields

- invoker_folder
- capif_callback_url
- csr_information(csr_common_name,csr_country_name...)

OPTIONAL:
- [discover_filter](#2configuration-via-discover_filterjson)

## 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)

- api_description_path 


## **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 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.


## **Configuration of publish_req**

This configuration fields is only mandatory if we want to use the [CAPIF_Publish_Service_API](https://github.com/jdegre/5GC_APIs/blob/Rel-18/TS29222_CAPIF_Publish_Service_API.yaml) 

   - service_api_id: The Api id we want to use Example "02eff6e1b3a8f7c8044a92ee8a30bd"
   - publisher_apf_id: APF id we chose to use Example : "APFa165364a379035d14311deadc04332"
   - publisher_aefs_ids: Array of strings filled out of AEFs ids we want to use Example:        ["AEFfa38f0e855bffb420e4994ecbc8fb9","AEFe8bfa711f4f0c95ba0b382508e6382"]

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 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

- 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 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.

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 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
- capif_password: CAPIF user password
- config_path: Absolute path to the Config_files folder
- uuid: UUID for Deregister 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 Deregister the user.

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