Files
Audric 5da075f150 feat(alias): add LOCAL_ALIASES to re-home short local TGs under an owned prefix
Re-home a short local talk group (e.g. 8) under the reflector's own owned
prefix as a globally-unique number (e.g. 2620008) via a single [GLOBAL]
LOCAL_ALIASES entry, so it routes across the trunk mesh like any owned TG
while local users keep dialing the short number.

- Config: LOCAL_ALIASES=localTG:aliasTG[/dir] (dir in|out, omitted = two-way);
  aliasTG must be owned by a LOCAL_PREFIX. Rejects unowned alias, an owned
  short side, duplicate short keys, and numeric overflow.
- Boundary rewrite: prefix routing / owner-relay / peer-interest run on the
  long owned number; local delivery and talker arbitration run on the short
  number, bridged in the four inbound trunk handlers.
- Rewrite-on-select folds a client that dials the long number onto the short
  number (select + monitor), so the two are one conversation locally and on
  the mesh.
- Twin: external-talker notify uses the short number to match the audio
  mirror; disconnect cleanup folds to short so an aliased TG cannot wedge.
- /status exposes local_aliases; satellite nodes warn that the setting is
  ignored (a local alias belongs on the mesh parent that owns the prefix).
- Docs (PEER_PROTOCOL, CONCEPTS, conf template) and integration tests
  (tests/test_alias.py): two-way / in / out, rewrite-on-select, status,
  validation, disconnect-wedge, and duplicate-key coverage.
2026-07-03 18:17:16 +02:00

72 lines
2.1 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
cd "$(dirname "$0")"
cleanup() {
echo "=== Tearing down test environment ==="
docker compose -f docker-compose.test.yml down -v --remove-orphans 2>/dev/null
docker compose -f docker-compose.routable.yml down -v --remove-orphans 2>/dev/null
}
trap cleanup EXIT
echo "=== Generating configs from topology.py ==="
python3 generate_configs.py
echo "=== Building and starting reflector mesh ==="
docker compose -f docker-compose.test.yml up -d --build --wait
echo "=== Running integration tests ==="
python3 test_trunk.py
echo "=== Running local-alias integration tests ==="
python3 test_alias.py -v
echo "=== Running MQTT-deltas integration tests ==="
python3 test_mqtt_deltas.py
echo "=== Running per-satellite-secret tests ==="
python3 test_satellite_secrets.py
echo "=== Logging tests ==="
python3 test_logging.py -v || exit 1
echo ""
echo "=================================="
echo "Running TWIN protocol tests"
echo "=================================="
echo "=== Generating TWIN topology configs ==="
python3 generate_configs.py --topology twin
echo "=== Tearing down default mesh ==="
docker compose -f docker-compose.test.yml down -v --remove-orphans
echo "=== Building and starting TWIN mesh ==="
docker compose -f docker-compose.test.yml up -d --build --wait
echo "=== Running TWIN integration tests ==="
python3 test_twin.py
echo ""
echo "=================================="
echo "Running ROUTABLE prefix tests"
echo "=================================="
echo "=== Generating ROUTABLE topology configs ==="
python3 generate_configs.py --topology routable
echo "=== Tearing down TWIN mesh ==="
docker compose -f docker-compose.test.yml down -v --remove-orphans
echo "=== Building and starting ROUTABLE mesh ==="
docker compose -f docker-compose.routable.yml up -d --build --wait
echo "=== Running ROUTABLE integration tests ==="
python3 test_routable.py
echo "=== Tearing down ROUTABLE mesh ==="
docker compose -f docker-compose.routable.yml down -v --remove-orphans
echo "=== Restoring default topology ==="
python3 generate_configs.py