Skip to content

fix(api): Address misclassification of NVOS data interface IPs as BMC IPs - #4395

Merged
nvlitagaki merged 5 commits into
NVIDIA:mainfrom
nvlitagaki:fix/find-switch-ip
Jul 31, 2026
Merged

fix(api): Address misclassification of NVOS data interface IPs as BMC IPs#4395
nvlitagaki merged 5 commits into
NVIDIA:mainfrom
nvlitagaki:fix/find-switch-ip

Conversation

@nvlitagaki

@nvlitagaki nvlitagaki commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Previously our search IP address logic mistakenly categorized all statically allocated machine interface addresses as static BMC IPs. Now it looks to the interface type as well as the allocation type to categorize the interface.

Additionally, if the response to an IP address search is associated with a switch, the CLI now prints the switch.

Related issues

Internal issue

Type of Change

  • Change - Changes in existing functionality
  • Fix - Bug fixes

Breaking Changes

  • This PR contains breaking changes

Testing

  • Unit tests added/updated
  • Manual testing performed

Additional Notes

@nvlitagaki
nvlitagaki requested a review from a team as a code owner July 30, 2026 18:44
@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 1accfcff-e9ed-4e35-ac92-081c227c7a79

📥 Commits

Reviewing files that changed from the base of the PR and between 549ea90 and e681a99.

📒 Files selected for processing (1)
  • crates/api-core/src/handlers/finder.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • crates/api-core/src/handlers/finder.rs

Summary by CodeRabbit

  • Bug Fixes

    • Improved IP finder classification by identifying static BMC IPs only on BMC interfaces, preventing static data/NVOS IPs from being misclassified.
    • Enhanced finder results with clearer switch association details and more accurate human-readable messages.
  • Tests

    • Expanded integration coverage for static BMC, machine, switch, and data IP classification and messaging.

Walkthrough

Finder address classification now uses interface type and switch metadata from database lookups. Static BMC results require a BMC interface. Machine and switch addresses receive distinct messages. Tests validate classifications and message content.

Changes

Finder classification

Layer / File(s) Summary
Interface metadata lookup
crates/api-db/src/machine_interface_address.rs
find_by_address now returns switch_id and interface_type through MachineInterfaceSearchResult.
Interface-aware finder logic
crates/api-core/src/handlers/finder.rs
Static BMC classification requires interface_type == Bmc. Machine-address messages distinguish machine and switch associations.
Classification tests
crates/api-core/src/handlers/finder.rs, crates/api-core/src/tests/finder.rs
Tests validate BMC-only classification, static BMC messaging, and non-BMC static data address results.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Finder
  participant MachineInterfaceSearch
  participant IpAddressMatch
  Finder->>MachineInterfaceSearch: find_by_address
  MachineInterfaceSearch-->>Finder: interface_type, switch_id, allocation metadata
  Finder->>IpAddressMatch: classify address
  Finder->>IpAddressMatch: format classification message
Loading

Possibly related PRs

Suggested labels: rest-api

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the API fix for misclassifying NVOS data interface IPs as BMC IPs.
Description check ✅ Passed The description accurately covers the classification fix, switch output change, and related testing.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@nvlitagaki

Copy link
Copy Markdown
Contributor Author

/ok to test b921d16

@nvlitagaki

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@github-actions

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
crates/api-core/src/handlers/finder.rs (1)

515-579: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use carbide-test-support table-driven helpers instead of a manual for-loop.

machine_interface_address_is_static_bmc is a total function (segment_name, allocation_type, interface_type) → bool, which fits value_scenarios! / check_values per the repository's testing conventions rather than a hand-rolled for loop with assert_eq!.

As per coding guidelines, "Use the carbide-test-support table-driven testing helpers for functions mapping inputs to outputs or errors; use scenarios! for Result, value_scenarios! for total operations, and direct check helpers when macros obscure intent." Also, "Prefer table-driven tests; for Rust, use grouped carbide-test-support scenarios (scenarios! / value_scenarios!) or explicit cases (check_cases / check_values) to cover input variants."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/api-core/src/handlers/finder.rs` around lines 515 - 579, The test
static_bmc_classification_requires_bmc_interface_type currently uses a manual
loop and assertions for a total function. Replace the loop with the repository’s
carbide-test-support table-driven helper, using value_scenarios! with
check_values or the applicable direct helper, while preserving all existing
input combinations, expected booleans, and case labels.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@crates/api-core/src/handlers/finder.rs`:
- Around line 515-579: The test
static_bmc_classification_requires_bmc_interface_type currently uses a manual
loop and assertions for a total function. Replace the loop with the repository’s
carbide-test-support table-driven helper, using value_scenarios! with
check_values or the applicable direct helper, while preserving all existing
input combinations, expected booleans, and case labels.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 03620869-a42a-4bd4-9143-b618bba7a0de

📥 Commits

Reviewing files that changed from the base of the PR and between 1d2f5e5 and b921d16.

📒 Files selected for processing (3)
  • crates/api-core/src/handlers/finder.rs
  • crates/api-core/src/tests/finder.rs
  • crates/api-db/src/machine_interface_address.rs

@nvlitagaki
nvlitagaki force-pushed the fix/find-switch-ip branch from 5382697 to 549ea90 Compare July 30, 2026 21:10
Signed-off-by: Leah Itagaki <litagaki@nvidia.com>
@nvlitagaki
nvlitagaki merged commit d7fbf6a into NVIDIA:main Jul 31, 2026
61 checks passed
polarweasel pushed a commit to polarweasel/infra-controller that referenced this pull request Jul 31, 2026
… IPs (NVIDIA#4395)

Previously our search IP address logic mistakenly categorized all
statically allocated machine interface addresses as static BMC IPs. Now
it looks to the interface type as well as the allocation type to
categorize the interface.

Additionally, if the response to an IP address search is associated with
a switch, the CLI now prints the switch.

## Related issues
Internal issue

## Type of Change
- [x] **Change** - Changes in existing functionality
- [x] **Fix** - Bug fixes

## Breaking Changes
- [ ] **This PR contains breaking changes**

## Testing
- [x] Unit tests added/updated
- [x] Manual testing performed

## Additional Notes

---------

Signed-off-by: Leah Itagaki <litagaki@nvidia.com>
Signed-off-by: Alex Ball <aball@nvidia.com>
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.

2 participants