stmcginnis / gofish

Gofish is a Golang client library for DMTF Redfish and SNIA Swordfish interaction.
BSD 3-Clause "New" or "Revised" License
211 stars 113 forks source link

feat: support oem field of thermal and fan #179

Closed daadajuan closed 5 months ago

daadajuan commented 2 years ago

Oem shall be the information describing the Original Equipment Manufacturer, different data structures or map keys response from different manufacturers. We can add oem field into Thermal and Fan, to support user get the information of oem.

For example, this is raw data of a hpe server when query Thermal.

{
  "@odata.context": "/redfish/v1/$metadata#Thermal.Thermal",
  "@odata.etag": "W/\"AEC0B081\"",
  "@odata.id": "/redfish/v1/Chassis/1/Thermal/",
  "@odata.type": "#Thermal.v1_1_0.Thermal",
  "Id": "Thermal",
  "Fans": [
    {
      "@odata.id": "/redfish/v1/Chassis/1/Thermal/#Fans/4",
      "MemberId": "4",
      "Name": "Fan 5",
      "Oem": {
        "Hpe": {
          "@odata.context": "/redfish/v1/$metadata#HpeServerFan.HpeServerFan",
          "@odata.type": "#HpeServerFan.v2_0_0.HpeServerFan",
          "HotPluggable": true,
          "Location": "System",
          "Redundant": true
        }
      },
      "Reading": 35,
      "ReadingUnits": "Percent",
      "Status": {
        "Health": "OK",
        "State": "Enabled"
      }
    }
  ],
  "Name": "Thermal",
  "Oem": {
    "Hpe": {
      "@odata.context": "/redfish/v1/$metadata#HpeThermalExt.HpeThermalExt",
      "@odata.type": "#HpeThermalExt.v2_0_0.HpeThermalExt",
      "FanPercentMinimum": 15,
      "ThermalConfiguration": "OptimalCooling"
    }
  },
  "Temperatures": [
    {
      "@odata.id": "/redfish/v1/Chassis/1/Thermal/#Temperatures/0",
      "MemberId": "0",
      "Name": "01-Inlet Ambient",
      "Oem": {
        "Hpe": {
          "@odata.context": "/redfish/v1/$metadata#HpeSeaOfSensors.HpeSeaOfSensors",
          "@odata.type": "#HpeSeaOfSensors.v2_0_0.HpeSeaOfSensors",
          "LocationXmm": 15,
          "LocationYmm": 0
        }
      },
      "PhysicalContext": "Intake",
      "ReadingCelsius": 24,
      "SensorNumber": 1,
      "Status": {
        "Health": "OK",
        "State": "Enabled"
      },
      "UpperThresholdCritical": 42,
      "UpperThresholdFatal": 47,
      "UpperThresholdUser": 0
    }
  ]
}

We can see the Oem and the Fan.Oem in the json but not in the Thermal and Fan, and could we support the 2 fields to return oem information?

stmcginnis commented 2 years ago

Hi @daadajuan - OEM data is unique to each vendor, so it's handled a little differently. See background here for details on how vendor plugins need to be implemented to access this data.

daadajuan commented 2 years ago

@stmcginnis - Thanks for your reply. In the issue you mentioned, I saw that @mikeletux added Oem json.RawMessage field in Service struct, similarly, I'm going to add Oem json.RawMessage in Thermal struct and Fan struct. And I will create a new folder oem to code the logic for handle oem information from vendors, like your example in the issue. For now, I have coded a change for this problem, you can see the PR if you are available. Thanks a lot.

stmcginnis commented 5 months ago

Closed by #178