Skip to content

cli: restore default value for device interface create --bandwidth#3775

Merged
juan-malbeclabs merged 3 commits into
mainfrom
tve/cli-bandwidth-default-value
May 27, 2026
Merged

cli: restore default value for device interface create --bandwidth#3775
juan-malbeclabs merged 3 commits into
mainfrom
tve/cli-bandwidth-default-value

Conversation

@thijsvanemmerik
Copy link
Copy Markdown
Contributor

Summary

Testing Verification

  • Added regression test test_cli_device_interface_create_bandwidth_is_optional that uses clap::try_parse_from without --bandwidth and asserts parsing succeeds with bandwidth == 0.
  • Verified the test fails on pre-fix code with clap error MissingRequiredArgument for --bandwidth <BANDWIDTH>, and passes after the fix.
  • All 336 doublezero_cli unit tests pass.

PR #3077 dropped default_value from the bandwidth clap attribute on
device interface create, which made --bandwidth mandatory in practice
because the field is u64 (not Option<u64>). The PR description claimed
--bandwidth was now optional, but only cir actually was. Restores the
default to '0bps' to match cir, and adds a regression test that parses
the CLI without --bandwidth.
@ben-malbeclabs
Copy link
Copy Markdown
Contributor

I think we need to scope this out a bit more:

  • We have bandwidth in two places: links and interfaces
  • We want bandwidth on the CYOA interfaces not connected to a link to be able to track capacity
  • We want bandwidth for the interface to match the link
  • Bandwidth is not an attribute of a loopback interface

We could place a CLI check that prevents:
interface[a|z] bandwidth < link bandwidth

@juan-malbeclabs
Copy link
Copy Markdown
Contributor

@thijsvanemmerik @ben-malbeclabs If that sounds good to everyone, we can move forward with this change and I can send a follow-up PR with the validations Ben suggested. Then we can merge them in sequence.

@thijsvanemmerik
Copy link
Copy Markdown
Contributor Author

Sounds good Juan, thanks for picking up the follow-up. Happy to keep this PR as the minimal loopback regression fix.

Ben, your scoping is right. The two checks sit naturally in different commands: require non-zero bandwidth for CYOA and DIA interfaces at device interface create and device interface update, and enforce interface[a|z].bandwidth >= link.bandwidth at link wan-create / dzx-create.

@juan-malbeclabs
Copy link
Copy Markdown
Contributor

New PR: #3778

Copy link
Copy Markdown
Contributor

@juan-malbeclabs juan-malbeclabs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM -> #3778 bandwidth validation

@juan-malbeclabs juan-malbeclabs merged commit 558c989 into main May 27, 2026
34 of 35 checks passed
@juan-malbeclabs juan-malbeclabs deleted the tve/cli-bandwidth-default-value branch May 27, 2026 20:15
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.

3 participants