blob: b9fb2aab3e34b5f0c9bec3362a59d6e9bf9aff4a [file] [log] [blame]
George Keishing72abe822019-07-29 08:03:40 -05001*** Settings ***
2Documentation Redfish BMC and PNOR software utilities keywords.
3
4Library code_update_utils.py
5Library gen_robot_valid.py
6Resource bmc_redfish_utils.robot
7
8*** Keywords ***
9
10Get Software Functional State
11 [Documentation] Return functional or active state of the software (i.e. True/False).
12 [Arguments] ${image_id}
13
14 # Description of argument(s):
15 # image_id The image ID (e.g. "acc9e073").
16
17 ${image_info}= Redfish.Get Properties /redfish/v1/UpdateService/FirmwareInventory/${image_id}
18
19 ${sw_functional}= Run Keyword If '${image_info["Description"]}' == 'BMC update'
20 ... Redfish.Get Attribute /redfish/v1/Managers/bmc FirmwareVersion
21 ... ELSE
22 ... Redfish.Get Attribute /redfish/v1/Systems/system BiosVersion
23
24 ${functional}= Run Keyword And Return Status
25 ... Should Be Equal ${sw_functional} ${image_info["Version"]}
26
27 [Return] ${functional}
28
29
30Get Software Inventory State
31 [Documentation] Return dictionary of the image type, version and functional state
32 ... of the software objects active on the system.
33
34 # User defined state for software objects.
35 # Note: "Functional" term refers to firmware which system is currently booted with.
36 # sw_inv_dict:
37 # [ace821ef]:
38 # [image_type]: Host update
39 # [functional]: True
40 # [version]: witherspoon-xx.xx.xx.xx
41 # [b9101858]:
42 # [image_type]: BMC update
43 # [functional]: True
44 # [version]: 2.8.0-dev-150-g04508dc9f
45 # [c45eafa5]:
46 # [image_type]: BMC update
47 # [functional]: False
48 # [version]: 2.8.0-dev-149-g1a8df5077
49
50 ${sw_member_list}= Redfish_Utils.Get Member List /redfish/v1/UpdateService/FirmwareInventory
51 &{sw_inv_dict}= Create Dictionary
52
53 # sw_member_list:
54 # [0]: /redfish/v1/UpdateService/FirmwareInventory/98744d76
55 # [1]: /redfish/v1/UpdateService/FirmwareInventory/9a8028ec
56 # [2]: /redfish/v1/UpdateService/FirmwareInventory/acc9e073
57
58 FOR ${uri_path} IN @{sw_member_list}
59 &{tmp_dict}= Create Dictionary
60 ${image_info}= Redfish.Get Properties ${uri_path}
61 Set To Dictionary ${tmp_dict} image_type ${image_info["Description"]}
62 ${functional}= Get Software Functional State ${uri_path.split("/")[-1]}
63 Set To Dictionary ${tmp_dict} functional ${functional}
64 Set To Dictionary ${sw_inv_dict} ${uri_path.split("/")[-1]} ${tmp_dict}
65 Set To Dictionary ${tmp_dict} version ${image_info["Version"]}
66 END
67
68 [Return] &{sw_inv_dict}