Files
hblink3/tests
Cort BuffingtonandClaude Opus 4.8 2ac1437ca5 Don't forward bridged traffic to a peer not logged into its master
When HBlink3 acts as a PEER, the router forwarded bridged call traffic to it
regardless of whether it had completed login to its upstream master. The frames
were fired at the master's address and silently dropped (we're not registered),
and the call falsely appeared as an active forward on the dashboard. This is
long-standing behavior (master/original hblink3 did the same) -- the new
event-sourced dashboard just made it visible.

Add HBSYSTEM.egress_ready() (True for masters/OpenBridges; for a PEER, True only
once CONNECTION == 'YES') and skip un-ready targets at the top of routerHBP
bridge_group / bridge_unit, so a disconnected peer gets no forwarded frames, no
TX report event, and no TX status churn. send_master also drops DMRD when not
connected as defense-in-depth, while still letting login/keepalive packets flow.

The routing harness models connected, participating systems, so it now marks its
PEER systems CONNECTION == 'YES' -- the 15-scenario byte baseline is unchanged.
Tests: tests/test_peer_egress.py (connected forwards, disconnected skipped) plus
a send_master drop/allow test; full suite 51 green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-25 08:00:55 -05:00
..

Tests

Regression tests pinning the behavior of helpers extracted during the 2026 cleanup. They exist because a live OBP/HBP network with real DMR audio cannot be reproduced in a dev environment, so the routing helpers are validated in isolation instead.

  • test_acl.py — HBSYSTEM.dmrd_acl_check() (the shared master/peer ACL logic): PERMIT/DENY matching, per-timeslot scoping, and the once-per-stream drop logging.
  • test_lc.py — gen_lcs() and embed_lc() from bridge.py: Link Control generation and the DMR payload LC rewrite used by all four group-routing paths.

Running

From the repo root, using the project virtualenv (which has twisted, dmr_utils3, and bitarray):

venv/bin/python -m unittest discover -s tests -v

Pure stdlib unittest — no extra dependencies. They also run under pytest if you have it installed (venv/bin/python -m pytest tests).