← Back to documentation
Snapshot of projects/netsentry-iot/testbench/README.md — 28 Nov 2026

NetSentry-IoT — Virtual Test Bench Plan (TDD)

Project instance of process/templates/testbench-plan.md — CMMI-DEV v2.0, Level 3 (Defined). Test-first: each test below is written before the component it verifies (TDD), and traces to requirements/RTM.md.

1. Objective

Validate the probe locally — without a live industrial LAN — by replaying deterministic traffic and attack scenarios, and by measuring the < 5 ms latency and the detection metrics.

2. Emulation / mocks

  • Replayable captures: committed PCAP/JSON corpora for clean baseline, MQTT, HTTP, spoofing and DoS scenarios (generated by src/attack-simulator/, deterministic).
  • Mock isolation backend: the nft/iptables rule dispatch is mocked (no real firewall changes); the probe is verified to emit the correct rule/alarm.
  • Mock clock: monotonic clock injected for deterministic latency tests.

3. Test strategy

LayerTests (TDD)What it verifies
Unittest_capture, test_mqtt_decode, test_http_decodecapture + bit-exact decoders (FUNC-001/002/003)
Unittest_detection, test_false_positivespoofing/DoS detection + FP control (FUNC-004, ROB-001)
Unittest_isolation, test_incident_log, test_minimizationlocal action + NIS2/GDPR logging (FUNC-005, COM-002/003)
Integrationtest_replayfull capture → decode → detect → act on replayed scenarios (VV-001)
Robustnesstest_fuzz, test_no_cloud1 000 malformed packets, zero crashes; WAN-severed operation (ROB-002, SEC-001)
Performancetest_latency, test_footprint, test_metrics< 5 ms p95/p99; CPU/RSS bound; metrics archived (PERF-001/002, VV-002)

4. Success criteria

  • Latency: p95 and p99 < 5 ms (PERF-001) — measured, archived in performance/.
  • Detection: recall ≥ 95 %, precision ≥ 90 % on the simulator scenarios (FUNC-004).
  • Robustness: zero crashes on 1 000 malformed packets (ROB-002).
  • Compliance: every incident has an append-only JSONL record; no payload stored (COM-002/003).
  • Every Mandatory requirement has ≥ 1 passing test (bidirectional RTM closure).

5. Tooling

  • pytest (unit/integration), hypothesis (fuzz/property), scapy (capture/replay), psutil (footprint), a monotonic clock stub for latency.

Source: raw markdown — published as-is from the source repository.