Package: idrac-ctl
idrac_ctlStandalone command line tool provide option to interact with Dell iDRAC via Redfish
REST API and execute typical workflow. It supports both asynchronous and synchronous options
to interact with iDRAC.boot from remote location via http/httpsboot from remote NFS/CIFSoptimize bios setting for real time workload.basic option related to job and management.  apply/reset pending changes.query any object that IDRAC exposes via REST interface. firmware/driver/status/metricsmanage volumesmanage raidmanage boot sourcemanage secure boot / UEFIand much more..Examples directory contains typical examples.
Project onhttps://pypi.org/manage/project/idrac-ctl/releases/OverviewThis tool provides an option to interact with Dell iDRAC via the command line and execute almost
every workflow you can do via Web UI. The idrac_ctl, by default, outputs everything in JSON,
so you can easily pass it to any other tools to filter. Some commands provide an option to
filter on action or specific fields, and s is still ongoing work. The tool developed in extendability
mind. Each command registered dynamically. It sufficiently indicates the import statement
ininitto load the custom command.Initial stepsSet the environment variable, so you don't need to pass each time.exportIDRAC_IP=MY_IPexportIDRAC_PASSWORD=MY_PASSWORDexportIDRAC_USERNAME=root# root is default.Installpip install idrac_ctl

# and run it as standalone app

