rackfish 1.0.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.
@@ -0,0 +1,43 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [1.0.0] - 2025-10-15
9
+
10
+ ### Added
11
+
12
+ - Initial release of rackfish
13
+ - Dynamic Redfish client with lazy loading
14
+ - Automatic OEM and Links property surfacing
15
+ - Action method binding with ActionInfo validation
16
+ - Collection iteration support
17
+ - Session and basic authentication
18
+ - Support for 150+ common Redfish operations
19
+ - Comprehensive documentation and examples
20
+ - Full test suite with 100% passing tests
21
+ - Support for Huawei, Dell, HPE, Lenovo, Supermicro and all Redfish-compliant BMCs
22
+
23
+ ### Features
24
+
25
+ - Zero external dependencies (except `requests`)
26
+ - Lazy resource fetching for performance
27
+ - Dynamic attribute mapping from JSON
28
+ - Collision-safe OEM/Links surfacing
29
+ - Type-safe action parameter validation
30
+ - Pythonic API with natural dot notation
31
+ - Thread-safe HTTP session management
32
+ - Recursion guard for deeply nested structures
33
+
34
+ ### Documentation
35
+
36
+ - Complete API documentation
37
+ - 150+ usage examples
38
+ - Use case index
39
+ - Test suite documentation
40
+ - Comprehensive README
41
+ - GitHub/PyPI ready structure
42
+
43
+ [1.0.0]: https://github.com/yourusername/rackfish/releases/tag/v1.0.0
@@ -0,0 +1,123 @@
1
+ # Contributing to rackfish
2
+
3
+ Thank you for your interest in contributing to rackfish! This document provides guidelines and instructions for contributing.
4
+
5
+ ## Code of Conduct
6
+
7
+ Please be respectful and constructive in all interactions with the project community.
8
+
9
+ ## How to Contribute
10
+
11
+ ### Reporting Bugs
12
+
13
+ - Check if the bug has already been reported in Issues
14
+ - Include detailed steps to reproduce
15
+ - Include Python version, OS, and BMC vendor/model
16
+ - Provide relevant error messages and logs
17
+
18
+ ### Suggesting Features
19
+
20
+ - Open an issue describing the feature
21
+ - Explain the use case and benefits
22
+ - Provide examples if possible
23
+
24
+ ### Pull Requests
25
+
26
+ 1. Fork the repository
27
+ 2. Create a feature branch (`git checkout -b feature/amazing-feature`)
28
+ 3. Make your changes
29
+ 4. Add tests for new functionality
30
+ 5. Ensure all tests pass (`pytest tests/`)
31
+ 6. Update documentation as needed
32
+ 7. Commit your changes (`git commit -m 'Add amazing feature'`)
33
+ 8. Push to the branch (`git push origin feature/amazing-feature`)
34
+ 9. Open a Pull Request
35
+
36
+ ## Development Setup
37
+
38
+ ```bash
39
+ # Clone the repository
40
+ git clone https://github.com/yourusername/rackfish.git
41
+ cd rackfish
42
+
43
+ # Create a virtual environment
44
+ python -m venv venv
45
+ source venv/bin/activate # On Windows: venv\Scripts\activate
46
+
47
+ # Install development dependencies
48
+ pip install -e ".[dev]"
49
+
50
+ # Run tests
51
+ pytest tests/
52
+
53
+ # Run linting
54
+ ruff check rackfish/
55
+ black --check rackfish/
56
+ mypy rackfish/
57
+ ```
58
+
59
+ ## Coding Standards
60
+
61
+ ### Style Guide
62
+
63
+ - Follow PEP 8
64
+ - Use Black for code formatting (line length: 100)
65
+ - Use Ruff for linting
66
+ - Use type hints where appropriate
67
+ - Write docstrings for public functions and classes
68
+
69
+ ### Code Organization
70
+
71
+ - Keep functions focused and small
72
+ - Use meaningful variable names
73
+ - Add comments for complex logic
74
+ - Maintain backward compatibility when possible
75
+
76
+ ### Testing
77
+
78
+ - Write tests for all new functionality
79
+ - Maintain or improve test coverage
80
+ - Use descriptive test names
81
+ - Mock external dependencies (BMC connections)
82
+ - Test edge cases and error conditions
83
+
84
+ ### Documentation
85
+
86
+ - Update README.md for major changes
87
+ - Add examples to `docs/EXAMPLES.md`
88
+ - Update `docs/USE_CASES.md` for new operations
89
+ - Add docstrings with examples
90
+ - Update CHANGELOG.md
91
+
92
+ ## Architecture Guidelines
93
+
94
+ See `.github/copilot-instructions.md` for detailed architecture documentation:
95
+
96
+ - Lazy loading semantics
97
+ - OEM/Links surfacing mechanism
98
+ - Action binding and validation
99
+ - Collection protocols
100
+ - Recursion guard implementation
101
+
102
+ ## Review Process
103
+
104
+ 1. All PRs require review before merging
105
+ 2. Automated tests must pass
106
+ 3. Code coverage should not decrease
107
+ 4. Documentation must be updated
108
+ 5. CHANGELOG.md must be updated
109
+
110
+ ## Release Process
111
+
112
+ 1. Update version in `rackfish/__init__.py` and `pyproject.toml`
113
+ 2. Update CHANGELOG.md
114
+ 3. Create a git tag
115
+ 4. Build and publish to PyPI
116
+
117
+ ## Questions?
118
+
119
+ Feel free to open an issue for questions or discussion.
120
+
121
+ ## License
122
+
123
+ By contributing, you agree that your contributions will be licensed under the MIT License.
rackfish-1.0.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Dmitrii Frolov
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,19 @@
1
+ # Manifest file for source distributions
2
+ include LICENSE
3
+ include README.md
4
+ include CHANGELOG.md
5
+ include CONTRIBUTING.md
6
+ include pyproject.toml
7
+ include requirements.txt
8
+
9
+ recursive-include pyredfisher *.py
10
+ recursive-include docs *.md
11
+ recursive-include examples *.py
12
+ recursive-include tests *.py
13
+
14
+ # Exclude development files
15
+ exclude .gitignore
16
+ exclude .python-version
17
+ recursive-exclude * __pycache__
18
+ recursive-exclude * *.py[co]
19
+ recursive-exclude * .DS_Store
@@ -0,0 +1,368 @@
1
+ Metadata-Version: 2.4
2
+ Name: rackfish
3
+ Version: 1.0.0
4
+ Summary: A lightweight, dynamic Python client for Redfish BMC APIs
5
+ Author-email: Dmitrii Frolov <thefrolov@mts.ru>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/thefrolov/rackfish
8
+ Project-URL: Documentation, https://github.com/thefrolov/rackfish/blob/main/docs/INDEX.md
9
+ Project-URL: Repository, https://github.com/thefrolov/rackfish
10
+ Project-URL: Issues, https://github.com/thefrolov/rackfish/issues
11
+ Project-URL: Changelog, https://github.com/thefrolov/rackfish/blob/main/CHANGELOG.md
12
+ Keywords: redfish,bmc,ipmi,server-management,hardware-management,datacenter,ilo,idrac,server
13
+ Classifier: Development Status :: 5 - Production/Stable
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Intended Audience :: System Administrators
16
+ Classifier: License :: OSI Approved :: MIT License
17
+ Classifier: Operating System :: OS Independent
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.8
20
+ Classifier: Programming Language :: Python :: 3.9
21
+ Classifier: Programming Language :: Python :: 3.10
22
+ Classifier: Programming Language :: Python :: 3.11
23
+ Classifier: Programming Language :: Python :: 3.12
24
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
25
+ Classifier: Topic :: System :: Hardware
26
+ Classifier: Topic :: System :: Systems Administration
27
+ Requires-Python: >=3.8
28
+ Description-Content-Type: text/markdown
29
+ License-File: LICENSE
30
+ Requires-Dist: requests>=2.25.0
31
+ Provides-Extra: dev
32
+ Requires-Dist: pytest>=7.0; extra == "dev"
33
+ Requires-Dist: pytest-cov>=4.0; extra == "dev"
34
+ Requires-Dist: black>=23.0; extra == "dev"
35
+ Requires-Dist: ruff>=0.1.0; extra == "dev"
36
+ Requires-Dist: mypy>=1.0; extra == "dev"
37
+ Dynamic: license-file
38
+
39
+ # rackfish - Dynamic Redfish Client
40
+
41
+ [![PyPI version](https://img.shields.io/pypi/v/rackfish.svg)](https://pypi.org/project/rackfish/)
42
+ [![Python Versions](https://img.shields.io/pypi/pyversions/rackfish.svg)](https://pypi.org/project/rackfish/)
43
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
44
+ [![Build Status](https://github.com/yourusername/rackfish/workflows/CI/badge.svg)](https://github.com/yourusername/rackfish/actions)
45
+ [![codecov](https://codecov.io/gh/yourusername/rackfish/branch/main/graph/badge.svg)](https://codecov.io/gh/yourusername/rackfish)
46
+ [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
47
+
48
+ A lightweight, dynamic Python client for interacting with Redfish BMC (Baseboard Management Controller) APIs. Provides intuitive access to server hardware management through lazy-loaded object graphs, automatic OEM property surfacing, and validated action invocation.
49
+
50
+ ## 🎯 Why rackfish?
51
+
52
+ - 🚀 **Zero Dependencies** (except `requests`) - Minimal footprint
53
+ - ⚡ **Lazy Loading** - Resources fetched on-demand for performance
54
+ - 🎨 **Pythonic Interface** - JSON properties become Python attributes
55
+ - 🔧 **OEM Support** - Vendor extensions (Huawei, Dell, HPE) automatically accessible
56
+ - 🔗 **Smart Navigation** - Related resources directly navigable via Links
57
+ - ✅ **Action Validation** - Parameter validation using ActionInfo schemas
58
+ - 📚 **Collection Support** - Iterate Redfish collections naturally
59
+ - 🔐 **Flexible Auth** - Session tokens or Basic authentication
60
+
61
+ ## Features
62
+
63
+ - **Zero Dependencies** (except `requests`) - Minimal footprint
64
+ - **Lazy Loading** - Resources fetched on-demand for performance
65
+ - **Dynamic Attributes** - JSON properties become Python attributes
66
+ - **OEM Surfacing** - Vendor extensions automatically accessible
67
+ - **Links Surfacing** - Related resources directly navigable
68
+ - **Action Validation** - Parameter validation using ActionInfo schemas
69
+ - **Collection Support** - Iterate Redfish collections naturally
70
+ - **Session & Basic Auth** - Flexible authentication options
71
+
72
+ ## Installation
73
+
74
+ ### From PyPI (recommended)
75
+
76
+ ```bash
77
+ pip install rackfish
78
+ ```
79
+
80
+ ### From source
81
+
82
+ ```bash
83
+ git clone https://github.com/yourusername/rackfish.git
84
+ cd rackfish
85
+ pip install -e .
86
+ ```
87
+
88
+ ### Development installation
89
+
90
+ ```bash
91
+ pip install -e ".[dev]"
92
+ ```
93
+
94
+ ## Quick Start
95
+
96
+ ```python
97
+ from rackfish import RedfishClient
98
+
99
+ # Connect to BMC
100
+ client = RedfishClient("https://bmc.example.com", "admin", "password",
101
+ use_session=True, verify_ssl=False)
102
+ root = client.connect()
103
+
104
+ # Power control
105
+ system = next(iter(client.Systems))
106
+ system.Reset(ResetType="GracefulRestart")
107
+
108
+ # Access OEM properties (auto-surfaced)
109
+ if hasattr(system, "BootMode"):
110
+ print(f"Boot Mode: {system.BootMode}")
111
+
112
+ # Navigate linked resources
113
+ for chassis in system.Chassis:
114
+ print(f"Chassis: {chassis.Name}")
115
+
116
+ # Logout
117
+ client.logout()
118
+ ```
119
+
120
+ ## Documentation
121
+
122
+ - **[docs/EXAMPLES.md](docs/EXAMPLES.md)** - Comprehensive usage examples for all common Redfish operations
123
+ - **[docs/USE_CASES.md](docs/USE_CASES.md)** - Complete index of 150+ supported use cases
124
+ - **[docs/OEM_LINKS_SURFACING.md](docs/OEM_LINKS_SURFACING.md)** - Details on automatic OEM and Links surfacing
125
+ - **[docs/TESTS.md](docs/TESTS.md)** - Test suite documentation
126
+ - **[docs/INDEX.md](docs/INDEX.md)** - Master navigation document
127
+ - **[CHANGELOG.md](CHANGELOG.md)** - Version history and changes
128
+ - **[CONTRIBUTING.md](CONTRIBUTING.md)** - How to contribute
129
+
130
+ ## Common Use Cases
131
+
132
+ ### User Management
133
+ ```python
134
+ accounts = client.AccountService.Accounts
135
+ new_user = accounts.create({"UserName": "operator", "Password": "pass", "RoleId": "Operator"})
136
+ new_user.RoleId = "Administrator"
137
+ new_user.delete()
138
+ ```
139
+
140
+ ### Storage Management
141
+ ```python
142
+ storage = next(iter(client.Systems)).Storage[0]
143
+ volume = storage.Volumes.create({"Name": "DataVol", "CapacityBytes": 500*1024**3})
144
+ ```
145
+
146
+ ### Network Configuration
147
+ ```python
148
+ port = client.Managers[0].EthernetInterfaces[0]
149
+ port.patch({"IPv4Addresses": [{"Address": "192.168.1.100", "SubnetMask": "255.255.255.0"}]})
150
+ ```
151
+
152
+ ### Event Subscriptions
153
+ ```python
154
+ subs = client.EventService.Subscriptions
155
+ sub = subs.create({"Destination": "https://listener/events", "EventTypes": ["Alert"]})
156
+ ```
157
+
158
+ ### Firmware Updates
159
+ ```python
160
+ client.UpdateService.SimpleUpdate(ImageURI="http://server/fw.bin", TransferProtocol="HTTP")
161
+ ```
162
+
163
+ ### System Health Monitoring
164
+ ```python
165
+ for temp in chassis.Thermal.Temperatures:
166
+ print(f"{temp.Name}: {temp.ReadingCelsius}°C")
167
+ ```
168
+
169
+ See [EXAMPLES.md](EXAMPLES.md) for 100+ more examples covering:
170
+ - BIOS configuration
171
+ - Certificate management
172
+ - Virtual media (KVM)
173
+ - LDAP authentication
174
+ - Boot order configuration
175
+ - SEL/log collection
176
+ - And much more...
177
+
178
+ ## Testing
179
+
180
+ Run the test suite:
181
+
182
+ ```bash
183
+ # Install with dev dependencies
184
+ pip install -e ".[dev]"
185
+
186
+ # Run all tests
187
+ pytest tests/
188
+
189
+ # Run with coverage
190
+ pytest --cov=rackfish tests/
191
+
192
+ # Run specific test file
193
+ pytest tests/test_common_usage.py
194
+ ```
195
+
196
+ ## Project Structure
197
+
198
+ ```
199
+ rackfish/
200
+ ├── rackfish/ # Main package
201
+ │ ├── __init__.py # Package initialization
202
+ │ └── client.py # Core library implementation
203
+ ├── tests/ # Test suite
204
+ │ ├── __init__.py
205
+ │ ├── test_common_usage.py
206
+ │ ├── test_oem_links_surfacing.py
207
+ │ └── test_recursion_fix.py
208
+ ├── examples/ # Usage examples
209
+ │ ├── examples_comprehensive.py
210
+ │ ├── demo_surfacing_comprehensive.py
211
+ │ └── example_oem_links.py
212
+ ├── docs/ # Documentation
213
+ │ ├── INDEX.md
214
+ │ ├── EXAMPLES.md
215
+ │ ├── USE_CASES.md
216
+ │ ├── TESTS.md
217
+ │ ├── OEM_LINKS_SURFACING.md
218
+ │ └── COMPLETION_SUMMARY.md
219
+ ├── .github/
220
+ │ └── copilot-instructions.md
221
+ ├── README.md
222
+ ├── CHANGELOG.md
223
+ ├── CONTRIBUTING.md
224
+ ├── LICENSE
225
+ ├── pyproject.toml
226
+ └── requirements.txt
227
+ ```
228
+
229
+ ## Contributing
230
+
231
+ Contributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
232
+
233
+ ## License
234
+
235
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
236
+
237
+ ## Architecture
238
+
239
+ ### Core Components
240
+
241
+ - **`RedfishClient`** - HTTP session management, authentication, base URL handling
242
+ - **`RedfishResource`** - Dynamic resource representation with lazy loading
243
+ - **`_convert`** - Recursive JSON-to-object mapping with link stub creation
244
+ - **`_hydrate`** - Property mapping, OEM/Links surfacing, action binding
245
+
246
+ ### Key Design Patterns
247
+
248
+ 1. **Lazy Loading** - Link stubs defer fetching until attribute access
249
+ 2. **OEM Surfacing** - Vendor properties promoted to main object (collision-safe)
250
+ 3. **Links Surfacing** - Related resources directly accessible (collision-safe)
251
+ 4. **Action Methods** - Redfish Actions bound as callable instance methods
252
+ 5. **ActionInfo Validation** - Parameter schemas fetched and enforced
253
+
254
+ ### Recursion Guard
255
+
256
+ Deeply nested JSON structures are handled safely by deferring hydration (`fetched=False`) for all embedded resources, preventing stack overflow.
257
+
258
+ ## Supported Use Cases
259
+
260
+ The library supports **150+ common Redfish operations** including:
261
+
262
+ ### System Management
263
+ - Power control (Reset, ForceOff, GracefulRestart)
264
+ - Boot order configuration
265
+ - System health monitoring
266
+
267
+ ### Storage
268
+ - Logical drive creation/deletion
269
+ - Storage controller management
270
+ - Drive inventory and status
271
+
272
+ ### Network
273
+ - IP configuration (IPv4/IPv6)
274
+ - VLAN management
275
+ - DNS/NTP configuration
276
+ - SNMP trap configuration
277
+
278
+ ### User & Security
279
+ - User account CRUD
280
+ - Role assignment
281
+ - Password policies
282
+ - LDAP integration
283
+
284
+ ### Certificates
285
+ - CSR generation
286
+ - SSL/TLS certificate import
287
+ - SSH public key management
288
+ - Two-factor authentication certs
289
+
290
+ ### Firmware & BIOS
291
+ - Firmware updates
292
+ - BIOS configuration
293
+ - BMC reset/rollback
294
+
295
+ ### Monitoring & Logs
296
+ - Temperature sensors
297
+ - Fan speeds
298
+ - Voltage readings
299
+ - System event logs (SEL)
300
+
301
+ ### Virtual Media
302
+ - ISO mounting (KVM)
303
+ - VNC/KVM configuration
304
+ - Virtual media operations
305
+
306
+ See [EXAMPLES.md](EXAMPLES.md) for complete list and code samples.
307
+
308
+ ## OEM Vendor Support
309
+
310
+ Works with any Redfish-compliant BMC including:
311
+
312
+ - **Huawei** - TaiShan servers, FruControl, custom boot modes
313
+ - **Dell** - iDRAC, DellAttributes
314
+ - **HPE** - iLO, HPE-specific extensions
315
+ - **Lenovo** - XClarity
316
+ - **Supermicro** - IPMI/Redfish hybrid
317
+ - And any other vendor implementing Redfish standard
318
+
319
+ OEM extensions are automatically surfaced to the main object for easy access.
320
+
321
+ ## Advanced Features
322
+
323
+ ### Generic Request Helpers
324
+
325
+ For operations not exposed as methods:
326
+
327
+ ```python
328
+ response = client.get("/redfish/v1/custom/path")
329
+ client.post("/redfish/v1/Actions/Custom", data={"param": "value"})
330
+ client.patch("/redfish/v1/Systems/1", data={"AssetTag": "NEW"})
331
+ client.delete("/redfish/v1/Collection/Item")
332
+ ```
333
+
334
+ ### Allowable Values
335
+
336
+ Get valid parameter values:
337
+
338
+ ```python
339
+ reset_types = system.get_allowable_values("ResetType")
340
+ print(f"Valid reset types: {reset_types}")
341
+ ```
342
+
343
+ ### Raw JSON Access
344
+
345
+ ```python
346
+ raw_data = resource.to_dict()
347
+ ```
348
+
349
+ ## Contributing
350
+
351
+ See `.github/copilot-instructions.md` for development guidelines and architecture details.
352
+
353
+ ## License
354
+
355
+ See LICENSE file.
356
+
357
+ ## Version
358
+
359
+ Current version: 1.0.0
360
+
361
+ ## Requirements
362
+
363
+ - Python 3.8+
364
+ - requests library
365
+
366
+ ## Support
367
+
368
+ For issues, questions, or contributions, please refer to the project repository.