Debian Codegraph @

ansible_collections/dellemc/openmanage/plugins/module_utils/idrac_utils/info/bios.py

raw symbols SCIP
1 # -*- coding: utf-8 -*-
2
3 # Dell OpenManage Ansible Modules
4 # Version 9.12.0
5 # Copyright (C) 2025 Dell Inc. or its subsidiaries. All Rights Reserved.
6
7 # Redistribution and use in source and binary forms, with or without modification,
8 # are permitted provided that the following conditions are met:
9
10 # * Redistributions of source code must retain the above copyright notice,
11 # this list of conditions and the following disclaimer.
12
13 # * Redistributions in binary form must reproduce the above copyright notice,
14 # this list of conditions and the following disclaimer in the documentation
15 # and/or other materials provided with the distribution.
16
17 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 # IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
21 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
22 # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
25 # USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 #
27
28
29 GET_IDRAC_SYSTEM_URI = "/redfish/v1/Systems/System.Embedded.1"
30 GET_IDRAC_FIRMWARE_URI = "/redfish/v1/UpdateService/Oem/Dell/DellSoftwareInventory"
31
32
33 class IDRACBiosInfo(object):
34 def __init__(self, idrac):
35 self.idrac = idrac
36
37 def get_bios_release_date_and_version_and_symbios(self):
38 response = self.idrac.invoke_request(method='GET', uri=GET_IDRAC_SYSTEM_URI)
39 if response.status_code == 200:
40 version = response.json_data.get("BiosVersion", "")
41 system = response.json_data.get("Oem", {}).get("Dell", {}).get("DellSystem", {})
42 is_symbios_available = "True" if system.get("smbiosGUID", "") else "False"
43 return system.get("BIOSReleaseDate", ""), version, is_symbios_available
44 return "", "", ""
45
46 def get_bios_fqdd_and_instance_id_and_key(self):
47 response = self.idrac.invoke_request(method='GET', uri=GET_IDRAC_FIRMWARE_URI)
48 if response.status_code == 200:
49 members = response.json_data.get("Members")
50 for each in members:
51 if each.get('ElementName', '') == 'BIOS' and each.get('Status', '') == 'Installed':
52 instance_id = each.get('Id')
53 fqdd = instance_id.split('__')[-1]
54 key = fqdd
55 return fqdd, instance_id, key
56 return "", "", ""
57
58 def get_bios_system_info(self):
59 output = {
60 "BIOSReleaseDate": "",
61 "FQDD": "",
62 "InstanceID": "",
63 "Key": "",
64 "SMBIOSPresent": "",
65 "VersionString": ""
66 }
67 release, version, symbios = self.get_bios_release_date_and_version_and_symbios()
68 fqdd, instance_id, key = self.get_bios_fqdd_and_instance_id_and_key()
69 output["BIOSReleaseDate"] = release
70 output["VersionString"] = version
71 output["SMBIOSPresent"] = symbios
72 output["FQDD"] = fqdd
73 output["InstanceID"] = instance_id
74 output["Key"] = key
75 return [output]