def _get_hpe_sub_resource_collection_path(self, sub_res): path = None try: path = utils.get_subresource_path_by(self, sub_res) except exception.MissingAttributeError: path = utils.get_subresource_path_by( self, ['Oem', 'Hpe', 'Links', sub_res]) return path
def set_license(self, key): """Set the license on a redfish system :param key: license key """ data = {'LicenseKey': key} license_service_uri = (utils.get_subresource_path_by( self, ['Oem', 'Hpe', 'Links', 'LicenseService'])) self._conn.post(license_service_uri, data=data)
def get_account_service(self): """Return a HPEAccountService object""" account_service_url = utils.get_subresource_path_by( self, 'AccountService') return (account_service.HPEAccountService( self._conn, account_service_url, redfish_version=self.redfish_version))
def get_update_service(self): """Return a HPEUpdateService object :returns: The UpdateService object """ update_service_url = utils.get_subresource_path_by( self, 'UpdateService') return (update_service.HPEUpdateService( self._conn, update_service_url, redfish_version=self.redfish_version))
def _get_base_configs(self): """Method that returns object of bios base configs.""" if self._base_configs is None: self._base_configs = BIOSBaseConfigs( self._conn, utils.get_subresource_path_by( self, ["Oem", "Hpe", "Links", "BaseConfigs"]), redfish_version=self.redfish_version) self._base_configs.refresh(force=False) return self._base_configs
def accounts(self): """Property to provide instance of HPEAccountCollection """ if self._accounts is None: self._accounts = account.HPEAccountCollection( self._conn, utils.get_subresource_path_by(self, 'Accounts'), redfish_version=self.redfish_version) self._accounts.refresh(force=False) return self._accounts
def physical_drives(self): """Gets the resource HPEPhysicalDriveCollection of ArrayControllers""" if self._physical_drives is None: self._physical_drives = (physical_drive.HPEPhysicalDriveCollection( self._conn, utils.get_subresource_path_by(self, ['Links', 'PhysicalDrives']), redfish_version=self.redfish_version)) self._physical_drives.refresh(force=False) return self._physical_drives
def volumes(self): """This property prepares the list of volumes :return a list of volumes. """ if self._volumes is None: self._volumes = sys_volumes.VolumeCollection( self._conn, utils.get_subresource_path_by(self, 'Volumes'), redfish_version=self.redfish_version) self._volumes.refresh(force=False) return self._volumes
def simple_storages(self): """This property gets the list of instances for SimpleStorages :returns: a list of instances of SimpleStorages """ if self._simple_storages is None: self._simple_storages = simple_storage.SimpleStorageCollection( self._conn, utils.get_subresource_path_by(self, 'SimpleStorage'), redfish_version=self.redfish_version) self._simple_storages.refresh(force=False) return self._simple_storages
def memory(self): """Property to provide reference to `MemoryCollection` instance It is calculated once when the first time it is queried. On refresh, this property gets reset. """ if self._memory is None: self._memory = memory.MemoryCollection( self._conn, utils.get_subresource_path_by(self, 'Memory'), redfish_version=self.redfish_version) self._memory.refresh(force=False) return self._memory
def virtual_media(self): """Property to provide reference to `VirtualMediaCollection` instance. It is calculated once when the first time it is queried. On refresh, this property gets reset. """ if self._virtual_media is None: self._virtual_media = virtual_media.VirtualMediaCollection( self._conn, utils.get_subresource_path_by(self, 'VirtualMedia'), redfish_version=self.redfish_version) self._virtual_media.refresh(force=False) return self._virtual_media
def pci_devices(self): """Provides the collection of PCI devices It is calculated once when the first time it is queried. On refresh, this property gets reset. """ if self._pci_devices is None: self._pci_devices = pci_device.PCIDeviceCollection( self._conn, utils.get_subresource_path_by( self, ['Oem', 'Hpe', 'Links', 'PCIDevices'])) self._pci_devices.refresh(force=False) return self._pci_devices
def secure_boot(self): """Property to provide reference to `SecureBoot` instance It is calculated once when the first time it is queried. On refresh, this property gets reset. """ if self._secure_boot is None: self._secure_boot = secure_boot.SecureBoot( self._conn, utils.get_subresource_path_by(self, 'SecureBoot'), redfish_version=self.redfish_version) self._secure_boot.refresh(force=False) return self._secure_boot
def bios_settings(self): """Property to provide reference to `BIOSSettings` instance It is calculated once when the first time it is queried. On refresh, this property gets reset. """ if self._bios_settings is None: self._bios_settings = bios.BIOSSettings( self._conn, utils.get_subresource_path_by(self, 'Bios'), redfish_version=self.redfish_version) self._bios_settings.refresh(force=False) return self._bios_settings
def boot_settings(self): """Property to provide reference to bios boot instance It is calculated once when the first time it is queried. On refresh, this property gets reset. """ if self._boot_settings is None: self._boot_settings = BIOSBootSettings( self._conn, utils.get_subresource_path_by(self, ["Oem", "Hpe", "Links", "Boot"]), redfish_version=self.redfish_version) self._boot_settings.refresh(force=False) return self._boot_settings
def iscsi_resource(self): """Property to provide reference to bios iscsi resource instance It is calculated once when the first time it is queried. On refresh, this property gets reset. """ if self._iscsi_resource is None: self._iscsi_resource = iscsi.ISCSIResource( self._conn, utils.get_subresource_path_by( self, ["Oem", "Hpe", "Links", "iScsi"]), redfish_version=self.redfish_version) self._iscsi_resource.refresh(force=False) return self._iscsi_resource
def iscsi_settings(self): """Property to provide reference to iSCSI settings instance It is calculated once when the first time it is queried. On refresh, this property gets reset. """ if self._iscsi_settings is None: self._iscsi_settings = ISCSISettings( self._conn, utils.get_subresource_path_by( self, ["@Redfish.Settings", "SettingsObject"]), redfish_version=self.redfish_version) self._iscsi_settings.refresh(force=False) return self._iscsi_settings
def smart_storage(self): """This property gets the object for smart storage. This property gets the object for smart storage. There is no collection for smart storages. :returns: an instance of smart storage """ if self._smart_storage is None: self._smart_storage = hpe_smart_storage.HPESmartStorage( self._conn, utils.get_subresource_path_by( self, ['Oem', 'Hpe', 'Links', 'SmartStorage']), redfish_version=self.redfish_version) self._smart_storage.refresh(force=False) return self._smart_storage
def array_controllers(self): """This property gets the list of instances for array controllers This property gets the list of instances for array controllers :returns: a list of instances of array controllers. """ if self._array_controllers is None: self._array_controllers = ( array_controller.HPEArrayControllerCollection( self._conn, utils.get_subresource_path_by( self, ['Links', 'ArrayControllers']), redfish_version=self.redfish_version)) self._array_controllers.refresh(force=False) return self._array_controllers
def get_manager_collection_path(self): return utils.get_subresource_path_by(self, 'Managers')
def test_get_subresource_path_by(self, subresource_path, expected_result): value = utils.get_subresource_path_by(self.sys_inst, subresource_path) self.assertEqual(expected_result, value)
def get_system_collection_path(self): return utils.get_subresource_path_by(self, 'Systems')