Browse Source

Provide last system inventory time

This change provides the time system inventory was last performed
by the iDRAC. That is done during system restart and referred to as
Collect System Inventory on Restart (CSIOR). The value is represented
in yyyymmddHHMMSS format.

Change-Id: I73ff5eb517528afe56b5cf45a74fa5d5519db186
Closes-Bug: #1894938
(cherry picked from commit a4c819e304)
changes/96/757796/1
Yogesh Ramachandra 2 years ago
parent
commit
b8a31b37d1
  1. 7
      dracclient/resources/inventory.py
  2. 3
      dracclient/tests/test_inventory.py
  3. 1
      dracclient/tests/wsman_mocks/system_view-enum-ok.xml

7
dracclient/resources/inventory.py

@ -59,7 +59,8 @@ NIC = collections.namedtuple(
System = collections.namedtuple(
'System',
['id', 'lcc_version', 'model', 'service_tag', 'uuid'])
['id', 'lcc_version', 'model', 'service_tag', 'uuid',
'last_system_inventory_time'])
class InventoryManagement(object):
@ -210,7 +211,9 @@ class InventoryManagement(object):
service_tag=self._get_system_attr(drac_system, 'ServiceTag'),
model=self._get_system_attr(drac_system, 'Model'),
lcc_version=self._get_system_attr(drac_system,
'LifecycleControllerVersion'))
'LifecycleControllerVersion'),
last_system_inventory_time=self._get_system_attr(
drac_system, 'LastSystemInventoryTime').split('.')[0])
def _get_system_attr(self, drac_system, attr_name):
return utils.get_wsman_resource_attr(drac_system,

3
dracclient/tests/test_inventory.py

@ -138,7 +138,8 @@ class ClientInventoryManagementTestCase(base.BaseTest):
uuid='ebd4edd3-dfd7-4c7d-a2c8-562b3c23b811',
service_tag='A1B2C3D',
model='PowerEdge R630',
lcc_version='2.1.0')
lcc_version='2.1.0',
last_system_inventory_time='20200902160859')
mock_requests.post(
'https://1.2.3.4:443/wsman',
text=test_utils.LifecycleControllerEnumerations[

1
dracclient/tests/wsman_mocks/system_view-enum-ok.xml

@ -17,6 +17,7 @@
<n1:LifecycleControllerVersion>2.1.0</n1:LifecycleControllerVersion>
<n1:Model>PowerEdge R630</n1:Model>
<n1:ServiceTag>A1B2C3D</n1:ServiceTag>
<n1:LastSystemInventoryTime>20200902160859.000000+000</n1:LastSystemInventoryTime>
<n1:UUID>ebd4edd3-dfd7-4c7d-a2c8-562b3c23b811</n1:UUID>
</n1:DCIM_SystemView>
</wsman:Items>

Loading…
Cancel
Save