stmcginnis / gofish

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

Read rawData for an entity #142

Closed sosodev closed 3 years ago

sosodev commented 3 years ago

Would it be reasonable to add a function to get a copy of the rawData for an entity? I've noticed that I often need to get some OEM specific data that gofish does not parse and I have to manually re-request and parse the entity JSON. I'd be glad to open a PR if you think this is reasonable :+1:

stmcginnis commented 3 years ago

Ideally I'd like to avoid that, but it does seem reasonable if it's necessary to be able to access something.

Is the main need that OEM data is not exposed in the objects themselves? That is on my list to get to soon. If that would meet your needs, I can try to prioritize getting that plumbed in so you don't need to jump through extra hoops to get the data you need.

sosodev commented 3 years ago

Right, I need to handle things that are OEM specific and not currently exposed in the objects themselves. What's your plan for handling OEM extensions in a generic way? I read in some other issue threads that you were having trouble finding a way of doing it with Go (understandable)

Right now I simply try to parse multiple formats that I know exist on our systems until one succeeds.

For example I know that our Supermicro systems will enumerate a drive's Indicate action in one of two ways:

  "Actions": {
    "Oem": {
      "#Drive.Indicate": {
        "target": "/redfish/v1/Chassis/NVMeSSD.0.Group.0.StorageBackplane/Drives/Disk.Bay.0/Actions/Oem/Drive.Indicate",
        "@Redfish.ActionInfo": "/redfish/v1/Chassis/NVMeSSD.0.Group.0.StorageBackplane/Drives/Disk.Bay.0/IndicateActionInfo"
      }
    }
  }

or

"Actions": {
    "Oem": {
      "#SmcDrive.Indicate": {
        "target": "/redfish/v1/Chassis/NVMeSSD.0.Group.0.StorageBackplane/Drives/Disk.Bay.0/Actions/Oem/SmcDrive.Indicate",
        "@Redfish.ActionInfo": "/redfish/v1/Chassis/NVMeSSD.0.Group.0.StorageBackplane/Drives/Disk.Bay.0/Oem/Supermicro/IndicateActionInfo"
      }
    }
  }

Though it seems like there is so much variability in OEM extensions that I'm just not sure how you could handle this stuff without context. In my opinion exposing a read-only rawData seems like a reasonable solution because the users have the context.

mikeletux commented 3 years ago

Hi Sean,

I'm jumping into this conversation because I'd like also to get OEM data parsed into structs. We can develop like a plugin system where we can create the structs for different vendors and if we are dealing with an specific vendor and these structs exist, use them when it comes to parsing JSON data. Something like that.

I'd be more than happy to help you here as well 😄

stmcginnis commented 3 years ago

Oh, interesting idea Miguel. Let me get a branch up (very soon) and the three of us can collaborate on the design there.

sosodev commented 3 years ago

Closing this since we've got more extensive OEM support merged in :smile: