Implement Redfish power on / power off support

Tested with:
redfishtool.py -S Never -r <host IP>:8080 Systems reset On
redfishtool.py -S Never -r <host IP>:8080 Systems reset ForceOff
parent d469aaff
This diff is collapsed.
......@@ -6,6 +6,18 @@
#ifndef _REDFISH_H
#define _REDFISH_H
#define REDFISH_BASE_PATH "/redfish/v1"
#define REDFISH_CHASSIS_PATH REDFISH_BASE_PATH "/Chassis"
#define REDFISH_SYSTEMS_PATH REDFISH_BASE_PATH "/Systems"
#define REDFISH_SYSTEM_PATH REDFISH_BASE_PATH "/Systems/system"
#define REDFISH_COMPUTER_SYSTEM_ACTION_RESET_PATH REDFISH_BASE_PATH "/Systems/system/Actions/ComputerSystem.Reset"
void register_redfish_request_handlers(struct mg_context *ctx);
int redfish_version_handler(struct mg_connection *conn, void *cbdata);
int redfish_v1_svclist_handler(struct mg_connection *conn, void *cbdata);
int redfish_v1_systems_endpoint_handler(struct mg_connection *conn, void *cbdata);
int redfish_v1_system_endpoint_handler(struct mg_connection *conn, void *cbdata);
int redfish_v1_system_reset_endpoint_handler(struct mg_connection *conn, void *cbdata);
#endif // _REDFISH_H
\ No newline at end of file
#endif // _REDFISH_H
......@@ -260,9 +260,7 @@ int power_control_handler(struct mg_connection *conn, void *cbdata)
int firmware_upload_form_handler(struct mg_connection *conn, void *cbdata)
{
mg_printf(conn,
"HTTP/1.1 200 OK\r\nContent-Type: text/html\r\nConnection: "
"close\r\n\r\n");
send_ok(conn);
SEND_STANDARD_HEADER(conn, "Firmware Management")
......@@ -341,10 +339,7 @@ int firmware_upload_handler(struct mg_connection *conn, void *cbdata)
main_firmware_buffer.locked = 0;
mg_printf(conn,
"HTTP/1.1 200 OK\r\n"
"Content-Type: text/html\r\n"
"Connection: close\r\n\r\n");
send_ok(conn);
SEND_STANDARD_HEADER(conn, "Firmware Uploaded")
......@@ -409,7 +404,7 @@ void *web_portal_pthread(void *arg)
mg_set_request_handler(ctx, "/firmware.upload$", firmware_upload_handler, (void *)0);
// Redfish
mg_set_request_handler(ctx, "/redfish$", redfish_version_handler, (void *)0);
register_redfish_request_handlers(ctx);
return 0;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment