Merge "Handle non-default language for registries"
This commit is contained in:
commit
40f460183a
@ -0,0 +1,7 @@
|
||||
---
|
||||
fixes:
|
||||
- |
|
||||
In some cases registries might not be available because the
|
||||
our check for the registry language did not account for a
|
||||
possible country suffix. The logic was improved to take it
|
||||
into account.
|
@ -594,7 +594,12 @@ class ResourceBase(object, metaclass=abc.ABCMeta):
|
||||
for key, registry in registries.items():
|
||||
if (registry
|
||||
and self._attribute_registry in (key, registry.identity)):
|
||||
if language != registry.language:
|
||||
# NOTE(iurygregory): some registries may have "en-US"
|
||||
# as their language, in this case we can check if the
|
||||
# registry language starts with the requested language.
|
||||
registry_language = registry.language.lower().split('-', 1)[0]
|
||||
if (language != registry.language
|
||||
and language.lower() != registry_language):
|
||||
LOG.debug('Found %(descr)s but its language %(reg_lang)s '
|
||||
'does not match the requested %(lang)s',
|
||||
{'descr': description,
|
||||
|
@ -119,8 +119,14 @@ class MessageRegistryFile(base.ResourceBase):
|
||||
# NOTE (etingof): as per RFC5646, languages are case-insensitive
|
||||
language = language.lower()
|
||||
|
||||
# NOTE(iurygregory): some registries may have "en-US" as their
|
||||
# language, in this case we can check if the registry language
|
||||
# starts with the requested language.
|
||||
locations = [
|
||||
l for l in self.location if l.language.lower() == language]
|
||||
l for l in self.location
|
||||
if l.language.lower().split('-', 1)[0] == language
|
||||
or l.language == language
|
||||
]
|
||||
|
||||
locations += [
|
||||
l for l in self.location if l.language.lower() == 'default']
|
||||
|
@ -0,0 +1,19 @@
|
||||
{
|
||||
"@odata.context": "/redfish/v1/$metadata#MessageRegistryFile.MessageRegistryFile",
|
||||
"@odata.etag": "\"1642688165\"",
|
||||
"@odata.id": "/redfish/v1/Registries/BiosAttributeRegistryProt0.208.208.0",
|
||||
"@odata.type": "#MessageRegistryFile.v1_1_3.MessageRegistryFile",
|
||||
"Description": "Registry for BiosAttributeRegistryProt0.208.208.0",
|
||||
"Id": "BiosAttributeRegistryProt0.208.208.0",
|
||||
"Languages": [
|
||||
"en-US"
|
||||
],
|
||||
"Location": [
|
||||
{
|
||||
"Language": "en-US",
|
||||
"Uri": "/redfish/v1/Registries/BiosAttributeRegistryProt0.208.208.0.json"
|
||||
}
|
||||
],
|
||||
"Name": "BiosAttributeRegistryProt0.208.208.0 Registry",
|
||||
"Registry": "BiosAttributeRegistryProt0.208.208.0"
|
||||
}
|
@ -0,0 +1,75 @@
|
||||
{
|
||||
"RegistryVersion": "208.208.0",
|
||||
"OwningEntity": "AMI",
|
||||
"Name": "Prot0 BIOS Attribute Registry",
|
||||
"@odata.context": "/redfish/v1/$metadata#AttributeRegistry.AttributeRegistry",
|
||||
"RegistryEntries": {
|
||||
"Dependencies": [
|
||||
{
|
||||
"Type": "Map",
|
||||
"DependencyFor": "ACPI004",
|
||||
"Dependency": {
|
||||
"MapToValue": "true",
|
||||
"MapToProperty": "Hidden",
|
||||
"MapFrom": [
|
||||
{
|
||||
"MapFromValue": true,
|
||||
"MapFromProperty": "CurrentValue",
|
||||
"MapFromAttribute": "ACPI004",
|
||||
"MapFromCondition": "EQU"
|
||||
}
|
||||
],
|
||||
"MapToAttribute": "ACPI002"
|
||||
}
|
||||
}
|
||||
],
|
||||
"Attributes": [
|
||||
{
|
||||
"DefaultValue": "Enable",
|
||||
"UefiNamespaceId": "x-UEFI-AMI",
|
||||
"DisplayName": "TPM SUPPORT",
|
||||
"HelpText": "Enables or Disables BIOS support for security device. O.S. will not show Security Device. TCG EFI protocol and INT1A interface will not be available.",
|
||||
"AttributeName": "TCG003",
|
||||
"Value": [
|
||||
{
|
||||
"ValueName": "Disable",
|
||||
"ValueDisplayName": "Disable"
|
||||
},
|
||||
{
|
||||
"ValueName": "Enable",
|
||||
"ValueDisplayName": "Enable"
|
||||
}
|
||||
],
|
||||
"ReadOnly": false,
|
||||
"ResetRequired": true,
|
||||
"Type": "Enumeration"
|
||||
},
|
||||
{
|
||||
"DefaultValue": "Disabled",
|
||||
"UefiNamespaceId": "x-UEFI-AMI",
|
||||
"DisplayName": " Disable Block Sid",
|
||||
"HelpText": " Override to allow SID authentication in TCG Storage device",
|
||||
"AttributeName": "TCG023",
|
||||
"Value": [
|
||||
{
|
||||
"ValueName": "Enabled",
|
||||
"ValueDisplayName": "Enabled"
|
||||
},
|
||||
{
|
||||
"ValueName": "Disabled",
|
||||
"ValueDisplayName": "Disabled"
|
||||
}
|
||||
],
|
||||
"ReadOnly": false,
|
||||
"ResetRequired": true,
|
||||
"Type": "Enumeration"
|
||||
}
|
||||
]
|
||||
},
|
||||
"@odata.type": "#AttributeRegistry.v1_3_1.AttributeRegistry",
|
||||
"@odata.id": "/redfish/v1/Registries/BiosAttributeRegistryProt0.208.208.0.json",
|
||||
"Language": "en-US",
|
||||
"@odata.etag": "\"1627746301\"",
|
||||
"Id": "BiosAttributeRegistryProt0.208.208.0",
|
||||
"Description": "This registry defines a representation of BIOS Attribute instances"
|
||||
}
|
400
sushy/tests/unit/json_samples/bios_zt.json
Normal file
400
sushy/tests/unit/json_samples/bios_zt.json
Normal file
@ -0,0 +1,400 @@
|
||||
{
|
||||
"@odata.context": "/redfish/v1/$metadata#Bios.Bios",
|
||||
"@odata.etag": "\"1676250921\"",
|
||||
"@odata.id": "/redfish/v1/Systems/Self/Bios",
|
||||
"@odata.type": "#Bios.v1_1_0.Bios",
|
||||
"Actions": {
|
||||
"#Bios.ChangePassword": {
|
||||
"@Redfish.ActionInfo": "/redfish/v1/Systems/Self/Bios/ChangePasswordActionInfo",
|
||||
"target": "/redfish/v1/Systems/Self/Bios/Actions/Bios.ChangePassword"
|
||||
},
|
||||
"#Bios.ResetBios": {
|
||||
"@Redfish.ActionInfo": "/redfish/v1/Systems/Self/Bios/ResetBiosActionInfo",
|
||||
"target": "/redfish/v1/Systems/Self/Bios/Actions/Bios.ResetBios"
|
||||
},
|
||||
"#ZtVga.ChangeState": {
|
||||
"@Redfish.ActionInfo": "/redfish/v1/Systems/Self/Bios/ChangeStateActionInfo",
|
||||
"target": "/redfish/v1/Systems/Self/Bios/Actions/ZtVga.ChangeState"
|
||||
}
|
||||
},
|
||||
"AttributeRegistry": "BiosAttributeRegistryProt0.208.208.0",
|
||||
"Attributes": {
|
||||
"ACPI002": false,
|
||||
"ACPI004": false,
|
||||
"CRCS005": "Disable",
|
||||
"CSM000": "Force BIOS",
|
||||
"CSM001": "Immediate",
|
||||
"CSM002": "Upon Request",
|
||||
"CSM005": "Disabled",
|
||||
"CSM006": "UEFI only",
|
||||
"CSM007": "UEFI",
|
||||
"CSM008": "UEFI",
|
||||
"CSM009": "UEFI",
|
||||
"CSM010": "UEFI",
|
||||
"CSM011": "Adjust",
|
||||
"GSIO020": false,
|
||||
"GSIO201": false,
|
||||
"GSIO202": true,
|
||||
"GSIO607": "IO=2F8h; IRQ=3,4,5,6,7,9,10,11,12;",
|
||||
"GSIO608": "IO=3F8h; IRQ=3,4,5,6,7,9,10,11,12;",
|
||||
"IIOS001": "Yes",
|
||||
"IIOS002": "No",
|
||||
"IIOS1FE": "Enable",
|
||||
"IPMI000": "Enabled",
|
||||
"IPMI001": "No",
|
||||
"IPMI002": "Do Nothing",
|
||||
"IPMI003": "Error code",
|
||||
"IPMI100": "Enabled",
|
||||
"IPMI101": 20,
|
||||
"IPMI102": "Reset",
|
||||
"IPMI103": "Disabled",
|
||||
"IPMI104": 10,
|
||||
"IPMI105": "Reset",
|
||||
"IPMI200": "Yes, On every reset",
|
||||
"IPMI201": "Clear Log",
|
||||
"IPMI400": "Disabled",
|
||||
"IPMI500": "Unspecified",
|
||||
"IPMI501": "...",
|
||||
"IPMI502": "...",
|
||||
"IPMI503": "0.0.0.0",
|
||||
"IPMI504": "00-00-00-00-00-00",
|
||||
"IPMI505": "Unspecified",
|
||||
"IPMI506": "...",
|
||||
"IPMI507": "...",
|
||||
"IPMI508": "0.0.0.0",
|
||||
"IPMI509": "00-00-00-00-00-00",
|
||||
"IPMI510": "Enabled",
|
||||
"IPMI511": "Unspecified",
|
||||
"IPMI512": ":::::::",
|
||||
"IPMI513": 0,
|
||||
"IPMI514": ":::::::",
|
||||
"IPMI515": "Enabled",
|
||||
"IPMI516": "Unspecified",
|
||||
"IPMI517": ":::::::",
|
||||
"IPMI518": 0,
|
||||
"IPMI519": ":::::::",
|
||||
"IPMI520": 0,
|
||||
"IPMI521": ":::::::",
|
||||
"IPMI522": "Unspecified",
|
||||
"IPMI523": 0,
|
||||
"IPMI524": ":::::::",
|
||||
"IPMI525": "Unspecified",
|
||||
"IPMI600": "Enabled",
|
||||
"IPMI601": "Enabled",
|
||||
"IPMI800": "",
|
||||
"IPMI801": "",
|
||||
"IPMI802": "Disable",
|
||||
"IPMI803": 0,
|
||||
"IPMI804": "No Access",
|
||||
"IPMI805": "",
|
||||
"IPMI807": "",
|
||||
"IPMI809": "",
|
||||
"IPMI810": "Disable",
|
||||
"IPMI811": 0,
|
||||
"IPMI812": "No Access",
|
||||
"IPMI900": "Unspecified",
|
||||
"IRCS001": "Auto",
|
||||
"KTIS001": "Auto",
|
||||
"KTIS002": 0,
|
||||
"KTIS003": 0,
|
||||
"KTIS004": "Auto",
|
||||
"KTIS005": "Auto",
|
||||
"KTIS006": "Auto",
|
||||
"KTIS007": "Enable",
|
||||
"MDFX001": "PMem Management Driver",
|
||||
"MDFX002": "Enabled",
|
||||
"MDFX003": "Enabled",
|
||||
"MDFX004": "Disable",
|
||||
"MDFX005": "VOL:100% PMEM:0% AD-WB:0%",
|
||||
"MDFX006": "VOL:100% PMEM:0% AD-WB:0%",
|
||||
"MDFX007": "VOL:100% PMEM:0% AD-WB:0%",
|
||||
"MDFX008": "VOL:100% PMEM:0% AD-WB:0%",
|
||||
"MDFX009": "VOL:100% PMEM:0% AD-WB:0%",
|
||||
"MDFX00A": "VOL:100% PMEM:0% AD-WB:0%",
|
||||
"MDFX00B": "VOL:100% PMEM:0% AD-WB:0%",
|
||||
"MDFX00C": "VOL:100% PMEM:0% AD-WB:0%",
|
||||
"MEMS001": "POR",
|
||||
"MEMS002": "Soft PPR",
|
||||
"MEMS003": "Disable",
|
||||
"MEMS004": "Auto",
|
||||
"MEMS005": "Auto",
|
||||
"MEMS006": "Auto",
|
||||
"MEMS007": "2LM",
|
||||
"MEMS008": "4KB Target, 256B Channel (4KB across CPU sockets, 256B across MCs within socket, 256B across channels within MCs)",
|
||||
"MEMS00B": "2-way Interleave",
|
||||
"MEMS00C": "Disabled",
|
||||
"MEMS00D": "Disabled",
|
||||
"MEMS00E": 100,
|
||||
"MEMS00F": "Disabled",
|
||||
"MEMS010": "Enable at End of POST",
|
||||
"MESS001": "Disable",
|
||||
"MESS002": 32768,
|
||||
"NVLCK002": "Enable",
|
||||
"NWSK000": "Enabled",
|
||||
"NWSK001": "Enabled",
|
||||
"NWSK002": "Disabled",
|
||||
"NWSK004": 120,
|
||||
"NWSK005": 1,
|
||||
"NWSK006": "Disabled",
|
||||
"NWSK007": "Disabled",
|
||||
"OROM001": true,
|
||||
"OROM002": true,
|
||||
"OROM990": true,
|
||||
"OROM991": true,
|
||||
"OROM992": true,
|
||||
"OROM993": true,
|
||||
"OROM994": true,
|
||||
"OROM995": true,
|
||||
"OROM996": true,
|
||||
"OROM998": true,
|
||||
"OROM999": true,
|
||||
"PCHS001": "Enable",
|
||||
"PCHS002": "AHCI",
|
||||
"PCHS005": "Enable",
|
||||
"PCHS006": "AHCI",
|
||||
"PCHS009": "Disable",
|
||||
"PCHS00A": "Enable",
|
||||
"PCHS00B": "Enable",
|
||||
"PCHS00C": "Enable",
|
||||
"PCHS00D": "Enable",
|
||||
"PCHS00E": "Enable",
|
||||
"PCHS00F": "Enable",
|
||||
"PCHS010": "Enable",
|
||||
"PCHS011": "Enable",
|
||||
"PCHS012": "Enable",
|
||||
"PCHS013": "Enable",
|
||||
"PCHS014": "Enable",
|
||||
"PCHS015": "Enable",
|
||||
"PCHS016": "Enable",
|
||||
"PCHS017": "Enable",
|
||||
"PCHS018": "Enable",
|
||||
"PCHS019": "Enable",
|
||||
"PCHS01A": "Enable",
|
||||
"PCHS01B": "Enable",
|
||||
"PCHS01C": "Enable",
|
||||
"PCHS01D": "Enable",
|
||||
"PCHS01E": "Enable",
|
||||
"PCHS01F": "Enable",
|
||||
"PCHS020": "Enable",
|
||||
"PCHS021": "Enable",
|
||||
"PCIS001": "32 PCI Bus Clocks",
|
||||
"PCIS002": "64 PCI Bus Clocks",
|
||||
"PCIS003": "Disabled",
|
||||
"PCIS004": "Disabled",
|
||||
"PCIS005": "Disabled",
|
||||
"PCIS006": "Enabled",
|
||||
"PCIS007": "Enabled",
|
||||
"PCIS008": "Enabled",
|
||||
"PCIS009": "Disabled",
|
||||
"PCIS010": "Enabled",
|
||||
"PCIS011": "Auto",
|
||||
"PCIS012": "Auto",
|
||||
"PCIS013": "Disabled",
|
||||
"PCIS014": "Disabled",
|
||||
"PCIS015": "5",
|
||||
"PCIS016": 1000,
|
||||
"PCIS017": "Keep Link ON",
|
||||
"PCIS018": "Disabled",
|
||||
"PCIS020": "Disabled",
|
||||
"PCIS021": "Disabled",
|
||||
"PCIS022": "Disabled",
|
||||
"PCIS023": "Disabled",
|
||||
"PCIS024": "Disabled",
|
||||
"PCIS025": "Disabled",
|
||||
"PCIS026": "Disabled",
|
||||
"PCIS027": "Auto",
|
||||
"PCIS028": "Disabled",
|
||||
"PCIS029": "Disabled",
|
||||
"PCIS030": "Enabled",
|
||||
"PCIS031": "Enabled",
|
||||
"PCIS032": "Disabled",
|
||||
"PCIS033": "Disabled",
|
||||
"PMS001": "Enable",
|
||||
"PMS002": "Enable",
|
||||
"PMS003": "Native Mode with No Legacy Support",
|
||||
"PMS005": "Enable",
|
||||
"PMS006": "Disable",
|
||||
"PMS007": "C0/C1 state",
|
||||
"PMS008": "BIOS Controls EPB",
|
||||
"PMS009": "OS controls EPB",
|
||||
"PMS00A": "Performance",
|
||||
"PMS00B": "Enable",
|
||||
"PMS00C": 0,
|
||||
"PMS00D": 1,
|
||||
"PMS00E": "Enable",
|
||||
"PMS00F": 0,
|
||||
"PMS010": 1,
|
||||
"PMS011": "Level 2",
|
||||
"PMS012": "Disable",
|
||||
"PMS013": "I/O sensitive",
|
||||
"PMS014": "Disable",
|
||||
"PMS015": 17,
|
||||
"PMS016": "HW_ALL",
|
||||
"PMS017": "Max Performance",
|
||||
"PMS018": "Enable",
|
||||
"PMS019": "512 Heavy",
|
||||
"PMS01A": "Disable",
|
||||
"PMS01B": "Disable",
|
||||
"PMS01C": "Disable",
|
||||
"PMS01D": "Disable",
|
||||
"PMS01E": "Disable",
|
||||
"PMS01F": "ACPI C2",
|
||||
"PMS020": "Disable",
|
||||
"PMS021": "Disable",
|
||||
"PMS022": "Disable",
|
||||
"PMS023": "0 us",
|
||||
"PRSS001": 0,
|
||||
"PRSS002": 0,
|
||||
"PRSS003": 0,
|
||||
"PRSS004": 0,
|
||||
"PRSS011": "Enable",
|
||||
"PRSS013": "Disable",
|
||||
"PRSS014": "Enable",
|
||||
"PRSS015": "Enable",
|
||||
"PRSS016": "Enable",
|
||||
"PRSS017": "Enable",
|
||||
"PRSS018": "Enable",
|
||||
"PRSS019": "Enable",
|
||||
"PRSS01A": "Enable",
|
||||
"PRSS01B": "Normal",
|
||||
"PRSS01C": "Enable",
|
||||
"PRSS01D": "Enable",
|
||||
"REDF000": "Enabled",
|
||||
"REDF001": "Basic Authentication",
|
||||
"REDF002": "169.254.0.17",
|
||||
"REDF003": "255.255.0.0",
|
||||
"REDF004": 443,
|
||||
"RFWCS030": "Disabled",
|
||||
"SECB001": "Disabled",
|
||||
"SECB002": "Custom",
|
||||
"SECB008": "Enabled",
|
||||
"SELS001": "Enable",
|
||||
"SELS002": "Enable",
|
||||
"SELS003": "Disable",
|
||||
"SELS004": "Disable",
|
||||
"SELS005": "Disable",
|
||||
"SELS006": "EMCA gen 2 CSMI",
|
||||
"SELS007": "EMCA gen 2 - MSMI",
|
||||
"SELS008": "Enable",
|
||||
"SELS009": "Enable",
|
||||
"SELS00A": "Enable",
|
||||
"SELS00C": "Enable",
|
||||
"SELS00D": "Enable",
|
||||
"SELS00E": "Enable",
|
||||
"SELS00F": "Enable",
|
||||
"SELS010": "Enable",
|
||||
"SELS011": "Enable",
|
||||
"SELS012": "Enable",
|
||||
"SELS013": "Enable",
|
||||
"SELS014": "Enable",
|
||||
"SELS015": "Enable",
|
||||
"SELS016": 1,
|
||||
"SELS017": "Enable",
|
||||
"SELS018": "Enable",
|
||||
"SELS019": "Enable",
|
||||
"SELS01A": "Enable",
|
||||
"SETUP001": "",
|
||||
"SETUP002": "",
|
||||
"SETUP003": 1,
|
||||
"SETUP004": "On",
|
||||
"SETUP005": false,
|
||||
"SETUP006": "Red Hat Enterprise Linux,0x000B,true;UEFI: AMI Virtual CDROM0 1.00,0x000A,true;UEFI: PXE IPv4 Intel(R) Ethernet Network Adapter E810-XXV-4,0x0001,false;UEFI: PXE IPv4 Intel(R) Ethernet Network Adapter E810-XXV-4,0x0002,false;UEFI: PXE IPv4 Intel(R) Ethernet Network Adapter E810-XXV-4,0x0003,false;UEFI: PXE IPv4 Intel(R) Ethernet Network Adapter E810-XXV-4,0x0004,false;UEFI: PXE IPv4 Intel(R) Ethernet Network Adapter E810-XXV-4,0x0005,false;UEFI: PXE IPv4 Intel(R) Ethernet Network Adapter E810-XXV-4,0x0006,false;UEFI: PXE IPv4 Intel(R) Ethernet Network Adapter E810-XXV-4,0x0007,false;UEFI: PXE IPv4 Intel(R) Ethernet Network Adapter E810-XXV-4,0x0008,false;UEFI: Built-in EFI Shell,0x0009,false;",
|
||||
"TCG001": "Enabled",
|
||||
"TCG002": "Enabled",
|
||||
"TCG003": "Enable",
|
||||
"TCG004": "Enable",
|
||||
"TCG006": "None",
|
||||
"TCG007": "None",
|
||||
"TCG010": "TCG_2",
|
||||
"TCG011": "Enabled",
|
||||
"TCG012": "Enabled",
|
||||
"TCG013": "Enabled",
|
||||
"TCG014": "TIS",
|
||||
"TCG016": "Auto",
|
||||
"TCG017": "Enabled",
|
||||
"TCG018": "Enabled",
|
||||
"TCG019": "Disabled",
|
||||
"TCG020": "Disabled",
|
||||
"TCG021": "Disabled",
|
||||
"TCG022": "1.3",
|
||||
"TCG023": "Disabled",
|
||||
"TER001": false,
|
||||
"TER002": true,
|
||||
"TER0020": "115200",
|
||||
"TER0021": "115200",
|
||||
"TER0022": "115200",
|
||||
"TER010": false,
|
||||
"TER011": "VT-UTF8",
|
||||
"TER012": "VT100",
|
||||
"TER013": "VT100",
|
||||
"TER030": "8",
|
||||
"TER031": "8",
|
||||
"TER03F": "None",
|
||||
"TER040": "None",
|
||||
"TER04E": "1",
|
||||
"TER04F": "1",
|
||||
"TER05C": "None",
|
||||
"TER05D": "None",
|
||||
"TER05E": "None",
|
||||
"TER06B": "COM1",
|
||||
"TER06D": false,
|
||||
"TER06c": false,
|
||||
"TER07A": "80x24",
|
||||
"TER07B": true,
|
||||
"TER07C": true,
|
||||
"TER089": false,
|
||||
"TER08A": false,
|
||||
"TER098": "VT100",
|
||||
"TER099": "VT100",
|
||||
"TER0A7": "Always Enable",
|
||||
"TER0A8": "COM1",
|
||||
"USB000": "Enabled",
|
||||
"USB001": "Enabled",
|
||||
"USB002": "Enabled",
|
||||
"USB003": "Enabled",
|
||||
"USB004": "Disabled",
|
||||
"USB009": "20 sec",
|
||||
"USB00A": "20 sec",
|
||||
"USB00B": "Auto",
|
||||
"USB00C": 5,
|
||||
"USB00D": "Enabled",
|
||||
"USB00E": "HiSpeed",
|
||||
"USB00F": "Enabled",
|
||||
"USB011": "Auto",
|
||||
"USB012": "Auto",
|
||||
"USB013": "Auto",
|
||||
"USB014": "Auto",
|
||||
"USB015": "Auto",
|
||||
"USB016": "Auto",
|
||||
"USB017": "Auto",
|
||||
"USB018": "Auto",
|
||||
"USB019": "Auto",
|
||||
"USB01A": "Auto",
|
||||
"USB01B": "Auto",
|
||||
"USB01C": "Auto",
|
||||
"USB01D": "Auto",
|
||||
"USB01E": "Auto",
|
||||
"USB01F": "Auto",
|
||||
"USB020": "Auto",
|
||||
"USB021": "Auto",
|
||||
"USB022": "Auto",
|
||||
"USB023": "Auto",
|
||||
"USB024": "Auto",
|
||||
"USB025": "Auto",
|
||||
"USB026": "Auto",
|
||||
"USB027": "Auto",
|
||||
"USB028": "Auto",
|
||||
"USB029": "Auto",
|
||||
"USB02A": "Auto",
|
||||
"USB02B": "Auto",
|
||||
"USB02C": "Auto",
|
||||
"USB02D": "Auto",
|
||||
"USB02E": "Auto",
|
||||
"USB02F": "Auto",
|
||||
"USB030": "Auto"
|
||||
},
|
||||
"Description": "Current BIOS Settings",
|
||||
"Id": "Bios",
|
||||
"Name": "Current BIOS Settings",
|
||||
"VgaState": "Enable"
|
||||
}
|
@ -67,3 +67,41 @@ class AttributeRegistryTestCase(base.TestCase):
|
||||
{'ValueDisplayName': 'Disabled',
|
||||
'ValueName': 'Disabled'}],
|
||||
attributes.allowable_values)
|
||||
|
||||
def test__parse_attributes_zt(self):
|
||||
self.conn = mock.Mock()
|
||||
with open('sushy/tests/unit/json_samples/'
|
||||
'bios_attribute_registry_zthardware.json') as f:
|
||||
self.json_doc = json.load(f)
|
||||
|
||||
self.conn.get.return_value.json.return_value = self.json_doc
|
||||
self.registry = attribute_registry.AttributeRegistry(
|
||||
self.conn,
|
||||
'/redfish/v1/Registries/'
|
||||
'BiosAttributeRegistryProt0.208.208.0.json',
|
||||
redfish_version='1.0.2')
|
||||
|
||||
self.registry._parse_attributes(self.json_doc)
|
||||
self.assertEqual('BiosAttributeRegistryProt0.208.208.0',
|
||||
self.registry.identity)
|
||||
self.assertEqual('Prot0 BIOS Attribute Registry', self.registry.name)
|
||||
self.assertEqual('en-US', self.registry.language)
|
||||
self.assertEqual('This registry defines a representation of '
|
||||
'BIOS Attribute instances',
|
||||
self.registry.description)
|
||||
self.assertEqual('208.208.0', self.registry.registry_version)
|
||||
self.assertEqual('AMI', self.registry.owning_entity)
|
||||
|
||||
attributes = self.registry.registry_entries.attributes[0]
|
||||
self.assertEqual('TCG003', attributes.name)
|
||||
self.assertEqual('TPM SUPPORT', attributes.display_name)
|
||||
self.assertEqual('Enable', attributes.default_value)
|
||||
self.assertIsNone(attributes.immutable)
|
||||
self.assertEqual(False, attributes.read_only)
|
||||
self.assertEqual('Enumeration', attributes.attribute_type)
|
||||
self.assertEqual(True, attributes.reset_required)
|
||||
self.assertEqual([{'ValueDisplayName': 'Disable',
|
||||
'ValueName': 'Disable'},
|
||||
{'ValueDisplayName': 'Enable',
|
||||
'ValueName': 'Enable'}],
|
||||
attributes.allowable_values)
|
||||
|
@ -341,3 +341,89 @@ class BiosTestCase(base.TestCase):
|
||||
self.sys_bios._attribute_registry = "Unknown"
|
||||
registry = self.sys_bios.get_attribute_registry()
|
||||
self.assertIsNone(registry)
|
||||
|
||||
|
||||
class BiosZTTestCase(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(BiosZTTestCase, self).setUp()
|
||||
self.conn = mock.Mock()
|
||||
with open('sushy/tests/unit/json_samples/bios_zt.json') as f:
|
||||
self.bios_json = json.load(f)
|
||||
# NOTE(iurygregory): ZT Hardware doesn't have Settings for Bios.
|
||||
|
||||
self.conn.get.return_value.json.side_effect = [self.bios_json]
|
||||
|
||||
registries = {}
|
||||
conn = mock.Mock()
|
||||
# Note(iurygregory): re-use message registry for now.
|
||||
with open('sushy/tests/unit/json_samples/message_registry.json') as f:
|
||||
conn.get.return_value.json.return_value = json.load(f)
|
||||
msg_reg = message_registry.MessageRegistry(
|
||||
conn, '/redfish/v1/Registries/Test',
|
||||
redfish_version='1.0.2')
|
||||
|
||||
registries['Test.1.0'] = msg_reg
|
||||
|
||||
with open('sushy/tests/unit/json_samples/'
|
||||
'bios_attribute_registry_zthardware.json') as f:
|
||||
conn.get.return_value.json.return_value = json.load(f)
|
||||
self.bios_reg = attribute_registry.AttributeRegistry(
|
||||
conn,
|
||||
'/redfish/v1/Registries/BiosAttributeRegistryProt0.208.208.0',
|
||||
redfish_version='1.3.1')
|
||||
|
||||
registries['BiosAttributeRegistryProt0.208.208.0'] = self.bios_reg
|
||||
|
||||
self.sys_bios = bios.Bios(
|
||||
self.conn, '/redfish/v1/Systems/Self/Bios',
|
||||
registries=registries,
|
||||
redfish_version='1.0.2')
|
||||
|
||||
def test__parse_attributes(self):
|
||||
self.sys_bios._parse_attributes(self.bios_json)
|
||||
self.assertEqual('1.0.2', self.sys_bios.redfish_version)
|
||||
self.assertEqual('Bios', self.sys_bios.identity)
|
||||
self.assertEqual('Current BIOS Settings',
|
||||
self.sys_bios.name)
|
||||
self.assertEqual(self.sys_bios.description,
|
||||
'Current BIOS Settings')
|
||||
self.assertEqual('BiosAttributeRegistryProt0.208.208.0',
|
||||
self.sys_bios._attribute_registry)
|
||||
|
||||
def test_get_attribute_registry_no_lang(self):
|
||||
|
||||
registry = self.sys_bios.get_attribute_registry(language='zh')
|
||||
self.assertIsNone(registry)
|
||||
|
||||
def test_get_attribute_registry(self):
|
||||
|
||||
registry = self.sys_bios.get_attribute_registry(language="en")
|
||||
registry2 = self.sys_bios.get_attribute_registry(language="en-US")
|
||||
|
||||
self.assertEqual(registry.name, 'Prot0 BIOS Attribute Registry')
|
||||
self.assertEqual(registry.description, 'This registry defines a '
|
||||
'representation of BIOS Attribute instances')
|
||||
self.assertEqual(registry.language, 'en-US')
|
||||
self.assertEqual(registry.registry_entries.attributes[0].name,
|
||||
'TCG003')
|
||||
self.assertEqual(registry.registry_entries.attributes[0].display_name,
|
||||
'TPM SUPPORT')
|
||||
self.assertEqual(registry.registry_entries.attributes[0].read_only,
|
||||
False)
|
||||
self.assertEqual(registry.registry_entries.attributes[0].
|
||||
attribute_type, 'Enumeration')
|
||||
|
||||
self.assertEqual(registry.name, registry2.name)
|
||||
self.assertEqual(registry.description, registry2.description)
|
||||
self.assertEqual(registry.language, registry2.language)
|
||||
self.assertEqual(registry.registry_entries.attributes[0].name,
|
||||
registry2.registry_entries.attributes[0].name)
|
||||
self.assertEqual(registry.registry_entries.attributes[0].display_name,
|
||||
registry2.registry_entries.attributes[0].display_name)
|
||||
self.assertEqual(registry.registry_entries.attributes[0].read_only,
|
||||
registry2.registry_entries.attributes[0].read_only)
|
||||
self.assertEqual(registry.registry_entries.attributes[0].
|
||||
attribute_type,
|
||||
registry2.registry_entries.attributes[0].
|
||||
attribute_type)
|
||||
|
Loading…
Reference in New Issue
Block a user