Skip to content

Commit

Permalink
Add redfish wrapanapi properties
Browse files Browse the repository at this point in the history
This adds `machine_type` and `product_name` properties to
`RedfishServer`.

Related PR:
  * ManageIQ/manageiq-providers-redfish#83
  • Loading branch information
matejart committed Aug 28, 2019
1 parent 8876b9c commit bde2c7a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tests/test_redfish.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ def test_server_complex_properties(self, mock_connector):
},
"/redfish/v1/Systems/System-1-2-1-1/Processors/CPU.Socket.1": {
"@odata.id": "/redfish/v1/Systems/System-1-2-1-1/Processors/CPU.Socket.1",
"InstructionSet": [{
"Member": "x86-64"
}],
"TotalCores": 20,
}
})
Expand All @@ -111,6 +114,8 @@ def test_server_complex_properties(self, mock_connector):
self.assertFalse(rf_server.is_off)
self.assertFalse(rf_server.is_powering_on)
self.assertFalse(rf_server.is_powering_off)
self.assertEqual(rf_server.machine_type, "x86-64")
self.assertEqual(rf_server.product_name, "System")

def test_server_power_states(self, mock_connector):
# string,
Expand Down
10 changes: 10 additions & 0 deletions wrapanapi/systems/redfish.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,16 @@ def state(self):
"""Retrieve the current power status of the physical server."""
return self.raw.PowerState

@property
def machine_type(self):
"""Retrieve the server's machine type."""
return self.raw.Processors.Members[0].InstructionSet[0]["Member"]

@property
def product_name(self):
"""Reurn the product name of the server"""
return self.raw.Name

def _get_state(self):
"""
Return ServerState object representing the server's current state.
Expand Down

0 comments on commit bde2c7a

Please sign in to comment.