Skip to content

chore: add nvswitch nvos info switch detail page#3417

Open
rtamma-nv wants to merge 2 commits into
NVIDIA:mainfrom
rtamma-nv:chore/switch-info
Open

chore: add nvswitch nvos info switch detail page#3417
rtamma-nv wants to merge 2 commits into
NVIDIA:mainfrom
rtamma-nv:chore/switch-info

Conversation

@rtamma-nv

Copy link
Copy Markdown
Contributor

Add NVOS info (IP, MAC, port) to the Interfaces section of switch detail page

Related issues

Type of Change

  • Add - New feature or capability
  • Change - Changes in existing functionality
  • Fix - Bug fixes
  • Remove - Removed features or deprecated functionality
  • Internal - Internal changes (refactoring, tests, docs, etc.)

Breaking Changes

  • This PR contains breaking changes

Testing

  • Unit tests added/updated
  • Integration tests added/updated
  • [ X] Manual testing performed
  • No testing required (docs, internal refactor, etc.)

Additional Notes

Signed-off-by: Roopesh Tamma <rtamma@nvidia.com>
@rtamma-nv rtamma-nv requested a review from a team as a code owner July 13, 2026 05:04
@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Summary by CodeRabbit

  • New Features
    • Added an Interfaces details table to switch detail pages.
    • Displays optional NVOS connection information, including IP address and MAC address.
    • NVOS details are conditionally shown only when available (port remains unset when not provided).

Walkthrough

Switch lookup paths now preserve NVOS IP and MAC values independently, including partial data, while leaving port unset. The switch detail model forwards optional NVOS information, and the Interfaces section conditionally renders available IP and MAC fields.

Changes

Switch NVOS details

Layer / File(s) Summary
NVOS data resolution and validation
crates/api-core/src/handlers/switch.rs, crates/api-core/src/tests/switch_find.rs
Shared NVOS conversion logic now supports IP-only or MAC-only endpoint data, returns no information when both are absent, and keeps port unset. Unit and API tests cover these cases.
NVOS data and rendering
crates/api-web/src/switch.rs, crates/api-web/templates/switch_detail.html
SwitchDetail forwards optional NVOS information, and the Interfaces table conditionally renders available IP and MAC fields.

Estimated code review effort: 2 (Simple) | ~15 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately reflects the main change: adding NVOS info to the switch detail page.
Description check ✅ Passed The description is directly related to the implemented change and matches the switch detail NVOS info update.
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.

@rtamma-nv rtamma-nv requested a review from tmcroberts97 July 13, 2026 05:05

@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.

Actionable comments posted: 1

🤖 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.

Inline comments:
In `@crates/api-web/templates/switch_detail.html`:
- Around line 121-142: The upstream switch detail mapping in the SwitchNvosInfo
creation flow must honor the template’s optional-field contract: preserve IP and
MAC independently when available and populate port from the source data instead
of always setting it to None. Update the relevant mapping in the switch handler
while keeping the existing nvos_info rendering structure unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 77f6b4ea-2c72-4519-b2b3-a55895a43b6c

📥 Commits

Reviewing files that changed from the base of the PR and between 767219e and a8cfffa.

📒 Files selected for processing (2)
  • crates/api-web/src/switch.rs
  • crates/api-web/templates/switch_detail.html

Comment on lines +121 to +142
<table class="detailsview">
{% if let Some(nvos_info) = nvos_info %}
{% if let Some(ip) = nvos_info.ip %}
<tr>
<th>NVOS IP</th>
<td>{{ ip }}</td>
</tr>
{% endif %}
{% if let Some(mac) = nvos_info.mac %}
<tr>
<th>NVOS MAC</th>
<td>{{ mac }}</td>
</tr>
{% endif %}
{% if let Some(port) = nvos_info.port %}
<tr>
<th>NVOS Port</th>
<td>{{ port }}</td>
</tr>
{% endif %}
{% endif %}
</table>

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.

🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

Align the producer with the optional-field rendering contract.

In the supplied crates/api-core/src/handlers/switch.rs flow, SwitchNvosInfo is created only when both IP and MAC are present, and port is always set to None. Consequently, this template cannot render a standalone available IP/MAC value, and the NVOS Port row at Line [135] through Line [140] is unreachable. Update the upstream mapping to preserve independently available fields and populate the port, or adjust the feature scope.

🤖 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-web/templates/switch_detail.html` around lines 121 - 142, The
upstream switch detail mapping in the SwitchNvosInfo creation flow must honor
the template’s optional-field contract: preserve IP and MAC independently when
available and populate port from the source data instead of always setting it to
None. Update the relevant mapping in the switch handler while keeping the
existing nvos_info rendering structure unchanged.

Source: Path instructions

@github-actions

github-actions Bot commented Jul 13, 2026

Copy link
Copy Markdown

🔍 Container Scan Summary

Service Total Critical High Medium Low Other
boot-artifacts-aarch64 3 0 0 3 0 0
boot-artifacts-x86_64 3 0 0 3 0 0
forge-admin-cli-x86_64 255 13 30 79 7 126
machine-validation-runner 803 40 237 296 36 194
machine_validation 803 40 237 296 36 194
machine_validation-aarch64 803 40 237 296 36 194
TOTAL 2670 133 741 973 115 708

Per-CVE detail lives in the per-service grype-* artifacts (JSON + SARIF). Severity counts only — no CVE IDs published here.

Signed-off-by: Roopesh Tamma <rtamma@nvidia.com>

@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/switch.rs (1)

555-606: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Prefer a table-driven helper test.

These Option-returning helper cases can be consolidated with value_scenarios! or check_values, keeping missing, partial, and port invariants together.

As per coding guidelines, tests for total operations should prefer table-driven value_scenarios! or check_values.

🤖 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/switch.rs` around lines 555 - 606, Consolidate
the three tests in switch_nvos_info_tests into one table-driven test using the
project’s value_scenarios! or check_values helper. Keep cases covering missing
values, IP-only, MAC-only, and both values, and assert the corresponding Option
fields plus the invariant that port remains unset.

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/switch.rs`:
- Around line 555-606: Consolidate the three tests in switch_nvos_info_tests
into one table-driven test using the project’s value_scenarios! or check_values
helper. Keep cases covering missing values, IP-only, MAC-only, and both values,
and assert the corresponding Option fields plus the invariant that port remains
unset.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 342bfaf3-814f-419d-b3b1-77c1d682b477

📥 Commits

Reviewing files that changed from the base of the PR and between a8cfffa and 996952e.

📒 Files selected for processing (3)
  • crates/api-core/src/handlers/switch.rs
  • crates/api-core/src/tests/switch_find.rs
  • crates/api-web/templates/switch_detail.html
💤 Files with no reviewable changes (1)
  • crates/api-web/templates/switch_detail.html

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