Commit 7c8e68db authored by JorgeEcheva26's avatar JorgeEcheva26
Browse files

refactor

parent 2c9805f6
Loading
Loading
Loading
Loading
+3 −8
Original line number Diff line number Diff line
from sdk import CAPIFInvokerConnector, ServiceDiscoverer
import sys
import os

@@ -9,7 +10,6 @@ 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,7 +18,6 @@ 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
@@ -30,7 +29,3 @@ if __name__ == "__main__":
    discoverer.discover()

    discoverer.get_tokens()


    
+7 −11
Original line number Diff line number Diff line
from sdk import CAPIFProviderConnector
import sys
import os
import json
@@ -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 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"

@@ -30,10 +29,7 @@ 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
        if not os.path.exists(detailspath):
            raise FileNotFoundError(f"No se encontró el archivo {detailspath}")

+118 −150
Original line number Diff line number Diff line
@@ -13,10 +13,7 @@
              "commType": " SUBSCRIBE_NOTIFY",
              "uri": "/{scsAsId}/subscriptions",
              "custOpName": "http_post",
                            "operations": [
                                "GET",
                                "POST"
                            ],
              "operations": ["GET", "POST"],
              "description": "Endpoint to manage monitoring subscriptions"
            },
            {
@@ -24,11 +21,7 @@
              "commType": " SUBSCRIBE_NOTIFY",
              "uri": "/{scsAsId}/subscriptions/{subscriptionId}",
              "custOpName": "http_get",
                            "operations": [
                                "GET",
                                "PUT",
                                "DELETE"
                            ],
              "operations": ["GET", "PUT", "DELETE"],
              "description": "Endpoint to manage single subscription"
            }
          ],
@@ -36,9 +29,7 @@
            {
              "commType": "REQUEST_RESPONSE",
              "custOpName": "string",
                            "operations": [
                                "POST"
                            ],
              "operations": ["POST"],
              "description": "string"
            }
          ]
@@ -46,17 +37,12 @@
      ],
      "protocol": "HTTP_1_1",
      "dataFormat": "JSON",
            "securityMethods": [
                "Oauth",
                "PSK"
            ],
      "securityMethods": ["Oauth", "PSK"],
      "interfaceDescriptions": [
        {
          "ipv4Addr": "127.0.0.1",
          "port": 8888,
                    "securityMethods": [
                        "Oauth"
                    ]
          "securityMethods": ["Oauth"]
        }
      ]
    },
@@ -72,9 +58,7 @@
              "commType": " SUBSCRIBE_NOTIFY",
              "uri": "/profile",
              "custOpName": "http_get",
                            "operations": [
                                "GET"
                            ],
              "operations": ["GET"],
              "description": "Endpoint for retrieving the list of available TSN profiles"
            },
            {
@@ -82,9 +66,7 @@
              "commType": " SUBSCRIBE_NOTIFY",
              "uri": "/profile?name={profileName}",
              "custOpName": "http_get",
                            "operations": [
                                "GET"
                            ],
              "operations": ["GET"],
              "description": "Endpoint for retrieving information about a single TSN profile"
            },
            {
@@ -92,9 +74,7 @@
              "commType": " SUBSCRIBE_NOTIFY",
              "uri": "/apply",
              "custOpName": "http_post",
                            "operations": [
                                "POST"
                            ],
              "operations": ["POST"],
              "description": "Endpoint for configuring TSN connection parameters"
            },
            {
@@ -102,9 +82,7 @@
              "commType": " SUBSCRIBE_NOTIFY",
              "uri": "/clear",
              "custOpName": "http_post",
                            "operations": [
                                "POST"
                            ],
              "operations": ["POST"],
              "description": "Endpoint for removing a previous TSN connection configuration"
            }
          ],
@@ -112,9 +90,7 @@
            {
              "commType": "REQUEST_RESPONSE",
              "custOpName": "string",
                            "operations": [
                                "POST"
                            ],
              "operations": ["POST"],
              "description": "string"
            }
          ]
@@ -122,16 +98,12 @@
      ],
      "protocol": "HTTP_1_1",
      "dataFormat": "JSON",
            "securityMethods": [
                "Oauth"
            ],
      "securityMethods": ["Oauth"],
      "interfaceDescriptions": [
        {
          "ipv4Addr": "127.0.0.1",
          "port": 8899,
                    "securityMethods": [
                        "Oauth"
                    ]
          "securityMethods": ["Oauth"]
        }
      ]
    }
@@ -140,16 +112,12 @@
  "supportedFeatures": "fffff",
  "shareableInfo": {
    "isShareable": true,
        "capifProvDoms": [
            "string"
        ]
    "capifProvDoms": ["string"]
  },
  "serviceAPICategory": "string",
  "apiSuppFeats": "fffff",
  "pubApiPath": {
        "ccfIds": [
            "string"
        ]
    "ccfIds": ["string"]
  },
  "ccfId": "string"
}
+4 −7
Original line number Diff line number Diff line

from sdk import CAPIFInvokerConnector
import sys
import os
import utilities
@@ -8,8 +9,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,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
    showcase_capif_connector()


+2 −4
Original line number Diff line number Diff line
@@ -11,8 +11,6 @@ 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()
Loading