Loading src/edgecloud/clients/i2edge/client.py +8 −36 Original line number Diff line number Diff line Loading @@ -43,45 +43,17 @@ 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, } ], } url = "{}zone/{}".format(self.base_url, zone_id) params = {} try: response = i2edge_get(url, params=params) log.info("Availability zone details retrieved successfully") return response except I2EdgeError as e: raise e def _create_artefact( self, Loading tests/edgecloud/test_2_av_zones.py +26 −0 Original line number Diff line number Diff line Loading @@ -5,6 +5,8 @@ from src.edgecloud.clients.errors import EdgeCloudPlatformError from src.edgecloud.core.edgecloud_factory import EdgeCloudFactory from tests.edgecloud.test_cases import test_cases zone_id = "Omega" @pytest.mark.parametrize("client_name, base_url", test_cases) def test_get_edge_cloud_zones(client_name, base_url): Loading @@ -20,3 +22,27 @@ def test_get_edge_cloud_zones(client_name, base_url): assert "geographyDetails" in zone except EdgeCloudPlatformError as e: pytest.fail(f"Failed to retrieve zones: {e}") @pytest.mark.parametrize("client_name, base_url", test_cases) def test_get_edge_cloud_zones_details(client_name, base_url, zone_id="Omega"): """ Test that get_edge_cloud_zone_details returns valid responses for each client. Since each client has different response formats, we only verify basic success criteria. """ edgecloud_platform = EdgeCloudFactory.create_edgecloud_client(client_name, base_url) try: zones = edgecloud_platform.get_edge_cloud_zones() assert len(zones) > 0, "No zones available for testing" zone_details = edgecloud_platform.get_edge_cloud_zones_details(zone_id) # Basic checks that apply to all clients assert zone_details is not None, "Zone details should not be None" assert isinstance(zone_details, dict), "Zone details should be a dictionary" assert len(zone_details) > 0, "Zone details should not be empty" except EdgeCloudPlatformError as e: pytest.fail(f"Failed to retrieve zone details: {e}") except KeyError as e: pytest.fail(f"Missing expected key in response: {e}") Loading
src/edgecloud/clients/i2edge/client.py +8 −36 Original line number Diff line number Diff line Loading @@ -43,45 +43,17 @@ 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, } ], } url = "{}zone/{}".format(self.base_url, zone_id) params = {} try: response = i2edge_get(url, params=params) log.info("Availability zone details retrieved successfully") return response except I2EdgeError as e: raise e def _create_artefact( self, Loading
tests/edgecloud/test_2_av_zones.py +26 −0 Original line number Diff line number Diff line Loading @@ -5,6 +5,8 @@ from src.edgecloud.clients.errors import EdgeCloudPlatformError from src.edgecloud.core.edgecloud_factory import EdgeCloudFactory from tests.edgecloud.test_cases import test_cases zone_id = "Omega" @pytest.mark.parametrize("client_name, base_url", test_cases) def test_get_edge_cloud_zones(client_name, base_url): Loading @@ -20,3 +22,27 @@ def test_get_edge_cloud_zones(client_name, base_url): assert "geographyDetails" in zone except EdgeCloudPlatformError as e: pytest.fail(f"Failed to retrieve zones: {e}") @pytest.mark.parametrize("client_name, base_url", test_cases) def test_get_edge_cloud_zones_details(client_name, base_url, zone_id="Omega"): """ Test that get_edge_cloud_zone_details returns valid responses for each client. Since each client has different response formats, we only verify basic success criteria. """ edgecloud_platform = EdgeCloudFactory.create_edgecloud_client(client_name, base_url) try: zones = edgecloud_platform.get_edge_cloud_zones() assert len(zones) > 0, "No zones available for testing" zone_details = edgecloud_platform.get_edge_cloud_zones_details(zone_id) # Basic checks that apply to all clients assert zone_details is not None, "Zone details should not be None" assert isinstance(zone_details, dict), "Zone details should be a dictionary" assert len(zone_details) > 0, "Zone details should not be empty" except EdgeCloudPlatformError as e: pytest.fail(f"Failed to retrieve zone details: {e}") except KeyError as e: pytest.fail(f"Missing expected key in response: {e}")