Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do I update OEM resources #392

Open
yeyuan20 opened this issue Dec 26, 2024 · 1 comment
Open

How do I update OEM resources #392

yeyuan20 opened this issue Dec 26, 2024 · 1 comment

Comments

@yeyuan20
Copy link

Hi,
I have a scenario where certain resources in the BMC, such as the NetworkProtocol resource, include an OEM-specific section, like:
{
....
"oem": {
"CompanyName": {
"SSDP": "Enabled"
}
}
}
I need to perform an update to this resource using the PATCH method.
My question is: Should I create a custom folder for my company name under the oem section, and within that, define my own NetworkProtocol resource? Then, should I override the update method for this custom resource?

Thanks!

@stmcginnis
Copy link
Owner

Hi @yeyuan20. You have at least three options here.

  1. You can create a folder for this vendor under the /oem folder in the repo and implement any OEM functionality needed there. If you look at the /oem/smc files, there should be examples of most things you would need to do to implement the OEM functionality.
  2. You can implement the same, but keep it local to your own source code. The original idea with OEM support was that each vendor could be its own separate module that could be installed as needed. Something like being able to do go get github.com/supermicro/gofish-extension. That never happened, but there's no reason you couldn't keep your changes "out of tree" if you wanted to. That said, if you are going to implement it anyway, it would be great to add it directly to the gofish project so others can use it too.
  3. If there are just a couple things you need, you could just implement some marshaling directly in your code that needs it. So it would be something like this:
type VendorNetworkSettings struct {
	 CompanyName struct {
		SSDP string
	}
}


func SSDPState(system *redfish.System) (string, error) {
	t := VendorNetworkSettings{}

	err := json.Unmarshal(system.OEM, &t)
	if err != nil {
		return "", err
	}

	return t.CompanyName.SSDP
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants