stmcginnis/gofish

ASRock Rack Chassis - cannot unmarshal json

BirknerAlex opened this issue · 2 comments

Hi,

I got a new ASRock Rack B650D4U mainboard. Trying to get the chassis fails with json: cannot unmarshal array into Go struct field Location.Location.PartLocation of type common.PartLocation.

I added the plain JSON result below. The response headers of the chassis returns following version is being used http://redfish.dmtf.org/schemas/v1/Chassis.v1_14_0.json - it looks indeed wrong here what AsRock here is doing but can it be skipped I don't need the location fields at all?

Regards
Alex

{
   "@odata.context":"/redfish/v1/$metadata#Chassis.Chassis",
   "@odata.etag":"\"1689255909\"",
   "@odata.id":"/redfish/v1/Chassis/Self",
   "@odata.type":"#Chassis.v1_14_0.Chassis",
   "Actions":{
      "#Chassis.Reset":{
         "@Redfish.ActionInfo":"/redfish/v1/Chassis/Self/ResetActionInfo",
         "@Redfish.OperationApplyTimeSupport":{
            "@odata.type":"#Settings.v1_2_2.OperationApplyTimeSupport",
            "MaintenanceWindowDurationInSeconds":600,
            "MaintenanceWindowResource":{
               "@odata.id":"/redfish/v1/Chassis/Self"
            },
            "SupportedValues":[
               "Immediate",
               "AtMaintenanceWindowStart"
            ]
         },
         "target":"/redfish/v1/Chassis/Self/Actions/Chassis.Reset"
      }
   },
   "AssetTag":"                      ",
   "ChassisType":"Other",
   "Description":"Chassis Self",
   "Id":"Self",
   "IndicatorLED":"Off",
   "IndicatorLED@Redfish.AllowableValues":[
      "Lit",
      "Blinking",
      "Off"
   ],
   "Links":{
      "ComputerSystems":[
         {
            "@odata.id":"/redfish/v1/Systems/Self"
         }
      ],
      "ComputerSystems@odata.count":1,
      "Drives":[
         {
            "@odata.id":"/redfish/v1/Systems/Self/Storage/StorageUnit_0/Drives/NVMe_Device0_NSID1"
         },
         {
            "@odata.id":"/redfish/v1/Systems/Self/Storage/StorageUnit_0/Drives/NVMe_Device1_NSID1"
         }
      ],
      "Drives@odata.count":2,
      "ManagedBy":[
         {
            "@odata.id":"/redfish/v1/Managers/Self"
         }
      ],
      "ManagedBy@odata.count":1
   },
   "Location":{
      "PartLocation":[
         
      ],
      "Placement":[
         
      ],
      "PostalAddress":[
         
      ]
   },
   "LogServices":{
      "@odata.id":"/redfish/v1/Chassis/Self/LogServices"
   },
   "Manufacturer":"To Be Filled By O.E.M.",
   "MediaControllers":{
      "@odata.id":"/redfish/v1/Chassis/Self/MediaControllers"
   },
   "Model":" ",
   "Name":"Computer System Chassis",
   "NetworkAdapters":{
      "@odata.id":"/redfish/v1/Chassis/Self/NetworkAdapters"
   },
   "PCIeDevices":{
      "@odata.id":"/redfish/v1/Chassis/Self/PCIeDevices"
   },
   "PCIeSlots":{
      "@odata.id":"/redfish/v1/Chassis/Self/PCIeSlots"
   },
   "PartNumber":" ",
   "PhysicalSecurity":[
      
   ],
   "Power":{
      "@odata.id":"/redfish/v1/Chassis/Self/Power"
   },
   "PowerState":"On",
   "SKU":"To Be Filled By O.E.M.",
   "Sensors":{
      "@odata.id":"/redfish/v1/Chassis/Self/Sensors"
   },
   "SerialNumber":"To Be Filled By O.E.M.",
   "Status":{
      "Health":"OK",
      "HealthRollup":"OK",
      "State":"Enabled"
   },
   "Thermal":{
      "@odata.id":"/redfish/v1/Chassis/Self/Thermal"
   }
}

Hey @BirknerAlex! Yeah, it does appear ASRock is not formatting this data according to the spec. I'm not sure where you would go to do it, but it would be worth filing an issue with them to see if they can fix their implementation to conform to the spec.

If it helps, you can reference the Redfish mockups where they could see the expected structure under Chassis > 1U.

It might also be worth checking if they have a firmware update available. I've seen a few times in the past where we've run in to similar situations and were lucky enough to find newer firmware had already fixed the problem.

There's not really a great way to handle this in gofish, but if you wanted to test with your own modified fork, you could either drop the Location field or see if there's a way to add some conditional JSON unmarshalling to handle it.

Thank you! I just forwarded this to AsRock Rack. Closing this issue now.