Skip to content

Commit df937d4

Browse files
authored
Update README.md
Corrected formatting and added a section about setting up initial accounts for redfish emulator authorization.
1 parent 47f159e commit df937d4

File tree

1 file changed

+67
-34
lines changed

1 file changed

+67
-34
lines changed

README.md

Lines changed: 67 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ New BMC types for emulation are created by loading a complete static mockup and
1515
* [Running the emulator](#running-the-emulator)
1616
* [Docker](#docker)
1717
* [Locally](#locally)
18+
* [Redfish Authorization](#redfish-auth)
1819
* [Creating a new BMC type for emulation](#creating-new-emulator)
1920
* [Creating a static mockup](#creating-static-mockup)
2021
* [Creating dynamic resources](#creating-dynamic-resources)
@@ -85,6 +86,38 @@ The setup.sh script can also be run without starting the emulator to just prepar
8586

8687
**NOTE:** If <WORK_DIR> already exists before running the setup.sh script, it will first get deleted.
8788

89+
<a name="redfish-auth"></a>
90+
91+
### Redfish Authorization
92+
93+
The emulator supports Basic and session authorization (X-Auth-Token). Initial accounts can be created by setting the AUTH_CONFIG environment variable. The expected format is <username>:<password>:<role> where <role> is one of Administrator, Operator, or ReadOnly as defined by DMTF as required default redfish roles.
94+
95+
These roles carry the following redfish privileges as defined by DMTF:
96+
- Administrator
97+
- Login
98+
- ConfigureManager
99+
- ConfigureUsers
100+
- ConfigureSelf
101+
- ConfigureComponents
102+
- Operator
103+
- Login
104+
- ConfigureSelf
105+
- ConfigureComponents
106+
- ReadOnly
107+
- Login
108+
- ConfigureSelf
109+
110+
Access to the emulators URIs are privilege based and are set per HTTP method for dynamic resources. Static resources (GET only) require Login privileges for access.
111+
112+
Any account specified by AUTH_CONFIG will be also added under the AccountService in the emulated redfish server and, if using the dynamic resource, can be manipulated (Add/Delete/Patch) using the AccountService. Actions under the AccountService will affect the emulator's authorization accounts.
113+
114+
Similarly session tokens can be created with SessionService actions if the emulator is using the dynamic resource. No sessions exist by default.
115+
116+
By default, if AUTH_CONFIG is empty or an invalid format, the emulator will have 3 accounts created:
117+
- root:root_password:Administrator
118+
- operator:operator_password:Operator
119+
- guest:guest_password:ReadOnly
120+
88121
<a name="creating-new-emulator"></a>
89122

90123
## Creating a new BMC type for emulation
@@ -147,35 +180,35 @@ The default loader is the parent Loader python class that is used as the base fo
147180
The Loader class currently sets up dynamic resources for:
148181
- Power Limit (init_power_limit())
149182
- Generic Power Limit Schema
150-
GET/PATCH /redfish/v1/Chassis/{sys_id}/Power
183+
- GET/PATCH /redfish/v1/Chassis/{sys_id}/Power
151184
- HPE Cray EX Power Limit Schema
152-
GET/PATCH /redfish/v1/Chassis/{sys_id}/Controls/{control_id}
153-
PATCH /redfish/v1/Chassis/{sys_id}/Controls.Deep
185+
- GET/PATCH /redfish/v1/Chassis/{sys_id}/Controls/{control_id}
186+
- PATCH /redfish/v1/Chassis/{sys_id}/Controls.Deep
154187
- Apollo 6500 Power Limit Schema
155-
GET /redfish/v1/Chassis/{sys_id}/Power/AccPowerService/PowerLimit
156-
POST /redfish/v1/Chassis/{sys_id}/Power/AccPowerService/PowerLimit/Actions/HpeServerAccPowerLimit.ConfigurePowerLimit
188+
- GET /redfish/v1/Chassis/{sys_id}/Power/AccPowerService/PowerLimit
189+
- POST /redfish/v1/Chassis/{sys_id}/Power/AccPowerService/PowerLimit/Actions/HpeServerAccPowerLimit.ConfigurePowerLimit
157190
- System Power Actions (init_system_reset())
158191
- Generic
159-
GET /redfish/v1/Systems/{sys_id}
160-
GET/POST /redfish/v1/Systems/{sys_id}/Actions/ComputerSystem.Reset
192+
- GET /redfish/v1/Systems/{sys_id}
193+
- GET/POST /redfish/v1/Systems/{sys_id}/Actions/ComputerSystem.Reset
161194
- Update Service (init_update_service())
162195
- Generic
163-
GET /redfish/v1/UpdateService/FirmwareInventory/{target_id}
164-
POST /redfish/v1/UpdateService/SimpleUpdate
165-
GET/PATCH /redfish/v1/UpdateService/FirmwareInventory/Config
196+
- GET /redfish/v1/UpdateService/FirmwareInventory/{target_id}
197+
- POST /redfish/v1/UpdateService/SimpleUpdate
198+
- GET/PATCH /redfish/v1/UpdateService/FirmwareInventory/Config
166199
- Account Service (init_account_service())
167200
- Generic
168-
GET/POST /redfish/v1/AccountService/Accounts
169-
GET/PATCH/DELETE /redfish/v1/AccountService/Accounts/{id}
201+
- GET/POST /redfish/v1/AccountService/Accounts
202+
- GET/PATCH/DELETE /redfish/v1/AccountService/Accounts/{id}
170203
- Session Service (init_session_service())
171204
- Generic
172-
GET/POST /redfish/v1/SessionService/Sessions
173-
GET/DELETE /redfish/v1/AccountService/Sessions/{id}
205+
- GET/POST /redfish/v1/SessionService/Sessions
206+
- GET/DELETE /redfish/v1/AccountService/Sessions/{id}
174207
- Event Service (init_event_service())
175208
- Generic
176-
GET/PATCH /redfish/v1/EventService
177-
GET/POST /redfish/v1/EventService/Subscriptions
178-
GET/PATCH/DELETE /redfish/v1/EventService/Subscriptions/{sub_id}
209+
- GET/PATCH /redfish/v1/EventService
210+
- GET/POST /redfish/v1/EventService/Subscriptions
211+
- GET/PATCH/DELETE /redfish/v1/EventService/Subscriptions/{sub_id}
179212
- Redfish Event Generation Schemas (get_event_template())
180213
- Generic
181214
- Intel
@@ -326,36 +359,36 @@ Some dynamic resources such as the EventService generate responses (i.e. Redfish
326359
## Existing dynamic resources:
327360
- Power Control
328361
- Generic - [power_control_api.py](https://github.com/Cray-HPE/csm-redfish-interface-emulator/blob/master/src/api_emulator/redfish/power_control_api.py)
329-
GET/PATCH /redfish/v1/Chassis/{sys_id}/Power
362+
- GET/PATCH /redfish/v1/Chassis/{sys_id}/Power
330363
- HPE Cray EX - [hpe_cray_ex_power_control_api.py](https://github.com/Cray-HPE/csm-redfish-interface-emulator/blob/master/src/api_emulator/redfish/hpe_cray_ex_power_control_api.py)
331-
GET/PATCH /redfish/v1/Chassis/<system_id>/Controls/<control_id>
332-
PATCH /redfish/v1/Chassis/<system_id>/Controls.Deep
364+
- GET/PATCH /redfish/v1/Chassis/<system_id>/Controls/<control_id>
365+
- PATCH /redfish/v1/Chassis/<system_id>/Controls.Deep
333366
- Proliant iLO - [proliant_ilo_power_control_api.py](https://github.com/Cray-HPE/csm-redfish-interface-emulator/blob/master/src/api_emulator/redfish/proliant_ilo_power_control_api.py)
334-
GET /redfish/v1/Chassis/{sys_id}/Power/AccPowerService/PowerLimit
335-
POST /redfish/v1/Chassis/{sys_id}/Power/AccPowerService/PowerLimit/Actions/HpeServerAccPowerLimit.ConfigurePowerLimit
367+
- GET /redfish/v1/Chassis/{sys_id}/Power/AccPowerService/PowerLimit
368+
- POST /redfish/v1/Chassis/{sys_id}/Power/AccPowerService/PowerLimit/Actions/HpeServerAccPowerLimit.ConfigurePowerLimit
336369
- Computer System Power Actions - [computer_systems_api.py](https://github.com/Cray-HPE/csm-redfish-interface-emulator/blob/master/src/api_emulator/redfish/computer_systems_api.py)
337-
GET /redfish/v1/Systems/<system_id>
338-
POST /redfish/v1/Systems/<system_id>/Actions/ComputerSystem.Reset
370+
- GET /redfish/v1/Systems/<system_id>
371+
- POST /redfish/v1/Systems/<system_id>/Actions/ComputerSystem.Reset
339372
- Firmware Update - [update_service_api.py](https://github.com/Cray-HPE/csm-redfish-interface-emulator/blob/master/src/api_emulator/redfish/update_service_api.py)
340-
GET /redfish/v1/UpdateService/FirmwareInventory/<target_id>
341-
POST /redfish/v1/UpdateService/SimpleUpdate
342-
GET/PATCH /redfish/v1/UpdateService/FirmwareInventory/Config
373+
- GET /redfish/v1/UpdateService/FirmwareInventory/<target_id>
374+
- POST /redfish/v1/UpdateService/SimpleUpdate
375+
- GET/PATCH /redfish/v1/UpdateService/FirmwareInventory/Config
343376
- EventService - [event_service_api.py](https://github.com/Cray-HPE/csm-redfish-interface-emulator/blob/master/src/api_emulator/redfish/event_service_api.py), [event_generator.py](https://github.com/Cray-HPE/csm-redfish-interface-emulator/blob/master/src/api_emulator/redfish/event_generator.py)
344-
GET/PATCH /redfish/v1/EventService
345-
GET/POST /redfish/v1/EventService/Subscriptions
346-
GET/PATCH/DELETE /redfish/v1/EventService/Subscriptions/<id>
377+
- GET/PATCH /redfish/v1/EventService
378+
- GET/POST /redfish/v1/EventService/Subscriptions
379+
- GET/PATCH/DELETE /redfish/v1/EventService/Subscriptions/<id>
347380
- Event templates
348381
- Generic - [events.py](https://github.com/Cray-HPE/csm-redfish-interface-emulator/blob/master/src/api_emulator/redfish/templates/events.py)
349382
- Intel - [intel_events.py](https://github.com/Cray-HPE/csm-redfish-interface-emulator/blob/master/src/api_emulator/redfish/templates/intel_events.py)
350383
- Gigabyte - [gigabyte_events.py](https://github.com/Cray-HPE/csm-redfish-interface-emulator/blob/master/src/api_emulator/redfish/templates/gigabyte_events.py)
351384
- HPE Cray - [hpe_cray_ex_events.py](https://github.com/Cray-HPE/csm-redfish-interface-emulator/blob/master/src/api_emulator/redfish/templates/hpe_cray_ex_events.py)
352385
- Proliant iLO - [proliant_ilo_events.py](https://github.com/Cray-HPE/csm-redfish-interface-emulator/blob/master/src/api_emulator/redfish/templates/proliant_ilo_events.py)
353386
- Account Service - [account_service_api.py](https://github.com/Cray-HPE/csm-redfish-interface-emulator/blob/master/src/api_emulator/redfish/account_service_api.py)
354-
GET/POST /redfish/v1/AccountService/Accounts
355-
GET/PATCH/DELETE /redfish/v1/AccountService/Accounts/{id}
387+
- GET/POST /redfish/v1/AccountService/Accounts
388+
- GET/PATCH/DELETE /redfish/v1/AccountService/Accounts/{id}
356389
- Session Service - [session_service_api.py](https://github.com/Cray-HPE/csm-redfish-interface-emulator/blob/master/src/api_emulator/redfish/session_service_api.py)
357-
GET/POST /redfish/v1/SessionService/Sessions
358-
GET/DELETE /redfish/v1/AccountService/Sessions/{id}
390+
- GET/POST /redfish/v1/SessionService/Sessions
391+
- GET/DELETE /redfish/v1/AccountService/Sessions/{id}
359392

360393
<a name="emulator-loader-map"></a>
361394

0 commit comments

Comments
 (0)