Commit 2658f44a authored by Adrian Pino's avatar Adrian Pino Committed by GitHub
Browse files

Merge pull request #54 from SunriseOpenOperatorPlatform/feature/add-edgecloud-get-av-zones-details

Add get_edge_cloud_zones_details function
parents 3a4f4af3 8847e7dd
Loading
Loading
Loading
Loading
+39 −0
Original line number Diff line number Diff line
@@ -40,3 +40,42 @@ class EdgeApplicationManager(EdgeCloudManagementInterface):
        self, region: Optional[str] = None, status: Optional[str] = None
    ) -> List[Dict]:
        return [{"edgeCloudZoneId": "zone-1", "status": "active"}]

    def get_edge_cloud_zones_details(
        self, zone_id: str, flavour_id: Optional[str] = None
    ) -> Dict:
        # Minimal mocked response based on required fields of 'ZoneRegisteredData' in GSMA OPG E/WBI API
        return {
            "zoneId": zone_id,
            "reservedComputeResources": [
                {
                    "cpuArchType": "ISA_X86_64",
                    "numCPU": "4",
                    "memory": 8192,
                }
            ],
            "computeResourceQuotaLimits": [
                {
                    "cpuArchType": "ISA_X86_64",
                    "numCPU": "8",
                    "memory": 16384,
                }
            ],
            "flavoursSupported": [
                {
                    "flavourId": "medium-x86",
                    "cpuArchType": "ISA_X86_64",
                    "supportedOSTypes": [
                        {
                            "architecture": "x86_64",
                            "distribution": "UBUNTU",
                            "version": "OS_VERSION_UBUNTU_2204_LTS",
                            "license": "OS_LICENSE_TYPE_FREE",
                        }
                    ],
                    "numCPU": 4,
                    "memorySize": 8192,
                    "storageSize": 100,
                }
            ],
        }
+43 −0
Original line number Diff line number Diff line
@@ -43,6 +43,46 @@ class EdgeApplicationManager(EdgeCloudManagementInterface):
        except I2EdgeError as e:
            raise e

    # Harcoded
    def get_edge_cloud_zones_details(
        self, zone_id: str, flavour_id: Optional[str] = None
    ) -> Dict:
        # Minimal mocked response based on required fields of 'ZoneRegisteredData' in GSMA OPG E/WBI API
        return {
            "zoneId": zone_id,
            "reservedComputeResources": [
                {
                    "cpuArchType": "ISA_X86_64",
                    "numCPU": "4",
                    "memory": 8192,
                }
            ],
            "computeResourceQuotaLimits": [
                {
                    "cpuArchType": "ISA_X86_64",
                    "numCPU": "8",
                    "memory": 16384,
                }
            ],
            "flavoursSupported": [
                {
                    "flavourId": "medium-x86",
                    "cpuArchType": "ISA_X86_64",
                    "supportedOSTypes": [
                        {
                            "architecture": "x86_64",
                            "distribution": "UBUNTU",
                            "version": "OS_VERSION_UBUNTU_2204_LTS",
                            "license": "OS_LICENSE_TYPE_FREE",
                        }
                    ],
                    "numCPU": 4,
                    "memorySize": 8192,
                    "storageSize": 100,
                }
            ],
        }

    def _create_artefact(
        self,
        artefact_id: str,
@@ -139,9 +179,11 @@ class EdgeApplicationManager(EdgeCloudManagementInterface):
        except I2EdgeError as e:
            raise e

    # Harcoded
    def deploy_app(self, app_id: str, app_zones: List[Dict]) -> Dict:
        return {"appInstanceId": "abcd-efgh"}

    # Harcoded
    def get_all_deployed_apps(
        self,
        app_id: Optional[str] = None,
@@ -150,5 +192,6 @@ class EdgeApplicationManager(EdgeCloudManagementInterface):
    ) -> List[Dict]:
        return [{"appInstanceId": "abcd-efgh", "status": "ready"}]

    # Harcoded
    def undeploy_app(self, app_instance_id: str) -> None:
        print(f"Deleting app instance: {app_instance_id}")
+39 −0
Original line number Diff line number Diff line
@@ -113,3 +113,42 @@ class EdgeApplicationManager(EdgeCloudManagementInterface):
            zone["edgeCloudRegion"] = node.get("location")
            zone_list.append(zone)
        return zone_list

    def get_edge_cloud_zones_details(
        self, zone_id: str, flavour_id: Optional[str] = None
    ) -> Dict:
        # Minimal mocked response based on required fields of 'ZoneRegisteredData' in GSMA OPG E/WBI API
        return {
            "zoneId": zone_id,
            "reservedComputeResources": [
                {
                    "cpuArchType": "ISA_X86_64",
                    "numCPU": "4",
                    "memory": 8192,
                }
            ],
            "computeResourceQuotaLimits": [
                {
                    "cpuArchType": "ISA_X86_64",
                    "numCPU": "8",
                    "memory": 16384,
                }
            ],
            "flavoursSupported": [
                {
                    "flavourId": "medium-x86",
                    "cpuArchType": "ISA_X86_64",
                    "supportedOSTypes": [
                        {
                            "architecture": "x86_64",
                            "distribution": "UBUNTU",
                            "version": "OS_VERSION_UBUNTU_2204_LTS",
                            "license": "OS_LICENSE_TYPE_FREE",
                        }
                    ],
                    "numCPU": 4,
                    "memorySize": 8192,
                    "storageSize": 100,
                }
            ],
        }
+14 −0
Original line number Diff line number Diff line
@@ -107,3 +107,17 @@ class EdgeCloudManagementInterface(ABC):
        :return: List of Edge Cloud Zones.
        """
        pass

    @abstractmethod
    def get_edge_cloud_zones_details(
        self, federation_context_id: str, zone_id: str
    ) -> Dict:
        """
        Retrieves details of a specific Edge Cloud Zone reserved
        for the specified zone by the partner OP.

        :param federation_context_id: Identifier of the federation context.
        :param zone_id: Unique identifier of the Edge Cloud Zone.
        :return: Dictionary with Edge Cloud Zone details.
        """
        pass