Skip to content

smartcontract,client: add topology CLI commands#3512

Draft
ben-malbeclabs wants to merge 1 commit intobc/rfc18-pr1from
bc/rfc18-pr2
Draft

smartcontract,client: add topology CLI commands#3512
ben-malbeclabs wants to merge 1 commit intobc/rfc18-pr1from
bc/rfc18-pr2

Conversation

@ben-malbeclabs
Copy link
Copy Markdown
Contributor

@ben-malbeclabs ben-malbeclabs commented Apr 10, 2026

RFC-18 flex-algo · PR 2 of 5 · see rfcs/rfc-0018-flex-algo.md
Depends on: #3497 (PR 1)
Series: #3497 · #3512 · #3513 · #3514 · #3515

Summary of Changes

  • Adds five doublezero link topology subcommands: create, delete, clear, list, backfill
  • Backs each with a Rust SDK command in doublezero_sdk::commands::topology
  • topology list displays name, admin-group bit, flex-algo number, BGP color community, constraint, and linked link count
  • topology clear removes a topology from all links that reference it; topology backfill allocates flex-algo node segments on all activated devices for a given topology
  • Wires the link topology subcommand group into the existing doublezero link command tree

Diff Breakdown

Category Files Lines (+/-) Net
Core logic 11 +1334 / -0 +1334
Scaffolding 6 +84 / -6 +78

Heavy on new code — all five CLI commands and six SDK commands are new files with no prior equivalent.

Key files (click to expand)
  • smartcontract/cli/src/topology/list.rs — lists all TopologyInfo accounts; shows BGP color (128 + admin_group_bit), constraint, and how many links are tagged with each topology
  • smartcontract/cli/src/topology/clear.rs — removes a topology from all links that reference it; confirms or dry-runs before submitting transactions
  • smartcontract/cli/src/topology/create.rs — creates a topology with name, constraint (include-any or exclude); admin-group bit and flex-algo number are allocated automatically onchain
  • smartcontract/cli/src/topology/backfill.rs — calls BackfillTopology for a named topology, optionally scoped to specific device pubkeys
  • smartcontract/sdk/rs/src/commands/topology/backfill.rs — SDK command for BackfillTopology; includes unit tests with mock client
  • smartcontract/sdk/rs/src/commands/topology/list.rs — SDK command for listing topology accounts; includes unit tests

Testing Verification

  • cargo test -p doublezero_sdk -p doublezero_cli passes
  • cargo clippy -- -D warnings clean
  • make rust-fmt applied before commit

Adds `doublezero link topology {create,delete,clear,backfill,list}` subcommands.

- sdk/rs: topology command structs (create, delete, clear, backfill, list)
- cli: topology CLI wrappers with clap arg parsing and unit tests
- client/doublezero: wire topology subcommands into link command dispatch
- clear: auto-discovers tagged links when --links omitted; batches 29/tx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant