You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm with Redfish as well, targeting things from the python side.
I use commonism/aiopenapi3 to create a dynamic OpenAPI client from the description documents and just started creating a thin layer on top to make things pretty. I just published aiopenapi3_redfish to accompany this issue - it requires some changes to aiopenapi3 to be merged
aiopenapi3 uses pydantic for data validation, so I'm aware of the differences in specification and protocol implemented, as well as the inconsistencies in the description documents themselves.
But aiopenapi3 allows to interfere with the description document and message processing to align the description document to be valid OpenAPI and the Messages to comply to the description documents specification, for redfish this section is called the clinic.
The clinic is the alternative to waiting for a vendor to come up with firmware updates.
Some examples of what the clinic does does for Dell (d9-6.10.80.00-A00) …
Task as returned by an Action (here "#OemManager.ExportSystemConfiguration) is invalid, it does not have a JSON body and all you get is the Location header.
The clinic creates the minimum required to make it a valid message to comply to the description document.
TaskServer/{TaskId} … got issues as well - for tasks in progress it returns status_code 202, which is undefined by the spec, finished tasks (status_code == 200) just return the tasks data without json envelope, though there is no alternate content type defined in the spec.
As aiopenapi3 creates the client dynamically, it would be possible to modify the description document to accept status_code 202 or alternating response content_types, but I prefer to limit the changes to description document to the minimum required.
e.g. …
classDocument(aiopenapi3.plugin.Document):
def__init__(self, url):
self._url=urlsuper().__init__()
defparsed(self, ctx):
ifstr(ctx.url) ==self._url:
# mangle the Task refs in the loaded openapi.yamlfork, vinctx.document["paths"].items():
foro, opinv.items():
forcode, contentinop["responses"].items():
if"content"notincontent:
continuetry:
s=content["content"]["application/json"]["schema"]
exceptKeyError:
continueif"$ref"insands["$ref"] =="/redfish/v1/Schemas/Task.v1_6_0.yaml#/components/schemas/Task":
s["$ref"] ="/redfish/v1/Schemas/Task.v1_6_0.yaml#/components/schemas/Task_v1_6_0_Task"""" set the PathItems security to X-Auth OR basicAuth instead of X-Auth AND basicAuth """fork, vinctx.document["paths"].items():
foro, opinv.items():
ifop["security"] == [{"basicAuth": [], "X-Auth": []}]:
op["security"] = [{"basicAuth": []}, {"X-Auth": []}]
That said my experience with the clinic are great and I propose to adapt this concept to gofish.
Allowing third parties to plugin doctors to the clinic will improve the compatibility with real world implementations, as discussed in #45 (comment).
As the comment picks up Oem as well … I allow detouring by path and @odata.type to redirect class creation for Oem (but not limited to).
First character indicates - # a @odata.type is used, "/" is a path.
I normalize all pathes in use to match the path from the description document.
e.g. /redfish/v1/Managers/iDRAC.Embedded.1/Oem/Dell/Jobs/JID_959816896261
is /redfish/v1/Managers/{ManagerId}/Oem/Dell/Jobs/{DellJobId}
with parameters ManagerId=iDRAC.Embedded.1, DellJobId=JID_959816896261
In the example - _v is the parsed value of the message as provided by aiopenapi3, ResourceRoot is the usability layer on top.
This example is paving the road to use DellAttributes …
I'm not aware of a OpenAPI client library using reflect to create the Schemas from the description document dynamically at runtime, but I'm not close with the go OpenAPI ecosystem.
but this project does not have discussions, so …
Hi,
I'm with Redfish as well, targeting things from the python side.
I use commonism/aiopenapi3 to create a dynamic OpenAPI client from the description documents and just started creating a thin layer on top to make things pretty.
I just published aiopenapi3_redfish to accompany this issue - it requires some changes to aiopenapi3 to be merged
aiopenapi3 uses pydantic for data validation, so I'm aware of the differences in specification and protocol implemented, as well as the inconsistencies in the description documents themselves.
But aiopenapi3 allows to interfere with the description document and message processing to align the description document to be valid OpenAPI and the Messages to comply to the description documents specification, for redfish this section is called the clinic.
The clinic is the alternative to waiting for a vendor to come up with firmware updates.
Some examples of what the clinic does does for Dell (d9-6.10.80.00-A00) …
Task as returned by an Action (here
"#OemManager.ExportSystemConfiguration
) is invalid, it does not have a JSON body and all you get is the Location header.The clinic creates the minimum required to make it a valid message to comply to the description document.
TaskServer/{TaskId} … got issues as well - for tasks in progress it returns status_code 202, which is undefined by the spec, finished tasks (status_code == 200) just return the tasks data without json envelope, though there is no alternate content type defined in the spec.
The clinic mangles the Message …
As aiopenapi3 creates the client dynamically, it would be possible to modify the description document to accept status_code 202 or alternating response content_types, but I prefer to limit the changes to description document to the minimum required.
e.g. …
That said my experience with the clinic are great and I propose to adapt this concept to gofish.
Allowing third parties to plugin
doctors
to the clinic will improve the compatibility with real world implementations, as discussed in #45 (comment).As the comment picks up Oem as well … I allow detouring by path and
@odata.type
to redirect class creation for Oem (but not limited to).First character indicates - # a @odata.type is used, "/" is a path.
I normalize all pathes in use to match the path from the description document.
e.g.
/redfish/v1/Managers/iDRAC.Embedded.1/Oem/Dell/Jobs/JID_959816896261
is
/redfish/v1/Managers/{ManagerId}/Oem/Dell/Jobs/{DellJobId}
with parameters ManagerId=iDRAC.Embedded.1, DellJobId=JID_959816896261
In the example -
_v
is the parsed value of the message as provided by aiopenapi3, ResourceRoot is the usability layer on top.This example is paving the road to use DellAttributes …
First -
At
/redfish/v1/Managers/iDRAC.Embedded.1
#DellOem.v1_3_0.DellOemLinks has to be converted to a Collection
Give DellAttributes some helper to access the data:
can be used with:
That said, I really enjoyed looking at gofish, hope you can get some inspiration as well.
The text was updated successfully, but these errors were encountered: