AISOCin‑a‑box

Edge Box Simulator (edge-sim)

edge/edge-sim/edge_sim.py is the developer-plane stand-in for a physical Box (§6 Phase E, card aiso-2zc): it generates realistic alert streams in the Vector/ECS shape §2.1 produces, and pushes them through the simulated tunnel to the cloud stack so you can watch alerts flow edge → tunnel → triage → case → portal without any hardware.

Stdlib-only (urllib, no cloud SDKs), consistent with the edge-plane import rule (§5 invariant 1).

What is real vs simulated

Leg Status
Alert contract REAL — every event is an AlertMetadataPush-shaped payload (§1.2.4.a) POSTed to POST /api/alerts/ingest: landed under RLS, deduped by (tenant, local_alert_id), run through the §3.2 triage graph, fanned out to the portal
Event shape REAL — ECS-normalized + redacted exactly as the §2.1 manifest output ([REDACTED:*] markers + redaction.fields_redacted)
Edge credential REAL — the tenant API key (Authorization: Bearer sk_tnt_…) or the dev-mode edge-agent headers (§1.2.4); the key IS the tenant scope
Fleet heartbeat REAL surface (POST /api/edges/{id}/heartbeat), synthetic numbers
Tenant ES index template REAL idempotent _index_template put for soc-box-<tenant>-*
WireGuard/gRPC tunnel leg SIMULATED — HTTPS to the ingest endpoint instead
The box itself SIMULATED — no os-image, no Vector process

Quickstart

Provision a tenant (see Getting started §1.5), then:

# stream 10 deterministic alerts (2 forced high-blast → HITL interrupts)
python3 edge/edge-sim/edge_sim.py \
    --api http://127.0.0.1:8117 \
    --tenant tnt_your_co --api-key 'sk_tnt_…' \
    --edge-id edge-your_co-01 \
    --count 10 --seed 7 --high-blast 2 --format json

The JSON summary reports sent / ingested / deduped / hitl_interrupts / cases / heartbeat_ok / index_template_ok — the same fields the acceptance gate fixtures assert.

Flags

Flag Meaning
--api control-plane base URL (default http://127.0.0.1:8117)
--tenant / --api-key tenant scope; the key (if given) wins over dev headers
--edge-id fleet row to heartbeat (provisioning creates edge-<tid>-01)
--eps events per second (default 2.0; sizing harness uses 500/2500)
--duration / --count stream by seconds or exact event count
--seed deterministic corpus — the same seed replays the same sequence (gate fixtures rely on this)
--high-blast N first N events are high-blast-radius host_isolate candidates → guaranteed HITL interrupt path (§3.2.3)
--no-triage generate + shape-validate locally only (no cloud POST)
--no-heartbeat skip the fleet channel
--format json machine-readable summary (CI fixtures)

Gate-fixture contract

The G1/G2 integration suites (apps/control-plane-api/tests/integration/test_g1_tenant_isolation.py, test_g2_hitl_audit.py) build on the simulator's guarantees: seeded determinism, the HIGHBLAST verdict-lane key (ecs.event.original == "HIGHBLAST" → stub router true-positive → OPA-gated host_isolate), and the ingest dedupe semantics. If you change the alert shape, run both suites against a live stack.