idrac_ctl --helpManual installMake sure you are using python >= 3.10Make sure you are using 3.10
conda install -n py310 python=3.10gitclonehttps://github.com/spyroot/idrac_ctl.gitcdidrac_ctl
pipinstall-rrequirements.txt
pythonidrac_ctl.py--helpPlease note i'm still trying to optimize the root menu for easy consumption.
For now, all subcommands are in root, hence format idrac_ctl command optional argsList of subcommands.maincommandlistofidrac_ctlcommandsattrcommandfetchtheattributeviewattr-clear-pendingcommandclearattributependingvaluesbioscommandfetchthebiosinformationbios-changecommandchangebiosvaluesbios-clear-pendingcommandclearbiospendingvaluesbios-registrycommandquerybiosregistrybootcommandfetchthebootsourceboot-clear-pendingcommandclearbootsourcependingvaluesboot-one-shotcommandchangeoneshootbootboot-optioncommandfetchthebootoptionsboot-settingscommandfetchthebootsettingandpendingboot-source-enablecommandenablethebootonaparticulardevice.boot-source-getcommandfetchthebootsourcefordevice/devicesboot-source-listcommandfetchthebootsourcelistchange-boot-ordercommandchangebootorderchassiscommandquerychassisserviceschassis-resetcommandresetchassiscurrent_bootcommandfetchthebootsourcefordevice/devicesdell-lc-svccommandquerydell-lcserviceseject_vmcommandejectthevirtualmediafirmwarefetchthefirmwareviewfirmware_inventoryfetchthefirmwareinventoryviewget_vmfetchthevirtualmediainsert_vmcommandinsertvirtualmediajobcommandfetchajobjob-rmcommanddeleteajobjob-rm-allcommanddeletealljobsjob-watchcommandwatchajobjobscommandfetchalistofjobsjobs-dell-servicecommandqueryjobsservicesjobs-servicecommandqueryjobsservicesmanagerfetchtheattributeviewoem-actionscommandgetsupporteddellosoemactionsoem-attachcommandattachnetworkisooem-attach-statuscommandgetattachstatusoem-boot-netioscommandbootfromnetworkisooem-detachcommanddetachnetworkisooem-disconnectcommanddisconnectnetworkisooem-net-ios-statuscommandgetnetworkisostatusoem-net-iso-taskcommandgetsupporteddellosoemactionspcicommandfetchthepcideviceorfunctionquerycommandquerybasedonresource.raidfetchthebiosinformationrebootrebootsthesystemservice-api-rs-statuscommandfetchserviceapistatusservice-api-statuscommandfetchserviceapistatusstorage-controllerscommandfetchthestorageinformationstorage-convert-noraidcommandconvertsraiddiskundercontrollertononeraidstorage-convert-raidcommandconvertsnoneraiddiskundercontrollertoraidstorage-drivescommandfetchthestoragedrivesinformationstorage-getcommandfetchthestorageinformationstorage-listcommandfetchthestoragedevicessystemcommandfetchthesystemview.system-exportcommandexportssystemconfigurationsystem-importcommandimportsystemconfigurationtaskcommandfetchtask.task-getcommandfetchtasktasks-listcommandfetchtaskslistvolume-getcommandqueryvolumefromstoragedevice.volume-initcommandinitializevolume..volumesfetchthevirtualdiskdataFrom a system we can view all compute system action and attributes.idrac_ctlsystemtrimmed output{"@odata.context":"/redfish/v1/$metadata#ComputerSystem.ComputerSystem","@odata.id":"/redfish/v1/Systems/System.Embedded.1","@odata.type":"#ComputerSystem.v1_16_0.ComputerSystem","Actions":{"#ComputerSystem.Reset":{"ResetType@Redfish.AllowableValues":["On","ForceOff","ForceRestart","GracefulRestart","GracefulShutdown","PushPowerButton","Nmi","PowerCycle"],"target":"/redfish/v1/Systems/System.Embedded.1/Actions/ComputerSystem.Reset"}},"AssetTag":"","Bios":{"@odata.id":"/redfish/v1/Systems/System.Embedded.1/Bios"},If you pass for the same command --deep flag, it will recursively walk for each action
and collect a unified view.Basic BIOS manipulation.For example, we want to disable the memory test, disable the os watch timer, disable the C state,
and enable SRIOV.  Create a spec file and run. Note that many BIOS changes require a host reset.
Therefore, if you have pending changes, these changes must either be applied or reset. Similarly,
when you apply, change must be applied.You can pass --commit --reboot, where commit will commit, i.e., apply change --reboot post-commit.Example change bios from JSON spec.idrac_ctlbios-change--from_spec./my_test.spec.jsonon-reset{"Attributes":{"MemFrequency":"MaxPerf","MemTest":"Disabled","OsWatchdogTimer":"Disabled","ProcCStates":"Disabled","SriovGlobalEnable":"Enabled"}}Example change bios from JSON spec, commit and reboot.idrac_ctlbios-change--from_spec./my_test.spec.json--showon-reset--commit--rebootExample --show the flag. It will generate the final spec command will generate.idrac_ctlbios-change--from_spec./my_test.spec.json--showon-resetCompare values.Before applying the change, you might want to check the current value.
For example first we fetch current values for ProcCStates and SysMemSizeidrac_ctlbios--filterProcCStates,SysMemSizeBy default, output colorize if you need pass or pipe to jq or any other tools
user--nocolorflag.pythonidrac_ctl.py--nocolorbios--filterProcCStates,SysMemSize|jq'.data'{"ProcCStates":"Disabled","SysMemSize":"768 GB"}You can also create query in json file and query many servers at same time.Create query.json[
  "ProcCStates",
  "SysMemSize"
]idrac_ctl--nocolorbios--from_filebios_query.json|jq'.data'## More advanced example. 

Let say we need boot one shot from ISO file from HTTP link and start
unattended kickstart installation.

First, check if any virtual media is already attached and check the device id.
```bash
idrac_ctl get_virtual_mediaIf you need to eject virtual mediapythonidrac_ctl.pyeject_virtual_media--device_id1Now insert virtual media. If you fancy you can start local HTTP listener
and pass your IP.idrac_ctlinsert_virtual_media--uri_pathhttp://10.241.7.99/ubuntu-22.04.1-desktop-amd64.iso--device_id1Confirm that virtual media insertedidrac_ctlget_virtual_mediaWe see image attached from get_virtual_media[{"@odata.context":"/redfish/v1/$metadata#VirtualMedia.VirtualMedia","@odata.id":"/redfish/v1/Systems/System.Embedded.1/VirtualMedia/1","@odata.type":"#VirtualMedia.v1_4_0.VirtualMedia","Actions":{"#VirtualMedia.EjectMedia":{"target":"/redfish/v1/Systems/System.Embedded.1/VirtualMedia/1/Actions/VirtualMedia.EjectMedia"},"#VirtualMedia.InsertMedia":{"target":"/redfish/v1/Systems/System.Embedded.1/VirtualMedia/1/Actions/VirtualMedia.InsertMedia"}},"ConnectedVia":"URI","Description":"iDRAC Virtual Media Instance","Id":"1","Image":"http://10.241.7.99/ubuntu-22.04.1-desktop-amd64.iso","ImageName":"ubuntu-22.04.1-desktop-amd64.iso","Inserted":true,"MediaTypes":["CD","DVD","USBStick"],"MediaTypes@odata.count":3,"Name":"VirtualMedia Instance 1","Password":null,"TransferMethod":"Stream","TransferProtocolType":"HTTP","UserName":null,"WriteProtected":true}]Set BIOS boot in one shot. In this setting on reboot, we will boot from CD-ROM when installation is complete.
BIOS will boot OS from the default location. i.e., whatever is first on the list.idrac_ctlboot_one_shot--deviceCd# note Cd is default anyway# --uefi_target if we need indicate UEFI device id.Now reboot a host.python idrac_ctl.py reboot --reset_type PowerCycle
python idrac_ctl.py reboot --reset_type GracefulRestartNote in my example, we didn't use UEFI.   If you need to use UEFI.
First, get UEFI idsidrac_ctlboot_sourceEach device has a UefiDevicePath key. You can pass this key to insert media action
if you need to boot from UEFI.{"@odata.context":"/redfish/v1/$metadata#BootOption.BootOption","@odata.id":"/redfish/v1/Systems/System.Embedded.1/BootOptions/NIC.Slot.8-1","@odata.type":"#BootOption.v1_0_4.BootOption","BootOptionEnabled":true,"BootOptionReference":"NIC.Slot.8-1","Description":"Current settings of the Legacy Boot option","DisplayName":"NIC in Slot 8 Port 1: IBA ICE Slot D800 v2500","Id":"NIC.Slot.8-1","Name":"Legacy Boot option","UefiDevicePath":"BBS(0x80,IBA ICE Slot D800 v2500)"}Noteidrac_ctlboot_one_shot--uefi_targetExport/Import system configurationThe export config, by default, will create a task and wait for completion. So will see
the status bar progress.  If we don't want to wait, we can pass --the async flag.In this setting, each request to iDRAC send asynchronously, and we don't want results
for job completion.idrac_ctlsystem-export--filenamesystem.json
idrac_ctlsystem-import--configsystem.jsonIf we don't need to wait, we can pass --async. It will create a job, but it will not wait
for a job to complete.idrac_ctlexport--filenamesystem.jsonidrac_ctlexport--filenamesystem.json--asyncThis command will output job_id that we can use with job --job_id to get a job status{"job_id":"JID_745386566338"}You can later fetch a result of job.idrac_ctljob--job_idJID_745386566338Example attaching ISO from CIFS share and using Dell OEM API.Install Samba,  in my case I share /var/www/html/ which I also use for nginxsudoaptinstallsamba
systemctlstatussmbd--no-pager-l
sudosystemctlenable--nowsmbd
sudoufwallowsamba
sudousermod-aGsambashare$USERsudosystemctlstart--nowsmbdecho"[sambashare]comment = Samba on wwwpath = /var/www/html/read only = nobrowsable = yes">>/etc/samba/smb.conf

sudosystemctlrestartsmbdNow we can mount.  Note in my case I use default username vmware and password 123456.idrac_ctloem-attach--ip_addr$CIFS_SERVER--share_namesambashare--remote_imageubuntu-22.04.1-desktop-amd64.isoNow we can check status.idrac_ctloem-attach-status{"DriversAttachStatus":"NotAttached","ISOAttachStatus":"Attached"}python idrac_ctl.py oem-net-ios-status
{
    "HostAttachedStatus": "Attached",
    "HostBootedFromISO": "No",
    "IPAddr": "10.241.7.99",
    "ISOConnectionStatus": "ConnectionUp",
    "ImageName": "ubuntu-22.04.1-desktop-amd64.iso",
    "ShareName": "sambashare",
    "UserName": "vmware"
}Example changing BIOS valuesFirst, obtain a list of all possible attributes and values that BIOS supports.
Note many values we can't change. Keep attention to the read-only flag.Also, note if a reboot is required or not.idrac_ctlbios-registry--attr_listFor example attribute PowerCycleRequest.idrac_ctlbios-registry--attr_namePowerCycleRequest[{"AttributeName":"PowerCycleRequest","CurrentValue":null,"DisplayName":"Power Cycle Request","DisplayOrder":10008,"HelpText":"Specifies how the system reacts when system transitions to S5 state.  When set to None, the transition to S5 is normal.  When set to Full Power Cycle, the system will temporarily be forced into a lower power state, similar to removing and replacing AC.","Hidden":false,"Immutable":false,"MenuPath":"./MiscSettingsRef","ReadOnly":false,"ResetRequired":true,"Type":"Enumeration","Value":[{"ValueDisplayName":"None","ValueName":"None"},{"ValueDisplayName":"Full Power Cycle","ValueName":"FullPowerCycle"}],"WarningText":null,"WriteOnly":false}]We can also query for a BIOS attributes that we can change.Save result to a file and find value that you need change.idrac_ctlbios-registry--filter-read_only-fbios.jsonIn my case I disable Mem Test and enabled MmioAbove4Gbidrac_ctlbios-change--attr_nameMemTest,MmioAbove4Gb--attr_valueDisabled,EnabledPlease use the  [GitHub issue] tracker (https://github.com/spyroot/idrac_ctl/issues) submit bugs or request features.More example TBD.