test(routable): clarify return-path docs; drop dead test scaffolding

Document both forward and return legs of the 263xx transit chain in
topology.py ROUTABLE_REFLECTORS comment block, making clear that
natlde's routable entry toward natlit is the return-path hop and that
the natlit→leaf final hop is carried by peer-interest (not a routable
entry).  Add inline note on natlde's entry.

Drop ROUTABLE_NAMES from topology.py (dead — test files define their own
sorted() locals, matching the REFLECTOR_NAMES/TWIN_NAMES convention).
Remove duplicate sys.path.insert and unused COMPOSE_FILE/TESTS_DIR
constants from test_routable.py.  Add clarifying comment above the
per-peer routable/blacklist injection in generate_configs.py.

Generated configs are byte-identical; no topology routing changes.
This commit is contained in:
Audric committed 2026-06-15 16:34:18 +02:00
1 parent 2e0e501ca5
commit 46979c1f8b
3 files changed
+28 -11

No files matched your search

+4
View File
@@ -64,6 +64,8 @@ def generate_reflector_conf(name: str) -> str:
f"SECRET={secret}", f"SECRET={secret}",
f"REMOTE_PREFIX={T.prefix_str(peer['prefix'])}", f"REMOTE_PREFIX={T.prefix_str(peer['prefix'])}",
] ]
# Optional per-peer routable/blacklist (used only by the ROUTABLE_REFLECTORS
# topology; inert for the default mesh).
routable = r.get("routable", {}).get(peer_name) routable = r.get("routable", {}).get(peer_name)
if routable: if routable:
lines.append(f"ROUTABLE_PREFIXES={','.join(routable)}") lines.append(f"ROUTABLE_PREFIXES={','.join(routable)}")
@@ -598,6 +600,8 @@ def generate_routable_reflector_conf(name: str) -> str:
f"SECRET={secret}", f"SECRET={secret}",
f"REMOTE_PREFIX={T.prefix_str(peer['prefix'])}", f"REMOTE_PREFIX={T.prefix_str(peer['prefix'])}",
] ]
# Optional per-peer routable/blacklist (used only by the ROUTABLE_REFLECTORS
# topology; inert for the default mesh).
routable = r.get("routable", {}).get(peer_name) routable = r.get("routable", {}).get(peer_name)
if routable: if routable:
lines.append(f"ROUTABLE_PREFIXES={','.join(routable)}") lines.append(f"ROUTABLE_PREFIXES={','.join(routable)}")
+2 -6
View File
@@ -33,7 +33,8 @@ from urllib.request import urlopen
from urllib.error import URLError from urllib.error import URLError
import json import json
# Reuse the V2 mock client and wire helpers from test_trunk.py # Reuse the V2 mock client and wire helpers from test_trunk.py.
# Also ensures tests/ is on the path for topology import below.
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
from test_trunk import ( # noqa: E402 from test_trunk import ( # noqa: E402
ClientPeer, UDP_AUDIO, UDP_FLUSH, ClientPeer, UDP_AUDIO, UDP_FLUSH,
@@ -41,8 +42,6 @@ from test_trunk import ( # noqa: E402
CLIENT2_CALLSIGN, CLIENT2_PASSWORD, CLIENT2_CALLSIGN, CLIENT2_PASSWORD,
) )
# Ensure tests/ is on the path so topology can be imported
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
import topology as T import topology as T
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
@@ -53,9 +52,6 @@ HOST = "127.0.0.1"
ROUTABLE_NAMES = sorted(T.ROUTABLE_REFLECTORS) ROUTABLE_NAMES = sorted(T.ROUTABLE_REFLECTORS)
COMPOSE_FILE = "docker-compose.routable.yml"
TESTS_DIR = os.path.dirname(os.path.abspath(__file__))
def _http(name: str): def _http(name: str):
return (HOST, T.routable_mapped_http_port(name)) return (HOST, T.routable_mapped_http_port(name))
+22 -5
View File
@@ -308,11 +308,27 @@ def twin_trunks_for(name: str) -> list:
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# Routable-prefix chain (isolated topology, used by test_routable.py only) # Routable-prefix chain (isolated topology, used by test_routable.py only)
# #
# leaf 222100* --trunk--> natlit 222 --trunk--> natlde 262 --trunk--> far 263 # leaf 222100 --trunk--> natlit 222 --trunk--> natlde 262 --trunk--> far 263
# #
# `263` is a SIBLING of 222/262 (not nested), so it is unreachable without # `263` is a SIBLING prefix to 222/262 (not nested), so it is unreachable
# routable prefixes. The leaf uses "*" (default route to its only uplink); # from leaf without explicit routable-prefix declarations.
# each backbone hop declares an explicit ROUTABLE_PREFIXES toward 263. #
# Forward path (leaf → far):
# leaf uses ROUTABLE_PREFIXES=* toward natlit — default-route all non-local
# TGs up the only uplink.
# natlit uses ROUTABLE_PREFIXES=263 toward natlde — transits 263xx onward.
# natlde→far is native: far owns 263, so no routable entry is needed.
#
# Return path (far → leaf):
# far→natlde is native (far originates, natlde accepts as trunk owner relay).
# natlde uses ROUTABLE_PREFIXES=263 toward natlit — transits 263xx back up.
# (This is the return-path hop; the entry points upstream, not downstream.)
# natlit→leaf final hop is carried by PEER-INTEREST: leaf's ROUTABLE_PREFIXES=*
# caused it to advertise interest in 263xx up to natlit via MsgPeerTgInterest,
# so natlit forwards via isPeerInterestedTG — no routable entry on natlit
# toward leaf is needed or correct.
# leaf ACCEPTS the return audio because its uplink has the `*` wildcard
# (matchesRoutable), not because leaf has a routable entry pointing at itself.
# #
# blacklist on leaf's uplink vetoes TG 26307 exactly (test_02) while leaving # blacklist on leaf's uplink vetoes TG 26307 exactly (test_02) while leaving
# TG 26305 (test_01) unaffected — the two tests use distinct TG numbers. # TG 26305 (test_01) unaffected — the two tests use distinct TG numbers.
@@ -324,12 +340,13 @@ ROUTABLE_REFLECTORS = {
"blacklist": {"natlit": "26307"}}, "blacklist": {"natlit": "26307"}},
"natlit": {"prefix": ["222"], "trunk_port_base": 52000, "natlit": {"prefix": ["222"], "trunk_port_base": 52000,
"peers": ["leaf", "natlde"], "routable": {"natlde": ["263"]}}, "peers": ["leaf", "natlde"], "routable": {"natlde": ["263"]}},
# return-path hop: ROUTABLE_PREFIXES=263 toward natlit transits 263xx back
# up the chain (far→natlde native; natlit→leaf via peer-interest, not routable)
"natlde": {"prefix": ["262"], "trunk_port_base": 53000, "natlde": {"prefix": ["262"], "trunk_port_base": 53000,
"peers": ["natlit", "far"], "routable": {"natlit": ["263"]}}, "peers": ["natlit", "far"], "routable": {"natlit": ["263"]}},
"far": {"prefix": ["263"], "trunk_port_base": 54000, "far": {"prefix": ["263"], "trunk_port_base": 54000,
"peers": ["natlde"]}, "peers": ["natlde"]},
} }
ROUTABLE_NAMES = list(ROUTABLE_REFLECTORS.keys())
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------