Loading src/edgecloud/clients/i2edge/client.py +13 −6 Original line number Diff line number Diff line Loading @@ -16,15 +16,22 @@ from src import logger from src.edgecloud.core.edgecloud_interface import EdgeCloudManagementInterface from . import schemas from .common import (I2EdgeError, i2edge_delete, i2edge_get, i2edge_post, i2edge_post_multiform_data) from .common import ( I2EdgeError, i2edge_delete, i2edge_get, i2edge_post, i2edge_post_multiform_data, ) class EdgeApplicationManager(EdgeCloudManagementInterface): def __init__(self, base_url: str): self.base_url = base_url def get_edge_cloud_zones(self, region: Optional[str] = None, status: Optional[str] = None) -> list[dict]: def get_edge_cloud_zones( self, region: Optional[str] = None, status: Optional[str] = None ) -> list[dict]: # Note: status is not supported by i2Edge; won't be used # Up to now; region == av_zone (so if region is specified, that zone will be returned) try: Loading @@ -32,12 +39,12 @@ class EdgeApplicationManager(EdgeCloudManagementInterface): if region is not None: url = "{}/zone/{}".format(self.base_url, region) if status is not None: params['status'] = status params["status"] = status response = i2edge_get(url, params=params) else: url = "{}/zones/list".format(self.base_url) if status is not None: params['status'] = status params["status"] = status response = i2edge_get(url, params=params) return response Loading src/edgecloud/clients/i2edge/schemas.py +4 −3 Original line number Diff line number Diff line Loading @@ -4,8 +4,7 @@ # Copyright 2025-present by Software Networks Area, i2CAT. # All rights reserved. # # This file is part of the Federation SDK # Unauthorized copying of this file, via any medium is strictly prohibited. # This file is part of the Open SDK # # Contributors: # - Sergio Giménez (sergio.gimenez@i2cat.net) Loading Loading @@ -108,7 +107,9 @@ class ApplicationOnboardingRequest(BaseModel): class GPU(BaseModel): gpuMemory: int = Field(default=0, description="GPU memory in MB") gpuModeName: str = Field(default="", description="GPU mode name") gpuVendorType: str = Field(default="GPU_PROVIDER_NVIDIA", description="GPU vendor type") gpuVendorType: str = Field( default="GPU_PROVIDER_NVIDIA", description="GPU vendor type" ) numGPU: int = Field(..., description="Number of GPUs") Loading src/edgecloud/clients/i2edge/utils.py +4 −3 Original line number Diff line number Diff line Loading @@ -4,8 +4,7 @@ # Copyright 2025-present by Software Networks Area, i2CAT. # All rights reserved. # # This file is part of the Federation SDK # Unauthorized copying of this file, via any medium is strictly prohibited. # This file is part of the Open SDK # # Contributors: # - Sergio Giménez (sergio.gimenez@i2cat.net) Loading Loading @@ -101,7 +100,9 @@ def onboard_app_with( raise e def delete_app_instance_by(namespace: str, flavour_id: str, zone_id: str, i2edge: I2EdgeClient): def delete_app_instance_by( namespace: str, flavour_id: str, zone_id: str, i2edge: I2EdgeClient ): i2edge_app_instance_name = get_app_name_from(namespace, i2edge) if i2edge_app_instance_name is None: err_msg = "Couldn't retrieve app instance from I2Edge." Loading src/edgecloud/core/edgecloud_factory.py +11 −13 Original line number Diff line number Diff line Loading @@ -12,21 +12,17 @@ ## from __future__ import annotations from enum import Enum from typing import TYPE_CHECKING from src.edgecloud.clients.aeros.client import \ EdgeApplicationManager as AerosClient from src.edgecloud.clients.dmo.client import \ EdgeApplicationManager as DmoClient from src.edgecloud.clients.i2edge.client import \ EdgeApplicationManager as I2EdgeClient from src.edgecloud.clients.piedge.client import \ EdgeApplicationManager as PiEdgeClient from src.edgecloud.clients.aeros.client import EdgeApplicationManager as AerosClient from src.edgecloud.clients.dmo.client import EdgeApplicationManager as DmoClient from src.edgecloud.clients.i2edge.client import EdgeApplicationManager as I2EdgeClient from src.edgecloud.clients.piedge.client import EdgeApplicationManager as PiEdgeClient if TYPE_CHECKING: from .edgecloud_interface import EdgeCloudInterface class EdgeCloudFactory: """ Factory class for creating EdgeCloud Clients Loading @@ -44,10 +40,12 @@ class EdgeCloudFactory: f"Supported clients are: {', '.join(supported_clients)}" ) class EdgeCloudTypes(): class EdgeCloudTypes: """ Class dedicated for the different types of edgecloud clients. """ I2EDGE = "i2edge" AEROS = "aeros" DMO = "dmo" Loading @@ -57,5 +55,5 @@ class EdgeCloudTypes(): I2EDGE: lambda url: I2EdgeClient(base_url=url), AEROS: lambda url: AerosClient(base_url=url), DMO: lambda url: DmoClient(base_url=url), PIEDGE: lambda url: PiEdgeClient(base_url=url) PIEDGE: lambda url: PiEdgeClient(base_url=url), } src/edgecloud/core/edgecloud_interface.py +16 −9 Original line number Diff line number Diff line Loading @@ -21,7 +21,8 @@ class EdgeCloudManagementInterface(ABC): @abstractmethod def onboard_app(self, app_manifest: Dict) -> Dict: """ Onboards an app, submitting application metadata to the Edge Cloud Provider. Onboards an app, submitting application metadata to the Edge Cloud Provider. :param app_manifest: Application metadata in dictionary format. :return: Dictionary containing created application details. Loading Loading @@ -62,14 +63,18 @@ class EdgeCloudManagementInterface(ABC): Requests the instantiation of an application instance. :param app_id: Unique identifier of the application. :param app_zones: List of Edge Cloud Zones where the app should be instantiated. :param app_zones: List of Edge Cloud Zones where the app should be instantiated. :return: Dictionary with instance details. """ pass @abstractmethod def get_all_deployed_apps( self, app_id: Optional[str] = None, app_instance_id: Optional[str] = None, region: Optional[str] = None self, app_id: Optional[str] = None, app_instance_id: Optional[str] = None, region: Optional[str] = None, ) -> List[Dict]: """ Retrieves information of application instances. Loading @@ -91,7 +96,9 @@ class EdgeCloudManagementInterface(ABC): pass @abstractmethod def get_edge_cloud_zones(self, region: Optional[str] = None, status: Optional[str] = None) -> List[Dict]: def get_edge_cloud_zones( self, region: Optional[str] = None, status: Optional[str] = None ) -> List[Dict]: """ Retrieves a list of available Edge Cloud Zones. Loading Loading
src/edgecloud/clients/i2edge/client.py +13 −6 Original line number Diff line number Diff line Loading @@ -16,15 +16,22 @@ from src import logger from src.edgecloud.core.edgecloud_interface import EdgeCloudManagementInterface from . import schemas from .common import (I2EdgeError, i2edge_delete, i2edge_get, i2edge_post, i2edge_post_multiform_data) from .common import ( I2EdgeError, i2edge_delete, i2edge_get, i2edge_post, i2edge_post_multiform_data, ) class EdgeApplicationManager(EdgeCloudManagementInterface): def __init__(self, base_url: str): self.base_url = base_url def get_edge_cloud_zones(self, region: Optional[str] = None, status: Optional[str] = None) -> list[dict]: def get_edge_cloud_zones( self, region: Optional[str] = None, status: Optional[str] = None ) -> list[dict]: # Note: status is not supported by i2Edge; won't be used # Up to now; region == av_zone (so if region is specified, that zone will be returned) try: Loading @@ -32,12 +39,12 @@ class EdgeApplicationManager(EdgeCloudManagementInterface): if region is not None: url = "{}/zone/{}".format(self.base_url, region) if status is not None: params['status'] = status params["status"] = status response = i2edge_get(url, params=params) else: url = "{}/zones/list".format(self.base_url) if status is not None: params['status'] = status params["status"] = status response = i2edge_get(url, params=params) return response Loading
src/edgecloud/clients/i2edge/schemas.py +4 −3 Original line number Diff line number Diff line Loading @@ -4,8 +4,7 @@ # Copyright 2025-present by Software Networks Area, i2CAT. # All rights reserved. # # This file is part of the Federation SDK # Unauthorized copying of this file, via any medium is strictly prohibited. # This file is part of the Open SDK # # Contributors: # - Sergio Giménez (sergio.gimenez@i2cat.net) Loading Loading @@ -108,7 +107,9 @@ class ApplicationOnboardingRequest(BaseModel): class GPU(BaseModel): gpuMemory: int = Field(default=0, description="GPU memory in MB") gpuModeName: str = Field(default="", description="GPU mode name") gpuVendorType: str = Field(default="GPU_PROVIDER_NVIDIA", description="GPU vendor type") gpuVendorType: str = Field( default="GPU_PROVIDER_NVIDIA", description="GPU vendor type" ) numGPU: int = Field(..., description="Number of GPUs") Loading
src/edgecloud/clients/i2edge/utils.py +4 −3 Original line number Diff line number Diff line Loading @@ -4,8 +4,7 @@ # Copyright 2025-present by Software Networks Area, i2CAT. # All rights reserved. # # This file is part of the Federation SDK # Unauthorized copying of this file, via any medium is strictly prohibited. # This file is part of the Open SDK # # Contributors: # - Sergio Giménez (sergio.gimenez@i2cat.net) Loading Loading @@ -101,7 +100,9 @@ def onboard_app_with( raise e def delete_app_instance_by(namespace: str, flavour_id: str, zone_id: str, i2edge: I2EdgeClient): def delete_app_instance_by( namespace: str, flavour_id: str, zone_id: str, i2edge: I2EdgeClient ): i2edge_app_instance_name = get_app_name_from(namespace, i2edge) if i2edge_app_instance_name is None: err_msg = "Couldn't retrieve app instance from I2Edge." Loading
src/edgecloud/core/edgecloud_factory.py +11 −13 Original line number Diff line number Diff line Loading @@ -12,21 +12,17 @@ ## from __future__ import annotations from enum import Enum from typing import TYPE_CHECKING from src.edgecloud.clients.aeros.client import \ EdgeApplicationManager as AerosClient from src.edgecloud.clients.dmo.client import \ EdgeApplicationManager as DmoClient from src.edgecloud.clients.i2edge.client import \ EdgeApplicationManager as I2EdgeClient from src.edgecloud.clients.piedge.client import \ EdgeApplicationManager as PiEdgeClient from src.edgecloud.clients.aeros.client import EdgeApplicationManager as AerosClient from src.edgecloud.clients.dmo.client import EdgeApplicationManager as DmoClient from src.edgecloud.clients.i2edge.client import EdgeApplicationManager as I2EdgeClient from src.edgecloud.clients.piedge.client import EdgeApplicationManager as PiEdgeClient if TYPE_CHECKING: from .edgecloud_interface import EdgeCloudInterface class EdgeCloudFactory: """ Factory class for creating EdgeCloud Clients Loading @@ -44,10 +40,12 @@ class EdgeCloudFactory: f"Supported clients are: {', '.join(supported_clients)}" ) class EdgeCloudTypes(): class EdgeCloudTypes: """ Class dedicated for the different types of edgecloud clients. """ I2EDGE = "i2edge" AEROS = "aeros" DMO = "dmo" Loading @@ -57,5 +55,5 @@ class EdgeCloudTypes(): I2EDGE: lambda url: I2EdgeClient(base_url=url), AEROS: lambda url: AerosClient(base_url=url), DMO: lambda url: DmoClient(base_url=url), PIEDGE: lambda url: PiEdgeClient(base_url=url) PIEDGE: lambda url: PiEdgeClient(base_url=url), }
src/edgecloud/core/edgecloud_interface.py +16 −9 Original line number Diff line number Diff line Loading @@ -21,7 +21,8 @@ class EdgeCloudManagementInterface(ABC): @abstractmethod def onboard_app(self, app_manifest: Dict) -> Dict: """ Onboards an app, submitting application metadata to the Edge Cloud Provider. Onboards an app, submitting application metadata to the Edge Cloud Provider. :param app_manifest: Application metadata in dictionary format. :return: Dictionary containing created application details. Loading Loading @@ -62,14 +63,18 @@ class EdgeCloudManagementInterface(ABC): Requests the instantiation of an application instance. :param app_id: Unique identifier of the application. :param app_zones: List of Edge Cloud Zones where the app should be instantiated. :param app_zones: List of Edge Cloud Zones where the app should be instantiated. :return: Dictionary with instance details. """ pass @abstractmethod def get_all_deployed_apps( self, app_id: Optional[str] = None, app_instance_id: Optional[str] = None, region: Optional[str] = None self, app_id: Optional[str] = None, app_instance_id: Optional[str] = None, region: Optional[str] = None, ) -> List[Dict]: """ Retrieves information of application instances. Loading @@ -91,7 +96,9 @@ class EdgeCloudManagementInterface(ABC): pass @abstractmethod def get_edge_cloud_zones(self, region: Optional[str] = None, status: Optional[str] = None) -> List[Dict]: def get_edge_cloud_zones( self, region: Optional[str] = None, status: Optional[str] = None ) -> List[Dict]: """ Retrieves a list of available Edge Cloud Zones. Loading