sovd-server 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.
- sovd_server-1.0.0/MANIFEST.in +3 -0
- sovd_server-1.0.0/PKG-INFO +263 -0
- sovd_server-1.0.0/README.md +227 -0
- sovd_server-1.0.0/pyproject.toml +102 -0
- sovd_server-1.0.0/requirements.txt +13 -0
- sovd_server-1.0.0/setup.cfg +4 -0
- sovd_server-1.0.0/setup.py +81 -0
- sovd_server-1.0.0/src/sovd_server/__init__.py +15 -0
- sovd_server-1.0.0/src/sovd_server/config/entities/apps.yaml +90 -0
- sovd_server-1.0.0/src/sovd_server/config/entities/areas.yaml +92 -0
- sovd_server-1.0.0/src/sovd_server/config/entities/components.yaml +118 -0
- sovd_server-1.0.0/src/sovd_server/config/resources/data/ecu_data_resources.yaml +470 -0
- sovd_server-1.0.0/src/sovd_server/config/resources/data/engine_data_resources.yaml +161 -0
- sovd_server-1.0.0/src/sovd_server/config/resources/faults/ecu_faults.yaml +67 -0
- sovd_server-1.0.0/src/sovd_server/config/resources/faults/engine_faults.yaml +141 -0
- sovd_server-1.0.0/src/sovd_server/config/resources/modes/ecu_modes.yaml +43 -0
- sovd_server-1.0.0/src/sovd_server/config/resources/modes/engine_modes.yaml +161 -0
- sovd_server-1.0.0/src/sovd_server/config/resources/operations/camera_operations.yaml +170 -0
- sovd_server-1.0.0/src/sovd_server/config/resources/operations/ecu_operations.yaml +119 -0
- sovd_server-1.0.0/src/sovd_server/config/sovd_gateway.yaml +85 -0
- sovd_server-1.0.0/src/sovd_server/config_loader.py +253 -0
- sovd_server-1.0.0/src/sovd_server/controllers/__init__.py +0 -0
- sovd_server-1.0.0/src/sovd_server/controllers/default_controller.py +886 -0
- sovd_server-1.0.0/src/sovd_server/controllers/security_controller.py +32 -0
- sovd_server-1.0.0/src/sovd_server/encoder.py +19 -0
- sovd_server-1.0.0/src/sovd_server/enhanced_server.py +460 -0
- sovd_server-1.0.0/src/sovd_server/models/__init__.py +60 -0
- sovd_server-1.0.0/src/sovd_server/models/base_model.py +68 -0
- sovd_server-1.0.0/src/sovd_server/models/configuration.py +147 -0
- sovd_server-1.0.0/src/sovd_server/models/configuration_collection.py +65 -0
- sovd_server-1.0.0/src/sovd_server/models/configuration_reference.py +95 -0
- sovd_server-1.0.0/src/sovd_server/models/configuration_write.py +93 -0
- sovd_server-1.0.0/src/sovd_server/models/cyclic_subscription.py +209 -0
- sovd_server-1.0.0/src/sovd_server/models/cyclic_subscription_collection.py +65 -0
- sovd_server-1.0.0/src/sovd_server/models/cyclic_subscription_create.py +157 -0
- sovd_server-1.0.0/src/sovd_server/models/cyclic_subscription_reference.py +159 -0
- sovd_server-1.0.0/src/sovd_server/models/cyclic_subscription_update.py +95 -0
- sovd_server-1.0.0/src/sovd_server/models/data_list.py +93 -0
- sovd_server-1.0.0/src/sovd_server/models/data_list_collection.py +65 -0
- sovd_server-1.0.0/src/sovd_server/models/data_list_create.py +65 -0
- sovd_server-1.0.0/src/sovd_server/models/data_list_reference.py +65 -0
- sovd_server-1.0.0/src/sovd_server/models/data_resource.py +173 -0
- sovd_server-1.0.0/src/sovd_server/models/data_resource_collection.py +65 -0
- sovd_server-1.0.0/src/sovd_server/models/data_resource_reference.py +179 -0
- sovd_server-1.0.0/src/sovd_server/models/data_resource_write.py +65 -0
- sovd_server-1.0.0/src/sovd_server/models/entity_capabilities.py +257 -0
- sovd_server-1.0.0/src/sovd_server/models/entity_collection.py +65 -0
- sovd_server-1.0.0/src/sovd_server/models/entity_reference.py +153 -0
- sovd_server-1.0.0/src/sovd_server/models/environment_data.py +91 -0
- sovd_server-1.0.0/src/sovd_server/models/error.py +65 -0
- sovd_server-1.0.0/src/sovd_server/models/error_error.py +123 -0
- sovd_server-1.0.0/src/sovd_server/models/execution_collection.py +65 -0
- sovd_server-1.0.0/src/sovd_server/models/execution_reference.py +65 -0
- sovd_server-1.0.0/src/sovd_server/models/extended_data_records.py +87 -0
- sovd_server-1.0.0/src/sovd_server/models/fault.py +95 -0
- sovd_server-1.0.0/src/sovd_server/models/fault_collection.py +65 -0
- sovd_server-1.0.0/src/sovd_server/models/fault_reference.py +245 -0
- sovd_server-1.0.0/src/sovd_server/models/fault_status.py +349 -0
- sovd_server-1.0.0/src/sovd_server/models/mode.py +173 -0
- sovd_server-1.0.0/src/sovd_server/models/mode_collection.py +65 -0
- sovd_server-1.0.0/src/sovd_server/models/mode_reference.py +95 -0
- sovd_server-1.0.0/src/sovd_server/models/mode_set.py +93 -0
- sovd_server-1.0.0/src/sovd_server/models/operation.py +173 -0
- sovd_server-1.0.0/src/sovd_server/models/operation_collection.py +65 -0
- sovd_server-1.0.0/src/sovd_server/models/operation_execution.py +179 -0
- sovd_server-1.0.0/src/sovd_server/models/operation_execution_modify.py +95 -0
- sovd_server-1.0.0/src/sovd_server/models/operation_execution_request.py +91 -0
- sovd_server-1.0.0/src/sovd_server/models/operation_reference.py +95 -0
- sovd_server-1.0.0/src/sovd_server/models/script.py +197 -0
- sovd_server-1.0.0/src/sovd_server/models/script_collection.py +65 -0
- sovd_server-1.0.0/src/sovd_server/models/script_execution.py +179 -0
- sovd_server-1.0.0/src/sovd_server/models/script_execution_collection.py +65 -0
- sovd_server-1.0.0/src/sovd_server/models/script_execution_reference.py +65 -0
- sovd_server-1.0.0/src/sovd_server/models/script_execution_request.py +91 -0
- sovd_server-1.0.0/src/sovd_server/models/script_reference.py +95 -0
- sovd_server-1.0.0/src/sovd_server/models/snapshot.py +93 -0
- sovd_server-1.0.0/src/sovd_server/models/snapshot_data.py +34 -0
- sovd_server-1.0.0/src/sovd_server/models/trigger.py +209 -0
- sovd_server-1.0.0/src/sovd_server/models/trigger_collection.py +65 -0
- sovd_server-1.0.0/src/sovd_server/models/trigger_condition.py +127 -0
- sovd_server-1.0.0/src/sovd_server/models/trigger_condition_values_inner.py +34 -0
- sovd_server-1.0.0/src/sovd_server/models/trigger_create.py +155 -0
- sovd_server-1.0.0/src/sovd_server/models/trigger_reference.py +159 -0
- sovd_server-1.0.0/src/sovd_server/models/trigger_update.py +91 -0
- sovd_server-1.0.0/src/sovd_server/models/version.py +127 -0
- sovd_server-1.0.0/src/sovd_server/models/version_info.py +65 -0
- sovd_server-1.0.0/src/sovd_server/parse_pdf.py +64 -0
- sovd_server-1.0.0/src/sovd_server/run_enhanced_server.py +60 -0
- sovd_server-1.0.0/src/sovd_server/typing_utils.py +30 -0
- sovd_server-1.0.0/src/sovd_server/util.py +147 -0
- sovd_server-1.0.0/src/sovd_server.egg-info/PKG-INFO +263 -0
- sovd_server-1.0.0/src/sovd_server.egg-info/SOURCES.txt +99 -0
- sovd_server-1.0.0/src/sovd_server.egg-info/dependency_links.txt +1 -0
- sovd_server-1.0.0/src/sovd_server.egg-info/entry_points.txt +2 -0
- sovd_server-1.0.0/src/sovd_server.egg-info/requires.txt +14 -0
- sovd_server-1.0.0/src/sovd_server.egg-info/top_level.txt +1 -0
- sovd_server-1.0.0/tests/test_config.py +175 -0
- sovd_server-1.0.0/tests/test_default_controller.py +1068 -0
- sovd_server-1.0.0/tests/test_endpoints.py +111 -0
- sovd_server-1.0.0/tests/test_server.py +54 -0
- sovd_server-1.0.0/tests/test_server_config.py +72 -0
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: sovd-server
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: SOVD (Service-Oriented Vehicle Data) Server Implementation
|
|
5
|
+
Home-page: https://github.com/sovd/sovd-server
|
|
6
|
+
Author: SOVD Development Team
|
|
7
|
+
Author-email: SOVD Development Team <dev@sovd.org>
|
|
8
|
+
License: MIT
|
|
9
|
+
Classifier: Development Status :: 4 - Beta
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Requires-Python: >=3.8
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
Requires-Dist: flask>=3.1.0
|
|
21
|
+
Requires-Dist: flask-cors>=3.0.0
|
|
22
|
+
Requires-Dist: pyyaml>=6.0
|
|
23
|
+
Requires-Dist: connexion[swagger-ui]<=3.3.0,>=3.0.0
|
|
24
|
+
Requires-Dist: jsonschema>=4.0.0
|
|
25
|
+
Provides-Extra: dev
|
|
26
|
+
Requires-Dist: pytest>=8.4.2; extra == "dev"
|
|
27
|
+
Requires-Dist: pytest-cov; extra == "dev"
|
|
28
|
+
Requires-Dist: black; extra == "dev"
|
|
29
|
+
Requires-Dist: flake8; extra == "dev"
|
|
30
|
+
Requires-Dist: mypy; extra == "dev"
|
|
31
|
+
Requires-Dist: bandit; extra == "dev"
|
|
32
|
+
Requires-Dist: safety; extra == "dev"
|
|
33
|
+
Dynamic: author
|
|
34
|
+
Dynamic: home-page
|
|
35
|
+
Dynamic: requires-python
|
|
36
|
+
|
|
37
|
+
# SOVD Server with YAML Configuration
|
|
38
|
+
|
|
39
|
+
This project implements a Service-Oriented Vehicle Diagnostics (SOVD) server based on ISO/DIS 17978-3:2025 with YAML-based configuration support.
|
|
40
|
+
|
|
41
|
+
## Features
|
|
42
|
+
|
|
43
|
+
- **Hierarchical YAML Configuration**: Multi-level configuration system with gateway, entity, and resource configurations
|
|
44
|
+
- **Real Data Endpoints**: Actual data for data resources, operations, faults, and modes
|
|
45
|
+
- **No Authentication**: Simplified setup without authorization layer for testing
|
|
46
|
+
- **RESTful API**: Full SOVD API implementation with proper JSON responses
|
|
47
|
+
- **Configurable Entities**: Support for areas, components, and applications
|
|
48
|
+
- **Resource Management**: Data resources, operations, faults, modes, and configurations
|
|
49
|
+
|
|
50
|
+
## Project Structure
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
sovd_server/
|
|
54
|
+
├── src/
|
|
55
|
+
│ └── sovd_server/ # Main source code
|
|
56
|
+
│ ├── config/ # Configuration files
|
|
57
|
+
│ │ ├── sovd_gateway.yaml # Main gateway configuration
|
|
58
|
+
│ │ ├── entities/ # Entity configurations
|
|
59
|
+
│ │ │ ├── areas.yaml
|
|
60
|
+
│ │ │ ├── components.yaml
|
|
61
|
+
│ │ │ └── apps.yaml
|
|
62
|
+
│ │ └── resources/ # Resource configurations
|
|
63
|
+
│ │ ├── data/ # Data resource configs
|
|
64
|
+
│ │ ├── operations/ # Operation configs
|
|
65
|
+
│ │ ├── faults/ # Fault configs
|
|
66
|
+
│ │ └── modes/ # Mode configs
|
|
67
|
+
│ ├── enhanced_server.py # Enhanced server with YAML support
|
|
68
|
+
│ ├── config_loader.py # YAML configuration loader
|
|
69
|
+
│ └── run_enhanced_server.py # Server runner script
|
|
70
|
+
├── tests/ # Test files
|
|
71
|
+
│ ├── test_config.py # Configuration testing
|
|
72
|
+
│ ├── test_endpoints.py # Endpoint testing
|
|
73
|
+
│ └── debug_*.py # Debug utilities
|
|
74
|
+
├── generated/ # Auto-generated SOVD server
|
|
75
|
+
├── docs/ # Documentation
|
|
76
|
+
├── requirements.txt # Dependencies
|
|
77
|
+
├── setup.py # Package setup
|
|
78
|
+
├── pyproject.toml # Modern Python project config
|
|
79
|
+
└── Makefile # Development commands
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Configuration System
|
|
83
|
+
|
|
84
|
+
### Gateway Configuration (`config/sovd_gateway.yaml`)
|
|
85
|
+
- Network settings (host, port)
|
|
86
|
+
- Logging configuration
|
|
87
|
+
- Security settings (disabled for testing)
|
|
88
|
+
- Entity and resource file references
|
|
89
|
+
|
|
90
|
+
### Entity Configurations
|
|
91
|
+
- **Areas**: Vehicle areas (engine, transmission, brakes)
|
|
92
|
+
- **Components**: Vehicle components (ECU, sensors, cameras)
|
|
93
|
+
- **Apps**: Diagnostic applications
|
|
94
|
+
|
|
95
|
+
### Resource Configurations
|
|
96
|
+
- **Data Resources**: Actual data with schemas (e.g., SoftwarePartNumber, EngineRPM)
|
|
97
|
+
- **Operations**: Operation definitions with request/response payloads (e.g., calibratecamera)
|
|
98
|
+
- **Faults**: Fault definitions with severity and diagnostic information
|
|
99
|
+
- **Modes**: Operation modes with capabilities and limitations
|
|
100
|
+
|
|
101
|
+
## Installation
|
|
102
|
+
|
|
103
|
+
1. **Set up virtual environment**:
|
|
104
|
+
```bash
|
|
105
|
+
python3 -m venv venv
|
|
106
|
+
source venv/bin/activate
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
2. **Install dependencies**:
|
|
110
|
+
```bash
|
|
111
|
+
pip install -r requirements.txt
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
3. **Install in development mode**:
|
|
115
|
+
```bash
|
|
116
|
+
pip install -e .
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
4. **Test configuration**:
|
|
120
|
+
```bash
|
|
121
|
+
python tests/test_config.py
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## Running the Server
|
|
125
|
+
|
|
126
|
+
### Enhanced Server (Recommended)
|
|
127
|
+
```bash
|
|
128
|
+
make run-server
|
|
129
|
+
# or
|
|
130
|
+
python src/sovd_server/run_enhanced_server.py
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Simple Server (Basic)
|
|
134
|
+
```bash
|
|
135
|
+
python generated/simple_server.py
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## Development Commands
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
make help # Show all available commands
|
|
142
|
+
make install-dev # Install development dependencies
|
|
143
|
+
make test # Run all tests
|
|
144
|
+
make lint # Run linting checks
|
|
145
|
+
make format # Format code with black
|
|
146
|
+
make clean # Clean up build artifacts
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## API Endpoints
|
|
150
|
+
|
|
151
|
+
### Basic Endpoints
|
|
152
|
+
- `GET /health` - Health check
|
|
153
|
+
- `GET /version-info` - Server version information
|
|
154
|
+
|
|
155
|
+
### Collection Endpoints
|
|
156
|
+
- `GET /areas` - List vehicle areas
|
|
157
|
+
- `GET /components` - List vehicle components
|
|
158
|
+
- `GET /apps` - List diagnostic applications
|
|
159
|
+
|
|
160
|
+
### Entity Endpoints
|
|
161
|
+
- `GET /{entity-path}` - Get entity capabilities
|
|
162
|
+
- `GET /{entity-path}/data` - Get data resources
|
|
163
|
+
- `GET /{entity-path}/data/{data-id}` - Get specific data resource
|
|
164
|
+
- `GET /{entity-path}/operations` - Get operations
|
|
165
|
+
- `GET /{entity-path}/operations/{operation-id}` - Get specific operation
|
|
166
|
+
- `POST /{entity-path}/operations/{operation-id}` - Start operation execution
|
|
167
|
+
- `GET /{entity-path}/faults` - Get faults
|
|
168
|
+
- `GET /{entity-path}/modes` - Get modes
|
|
169
|
+
|
|
170
|
+
## Example Usage
|
|
171
|
+
|
|
172
|
+
### Get Engine Data
|
|
173
|
+
```bash
|
|
174
|
+
curl http://localhost:8080/engine/data
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### Get Software Part Number
|
|
178
|
+
```bash
|
|
179
|
+
curl http://localhost:8080/engine/data/SoftwarePartNumber
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### Start Camera Calibration
|
|
183
|
+
```bash
|
|
184
|
+
curl -X POST http://localhost:8080/camera/front/operations/calibratecamera \
|
|
185
|
+
-H "Content-Type: application/json" \
|
|
186
|
+
-d '{"calibration_type": "automatic", "target_distance": 10.0}'
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
## Configuration Examples
|
|
190
|
+
|
|
191
|
+
### Data Resource Example
|
|
192
|
+
```yaml
|
|
193
|
+
data_resources:
|
|
194
|
+
- id: "SoftwarePartNumber"
|
|
195
|
+
name: "Software Part Number"
|
|
196
|
+
description: "Current software part number installed on the engine ECU"
|
|
197
|
+
category: "software"
|
|
198
|
+
data:
|
|
199
|
+
value: "SW-ENG-2024.1.0-REV-A"
|
|
200
|
+
version: "2024.1.0"
|
|
201
|
+
revision: "A"
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
### Operation Example
|
|
205
|
+
```yaml
|
|
206
|
+
operations:
|
|
207
|
+
- id: "calibratecamera"
|
|
208
|
+
name: "Calibrate Camera"
|
|
209
|
+
description: "Calibrate the front camera system for optimal performance"
|
|
210
|
+
execution:
|
|
211
|
+
type: "asynchronous"
|
|
212
|
+
timeout: 300
|
|
213
|
+
request_payload:
|
|
214
|
+
calibration_type:
|
|
215
|
+
type: "string"
|
|
216
|
+
enum: ["automatic", "manual", "advanced"]
|
|
217
|
+
default: "automatic"
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
## Testing
|
|
221
|
+
|
|
222
|
+
### Run All Tests
|
|
223
|
+
```bash
|
|
224
|
+
make test
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
### Configuration Test
|
|
228
|
+
```bash
|
|
229
|
+
python tests/test_config.py
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
### Endpoint Test
|
|
233
|
+
```bash
|
|
234
|
+
python tests/test_endpoints.py
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
## Development
|
|
238
|
+
|
|
239
|
+
The system is designed to be easily extensible:
|
|
240
|
+
|
|
241
|
+
1. **Add new entities**: Create new YAML files in `src/sovd_server/config/entities/`
|
|
242
|
+
2. **Add new resources**: Create new YAML files in `src/sovd_server/config/resources/`
|
|
243
|
+
3. **Modify data**: Update the YAML files with new data
|
|
244
|
+
4. **Add endpoints**: Extend the enhanced server with new routes
|
|
245
|
+
|
|
246
|
+
## Documentation
|
|
247
|
+
|
|
248
|
+
Full documentation is in the [docs/](docs/INDEX.md) directory: configuration, contributing, testing, deployment, security, and changelog.
|
|
249
|
+
|
|
250
|
+
## Notes
|
|
251
|
+
|
|
252
|
+
- The server runs without authentication for testing purposes
|
|
253
|
+
- All configuration is loaded from YAML files
|
|
254
|
+
- The system uses the auto-generated SOVD models for proper API compliance
|
|
255
|
+
- CORS is enabled for web client testing
|
|
256
|
+
- Logging is configured through the gateway configuration
|
|
257
|
+
|
|
258
|
+
## Troubleshooting
|
|
259
|
+
|
|
260
|
+
1. **Configuration not loading**: Check file paths in YAML files
|
|
261
|
+
2. **Endpoints returning 404**: Verify entity paths match configuration
|
|
262
|
+
3. **Data not found**: Check resource file references in entity configs
|
|
263
|
+
4. **Server not starting**: Check port availability and dependencies
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
# SOVD Server with YAML Configuration
|
|
2
|
+
|
|
3
|
+
This project implements a Service-Oriented Vehicle Diagnostics (SOVD) server based on ISO/DIS 17978-3:2025 with YAML-based configuration support.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Hierarchical YAML Configuration**: Multi-level configuration system with gateway, entity, and resource configurations
|
|
8
|
+
- **Real Data Endpoints**: Actual data for data resources, operations, faults, and modes
|
|
9
|
+
- **No Authentication**: Simplified setup without authorization layer for testing
|
|
10
|
+
- **RESTful API**: Full SOVD API implementation with proper JSON responses
|
|
11
|
+
- **Configurable Entities**: Support for areas, components, and applications
|
|
12
|
+
- **Resource Management**: Data resources, operations, faults, modes, and configurations
|
|
13
|
+
|
|
14
|
+
## Project Structure
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
sovd_server/
|
|
18
|
+
├── src/
|
|
19
|
+
│ └── sovd_server/ # Main source code
|
|
20
|
+
│ ├── config/ # Configuration files
|
|
21
|
+
│ │ ├── sovd_gateway.yaml # Main gateway configuration
|
|
22
|
+
│ │ ├── entities/ # Entity configurations
|
|
23
|
+
│ │ │ ├── areas.yaml
|
|
24
|
+
│ │ │ ├── components.yaml
|
|
25
|
+
│ │ │ └── apps.yaml
|
|
26
|
+
│ │ └── resources/ # Resource configurations
|
|
27
|
+
│ │ ├── data/ # Data resource configs
|
|
28
|
+
│ │ ├── operations/ # Operation configs
|
|
29
|
+
│ │ ├── faults/ # Fault configs
|
|
30
|
+
│ │ └── modes/ # Mode configs
|
|
31
|
+
│ ├── enhanced_server.py # Enhanced server with YAML support
|
|
32
|
+
│ ├── config_loader.py # YAML configuration loader
|
|
33
|
+
│ └── run_enhanced_server.py # Server runner script
|
|
34
|
+
├── tests/ # Test files
|
|
35
|
+
│ ├── test_config.py # Configuration testing
|
|
36
|
+
│ ├── test_endpoints.py # Endpoint testing
|
|
37
|
+
│ └── debug_*.py # Debug utilities
|
|
38
|
+
├── generated/ # Auto-generated SOVD server
|
|
39
|
+
├── docs/ # Documentation
|
|
40
|
+
├── requirements.txt # Dependencies
|
|
41
|
+
├── setup.py # Package setup
|
|
42
|
+
├── pyproject.toml # Modern Python project config
|
|
43
|
+
└── Makefile # Development commands
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Configuration System
|
|
47
|
+
|
|
48
|
+
### Gateway Configuration (`config/sovd_gateway.yaml`)
|
|
49
|
+
- Network settings (host, port)
|
|
50
|
+
- Logging configuration
|
|
51
|
+
- Security settings (disabled for testing)
|
|
52
|
+
- Entity and resource file references
|
|
53
|
+
|
|
54
|
+
### Entity Configurations
|
|
55
|
+
- **Areas**: Vehicle areas (engine, transmission, brakes)
|
|
56
|
+
- **Components**: Vehicle components (ECU, sensors, cameras)
|
|
57
|
+
- **Apps**: Diagnostic applications
|
|
58
|
+
|
|
59
|
+
### Resource Configurations
|
|
60
|
+
- **Data Resources**: Actual data with schemas (e.g., SoftwarePartNumber, EngineRPM)
|
|
61
|
+
- **Operations**: Operation definitions with request/response payloads (e.g., calibratecamera)
|
|
62
|
+
- **Faults**: Fault definitions with severity and diagnostic information
|
|
63
|
+
- **Modes**: Operation modes with capabilities and limitations
|
|
64
|
+
|
|
65
|
+
## Installation
|
|
66
|
+
|
|
67
|
+
1. **Set up virtual environment**:
|
|
68
|
+
```bash
|
|
69
|
+
python3 -m venv venv
|
|
70
|
+
source venv/bin/activate
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
2. **Install dependencies**:
|
|
74
|
+
```bash
|
|
75
|
+
pip install -r requirements.txt
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
3. **Install in development mode**:
|
|
79
|
+
```bash
|
|
80
|
+
pip install -e .
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
4. **Test configuration**:
|
|
84
|
+
```bash
|
|
85
|
+
python tests/test_config.py
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Running the Server
|
|
89
|
+
|
|
90
|
+
### Enhanced Server (Recommended)
|
|
91
|
+
```bash
|
|
92
|
+
make run-server
|
|
93
|
+
# or
|
|
94
|
+
python src/sovd_server/run_enhanced_server.py
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Simple Server (Basic)
|
|
98
|
+
```bash
|
|
99
|
+
python generated/simple_server.py
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## Development Commands
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
make help # Show all available commands
|
|
106
|
+
make install-dev # Install development dependencies
|
|
107
|
+
make test # Run all tests
|
|
108
|
+
make lint # Run linting checks
|
|
109
|
+
make format # Format code with black
|
|
110
|
+
make clean # Clean up build artifacts
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## API Endpoints
|
|
114
|
+
|
|
115
|
+
### Basic Endpoints
|
|
116
|
+
- `GET /health` - Health check
|
|
117
|
+
- `GET /version-info` - Server version information
|
|
118
|
+
|
|
119
|
+
### Collection Endpoints
|
|
120
|
+
- `GET /areas` - List vehicle areas
|
|
121
|
+
- `GET /components` - List vehicle components
|
|
122
|
+
- `GET /apps` - List diagnostic applications
|
|
123
|
+
|
|
124
|
+
### Entity Endpoints
|
|
125
|
+
- `GET /{entity-path}` - Get entity capabilities
|
|
126
|
+
- `GET /{entity-path}/data` - Get data resources
|
|
127
|
+
- `GET /{entity-path}/data/{data-id}` - Get specific data resource
|
|
128
|
+
- `GET /{entity-path}/operations` - Get operations
|
|
129
|
+
- `GET /{entity-path}/operations/{operation-id}` - Get specific operation
|
|
130
|
+
- `POST /{entity-path}/operations/{operation-id}` - Start operation execution
|
|
131
|
+
- `GET /{entity-path}/faults` - Get faults
|
|
132
|
+
- `GET /{entity-path}/modes` - Get modes
|
|
133
|
+
|
|
134
|
+
## Example Usage
|
|
135
|
+
|
|
136
|
+
### Get Engine Data
|
|
137
|
+
```bash
|
|
138
|
+
curl http://localhost:8080/engine/data
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### Get Software Part Number
|
|
142
|
+
```bash
|
|
143
|
+
curl http://localhost:8080/engine/data/SoftwarePartNumber
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### Start Camera Calibration
|
|
147
|
+
```bash
|
|
148
|
+
curl -X POST http://localhost:8080/camera/front/operations/calibratecamera \
|
|
149
|
+
-H "Content-Type: application/json" \
|
|
150
|
+
-d '{"calibration_type": "automatic", "target_distance": 10.0}'
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## Configuration Examples
|
|
154
|
+
|
|
155
|
+
### Data Resource Example
|
|
156
|
+
```yaml
|
|
157
|
+
data_resources:
|
|
158
|
+
- id: "SoftwarePartNumber"
|
|
159
|
+
name: "Software Part Number"
|
|
160
|
+
description: "Current software part number installed on the engine ECU"
|
|
161
|
+
category: "software"
|
|
162
|
+
data:
|
|
163
|
+
value: "SW-ENG-2024.1.0-REV-A"
|
|
164
|
+
version: "2024.1.0"
|
|
165
|
+
revision: "A"
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### Operation Example
|
|
169
|
+
```yaml
|
|
170
|
+
operations:
|
|
171
|
+
- id: "calibratecamera"
|
|
172
|
+
name: "Calibrate Camera"
|
|
173
|
+
description: "Calibrate the front camera system for optimal performance"
|
|
174
|
+
execution:
|
|
175
|
+
type: "asynchronous"
|
|
176
|
+
timeout: 300
|
|
177
|
+
request_payload:
|
|
178
|
+
calibration_type:
|
|
179
|
+
type: "string"
|
|
180
|
+
enum: ["automatic", "manual", "advanced"]
|
|
181
|
+
default: "automatic"
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
## Testing
|
|
185
|
+
|
|
186
|
+
### Run All Tests
|
|
187
|
+
```bash
|
|
188
|
+
make test
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
### Configuration Test
|
|
192
|
+
```bash
|
|
193
|
+
python tests/test_config.py
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### Endpoint Test
|
|
197
|
+
```bash
|
|
198
|
+
python tests/test_endpoints.py
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
## Development
|
|
202
|
+
|
|
203
|
+
The system is designed to be easily extensible:
|
|
204
|
+
|
|
205
|
+
1. **Add new entities**: Create new YAML files in `src/sovd_server/config/entities/`
|
|
206
|
+
2. **Add new resources**: Create new YAML files in `src/sovd_server/config/resources/`
|
|
207
|
+
3. **Modify data**: Update the YAML files with new data
|
|
208
|
+
4. **Add endpoints**: Extend the enhanced server with new routes
|
|
209
|
+
|
|
210
|
+
## Documentation
|
|
211
|
+
|
|
212
|
+
Full documentation is in the [docs/](docs/INDEX.md) directory: configuration, contributing, testing, deployment, security, and changelog.
|
|
213
|
+
|
|
214
|
+
## Notes
|
|
215
|
+
|
|
216
|
+
- The server runs without authentication for testing purposes
|
|
217
|
+
- All configuration is loaded from YAML files
|
|
218
|
+
- The system uses the auto-generated SOVD models for proper API compliance
|
|
219
|
+
- CORS is enabled for web client testing
|
|
220
|
+
- Logging is configured through the gateway configuration
|
|
221
|
+
|
|
222
|
+
## Troubleshooting
|
|
223
|
+
|
|
224
|
+
1. **Configuration not loading**: Check file paths in YAML files
|
|
225
|
+
2. **Endpoints returning 404**: Verify entity paths match configuration
|
|
226
|
+
3. **Data not found**: Check resource file references in entity configs
|
|
227
|
+
4. **Server not starting**: Check port availability and dependencies
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=45", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "sovd-server"
|
|
7
|
+
version = "1.0.0"
|
|
8
|
+
description = "SOVD (Service-Oriented Vehicle Data) Server Implementation"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.9,<4.0"
|
|
11
|
+
license = {text = "MIT"}
|
|
12
|
+
authors = [
|
|
13
|
+
{name = "SOVD Development Team", email = "dev@sovd.org"},
|
|
14
|
+
]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Development Status :: 4 - Beta",
|
|
17
|
+
"Intended Audience :: Developers",
|
|
18
|
+
"License :: OSI Approved :: MIT License",
|
|
19
|
+
"Operating System :: OS Independent",
|
|
20
|
+
"Programming Language :: Python :: 3",
|
|
21
|
+
"Programming Language :: Python :: 3.9",
|
|
22
|
+
"Programming Language :: Python :: 3.10",
|
|
23
|
+
"Programming Language :: Python :: 3.11",
|
|
24
|
+
"Programming Language :: Python :: 3.12",
|
|
25
|
+
]
|
|
26
|
+
dependencies = [
|
|
27
|
+
"flask>=3.1.0",
|
|
28
|
+
"flask-cors>=3.0.0",
|
|
29
|
+
"pyyaml>=6.0",
|
|
30
|
+
"connexion[swagger-ui]>=3.0.0,<=3.3.0",
|
|
31
|
+
"jsonschema>=4.0.0",
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
[project.optional-dependencies]
|
|
35
|
+
dev = [
|
|
36
|
+
"pytest>=8.4.2",
|
|
37
|
+
"pytest-cov",
|
|
38
|
+
"black",
|
|
39
|
+
"flake8",
|
|
40
|
+
"mypy",
|
|
41
|
+
"bandit",
|
|
42
|
+
"safety",
|
|
43
|
+
]
|
|
44
|
+
|
|
45
|
+
[project.scripts]
|
|
46
|
+
sovd-server = "src.sovd_server.run_enhanced_server:main"
|
|
47
|
+
|
|
48
|
+
[tool.setuptools.packages.find]
|
|
49
|
+
where = ["src"]
|
|
50
|
+
|
|
51
|
+
[tool.setuptools.package-data]
|
|
52
|
+
sovd_server = ["config/*.yaml", "config/**/*.yaml"]
|
|
53
|
+
|
|
54
|
+
[tool.black]
|
|
55
|
+
line-length = 88
|
|
56
|
+
target-version = ['py39']
|
|
57
|
+
include = '\.pyi?$'
|
|
58
|
+
extend-exclude = '''
|
|
59
|
+
/(
|
|
60
|
+
# directories
|
|
61
|
+
\.eggs
|
|
62
|
+
| \.git
|
|
63
|
+
| \.hg
|
|
64
|
+
| \.mypy_cache
|
|
65
|
+
| \.tox
|
|
66
|
+
| \.venv
|
|
67
|
+
| venv
|
|
68
|
+
| _build
|
|
69
|
+
| buck-out
|
|
70
|
+
| build
|
|
71
|
+
| dist
|
|
72
|
+
# generated OpenAPI code (symlinked under src/sovd_server)
|
|
73
|
+
| src/sovd_server/models
|
|
74
|
+
| src/sovd_server/controllers
|
|
75
|
+
| src/sovd_server/util\.py
|
|
76
|
+
| src/sovd_server/typing_utils\.py
|
|
77
|
+
| src/sovd_server/encoder\.py
|
|
78
|
+
| generated
|
|
79
|
+
)/
|
|
80
|
+
'''
|
|
81
|
+
|
|
82
|
+
[tool.pytest.ini_options]
|
|
83
|
+
testpaths = ["tests"]
|
|
84
|
+
python_files = ["test_*.py"]
|
|
85
|
+
python_classes = ["Test*"]
|
|
86
|
+
python_functions = ["test_*"]
|
|
87
|
+
addopts = "-v --tb=short"
|
|
88
|
+
|
|
89
|
+
[tool.mypy]
|
|
90
|
+
python_version = "3.9"
|
|
91
|
+
warn_return_any = true
|
|
92
|
+
warn_unused_configs = true
|
|
93
|
+
disallow_untyped_defs = true
|
|
94
|
+
|
|
95
|
+
[dependency-groups]
|
|
96
|
+
dev = [
|
|
97
|
+
"pytest (>=8.4.2,<9.0.0)",
|
|
98
|
+
"pytest-cov (>=7.0.0,<8.0.0)",
|
|
99
|
+
"black (>=25.9.0,<26.0.0)",
|
|
100
|
+
"flake8 (>=7.3.0,<8.0.0)",
|
|
101
|
+
"mypy (>=1.18.2,<2.0.0)"
|
|
102
|
+
]
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Core dependencies
|
|
2
|
+
flask>=3.1.0
|
|
3
|
+
flask-cors>=3.0.0
|
|
4
|
+
pyyaml>=6.0
|
|
5
|
+
connexion[swagger-ui]>=3.0.0,<=3.3.0
|
|
6
|
+
jsonschema>=4.0.0
|
|
7
|
+
|
|
8
|
+
# Development dependencies (install with: pip install -r requirements.txt[dev])
|
|
9
|
+
pytest>=8.4.2
|
|
10
|
+
pytest-cov
|
|
11
|
+
black
|
|
12
|
+
flake8
|
|
13
|
+
mypy
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Setup script for SOVD Server
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
import os
|
|
7
|
+
|
|
8
|
+
from setuptools import setup, find_packages
|
|
9
|
+
|
|
10
|
+
_ROOT = os.path.dirname(os.path.abspath(__file__))
|
|
11
|
+
|
|
12
|
+
with open(os.path.join(_ROOT, "README.md"), "r", encoding="utf-8") as fh:
|
|
13
|
+
long_description = fh.read()
|
|
14
|
+
|
|
15
|
+
requirements_path = os.path.join(_ROOT, "requirements.txt")
|
|
16
|
+
if os.path.isfile(requirements_path):
|
|
17
|
+
with open(requirements_path, "r", encoding="utf-8") as fh:
|
|
18
|
+
requirements = []
|
|
19
|
+
for line in fh:
|
|
20
|
+
line = line.strip()
|
|
21
|
+
if line.startswith("# Development"):
|
|
22
|
+
break
|
|
23
|
+
if line and not line.startswith("#"):
|
|
24
|
+
requirements.append(line)
|
|
25
|
+
else:
|
|
26
|
+
# Fallback when building from sdist without requirements.txt (use pyproject.toml deps)
|
|
27
|
+
requirements = [
|
|
28
|
+
"flask>=3.1.0",
|
|
29
|
+
"flask-cors>=3.0.0",
|
|
30
|
+
"pyyaml>=6.0",
|
|
31
|
+
"connexion[swagger-ui]>=3.0.0,<=3.3.0",
|
|
32
|
+
"jsonschema>=4.0.0",
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
setup(
|
|
36
|
+
name="sovd-server",
|
|
37
|
+
version="1.0.0",
|
|
38
|
+
author="SOVD Development Team",
|
|
39
|
+
author_email="dev@sovd.org",
|
|
40
|
+
description="SOVD (Service-Oriented Vehicle Data) Server Implementation",
|
|
41
|
+
long_description=long_description,
|
|
42
|
+
long_description_content_type="text/markdown",
|
|
43
|
+
url="https://github.com/sovd/sovd-server",
|
|
44
|
+
packages=find_packages(where="src"),
|
|
45
|
+
package_dir={"": "src"},
|
|
46
|
+
classifiers=[
|
|
47
|
+
"Development Status :: 4 - Beta",
|
|
48
|
+
"Intended Audience :: Developers",
|
|
49
|
+
"License :: OSI Approved :: MIT License",
|
|
50
|
+
"Operating System :: OS Independent",
|
|
51
|
+
"Programming Language :: Python :: 3",
|
|
52
|
+
"Programming Language :: Python :: 3.8",
|
|
53
|
+
"Programming Language :: Python :: 3.9",
|
|
54
|
+
"Programming Language :: Python :: 3.10",
|
|
55
|
+
"Programming Language :: Python :: 3.11",
|
|
56
|
+
"Programming Language :: Python :: 3.12",
|
|
57
|
+
],
|
|
58
|
+
python_requires=">=3.8",
|
|
59
|
+
install_requires=requirements,
|
|
60
|
+
extras_require={
|
|
61
|
+
"dev": [
|
|
62
|
+
"pytest>=6.0",
|
|
63
|
+
"pytest-cov",
|
|
64
|
+
"black",
|
|
65
|
+
"flake8",
|
|
66
|
+
"mypy",
|
|
67
|
+
],
|
|
68
|
+
},
|
|
69
|
+
entry_points={
|
|
70
|
+
"console_scripts": [
|
|
71
|
+
"sovd-server=src.sovd_server.run_enhanced_server:main",
|
|
72
|
+
],
|
|
73
|
+
},
|
|
74
|
+
include_package_data=True,
|
|
75
|
+
package_data={
|
|
76
|
+
"sovd_server": [
|
|
77
|
+
"config/*.yaml",
|
|
78
|
+
"config/**/*.yaml",
|
|
79
|
+
],
|
|
80
|
+
},
|
|
81
|
+
)
|