Keep low-ID unit data local to the deployment

master
Simon 3 weeks ago
parent 13abcb5b8d
commit 15d45f6eb5

@ -2415,9 +2415,9 @@ class routerOBP(OPENBRIDGE):
continue
if system == 'DATA-GATEWAY':
continue
#We only want to send data calls to individual IDs via OpenBridge
#Only subscriber-to-subscriber unit data may traverse the mesh.
#Only send if proto ver for bridge is > 1
if CONFIG['SYSTEMS'][system]['MODE'] == 'OPENBRIDGE' and CONFIG['SYSTEMS'][system]['VER'] > 1 and (_int_dst_id >= 1000000):
if CONFIG['SYSTEMS'][system]['MODE'] == 'OPENBRIDGE' and CONFIG['SYSTEMS'][system]['VER'] > 1 and (_int_dst_id >= 1000000) and (int_id(_rf_src) >= 1000000):
self.sendDataToOBP(system,_data,dmrpkt,pkt_time,_stream_id,_dst_id,_peer_id,_rf_src,_bits,_slot,_hops,_source_server,_ber,_rssi,_source_rptr)
#If destination ID is in the Subscriber Map
@ -3158,8 +3158,8 @@ class routerHBP(HBSYSTEM):
continue
if system == 'DATA-GATEWAY':
continue
#We only want to send data calls to individual IDs via FreeBridge (not OpenBridge)
if CONFIG['SYSTEMS'][system]['MODE'] == 'OPENBRIDGE' and CONFIG['SYSTEMS'][system]['VER'] > 1 and (_int_dst_id >= 1000000):
#Only subscriber-to-subscriber unit data may traverse FreeBridge.
if CONFIG['SYSTEMS'][system]['MODE'] == 'OPENBRIDGE' and CONFIG['SYSTEMS'][system]['VER'] > 1 and (_int_dst_id >= 1000000) and (int_id(_rf_src) >= 1000000):
self.sendDataToOBP(system,_data,dmrpkt,pkt_time,_stream_id,_dst_id,_peer_id,_rf_src,_bits,_slot,_ber=_ber,_rssi=_rssi)
#If destination ID is in the Subscriber Map

@ -1,5 +1,10 @@
# Unreleased Changes
- Unit-data mesh forwarding now requires both the RF source and destination
DMR IDs to be at least 1000000. This keeps low-ID service requests and replies
(including IP service 5005) local. Local HBP delivery and the dedicated
DATA-GATEWAY feed are unchanged; subscriber-to-subscriber data remains eligible
for mesh forwarding. This is an ID-based routing rule, not payload inspection.
- Added link-local `BCRQ`/`BCTS` request-to-send controls on the dedicated
DATA-GATEWAY FBP5 relationship. A successful request holds a local slot for
500ms until matching data starts. Legacy controls, DMR bytes and ordinary

@ -0,0 +1,59 @@
"""Low-ID unit data stays local without suppressing Gateway observation."""
import unittest
from tests.harness.deterministic import (
DeterministicScenario, PacketSpec, minimal_config, add_openbridge_system,
bytes_3, HBPF_DATA_SYNC,
)
class UnitDataMeshContainmentTests(unittest.TestCase):
def test_mesh_requires_subscriber_source_and_destination(self):
pairs = (
(2341, 2342690, False),
(5000, 2342690, False),
(5005, 2342690, False),
(900999, 2342690, False),
(999999, 2342690, False),
(2342690, 5005, False),
(2342690, 999999, False),
(1000000, 2342690, True),
(2342690, 1000000, True),
(2342690, 2342691, True),
)
for ingress in ("MASTER-A", "OBP-IN", "DATA-GATEWAY"):
for source, destination, mesh_allowed in pairs:
for dtype in (3, 6, 7, 8):
with self.subTest(ingress=ingress, source=source,
destination=destination, dtype=dtype):
config = minimal_config(("MASTER-A", "MASTER-B"))
config["GLOBAL"]["DATA_GATEWAY"] = True
for name, network_id in (("OBP-IN", 3001), ("OBP-OUT", 3002),
("DATA-GATEWAY", 9991)):
add_openbridge_system(config, name, network_id)
with DeterministicScenario(config=config) as scenario:
scenario.clock.advance(10)
scenario.bm.SUB_MAP[bytes_3(destination)] = (
"MASTER-B", 2, scenario.clock.time())
packet = PacketSpec(
rf_src=source, dst_id=destination, slot=2,
call_type="unit", frame_type=HBPF_DATA_SYNC,
dtype_vseq=dtype, payload=bytes([dtype]) * 33,
)
inject = (scenario.inject_hbp if ingress == "MASTER-A"
else scenario.inject_obp)
inject(ingress, packet)
mesh = scenario.capture.for_system("OBP-OUT")
self.assertEqual(len(mesh), int(mesh_allowed))
local = scenario.capture.for_system("MASTER-B")
self.assertEqual(len(local), 1)
gateway = scenario.capture.for_system("DATA-GATEWAY")
self.assertEqual(len(gateway), int(ingress != "DATA-GATEWAY"))
for forwarded in mesh + local + gateway:
self.assertEqual(forwarded.fields["rf_src"], bytes_3(source))
self.assertEqual(forwarded.fields["dst_id"], bytes_3(destination))
self.assertEqual(forwarded.fields["dmr_payload"], packet.payload)
if __name__ == "__main__":
unittest.main()
Loading…
Cancel
Save

Powered by TurnKey Linux.