Commit 6683dd1e authored by JorgeEcheva26's avatar JorgeEcheva26
Browse files

Details of Provider and readme of provider

parent 7c8e68db
Loading
Loading
Loading
Loading
+26 −7
Original line number Diff line number Diff line
@@ -49,11 +49,11 @@ OpenCAPIF SDK brings a set of functions to integrate with the 5G Core's function
| /allServiceAPIs (GET)                                 | discover()                                                  | Retrieves a list of all available service APIs.             |
| /trustedInvokers (PUT//POST)                          | discover()                                                  | Registers or updates trusted invokers.                      |
| /securities/{securityId}/token (GET)                  | get_tokens()                                                | Retrieves a security token for a specific `securityId`. This JWT token is used to query the targeted services.      |
| /{apfId}/service-apis(POST)                           | publish_services()                                          | Registers a new service API into the system.                |
| /{apfId}/service-apis/{serviceApiId} (DELETE)         | unpublish_service()                                         | Deletes a service API from the system.                      |
| /{apfId}/service-apis/{serviceApiId} (PUT)            | update_service()                                            | Updates the details of an existing service API.             |
| /{apfId}/service-apis (GET)                           | get_service()                                               | Retrieves the details of a specific service API.            |
| /{apfId}/service-apis/{serviceApiId} (GET)            | get_all_services()                                          | Retrieves a list of all available service APIs.             |
| /{apfId}/service-apis(POST)                           | publish_services()                                          | Registers a new service API into the system for a specific `apfId`                |
| /{apfId}/service-apis/{serviceApiId} (DELETE)         | unpublish_service()                                         | Deletes a service API from the system for a specific `apfId`and `serviceApiId`                      |
| /{apfId}/service-apis/{serviceApiId} (PUT)            | update_service()                                            | Updates the details of an existing service API for a specific `apfId`and `serviceApiId`             |
| /{apfId}/service-apis/{serviceApiId} (GET)                           | get_service()                                               | Retrieves the details of a specific service API for a specific `apfId` and `serviceApiId`           |
| /{apfId}/service-apis (GET)            | get_all_services()                                          | Retrieves a list of all available service APIs for a specific `apfId`            |


NOTE: Above mentioned CAPIF APIs are defined in these 3GPP references:
@@ -67,7 +67,7 @@ NOTE: Above mentioned CAPIF APIs are defined in these 3GPP references:

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


# Netapp developer path
## Invoker NetApp
 
A NetApp development running as an Invoker would usually follow this process step by step making use of SDK:
@@ -118,6 +118,16 @@ This image highlights Invoker path using SDK code:

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

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

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

## Provider NetApp

A NetApp development running as a Provider would typically follow this process step by step, making use of the SDK:
@@ -157,3 +167,12 @@ Here is a sample of the implementation of this hole [functionality](./netapp-sam
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 alread used the get an api or get all apis functionality, It will be available the response to your request.
- `Published-Apis.json` : Constains the currently published APIs with their ApiId
 No newline at end of file
+3 −3
Original line number Diff line number Diff line
@@ -34,9 +34,9 @@
        "service-kpis": ""
    },
    "publish_req" : {
        "service_api_id":"6d3fbdcc138f81b36c7b1595229377",
        "publisher_apf_id":"APFdf22044ce6988b136b253a8c5b26f1",
        "publisher_aefs_ids":["AEF0f66526ff2fd8a1be721ace3506adb","AEF212b55c43b1b16116192043bab9e05"]
        "service_api_id":"80dbdd52ee766d4ad4494264e4289c",
        "publisher_apf_id":"APF73e3458fb483c3c65f2f7e126ec851",
        "publisher_aefs_ids":["AEF07a01ccd74a160c195e69b4f116d66","AEFb5c206b46fc68c192aed6870899ea1"]
    },
    "api_description_path":"/Users/IDB0128/git_repos/pesp_capif_sdk/samples/provider_api_description_sample.json"
}
 No newline at end of file
+48 −32
Original line number Diff line number Diff line
@@ -26,20 +26,20 @@ CAPIF is designed to use using two different roles:


- [As an Invoker](#as-an-invoker)
    - [Important Information for Invoker](#important-information-for-invoker-consumer)
    - [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_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-proxvider)
    - [Important Information for Provider](#important-information-for-provider-consumer)
    - [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)
    - [Update Services](#update_service--script-provider_update_apipy)
    - [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)
    - [Deregister and Login](#script-deregister_and_loginpy)
@@ -47,6 +47,16 @@ CAPIF is designed to use using two different roles:
# As an invoker

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:

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


### onboard_invoker() // Script invoker_capif_connector.py  

@@ -55,34 +65,39 @@ Simplifies the process of onboarding for Invoker users
![Invoker_onboard](./images/Invoker_onboarding.png)

### discover() // Script invoker_service_discover.py
In this functionality it could be used [discover_filter](./sdk-configuration.md) to retrieve only the access of the API's it's wanted to access
In this functionality it could be used [discover_filter](./sdk-configuration.md) to retrieve only the access of the API's it's wanted to query

It is mandatory to have onboarded as a [invoker](#onboard_invoker--script-invoker_capif_connectorpy) before

![Invoker_discover](./images/Invoker_discover.png)

### get_tokens() // Script invoker_service_get_token.py

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

This functionality **requires** to to have onboarded as a [invoker](#onboard_invoker--script-invoker_capif_connectorpy) before and run the [discover](#discover--script-invoker_service_discoverpy) function at least once before.

![Invoker_get_token](./images/invoker_get_token.png)

### update_invoker() and offboard_and_deregister_Invoker() // invoker_capif_connector_update.py and invoker_capif_connector_offboarding.py

For using this features we must have onboard as an invoker previusly.
For using this features we must have [onboarded as an invoker](#onboard_invoker--script-invoker_capif_connectorpy) previusly.

![Invoker_update-offboard](./images/invoker_update-offboard.png)

## 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:
# As a provider
The common path to follow using CAPIF in order to publish an API is by following this steps:

-   `Capif_api_security_context_details.json`: This file contains the information of your invoker. It will contain:
## Important information for Provider consumer

    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.
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_provider_api_description_sample.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 alread used the get an api or get all apis functionality, It will be available the response to your request.
- `Published-Apis.json` : Constains the currently published APIs with their ApiId

# 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

@@ -96,7 +111,9 @@ For using the Publish Service is mandatory to fullfill certain fields of the [Pu

### publish_services() // Script provider_publish_api.py

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

It is mandatory to have [onboarded as a provider](#onboard_provider--script-provider_capif_connectorpy) before 

    Mandatory fields:
    - PublisherAPFid
@@ -106,14 +123,18 @@ For using the Publish Service is mandatory to fullfill certain fields of the [Pu

Simplifies the process of deleting an API

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 

    Mandatory fields:
    - ServiceApiId
    - PublisherAPFid
    - PublisherAEFsids

### update_service(service_api_description_json_full_path) // Script provider_update_api.py
### update_service() // Script provider_update_api.py

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

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

    Mandatory fields:
    - ServiceApiId
@@ -122,7 +143,9 @@ For using the Publish Service is mandatory to fullfill certain fields of the [Pu

### get_service() // Script provider_get_published_api.py

    Simplifies the process of recieving the information of One service published previously
Simplifies the process of recieving 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

    Mandatory fields:
    - ServiceApiId
@@ -130,7 +153,9 @@ For using the Publish Service is mandatory to fullfill certain fields of the [Pu

### get_all_services() // Script provider_get_all_published_api.py

    Simplifies the process of recieving the information of all available services published previously
Simplifies the process of recieving 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

    Mandatory fields:
    - PublisherAPFid
@@ -141,18 +166,9 @@ For using the Publish Service is mandatory to fullfill certain fields of the [Pu

For using this features we must have onboard as a provider previusly.

![Provider_update-offboard](./images/provider_update-offboard.png)

## 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_provider_api_description_sample.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 alread used the get an api or get all apis functionality, It will be available the response to your request.
- `Published-Apis.json` : Constains the currently published APIs with their ApiId

It is mandatory to have onboarded as a [provider](#onboard_provider--script-provider_capif_connectorpy) before

![Provider_update-offboard](./images/provider_update-offboard.png)



+150 −118
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@
    "apiName": "Api-de-prueba-2",
    "aefProfiles": [
        {
      "aefId": "AEF0f66526ff2fd8a1be721ace3506adb",
            "aefId": "AEF07a01ccd74a160c195e69b4f116d66",
            "versions": [
                {
                    "apiVersion": "v1",
@@ -13,7 +13,10 @@
                            "commType": " SUBSCRIBE_NOTIFY",
                            "uri": "/{scsAsId}/subscriptions",
                            "custOpName": "http_post",
              "operations": ["GET", "POST"],
                            "operations": [
                                "GET",
                                "POST"
                            ],
                            "description": "Endpoint to manage monitoring subscriptions"
                        },
                        {
@@ -21,7 +24,11 @@
                            "commType": " SUBSCRIBE_NOTIFY",
                            "uri": "/{scsAsId}/subscriptions/{subscriptionId}",
                            "custOpName": "http_get",
              "operations": ["GET", "PUT", "DELETE"],
                            "operations": [
                                "GET",
                                "PUT",
                                "DELETE"
                            ],
                            "description": "Endpoint to manage single subscription"
                        }
                    ],
@@ -29,7 +36,9 @@
                        {
                            "commType": "REQUEST_RESPONSE",
                            "custOpName": "string",
              "operations": ["POST"],
                            "operations": [
                                "POST"
                            ],
                            "description": "string"
                        }
                    ]
@@ -37,17 +46,22 @@
            ],
            "protocol": "HTTP_1_1",
            "dataFormat": "JSON",
      "securityMethods": ["Oauth", "PSK"],
            "securityMethods": [
                "Oauth",
                "PSK"
            ],
            "interfaceDescriptions": [
                {
                    "ipv4Addr": "127.0.0.1",
                    "port": 8888,
          "securityMethods": ["Oauth"]
                    "securityMethods": [
                        "Oauth"
                    ]
                }
            ]
        },
        {
      "aefId": "AEF212b55c43b1b16116192043bab9e05",
            "aefId": "AEFb5c206b46fc68c192aed6870899ea1",
            "versions": [
                {
                    "apiVersion": "v1",
@@ -58,7 +72,9 @@
                            "commType": " SUBSCRIBE_NOTIFY",
                            "uri": "/profile",
                            "custOpName": "http_get",
              "operations": ["GET"],
                            "operations": [
                                "GET"
                            ],
                            "description": "Endpoint for retrieving the list of available TSN profiles"
                        },
                        {
@@ -66,7 +82,9 @@
                            "commType": " SUBSCRIBE_NOTIFY",
                            "uri": "/profile?name={profileName}",
                            "custOpName": "http_get",
              "operations": ["GET"],
                            "operations": [
                                "GET"
                            ],
                            "description": "Endpoint for retrieving information about a single TSN profile"
                        },
                        {
@@ -74,7 +92,9 @@
                            "commType": " SUBSCRIBE_NOTIFY",
                            "uri": "/apply",
                            "custOpName": "http_post",
              "operations": ["POST"],
                            "operations": [
                                "POST"
                            ],
                            "description": "Endpoint for configuring TSN connection parameters"
                        },
                        {
@@ -82,7 +102,9 @@
                            "commType": " SUBSCRIBE_NOTIFY",
                            "uri": "/clear",
                            "custOpName": "http_post",
              "operations": ["POST"],
                            "operations": [
                                "POST"
                            ],
                            "description": "Endpoint for removing a previous TSN connection configuration"
                        }
                    ],
@@ -90,7 +112,9 @@
                        {
                            "commType": "REQUEST_RESPONSE",
                            "custOpName": "string",
              "operations": ["POST"],
                            "operations": [
                                "POST"
                            ],
                            "description": "string"
                        }
                    ]
@@ -98,12 +122,16 @@
            ],
            "protocol": "HTTP_1_1",
            "dataFormat": "JSON",
      "securityMethods": ["Oauth"],
            "securityMethods": [
                "Oauth"
            ],
            "interfaceDescriptions": [
                {
                    "ipv4Addr": "127.0.0.1",
                    "port": 8899,
          "securityMethods": ["Oauth"]
                    "securityMethods": [
                        "Oauth"
                    ]
                }
            ]
        }
@@ -112,12 +140,16 @@
    "supportedFeatures": "fffff",
    "shareableInfo": {
        "isShareable": true,
    "capifProvDoms": ["string"]
        "capifProvDoms": [
            "string"
        ]
    },
    "serviceAPICategory": "string",
    "apiSuppFeats": "fffff",
    "pubApiPath": {
    "ccfIds": ["string"]
        "ccfIds": [
            "string"
        ]
    },
    "ccfId": "string"
}
 No newline at end of file
+2 −2
Original line number Diff line number Diff line

from sdk import CAPIFInvokerConnector

import sys
import os
import utilities
@@ -8,7 +8,7 @@ import utilities
script_dir = os.path.dirname(os.path.abspath(__file__))  # Directorio actual del script
sdk_path = os.path.join(script_dir, '..', 'sdk')  # Subir un nivel y apuntar a 'sdk'
sys.path.insert(0, sdk_path)

from sdk import CAPIFInvokerConnector

def showcase_capif_connector():
    """
Loading