From 6416cf65972770eeea66f73bfc0ab016cbf246cb Mon Sep 17 00:00:00 2001 From: vmud213 Date: Thu, 20 Jul 2017 18:33:19 +0530 Subject: [PATCH] Redfish: Adds secure_boot to server capabilities This commit adds logic to include 'secure_boot' capabilitiy to server capabilities. Change-Id: Ia25d02f8d22f25ba6a3e864f72c9b0a17b80c214 --- proliantutils/redfish/redfish.py | 6 ++++-- proliantutils/tests/redfish/test_redfish.py | 5 +++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/proliantutils/redfish/redfish.py b/proliantutils/redfish/redfish.py index eb9c7a3..77bb38e 100644 --- a/proliantutils/redfish/redfish.py +++ b/proliantutils/redfish/redfish.py @@ -627,8 +627,10 @@ class RedfishOperations(operations.IloOperations): ), ('trusted_boot', (tpm_state == sys_cons.TPM_PRESENT_ENABLED - or tpm_state == sys_cons.TPM_PRESENT_DISABLED)),) - if value}) + or tpm_state == sys_cons.TPM_PRESENT_DISABLED)), + ('secure_boot', + GET_SECUREBOOT_CURRENT_BOOT_MAP.get( + sushy_system.secure_boot.current_boot)),) if value}) except sushy.exceptions.SushyError as e: msg = (self._("The Redfish controller is unable to get " "resource or its members. Error " diff --git a/proliantutils/tests/redfish/test_redfish.py b/proliantutils/tests/redfish/test_redfish.py index 03d24bc..c7a9fe2 100644 --- a/proliantutils/tests/redfish/test_redfish.py +++ b/proliantutils/tests/redfish/test_redfish.py @@ -655,6 +655,8 @@ class RedfishOperationsTestCase(testtools.TestCase): [mock.MagicMock(spec=pci_device.PCIDevice)]) type(get_system_mock.return_value.bios_settings).sriov = ( sys_cons.SRIOV_ENABLED) + type(get_system_mock.return_value.secure_boot).current_boot = ( + sys_cons.SECUREBOOT_CURRENT_BOOT_ENABLED) type(get_system_mock.return_value).rom_version = ( 'U31 v1.00 (03/11/2017)') type(get_manager_mock.return_value).firmware_version = 'iLO 5 v1.15' @@ -667,6 +669,7 @@ class RedfishOperationsTestCase(testtools.TestCase): tpm_mock) actual = self.rf_client.get_server_capabilities() expected = {'pci_gpu_devices': 1, 'sriov_enabled': 'true', + 'secure_boot': 'true', 'rom_firmware_version': 'U31 v1.00 (03/11/2017)', 'ilo_firmware_version': 'iLO 5 v1.15', 'nic_capacity': '1Gb', @@ -687,6 +690,8 @@ class RedfishOperationsTestCase(testtools.TestCase): [mock.MagicMock(spec=pci_device.PCIDevice)]) type(get_system_mock.return_value.bios_settings).sriov = ( sys_cons.SRIOV_DISABLED) + type(get_system_mock.return_value.secure_boot).current_boot = ( + sys_cons.SECUREBOOT_CURRENT_BOOT_DISABLED) type(get_system_mock.return_value).rom_version = ( 'U31 v1.00 (03/11/2017)') type(get_manager_mock.return_value).firmware_version = 'iLO 5 v1.15'