Repository: HewlettPackard/oneview-python (language: python)

Issue:
Release/5.0.0
### Description
Moving code from old repo to new repo

### Check List
- [x] New functionality includes testing.
  - [x] All tests pass for Python 2.7+ & 3.4+(`$ tox`).
- [x] New functionality has been documented in the README if applicable.
  - [x] New functionality has been thoroughly documented in the examples (please include helpful comments).
  - [x] New endpoints supported are updated in the endpoints-support.md file.
- [x] Changes are documented in the CHANGELOG.


Discussion / hints:

Fix patch:
diff --git a/endpoints-support.md b/endpoints-support.md
old mode 100755
new mode 100644
index 39c84b05c..a21741b5a
--- a/endpoints-support.md
+++ b/endpoints-support.md
@@ -365,26 +365,28 @@
 | <sub>/rest/scopes/{id}</sub>                                                                    | DELETE               |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |:white_check_mark:|:white_check_mark:   |:white_check_mark:      |:white_check_mark:|:white_check_mark:|
 | <sub>/rest/scopes/{id}</sub>                                                                    | PATCH                |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |:white_check_mark:|:white_check_mark:   |:white_check_mark:      |:white_check_mark:|:white_check_mark:|
 | **Server Hardware**                                                                             |
-| <sub>/rest/server-hardware</sub>                                                                | GET                  |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |:white_check_mark:|:white_check_mark:   |:white_check_mark:      |:white_check_mark:|:white_check_mark:|
-| <sub>/rest/server-hardware</sub>                                                                | POST                 |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |:white_check_mark:|:white_check_mark:   |:white_check_mark:      |:white_check_mark:|:white_check_mark:|
-| <sub>/rest/server-hardware/{id}</sub>                                                           | GET                  |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |:white_check_mark:|:white_check_mark:   |:white_check_mark:      |:white_check_mark:|:white_check_mark:|
-| <sub>/rest/server-hardware/{id}</sub>                                                           | DELETE               |    :heavy_minus_sign:    |    :heavy_minus_sign:    |    :heavy_minus_sign:    |    :heavy_minus_sign:    |    :heavy_minus_sign:    |    :heavy_minus_sign:    |:heavy_minus_sign: |:heavy_minus_sign:    |:heavy_minus_sign:       |:heavy_minus_sign:  |:white_check_mark:|
-| <sub>/rest/server-hardware/{id}/bios</sub>                                                      | GET                  |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |:white_check_mark:|:white_check_mark:   |:white_check_mark:      |:white_check_mark:|:white_check_mark:|
-| <sub>/rest/server-hardware/{id}/environmentalConfiguration</sub>                                | GET                  |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |:white_check_mark:|:white_check_mark:   |:white_check_mark:      |:white_check_mark:|:white_check_mark:|
-| <sub>/rest/server-hardware/{id}/environmentalConfiguration</sub>                                | PUT                  |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |:white_check_mark:|:white_check_mark:   |:white_check_mark:      |:white_check_mark:|:white_check_mark:|
-| <sub>/rest/server-hardware/{id}/iloSsoUrl</sub>                                                 | GET                  |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |:white_check_mark:|:white_check_mark:   |:white_check_mark:      |:white_check_mark:|:white_check_mark:|
-| <sub>/rest/server-hardware/{id}/javaRemoteConsoleUrl</sub>                                      | GET                  |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |:white_check_mark:|:white_check_mark:   |:white_check_mark:      |:white_check_mark:|:white_check_mark:|
-| <sub>/rest/server-hardware/{id}/mpFirmwareVersion</sub>                                         | PUT                  |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |:white_check_mark:|:white_check_mark:   |:white_check_mark:      |:white_check_mark:|:white_check_mark:|
-| <sub>/rest/server-hardware/{id}/physicalServerHardware</sub>                                    | GET                  |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |:white_check_mark:|:white_check_mark:   |:white_check_mark:      |:white_check_mark:|:white_check_mark:|
-| <sub>/rest/server-hardware/{id}/powerState</sub>                                                | PUT                  |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |:white_check_mark:|:white_check_mark:   |:white_check_mark:      |:white_check_mark:|:white_check_mark:|
-| <sub>/rest/server-hardware/{id}/refreshState</sub>                                              | PUT                  |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |:white_check_mark:|:white_check_mark:   |:white_check_mark:      |:white_check_mark:|:white_check_mark:|
-| <sub>/rest/server-hardware/{id}/remoteConsoleUrl</sub>                                          | GET                  |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |:white_check_mark:|:white_check_mark:   |:white_check_mark:      |:white_check_mark:|:white_check_mark:|
-| <sub>/rest/server-hardware/{id}/utilization</sub>                                               | GET                  |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |:white_check_mark:|:white_check_mark:   |:white_check_mark:      |:white_check_mark:|:white_check_mark:|
-| <sub>/rest/server-hardware/{id}</sub>                                                           | PATCH                |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |:white_check_mark:|:white_check_mark:   |:white_check_mark:      |:white_check_mark:|:white_check_mark:|
-| <sub>/rest/server-hardware/*/firmware</sub>                                                     | GET                  |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |:white_check_mark:|:white_check_mark:   |:white_check_mark:      |:white_check_mark:|:white_check_mark:|
-| <sub>/rest/server-hardware/{id}/firmware</sub>                                                  | GET                  |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |:white_check_mark:|:white_check_mark:   |:white_check_mark:      |:white_check_mark:|:white_check_mark:|
-| <sub>/rest/server-hardware/discovery</sub>                                                      | POST                 |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |:white_check_mark:|:white_check_mark:   |:white_check_mark:      |:white_check_mark:|:white_check_mark:|
-| <sub>/rest/server-hardware/{id}/localStorageV2</sub>                                            | POST                 |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |:white_check_mark:|:white_check_mark:   |:white_check_mark:      |:white_check_mark:|:white_check_mark:|
+| <sub>/rest/server-hardware</sub>                                                                | GET                  |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |:white_check_mark:|:white_check_mark:   |:white_check_mark:      |:white_check_mark:|:white_check_mark:      |
+| <sub>/rest/server-hardware</sub>                                                                | POST                 |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |:white_check_mark:|:white_check_mark:   |:white_check_mark:      |:white_check_mark:|:white_check_mark:      |
+| <sub>/rest/server-hardware/{id}</sub>                                                           | GET                  |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |:white_check_mark:|:white_check_mark:   |:white_check_mark:      |:white_check_mark:|:white_check_mark:      |
+| <sub>/rest/server-hardware/{id}</sub>                                                           | DELETE               |    :heavy_minus_sign:    |    :heavy_minus_sign:    |    :heavy_minus_sign:    |    :heavy_minus_sign:    |    :heavy_minus_sign:    |    :heavy_minus_sign:    |:heavy_minus_sign: |:heavy_minus_sign:    |:heavy_minus_sign:       |:heavy_minus_sign:  |    :heavy_minus_sign:    |
+| <sub>/rest/server-hardware/{id}/bios</sub>                                                      | GET                  |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |:white_check_mark:|:white_check_mark:   |:white_check_mark:      |:white_check_mark:|:white_check_mark:    |
+| <sub>/rest/server-hardware/{id}/environmentalConfiguration</sub>                                | GET                  |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |:white_check_mark:|:white_check_mark:   |:white_check_mark:      |:white_check_mark:|:white_check_mark:    |
+| <sub>/rest/server-hardware/{id}/environmentalConfiguration</sub>                                | PUT                  |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |:white_check_mark:|:white_check_mark:   |:white_check_mark:      |:white_check_mark:|:white_check_mark:    |
+| <sub>/rest/server-hardware/{id}/iloSsoUrl</sub>                                                 | GET                  |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |:white_check_mark:|:white_check_mark:   |:white_check_mark:      |:white_check_mark:|:white_check_mark:    |
+| <sub>/rest/server-hardware/{id}/javaRemoteConsoleUrl</sub>                                      | GET                  |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |:white_check_mark:|:white_check_mark:   |:white_check_mark:      |:white_check_mark:|:white_check_mark:    |
+| <sub>/rest/server-hardware/{id}/mpFirmwareVersion</sub>                                         | PUT                  |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |:white_check_mark:|:white_check_mark:   |:white_check_mark:      |:white_check_mark:|:white_check_mark:    |
+| <sub>/rest/server-hardware/{id}/physicalServerHardware</sub>                                    | GET                  |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |:white_check_mark:|:white_check_mark:   |:white_check_mark:      |:white_check_mark:|:white_check_mark:    |
+| <sub>/rest/server-hardware/{id}/powerState</sub>                                                | PUT                  |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |:white_check_mark:|:white_check_mark:   |:white_check_mark:      |:white_check_mark:|:white_check_mark:    |
+| <sub>/rest/server-hardware/{id}/refreshState</sub>                                              | PUT                  |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |:white_check_mark:|:white_check_mark:   |:white_check_mark:      |:white_check_mark:|:white_check_mark:    |
+| <sub>/rest/server-hardware/{id}/remoteConsoleUrl</sub>                                          | GET                  |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |:white_check_mark:|:white_check_mark:   |:white_check_mark:      |:white_check_mark:|:white_check_mark:    |
+| <sub>/rest/server-hardware/{id}/utilization</sub>                                               | GET                  |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |:white_check_mark:|:white_check_mark:   |:white_check_mark:      |:white_check_mark:|:white_check_mark:    |
+| <sub>/rest/server-hardware/{id}</sub>                                                           | PATCH                |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |:white_check_mark:|:white_check_mark:   |:white_check_mark:      |:white_check_mark:|:white_check_mark:    |
+| <sub>/rest/server-hardware/*/firmware</sub>                                                     | GET                  |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |:white_check_mark:|:white_check_mark:   |:white_check_mark:      |:white_check_mark:|:white_check_mark:    |
+| <sub>/rest/server-hardware/{id}/firmware</sub>                                                  | GET                  |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |:white_check_mark:|:white_check_mark:   |:white_check_mark:      |:white_check_mark:|:white_check_mark:    |
+| <sub>/rest/server-hardware/discovery</sub>                                                      | POST                 |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |:white_check_mark:|:white_check_mark:   |:white_check_mark:      |:white_check_mark:|:white_check_mark:    |
+| <sub>/rest/server-hardware/{id}/localStorageV2</sub>                                            | POST                 |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |:white_check_mark:|:white_check_mark:   |:white_check_mark:      |:white_check_mark:|:white_check_mark:    |
+| <sub>/rest/server-hardware/firmware-compliance</sub>                                            | POST                 |    :heavy_minus_sign:    |    :heavy_minus_sign:    |    :heavy_minus_sign:    |    :heavy_minus_sign:    |    :heavy_minus_sign:    |    :heavy_minus_sign:    |:heavy_minus_sign:|:heavy_minus_sign:   |:heavy_minus_sign:      |:heavy_minus_sign:|    :heavy_minus_sign:    |
+| <sub>/rest/server-hardware/{id}/firmware/settings</sub>                                         | PATCH                 |    :heavy_minus_sign:    |    :heavy_minus_sign:    |    :heavy_minus_sign:    |    :heavy_minus_sign:    |    :heavy_minus_sign:    |    :heavy_minus_sign:    |:heavy_minus_sign:|:heavy_minus_sign:   |:heavy_minus_sign:      |:heavy_minus_sign:|    :heavy_minus_sign:    |
 | **Server Hardware Types**                                                                       |
 | <sub>/rest/server-hardware-types</sub>                                                          | GET                  |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |:white_check_mark:|:white_check_mark:   |:white_check_mark:      |:white_check_mark:|:white_check_mark:|
 | <sub>/rest/server-hardware-types/{id}</sub>                                                     | GET                  |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |    :white_check_mark:    |:white_check_mark:|:white_check_mark:   |:white_check_mark:      |:white_check_mark:|:white_check_mark:|
