Commit bfeb58a2 authored by JorgeEcheva26's avatar JorgeEcheva26
Browse files

Netapp provider demo and reference to a netapp flow

parent 7808f649
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -76,6 +76,10 @@ To leverage the OpenCAPIF SDK, it must have a registered user in the target CAPI

The NetApp Developer Path guides the programmer through building and integrating NetApps using CAPIF. This path is divided into two key sections: [Invoker NetApp](#invoker-netapp-1) and Provider NetApp. Each section covers the essential flow and functions for developing NetApps interaction with CAPIF, whether the user is 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.

Here is a good illustration about how a usual flow of a Netapp should work

[EXAMPLE](https://ocf.etsi.org/documentation/latest/testing/postman/)

## Invoker NetApp

Here is a code sample of the implementation of this hole [Invoker-Netapp](./netapp-samples/netapp-invoker-sample/netapp-invoker.py) sample.
+5 −5
Original line number Diff line number Diff line
@@ -16,7 +16,7 @@
    "capif_username": "echeva_0",
    "capif_password": "echevapass",
    "apfs": "1",
    "aefs": "2",
    "aefs": "3",
    "debug_mode": "False",
    "discover_filter": {
        "api-name": "",
@@ -35,11 +35,11 @@
    },
    "publish_req": {
        "service_api_id": "",
        "publisher_apf_id": "APFaa098af4b4a6b14e5a9b680997b5ee",
        "publisher_apf_id": "",
        "publisher_aefs_ids": [
            "AEF16f834e826860ad9314351e40bed14",
            "AEFddf104340beca13b136050754c8324"
            "",
            ""
        ]
    },
    "api_description_path": "./netapp-provider-api-spec.json"
    "api_description_path": "./nef-upf-partner-1.json"
}
 No newline at end of file
+138 −0
Original line number Diff line number Diff line
{
    "apiName": "6G-resilience",
    "aefProfiles": [
        {
            "aefId": "AEFc7416f23179329845f26ffdf895627",
            "versions": [
                {
                    "apiVersion": "6G_Resilience_v1",
                    "expiry": "2100-11-30T10:32:02.004Z",
                    "resources": [
                        {
                            "resourceName": "RESILIENCE_MANAGEMENT",
                            "commType": "SUBSCRIBE_NOTIFY",
                            "uri": "/resilience",
                            "custOpName": "http_post",
                            "operations": [
                                "GET",
                                "POST"
                            ],
                            "description": "Endpoint to manage resilience functionalities in 6G networks"
                        },
                        {
                            "resourceName": "RESILIENCE_SINGLE",
                            "commType": "SUBSCRIBE_NOTIFY",
                            "uri": "/resilience/{profileId}",
                            "custOpName": "http_get",
                            "operations": [
                                "GET",
                                "PUT",
                                "DELETE"
                            ],
                            "description": "Endpoint to manage a single resilience profile"
                        }
                    ],
                    "custOperations": [
                        {
                            "commType": "REQUEST_RESPONSE",
                            "custOpName": "string",
                            "operations": [
                                "POST"
                            ],
                            "description": "Custom operation for managing 6G resilience parameters"
                        }
                    ]
                }
            ],
            "protocol": "HTTP_1_1",
            "dataFormat": "JSON",
            "securityMethods": [
                "Oauth"
            ],
            "interfaceDescriptions": [
                {
                    "ipv4Addr": "127.0.0.1",
                    "port": 8899,
                    "securityMethods": [
                        "Oauth"
                    ]
                }
            ]
        },
        {
            "aefId": "AEFd8fcb1de1f053d282f3107672ac30b",
            "versions": [
                {
                    "apiVersion": "6G_Resilience_v1",
                    "expiry": "2100-11-30T10:32:02.004Z",
                    "resources": [
                        {
                            "resourceName": "SLICE_RESILIENCE",
                            "commType": "SUBSCRIBE_NOTIFY",
                            "uri": "/slice/resilience",
                            "custOpName": "http_post",
                            "operations": [
                                "GET",
                                "POST"
                            ],
                            "description": "Endpoint for managing resilience in network slices"
                        },
                        {
                            "resourceName": "SLICE_SINGLE_RESILIENCE",
                            "commType": "SUBSCRIBE_NOTIFY",
                            "uri": "/slice/{sliceId}/resilience",
                            "custOpName": "http_get",
                            "operations": [
                                "GET",
                                "PUT",
                                "DELETE"
                            ],
                            "description": "Endpoint for managing a single slice's resilience"
                        }
                    ],
                    "custOperations": [
                        {
                            "commType": "REQUEST_RESPONSE",
                            "custOpName": "string",
                            "operations": [
                                "POST"
                            ],
                            "description": "Custom operation for configuring resilience in network slices"
                        }
                    ]
                }
            ],
            "protocol": "HTTP_1_1",
            "dataFormat": "JSON",
            "securityMethods": [
                "Oauth",
                "PSK"
            ],
            "interfaceDescriptions": [
                {
                    "ipv4Addr": "127.0.0.1",
                    "port": 8877,
                    "securityMethods": [
                        "Oauth"
                    ]
                }
            ]
        }
    ],
    "description": "API of dummy netapp to test",
    "supportedFeatures": "fffff",
    "shareableInfo": {
        "isShareable": true,
        "capifProvDoms": [
            "string"
        ]
    },
    "serviceAPICategory": "string",
    "apiSuppFeats": "fffff",
    "pubApiPath": {
        "ccfIds": [
            "string"
        ]
    },
    "ccfId": "string"
}
 No newline at end of file
+78 −19
Original line number Diff line number Diff line
{
    "apiName": "Sample-API-2",
    "apiName": "5G-NetApp-API",
    "aefProfiles": [
        {
            "aefId": "AEF16f834e826860ad9314351e40bed14",
            "aefId": "AEFc7416f23179329845f26ffdf895627",
            "versions": [
                {
                    "apiVersion": "v1",
                    "apiVersion": "QoS_v1",
                    "expiry": "2100-11-30T10:32:02.004Z",
                    "resources": [
                        {
                            "resourceName": "MONITORING_SUBSCRIPTIONS",
                            "resourceName": "QOS_MANAGEMENT",
                            "commType": "SUBSCRIBE_NOTIFY",
                            "uri": "/{scsAsId}/subscriptions",
                            "uri": "/{scsAsId}/qos",
                            "custOpName": "http_post",
                            "operations": [
                                "GET",
                                "POST"
                            ],
                            "description": "Endpoint to manage monitoring subscriptions"
                            "description": "Endpoint to manage QoS levels for network traffic"
                        },
                        {
                            "resourceName": "MONITORING_SUBSCRIPTION_SINGLE",
                            "resourceName": "QOS_PROFILE_SINGLE",
                            "commType": "SUBSCRIBE_NOTIFY",
                            "uri": "/{scsAsId}/subscriptions/{subscriptionId}",
                            "uri": "/{scsAsId}/qos/{profileId}",
                            "custOpName": "http_get",
                            "operations": [
                                "GET",
                                "PUT",
                                "DELETE"
                            ],
                            "description": "Endpoint to manage single subscription"
                            "description": "Endpoint to manage single QoS profile"
                        }
                    ],
                    "custOperations": [
@@ -39,7 +39,7 @@
                            "operations": [
                                "POST"
                            ],
                            "description": "string"
                            "description": "Custom operation for managing QoS parameters"
                        }
                    ]
                }
@@ -61,10 +61,10 @@
            ]
        },
        {
            "aefId": "AEFddf104340beca13b136050754c8324",
            "aefId": "AEFd8fcb1de1f053d282f3107672ac30b",
            "versions": [
                {
                    "apiVersion": "v1",
                    "apiVersion": "TSN_v1",
                    "expiry": "2100-11-30T10:32:02.004Z",
                    "resources": [
                        {
@@ -115,7 +115,7 @@
                            "operations": [
                                "POST"
                            ],
                            "description": "string"
                            "description": "Custom operation for managing TSN profiles"
                        }
                    ]
                }
@@ -134,6 +134,65 @@
                    ]
                }
            ]
        },
        {
            "aefId": "AEF862b574b97f78ac88d2dfa00c6dc7b",
            "versions": [
                {
                    "apiVersion": "NetworkSlicing_v1",
                    "expiry": "2100-11-30T10:32:02.004Z",
                    "resources": [
                        {
                            "resourceName": "SLICE_MANAGEMENT",
                            "commType": "SUBSCRIBE_NOTIFY",
                            "uri": "/slice",
                            "custOpName": "http_post",
                            "operations": [
                                "GET",
                                "POST"
                            ],
                            "description": "Endpoint for managing network slices"
                        },
                        {
                            "resourceName": "SLICE_SINGLE",
                            "commType": "SUBSCRIBE_NOTIFY",
                            "uri": "/slice/{sliceId}",
                            "custOpName": "http_get",
                            "operations": [
                                "GET",
                                "PUT",
                                "DELETE"
                            ],
                            "description": "Endpoint for managing a single network slice"
                        }
                    ],
                    "custOperations": [
                        {
                            "commType": "REQUEST_RESPONSE",
                            "custOpName": "string",
                            "operations": [
                                "POST"
                            ],
                            "description": "Custom operation for configuring network slices"
                        }
                    ]
                }
            ],
            "protocol": "HTTP_1_1",
            "dataFormat": "JSON",
            "securityMethods": [
                "Oauth",
                "PSK"
            ],
            "interfaceDescriptions": [
                {
                    "ipv4Addr": "127.0.0.1",
                    "port": 8877,
                    "securityMethods": [
                        "Oauth"
                    ]
                }
            ]
        }
    ],
    "description": "API of dummy netapp to test",
