2016-09-07 01:12:19 +03:00
# Copyright (C) 2016 Red Hat, Inc.
# Copyright (C) 2016 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Charles Arnold <carnold suse com>
#
2018-04-04 16:35:41 +03:00
# This work is licensed under the GNU GPLv2 or later.
2018-03-20 22:00:02 +03:00
# See the COPYING file in the top-level directory.
2016-09-07 01:12:19 +03:00
2019-05-14 21:16:14 +03:00
from . . xmlbuilder import XMLBuilder , XMLChildProperty , XMLProperty
class _SysinfoEntry ( XMLBuilder ) :
XML_NAME = " entry "
2020-09-10 19:06:13 +03:00
name = XMLProperty ( " ./@name " )
2019-05-14 21:16:14 +03:00
value = XMLProperty ( " . " )
2020-09-10 19:06:13 +03:00
file = XMLProperty ( " ./@file " )
class _SysinfoOemString ( _SysinfoEntry ) :
pass
2016-09-07 01:12:19 +03:00
2018-03-20 22:10:04 +03:00
class DomainSysinfo ( XMLBuilder ) :
2016-09-07 01:12:19 +03:00
"""
2018-03-20 22:10:04 +03:00
Class for building and domain < sysinfo > XML
2016-09-07 01:12:19 +03:00
"""
2018-03-21 17:53:34 +03:00
XML_NAME = " sysinfo "
2016-09-07 01:12:19 +03:00
_XML_PROP_ORDER = [ " type " ,
" bios_vendor " , " bios_version " , " bios_date " , " bios_release " ,
" system_manufacturer " , " system_product " , " system_version " ,
" system_serial " , " system_uuid " , " system_sku " , " system_family " ,
" baseBoard_manufacturer " , " baseBoard_product " , " baseBoard_version " ,
2019-05-14 21:05:08 +03:00
" baseBoard_serial " , " baseBoard_asset " , " baseBoard_location " ,
" chassis_manufacturer " , " chassis_version " ,
2019-05-14 21:16:14 +03:00
" chassis_serial " , " chassis_asset " , " chassis_sku " , " oemStrings " ]
2016-09-07 01:12:19 +03:00
type = XMLProperty ( " ./@type " )
2018-09-03 23:08:58 +03:00
bios_date = XMLProperty ( " ./bios/entry[@name= ' date ' ] " )
2016-09-07 01:12:19 +03:00
bios_vendor = XMLProperty ( " ./bios/entry[@name= ' vendor ' ] " )
bios_version = XMLProperty ( " ./bios/entry[@name= ' version ' ] " )
bios_release = XMLProperty ( " ./bios/entry[@name= ' release ' ] " )
2017-12-14 20:02:36 +03:00
system_uuid = XMLProperty ( " ./system/entry[@name= ' uuid ' ] " )
2016-09-07 01:12:19 +03:00
system_manufacturer = XMLProperty ( " ./system/entry[@name= ' manufacturer ' ] " )
system_product = XMLProperty ( " ./system/entry[@name= ' product ' ] " )
system_version = XMLProperty ( " ./system/entry[@name= ' version ' ] " )
system_serial = XMLProperty ( " ./system/entry[@name= ' serial ' ] " )
system_sku = XMLProperty ( " ./system/entry[@name= ' sku ' ] " )
system_family = XMLProperty ( " ./system/entry[@name= ' family ' ] " )
baseBoard_manufacturer = XMLProperty (
" ./baseBoard/entry[@name= ' manufacturer ' ] " )
baseBoard_product = XMLProperty ( " ./baseBoard/entry[@name= ' product ' ] " )
baseBoard_version = XMLProperty ( " ./baseBoard/entry[@name= ' version ' ] " )
baseBoard_serial = XMLProperty ( " ./baseBoard/entry[@name= ' serial ' ] " )
baseBoard_asset = XMLProperty ( " ./baseBoard/entry[@name= ' asset ' ] " )
baseBoard_location = XMLProperty ( " ./baseBoard/entry[@name= ' location ' ] " )
2019-05-14 21:05:08 +03:00
chassis_manufacturer = XMLProperty ( " ./chassis/entry[@name= ' manufacturer ' ] " )
chassis_version = XMLProperty ( " ./chassis/entry[@name= ' version ' ] " )
chassis_serial = XMLProperty ( " ./chassis/entry[@name= ' serial ' ] " )
chassis_asset = XMLProperty ( " ./chassis/entry[@name= ' asset ' ] " )
chassis_sku = XMLProperty ( " ./chassis/entry[@name= ' sku ' ] " )
2019-05-14 21:16:14 +03:00
2020-09-10 19:06:13 +03:00
oemStrings = XMLChildProperty (
_SysinfoOemString , relative_xpath = " ./oemStrings " )
entries = XMLChildProperty ( _SysinfoEntry )