From 6badb04d8fffdaeb3c2e64e50f8edc2ab51268db Mon Sep 17 00:00:00 2001 From: JorgeEcheva26 <jorge.echevarriauribarri.practicas@telefonica.es> Date: Fri, 27 Sep 2024 09:42:11 +0200 Subject: [PATCH] refactor --- .../capif-sdk-config-sample.json | 82 +++--- .../netapp-invoker-sample/netapp-invoker.py | 11 +- .../netapp-provider-sample/netapp-provider.py | 18 +- samples/provider_api_description_sample.json | 268 ++++++++---------- scripts/invoker_capif_connector.py | 11 +- .../invoker_capif_connector_offboarding.py | 6 +- scripts/invoker_capif_connector_update.py | 8 +- scripts/invoker_service_discovery.py | 11 +- scripts/invoker_service_get_token.py | 12 +- scripts/provider_capif_connector.py | 8 +- .../provider_capif_connector_offboarding.py | 6 +- scripts/provider_capif_connector_update.py | 8 +- scripts/provider_get_published_api.py | 7 +- scripts/provider_publish_api.py | 7 +- scripts/provider_unpublish_api.py | 7 +- scripts/provider_update_api.py | 7 +- scripts/utilities.py | 7 +- 17 files changed, 222 insertions(+), 262 deletions(-) diff --git a/netapp-samples/netapp-invoker-sample/capif-sdk-config-sample.json b/netapp-samples/netapp-invoker-sample/capif-sdk-config-sample.json index 1da7d1f..d2b1779 100644 --- a/netapp-samples/netapp-invoker-sample/capif-sdk-config-sample.json +++ b/netapp-samples/netapp-invoker-sample/capif-sdk-config-sample.json @@ -1,42 +1,42 @@ { - "invoker_folder": "/Users/IDB0128/Documents/OpenCapif/test_invoker_certificate_folder", - "provider_folder": "/Users/IDB0128/Documents/OpenCapif/test_provider_certificate_folder", - "capif_host": "capif-prev.mobilesandbox.cloud", - "register_host": "registercapif-prev.mobilesandbox.cloud", - "capif_https_port": "36212", - "capif_register_port": "36211", - "capif_callback_url": "http://localhost:5000", - "csr_common_name": "test03", - "csr_organizational_unit": "test_app_ou", - "csr_organization": "test_app_o", - "crs_locality": "Madrid", - "csr_state_or_province_name": "Madrid", - "csr_country_name": "ES", - "csr_email_address": "test@example.com", - "capif_username": "echeva_0", - "capif_password": "echevapass", - "apfs": "1", - "aefs": "2", - "debug_mode": "False", - "discover_filter" : { - "api-name": "", - "api-version": "", - "comm-type": "", - "protocol": "", - "aef-id": "", - "data-format": "", - "api-cat": "", - "preferred-aef-loc": "", - "req-api-prov-name": "", - "supported-features": "", - "api-supported-features": "", - "ue-ip-addr": "", - "service-kpis": "" - }, - "publish_req" : { - "service_api_id":"", - "publisher_apf_id":"", - "publisher_aefs_ids":["",""] - }, - "api_description_path":"/Users/IDB0128/git_repos/pesp_capif_sdk/samples/provider_api_description_sample.json" -} \ No newline at end of file + "invoker_folder": "/Users/IDB0128/Documents/OpenCapif/test_invoker_certificate_folder", + "provider_folder": "/Users/IDB0128/Documents/OpenCapif/test_provider_certificate_folder", + "capif_host": "capif-prev.mobilesandbox.cloud", + "register_host": "registercapif-prev.mobilesandbox.cloud", + "capif_https_port": "36212", + "capif_register_port": "36211", + "capif_callback_url": "http://localhost:5000", + "csr_common_name": "test03", + "csr_organizational_unit": "test_app_ou", + "csr_organization": "test_app_o", + "crs_locality": "Madrid", + "csr_state_or_province_name": "Madrid", + "csr_country_name": "ES", + "csr_email_address": "test@example.com", + "capif_username": "echeva_0", + "capif_password": "echevapass", + "apfs": "1", + "aefs": "2", + "debug_mode": "False", + "discover_filter": { + "api-name": "", + "api-version": "", + "comm-type": "", + "protocol": "", + "aef-id": "", + "data-format": "", + "api-cat": "", + "preferred-aef-loc": "", + "req-api-prov-name": "", + "supported-features": "", + "api-supported-features": "", + "ue-ip-addr": "", + "service-kpis": "" + }, + "publish_req": { + "service_api_id": "", + "publisher_apf_id": "", + "publisher_aefs_ids": ["", ""] + }, + "api_description_path": "/Users/IDB0128/git_repos/pesp_capif_sdk/samples/provider_api_description_sample.json" +} diff --git a/netapp-samples/netapp-invoker-sample/netapp-invoker.py b/netapp-samples/netapp-invoker-sample/netapp-invoker.py index d83f810..54a5e60 100644 --- a/netapp-samples/netapp-invoker-sample/netapp-invoker.py +++ b/netapp-samples/netapp-invoker-sample/netapp-invoker.py @@ -1,15 +1,15 @@ +from sdk import CAPIFInvokerConnector, ServiceDiscoverer import sys import os # Añadir el directorio del SDK al PYTHONPATH usando una ruta relativa script_dir = os.path.dirname(os.path.abspath(__file__)) # Directorio actual del script -sdk_path = os.path.join(script_dir, '..','..', 'sdk') # Subir dos niveles y apuntar a 'sdk' +sdk_path = os.path.join(script_dir, '..', '..', 'sdk') # Subir dos niveles y apuntar a 'sdk' sys.path.insert(0, sdk_path) capif_sdk_config_path = "/Users/dgs/Downloads/capif_sdk/invoker/config.json" capif_sdk_config_path = "/Users/IDB0128/git_repos/pesp_capif_sdk/netapp-samples/netapp-invoker-sample/capif-sdk-config-sample.json" -from sdk import CAPIFInvokerConnector,ServiceDiscoverer if __name__ == "__main__": @@ -18,19 +18,14 @@ if __name__ == "__main__": capif_connector.onboard_invoker() print("INVOKER ONBOARDING COMPLETED") - # Aquà ya tengo certificados, ahora puedo hacer discover (get token para un api o varios, según elijas) # Como developer yo ya sé a qué APIs quiero acceder # DISCOVER filter configureCmcAmfSet # Without DISCOVER filter it is obtained the whole list of available APIs in CAPIF - discoverer=ServiceDiscoverer(config_file=capif_sdk_config_path) + discoverer = ServiceDiscoverer(config_file=capif_sdk_config_path) discoverer.discover() discoverer.get_tokens() - - - - diff --git a/netapp-samples/netapp-provider-sample/netapp-provider.py b/netapp-samples/netapp-provider-sample/netapp-provider.py index f606663..377ba08 100644 --- a/netapp-samples/netapp-provider-sample/netapp-provider.py +++ b/netapp-samples/netapp-provider-sample/netapp-provider.py @@ -1,18 +1,17 @@ +from sdk import CAPIFProviderConnector import sys import os -import json +import json # Añadir el directorio del SDK al PYTHONPATH usando una ruta relativa script_dir = os.path.dirname(os.path.abspath(__file__)) # Directorio actual del script sdk_path = os.path.join(script_dir, '..', '..', 'sdk') # Subir dos niveles y apuntar a 'sdk' sys.path.insert(0, sdk_path) -from sdk import CAPIFProviderConnector +# capif_sdk_config_path = "/Users/dgs/Downloads/capif_sdk/invoker/config.json" -# capif_sdk_config_path = "/Users/dgs/Downloads/capif_sdk/invoker/config.json" - -capif_sdk_config_path = "./capif-sdk-config-sample.json" +capif_sdk_config_path = "./capif-sdk-config-sample.json" if __name__ == "__main__": try: @@ -30,13 +29,10 @@ if __name__ == "__main__": if not provider_folder: raise ValueError("El valor 'provider_folder' no está definido en el archivo de configuración.") - - detailspath = os.path.join(provider_folder,username_folder, "capif_provider_details.json") - - # Comprobación de la existencia del archivo de detalles + detailspath = os.path.join(provider_folder, username_folder, "capif_provider_details.json") if not os.path.exists(detailspath): raise FileNotFoundError(f"No se encontró el archivo {detailspath}") - + with open(detailspath, 'r') as file: details = json.load(file) @@ -50,7 +46,7 @@ if __name__ == "__main__": # Actualización del archivo de configuración config['publish_req']['publisher_apf_id'] = APF config['publish_req']['publisher_aefs_ids'] = [AEF1, AEF2] - + with open(capif_sdk_config_path, 'w') as file: json.dump(config, file, indent=4) # Guarda el JSON con formato diff --git a/samples/provider_api_description_sample.json b/samples/provider_api_description_sample.json index ee16d98..2b0fec3 100755 --- a/samples/provider_api_description_sample.json +++ b/samples/provider_api_description_sample.json @@ -1,155 +1,123 @@ { - "apiName": "Api-de-prueba-2", - "aefProfiles": [ + "apiName": "Api-de-prueba-2", + "aefProfiles": [ + { + "aefId": "AEF0f66526ff2fd8a1be721ace3506adb", + "versions": [ { - "aefId": "AEF0f66526ff2fd8a1be721ace3506adb", - "versions": [ - { - "apiVersion": "v1", - "expiry": "2100-11-30T10:32:02.004Z", - "resources": [ - { - "resourceName": "MONITORING_SUBSCRIPTIONS", - "commType": " SUBSCRIBE_NOTIFY", - "uri": "/{scsAsId}/subscriptions", - "custOpName": "http_post", - "operations": [ - "GET", - "POST" - ], - "description": "Endpoint to manage monitoring subscriptions" - }, - { - "resourceName": "MONITORING_SUBSCRIPTION_SINGLE", - "commType": " SUBSCRIBE_NOTIFY", - "uri": "/{scsAsId}/subscriptions/{subscriptionId}", - "custOpName": "http_get", - "operations": [ - "GET", - "PUT", - "DELETE" - ], - "description": "Endpoint to manage single subscription" - } - ], - "custOperations": [ - { - "commType": "REQUEST_RESPONSE", - "custOpName": "string", - "operations": [ - "POST" - ], - "description": "string" - } - ] - } - ], - "protocol": "HTTP_1_1", - "dataFormat": "JSON", - "securityMethods": [ - "Oauth", - "PSK" - ], - "interfaceDescriptions": [ - { - "ipv4Addr": "127.0.0.1", - "port": 8888, - "securityMethods": [ - "Oauth" - ] - } - ] - }, + "apiVersion": "v1", + "expiry": "2100-11-30T10:32:02.004Z", + "resources": [ + { + "resourceName": "MONITORING_SUBSCRIPTIONS", + "commType": " SUBSCRIBE_NOTIFY", + "uri": "/{scsAsId}/subscriptions", + "custOpName": "http_post", + "operations": ["GET", "POST"], + "description": "Endpoint to manage monitoring subscriptions" + }, + { + "resourceName": "MONITORING_SUBSCRIPTION_SINGLE", + "commType": " SUBSCRIBE_NOTIFY", + "uri": "/{scsAsId}/subscriptions/{subscriptionId}", + "custOpName": "http_get", + "operations": ["GET", "PUT", "DELETE"], + "description": "Endpoint to manage single subscription" + } + ], + "custOperations": [ + { + "commType": "REQUEST_RESPONSE", + "custOpName": "string", + "operations": ["POST"], + "description": "string" + } + ] + } + ], + "protocol": "HTTP_1_1", + "dataFormat": "JSON", + "securityMethods": ["Oauth", "PSK"], + "interfaceDescriptions": [ { - "aefId": "AEF212b55c43b1b16116192043bab9e05", - "versions": [ - { - "apiVersion": "v1", - "expiry": "2100-11-30T10:32:02.004Z", - "resources": [ - { - "resourceName": "TSN_LIST_PROFILES", - "commType": " SUBSCRIBE_NOTIFY", - "uri": "/profile", - "custOpName": "http_get", - "operations": [ - "GET" - ], - "description": "Endpoint for retrieving the list of available TSN profiles" - }, - { - "resourceName": "TSN_DETAIL_PROFILE", - "commType": " SUBSCRIBE_NOTIFY", - "uri": "/profile?name={profileName}", - "custOpName": "http_get", - "operations": [ - "GET" - ], - "description": "Endpoint for retrieving information about a single TSN profile" - }, - { - "resourceName": "TSN_APPLY_CONFIGURATION", - "commType": " SUBSCRIBE_NOTIFY", - "uri": "/apply", - "custOpName": "http_post", - "operations": [ - "POST" - ], - "description": "Endpoint for configuring TSN connection parameters" - }, - { - "resourceName": "TSN_CLEAR_CONFIGURATION", - "commType": " SUBSCRIBE_NOTIFY", - "uri": "/clear", - "custOpName": "http_post", - "operations": [ - "POST" - ], - "description": "Endpoint for removing a previous TSN connection configuration" - } - ], - "custOperations": [ - { - "commType": "REQUEST_RESPONSE", - "custOpName": "string", - "operations": [ - "POST" - ], - "description": "string" - } - ] - } - ], - "protocol": "HTTP_1_1", - "dataFormat": "JSON", - "securityMethods": [ - "Oauth" - ], - "interfaceDescriptions": [ - { - "ipv4Addr": "127.0.0.1", - "port": 8899, - "securityMethods": [ - "Oauth" - ] - } - ] + "ipv4Addr": "127.0.0.1", + "port": 8888, + "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 + { + "aefId": "AEF212b55c43b1b16116192043bab9e05", + "versions": [ + { + "apiVersion": "v1", + "expiry": "2100-11-30T10:32:02.004Z", + "resources": [ + { + "resourceName": "TSN_LIST_PROFILES", + "commType": " SUBSCRIBE_NOTIFY", + "uri": "/profile", + "custOpName": "http_get", + "operations": ["GET"], + "description": "Endpoint for retrieving the list of available TSN profiles" + }, + { + "resourceName": "TSN_DETAIL_PROFILE", + "commType": " SUBSCRIBE_NOTIFY", + "uri": "/profile?name={profileName}", + "custOpName": "http_get", + "operations": ["GET"], + "description": "Endpoint for retrieving information about a single TSN profile" + }, + { + "resourceName": "TSN_APPLY_CONFIGURATION", + "commType": " SUBSCRIBE_NOTIFY", + "uri": "/apply", + "custOpName": "http_post", + "operations": ["POST"], + "description": "Endpoint for configuring TSN connection parameters" + }, + { + "resourceName": "TSN_CLEAR_CONFIGURATION", + "commType": " SUBSCRIBE_NOTIFY", + "uri": "/clear", + "custOpName": "http_post", + "operations": ["POST"], + "description": "Endpoint for removing a previous TSN connection configuration" + } + ], + "custOperations": [ + { + "commType": "REQUEST_RESPONSE", + "custOpName": "string", + "operations": ["POST"], + "description": "string" + } + ] + } + ], + "protocol": "HTTP_1_1", + "dataFormat": "JSON", + "securityMethods": ["Oauth"], + "interfaceDescriptions": [ + { + "ipv4Addr": "127.0.0.1", + "port": 8899, + "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" +} diff --git a/scripts/invoker_capif_connector.py b/scripts/invoker_capif_connector.py index a604812..00e8c73 100755 --- a/scripts/invoker_capif_connector.py +++ b/scripts/invoker_capif_connector.py @@ -1,4 +1,5 @@ +from sdk import CAPIFInvokerConnector import sys import os import utilities @@ -8,13 +9,11 @@ script_dir = os.path.dirname(os.path.abspath(__file__)) # Directorio actual del 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(): """ This method showcases how one can use the CAPIFConnector class. - + """ capif_connector = CAPIFInvokerConnector(config_file=utilities.get_config_file()) @@ -22,9 +21,7 @@ def showcase_capif_connector(): capif_connector.onboard_invoker() print("COMPLETED") + if __name__ == "__main__": - #Let's register invoker to CAPIF. This should happen exactly once + # Let's register invoker to CAPIF. This should happen exactly once showcase_capif_connector() - - - diff --git a/scripts/invoker_capif_connector_offboarding.py b/scripts/invoker_capif_connector_offboarding.py index 5dd7a8f..f32214e 100755 --- a/scripts/invoker_capif_connector_offboarding.py +++ b/scripts/invoker_capif_connector_offboarding.py @@ -11,13 +11,11 @@ sdk_path = os.path.join(script_dir, '..', 'sdk') # Subir un nivel y apuntar a ' sys.path.insert(0, sdk_path) - - def showcase_offboard_and_deregister_invoker(): capif_connector = CAPIFInvokerConnector(config_file=utilities.get_config_file()) capif_connector.offboard_invoker() print("COMPLETED") - - + + if __name__ == "__main__": showcase_offboard_and_deregister_invoker() diff --git a/scripts/invoker_capif_connector_update.py b/scripts/invoker_capif_connector_update.py index e2a88d3..e08e594 100644 --- a/scripts/invoker_capif_connector_update.py +++ b/scripts/invoker_capif_connector_update.py @@ -1,3 +1,4 @@ +from sdk import CAPIFInvokerConnector import sys import os import utilities @@ -7,8 +8,6 @@ script_dir = os.path.dirname(os.path.abspath(__file__)) # Directorio actual del 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(): """ @@ -22,6 +21,7 @@ def showcase_capif_connector(): capif_connector.update_invoker() print("COMPLETED") + if __name__ == "__main__": - #Let's register invoker to CAPIF. This should happen exactly once - showcase_capif_connector() \ No newline at end of file + # Let's register invoker to CAPIF. This should happen exactly once + showcase_capif_connector() diff --git a/scripts/invoker_service_discovery.py b/scripts/invoker_service_discovery.py index 05fc4b3..234fe37 100755 --- a/scripts/invoker_service_discovery.py +++ b/scripts/invoker_service_discovery.py @@ -1,3 +1,4 @@ +from sdk import ServiceDiscoverer import sys import os import utilities @@ -8,18 +9,16 @@ sdk_path = os.path.join(script_dir, '..', 'sdk') # Subir un nivel y apuntar a ' sys.path.insert(0, sdk_path) # Ahora importa las clases desde tu archivo sdk.py -from sdk import ServiceDiscoverer - def showcase_access_token_retrieval_from_capif(): service_discoverer = ServiceDiscoverer(config_file=utilities.get_config_file()) service_discoverer.discover() - + if __name__ == "__main__": - #The following code assumes that you have already registered the net app to capif. - #showcase_service_discovery() - #showcase_retrieve_endpoint_url_from_tsn() + # The following code assumes that you have already registered the net app to capif. + # showcase_service_discovery() + # showcase_retrieve_endpoint_url_from_tsn() showcase_access_token_retrieval_from_capif() print("COMPLETED") diff --git a/scripts/invoker_service_get_token.py b/scripts/invoker_service_get_token.py index cc87de6..591775f 100755 --- a/scripts/invoker_service_get_token.py +++ b/scripts/invoker_service_get_token.py @@ -1,3 +1,4 @@ +from sdk import ServiceDiscoverer import sys import os import utilities @@ -8,19 +9,16 @@ sdk_path = os.path.join(script_dir, '..', 'sdk') # Subir un nivel y apuntar a ' sys.path.insert(0, sdk_path) # Ahora importa las clases desde tu archivo sdk.py -from sdk import ServiceDiscoverer - - def showcase_access_token_retrieval_from_capif(): service_discoverer = ServiceDiscoverer(config_file=utilities.get_config_file()) service_discoverer.get_tokens() - + if __name__ == "__main__": - #The following code assumes that you have already registered the net app to capif. - #showcase_service_discovery() - #showcase_retrieve_endpoint_url_from_tsn() + # The following code assumes that you have already registered the net app to capif. + # showcase_service_discovery() + # showcase_retrieve_endpoint_url_from_tsn() showcase_access_token_retrieval_from_capif() print("COMPLETED") diff --git a/scripts/provider_capif_connector.py b/scripts/provider_capif_connector.py index 16b8275..7eacc8b 100755 --- a/scripts/provider_capif_connector.py +++ b/scripts/provider_capif_connector.py @@ -1,3 +1,4 @@ +from sdk import CAPIFProviderConnector import sys import os import utilities @@ -8,7 +9,8 @@ sdk_path = os.path.join(script_dir, '..', 'sdk') # Subir un nivel y apuntar a ' sys.path.insert(0, sdk_path) # Ahora importa las clases desde tu archivo sdk.py -from sdk import CAPIFProviderConnector + + def showcase_capif_nef_connector(): """ @@ -17,9 +19,9 @@ def showcase_capif_nef_connector(): capif_connector.onboard_provider() - print("COMPLETED") + if __name__ == "__main__": - #Let's register a NEF to CAPIF. This should happen exactly once + # Let's register a NEF to CAPIF. This should happen exactly once showcase_capif_nef_connector() diff --git a/scripts/provider_capif_connector_offboarding.py b/scripts/provider_capif_connector_offboarding.py index fcdb00f..bd561f2 100755 --- a/scripts/provider_capif_connector_offboarding.py +++ b/scripts/provider_capif_connector_offboarding.py @@ -1,3 +1,4 @@ +from sdk import CAPIFProviderConnector import sys import os import utilities @@ -8,14 +9,11 @@ sdk_path = os.path.join(script_dir, '..', 'sdk') # Subir un nivel y apuntar a ' sys.path.insert(0, sdk_path) -from sdk import CAPIFProviderConnector - def offboard_capif_nef_connector(): - """ - """ capif_connector = CAPIFProviderConnector(config_file=utilities.get_config_file()) capif_connector.offboard_provider() print("COMPLETED") + if __name__ == "__main__": offboard_capif_nef_connector() diff --git a/scripts/provider_capif_connector_update.py b/scripts/provider_capif_connector_update.py index c1ec26e..20564e7 100644 --- a/scripts/provider_capif_connector_update.py +++ b/scripts/provider_capif_connector_update.py @@ -1,16 +1,14 @@ +from sdk import CAPIFProviderConnector import sys import os import utilities - # Añadir el directorio del SDK al PYTHONPATH usando una ruta relativa 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 CAPIFProviderConnector - def showcase_capif_nef_connector(): """ @@ -20,9 +18,9 @@ def showcase_capif_nef_connector(): capif_connector.update_provider() - print("COMPLETED") + if __name__ == "__main__": - #Let's register a NEF to CAPIF. This should happen exactly once + # Let's register a NEF to CAPIF. This should happen exactly once showcase_capif_nef_connector() diff --git a/scripts/provider_get_published_api.py b/scripts/provider_get_published_api.py index 6876707..8090c86 100644 --- a/scripts/provider_get_published_api.py +++ b/scripts/provider_get_published_api.py @@ -1,3 +1,4 @@ +from sdk import CAPIFProviderConnector import sys import os import utilities @@ -8,7 +9,8 @@ sdk_path = os.path.join(script_dir, '..', 'sdk') # Subir un nivel y apuntar a ' sys.path.insert(0, sdk_path) # Ahora importa las clases desde tu archivo sdk.py -from sdk import CAPIFProviderConnector + + def showcase_capif_nef_connector(): """ @@ -18,6 +20,7 @@ def showcase_capif_nef_connector(): capif_connector.get_service() print("COMPLETED") + if __name__ == "__main__": - #Let's register a NEF to CAPIF. This should happen exactly once + # Let's register a NEF to CAPIF. This should happen exactly once showcase_capif_nef_connector() diff --git a/scripts/provider_publish_api.py b/scripts/provider_publish_api.py index dddee28..3ef5f66 100644 --- a/scripts/provider_publish_api.py +++ b/scripts/provider_publish_api.py @@ -1,3 +1,4 @@ +from sdk import CAPIFProviderConnector import sys import os import utilities @@ -8,7 +9,8 @@ sdk_path = os.path.join(script_dir, '..', 'sdk') # Subir un nivel y apuntar a ' sys.path.insert(0, sdk_path) # Ahora importa las clases desde tu archivo sdk.py -from sdk import CAPIFProviderConnector + + def showcase_capif_nef_connector(): """ @@ -18,6 +20,7 @@ def showcase_capif_nef_connector(): capif_connector.publish_services() print("COMPLETED") + if __name__ == "__main__": - #Let's register a NEF to CAPIF. This should happen exactly once + # Let's register a NEF to CAPIF. This should happen exactly once showcase_capif_nef_connector() diff --git a/scripts/provider_unpublish_api.py b/scripts/provider_unpublish_api.py index 607a980..0dc792c 100644 --- a/scripts/provider_unpublish_api.py +++ b/scripts/provider_unpublish_api.py @@ -1,3 +1,4 @@ +from sdk import CAPIFProviderConnector import sys import os import utilities @@ -8,7 +9,8 @@ sdk_path = os.path.join(script_dir, '..', 'sdk') # Subir un nivel y apuntar a ' sys.path.insert(0, sdk_path) # Ahora importa las clases desde tu archivo sdk.py -from sdk import CAPIFProviderConnector + + def showcase_capif_nef_connector(): """ @@ -18,6 +20,7 @@ def showcase_capif_nef_connector(): capif_connector.unpublish_service() print("COMPLETED") + if __name__ == "__main__": - #Let's register a NEF to CAPIF. This should happen exactly once + # Let's register a NEF to CAPIF. This should happen exactly once showcase_capif_nef_connector() diff --git a/scripts/provider_update_api.py b/scripts/provider_update_api.py index 515a005..cc64a72 100644 --- a/scripts/provider_update_api.py +++ b/scripts/provider_update_api.py @@ -1,3 +1,4 @@ +from sdk import CAPIFProviderConnector import sys import os import utilities @@ -8,7 +9,8 @@ sdk_path = os.path.join(script_dir, '..', 'sdk') # Subir un nivel y apuntar a ' sys.path.insert(0, sdk_path) # Ahora importa las clases desde tu archivo sdk.py -from sdk import CAPIFProviderConnector + + def showcase_capif_nef_connector(): """ @@ -18,6 +20,7 @@ def showcase_capif_nef_connector(): capif_connector.update_service() print("COMPLETED") + if __name__ == "__main__": - #Let's register a NEF to CAPIF. This should happen exactly once + # Let's register a NEF to CAPIF. This should happen exactly once showcase_capif_nef_connector() diff --git a/scripts/utilities.py b/scripts/utilities.py index ef91c63..8975950 100755 --- a/scripts/utilities.py +++ b/scripts/utilities.py @@ -1,9 +1,8 @@ -def get_config_file()-> str : +def get_config_file() -> str: return "../config/capif-sdk-config.json" -def get_register_file()-> str : - return "../config/capif-sdk-register.json" - +def get_register_file() -> str: + return "../config/capif-sdk-register.json" \ No newline at end of file -- GitLab