Redfish-Interface-Emulator icon indicating copy to clipboard operation
Redfish-Interface-Emulator copied to clipboard

curl POST request getting a 404 not found return from emulator.py

Open jimlundberg opened this issue 2 years ago • 1 comments

Both my IBM CentOS server and my local wsl CentOS image are both getting a 404 return on a POST request. It is happening with both http and https requests. I would think the problem may be in the flask module or maybe requests.

Client side:

(venv) [root@IBM-R912JTS2 emulator]# curl -X POST -k -H 'Content-Type: application/json' https://9.114.207.147:5000/redfish/v1/SessionService/Sessions -d '{"UserName":"Admin"}' curl: (7) Failed to connect to 9.114.207.147 port 5000: Connection refused (venv) [root@IBM-R912JTS2 emulator]# clear (venv) [root@IBM-R912JTS2 emulator]# curl -X POST -k -H 'Content-Type: application/json' https://172.24.225.83:5000/redfish/v1/SessionService/Sessions -d '{"UserName":"Admin"}' ""(venv) [root@IBM-R912JTS2 emulator]# curl -X GET -H 'Content-Type: application/json' https://172.24.225.83:5000/redfish/v1/ curl: (60) SSL certificate problem: self signed certificate More details here: https://curl.haxx.se/docs/sslcerts.html

curl failed to verify the legitimacy of the server and therefore could not establish a secure connection to it. To learn more about this situation and how to fix it, please visit the web page mentioned above. (venv) [root@IBM-R912JTS2 emulator]# curl -k -X GET -H 'Content-Type: application/json' https://172.24.225.83:5000/redfish/v1/ { "@odata.context": "/redfish/v1/$metadata#ServiceRoot", "@odata.type": "#ServiceRoot.1.0.0.ServiceRoot", "@odata.id": "/redfish/v1/", ....

Server side:

(venv) [root@IBM-R912JTS2 emulator]# python3 emulator.py /mnt/c/Users/C-VS95897/venv/lib64/python3.6/site-packages/requests/init.py:104: RequestsDependencyWarning: urllib3 (1.26.9) or chardet (5.0.0)/charset_normalizer (2.0.12) doesn't match a supported version! RequestsDependencyWarning) INFO:root:Mockup folders ['Redfish']

  • Redfish endpoint at localhost:5000
  • Using static mockup INFO:root:Init ResourceDictionary. INFO:root:Loading Redfish static resources INFO:root:Init ResourceDictionary.
  • Use HTTPS
  • Running in Redfish mode
  • Serving Flask app 'g' (lazy loading)
  • Environment: production WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
  • Debug mode: off WARNING:werkzeug: * Running on all addresses. WARNING: This is a development server. Do not use it in a production deployment. INFO:werkzeug: * Running on https://172.24.225.83:5000/ (Press CTRL+C to quit) INFO:werkzeug:172.24.225.83 - - [05/Jul/2022 10:57:23] "POST /redfish/v1/SessionService/Sessions HTTP/1.1" 404 - INFO:werkzeug:172.24.225.83 - - [05/Jul/2022 10:58:40] "GET /redfish/v1/ HTTP/1.1" 200 -

jimlundberg avatar Jul 05 '22 18:07 jimlundberg

The SessionService resource is not fully implemented in this emulator. Hence there are stubs in the resource API file - ./api_emulator/redfish/SessionService_api.py

Fortunately, the SNIA API Emulator (https://github.com/SNIA/Swordfish-API-Emulator) is working to fix this.

jcleung5549 avatar Jul 15 '22 20:07 jcleung5549