Commit 4b4206ae authored by JorgeEcheva26's avatar JorgeEcheva26
Browse files

Path to api description also in conf.json

parent 7301e498
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -37,5 +37,6 @@
        "serviceApiId":"addd0af19a424e54c87fc8b1fe4fba",
        "publisherAPFid":"APFd7feeefab02e127ec6817e7cda9ac7",
        "publisherAEFsids":["AEFb1f5ab26a98e3c24d5dfad26507a28","AEFb0fa4e048bea75f0f335cfa8b2a0aa"]
    }
    },
    "api_description_path":""
}
 No newline at end of file
+1 −2
Original line number Diff line number Diff line
@@ -15,8 +15,7 @@ def showcase_capif_nef_connector():
    """
    capif_connector = CAPIFProviderConnector(config_file=utilities.get_config_file())

    capif_connector.publish_services(
        service_api_description_json_full_path=utilities.provider_exposer_get_api_description_path())
    capif_connector.publish_services()
    print("COMPLETED")

if __name__ == "__main__":
+1 −2
Original line number Diff line number Diff line
@@ -15,8 +15,7 @@ def showcase_capif_nef_connector():
    """
    capif_connector = CAPIFProviderConnector(config_file=utilities.get_config_file())

    capif_connector.update_service(
        service_api_description_json_full_path=utilities.provider_exposer_get_api_description_path())
    capif_connector.update_service()
    print("COMPLETED")

if __name__ == "__main__":
+0 −2
Original line number Diff line number Diff line
@@ -6,6 +6,4 @@ def get_config_file()-> str :
def get_register_file()-> str : 
    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"
+6 −5
Original line number Diff line number Diff line
@@ -511,7 +511,7 @@ class CAPIFProviderConnector:
            csr_email_address = os.getenv('CSR_EMAIL_ADDRESS', config.get('csr_email_address', '')).strip()
            APFs = os.getenv('APFS', config.get('APFs', '')).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:
                self.logger.warning("CAPIF_HOST is not provided; defaulting to an empty string")
@@ -536,7 +536,7 @@ class CAPIFProviderConnector:
            self.csr_email_address = csr_email_address
            self.AEFs = int(AEFs)
            self.APFs = int(APFs)
            
            self.api_description_path=api_description_path
            
            self.capif_https_port = str(capif_https_port)
            
@@ -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.

@@ -820,7 +820,7 @@ class CAPIFProviderConnector:
        if apf_number is None:
            self.logger.error(f"No matching APF found for publisherAPFid: {APF_api_prov_func_id}")
            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
        self.logger.info(f"Reading and modifying service API description from {service_api_description_json_full_path}")

@@ -1178,7 +1178,7 @@ class CAPIFProviderConnector:
            self.logger.error(f"Unexpected error during services reception: {e} - Response: {response.text}")
            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.

@@ -1219,6 +1219,7 @@ class CAPIFProviderConnector:
            self.logger.error(f"No matching APF found for publisherAPFid: {APF_api_prov_func_id}")
            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
        self.logger.info(f"Reading and modifying service API description from {service_api_description_json_full_path}")