def test_get_resource_identity(self): self.assertIsNone(rsd_lib_utils.get_resource_identity(None)) self.assertIsNone(rsd_lib_utils.get_resource_identity({})) self.assertEqual( '/redfish/v1/Systems/437XR1138R2/BIOS', rsd_lib_utils.get_resource_identity( {"@odata.id": "/redfish/v1/Systems/437XR1138R2/BIOS"}))
def _get_endpoint_collection_path(self): """Helper function to find the EndpointCollection path""" endpoint_col = self.json.get('Endpoints') if not endpoint_col: raise exceptions.MissingAttributeError(attribute='Endpoints', resource=self._path) return rsd_lib_utils.get_resource_identity(endpoint_col)
def _get_metric_definitions_path(self): """Helper function to find the metric definitions path""" metrics = self.json.get('MetricDefinitions') if not metrics: raise exceptions.MissingAttributeError( attribute='MetricDefinitions', resource=self._path) return utils.get_resource_identity(metrics)
def _get_metrics_path(self): """Helper function to find the System process metrics path""" metrics = self.json.get('Oem').get('Intel_RackScale').get('Metrics') if not metrics: raise exceptions.MissingAttributeError( attribute='Processor Metrics', resource=self._path) return utils.get_resource_identity(metrics)
def _get_allocated_volumes_path(self): """Helper function to find the AllocatedVolumes path""" volume_col = self.json.get('AllocatedVolumes') if not volume_col: raise exceptions.MissingAttributeError( attribute='AllocatedVolumes', resource=self._path) return rsd_lib_utils.get_resource_identity(volume_col)
def _get_allocated_pools_path(self): """Helper function to find the AllocatedPools path""" storage_pool_col = self.json.get('AllocatedPools') if not storage_pool_col: raise exceptions.MissingAttributeError(attribute='AllocatedPools', resource=self._path) return rsd_lib_utils.get_resource_identity(storage_pool_col)
def _get_storage_pool_collection_path(self): """Helper function to find the StoragePoolCollection path""" storage_pool_col = self.json.get('StoragePools') if not storage_pool_col: raise exceptions.MissingAttributeError(attribute='StoragePools', resource=self._path) return utils.get_resource_identity(storage_pool_col)
def _get_volume_collection_path(self): """Helper function to find the VolumeCollection path""" volume_col = self.json.get('Volumes') if not volume_col: raise exceptions.MissingAttributeError(attribute='Volumes', resource=self._path) return utils.get_resource_identity(volume_col)
def _get_drive_collection_path(self): """Helper function to find the DriveCollection path""" drive_col = self.json.get('Drives') if not drive_col: raise exceptions.MissingAttributeError(attribute='Drives', resource=self._path) return utils.get_resource_identity(drive_col)
def _get_zone_collection_path(self): """Helper function to find the ZoneCollection path""" zone_col = self.json.get('Zones') if not zone_col: raise exceptions.MissingAttributeError(attribute='Zones', resource=self._path) return rsd_lib_utils.get_resource_identity(zone_col)