mirror of
https://github.com/Telecominfraproject/OpenNetworkLinux.git
synced 2025-12-26 17:57:01 +00:00
Add DMI information for x86_64 platforms.
This commit is contained in:
@@ -3,7 +3,7 @@ prerequisites:
|
||||
|
||||
packages:
|
||||
- name: onl-vendor-config-onl
|
||||
depends: [ python-yaml, onl-bootd ]
|
||||
depends: [ python-yaml, onl-bootd, python-dmidecode ]
|
||||
version: 1.0.0
|
||||
arch: all
|
||||
copyright: Copyright 2013, 2014, 2015 Big Switch Networks
|
||||
|
||||
@@ -16,6 +16,7 @@ import re
|
||||
import yaml
|
||||
import onl.YamlUtils
|
||||
import subprocess
|
||||
import platform
|
||||
|
||||
class OnlInfoObject(object):
|
||||
DEFAULT_INDENT=" "
|
||||
@@ -43,6 +44,9 @@ class OnlInfoObject(object):
|
||||
"""String representation of the information container."""
|
||||
return OnlInfoObject.string(self._data, indent)
|
||||
|
||||
def update(self, d):
|
||||
self._data.update(d)
|
||||
|
||||
@staticmethod
|
||||
def string(d, indent=DEFAULT_INDENT):
|
||||
return "\n".join( sorted("%s%s: %s" % (indent,k,v) for k,v in d.iteritems() if not k.startswith('_') and d[k] is not None and k != 'CRC'))
|
||||
@@ -114,6 +118,8 @@ class OnlPlatformBase(object):
|
||||
self.add_info_json("platform_info", "%s/platform-info.json" % self.basedir_onl(), PlatformInfo,
|
||||
required=False)
|
||||
|
||||
self.platform_info.update(self.dmi_versions())
|
||||
|
||||
# Find the base platform config
|
||||
if self.platform().startswith('x86-64'):
|
||||
y1 = self.CONFIG_DEFAULT_GRUB
|
||||
@@ -224,6 +230,35 @@ class OnlPlatformBase(object):
|
||||
def firmware_version(self):
|
||||
return self.platform_info.CPLD_VERSIONS
|
||||
|
||||
def dmi_versions(self):
|
||||
# Note - the dmidecode module returns empty lists for powerpc systems.
|
||||
if platform.machine() != "x86_64":
|
||||
return {}
|
||||
|
||||
import dmidecode
|
||||
fields = [
|
||||
{
|
||||
'name': 'DMI BIOS Version',
|
||||
'subsystem': dmidecode.bios,
|
||||
'dmi_type' : 0,
|
||||
'key' : 'Version',
|
||||
},
|
||||
|
||||
{
|
||||
'name': 'DMI System Version',
|
||||
'subsystem': dmidecode.system,
|
||||
'dmi_type' : 1,
|
||||
'key' : 'Version',
|
||||
},
|
||||
]
|
||||
rv = {}
|
||||
for field in fields:
|
||||
for v in field['subsystem']().values():
|
||||
if type(v) is dict and v['dmi_type'] == field['dmi_type']:
|
||||
rv[field['name']] = v['data'][field['key']]
|
||||
|
||||
return rv
|
||||
|
||||
def upgrade_manifest(self, type_, override_dir=None):
|
||||
if override_dir:
|
||||
m = os.path.join(override_dir, "manifest.json")
|
||||
|
||||
Reference in New Issue
Block a user