bgpstatus,smartcontract: enumerate netns and submit per-user BGP RTT onchain#3716
Merged
Conversation
elitegreg
approved these changes
May 18, 2026
Two related changes that share files in the bgpstatus submitter and the serviceability program. Tests follow in a separate commit. - bgpstatus: discover VRFs by enumerating /var/run/netns/ instead of synthesizing names from onchain tenant data and a hardcoded base prefix. Fixes multicast user BGP status never being collected on Arista EOS: the default VRF is exposed as /var/run/netns/default, not the agent's current Linux namespace (which is ns-management). Drops --bgp-namespace wiring from the submitter (the flag is still used by the state collector); adds NetnsDir config. - bgpstatus: submit smoothed BGP TCP RTT alongside every status write. Sourced from the same INET_DIAG snapshot already used to detect ESTABLISHED sessions, converted to nanoseconds at the boundary to match Link.delay_ns / jitter_ns. A Down submission clears RTT so a stale sample cannot outlive the session. - smartcontract: extend SetUserBGPStatusArgs and the User account with bgp_rtt_ns: u64. Old (status-only) payloads decode with bgp_rtt_ns=0 via BorshDeserializeIncremental; old serialized User accounts decode with bgp_rtt_ns=0 via the existing append-only reader. - sdk (go/python/typescript): deserialize the new field; the Go executor builds the new 10-byte instruction payload. - cli: doublezero user get/list surface BGP RTT in ms. - netns: remove the empty-string short-circuit in RunInNamespace; it was added to support the prior (incorrect) default-VRF sentinel and now masks accidental misuse.
Covers the previous commit across all test layers.
- bgpstatus: tests for listNamespaces, the new BGPPeerState collector
shape, end-to-end RTT plumbing through tick() and submitTask, and
Down clearing RTT. Existing tests adapted to the new collector
signature via a staticEstablishedCollector adapter.
- netns: regression test confirming RunInNamespace("") now errors
rather than silently no-opping.
- smartcontract: integration test for SetUserBGPStatus now asserts
bgp_rtt_ns round-trips onto the User account; unit tests cover
SetUserBGPStatusArgs incremental decode of old vs new payloads and
the User append-only default for bgp_rtt_ns. Sizing assertions in
the access pass airdrop test bumped to cover the 8-byte addition.
- sdk fixtures (go/python/typescript): new bgp_rtt_ns field
round-trips; old-layout backward-compat tests strip the new
trailing bytes; Go executor builds the 10-byte payload.
- e2e: doublezero user list fixtures gain the rtt column ("-" since
no real BGP session is up in those scenarios). user_bgp_status_test
asserts BgpRttNs > 0 on Up and BgpRttNs == 0 on Down for regular,
multicast, and non-default-tenant scenarios.
The CLI renames the bgp_rtt field to a 3-char rtt column in the user list table. The fixtures still said bgp_rtt with 7-char value padding, so the byte-exact comparison in ibrl_with_allocated_ip_test and the ibrl test would fail against the live output. Shorten the column header to rtt and trim the data cell padding from "- " to "- " to match.
c8ce839 to
6e091d2
Compare
Extend RFC 19 to cover the smoothed BGP TCP RTT field added in the same PR: new bgp_rtt_ns: u64 on the User account (same unit as Link.delay_ns), corresponding 8 bytes in the args struct (decoded via BorshDeserializeIncremental so deploy order is unconstrained), Down clears the value, and the telemetry collector sources RTT from the same INET_DIAG snapshot already used to detect ESTABLISHED sessions so there is no new collection cost. Status flips from Approved to Implemented now that the implementation has shipped on this branch.
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 of Changes
/var/run/netns/instead of synthesizing names from onchain tenant data and a hardcoded base prefix. Fixes multicast user BGP status never being collected on Arista EOS: the default VRF is exposed as/var/run/netns/default, not the agent's current Linux namespace (which isns-management).Link.delay_ns/Link.jitter_ns. A Down submission clears RTT so a stale sample cannot outlive the session.SetUserBGPStatusArgsand theUseraccount withbgp_rtt_ns: u64. Old (status-only) payloads decode withbgp_rtt_ns=0viaBorshDeserializeIncremental; old serialized User accounts decode withbgp_rtt_ns=0via the existing append-only reader. Deploy order is unconstrained.Testing Verification