Loading opencapif_sdk/api_schema_translator.py +8 −3 Original line number Original line Diff line number Diff line Loading @@ -34,11 +34,16 @@ class api_schema_translator: self.api_info = self.__load_api_file(self.api_path) self.api_info = self.__load_api_file(self.api_path) self.__validate_api_info() self.__validate_api_info() def build(self, api_name, ip=None, port=None, fqdn=None, ipv6Addr=None): def build(self, api_name, supported_features, api_supp_features, ip=None, port=None, fqdn=None, ipv6Addr=None): """ """ Builds the API description and saves it to a JSON file. Builds the API description and saves it to a JSON file. Supports either IPv4 (ip), IPv6 (ipv6Addr), or FQDN (fqdn). Supports either IPv4 (ip), IPv6 (ipv6Addr), or FQDN (fqdn). """ """ # Validate required fields if not supported_features or not api_supp_features: self.logger.error("Both 'supported_features' and 'api_supp_features' are required. Aborting build.") return # Validate that at least one of ip, ipv6Addr, or fqdn is provided # Validate that at least one of ip, ipv6Addr, or fqdn is provided if not (ip or ipv6Addr or fqdn): if not (ip or ipv6Addr or fqdn): self.logger.error("At least one of 'ip', 'ipv6Addr', or 'fqdn' must be provided. Aborting build.") self.logger.error("At least one of 'ip', 'ipv6Addr', or 'fqdn' must be provided. Aborting build.") Loading @@ -55,13 +60,13 @@ class api_schema_translator: "apiName": self.api_info["info"].get("title", api_name), "apiName": self.api_info["info"].get("title", api_name), "aefProfiles": self.__build_aef_profiles(ip, port, fqdn, ipv6Addr), "aefProfiles": self.__build_aef_profiles(ip, port, fqdn, ipv6Addr), "description": self.api_info["info"].get("description", "No description provided"), "description": self.api_info["info"].get("description", "No description provided"), "supportedFeatures": "fffff", "supportedFeatures": supported_features, "shareableInfo": { "shareableInfo": { "isShareable": True, "isShareable": True, "capifProvDoms": ["string"] "capifProvDoms": ["string"] }, }, "serviceAPICategory": "string", "serviceAPICategory": "string", "apiSuppFeats": "fffff", "apiSuppFeats": api_supp_features, "pubApiPath": { "pubApiPath": { "ccfIds": ["string"] "ccfIds": ["string"] }, }, Loading opencapif_sdk/capif_provider_connector.py +1 −2 Original line number Original line Diff line number Diff line Loading @@ -193,7 +193,6 @@ class capif_provider_connector: context = ssl.create_default_context() context = ssl.create_default_context() context.check_hostname = False context.check_hostname = False context.verify_mode = ssl.CERT_NONE context.verify_mode = ssl.CERT_NONE with socket.create_connection((self.capif_host, self.capif_https_port)) as sock: with socket.create_connection((self.capif_host, self.capif_https_port)) as sock: with context.wrap_socket(sock, server_hostname=self.capif_host) as ssock: with context.wrap_socket(sock, server_hostname=self.capif_host) as ssock: cert = ssock.getpeercert(binary_form=True) cert = ssock.getpeercert(binary_form=True) Loading Loading @@ -1160,7 +1159,7 @@ class capif_provider_connector: self.logger.info("Starting certificate removal process...") self.logger.info("Starting certificate removal process...") # List of possible certificate patterns to remove # List of possible certificate patterns to remove cert_patterns = ["APF-", "apf-", "AEF-", "aef-", "AMF", "amf"] cert_patterns = ["APF-", "apf-", "AEF-", "aef-"] cert_extensions = ["_private_key.key", "_public.csr", ".crt"] cert_extensions = ["_private_key.key", "_public.csr", ".crt"] # Iterate over the directory and remove matching files # Iterate over the directory and remove matching files Loading setup.py +1 −1 Original line number Original line Diff line number Diff line Loading @@ -7,7 +7,7 @@ with open(os.path.join(this_directory, "README_pipy.md"), encoding="utf-8") as f setup( setup( name="opencapif_sdk", name="opencapif_sdk", version="0.1.19", version="0.1.20", author="JorgeEcheva, dgs-cgm", author="JorgeEcheva, dgs-cgm", author_email="jorge.echevarriauribarri.practicas@telefonica.com, daniel.garciasanchez@telefonica.com", author_email="jorge.echevarriauribarri.practicas@telefonica.com, daniel.garciasanchez@telefonica.com", description=( description=( Loading test/capif_sdk_config_sample_test.json +2 −2 Original line number Original line Diff line number Diff line Loading @@ -9,7 +9,7 @@ "invoker": { "invoker": { "invoker_folder": "/Users/IDB0128/Documents/OpenCapif/test_invoker_certificate_folder", "invoker_folder": "/Users/IDB0128/Documents/OpenCapif/test_invoker_certificate_folder", "capif_callback_url": "http://localhost:5000", "capif_callback_url": "http://localhost:5000", "supported_features": "fffffff", "supported_features": "0", "check_authentication_data": { "check_authentication_data": { "ip": "", "ip": "", "port": "" "port": "" Loading Loading @@ -51,7 +51,7 @@ }, }, "provider": { "provider": { "provider_folder": "/Users/IDB0128/Documents/OpenCapif/test_provider_certificate_folder", "provider_folder": "/Users/IDB0128/Documents/OpenCapif/test_provider_certificate_folder", "supported_features": "fffffff", "supported_features": "0", "cert_generation": { "cert_generation": { "csr_common_name": "provider", "csr_common_name": "provider", "csr_organizational_unit": "discovery", "csr_organizational_unit": "discovery", Loading test/network_app_provider_api_spec.json +4 −4 Original line number Original line Diff line number Diff line Loading @@ -2,7 +2,7 @@ "apiName": "Testtrece", "apiName": "Testtrece", "aefProfiles": [ "aefProfiles": [ { { "aefId": "AEF6b074911c72c9a49c8a3ea7e881b85", "aefId": "AEF5ab315755935b121309e787620c354", "versions": [ "versions": [ { { "apiVersion": "v1", "apiVersion": "v1", Loading Loading @@ -77,7 +77,7 @@ ] ] }, }, { { "aefId": "AEFfaa1b3b961a3a09c71b633fe8327c3", "aefId": "AEF32cfb4a7b1b8c705217a6bb37b43f2", "versions": [ "versions": [ { { "apiVersion": "v1", "apiVersion": "v1", Loading Loading @@ -169,7 +169,7 @@ } } ], ], "description": "API of dummy Network-App to test", "description": "API of dummy Network-App to test", "supportedFeatures": "fffffff", "supportedFeatures": "0", "shareableInfo": { "shareableInfo": { "isShareable": true, "isShareable": true, "capifProvDoms": [ "capifProvDoms": [ Loading @@ -177,7 +177,7 @@ ] ] }, }, "serviceAPICategory": "string", "serviceAPICategory": "string", "apiSuppFeats": "fffff", "apiSuppFeats": "0", "pubApiPath": { "pubApiPath": { "ccfIds": [ "ccfIds": [ "string" "string" Loading Loading
opencapif_sdk/api_schema_translator.py +8 −3 Original line number Original line Diff line number Diff line Loading @@ -34,11 +34,16 @@ class api_schema_translator: self.api_info = self.__load_api_file(self.api_path) self.api_info = self.__load_api_file(self.api_path) self.__validate_api_info() self.__validate_api_info() def build(self, api_name, ip=None, port=None, fqdn=None, ipv6Addr=None): def build(self, api_name, supported_features, api_supp_features, ip=None, port=None, fqdn=None, ipv6Addr=None): """ """ Builds the API description and saves it to a JSON file. Builds the API description and saves it to a JSON file. Supports either IPv4 (ip), IPv6 (ipv6Addr), or FQDN (fqdn). Supports either IPv4 (ip), IPv6 (ipv6Addr), or FQDN (fqdn). """ """ # Validate required fields if not supported_features or not api_supp_features: self.logger.error("Both 'supported_features' and 'api_supp_features' are required. Aborting build.") return # Validate that at least one of ip, ipv6Addr, or fqdn is provided # Validate that at least one of ip, ipv6Addr, or fqdn is provided if not (ip or ipv6Addr or fqdn): if not (ip or ipv6Addr or fqdn): self.logger.error("At least one of 'ip', 'ipv6Addr', or 'fqdn' must be provided. Aborting build.") self.logger.error("At least one of 'ip', 'ipv6Addr', or 'fqdn' must be provided. Aborting build.") Loading @@ -55,13 +60,13 @@ class api_schema_translator: "apiName": self.api_info["info"].get("title", api_name), "apiName": self.api_info["info"].get("title", api_name), "aefProfiles": self.__build_aef_profiles(ip, port, fqdn, ipv6Addr), "aefProfiles": self.__build_aef_profiles(ip, port, fqdn, ipv6Addr), "description": self.api_info["info"].get("description", "No description provided"), "description": self.api_info["info"].get("description", "No description provided"), "supportedFeatures": "fffff", "supportedFeatures": supported_features, "shareableInfo": { "shareableInfo": { "isShareable": True, "isShareable": True, "capifProvDoms": ["string"] "capifProvDoms": ["string"] }, }, "serviceAPICategory": "string", "serviceAPICategory": "string", "apiSuppFeats": "fffff", "apiSuppFeats": api_supp_features, "pubApiPath": { "pubApiPath": { "ccfIds": ["string"] "ccfIds": ["string"] }, }, Loading
opencapif_sdk/capif_provider_connector.py +1 −2 Original line number Original line Diff line number Diff line Loading @@ -193,7 +193,6 @@ class capif_provider_connector: context = ssl.create_default_context() context = ssl.create_default_context() context.check_hostname = False context.check_hostname = False context.verify_mode = ssl.CERT_NONE context.verify_mode = ssl.CERT_NONE with socket.create_connection((self.capif_host, self.capif_https_port)) as sock: with socket.create_connection((self.capif_host, self.capif_https_port)) as sock: with context.wrap_socket(sock, server_hostname=self.capif_host) as ssock: with context.wrap_socket(sock, server_hostname=self.capif_host) as ssock: cert = ssock.getpeercert(binary_form=True) cert = ssock.getpeercert(binary_form=True) Loading Loading @@ -1160,7 +1159,7 @@ class capif_provider_connector: self.logger.info("Starting certificate removal process...") self.logger.info("Starting certificate removal process...") # List of possible certificate patterns to remove # List of possible certificate patterns to remove cert_patterns = ["APF-", "apf-", "AEF-", "aef-", "AMF", "amf"] cert_patterns = ["APF-", "apf-", "AEF-", "aef-"] cert_extensions = ["_private_key.key", "_public.csr", ".crt"] cert_extensions = ["_private_key.key", "_public.csr", ".crt"] # Iterate over the directory and remove matching files # Iterate over the directory and remove matching files Loading
setup.py +1 −1 Original line number Original line Diff line number Diff line Loading @@ -7,7 +7,7 @@ with open(os.path.join(this_directory, "README_pipy.md"), encoding="utf-8") as f setup( setup( name="opencapif_sdk", name="opencapif_sdk", version="0.1.19", version="0.1.20", author="JorgeEcheva, dgs-cgm", author="JorgeEcheva, dgs-cgm", author_email="jorge.echevarriauribarri.practicas@telefonica.com, daniel.garciasanchez@telefonica.com", author_email="jorge.echevarriauribarri.practicas@telefonica.com, daniel.garciasanchez@telefonica.com", description=( description=( Loading
test/capif_sdk_config_sample_test.json +2 −2 Original line number Original line Diff line number Diff line Loading @@ -9,7 +9,7 @@ "invoker": { "invoker": { "invoker_folder": "/Users/IDB0128/Documents/OpenCapif/test_invoker_certificate_folder", "invoker_folder": "/Users/IDB0128/Documents/OpenCapif/test_invoker_certificate_folder", "capif_callback_url": "http://localhost:5000", "capif_callback_url": "http://localhost:5000", "supported_features": "fffffff", "supported_features": "0", "check_authentication_data": { "check_authentication_data": { "ip": "", "ip": "", "port": "" "port": "" Loading Loading @@ -51,7 +51,7 @@ }, }, "provider": { "provider": { "provider_folder": "/Users/IDB0128/Documents/OpenCapif/test_provider_certificate_folder", "provider_folder": "/Users/IDB0128/Documents/OpenCapif/test_provider_certificate_folder", "supported_features": "fffffff", "supported_features": "0", "cert_generation": { "cert_generation": { "csr_common_name": "provider", "csr_common_name": "provider", "csr_organizational_unit": "discovery", "csr_organizational_unit": "discovery", Loading
test/network_app_provider_api_spec.json +4 −4 Original line number Original line Diff line number Diff line Loading @@ -2,7 +2,7 @@ "apiName": "Testtrece", "apiName": "Testtrece", "aefProfiles": [ "aefProfiles": [ { { "aefId": "AEF6b074911c72c9a49c8a3ea7e881b85", "aefId": "AEF5ab315755935b121309e787620c354", "versions": [ "versions": [ { { "apiVersion": "v1", "apiVersion": "v1", Loading Loading @@ -77,7 +77,7 @@ ] ] }, }, { { "aefId": "AEFfaa1b3b961a3a09c71b633fe8327c3", "aefId": "AEF32cfb4a7b1b8c705217a6bb37b43f2", "versions": [ "versions": [ { { "apiVersion": "v1", "apiVersion": "v1", Loading Loading @@ -169,7 +169,7 @@ } } ], ], "description": "API of dummy Network-App to test", "description": "API of dummy Network-App to test", "supportedFeatures": "fffffff", "supportedFeatures": "0", "shareableInfo": { "shareableInfo": { "isShareable": true, "isShareable": true, "capifProvDoms": [ "capifProvDoms": [ Loading @@ -177,7 +177,7 @@ ] ] }, }, "serviceAPICategory": "string", "serviceAPICategory": "string", "apiSuppFeats": "fffff", "apiSuppFeats": "0", "pubApiPath": { "pubApiPath": { "ccfIds": [ "ccfIds": [ "string" "string" Loading