-
Notifications
You must be signed in to change notification settings - Fork 0
Python CLI
Teddi edited this page Mar 27, 2026
·
1 revision
The Python CLI provides headless validation and CSV/report export, suitable for CI/CD pipelines.
- Python 3.10+
- No external packages (standard library only)
python3 scd_validator.py --input <file.scd> --out-dir <output_directory>| Argument | Required | Description |
|---|---|---|
--input |
Yes | Path to the SCD/SCL file to validate |
--out-dir |
No | Directory for output files (default: ./out) |
| Code | Meaning |
|---|---|
0 |
Validation passed — no errors |
1 |
One or more validation errors found |
2 |
Parse error or I/O error |
All output files are written to --out-dir:
| File | Contents |
|---|---|
goose_matrix.csv |
GOOSE publisher × subscriber matrix |
sv_matrix.csv |
Sampled Values publisher × subscriber matrix |
flows_detail.csv |
Detailed flow list with source/destination datasets |
protocol_summary.csv |
Per-protocol counts |
validation_report.csv |
All validation issues with code, severity, IED, and fix hint |
python3 -m pytest tests/ -vRun a specific test:
python3 -m pytest tests/test_integration.py::test_iec001 -vThe test suite contains 38 integration tests covering parse → validate → export end-to-end.
| Module | Responsibility |
|---|---|
scd_validator.py |
CLI entry point; argument parsing; orchestration |
scd_parser.py |
XML parsing; produces ParseOutput dataclass |
scd_validations.py |
26 validation checks; loads thresholds from validation_config.json
|
scd_export.py |
Writes CSV output files |
scd_utils.py |
IP address, MAC address, and APPID helpers |
- name: Validate SCD file
run: |
python3 scd_validator.py --input substation.scd --out-dir ./reports
# exits with code 1 if errors found, failing the pipeline