Hardware Script python reference

Main interface functions wrapped with lmi commands are:

All of these accept ns object as the first argument, an instance of lmi.shell.LMINamespace.

Hardware Module API

LMI hardware provider client library.

lmi.scripts.hardware.format_memory_size(size)

Returns formatted memory size.

Parameters:size (Number) – Size in bytes
Returns:Formatted size string.
Return type:String
lmi.scripts.hardware.get_all_info(ns)

Prints tabular data of all available info.

lmi.scripts.hardware.get_all_instances(ns, class_name)

Returns all instances of instance_name.

Parameters:instance_name (String) – Instance name
Returns:List of instances of instance_name
Return type:List of lmi.shell.LMIInstance
lmi.scripts.hardware.get_colored_string(msg, color)

Returns colored message with ANSI escape sequences for terminal.

Parameters:
  • msg (String) – Message to be colored.
  • color (Integer) – Color of the message [GREEN_COLOR, YELLOW_COLOR, RED_COLOR].
Returns:

Colored message.

Return type:

String

lmi.scripts.hardware.get_cpu_info(ns)

Prints tabular data of processor info.

lmi.scripts.hardware.get_disks_info(ns)

Prints tabular data of disk info.

lmi.scripts.hardware.get_hostname(ns)
Returns:System hostname.
Return type:String
lmi.scripts.hardware.get_memory_info(ns)

Prints tabular data of memory info.

lmi.scripts.hardware.get_motherboard_info(ns)

Prints tabular data of motherboard info.

lmi.scripts.hardware.get_pci_info(ns)

Prints tabular data of PCI devices info.

lmi.scripts.hardware.get_pci_list(ns, pcis, bus=0, level=0)

Recursive function, returns list of PCI devices ready for TableFormatter.

Parameters:
  • ns (lmi.shell.LMINamespace.LMINamespace) – LMI Namespace.
  • pcis (List) – Sorted list of PCI devices and bridges.
  • bus (Integer) – ID of PCI bus for this level.
  • level (Integer) – Level of recursion.
Returns:

Formatted list of tuples of PCI devices.

Return type:

List of tuples

lmi.scripts.hardware.get_single_instance(ns, class_name)

Returns single instance of instance_name.

Parameters:instance_name (String) – Instance name
Returns:Instance of instance_name
Return type:lmi.shell.LMIInstance
lmi.scripts.hardware.get_system_info(ns)

Prints tabular data of system info, from the LMI_Chassis instance.