How hardikvjoshi/redfish-profile-simulator works
1. This repository is a small, single-process Redfish service simulator written in Python and built on Flask. The runtime is an HTTP server that exposes a Redfish-compatible API for a “simple monolithic server” profile rather than a general-purpose management platform.
2. The entrypoint is redfishProfileSimulator.py, which likely reads CLI options for host, port, and profile path, then starts the Flask app. The simulator runs locally by default and serves plain HTTP only, with no external database or message broker.
3. The core architecture is an in-memory Redfish data model. Initial resource state is loaded from the MockupData/SimpleOcpServerV1 tree, which is a static Redfish mockup laid out as URI paths with index.json and index.xml files. After startup, the simulator mutates Python dictionaries in memory in response to client operations.
4. The v1sim package is the main implementation boundary. It appears to be organized by Redfish resource area: serviceRoot.py, serviceVersions.py, accountService.py, sessionService.py, managers.py, chassis.py, systems.py, network.py, storage.py, and updateService.py. These modules collectively define the service’s Redfish resources and the behavior behind each URI subtree.
5. Request handling is split between a REST/resource layer and the Flask layer. Files like resource.py, common_services.py, and redfishURIs.py suggest a generic resource abstraction plus URI routing/mapping logic, while flask_redfish_auth.py and security.py handle authentication and access control before requests reach the resource handlers.
6. Authentication is a first-class part of the design, even though the simulator is minimal. The README says it supports Basic Auth and Redfish Session Auth, but only for one hard-coded user/token. That means auth is not delegated to an external identity provider; it is enforced entirely inside the simulator process.
7. The data flow is: mockup files seed the model, Flask receives a request, auth middleware validates the caller, URI routing selects the appropriate Redfish resource module, and the module reads or patches the in-memory dictionaries. Supported operations include GET, PATCH, POST, and DELETE, so the simulator behaves like a mutable service rather than a read-only mock server.
8. The service model is intentionally small and aligned to an OCP Remote Machine Management-style “simple server.” The mockup includes one system, one chassis, one manager, an account service, and a session service. Resource collections and entity instances are represented explicitly in the directory structure under MockupData, mirroring the Redfish hierarchy.
9. The main managed domains are:
- Systems: the computer system, boot state, logs, and inventory-like fields
- Chassis: power and thermal data
- Managers: BMC network and protocol configuration
- AccountService: users and roles
- SessionService: session creation and token-based session state
These are the primary architectural “boundaries” an architecture diagram should show.
10. The MockupData/SimpleOcpServerV1/redfish/v1 tree is important because it defines the initial URI topology the simulator serves. The simulator is not inventing the Redfish shape at runtime; it is projecting a fixed, file-backed Redfish profile into memory and then exposing it through Flask.
11. The repository has no evidence of persistence beyond process memory. There is no database, filesystem write-back layer, or external state store indicated by the tree or README. Any changes made through PATCH/POST/DELETE are therefore runtime-only unless the simulator itself writes them back somewhere not shown here.
12. Operationally, this is a development/test tool for exercising Redfish clients. The README emphasizes easy URI extension, deliberate bad responses, and authentication testing. That makes the architecture closer to a configurable protocol simulator than a production service.
13. If you are drawing the architecture, the cleanest diagram is: client on one side; Flask HTTP server in the middle; auth middleware first; then URI/resource dispatch; then per-domain Redfish resource handlers; all backed by one in-memory model seeded from MockupData. The only “infrastructure” dependency is the Python runtime plus Flask.
Main entry points: resource.py Resource Core · v1 Mockup Tree · flask_redfish_auth.py Auth Layer · serviceRoot.py Service Root
Components 21
Runtime
HTTP entry and request handling
- Redfish Client · External tool or test client exercising the simulator
- Simulator Main · Parses CLI options and starts the Flask service
redfishProfileSimulator.py - Flask Server · Single-process HTTP runtime exposing the Redfish API
Simulator Core
Redfish resource model, auth, and routing
- Auth Layer · Validates Basic Auth and Redfish session tokens
v1sim/flask_redfish_auth.py - Access Control · Holds local authorization and token logic
v1sim/security.py - URI Router · Maps request paths to Redfish resource handlers
v1sim/redfishURIs.py - Resource Core · Generic request handling and in-memory resource operations
v1sim/resource.py - Common Services · Shared service behaviors and request utilities
v1sim/common_services.py - Service Root · Top-level Redfish service document and entry resources
v1sim/serviceRoot.py - Service Versions · Advertises supported Redfish versions and links
v1sim/serviceVersions.py - Account Service · User accounts and roles exposed through Redfish
v1sim/accountService.py - Session Service · Creates and tracks Redfish session state
v1sim/sessionService.py - Managers · BMC network and protocol configuration resources
v1sim/managers.py - Chassis · Power and thermal state for chassis resources
v1sim/chassis.py - Systems · Computer system state, logs, and inventory fields
v1sim/systems.py - Network · Network-oriented resource behavior and interfaces
v1sim/network.py - Storage · Storage-related resource behavior
v1sim/storage.py - Update Service · Firmware or update-related Redfish behavior
v1sim/updateService.py
Mockup Data
Static Redfish profile used to seed the in-memory model
- Mockup Tree · File-backed Redfish profile used to initialize runtime state
MockupData/SimpleOcpServerV1/redfish/v1 - Service Index · Initial service document and URI topology
MockupData/SimpleOcpServerV1/redfish/index.json - OData Meta · Redfish metadata document for the profile
MockupData/SimpleOcpServerV1/redfish/v1/$metadata/index.xml
Connections 26
- Redfish Client → Flask Server: HTTP requests · Clients call the local Redfish endpoint
- Simulator Main → Flask Server: starts · Main script launches the Flask server
- Flask Server → Auth Layer: auth first · Requests pass through authentication middleware
- Auth Layer → Access Control: checks · Authentication and authorization decisions are evaluated locally
- Auth Layer → URI Router: route after auth · Authenticated requests proceed to URI dispatch
- URI Router → Resource Core: dispatches · URI mapping resolves to a resource handler
- Resource Core → Common Services: uses · Shared service behavior and helpers support resource operations
- Resource Core → Service Root: serves · Handles the top-level service document
- Resource Core → Service Versions: serves · Handles version discovery and metadata links
- Resource Core → Account Service: serves · Handles account and role resources
- Resource Core → Session Service: serves · Handles session creation and lookup
- Resource Core → Managers: serves · Handles manager subtree resources
- Resource Core → Chassis: serves · Handles chassis subtree resources
- Resource Core → Systems: serves · Handles system subtree resources
- Resource Core → Network: serves · Handles network-related resources
- Resource Core → Storage: serves · Handles storage-related resources
- Resource Core → Update Service: serves · Handles update-related resources
- Mockup Tree → Service Root: seeds · Static profile data initializes the service root
- Mockup Tree → Service Versions: seeds · Profile metadata seeds supported version data
- Mockup Tree → Account Service: seeds · Mockup includes account and role documents
- Mockup Tree → Session Service: seeds · Mockup includes session collection state
- Mockup Tree → Managers: seeds · Mockup includes manager and network documents
- Mockup Tree → Chassis: seeds · Mockup includes chassis power and thermal documents
- Mockup Tree → Systems: seeds · Mockup includes system and log documents
- Mockup Tree → OData Meta: seeds · Metadata file accompanies the profile
- Service Index → Service Root: defines · Root index defines the served Redfish topology