diff --git a/examples/server_hardware_firmware_update.py b/examples/server_hardware_firmware_update.py
new file mode 100644
index 000000000..18e5cfab9
--- /dev/null
+++ b/examples/server_hardware_firmware_update.py
@@ -0,0 +1,80 @@
+# -*- coding: utf-8 -*-
+###
+# (C) Copyright [2023] Hewlett Packard Enterprise Development LP
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+###
+
+from hpeOneView.oneview_client import OneViewClient
+from config_loader import try_load_from_file
+
+config = {
+    "ip": "<oneview_ip>",
+    "credentials": {
+        "userName": "<username>",
+        "password": "<password>"
+    }
+}
+
+# Try load config from a file (if there is a config file)
+config = try_load_from_file(config)
+
+variant = 'Synergy'
+options = {
+    "hostname": config['server_hostname'],
+    "username": config['server_username'],
+    "password": config['server_password'],
+    "licensingIntent": "OneView",
+    "configurationState": "Managed"
+}
+
+oneview_client = OneViewClient(config)
+server_hardwares = oneview_client.server_hardware
+
+# Get list of all server hardware resources
+servers = []
+print("Get list of all server hardware resources")
+server_hardware_all = server_hardwares.get_all()
+for serv in server_hardware_all:
+    print('  %s' % serv['name'])
+    servers.append(serv['name'])
+
+# Get recently added server hardware resource by name
+if server_hardware_all:
+    server = server_hardwares.get_by_name(servers[0])
+    print(server.data)
+
+# Request power operation to change the power state of the physical server.
+configuration = {
+    "powerState": "Off",
+    "powerControl": "MomentaryPress"
+}
+if server:
+    server_power = server.update_power_state(configuration)
+    print("Successfully changed the power state of server '{name}' to '{powerState}'".format(**server_power))
+
+# Perform a firmware update on server
+# Firmware update can only be done on server hardware(Gen10 and later) with no server profile assigned, and server hardware
+# should be in powered off state
+compliance_configuration = {
+    "firmwareBaselineId": config['server_hardware']['firmware_baseline_id'],
+    "serverUUID": server.data['uuid']
+}
+firmware_update_configuration = [{"op": "replace", "value": {"baselineUri": "/rest/firmware-drivers/" + config['server_hardware']['firmware_baseline_id'],
+                                  "firmwareInstallType": "FirmwareOnlyOfflineMode", "installationPolicy": "LowerThanBaseline"}
+                                  }]
+if server:
+    firmware_compliance = server.check_firmware_compliance(compliance_configuration)
+    if firmware_compliance['serverFirmwareUpdateRequired']:
+        print("Updating firmware for the server hardware..")
+        server.perform_firmware_update(firmware_update_configuration)
diff --git a/hpeOneView/resources/servers/server_hardware.py b/hpeOneView/resources/servers/server_hardware.py
index e888acad4..572bb2b0a 100644
--- a/hpeOneView/resources/servers/server_hardware.py
+++ b/hpeOneView/resources/servers/server_hardware.py
@@ -19,6 +19,7 @@
 from __future__ import division
 from __future__ import print_function
 from __future__ import unicode_literals
+import re
 
 from future import standard_library
 
@@ -28,6 +29,12 @@
 from hpeOneView.resources.resource import (Resource, ResourceUtilizationMixin,
                                            ResourcePatchMixin, ensure_resource_client)
 
+SERVER_HARWARE_BELOW_GEN10 = 'Server Hardware generation is below Gen10'
+SERVER_PROFILE_ATTACHED = 'Server Hardware has a Profile attached'
+SERVER_POWERED_ON = 'Server Hardware is in Powered On state'
+ONGOING_FIRMWARE_UPDATE = 'Server Hardware is undergoing a firmware update'
+ILO_ADVANCED_LICENSE_REQUIRED = 'Requires an HPE iLO Advanced license for monitored hardware'
+
 
 class ServerHardware(ResourcePatchMixin, ResourceUtilizationMixin, Resource):
     """
@@ -326,3 +333,68 @@ def get_local_storage(self, ip=None):
             uri = "{}?ip={}".format(uri, ip)
 
         return self._helper.do_get(uri)
+
+    def check_firmware_compliance(self, configuration, timeout=-1, custom_headers=None):
+        """
+        Checks the firmware compliance of a server with the selected firmware baseline.
+        Returns the compliance status of each individual component as well as the overall
+        firmware compliance status of the server.
+
+        Args:
+            configuration: Firmware Compliance Configuration
+
+        Returns:
+            Resource
+        """
+        uri = "{}/firmware-compliance".format(self.URI)
+        return self._helper.do_post(uri, configuration, timeout=timeout, custom_headers=custom_headers)
+
+    @ensure_resource_client
+    def validate_server_hardware_for_firmware_update(self):
+        """
+        Performs a validation for the prerequisites before firmware update.
+        Checks if the server hardware is in powered off state, No server profile attached to server
+        hardware, server hardware model is Gen10 or above, server hardware has advanced ilo license type.
+
+        """
+        state = self.data["state"]
+        server_profile_uri = self.data["serverProfileUri"]
+        power_state = self.data["powerState"]
+        generation = self.data["mpModel"]
+        license_type = self.data["mpLicenseType"]
+
+        validation_error_list = []
+
+        matches = re.findall("\d+$", generation)
+        if int(matches[0]) < 5:
+            validation_error_list.append(SERVER_HARWARE_BELOW_GEN10)
+        if server_profile_uri:
+            validation_error_list.append(SERVER_PROFILE_ATTACHED)
+        if state == "UpdatingFirmware":
+            validation_error_list.append(ONGOING_FIRMWARE_UPDATE)
+        if power_state != "Off":
+            validation_error_list.append(SERVER_POWERED_ON)
+        if license_type != "iLO Advanced":
+            validation_error_list.append(ILO_ADVANCED_LICENSE_REQUIRED)
+
+        if len(validation_error_list) > 0:
+            raise ValueError(validation_error_list)
+        else:
+            return True
+
+    @ensure_resource_client
+    def perform_firmware_update(self, configuration, timeout=-1, custom_headers=None):
+        """
+        Performs a specific patch operation on the firmware settings for the given server.
+        If the server supports the particular operation, the operation is performed and a response is
+        returned to the caller with the results.
+
+        Args:
+            configuration: Firmware Update Configuration
+
+        Returns:
+            Updated Resource
+        """
+        uri = "{}/firmware/settings".format(self.data["uri"])
+        if self.validate_server_hardware_for_firmware_update():
+            return self.patch_request(uri, configuration, timeout=timeout, custom_headers=custom_headers)


Test patch:
diff --git a/tests/unit/resources/servers/test_server_hardware.py b/tests/unit/resources/servers/test_server_hardware.py
index 38aea7d0c..8c917347e 100644
--- a/tests/unit/resources/servers/test_server_hardware.py
+++ b/tests/unit/resources/servers/test_server_hardware.py
@@ -281,3 +281,106 @@ def test_get_local_storage_with_ip(self, mock_get):
         self._server_hardware.get_local_storage(ip='172.16.8.4')
 
         mock_get.assert_called_once_with(uri_rest_call)
+
+    @mock.patch.object(ResourceHelper, 'do_post')
+    def test_check_firmware_compliance(self, mock_post):
+        self._server_hardware.check_firmware_compliance(configuration={"firmwareBaselineId": "abcd-1234-defg",
+                                                                       "serverUUID": "1234567-8901"})
+
+        mock_post.assert_called_once_with('/rest/server-hardware/firmware-compliance', {"firmwareBaselineId": "abcd-1234-defg",
+                                                                                        "serverUUID": "1234567-8901"}, timeout=-1, custom_headers=None)
+
+    @mock.patch.object(ResourcePatchMixin, 'patch_request')
+    def test_perform_firmware_update_called_once(self, mock_patch):
+        uri_rest_call = '{}/firmware/settings'.format(self.uri)
+        self._server_hardware.data = {"uri": self.uri, "state": "NoProfileApplied", "serverProfileUri": None,
+                                      "powerState": "Off", "mpModel": "iLO5", "mpLicenseType": "iLO Advanced"}
+        self._server_hardware.perform_firmware_update([{"op": "replace", "value": {"baselineUri": "/rest/firmware-drivers/sdsdfsdf",
+                                                        "firmwareInstallType": "FirmwareOnlyOfflineMode", "installationPolicy": "LowerThanBaseline"}
+                                                        }])
+
+        mock_patch.assert_called_once_with(uri_rest_call,
+                                           [{"op": "replace", "value": {"baselineUri": "/rest/firmware-drivers/sdsdfsdf",
+                                             "firmwareInstallType": "FirmwareOnlyOfflineMode", "installationPolicy": "LowerThanBaseline"}
+                                             }],
+                                           custom_headers=None,
+                                           timeout=-1)
+
+    @mock.patch.object(ResourcePatchMixin, 'patch_request')
+    def test_perform_firmware_update_with_sh_powered_on_should_error(self, mock_patch):
+        expected_error_list = ['Server Hardware is in Powered On state']
+        self._server_hardware.data = {"uri": self.uri, "state": "NoProfileApplied", "serverProfileUri": None,
+                                      "powerState": "On", "mpModel": "iLO5", "mpLicenseType": "iLO Advanced"}
+
+        try:
+            self._server_hardware.perform_firmware_update([{"op": "replace", "value": {"baselineUri": "/rest/firmware-drivers/sdsdfsdf",
+                                                                                       "firmwareInstallType": "FirmwareOnlyOfflineMode",
+                                                                                       "installationPolicy": "LowerThanBaseline"}
+                                                            }])
+        except ValueError as e:
+            self.assertEqual(expected_error_list, e.args[0])
+        else:
+            self.fail("Expected error not raised")
+
+    @mock.patch.object(ResourcePatchMixin, 'patch_request')
+    def test_perform_firmware_update_with_profile_attached_should_error(self, mock_patch):
+        expected_error_list = ["Server Hardware has a Profile attached"]
+        self._server_hardware.data = {"uri": self.uri, "state": "ProfileApplied", "serverProfileUri": "some_uri",
+                                      "powerState": "Off", "mpModel": "iLO5", "mpLicenseType": "iLO Advanced"}
+
+        try:
+            self._server_hardware.perform_firmware_update([{"op": "replace", "value": {"baselineUri": "/rest/firmware-drivers/sdsdfsdf",
+                                                                                       "firmwareInstallType": "FirmwareOnlyOfflineMode",
+                                                                                       "installationPolicy": "LowerThanBaseline"}
+                                                            }])
+        except ValueError as e:
+            self.assertEqual(expected_error_list, e.args[0])
+        else:
+            self.fail("Expected error not raised")
+
+    @mock.patch.object(ResourcePatchMixin, 'patch_request')
+    def test_perform_firmware_update_with_server_below_gen10_should_error(self, mock_patch):
+        expected_error_list = ["Server Hardware generation is below Gen10"]
+        self._server_hardware.data = {"uri": self.uri, "state": "NoProfileApplied", "serverProfileUri": None,
+                                      "powerState": "Off", "mpModel": "iLO4", "mpLicenseType": "iLO Advanced"}
+
+        try:
+            self._server_hardware.perform_firmware_update([{"op": "replace", "value": {"baselineUri": "/rest/firmware-drivers/sdsdfsdf",
+                                                                                       "firmwareInstallType": "FirmwareOnlyOfflineMode",
+                                                                                       "installationPolicy": "LowerThanBaseline"}
+                                                            }])
+        except ValueError as e:
+            self.assertEqual(expected_error_list, e.args[0])
+        else:
+            self.fail("Expected error not raised")
+
+    @mock.patch.object(ResourcePatchMixin, 'patch_request')
+    def test_perform_firmware_update_with_an_ongoing_update_profile_attached_should_error(self, mock_patch):
+        expected_error_list = ["Server Hardware has a Profile attached", "Server Hardware is undergoing a firmware update"]
+        self._server_hardware.data = {"uri": self.uri, "state": "UpdatingFirmware", "powerState": "Off",
+                                      "serverProfileUri": "some_uri", "mpModel": "iLO5", "mpLicenseType": "iLO Advanced"}
+
+        try:
+            self._server_hardware.perform_firmware_update([{"op": "replace", "value": {"baselineUri": "/rest/firmware-drivers/sdsdfsdf",
+                                                                                       "firmwareInstallType": "FirmwareOnlyOfflineMode",
+                                                                                       "installationPolicy": "LowerThanBaseline"}
+                                                            }])
+        except ValueError as e:
+            self.assertEqual(expected_error_list, e.args[0])
+        else:
+            self.fail("Expected error not raised")
+
+    @mock.patch.object(ResourcePatchMixin, 'patch_request')
+    def test_perform_firmware_update_with_no_ilo_advanced_license_should_error(self, mock_patch):
+        self._server_hardware.data = {"uri": self.uri, "state": "NoProfileAttached", "serverProfileUri": None,
+                                      "powerState": "Off", "mpModel": "iLO5", "mpLicenseType": "iLO"}
+        expected_error_list = ["Requires an HPE iLO Advanced license for monitored hardware"]
+        try:
+            self._server_hardware.perform_firmware_update([{"op": "replace", "value": {"baselineUri": "/rest/firmware-drivers/sdsdfsdf",
+                                                                                       "firmwareInstallType": "FirmwareOnlyOfflineMode",
+                                                                                       "installationPolicy": "LowerThanBaseline"}
+                                                            }])
+        except ValueError as e:
+            self.assertEqual(expected_error_list, e.args[0])
+        else:
+            self.fail("Expected error not raised")