57 lines
2.2 KiB
Markdown
57 lines
2.2 KiB
Markdown
# Migration Validation Framework
|
|
|
|
## Problem Statement
|
|
|
|
Infrastructure migrations often fail in small, expensive ways: a mount option changes, a service is disabled, or disk usage moves past an operational threshold. Teams need structured evidence that the migrated host still matches the expected operating profile.
|
|
|
|
## Solution Overview
|
|
|
|
This project provides a Python CLI that collects system state into JSON snapshots and compares before/after files. The output is designed for change records, migration gates, and post-cutover validation.
|
|
|
|
## Architecture Overview
|
|
|
|
```
|
|
Operator -> CLI -> Collectors -> JSON Snapshot -> Comparator -> Diff/Report
|
|
```
|
|
|
|
Core components:
|
|
|
|
- `cli.py` provides collect, compare, snapshot, list, and report commands.
|
|
- `collectors/` gathers mounts, services, and disk usage.
|
|
- `validators/compare.py` identifies drift and validation failures.
|
|
- `reports/` contains report generation helpers.
|
|
- `examples/` contains realistic before/after evidence.
|
|
|
|
## How to Run
|
|
|
|
```bash
|
|
cd migration-validation-framework
|
|
python3 cli.py collect --output before.json --systems web01,db01
|
|
python3 cli.py collect --output after.json --systems web01,db01
|
|
python3 cli.py compare before.json after.json --output diff.json
|
|
python3 cli.py compare examples/before.json examples/after.json --output /tmp/migration-diff.json
|
|
```
|
|
|
|
Legacy snapshot IDs are still supported:
|
|
|
|
```bash
|
|
python3 cli.py snapshot --env prod --label pre --systems web01,db01
|
|
python3 cli.py compare prod-pre-20260429_020000 prod-post-20260429_030000 --output change-0429
|
|
```
|
|
|
|
## Example Output
|
|
|
|
```text
|
|
Comparison completed: diff.json (FAIL)
|
|
Overall risk: high
|
|
Total changes: 4
|
|
Failed checks: critical_services_running
|
|
Recommendation: restore sshd before production cutover
|
|
```
|
|
|
|
Sample inputs and output are available in [examples/before.json](examples/before.json), [examples/after.json](examples/after.json), and [examples/diff.json](examples/diff.json).
|
|
|
|
## Real-World Use Case
|
|
|
|
During a data center migration, a platform team can collect baseline state before cutover, collect the same evidence after DNS or workload migration, and attach the diff to the change ticket. The framework gives reviewers a compact signal on whether the host is ready for production traffic.
|