# hardikvjoshi/redfish-profile-simulator architecture

> Architecture diagram of the GitHub repository hardikvjoshi/redfish-profile-simulator, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-05-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hardikvjoshi/redfish-profile-simulator
- Repository: https://github.com/hardikvjoshi/redfish-profile-simulator

## Overview

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: [`v1sim/resource.py`](https://github.com/hardikvjoshi/redfish-profile-simulator/blob/master/v1sim/resource.py) (Resource Core), [`MockupData/SimpleOcpServerV1/redfish/v1`](https://github.com/hardikvjoshi/redfish-profile-simulator/tree/master/MockupData/SimpleOcpServerV1/redfish/v1) (Mockup Tree), [`v1sim/flask_redfish_auth.py`](https://github.com/hardikvjoshi/redfish-profile-simulator/blob/master/v1sim/flask_redfish_auth.py) (Auth Layer), [`v1sim/serviceRoot.py`](https://github.com/hardikvjoshi/redfish-profile-simulator/blob/master/v1sim/serviceRoot.py) (Service Root)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_g_runtime["Runtime"]
  node_client(("Redfish Client<br/>caller"))
  node_entrypoint["Simulator Main<br/>python entrypoint"]
  node_flask["Flask Server<br/>HTTP server"]
end

subgraph group_g_core["Simulator Core"]
  node_auth["Auth Layer<br/>basic/session auth"]
  node_security["Access Control<br/>security checks<br/>[security.py]"]
  node_uris["URI Router<br/>routing map<br/>[redfishURIs.py]"]
  node_resource["Resource Core<br/>resource abstraction<br/>[resource.py]"]
  node_common["Common Services<br/>shared helpers<br/>[common_services.py]"]
  node_root["Service Root<br/>Redfish root<br/>[serviceRoot.py]"]
  node_versions["Service Versions<br/>Redfish metadata<br/>[serviceVersions.py]"]
  node_accounts["Account Service<br/>identity service<br/>[accountService.py]"]
  node_sessions["Session Service<br/>[sessionService.py]"]
  node_managers["Managers<br/>manager service<br/>[managers.py]"]
  node_chassis["Chassis<br/>hardware service<br/>[chassis.py]"]
  node_systems["Systems<br/>system service<br/>[systems.py]"]
  node_network["Network<br/>[network.py]"]
  node_storage["Storage<br/>[storage.py]"]
  node_update["Update Service<br/>[updateService.py]"]
end

subgraph group_g_data["Mockup Data"]
  node_mockup["Mockup Tree<br/>static seed data"]
  node_service_index["Service Index<br/>root json<br/>[index.json]"]
  node_odata["OData Meta<br/>metadata xml<br/>[index.xml]"]
end

node_client -->|"HTTP requests"| node_flask
node_entrypoint -->|"starts"| node_flask
node_flask -->|"auth first"| node_auth
node_auth -->|"checks"| node_security
node_auth -->|"route after auth"| node_uris
node_uris -->|"dispatches"| node_resource
node_resource -->|"uses"| node_common
node_resource -->|"serves"| node_root
node_resource -->|"serves"| node_versions
node_resource -->|"serves"| node_accounts
node_resource -->|"serves"| node_sessions
node_resource -->|"serves"| node_managers
node_resource -->|"serves"| node_chassis
node_resource -->|"serves"| node_systems
node_resource -->|"serves"| node_network
node_resource -->|"serves"| node_storage
node_resource -->|"serves"| node_update
node_mockup -->|"seeds"| node_root
node_mockup -->|"seeds"| node_versions
node_mockup -->|"seeds"| node_accounts
node_mockup -->|"seeds"| node_sessions
node_mockup -->|"seeds"| node_managers
node_mockup -->|"seeds"| node_chassis
node_mockup -->|"seeds"| node_systems
node_mockup -->|"seeds"| node_odata
node_service_index -->|"defines"| node_root

click node_entrypoint "https://github.com/hardikvjoshi/redfish-profile-simulator/blob/master/redfishProfileSimulator.py"
click node_auth "https://github.com/hardikvjoshi/redfish-profile-simulator/blob/master/v1sim/flask_redfish_auth.py"
click node_security "https://github.com/hardikvjoshi/redfish-profile-simulator/blob/master/v1sim/security.py"
click node_uris "https://github.com/hardikvjoshi/redfish-profile-simulator/blob/master/v1sim/redfishURIs.py"
click node_resource "https://github.com/hardikvjoshi/redfish-profile-simulator/blob/master/v1sim/resource.py"
click node_common "https://github.com/hardikvjoshi/redfish-profile-simulator/blob/master/v1sim/common_services.py"
click node_root "https://github.com/hardikvjoshi/redfish-profile-simulator/blob/master/v1sim/serviceRoot.py"
click node_versions "https://github.com/hardikvjoshi/redfish-profile-simulator/blob/master/v1sim/serviceVersions.py"
click node_accounts "https://github.com/hardikvjoshi/redfish-profile-simulator/blob/master/v1sim/accountService.py"
click node_sessions "https://github.com/hardikvjoshi/redfish-profile-simulator/blob/master/v1sim/sessionService.py"
click node_managers "https://github.com/hardikvjoshi/redfish-profile-simulator/blob/master/v1sim/managers.py"
click node_chassis "https://github.com/hardikvjoshi/redfish-profile-simulator/blob/master/v1sim/chassis.py"
click node_systems "https://github.com/hardikvjoshi/redfish-profile-simulator/blob/master/v1sim/systems.py"
click node_network "https://github.com/hardikvjoshi/redfish-profile-simulator/blob/master/v1sim/network.py"
click node_storage "https://github.com/hardikvjoshi/redfish-profile-simulator/blob/master/v1sim/storage.py"
click node_update "https://github.com/hardikvjoshi/redfish-profile-simulator/blob/master/v1sim/updateService.py"
click node_mockup "https://github.com/hardikvjoshi/redfish-profile-simulator/tree/master/MockupData/SimpleOcpServerV1/redfish/v1"
click node_service_index "https://github.com/hardikvjoshi/redfish-profile-simulator/blob/master/MockupData/SimpleOcpServerV1/redfish/index.json"
click node_odata "https://github.com/hardikvjoshi/redfish-profile-simulator/blob/master/MockupData/SimpleOcpServerV1/redfish/v1/$metadata/index.xml"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_client,node_entrypoint,node_flask toneBlue
class node_auth,node_security,node_uris,node_resource,node_common,node_root,node_versions,node_accounts,node_sessions,node_managers,node_chassis,node_systems,node_network,node_storage,node_update toneAmber
class node_mockup,node_service_index,node_odata toneMint
```

## Components

### Runtime

HTTP entry and request handling

- **Redfish Client**: caller · External tool or test client exercising the simulator
- [Simulator Main](https://github.com/hardikvjoshi/redfish-profile-simulator/blob/master/redfishProfileSimulator.py): python entrypoint · Parses CLI options and starts the Flask service · `redfishProfileSimulator.py`
- **Flask Server**: HTTP server · Single-process HTTP runtime exposing the Redfish API

### Simulator Core

Redfish resource model, auth, and routing

- [Auth Layer](https://github.com/hardikvjoshi/redfish-profile-simulator/blob/master/v1sim/flask_redfish_auth.py): basic/session auth · Validates Basic Auth and Redfish session tokens · `v1sim/flask_redfish_auth.py`
- [Access Control](https://github.com/hardikvjoshi/redfish-profile-simulator/blob/master/v1sim/security.py): security checks · Holds local authorization and token logic · `v1sim/security.py`
- [URI Router](https://github.com/hardikvjoshi/redfish-profile-simulator/blob/master/v1sim/redfishURIs.py): routing map · Maps request paths to Redfish resource handlers · `v1sim/redfishURIs.py`
- [Resource Core](https://github.com/hardikvjoshi/redfish-profile-simulator/blob/master/v1sim/resource.py): resource abstraction · Generic request handling and in-memory resource operations · `v1sim/resource.py`
- [Common Services](https://github.com/hardikvjoshi/redfish-profile-simulator/blob/master/v1sim/common_services.py): shared helpers · Shared service behaviors and request utilities · `v1sim/common_services.py`
- [Service Root](https://github.com/hardikvjoshi/redfish-profile-simulator/blob/master/v1sim/serviceRoot.py): Redfish root · Top-level Redfish service document and entry resources · `v1sim/serviceRoot.py`
- [Service Versions](https://github.com/hardikvjoshi/redfish-profile-simulator/blob/master/v1sim/serviceVersions.py): Redfish metadata · Advertises supported Redfish versions and links · `v1sim/serviceVersions.py`
- [Account Service](https://github.com/hardikvjoshi/redfish-profile-simulator/blob/master/v1sim/accountService.py): identity service · User accounts and roles exposed through Redfish · `v1sim/accountService.py`
- [Session Service](https://github.com/hardikvjoshi/redfish-profile-simulator/blob/master/v1sim/sessionService.py): session service · Creates and tracks Redfish session state · `v1sim/sessionService.py`
- [Managers](https://github.com/hardikvjoshi/redfish-profile-simulator/blob/master/v1sim/managers.py): manager service · BMC network and protocol configuration resources · `v1sim/managers.py`
- [Chassis](https://github.com/hardikvjoshi/redfish-profile-simulator/blob/master/v1sim/chassis.py): hardware service · Power and thermal state for chassis resources · `v1sim/chassis.py`
- [Systems](https://github.com/hardikvjoshi/redfish-profile-simulator/blob/master/v1sim/systems.py): system service · Computer system state, logs, and inventory fields · `v1sim/systems.py`
- [Network](https://github.com/hardikvjoshi/redfish-profile-simulator/blob/master/v1sim/network.py): network service · Network-oriented resource behavior and interfaces · `v1sim/network.py`
- [Storage](https://github.com/hardikvjoshi/redfish-profile-simulator/blob/master/v1sim/storage.py): storage service · Storage-related resource behavior · `v1sim/storage.py`
- [Update Service](https://github.com/hardikvjoshi/redfish-profile-simulator/blob/master/v1sim/updateService.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](https://github.com/hardikvjoshi/redfish-profile-simulator/tree/master/MockupData/SimpleOcpServerV1/redfish/v1): static seed data · File-backed Redfish profile used to initialize runtime state · `MockupData/SimpleOcpServerV1/redfish/v1`
- [Service Index](https://github.com/hardikvjoshi/redfish-profile-simulator/blob/master/MockupData/SimpleOcpServerV1/redfish/index.json): root json · Initial service document and URI topology · `MockupData/SimpleOcpServerV1/redfish/index.json`
- [OData Meta](https://github.com/hardikvjoshi/redfish-profile-simulator/blob/master/MockupData/SimpleOcpServerV1/redfish/v1/$metadata/index.xml): metadata xml · Redfish metadata document for the profile · `MockupData/SimpleOcpServerV1/redfish/v1/$metadata/index.xml`

## Connections

- 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
