Skip to content

Commit fa40ba9

Browse files
authoredMay 31, 2024··
Merge pull request #120 from DMTF/Fix119-Bios-URIs
Corrected Bios-related static resources in the built-in mockup to use correct URIs
2 parents 43d486a + 0aeddd5 commit fa40ba9

File tree

4 files changed

+11
-17
lines changed

4 files changed

+11
-17
lines changed
 

‎api_emulator/redfish/static/Systems/437XR1138R2/BIOS/Settings/index.json ‎api_emulator/redfish/static/Systems/437XR1138R2/Bios/Settings/index.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@
1616
"UsbControl": "UsbEnabled"
1717
},
1818
"@odata.context": "/redfish/v1/$metadata#Bios.Bios",
19-
"@odata.id": "/redfish/v1/Systems/437XR1138R2/BIOS/Settings",
19+
"@odata.id": "/redfish/v1/Systems/437XR1138R2/Bios/Settings",
2020
"@Redfish.Copyright": "Copyright 2014-2016 DMTF. For the full DMTF copyright policy, see http://www.dmtf.org/about/policies/copyright."
2121
}

‎api_emulator/redfish/static/Systems/437XR1138R2/BIOS/index.json ‎api_emulator/redfish/static/Systems/437XR1138R2/Bios/index.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"@odata.type": "#Bios.v1_0_0.Bios",
3-
"Id": "BIOS",
3+
"Id": "Bios",
44
"Name": "BIOS Configuration Current Settings",
55
"AttributeRegistry": "BiosAttributeRegistryP89.v1_0_0",
66
"Attributes": {
@@ -25,19 +25,19 @@
2525
]
2626
}],
2727
"SettingsObject": {
28-
"@odata.id": "/redfish/v1/Systems/437XR1138R2/BIOS/Settings"
28+
"@odata.id": "/redfish/v1/Systems/437XR1138R2/Bios/Settings"
2929
},
3030
"Time": "2016-03-07T14:44.30-05:00"
3131
},
3232
"Actions": {
3333
"#Bios.ResetBios": {
34-
"target": "/redfish/v1/Systems/437XR1138R2/BIOS/Actions/Bios.ResetBios"
34+
"target": "/redfish/v1/Systems/437XR1138R2/Bios/Actions/Bios.ResetBios"
3535
},
3636
"#Bios.ChangePassword": {
37-
"target": "/redfish/v1/Systems/437XR1138R2/BIOS/Actions/Bios.ChangePassword"
37+
"target": "/redfish/v1/Systems/437XR1138R2/Bios/Actions/Bios.ChangePassword"
3838
}
3939
},
4040
"@odata.context": "/redfish/v1/$metadata#Bios.Bios",
41-
"@odata.id": "/redfish/v1/Systems/437XR1138R2/BIOS",
41+
"@odata.id": "/redfish/v1/Systems/437XR1138R2/Bios",
4242
"@Redfish.Copyright": "Copyright 2014-2016 DMTF. For the full DMTF copyright policy, see http://www.dmtf.org/about/policies/copyright."
4343
}

‎api_emulator/redfish/static/Systems/437XR1138R2/index.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
}
8080
},
8181
"Bios": {
82-
"@odata.id": "/redfish/v1/Systems/437XR1138R2/BIOS"
82+
"@odata.id": "/redfish/v1/Systems/437XR1138R2/Bios"
8383
},
8484
"Processors": {
8585
"@odata.id": "/redfish/v1/Systems/437XR1138R2/Processors"

‎emulator.py

+4-10
Original file line numberDiff line numberDiff line change
@@ -124,13 +124,6 @@ def error_response(msg, status, jsonify=False):
124124
class PathError(Exception):
125125
pass
126126

127-
@g.api.representation('application/xml')
128-
def output_xml(data, code, headers=None):
129-
resp = make_response(data, code)
130-
resp.headers.extend(headers or {})
131-
resp.headers['Content-Type'] = 'text/xml; charset=ISO-8859-1'
132-
return resp
133-
134127
@g.api.representation('application/json')
135128
def output_json(data, code, headers=None):
136129
"""
@@ -352,7 +345,7 @@ def serviceInfo():
352345
def browse():
353346
return render_template('browse.html')
354347

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

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

376370
resp = make_response(md_xml, 200)
377-
resp.headers['Content-Type'] = 'text/xml'
371+
resp.headers['Content-Type'] = 'application/xml'
378372
return resp
379373

380374
except Exception:

0 commit comments

Comments
 (0)
Please sign in to comment.