Add routed device addressing for Python bindings - #2
Open
acedrew wants to merge 3 commits into
Open
Conversation
Introduces RequestTarget enum (Direct/Routed/ImplicitRouted) so all client service methods accept routed addresses via `impl Into<RequestTarget>`. Adds ClientRouterTable auto-populated from I-Am-Router-To-Network, with resolve_router() for automatic router discovery. Python bindings gain parse_target() supporting "network:mac" address format and a `router` keyword-only param on all 32 address-taking methods. Includes unit tests for parse_target and ClientRouterTable. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Two issues caused routed confirmed requests to time out: 1. The NPDU destination filter in layer.rs (line 143) discarded all non-broadcast messages with a DNET, including legitimate application- layer responses to our routed requests. Since network-layer messages are already handled earlier in the dispatch loop, the remaining messages are all APDUs — which should be accepted regardless of DNET, as a non-router can be the destination of a routed reply. 2. The non-BBMD FORWARDED_NPDU handler in bip.rs used the UDP sender address as source_mac instead of the originating IP from the BVLL header. When a response came through a BBMD relay, the source_mac wouldn't match the router_mac registered in the TSM, causing a correlation failure. Now uses originating_ip consistently with the BBMD code path. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add routed_test.rs: 8-test integration binary for campus simulator (router discovery, direct reads, routed reads to multiple networks, error round-trip, and implicit routing via auto-discovery) - Auto-resolve ImplicitRouted targets in confirmed_request() and unconfirmed_request() instead of requiring callers to pre-resolve Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
RequestTargetenum (Direct,Routed,ImplicitRouted) tobacnet-client, allowing all service methods to accept routed addresses viaimpl Into<RequestTarget>— fully backwards compatibleClientRouterTableauto-populated from I-Am-Router-To-Network messages, withresolve_router()for automatic router discovery when using implicit routed addressesparse_target()in Python bindings supporting"network:mac"address format (e.g."1001:10.1.0.10:47808"for IP,"1001:0a"for MS/TP)router: Optional[str] = Nonekeyword-only parameter to all 32 address-taking Python methods and.pyitype stubsAddress formats
"192.168.1.100:47808""1001:10.1.0.10:47808""1001:10.1.0.10:47808"+router="192.168.1.254:47808""1001:0a"Test plan
cargo checkpasses across full workspacecargo test— all 1706 tests pass (includes new unit tests forparse_targetandClientRouterTable)cargo check -p rusty-bacnet --testsconfirms Python bindings compile🤖 Generated with Claude Code