waldur-site-agent-cscs-dwdi 0.7.6__py3-none-any.whl → 0.7.8__py3-none-any.whl

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.
@@ -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,7 @@
1
1
  waldur_site_agent_cscs_dwdi/__init__.py,sha256=OHO1yF5NTGt0otI-GollR_ppPXP--aUZRCdaT5-8IWw,56
2
2
  waldur_site_agent_cscs_dwdi/backend.py,sha256=AWZuuY24KDGB5RWZhonoPrbIKpnrPc6D5WwwE6E8F6Y,30155
3
3
  waldur_site_agent_cscs_dwdi/client.py,sha256=6YrMky3pUfBJSAMYFAavBOz7-pooQIfqNjsBVk__K6g,14314
4
- waldur_site_agent_cscs_dwdi-0.7.6.dist-info/METADATA,sha256=9MZUrv-3X3VmDqW2eA3wFCxwQFswQwaMeGRoghOmdLY,8131
5
- waldur_site_agent_cscs_dwdi-0.7.6.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
6
- waldur_site_agent_cscs_dwdi-0.7.6.dist-info/entry_points.txt,sha256=gbp1thULdYQN4leLZeM8TBoruPSGQEKQxlQ0fg8u3Ug,187
7
- waldur_site_agent_cscs_dwdi-0.7.6.dist-info/RECORD,,
4
+ waldur_site_agent_cscs_dwdi-0.7.8.dist-info/METADATA,sha256=_TdltWT6XKk-nhhlgClfjCaifszsfcVO8DrEPEKEcr0,11704
5
+ waldur_site_agent_cscs_dwdi-0.7.8.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
6
+ waldur_site_agent_cscs_dwdi-0.7.8.dist-info/entry_points.txt,sha256=gbp1thULdYQN4leLZeM8TBoruPSGQEKQxlQ0fg8u3Ug,187
7
+ waldur_site_agent_cscs_dwdi-0.7.8.dist-info/RECORD,,