Skip to content

Commit f2f36d5

Browse files
committed
Add support for /redfish/v1/odata
1 parent c817170 commit f2f36d5

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

emulator.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,36 @@ def get_metadata():
382382
resp = error_response('Internal Server Error', 500, True)
383383
return resp
384384

385+
# Return odata
386+
@g.app.route('/redfish/v1/odata')
387+
def get_odata():
388+
logging.info ('In get_odata')
389+
try:
390+
391+
odata_json = ""
392+
393+
if os.path.exists('Resources/odata/index.json'):
394+
# Use dynamic data source
395+
filename = 'Resources/odata/index.json'
396+
else:
397+
# Use static mockup
398+
mockup_path = MOCKUPFOLDERS[0]
399+
filename = os.path.join("api_emulator", mockup_path, 'static', 'odata', 'index.json')
400+
401+
with open(filename, 'r') as var:
402+
for line in var:
403+
line = line.rstrip()
404+
odata_json += line
405+
406+
resp = make_response(odata_json, 200)
407+
return resp
408+
409+
except Exception:
410+
traceback.print_exc()
411+
resp = error_response('Internal Server Error', 500, True)
412+
return resp
413+
414+
385415
#
386416
# If any other RESTful request, send to RedfishAPI object for processing. Note: <path:path> specifies any path
387417
#

0 commit comments

Comments
 (0)