+9 −22
Original line number Diff line number Diff line
@@ -17,18 +17,9 @@ if __name__ == "__main__":
        capif_connector.onboard_provider()
        print("PROVIDER ONBOARDING COMPLETED")

        # Retrieve AEFs ids and APFs ids to publish an API
        with open(capif_sdk_config_path, 'r') as file:
            config = json.load(file)
        provider_folder = capif_connector.provider_folder

        provider_folder = config.get('provider_folder')
        username_folder = config.get('capif_username')
        if not provider_folder:
            raise ValueError("'provider_folder' value is not defined in the configuration file.")

        detailspath = os.path.join(provider_folder, username_folder, "capif_provider_details.json")
        if not os.path.exists(detailspath):
            raise FileNotFoundError(f"The file {detailspath} was not found")
        detailspath = os.path.join(provider_folder, "capif_provider_details.json")

        with open(detailspath, 'r') as file:
            details = json.load(file)
@@ -36,20 +27,16 @@ if __name__ == "__main__":
        APF = details.get('APF-1_api_prov_func_id')
        AEF1 = details.get('AEF-1_api_prov_func_id')
        AEF2 = details.get('AEF-2_api_prov_func_id')
        AEF3 = details.get('AEF-3_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'")
        capif_connector.publish_req['publisher_apf_id'] = APF
        capif_connector.publish_req['publisher_aefs_ids'] = [AEF1, AEF2]

        # Update the configuration file
        config['publish_req']['publisher_apf_id'] = APF
        config['publish_req']['publisher_aefs_ids'] = [AEF1, AEF2]
        capif_connector.publish_services()

        with open(capif_sdk_config_path, 'w') as file:
            json.dump(config, file, indent=4)  # Save JSON with formatting
        capif_connector.api_description_path = "./nef-upf-partner-2.json"

        print("Configuration file updated successfully.")
        # Reinitialize the connector with the updated configuration
        capif_connector = CAPIFProviderConnector(config_file=capif_sdk_config_path)
        capif_connector.publish_req['publisher_aefs_ids'] = [AEF1, AEF2, AEF3]

        capif_connector.publish_services()

Loading