Add UnavailableOffline state mapping and add getResourceStatus helper - #1501
Add UnavailableOffline state mapping and add getResourceStatus helper#1501jnin-dev wants to merge 9 commits into
Conversation
ac44a87 to
fd33698
Compare
aee002e to
3e4fbe1
Compare
jeaaustx
left a comment
There was a problem hiding this comment.
Overall the change looks reasonable to me. I have a few comments in the code and a couple of comments on the commit messages:
- The utils function commit message talks about UnavailableOffline but the output example in the commit message only shows Absent. For clarity it would be good to show the different cases in the output in the commit message.
- I'm wondering about carrying these patches and the ease of handling rebasing in the future. I suggest considering breaking these up to a single commit that adds the utility function and then separate commits for each of the places changing to use the utility function. (This would help with chicken/egg problem on rebase of needing support in place that pulls in the utility function for any other commits dependant on the function.) But...
- Is this going upstream? If so then above concern about rebase is less important. However for upstream it is still easiest to get the utility function commit in by itself.
- Probably should add some unit tests for the utiilty function.
354e5cc to
4d27cb6
Compare
I added to the commit message about the difference cases for Status.State
I believe the utility function will go upstream. I've separated them into different commits for each resource since it'll be cleaner
Done. |
4d27cb6 to
e49178a
Compare
0d8668c to
65d140a
Compare
65d140a to
040f27d
Compare
2f26805 to
293b40c
Compare
jeaaustx
left a comment
There was a problem hiding this comment.
Changes look good to me. I have just the one comment about the refactoring.
8052c8c to
d08e3c0
Compare
- State `Available` will be mapped to `UnavailableOffline` for Status.State for resources that are present but unavailable - Added a utility function to reduce code duplication for retrieving resource's Status.State (`getResourceState`) and Status.Health (`getResourceHealth`) Tested: - Compiles and builds - Unit tests pass Change-Id: I1164a9412cbd4e1ab8938366ffc7ea9c7fe58786 Signed-off-by: Justin Nguyen <justinnanguyen@gmail.com>
d08e3c0 to
33ab4e5
Compare
- Utilized resource util's getResourceState() and getResourceHealth()
to get the Status.State and Status.Health of the cable resource
- Cable will now have the Status.Health where it previously did not have
it
Tested:
- Unit tests passed
- Redfish Service Validator passed
- Response as expected:
```
curl -k -v http://${bmc}/redfish/v1/Cables/dp1_cable0
```
Results in
```
curl -k -v https://${bmc}/redfish/v1/Cables/dp1_cable0
```
Results in
```
{
"@odata.id": "/redfish/v1/Cables/dp1_cable0",
"@odata.type": "#Cable.v1_0_0.Cable",
"CableType": "",
"Id": "dp1_cable0",
"Name": "Cable",
...
"Status": {
"State": "Enabled",
"Health": "OK"
}
...
}
```
Signed-off-by: Justin Nguyen <justinnanguyen@gmail.com>
- Utilized resource util's getResourceState() and getResourceHealth()
to get Status.State and Status.Health of the fan resource
Tested:
- Unit tests passed
- Redfish Service Validator passed
- Response as expected:
```
curl -k -v https://${bmc}/redfish/v1/Chassis/chassis/ThermalSubsystem/Fans/fan0
```
Results in
```
{
"@odata.id": "/redfish/v1/Chassis/chassis/ThermalSubsystem/Fans/fan0",
"@odata.type": "#Fan.v1_3_0.Fan",
"Id": "fan0",
"Location": {
"PartLocation": {
"ServiceLabel": "U78DA.N00.WZS003H-A0"
}
},
"Manufacturer": "Delta",
"Model": "7B5F",
"Name": "fan0",
"PartNumber": "02YK323",
"SerialNumber": "YL12JP1C1234",
"SparePartNumber": "02YK323",
"Status": {
"Health": "OK",
"State": "UnavailableOffline"
}
```
Where the state can be `Enabled`, `UnavailableOffline`, or `Absent`
Signed-off-by: Justin Nguyen <justinnanguyen@gmail.com>
- Utilized resource util's getResourceState and getResourceHealth to
get the Status.State and Status.Health of the power supply resource
- This commit will decouple Status.Health from Status.State
Tested:
- Unit tests passed
- Redfish Service Validator passed
- Response as expected:
```
curl -k -v https://${bmc}/redfish/v1/Chassis/chassis/PowerSubsystem/PowerSupplies/powersupply0
```
Results in
```
{
"@odata.id": "/redfish/v1/Chassis/chassis/PowerSubsystem/PowerSupplies/powersupply0",
...
"SerialNumber": "Y YL106 63F0",
"SparePartNumber": "0 ",
"Status": {
"Health": "OK",
"State": "UnavailableOffline"
}
...
}
```
Signed-off-by: Justin Nguyen <justinnanguyen@gmail.com>
- Utilized resource util's getResourceState and getResourceHealth to
get the Status.State and Status.Health of the fabric adapters resource
Tested:
- Unit tests passed
- Redfish Service Validator passed
```
curl -k -v https://${bmc}/redfish/v1/Systems/system/FabricAdapters/pcie_card0
```
Results in
```
{
"@odata.id": "/redfish/v1/Systems/system/FabricAdapters/pcie_card0",
"@odata.type": "#FabricAdapter.v1_4_0.FabricAdapter",
...
"Status": {
"Health": "OK",
"State": "UnavailableOffline"
}
...
}
```
If the resource is functional and present but not available
Signed-off-by: Justin Nguyen <justinnanguyen@gmail.com>
- Utilize getResourceState and getResourceHealth utility function for
resource's Status.State and Status.Health
Tested:
- Unit tests passed
- Redfish Service Validator passed
- Request expected:
```
curl -k -v https://${bmc}/redfish/v1/Systems/system/FabricAdapters/disk_backplane0/Ports/dp0_connector1
```
Results in
```
{
"@odata.id": "/redfish/v1/Systems/system/FabricAdapters/disk_backplane0/Ports/dp0_connector1",
"@odata.type": "#Port.v1_11_0.Port",
"Id": "dp0_connector1",
...
"Status": {
"Health": "OK",
"State": "UnavailableOffline"
}
}
```
if the resource is present but not available
Signed-off-by: Justin Nguyen <justinnanguyen@gmail.com>
- Utilize getResourceStatus and getResourceHealth where applicable and
extended Status.State to handle `Available` mapping to
`UnavailableOffline`
Tested:
- Unit tests passed
- Redfish Service Validator passed
- Request to Processor results in
```
...
"Status": {
"Health": "OK",
"State": "Enabled"
}
...
```
or `UnavailableOffline` if not available
- Request to Subprocessors results in
```
{
"@odata.id": "/redfish/v1/Systems/system/Processors/dcm1-cpu1/SubProcessors/core15",
"@odata.type": "#Processor.v1_18_0.Processor",
"Enabled": true,
"Id": "core15",
"Name": "core15",
"Status": {
"Health": "OK",
"State": "UnavailableOffline"
}
```
if not available
Signed-off-by: Justin Nguyen <justinnanguyen@gmail.com>
- Added `Available` mapping to `UnavailableOffline` for memory
Tested:
- Unit tests passed
- Redfish Service Validator passed
- Request:
```
curl -k -v https://${bmc}/redfish/v1/Systems/system/Memory/dimm3
```
Results in
```
{
"@odata.id": "/redfish/v1/Systems/system/Memory/dimm3",
"@odata.type": "#Memory.v1_12_0.Memory",
...
"Status": {
"Health": "OK",
"State": "Enabled"
}
...
```
`UnavailableOffline` if not available
```
"Status": {
"Health": "OK",
"State": "UnavailableOffline"
}
```
Signed-off-by: Justin Nguyen <justinnanguyen@gmail.com>
- Utilized getResourceState and getResourceHealth utility function for
Assembly's Status.State and Status.Health
Tested:
- Unit tests and Redfish Service Validator passed
- Request:
```
curl -k -v https://${bmc}/redfish/v1/Chassis/chassis/Assembly
```
Response:
```
"Status": {
"Health": "OK",
"State": "Enabled"
}
```
Otherwise if Available is false
```
"Status": {
"Health": "OK",
"State": "UnavailableOffline"
}
```
Signed-off-by: Justin Nguyen <justinnanguyen@gmail.com>
33ab4e5 to
369524b
Compare
resource's Status.State and Status.Health
Availableto RedfishUnavailableOfflineTested:
with the new mapping
Results with