Skip to content
Snippets Groups Projects
Commit c0afb7d6 authored by JorgeEcheva26's avatar JorgeEcheva26
Browse files

Path to api description also in conf.json

parent 11f3b8b1
No related branches found
No related tags found
1 merge request!1Sdk v0.1 (#1)
...@@ -37,5 +37,6 @@ ...@@ -37,5 +37,6 @@
"serviceApiId":"addd0af19a424e54c87fc8b1fe4fba", "serviceApiId":"addd0af19a424e54c87fc8b1fe4fba",
"publisherAPFid":"APFd7feeefab02e127ec6817e7cda9ac7", "publisherAPFid":"APFd7feeefab02e127ec6817e7cda9ac7",
"publisherAEFsids":["AEFb1f5ab26a98e3c24d5dfad26507a28","AEFb0fa4e048bea75f0f335cfa8b2a0aa"] "publisherAEFsids":["AEFb1f5ab26a98e3c24d5dfad26507a28","AEFb0fa4e048bea75f0f335cfa8b2a0aa"]
} },
"api_description_path":""
} }
\ No newline at end of file
...@@ -15,8 +15,7 @@ def showcase_capif_nef_connector(): ...@@ -15,8 +15,7 @@ def showcase_capif_nef_connector():
""" """
capif_connector = CAPIFProviderConnector(config_file=utilities.get_config_file()) capif_connector = CAPIFProviderConnector(config_file=utilities.get_config_file())
capif_connector.publish_services( capif_connector.publish_services()
service_api_description_json_full_path=utilities.provider_exposer_get_api_description_path())
print("COMPLETED") print("COMPLETED")
if __name__ == "__main__": if __name__ == "__main__":
......
...@@ -15,8 +15,7 @@ def showcase_capif_nef_connector(): ...@@ -15,8 +15,7 @@ def showcase_capif_nef_connector():
""" """
capif_connector = CAPIFProviderConnector(config_file=utilities.get_config_file()) capif_connector = CAPIFProviderConnector(config_file=utilities.get_config_file())
capif_connector.update_service( capif_connector.update_service()
service_api_description_json_full_path=utilities.provider_exposer_get_api_description_path())
print("COMPLETED") print("COMPLETED")
if __name__ == "__main__": if __name__ == "__main__":
......
...@@ -6,6 +6,4 @@ def get_config_file()-> str : ...@@ -6,6 +6,4 @@ def get_config_file()-> str :
def get_register_file()-> str : def get_register_file()-> str :
return "/Users/IDB0128/git_repos/pesp_capif_sdk/config/register.json" return "/Users/IDB0128/git_repos/pesp_capif_sdk/config/register.json"
def provider_exposer_get_api_description_path() -> str:
return "/Users/IDB0128/git_repos/pesp_capif_sdk/samples/provider_api_description_sample.json"
...@@ -511,7 +511,7 @@ class CAPIFProviderConnector: ...@@ -511,7 +511,7 @@ class CAPIFProviderConnector:
csr_email_address = os.getenv('CSR_EMAIL_ADDRESS', config.get('csr_email_address', '')).strip() csr_email_address = os.getenv('CSR_EMAIL_ADDRESS', config.get('csr_email_address', '')).strip()
APFs = os.getenv('APFS', config.get('APFs', '')).strip() APFs = os.getenv('APFS', config.get('APFs', '')).strip()
AEFs = os.getenv('AEFS', config.get('AEFs', '')).strip() AEFs = os.getenv('AEFS', config.get('AEFs', '')).strip()
api_description_path = os.getenv('API_DESCRIPTION_PATH', config.get('api_description_path', '')).strip()
if not capif_host: if not capif_host:
self.logger.warning("CAPIF_HOST is not provided; defaulting to an empty string") self.logger.warning("CAPIF_HOST is not provided; defaulting to an empty string")
...@@ -536,7 +536,7 @@ class CAPIFProviderConnector: ...@@ -536,7 +536,7 @@ class CAPIFProviderConnector:
self.csr_email_address = csr_email_address self.csr_email_address = csr_email_address
self.AEFs = int(AEFs) self.AEFs = int(AEFs)
self.APFs = int(APFs) self.APFs = int(APFs)
self.api_description_path=api_description_path
self.capif_https_port = str(capif_https_port) self.capif_https_port = str(capif_https_port)
...@@ -781,7 +781,7 @@ class CAPIFProviderConnector: ...@@ -781,7 +781,7 @@ class CAPIFProviderConnector:
def publish_services(self, service_api_description_json_full_path: str) -> dict: def publish_services(self) -> dict:
""" """
Publishes services to CAPIF and returns the published services dictionary. Publishes services to CAPIF and returns the published services dictionary.
...@@ -820,7 +820,7 @@ class CAPIFProviderConnector: ...@@ -820,7 +820,7 @@ class CAPIFProviderConnector:
if apf_number is None: if apf_number is None:
self.logger.error(f"No matching APF found for publisherAPFid: {APF_api_prov_func_id}") self.logger.error(f"No matching APF found for publisherAPFid: {APF_api_prov_func_id}")
raise ValueError("Invalid publisherAPFid") raise ValueError("Invalid publisherAPFid")
service_api_description_json_full_path = self.api_description_path
# Leer y modificar la descripción de la API de servicio # Leer y modificar la descripción de la API de servicio
self.logger.info(f"Reading and modifying service API description from {service_api_description_json_full_path}") self.logger.info(f"Reading and modifying service API description from {service_api_description_json_full_path}")
...@@ -1178,7 +1178,7 @@ class CAPIFProviderConnector: ...@@ -1178,7 +1178,7 @@ class CAPIFProviderConnector:
self.logger.error(f"Unexpected error during services reception: {e} - Response: {response.text}") self.logger.error(f"Unexpected error during services reception: {e} - Response: {response.text}")
raise raise
def update_service(self, service_api_description_json_full_path: str) -> dict: def update_service(self) -> dict:
""" """
Publishes services to CAPIF and returns the published services dictionary. Publishes services to CAPIF and returns the published services dictionary.
...@@ -1219,6 +1219,7 @@ class CAPIFProviderConnector: ...@@ -1219,6 +1219,7 @@ class CAPIFProviderConnector:
self.logger.error(f"No matching APF found for publisherAPFid: {APF_api_prov_func_id}") self.logger.error(f"No matching APF found for publisherAPFid: {APF_api_prov_func_id}")
raise ValueError("Invalid publisherAPFid") raise ValueError("Invalid publisherAPFid")
service_api_description_json_full_path = self.api_description_path
# Leer y modificar la descripción de la API de servicio # Leer y modificar la descripción de la API de servicio
self.logger.info(f"Reading and modifying service API description from {service_api_description_json_full_path}") self.logger.info(f"Reading and modifying service API description from {service_api_description_json_full_path}")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment