Commit 04a765d8 authored by JorgeEcheva26's avatar JorgeEcheva26
Browse files

Changes for release 2

parent 0c24a548
Loading
Loading
Loading
Loading
+8 −3
Original line number Original line Diff line number Diff line
@@ -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.")
@@ -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"]
                },
                },
+1 −2
Original line number Original line Diff line number Diff line
@@ -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)
@@ -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
+1 −1
Original line number Original line Diff line number Diff line
@@ -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=(
+2 −2
Original line number Original line Diff line number Diff line
@@ -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": ""
@@ -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",
+4 −4
Original line number Original line Diff line number Diff line
@@ -2,7 +2,7 @@
    "apiName": "Testtrece",
    "apiName": "Testtrece",
    "aefProfiles": [
    "aefProfiles": [
        {
        {
            "aefId": "AEF6b074911c72c9a49c8a3ea7e881b85",
            "aefId": "AEF5ab315755935b121309e787620c354",
            "versions": [
            "versions": [
                {
                {
                    "apiVersion": "v1",
                    "apiVersion": "v1",
@@ -77,7 +77,7 @@
            ]
            ]
        },
        },
        {
        {
            "aefId": "AEFfaa1b3b961a3a09c71b633fe8327c3",
            "aefId": "AEF32cfb4a7b1b8c705217a6bb37b43f2",
            "versions": [
            "versions": [
                {
                {
                    "apiVersion": "v1",
                    "apiVersion": "v1",
@@ -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": [
@@ -177,7 +177,7 @@
        ]
        ]
    },
    },
    "serviceAPICategory": "string",
    "serviceAPICategory": "string",
    "apiSuppFeats": "fffff",
    "apiSuppFeats": "0",
    "pubApiPath": {
    "pubApiPath": {
        "ccfIds": [
        "ccfIds": [
            "string"
            "string"
Loading