| Age | Commit message (Collapse) | Author | Files | Lines |
|
Hardware resources are using a generic Redfish Name such as "PCIe
Device." Pass PrettyName instead for a more descriptive and
human-readable Name with it defaulting to what the resource was
originally
This preserves existing fallbacks such that if PrettyName is not
present, nothing changes
Tested:
- Unit tests pass
- Redfish Service Validator passes
- Request to resources show `Name` field as PrettyName value otherwise
defaulting to resource's original `Name`
- For example
```
curl -k -v https://${bmc}/redfish/v1/Systems/system/PCIeDevices/pcie_card0
```
Results in
```
{
"@odata.id": "/redfish/v1/Systems/system/PCIeDevices/pcie_card0",
"@odata.type": "#PCIeDevice.v1_19_0.PCIeDevice",
"Id": "pcie_card0",
...
"Name": "PCIe4 x16 or PCIe5 x8 adapter",
...
}
```
and defaults to
```
"Name": "PCIe Device",
```
Change-Id: I95ef77027311d18eb9f85295f359b2d9fbc31b2f
Signed-off-by: Justin Nguyen <justinnanguyen@gmail.com>
|
|
- Utilize getResourceState and getResourceHealth utility function for
Assembly Status.State and Status.Health
- Map `Available` to Redfish `UnavailableOffline`
Tested:
- Unit tests passed
- Redfish Service Validator passed
- Request expected
```
curl -k -v https://${bmc}/redfish/v1/Chassis/chassis/Assembly
```
```
{
"@odata.id": "/redfish/v1/Chassis/chassis/Assembly",
"@odata.type": "#Assembly.v1_6_0.Assembly",
"Assemblies": [
{
"@odata.id": "/redfish/v1/Chassis/chassis/Assembly#/Assemblies/0",
"@odata.type": "#Assembly.v1_6_0.AssemblyData",
"Location": {
"PartLocation": {
"ServiceLabel": "Ufcs-N00-D0"
}
},
"LocationIndicatorActive": false,
"MemberId": "0",
"Name": "base_op_panel_blyth",
"Status": {
"Health": "OK",
"State": "Absent"
}
},
{
"@odata.id": "/redfish/v1/Chassis/chassis/Assembly#/Assemblies/1",
"@odata.type": "#Assembly.v1_6_0.AssemblyData",
"Location": {
"PartLocation": {
"ServiceLabel": "U78DA.N00.1234567-D1"
}
},
"LocationIndicatorActive": false,
"MemberId": "1",
"Model": "6B86",
"Name": "lcd_op_panel_hill",
"PartNumber": "PN12345",
"SerialNumber": "YL6B86010000",
"SparePartNumber": "F191014",
"Status": {
"Health": "OK",
"State": "UnavailableOffline"
}
}
],
"Assemblies@odata.count": 2,
"Id": "Assembly",
"Name": "Assembly Collection"
}
```
Change-Id: If7f06b27dbdfa914a9db4480ba856d9dd25c8795
Signed-off-by: Justin Nguyen <justinnanguyen@gmail.com>
|
|
Long lambdas have been documented as an anti-pattern for some time.[1]
Despite this being generally understood, bmcweb has a long ways to go
cleaning these up, and routinely code is submitted in violation of this
anti-pattern.
Invent an ast-grep rule that can identify when new examples of this
anti-pattern are added, and ignore the existing 200+ examples that are
in the codebase already using ast-grep ignore. These flags will give us
something to search for as we clean this up, and will help to prevent
new instances from being added unintentionally.
[1] https://github.com/openbmc/docs/blob/master/anti-patterns.md#very-long-lambda-callbacks
Tested: Comment only change. ast-grep passes. Manually removing an
ast-grep ignore flag shows as a failure in ast-grep scan
Change-Id: I77d634a393884969f184d2c39c02cc08288d5a29
Signed-off-by: Ed Tanous <etanous@nvidia.com>
|
|
The sdbusplus headers provide shortened aliases for many types.
Switch to using them to provide better code clarity and shorter
lines. Possible replacements are for:
* bus_t
* exception_t
* manager_t
* match_t
* message_t
* object_t
* slot_t
* object_path
Change-Id: Iace20f9ad26e8d9dc234979e7a4087d599da2641
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
|
|
Implement LocationIndicatorActive for Assembly schema to set and get the
status of the location LED. A client uses the `LocationIndicatorActive`
property to physically identify or locate the assembly.
The assembly is an array of AssemblyData [1], and the element of the
array can be patched as explained in [2].
```
{
"Assemblies": [
{},
{},
{
"LocationIndicatorActive": true
},
{}
]
}
```
Tested:
- Validator passes.
-
1. Get LocationIndicatorActive
```
curl -k -H "X-Auth-Token: $token" -X GET https://${bmc}/redfish/v1/Chassis/chassis/Assembly
{
"@odata.id": "/redfish/v1/Chassis/chassis/Assembly",
"@odata.type": "#Assembly.v1_6_0.Assembly",
"Assemblies": [
{
"@odata.id": "/redfish/v1/Chassis/chassis/Assembly#/Assemblies/0",
"@odata.type": "#Assembly.v1_6_0.AssemblyData",
"LocationIndicatorActive": false,
"MemberId": "0",
...
},
{
"@odata.id": "/redfish/v1/Chassis/chassis/Assembly#/Assemblies/1",
"@odata.type": "#Assembly.v1_6_0.AssemblyData",
"LocationIndicatorActive": false,
"MemberId": "1",
...
}
],
"Assemblies@odata.count": 2,
"Id": "Assembly",
"Name": "Assembly Collection"
}
```
2. Set LocationIndicatorActive to true
```
curl -k -H "X-Auth-Token: $token" -H "Content-Type: application/json" \
-X PATCH -d '{"Assemblies":[{"LocationIndicatorActive":true},{}]}' \
https://${bmc}/redfish/v1/Chassis/chassis/Assembly
```
Then we will see the location LED lit up, and the
LocationIndicatorActive value becomes true.
```
curl -k -H "X-Auth-Token: $token" -X GET https://${bmc}/redfish/v1/Chassis/chassis/Assembly
{
"@odata.id": "/redfish/v1/Chassis/chassis/Assembly",
"@odata.type": "#Assembly.v1_6_0.Assembly",
"Assemblies": [
{
"@odata.id": "/redfish/v1/Chassis/chassis/Assembly#/Assemblies/0",
"@odata.type": "#Assembly.v1_6_0.AssemblyData",
"LocationIndicatorActive": true,
"MemberId": "0",
...
},
{
"@odata.id": "/redfish/v1/Chassis/chassis/Assembly#/Assemblies/1",
"@odata.type": "#Assembly.v1_6_0.AssemblyData",
"LocationIndicatorActive": false,
"MemberId": "1",
...
}
],
"Assemblies@odata.count": 2,
"Id": "Assembly",
"Name": "Assembly Collection"
}
```
If the input array size is different from the existing assemblies, it
will cause an error like
```
curl -k -H "X-Auth-Token: $token" -H "Content-Type: application/json" \
-X PATCH -d '{"Assemblies":[{},{"LocationIndicatorActive":true},{}]}' \
https://${bmc}/redfish/v1/Chassis/chassis/Assembly
{
"error": {
"@Message.ExtendedInfo": [
{
"@odata.type": "#Message.v1_1_1.Message",
"Message": "The array provided for property Assemblies exceeds the size limit 2.",
"MessageArgs": [
"Assemblies",
"2"
],
"MessageId": "Base.1.19.ArraySizeTooLong",
"MessageSeverity": "Warning",
"Resolution": "Resubmit the request with an appropriate array size."
}
],
"code": "Base.1.19.ArraySizeTooLong",
"message": "The array provided for property Assemblies exceeds the size limit 2."
}
}%
```
[1] https://redfish.dmtf.org/schemas/v1/Assembly.v1_6_0.json
[2] https://redfishforum.com/thread/437/patch-individual-items-array-objects
Change-Id: Ic2e87f5daeb7ebed161654bb54ac29e7d5daa482
Signed-off-by: Myung Bae <myungbae@us.ibm.com>
|
|
This commit implements Redfish Assembly schema.
This schema will be used to publish inventory data for FRUs which are
attached to a given Chassis and does not map to any specific schema
definition.
The properties which are published in this commit are LocationCode,
SparePartNumber, Model, SerialNumber and PartNumber.
One of the major use case to publish these properties via redfish is for
anyone to identify the inventory and its location in the system, which
in turn will help them in repair/replacement related to that FRU.
The validator has been executed on the change and no error has been
found.
As this has been tested on a development image some fields are empty
in the below pasted output for which warning was thrown by validator but
no errors.
Sample Output with [1]:
```
{
"@odata.id": "/redfish/v1/Chassis/chassis/Assembly",
"@odata.type": "#Assembly.v1_5_1.Assembly",
"Assemblies": [
{
"@odata.id": "/redfish/v1/Chassis/chassis/Assembly#/Assemblies/0",
"@odata.type": "#Assembly.v1_5_1.AssemblyData",
"Location": {
"PartLocation": {
"ServiceLabel": "U78DA.ND0.1234567-D0"
}
},
"Manufacturer": "",
"MemberId": "0",
"Model": "",
"Name": "base_op_panel_blyth",
"PartNumber": "",
"SerialNumber": "",
"Status": {
"Health": "OK",
"State": "Absent"
}
},
{
"@odata.id": "/redfish/v1/Chassis/chassis/Assembly#/Assemblies/1",
"@odata.type": "#Assembly.v1_5_1.AssemblyData",
"Location": {
"PartLocation": {
"ServiceLabel": "U78DA.ND0.1234567-D1"
}
},
"Manufacturer": "",
"MemberId": "1",
"Model": "6B86",
"Name": "lcd_op_panel_hill",
"PartNumber": "PN12345",
"SerialNumber": "YL6B86010000",
"Status": {
"Health": "OK",
"State": "Enabled"
}
}
],
"Assemblies@odata.count": 2,
"Id": "Assembly",
"Name": "Assembly Collection"
}
```
[1] https://gerrit.openbmc.org/c/openbmc/openbmc/+/83907
Change-Id: I2d462340fe1a0b0eb387697f0ff70fcafde3f8d9
Signed-off-by: Sunny Srivastava <sunnsr25@in.ibm.com>
Signed-off-by: Ninad Palsule <ninad@linux.ibm.com>
Signed-off-by: Myung Bae <myungbae@us.ibm.com>
|