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 1da7d1f7e6db7fff5aa010a87fb094b6b74b16f6..d2b17798a181bc124cd90d0a40735c38b4c10d1d 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 d83f8109665cc05477b03bb37a063d8116a9a07d..54a5e609f7ac14cee0f7e3253ee1c762b19316d1 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 f606663e6c71277dbdd5886dd2171138b1f6a3e4..377ba08f958b2ffe34ec0eedd7096527c63e9fb5 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 ee16d98add75bd2df729d7e9151f966599d7d7f9..2b0fec36597f2baefa2b3bb844b3b4fc67687841 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 a60481274e3eb1020df04c1667c38b273510c360..00e8c7318f9bbb5516a9b8de57a51a47c08f1699 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 5dd7a8f914c5019f50e5311b825ef7c52cab180d..f32214e19ac6dc01cabde451e669d573c5b35d0c 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 e2a88d3695d324b5092eca74774e07ecaac7d892..e08e59413a3f1370b08c9b23510af57c951b7ace 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 05fc4b319c27136367e55e1f8e567d8cce8b5515..234fe37e5bb7624340f53ab57bab66f2098b821d 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 cc87de6169aa92693a4acac88995ba903909b19c..591775fc22357a4c45e5050598283f9610a718f2 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 16b82756e834fd08214bc0c0d645617887026636..7eacc8b7cf114d824b258b75033ba21e29657d3b 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 fcdb00fd22b02b693a7c78681e74f945bfc38f35..bd561f2305fa0c7ece2cb9a7a825e7e9b02e0455 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 c1ec26e4cfe386299a45e44514ec0f5b819e2492..20564e7cb7166891e56dc3a6f856caf2190bd2e4 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 68767078075ae16351ee987e30be18569a7f5e97..8090c86d76550281ea0b9f0bc6d438066d9700fb 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 dddee28c2eeeb8acf12e549cc8cb0200c3409f04..3ef5f663aa63f81e251cd279bde3f6191dd0b664 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 607a9805b690369c2c9505baf034850ccb760b7a..0dc792cfd4fe377c945f699a41b3b230f1024c92 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 515a005747620a62d9d01d3ee673603b6dd11f98..cc64a72fc5f87da0f94b7dd0ea8efe2d1394d324 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 ef91c636be9723a505c9e1ae3b91b74d4c654a56..89759504341c0fa8cf368c84b2b21cc7c8b45516 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