Skip to content

Commit

Permalink
Merge pull request #120 from DMTF/Fix119-Bios-URIs
Browse files Browse the repository at this point in the history
Corrected Bios-related static resources in the built-in mockup to use correct URIs
  • Loading branch information
mraineri authored May 31, 2024
2 parents 43d486a + 0aeddd5 commit fa40ba9
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
"UsbControl": "UsbEnabled"
},
"@odata.context": "/redfish/v1/$metadata#Bios.Bios",
"@odata.id": "/redfish/v1/Systems/437XR1138R2/BIOS/Settings",
"@odata.id": "/redfish/v1/Systems/437XR1138R2/Bios/Settings",
"@Redfish.Copyright": "Copyright 2014-2016 DMTF. For the full DMTF copyright policy, see http://www.dmtf.org/about/policies/copyright."
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"@odata.type": "#Bios.v1_0_0.Bios",
"Id": "BIOS",
"Id": "Bios",
"Name": "BIOS Configuration Current Settings",
"AttributeRegistry": "BiosAttributeRegistryP89.v1_0_0",
"Attributes": {
Expand All @@ -25,19 +25,19 @@
]
}],
"SettingsObject": {
"@odata.id": "/redfish/v1/Systems/437XR1138R2/BIOS/Settings"
"@odata.id": "/redfish/v1/Systems/437XR1138R2/Bios/Settings"
},
"Time": "2016-03-07T14:44.30-05:00"
},
"Actions": {
"#Bios.ResetBios": {
"target": "/redfish/v1/Systems/437XR1138R2/BIOS/Actions/Bios.ResetBios"
"target": "/redfish/v1/Systems/437XR1138R2/Bios/Actions/Bios.ResetBios"
},
"#Bios.ChangePassword": {
"target": "/redfish/v1/Systems/437XR1138R2/BIOS/Actions/Bios.ChangePassword"
"target": "/redfish/v1/Systems/437XR1138R2/Bios/Actions/Bios.ChangePassword"
}
},
"@odata.context": "/redfish/v1/$metadata#Bios.Bios",
"@odata.id": "/redfish/v1/Systems/437XR1138R2/BIOS",
"@odata.id": "/redfish/v1/Systems/437XR1138R2/Bios",
"@Redfish.Copyright": "Copyright 2014-2016 DMTF. For the full DMTF copyright policy, see http://www.dmtf.org/about/policies/copyright."
}
2 changes: 1 addition & 1 deletion api_emulator/redfish/static/Systems/437XR1138R2/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
}
},
"Bios": {
"@odata.id": "/redfish/v1/Systems/437XR1138R2/BIOS"
"@odata.id": "/redfish/v1/Systems/437XR1138R2/Bios"
},
"Processors": {
"@odata.id": "/redfish/v1/Systems/437XR1138R2/Processors"
Expand Down
14 changes: 4 additions & 10 deletions emulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,6 @@ def error_response(msg, status, jsonify=False):
class PathError(Exception):
pass

@g.api.representation('application/xml')
def output_xml(data, code, headers=None):
resp = make_response(data, code)
resp.headers.extend(headers or {})
resp.headers['Content-Type'] = 'text/xml; charset=ISO-8859-1'
return resp

@g.api.representation('application/json')
def output_json(data, code, headers=None):
"""
Expand Down Expand Up @@ -352,7 +345,7 @@ def serviceInfo():
def browse():
return render_template('browse.html')

# Return metadata as type text/xml
# Return metadata as type application/xml
@g.app.route('/redfish/v1/$metadata')
def get_metadata():
logging.info ('In get_metadata')
Expand All @@ -365,7 +358,8 @@ def get_metadata():
filename = 'Resources/$metadata/index.xml'
else:
# Use static mockup
mockup_path = MOCKUPFOLDERS[0]
# Static resource loader relies on the folder to be lower case, but inspects it based on the capitalization...
mockup_path = MOCKUPFOLDERS[0].lower()
filename = os.path.join("api_emulator", mockup_path, 'static', '$metadata', 'index.xml')

with open(filename, 'r') as var:
Expand All @@ -374,7 +368,7 @@ def get_metadata():
md_xml += line

resp = make_response(md_xml, 200)
resp.headers['Content-Type'] = 'text/xml'
resp.headers['Content-Type'] = 'application/xml'
return resp

except Exception:
Expand Down

0 comments on commit fa40ba9

Please sign in to comment.