<s> """<STR_LIT>""" <EOL> from proliantutils . ilo import ipmi <EOL> from proliantutils . ilo import operations <EOL> from proliantutils . ilo import ribcl <EOL> from proliantutils . ilo import ris <EOL> from proliantutils import log <EOL> SUPPORTED_RIS_METHODS = [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> ] <EOL> LOG = log . get_logger ( __name__ ) <EOL> class IloClient ( operations . IloOperations ) : <EOL> def __init__ ( self , host , login , password , timeout = <NUM_LIT> , port = <NUM_LIT> , <EOL> bios_password = None , cacert = None ) : <EOL> self . ribcl = ribcl . RIBCLOperations ( host , login , password , timeout , <EOL> port , cacert = cacert ) <EOL> self . ris = ris . RISOperations ( host , login , password , <EOL> bios_password = bios_password , <EOL> cacert = cacert ) <EOL> self . info = { '<STR_LIT:address>' : host , '<STR_LIT:username>' : login , '<STR_LIT:password>' : password } <EOL> self . host = host <EOL> self . model = self . ribcl . get_product_name ( ) <EOL> LOG . debug ( self . _ ( "<STR_LIT>" <EOL> "<STR_LIT>" ) , { '<STR_LIT>' : self . model } ) <EOL> def _call_method ( self , method_name , * args , ** kwargs ) : <EOL> """<STR_LIT>""" <EOL> the_operation_object = self . ribcl <EOL> if ( '<STR_LIT>' in self . model ) and ( method_name in SUPPORTED_RIS_METHODS ) : <EOL> the_operation_object = self . ris <EOL> method = getattr ( the_operation_object , method_name ) <EOL> LOG . debug ( self . _ ( "<STR_LIT>" ) , <EOL> { '<STR_LIT:class>' : type ( the_operation_object ) . __name__ , <EOL> '<STR_LIT>' : method_name } ) <EOL> return method ( * args , ** kwargs ) <EOL> def get_all_licenses ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . _call_method ( '<STR_LIT>' ) <EOL> def get_product_name ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . _call_method ( '<STR_LIT>' ) <EOL> def get_host_power_status ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . _call_method ( '<STR_LIT>' ) <EOL> def get_http_boot_url ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . _call_method ( '<STR_LIT>' ) <EOL> def set_http_boot_url ( self , url ) : <EOL> """<STR_LIT>""" <EOL> return self . _call_method ( '<STR_LIT>' , url ) <EOL> def set_iscsi_boot_info ( self , mac , target_name , lun , ip_address , <EOL> port = '<STR_LIT>' , auth_method = None , username = None , <EOL> password = None ) : <EOL> """<STR_LIT>""" <EOL> return self . _call_method ( '<STR_LIT>' , mac , target_name , lun , <EOL> ip_address , port , auth_method , username , <EOL> password ) <EOL> def get_one_time_boot ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . _call_method ( '<STR_LIT>' ) <EOL> def get_vm_status ( self , device = '<STR_LIT>' ) : <EOL> """<STR_LIT>""" <EOL> return self . _call_method ( '<STR_LIT>' , device ) <EOL> def reset_server ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . _call_method ( '<STR_LIT>' ) <EOL> def press_pwr_btn ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . _call_method ( '<STR_LIT>' ) <EOL> def hold_pwr_btn ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . _call_method ( '<STR_LIT>' ) <EOL> def set_host_power ( self , power ) : <EOL> """<STR_LIT>""" <EOL> return self . _call_method ( '<STR_LIT>' , power ) <EOL> def set_one_time_boot ( self , value ) : <EOL> """<STR_LIT>""" <EOL> return self . _call_method ( '<STR_LIT>' , value ) <EOL> def insert_virtual_media ( self , url , device = '<STR_LIT>' ) : <EOL> """<STR_LIT>""" <EOL> return self . _call_method ( '<STR_LIT>' , url , device ) <EOL> def eject_virtual_media ( self , device = '<STR_LIT>' ) : <EOL> """<STR_LIT>""" <EOL> return self . _call_method ( '<STR_LIT>' , device ) <EOL> def set_vm_status ( self , device = '<STR_LIT>' , <EOL> boot_option = '<STR_LIT>' , write_protect = '<STR_LIT>' ) : <EOL> """<STR_LIT>""" <EOL> return self . _call_method ( '<STR_LIT>' , device , boot_option , <EOL> write_protect ) <EOL> def get_current_boot_mode ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . _call_method ( '<STR_LIT>' ) <EOL> def get_pending_boot_mode ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . _call_method ( '<STR_LIT>' ) <EOL> def get_supported_boot_mode ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . _call_method ( '<STR_LIT>' ) <EOL> def set_pending_boot_mode ( self , value ) : <EOL> """<STR_LIT>""" <EOL> return self . _call_method ( '<STR_LIT>' , value ) <EOL> def get_persistent_boot_device ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . _call_method ( '<STR_LIT>' ) <EOL> def update_persistent_boot ( self , device_type = [ ] ) : <EOL> """<STR_LIT>""" <EOL> return self . _call_method ( '<STR_LIT>' , device_type ) <EOL> def get_secure_boot_mode ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . _call_method ( '<STR_LIT>' ) <EOL> def set_secure_boot_mode ( self , secure_boot_enable ) : <EOL> """<STR_LIT>""" <EOL> return self . _call_method ( '<STR_LIT>' , secure_boot_enable ) <EOL> def reset_secure_boot_keys ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . _call_method ( '<STR_LIT>' ) <EOL> def clear_secure_boot_keys ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . _call_method ( '<STR_LIT>' ) <EOL> def reset_ilo_credential ( self , password ) : <EOL> """<STR_LIT>""" <EOL> return self . _call_method ( '<STR_LIT>' , password ) <EOL> def reset_ilo ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . _call_method ( '<STR_LIT>' ) <EOL> def reset_bios_to_default ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . _call_method ( '<STR_LIT>' ) <EOL> def get_host_uuid ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . _call_method ( '<STR_LIT>' ) <EOL> def get_host_health_data ( self , data = None ) : <EOL> """<STR_LIT>""" <EOL> return self . _call_method ( '<STR_LIT>' , data ) <EOL> def get_host_health_present_power_reading ( self , data = None ) : <EOL> """<STR_LIT>""" <EOL> return self . _call_method ( '<STR_LIT>' , data ) <EOL> def get_host_health_power_supplies ( self , data = None ) : <EOL> """<STR_LIT>""" <EOL> return self . _call_method ( '<STR_LIT>' , data ) <EOL> def get_host_health_fan_sensors ( self , data = None ) : <EOL> """<STR_LIT>""" <EOL> return self . _call_method ( '<STR_LIT>' , data ) <EOL> def get_host_health_temperature_sensors ( self , data = None ) : <EOL> """<STR_LIT>""" <EOL> return self . _call_method ( '<STR_LIT>' , data ) <EOL> def get_host_health_at_a_glance ( self , data = None ) : <EOL> """<STR_LIT>""" <EOL> return self . _call_method ( '<STR_LIT>' , data ) <EOL> def get_host_power_readings ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . _call_method ( '<STR_LIT>' ) <EOL> def get_essential_properties ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . _call_method ( '<STR_LIT>' ) <EOL> def get_server_capabilities ( self ) : <EOL> """<STR_LIT>""" <EOL> capabilities = { } <EOL> if '<STR_LIT>' in self . model : <EOL> capabilities = self . ris . get_server_capabilities ( ) <EOL> data = self . ribcl . get_host_health_data ( ) <EOL> gpu = self . ribcl . _get_number_of_gpu_devices_connected ( data ) <EOL> capabilities . update ( gpu ) <EOL> major_minor = self . ris . get_ilo_firmware_version_as_major_minor ( ) <EOL> else : <EOL> capabilities = self . ribcl . get_server_capabilities ( ) <EOL> major_minor = self . ribcl . get_ilo_firmware_version_as_major_minor ( ) <EOL> nic_capacity = ipmi . get_nic_capacity ( self . info , major_minor ) <EOL> if nic_capacity : <EOL> capabilities . update ( { '<STR_LIT>' : nic_capacity } ) <EOL> if capabilities : <EOL> return capabilities <EOL> def activate_license ( self , key ) : <EOL> """<STR_LIT>""" <EOL> return self . _call_method ( '<STR_LIT>' , key ) <EOL> def update_firmware ( self , firmware_url , component_type ) : <EOL> """<STR_LIT>""" <EOL> return self . _call_method ( <EOL> '<STR_LIT>' , firmware_url , component_type ) </s>
