simhall 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. simhall-0.1.0/LICENSE +201 -0
  2. simhall-0.1.0/PKG-INFO +133 -0
  3. simhall-0.1.0/README.md +97 -0
  4. simhall-0.1.0/pyproject.toml +72 -0
  5. simhall-0.1.0/setup.cfg +4 -0
  6. simhall-0.1.0/src/simhall/__init__.py +32 -0
  7. simhall-0.1.0/src/simhall/__main__.py +7 -0
  8. simhall-0.1.0/src/simhall/actions.py +103 -0
  9. simhall-0.1.0/src/simhall/cli.py +291 -0
  10. simhall-0.1.0/src/simhall/emulators/__init__.py +3 -0
  11. simhall-0.1.0/src/simhall/emulators/dcgm.py +99 -0
  12. simhall-0.1.0/src/simhall/emulators/lldp.py +188 -0
  13. simhall-0.1.0/src/simhall/emulators/netbox.py +709 -0
  14. simhall-0.1.0/src/simhall/emulators/redfish.py +395 -0
  15. simhall-0.1.0/src/simhall/faults.py +169 -0
  16. simhall-0.1.0/src/simhall/golden.py +92 -0
  17. simhall-0.1.0/src/simhall/hall.py +1066 -0
  18. simhall-0.1.0/src/simhall/models.py +269 -0
  19. simhall-0.1.0/src/simhall/naming.py +93 -0
  20. simhall-0.1.0/src/simhall/py.typed +0 -0
  21. simhall-0.1.0/src/simhall/seed_netbox.py +343 -0
  22. simhall-0.1.0/src/simhall/server.py +427 -0
  23. simhall-0.1.0/src/simhall/specfile.py +80 -0
  24. simhall-0.1.0/src/simhall/technician.py +567 -0
  25. simhall-0.1.0/src/simhall/views.py +123 -0
  26. simhall-0.1.0/src/simhall.egg-info/PKG-INFO +133 -0
  27. simhall-0.1.0/src/simhall.egg-info/SOURCES.txt +40 -0
  28. simhall-0.1.0/src/simhall.egg-info/dependency_links.txt +1 -0
  29. simhall-0.1.0/src/simhall.egg-info/entry_points.txt +2 -0
  30. simhall-0.1.0/src/simhall.egg-info/requires.txt +15 -0
  31. simhall-0.1.0/src/simhall.egg-info/top_level.txt +1 -0
  32. simhall-0.1.0/tests/test_actions.py +159 -0
  33. simhall-0.1.0/tests/test_cli.py +79 -0
  34. simhall-0.1.0/tests/test_emulators.py +257 -0
  35. simhall-0.1.0/tests/test_faults_property.py +341 -0
  36. simhall-0.1.0/tests/test_generate.py +200 -0
  37. simhall-0.1.0/tests/test_golden.py +105 -0
  38. simhall-0.1.0/tests/test_netbox_api.py +117 -0
  39. simhall-0.1.0/tests/test_seed_netbox.py +149 -0
  40. simhall-0.1.0/tests/test_server_http.py +214 -0
  41. simhall-0.1.0/tests/test_specfile.py +65 -0
  42. simhall-0.1.0/tests/test_technician.py +477 -0
simhall-0.1.0/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Hasanat Kazmi
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
simhall-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,133 @@
1
+ Metadata-Version: 2.4
2
+ Name: simhall
3
+ Version: 0.1.0
4
+ Summary: Virtual GPU hall: emulated Redfish BMCs, LLDP switches (Arista eAPI / NVIDIA NVUE), DCGM exporters and a minimal NetBox API, with fault injection, for testing turnup-check and Turnup Acceptance without hardware.
5
+ Author: Hasanat Kazmi
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/turnup-dev/simhall
8
+ Project-URL: Repository, https://github.com/turnup-dev/simhall
9
+ Project-URL: Issues, https://github.com/turnup-dev/simhall/issues
10
+ Keywords: redfish,lldp,dcgm,netbox,simulator,gpu,datacenter
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: System Administrators
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Programming Language :: Python :: 3.13
16
+ Classifier: Programming Language :: Python :: 3.14
17
+ Classifier: Topic :: System :: Hardware
18
+ Classifier: Topic :: System :: Networking
19
+ Requires-Python: >=3.12
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE
22
+ Requires-Dist: fastapi>=0.110
23
+ Requires-Dist: uvicorn>=0.27
24
+ Requires-Dist: pydantic>=2.5
25
+ Requires-Dist: httpx>=0.26
26
+ Requires-Dist: pyyaml>=6.0
27
+ Requires-Dist: click>=8.1
28
+ Provides-Extra: netbox
29
+ Requires-Dist: pynetbox>=7.0; extra == "netbox"
30
+ Provides-Extra: dev
31
+ Requires-Dist: pytest>=8; extra == "dev"
32
+ Requires-Dist: pytest-timeout>=2.3; extra == "dev"
33
+ Requires-Dist: hypothesis>=6.100; extra == "dev"
34
+ Requires-Dist: ruff>=0.5; extra == "dev"
35
+ Dynamic: license-file
36
+
37
+ # simhall
38
+
39
+ A virtual GPU hall for testing bring-up tooling without hardware. One ground-truth model serves the
40
+ devices a bring-up tool talks to, with fault injection and technician actions: Redfish BMCs, LLDP tables
41
+ on Arista (eAPI) and NVIDIA (NVUE) leaves, DCGM exporters, and a minimal NetBox API. Apache-2.0.
42
+
43
+ ```bash
44
+ pip install simhall turnup-check
45
+ simhall serve --golden hall-b & # 127.0.0.1:8900, any token
46
+ turnup-check --site hall-b --intent http://127.0.0.1:8900/netbox
47
+ ```
48
+
49
+ ```
50
+ reading intent 288 links · 18 nodes · 2 leaves
51
+ polling lldp · redfish · dcgm
52
+ ✓ 287 / 288 links match intent
53
+ ✓ 18 / 18 nodes reachable, firmware baseline ok
54
+ ✗ mismatch node7 mlx5_3 → leaf4/22
55
+ expected leaf4/21
56
+ fix move cable one port up
57
+ elapsed 0.4 s
58
+ ```
59
+
60
+ A technician seats the cable, and the same command exits 0 with `288 / 288`:
61
+
62
+ ```bash
63
+ simhall act '{"kind":"seat_cable","label":"CBL-12-07-03","b_interface":"swp21"}'
64
+ ```
65
+
66
+ Everything here is synthetic: no real hostnames, IPs, serial numbers or topologies. The intent it emits
67
+ carries `simulated: true`, so a simulated run never counts as a real one.
68
+
69
+ ## Why
70
+
71
+ Bring-up tooling is tested on the hardware it is meant to verify, which is the hardware nobody can spare.
72
+ simhall gives a tool like [turnup-check](https://github.com/turnup-dev/turnup-check) a hall that behaves
73
+ like the real protocols at every layer, where any fault can be injected, observed through every view at
74
+ once, and cleared again byte for byte. The test suite of turnup-check runs thousands of random halls and
75
+ fault sets against it in-process.
76
+
77
+ ## Install
78
+
79
+ ```bash
80
+ pip install simhall # Python 3.12+
81
+ pip install git+https://github.com/turnup-dev/simhall # or straight from this repository
82
+ ```
83
+
84
+ From a checkout: `pip install -e '.[dev]'`, then `simhall --help`. Dependencies: fastapi, uvicorn,
85
+ pydantic v2, httpx, pyyaml, click; `pynetbox` only for `simhall seed-netbox` (`.[netbox]`).
86
+
87
+ ## Faults and what a tool should see
88
+
89
+ | Fault | Observable effect | Expected `turnup-check` finding |
90
+ |---|---|---|
91
+ | `wrong_port(cable, to_device, to_interface)` | neighbor appears on the target port, intended port down; node Redfish port shows the target | `wrong_port` |
92
+ | `missing_link(cable)` | intended port down, no neighbor anywhere; node port `NoLink` | `missing_link` |
93
+ | `swap_pair(a, b)` | the two cables' leaf ports are exchanged | 2 x `wrong_port` |
94
+ | `link_degraded(cable, 200 \| "down")` | speed 200G on both ends, or link down with an aging LLDP entry | `link_degraded` |
95
+ | `unreachable_node(node, timeout \| http_500 \| refused)` | Redfish and/or DCGM answer per mode; links stay up | `unreachable_node` |
96
+ | `firmware_off_baseline(node, component, version)` | the inventory member's version changes | `firmware_off_baseline` |
97
+ | `gpu_unhealthy`, `gpu_missing`, `nvlink_degraded`, `node_health_warning` | DCGM metrics and Redfish health change accordingly | the matching finding |
98
+ | `pdu_outlet_off(node)` | BMC and exporter refused, host off, every link down | `unreachable_node` + `missing_link` per port |
99
+ | `coolant_leak`, `partial_redfish`, `lldp_port_id_mac` | leak detectors Critical; `FirmwareInventory` 404; port ids as MACs | none, by design |
100
+
101
+ Actions (`seat_cable`, `unseat_cable`, `power_on`, `power_off`, `replace_node`, `update_firmware`,
102
+ `scan_qr`) change the hall the way a technician would and retire the faults they physically resolve.
103
+ Faults are applied on top of the base state and clearing one restores the views exactly, in any order.
104
+ The complete tables and the rules are in [docs/faults.md](https://github.com/turnup-dev/simhall/blob/main/docs/faults.md).
105
+
106
+ ## Python API
107
+
108
+ ```python
109
+ from simhall import HallSpec, Hall, Fault, Action
110
+
111
+ hall = Hall.generate(HallSpec(site="hall-b", racks=1, nodes_per_rack=18, ports_per_node=16,
112
+ leaves_per_rack=2, switch_vendor="nvidia", seed=1))
113
+ hall.inject(Fault(kind="wrong_port", cable="CBL-12-07-03", to_device="leaf4", to_interface="swp22"))
114
+ hall.lldp_table("leaf4") # what the leaf would say
115
+ hall.redfish_tree("node7") # what the BMC would say
116
+ hall.act(Action(kind="seat_cable", label="CBL-12-07-03", b_interface="swp21"))
117
+ ```
118
+
119
+ `create_app(hall)` serves that very object over HTTP, so in-process actions are visible to a tool polling
120
+ it. The model, the cabling rule and how state is derived: [docs/model.md](https://github.com/turnup-dev/simhall/blob/main/docs/model.md).
121
+
122
+ ## Documentation
123
+
124
+ - [docs/protocols.md](https://github.com/turnup-dev/simhall/blob/main/docs/protocols.md): every endpoint served, by protocol, and the per-device fault modes.
125
+ - [docs/model.md](https://github.com/turnup-dev/simhall/blob/main/docs/model.md): `HallSpec`, `Hall`, the cabling rule, base and derived state.
126
+ - [docs/faults.md](https://github.com/turnup-dev/simhall/blob/main/docs/faults.md): all faults, actions and their HTTP status codes.
127
+ - [docs/specs.md](https://github.com/turnup-dev/simhall/blob/main/docs/specs.md): the golden scenario `hall-b` and spec files for your own halls.
128
+ - [docs/tools.md](https://github.com/turnup-dev/simhall/blob/main/docs/tools.md): the technician bot and seeding a real NetBox from a hall.
129
+ - [docs/development.md](https://github.com/turnup-dev/simhall/blob/main/docs/development.md): tests, CI, releasing, source layout.
130
+
131
+ ## License
132
+
133
+ Apache-2.0. See `LICENSE`.
@@ -0,0 +1,97 @@
1
+ # simhall
2
+
3
+ A virtual GPU hall for testing bring-up tooling without hardware. One ground-truth model serves the
4
+ devices a bring-up tool talks to, with fault injection and technician actions: Redfish BMCs, LLDP tables
5
+ on Arista (eAPI) and NVIDIA (NVUE) leaves, DCGM exporters, and a minimal NetBox API. Apache-2.0.
6
+
7
+ ```bash
8
+ pip install simhall turnup-check
9
+ simhall serve --golden hall-b & # 127.0.0.1:8900, any token
10
+ turnup-check --site hall-b --intent http://127.0.0.1:8900/netbox
11
+ ```
12
+
13
+ ```
14
+ reading intent 288 links · 18 nodes · 2 leaves
15
+ polling lldp · redfish · dcgm
16
+ ✓ 287 / 288 links match intent
17
+ ✓ 18 / 18 nodes reachable, firmware baseline ok
18
+ ✗ mismatch node7 mlx5_3 → leaf4/22
19
+ expected leaf4/21
20
+ fix move cable one port up
21
+ elapsed 0.4 s
22
+ ```
23
+
24
+ A technician seats the cable, and the same command exits 0 with `288 / 288`:
25
+
26
+ ```bash
27
+ simhall act '{"kind":"seat_cable","label":"CBL-12-07-03","b_interface":"swp21"}'
28
+ ```
29
+
30
+ Everything here is synthetic: no real hostnames, IPs, serial numbers or topologies. The intent it emits
31
+ carries `simulated: true`, so a simulated run never counts as a real one.
32
+
33
+ ## Why
34
+
35
+ Bring-up tooling is tested on the hardware it is meant to verify, which is the hardware nobody can spare.
36
+ simhall gives a tool like [turnup-check](https://github.com/turnup-dev/turnup-check) a hall that behaves
37
+ like the real protocols at every layer, where any fault can be injected, observed through every view at
38
+ once, and cleared again byte for byte. The test suite of turnup-check runs thousands of random halls and
39
+ fault sets against it in-process.
40
+
41
+ ## Install
42
+
43
+ ```bash
44
+ pip install simhall # Python 3.12+
45
+ pip install git+https://github.com/turnup-dev/simhall # or straight from this repository
46
+ ```
47
+
48
+ From a checkout: `pip install -e '.[dev]'`, then `simhall --help`. Dependencies: fastapi, uvicorn,
49
+ pydantic v2, httpx, pyyaml, click; `pynetbox` only for `simhall seed-netbox` (`.[netbox]`).
50
+
51
+ ## Faults and what a tool should see
52
+
53
+ | Fault | Observable effect | Expected `turnup-check` finding |
54
+ |---|---|---|
55
+ | `wrong_port(cable, to_device, to_interface)` | neighbor appears on the target port, intended port down; node Redfish port shows the target | `wrong_port` |
56
+ | `missing_link(cable)` | intended port down, no neighbor anywhere; node port `NoLink` | `missing_link` |
57
+ | `swap_pair(a, b)` | the two cables' leaf ports are exchanged | 2 x `wrong_port` |
58
+ | `link_degraded(cable, 200 \| "down")` | speed 200G on both ends, or link down with an aging LLDP entry | `link_degraded` |
59
+ | `unreachable_node(node, timeout \| http_500 \| refused)` | Redfish and/or DCGM answer per mode; links stay up | `unreachable_node` |
60
+ | `firmware_off_baseline(node, component, version)` | the inventory member's version changes | `firmware_off_baseline` |
61
+ | `gpu_unhealthy`, `gpu_missing`, `nvlink_degraded`, `node_health_warning` | DCGM metrics and Redfish health change accordingly | the matching finding |
62
+ | `pdu_outlet_off(node)` | BMC and exporter refused, host off, every link down | `unreachable_node` + `missing_link` per port |
63
+ | `coolant_leak`, `partial_redfish`, `lldp_port_id_mac` | leak detectors Critical; `FirmwareInventory` 404; port ids as MACs | none, by design |
64
+
65
+ Actions (`seat_cable`, `unseat_cable`, `power_on`, `power_off`, `replace_node`, `update_firmware`,
66
+ `scan_qr`) change the hall the way a technician would and retire the faults they physically resolve.
67
+ Faults are applied on top of the base state and clearing one restores the views exactly, in any order.
68
+ The complete tables and the rules are in [docs/faults.md](https://github.com/turnup-dev/simhall/blob/main/docs/faults.md).
69
+
70
+ ## Python API
71
+
72
+ ```python
73
+ from simhall import HallSpec, Hall, Fault, Action
74
+
75
+ hall = Hall.generate(HallSpec(site="hall-b", racks=1, nodes_per_rack=18, ports_per_node=16,
76
+ leaves_per_rack=2, switch_vendor="nvidia", seed=1))
77
+ hall.inject(Fault(kind="wrong_port", cable="CBL-12-07-03", to_device="leaf4", to_interface="swp22"))
78
+ hall.lldp_table("leaf4") # what the leaf would say
79
+ hall.redfish_tree("node7") # what the BMC would say
80
+ hall.act(Action(kind="seat_cable", label="CBL-12-07-03", b_interface="swp21"))
81
+ ```
82
+
83
+ `create_app(hall)` serves that very object over HTTP, so in-process actions are visible to a tool polling
84
+ it. The model, the cabling rule and how state is derived: [docs/model.md](https://github.com/turnup-dev/simhall/blob/main/docs/model.md).
85
+
86
+ ## Documentation
87
+
88
+ - [docs/protocols.md](https://github.com/turnup-dev/simhall/blob/main/docs/protocols.md): every endpoint served, by protocol, and the per-device fault modes.
89
+ - [docs/model.md](https://github.com/turnup-dev/simhall/blob/main/docs/model.md): `HallSpec`, `Hall`, the cabling rule, base and derived state.
90
+ - [docs/faults.md](https://github.com/turnup-dev/simhall/blob/main/docs/faults.md): all faults, actions and their HTTP status codes.
91
+ - [docs/specs.md](https://github.com/turnup-dev/simhall/blob/main/docs/specs.md): the golden scenario `hall-b` and spec files for your own halls.
92
+ - [docs/tools.md](https://github.com/turnup-dev/simhall/blob/main/docs/tools.md): the technician bot and seeding a real NetBox from a hall.
93
+ - [docs/development.md](https://github.com/turnup-dev/simhall/blob/main/docs/development.md): tests, CI, releasing, source layout.
94
+
95
+ ## License
96
+
97
+ Apache-2.0. See `LICENSE`.
@@ -0,0 +1,72 @@
1
+ # SPDX-License-Identifier: Apache-2.0
2
+ [build-system]
3
+ requires = ["setuptools>=77"]
4
+ build-backend = "setuptools.build_meta"
5
+
6
+ [project]
7
+ name = "simhall"
8
+ version = "0.1.0"
9
+ description = "Virtual GPU hall: emulated Redfish BMCs, LLDP switches (Arista eAPI / NVIDIA NVUE), DCGM exporters and a minimal NetBox API, with fault injection, for testing turnup-check and Turnup Acceptance without hardware."
10
+ readme = "README.md"
11
+ license = "Apache-2.0"
12
+ license-files = ["LICENSE"]
13
+ requires-python = ">=3.12"
14
+ authors = [{ name = "Hasanat Kazmi" }]
15
+ keywords = ["redfish", "lldp", "dcgm", "netbox", "simulator", "gpu", "datacenter"]
16
+ classifiers = [
17
+ "Development Status :: 3 - Alpha",
18
+ "Intended Audience :: System Administrators",
19
+ "Programming Language :: Python :: 3",
20
+ "Programming Language :: Python :: 3.12",
21
+ "Programming Language :: Python :: 3.13",
22
+ "Programming Language :: Python :: 3.14",
23
+ "Topic :: System :: Hardware",
24
+ "Topic :: System :: Networking",
25
+ ]
26
+ dependencies = [
27
+ "fastapi>=0.110",
28
+ "uvicorn>=0.27",
29
+ "pydantic>=2.5",
30
+ "httpx>=0.26",
31
+ "pyyaml>=6.0",
32
+ "click>=8.1",
33
+ ]
34
+
35
+ [project.optional-dependencies]
36
+ netbox = ["pynetbox>=7.0"]
37
+ dev = ["pytest>=8", "pytest-timeout>=2.3", "hypothesis>=6.100", "ruff>=0.5"]
38
+
39
+ [project.scripts]
40
+ simhall = "simhall.cli:main"
41
+
42
+ [project.urls]
43
+ Homepage = "https://github.com/turnup-dev/simhall"
44
+ Repository = "https://github.com/turnup-dev/simhall"
45
+ Issues = "https://github.com/turnup-dev/simhall/issues"
46
+
47
+ [tool.setuptools.packages.find]
48
+ where = ["src"]
49
+
50
+ [tool.setuptools.package-data]
51
+ simhall = ["py.typed"]
52
+
53
+ [tool.pytest.ini_options]
54
+ testpaths = ["tests"]
55
+ pythonpath = ["src"]
56
+ timeout = 80
57
+ addopts = "-q -p no:cacheprovider"
58
+ filterwarnings = [
59
+ "ignore::DeprecationWarning",
60
+ ]
61
+
62
+ [tool.ruff]
63
+ line-length = 110
64
+ target-version = "py312"
65
+ src = ["src", "tests"]
66
+
67
+ [tool.ruff.lint]
68
+ select = ["E", "F", "I", "UP", "B", "W"]
69
+ ignore = ["B008"]
70
+
71
+ [tool.ruff.lint.isort]
72
+ known-first-party = ["simhall"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,32 @@
1
+ # SPDX-License-Identifier: Apache-2.0
2
+ # Copyright 2026 Hasanat Kazmi
3
+ """simhall: a virtual GPU hall for testing bring-up tooling without hardware.
4
+
5
+ ```python
6
+ from simhall import HallSpec, Hall, Fault, Action
7
+ hall = Hall.generate(HallSpec(site="hall-b"))
8
+ hall.inject(Fault(kind="wrong_port", cable="CBL-12-07-03", to_device="leaf4", to_interface="swp22"))
9
+ ```
10
+ """
11
+
12
+ from __future__ import annotations
13
+
14
+ __version__ = "0.1.0"
15
+
16
+ from simhall.actions import Action
17
+ from simhall.faults import Fault
18
+ from simhall.hall import Conflict, Hall, SimError, UnknownObject
19
+ from simhall.models import CableSpec, Endpoint, HallSpec
20
+
21
+ __all__ = [
22
+ "Action",
23
+ "CableSpec",
24
+ "Conflict",
25
+ "Endpoint",
26
+ "Fault",
27
+ "Hall",
28
+ "HallSpec",
29
+ "SimError",
30
+ "UnknownObject",
31
+ "__version__",
32
+ ]
@@ -0,0 +1,7 @@
1
+ # SPDX-License-Identifier: Apache-2.0
2
+ # Copyright 2026 Hasanat Kazmi
3
+ """`python -m simhall ...` runs the CLI."""
4
+
5
+ from simhall.cli import main
6
+
7
+ main()
@@ -0,0 +1,103 @@
1
+ # SPDX-License-Identifier: Apache-2.0
2
+ # Copyright 2026 Hasanat Kazmi
3
+ """Actions: what a technician (or a bot) physically does to the hall (CONTRACT.md section 6.2).
4
+
5
+ Actions change the ground truth and retire any fault they physically resolve; emulators reflect the
6
+ result on the next poll.
7
+ """
8
+
9
+ from __future__ import annotations
10
+
11
+ from typing import Literal
12
+
13
+ from pydantic import BaseModel, ConfigDict, model_validator
14
+
15
+ ActionKind = Literal[
16
+ "seat_cable",
17
+ "unseat_cable",
18
+ "power_on",
19
+ "power_off",
20
+ "replace_node",
21
+ "update_firmware",
22
+ "scan_qr",
23
+ ]
24
+
25
+ ACTION_KINDS: tuple[str, ...] = ActionKind.__args__ # type: ignore[attr-defined]
26
+
27
+ REQUIRED_FIELDS: dict[str, tuple[str, ...]] = {
28
+ "seat_cable": ("label",),
29
+ "unseat_cable": ("label",),
30
+ "power_on": ("device",),
31
+ "power_off": ("device",),
32
+ "replace_node": ("device", "new_serial"),
33
+ "update_firmware": ("device", "component", "version"),
34
+ "scan_qr": ("label",),
35
+ }
36
+
37
+
38
+ class Action(BaseModel):
39
+ """One physical action. For `seat_cable`, ends omitted default to the intent ends of `label`."""
40
+
41
+ model_config = ConfigDict(extra="forbid")
42
+
43
+ kind: ActionKind
44
+ label: str | None = None
45
+ a_device: str | None = None
46
+ a_interface: str | None = None
47
+ b_device: str | None = None
48
+ b_interface: str | None = None
49
+ device: str | None = None
50
+ new_serial: str | None = None
51
+ component: str | None = None
52
+ version: str | None = None
53
+ actor: str | None = None
54
+
55
+ @model_validator(mode="after")
56
+ def _required(self) -> Action:
57
+ missing = [f for f in REQUIRED_FIELDS[self.kind] if getattr(self, f) is None]
58
+ if missing:
59
+ raise ValueError(f"action {self.kind} requires {', '.join(missing)}")
60
+ return self
61
+
62
+
63
+ def seat_cable(
64
+ label: str,
65
+ a_device: str | None = None,
66
+ a_interface: str | None = None,
67
+ b_device: str | None = None,
68
+ b_interface: str | None = None,
69
+ actor: str | None = None,
70
+ ) -> Action:
71
+ return Action(
72
+ kind="seat_cable",
73
+ label=label,
74
+ a_device=a_device,
75
+ a_interface=a_interface,
76
+ b_device=b_device,
77
+ b_interface=b_interface,
78
+ actor=actor,
79
+ )
80
+
81
+
82
+ def unseat_cable(label: str, actor: str | None = None) -> Action:
83
+ return Action(kind="unseat_cable", label=label, actor=actor)
84
+
85
+
86
+ def power_on(device: str, actor: str | None = None) -> Action:
87
+ return Action(kind="power_on", device=device, actor=actor)
88
+
89
+
90
+ def power_off(device: str, actor: str | None = None) -> Action:
91
+ return Action(kind="power_off", device=device, actor=actor)
92
+
93
+
94
+ def replace_node(device: str, new_serial: str, actor: str | None = None) -> Action:
95
+ return Action(kind="replace_node", device=device, new_serial=new_serial, actor=actor)
96
+
97
+
98
+ def update_firmware(device: str, component: str, version: str, actor: str | None = None) -> Action:
99
+ return Action(kind="update_firmware", device=device, component=component, version=version, actor=actor)
100
+
101
+
102
+ def scan_qr(label: str, actor: str | None = None) -> Action:
103
+ return Action(kind="scan_qr", label=label, actor=actor)