waldur-site-agent-cscs-dwdi 0.7.6__tar.gz → 0.7.8__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.

Potentially problematic release.


This version of waldur-site-agent-cscs-dwdi might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: waldur-site-agent-cscs-dwdi
3
- Version: 0.7.6
3
+ Version: 0.7.8
4
4
  Summary: CSCS-DWDI reporting plugin for Waldur Site Agent
5
5
  Author-email: OpenNode Team <info@opennodecloud.com>
6
6
  Requires-Python: <4,>=3.9
@@ -11,7 +11,16 @@ Description-Content-Type: text/markdown
11
11
  # CSCS-DWDI Plugin for Waldur Site Agent
12
12
 
13
13
  This plugin provides integration with the CSCS Data Warehouse Data Intelligence (DWDI) system to report both
14
- computational and storage usage data to Waldur.
14
+ computational and storage usage data to Waldur. The plugin supports secure OIDC authentication and optional
15
+ SOCKS proxy connectivity for accessing DWDI API endpoints from restricted networks.
16
+
17
+ ## Features
18
+
19
+ - **Dual Backend Support**: Separate backends for compute and storage resource usage reporting
20
+ - **OIDC Authentication**: Secure client credentials flow with automatic token refresh
21
+ - **Proxy Support**: SOCKS and HTTP proxy support for network-restricted environments
22
+ - **Flexible Configuration**: Configurable unit conversions and component mappings
23
+ - **Production Ready**: Comprehensive error handling and logging
15
24
 
16
25
  ## Overview
17
26
 
@@ -113,12 +122,24 @@ backend_components:
113
122
 
114
123
  ## Authentication
115
124
 
116
- Both backends use OIDC client credentials flow for authentication with the DWDI API. You need:
125
+ Both backends use OIDC client credentials flow for authentication with the DWDI API. The authentication tokens are
126
+ automatically managed with refresh capabilities.
127
+
128
+ ### Required Settings
117
129
 
118
130
  - `cscs_dwdi_client_id`: OIDC client identifier
119
131
  - `cscs_dwdi_client_secret`: OIDC client secret
120
132
  - `cscs_dwdi_oidc_token_url`: OIDC token endpoint URL
121
- - `cscs_dwdi_oidc_scope`: OIDC scope (optional, defaults to "openid")
133
+
134
+ ### Optional Settings
135
+
136
+ - `cscs_dwdi_oidc_scope`: OIDC scope (defaults to "openid")
137
+
138
+ ### Token Management
139
+
140
+ - Tokens are automatically acquired and cached
141
+ - Automatic token refresh before expiration
142
+ - Error handling for authentication failures
122
143
 
123
144
  ## SOCKS Proxy Support
124
145
 
@@ -197,19 +218,52 @@ See the `examples/` directory for complete configuration examples:
197
218
 
198
219
  The plugin is automatically discovered when the waldur-site-agent-cscs-dwdi package is installed alongside waldur-site-agent.
199
220
 
221
+ ### UV Workspace Installation
222
+
200
223
  ```bash
201
224
  # Install all workspace packages including cscs-dwdi plugin
202
225
  uv sync --all-packages
226
+
227
+ # Or install specific plugin dependencies only
228
+ uv sync --extra cscs-dwdi
229
+ ```
230
+
231
+ ### Manual Installation
232
+
233
+ ```bash
234
+ # Install from PyPI (when published)
235
+ pip install waldur-site-agent-cscs-dwdi
236
+
237
+ # Install from source
238
+ pip install -e plugins/cscs-dwdi/
203
239
  ```
204
240
 
205
241
  ## Testing
206
242
 
207
- Run the test suite:
243
+ ### Running Tests
208
244
 
209
245
  ```bash
246
+ # Run all cscs-dwdi tests
210
247
  uv run pytest plugins/cscs-dwdi/tests/
248
+
249
+ # Run with coverage
250
+ uv run pytest plugins/cscs-dwdi/tests/ --cov=waldur_site_agent_cscs_dwdi
251
+
252
+ # Run specific test files
253
+ uv run pytest plugins/cscs-dwdi/tests/test_cscs_dwdi.py -v
211
254
  ```
212
255
 
256
+ ### Test Coverage
257
+
258
+ The test suite covers:
259
+
260
+ - Client initialization and configuration
261
+ - OIDC authentication flow
262
+ - API endpoint calls (mocked)
263
+ - Usage data processing
264
+ - Error handling scenarios
265
+ - Backend initialization and validation
266
+
213
267
  ## API Compatibility
214
268
 
215
269
  This plugin is compatible with DWDI API version 1 (`/api/v1/`). It requires the following API endpoints to be available:
@@ -228,29 +282,74 @@ This plugin is compatible with DWDI API version 1 (`/api/v1/`). It requires the
228
282
 
229
283
  ### Authentication Issues
230
284
 
285
+ **Problem**: Authentication failures or token errors
286
+
287
+ **Solutions**:
231
288
  - Verify OIDC client credentials are correct
232
289
  - Check that the token endpoint URL is accessible
233
- - Ensure the client has appropriate scopes
290
+ - Ensure the client has appropriate scopes for DWDI API access
291
+ - Verify network connectivity to the OIDC provider
292
+ - Check logs for specific authentication error messages
293
+
294
+ **Testing authentication**:
295
+
296
+ ```bash
297
+ # Test OIDC token acquisition manually
298
+ curl -X POST "https://auth.cscs.ch/realms/cscs/protocol/openid-connect/token" \
299
+ -H "Content-Type: application/x-www-form-urlencoded" \
300
+ -d "grant_type=client_credentials&client_id=YOUR_CLIENT_ID&client_secret=YOUR_SECRET&scope=openid"
301
+ ```
234
302
 
235
303
  ### Storage Backend Issues
236
304
 
305
+ **Problem**: Storage usage data not found or incorrect
306
+
307
+ **Solutions**:
237
308
  - Verify `storage_filesystem` and `storage_data_type` match available values in DWDI
238
309
  - Check `storage_path_mapping` if using custom resource IDs
239
310
  - Ensure storage paths exist in the DWDI system
311
+ - Validate that the paths have usage data for the requested time period
240
312
 
241
313
  ### Connection Issues
242
314
 
315
+ **Problem**: Network connectivity or API access failures
316
+
317
+ **Solutions**:
243
318
  - Use the `ping()` method to test API connectivity
244
319
  - Check network connectivity to the DWDI API endpoint
245
- - Verify SSL/TLS configuration
320
+ - Verify SSL/TLS configuration and certificates
246
321
  - If behind a firewall, configure SOCKS proxy (`socks_proxy` setting)
322
+ - Check DNS resolution for the API hostname
247
323
 
248
324
  ### Proxy Issues
249
325
 
326
+ **Problem**: SOCKS or HTTP proxy connection failures
327
+
328
+ **Solutions**:
250
329
  - Verify proxy server is running and accessible
251
330
  - Check proxy authentication if required
252
331
  - Test proxy connectivity manually: `curl --proxy socks5://localhost:12345 https://dwdi.cscs.ch`
253
332
  - Ensure proxy supports the required protocol (SOCKS4/5, HTTP)
333
+ - Verify proxy URL format is correct (e.g., `socks5://hostname:port`)
334
+
335
+ ### Debugging Tips
336
+
337
+ **Enable debug logging**:
338
+
339
+ ```python
340
+ import logging
341
+ logging.getLogger('waldur_site_agent_cscs_dwdi').setLevel(logging.DEBUG)
342
+ ```
343
+
344
+ **Test API connectivity**:
345
+
346
+ ```bash
347
+ # Test direct API access
348
+ curl -H "Authorization: Bearer YOUR_TOKEN" https://dwdi.cscs.ch/api/v1/
349
+
350
+ # Test through proxy
351
+ curl --proxy socks5://localhost:12345 -H "Authorization: Bearer YOUR_TOKEN" https://dwdi.cscs.ch/api/v1/
352
+ ```
254
353
 
255
354
  ## Development
256
355
 
@@ -273,7 +372,14 @@ plugins/cscs-dwdi/
273
372
 
274
373
  - **`CSCSDWDIComputeBackend`**: Compute usage reporting backend
275
374
  - **`CSCSDWDIStorageBackend`**: Storage usage reporting backend
276
- - **`CSCSDWDIClient`**: HTTP client for CSCS-DWDI API communication
375
+ - **`CSCSDWDIClient`**: HTTP client for CSCS-DWDI API communication with OIDC authentication
376
+
377
+ ### Key Features
378
+
379
+ - **Automatic Token Management**: OIDC tokens are cached and refreshed automatically
380
+ - **Proxy Support**: Built-in SOCKS and HTTP proxy support using httpx
381
+ - **Error Handling**: Comprehensive error handling with detailed logging
382
+ - **Flexible Configuration**: Support for custom unit conversions and component mappings
277
383
 
278
384
  ### Extension Points
279
385
 
@@ -282,3 +388,13 @@ To extend the plugin:
282
388
  1. **Additional Endpoints**: Modify `CSCSDWDIClient` to support more API endpoints
283
389
  2. **Authentication Methods**: Update authentication logic in `client.py`
284
390
  3. **Data Processing**: Enhance response processing methods for additional data formats
391
+ 4. **Proxy Types**: Extend proxy support for additional proxy protocols
392
+
393
+ ### Contributing
394
+
395
+ When contributing to this plugin:
396
+
397
+ 1. Follow the existing code style and patterns
398
+ 2. Add tests for new functionality
399
+ 3. Update documentation for new features
400
+ 4. Ensure backward compatibility with existing configurations
@@ -1,7 +1,16 @@
1
1
  # CSCS-DWDI Plugin for Waldur Site Agent
2
2
 
3
3
  This plugin provides integration with the CSCS Data Warehouse Data Intelligence (DWDI) system to report both
4
- computational and storage usage data to Waldur.
4
+ computational and storage usage data to Waldur. The plugin supports secure OIDC authentication and optional
5
+ SOCKS proxy connectivity for accessing DWDI API endpoints from restricted networks.
6
+
7
+ ## Features
8
+
9
+ - **Dual Backend Support**: Separate backends for compute and storage resource usage reporting
10
+ - **OIDC Authentication**: Secure client credentials flow with automatic token refresh
11
+ - **Proxy Support**: SOCKS and HTTP proxy support for network-restricted environments
12
+ - **Flexible Configuration**: Configurable unit conversions and component mappings
13
+ - **Production Ready**: Comprehensive error handling and logging
5
14
 
6
15
  ## Overview
7
16
 
@@ -103,12 +112,24 @@ backend_components:
103
112
 
104
113
  ## Authentication
105
114
 
106
- Both backends use OIDC client credentials flow for authentication with the DWDI API. You need:
115
+ Both backends use OIDC client credentials flow for authentication with the DWDI API. The authentication tokens are
116
+ automatically managed with refresh capabilities.
117
+
118
+ ### Required Settings
107
119
 
108
120
  - `cscs_dwdi_client_id`: OIDC client identifier
109
121
  - `cscs_dwdi_client_secret`: OIDC client secret
110
122
  - `cscs_dwdi_oidc_token_url`: OIDC token endpoint URL
111
- - `cscs_dwdi_oidc_scope`: OIDC scope (optional, defaults to "openid")
123
+
124
+ ### Optional Settings
125
+
126
+ - `cscs_dwdi_oidc_scope`: OIDC scope (defaults to "openid")
127
+
128
+ ### Token Management
129
+
130
+ - Tokens are automatically acquired and cached
131
+ - Automatic token refresh before expiration
132
+ - Error handling for authentication failures
112
133
 
113
134
  ## SOCKS Proxy Support
114
135
 
@@ -187,19 +208,52 @@ See the `examples/` directory for complete configuration examples:
187
208
 
188
209
  The plugin is automatically discovered when the waldur-site-agent-cscs-dwdi package is installed alongside waldur-site-agent.
189
210
 
211
+ ### UV Workspace Installation
212
+
190
213
  ```bash
191
214
  # Install all workspace packages including cscs-dwdi plugin
192
215
  uv sync --all-packages
216
+
217
+ # Or install specific plugin dependencies only
218
+ uv sync --extra cscs-dwdi
219
+ ```
220
+
221
+ ### Manual Installation
222
+
223
+ ```bash
224
+ # Install from PyPI (when published)
225
+ pip install waldur-site-agent-cscs-dwdi
226
+
227
+ # Install from source
228
+ pip install -e plugins/cscs-dwdi/
193
229
  ```
194
230
 
195
231
  ## Testing
196
232
 
197
- Run the test suite:
233
+ ### Running Tests
198
234
 
199
235
  ```bash
236
+ # Run all cscs-dwdi tests
200
237
  uv run pytest plugins/cscs-dwdi/tests/
238
+
239
+ # Run with coverage
240
+ uv run pytest plugins/cscs-dwdi/tests/ --cov=waldur_site_agent_cscs_dwdi
241
+
242
+ # Run specific test files
243
+ uv run pytest plugins/cscs-dwdi/tests/test_cscs_dwdi.py -v
201
244
  ```
202
245
 
246
+ ### Test Coverage
247
+
248
+ The test suite covers:
249
+
250
+ - Client initialization and configuration
251
+ - OIDC authentication flow
252
+ - API endpoint calls (mocked)
253
+ - Usage data processing
254
+ - Error handling scenarios
255
+ - Backend initialization and validation
256
+
203
257
  ## API Compatibility
204
258
 
205
259
  This plugin is compatible with DWDI API version 1 (`/api/v1/`). It requires the following API endpoints to be available:
@@ -218,29 +272,74 @@ This plugin is compatible with DWDI API version 1 (`/api/v1/`). It requires the
218
272
 
219
273
  ### Authentication Issues
220
274
 
275
+ **Problem**: Authentication failures or token errors
276
+
277
+ **Solutions**:
221
278
  - Verify OIDC client credentials are correct
222
279
  - Check that the token endpoint URL is accessible
223
- - Ensure the client has appropriate scopes
280
+ - Ensure the client has appropriate scopes for DWDI API access
281
+ - Verify network connectivity to the OIDC provider
282
+ - Check logs for specific authentication error messages
283
+
284
+ **Testing authentication**:
285
+
286
+ ```bash
287
+ # Test OIDC token acquisition manually
288
+ curl -X POST "https://auth.cscs.ch/realms/cscs/protocol/openid-connect/token" \
289
+ -H "Content-Type: application/x-www-form-urlencoded" \
290
+ -d "grant_type=client_credentials&client_id=YOUR_CLIENT_ID&client_secret=YOUR_SECRET&scope=openid"
291
+ ```
224
292
 
225
293
  ### Storage Backend Issues
226
294
 
295
+ **Problem**: Storage usage data not found or incorrect
296
+
297
+ **Solutions**:
227
298
  - Verify `storage_filesystem` and `storage_data_type` match available values in DWDI
228
299
  - Check `storage_path_mapping` if using custom resource IDs
229
300
  - Ensure storage paths exist in the DWDI system
301
+ - Validate that the paths have usage data for the requested time period
230
302
 
231
303
  ### Connection Issues
232
304
 
305
+ **Problem**: Network connectivity or API access failures
306
+
307
+ **Solutions**:
233
308
  - Use the `ping()` method to test API connectivity
234
309
  - Check network connectivity to the DWDI API endpoint
235
- - Verify SSL/TLS configuration
310
+ - Verify SSL/TLS configuration and certificates
236
311
  - If behind a firewall, configure SOCKS proxy (`socks_proxy` setting)
312
+ - Check DNS resolution for the API hostname
237
313
 
238
314
  ### Proxy Issues
239
315
 
316
+ **Problem**: SOCKS or HTTP proxy connection failures
317
+
318
+ **Solutions**:
240
319
  - Verify proxy server is running and accessible
241
320
  - Check proxy authentication if required
242
321
  - Test proxy connectivity manually: `curl --proxy socks5://localhost:12345 https://dwdi.cscs.ch`
243
322
  - Ensure proxy supports the required protocol (SOCKS4/5, HTTP)
323
+ - Verify proxy URL format is correct (e.g., `socks5://hostname:port`)
324
+
325
+ ### Debugging Tips
326
+
327
+ **Enable debug logging**:
328
+
329
+ ```python
330
+ import logging
331
+ logging.getLogger('waldur_site_agent_cscs_dwdi').setLevel(logging.DEBUG)
332
+ ```
333
+
334
+ **Test API connectivity**:
335
+
336
+ ```bash
337
+ # Test direct API access
338
+ curl -H "Authorization: Bearer YOUR_TOKEN" https://dwdi.cscs.ch/api/v1/
339
+
340
+ # Test through proxy
341
+ curl --proxy socks5://localhost:12345 -H "Authorization: Bearer YOUR_TOKEN" https://dwdi.cscs.ch/api/v1/
342
+ ```
244
343
 
245
344
  ## Development
246
345
 
@@ -263,7 +362,14 @@ plugins/cscs-dwdi/
263
362
 
264
363
  - **`CSCSDWDIComputeBackend`**: Compute usage reporting backend
265
364
  - **`CSCSDWDIStorageBackend`**: Storage usage reporting backend
266
- - **`CSCSDWDIClient`**: HTTP client for CSCS-DWDI API communication
365
+ - **`CSCSDWDIClient`**: HTTP client for CSCS-DWDI API communication with OIDC authentication
366
+
367
+ ### Key Features
368
+
369
+ - **Automatic Token Management**: OIDC tokens are cached and refreshed automatically
370
+ - **Proxy Support**: Built-in SOCKS and HTTP proxy support using httpx
371
+ - **Error Handling**: Comprehensive error handling with detailed logging
372
+ - **Flexible Configuration**: Support for custom unit conversions and component mappings
267
373
 
268
374
  ### Extension Points
269
375
 
@@ -272,3 +378,13 @@ To extend the plugin:
272
378
  1. **Additional Endpoints**: Modify `CSCSDWDIClient` to support more API endpoints
273
379
  2. **Authentication Methods**: Update authentication logic in `client.py`
274
380
  3. **Data Processing**: Enhance response processing methods for additional data formats
381
+ 4. **Proxy Types**: Extend proxy support for additional proxy protocols
382
+
383
+ ### Contributing
384
+
385
+ When contributing to this plugin:
386
+
387
+ 1. Follow the existing code style and patterns
388
+ 2. Add tests for new functionality
389
+ 3. Update documentation for new features
390
+ 4. Ensure backward compatibility with existing configurations
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "waldur-site-agent-cscs-dwdi"
3
- version = "0.7.6"
3
+ version = "0.7.8"
4
4
  description = "CSCS-DWDI reporting plugin for Waldur Site Agent"
5
5
  readme = "README.md"
6
6
  authors = [{ name = "OpenNode Team", email = "info@opennodecloud.com" }]