feat(rest-api): Add DPU machine retrieval endpoint#2539
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughA new DPU-machine retrieval endpoint returns DPU machines attached to a host machine through Temporal. The change also adds the corresponding API models, SDK clients, OpenAPI definitions, CLI command, and site-agent workflow/activity registration. ChangesDPU Machines Endpoint
Sequence DiagramsequenceDiagram
participant Client
participant GetAllDpuMachineHandler
participant Database
participant TemporalClient
Client->>GetAllDpuMachineHandler: GET /v2/org/{org}/nico/machine/{id}/dpu
GetAllDpuMachineHandler->>Database: Load Machine + Site relation
GetAllDpuMachineHandler->>Database: Query MachineInterfaces for AttachedDPUMachineIDs
alt No DPU IDs
GetAllDpuMachineHandler-->>Client: 200 empty array
else DPU IDs present
GetAllDpuMachineHandler->>TemporalClient: ExecuteWorkflow GetDpuMachines(dpuIDs)
alt Workflow success
TemporalClient-->>GetAllDpuMachineHandler: []DpuMachine protos
GetAllDpuMachineHandler-->>Client: 200 []APIDpuMachine JSON
else Workflow timeout
TemporalClient-->>GetAllDpuMachineHandler: TimeoutError
GetAllDpuMachineHandler->>TemporalClient: TerminateWorkflow
GetAllDpuMachineHandler-->>Client: timeout error
else Workflow error
TemporalClient-->>GetAllDpuMachineHandler: WorkflowError
GetAllDpuMachineHandler-->>Client: API error response
end
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
/ok to test 0085855 |
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
🌿 Preview your docs: https://nvidia-preview-pull-request-2539.docs.buildwithfern.com/infra-controller |
There was a problem hiding this comment.
Actionable comments posted: 7
🧹 Nitpick comments (2)
rest-api/api/pkg/api/routes_test.go (1)
36-58: 📐 Maintainability & Code Quality | ⚡ Quick winAssert the new DPU route explicitly, not just the bucket count.
Incrementing
"machine"to6only proves that one more machine-scoped route exists. It will not catch a wrong method or path for/machine/:id/dpu, which is now part of the SDK/OpenAPI contract. Add a directassertRouteExistsfor the new GET route.♻️ Suggested assertion
+ expectedMachineDpuPath := "/org/:orgName/" + cfg.GetAPIName() + "/machine/:id/dpu" + assertRouteExists(t, got, http.MethodGet, expectedMachineDpuPath)🤖 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 `@rest-api/api/pkg/api/routes_test.go` around lines 36 - 58, The test currently only increments the "machine" bucket in routeCount which won't verify the exact new GET /machine/:id/dpu endpoint; update routes_test.go to add an explicit assertion using the test helper (e.g., call assertRouteExists or the existing route assertion function) to verify a GET route for the path "/machine/:id/dpu" (or its test-path equivalent) is registered and uses the correct method, in addition to leaving the "machine" count change; locate the assertion helpers and the routeCount map to insert the new assertRouteExists("GET", "/machine/:id/dpu") call so the SDK/OpenAPI contract is verified directly.rest-api/api/pkg/api/handler/machine_test.go (1)
3441-3447: 📐 Maintainability & Code Quality | ⚡ Quick winSplit this negative-path case so each subtest targets one privilege predicate.
This fixture currently omits both targeted-creation capability and provider tenant-account linkage, so the 403 can come from multiple preconditions. Please split into two focused subtests (one missing capability, one missing account) to keep failure-branch intent deterministic.
Based on learnings, failure-path tests should isolate exactly one validation branch per subtest.
🤖 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 `@rest-api/api/pkg/api/handler/machine_test.go` around lines 3441 - 3447, The test case "non-privileged tenant is rejected (requirePrivilegedTenant=true)" bundles two failure reasons; split it into two focused subtests: one named e.g. "rejected when missing creation capability (requirePrivilegedTenant=true)" that keeps reqOrgName: tnOrgRegular, user: tnuRegular, mID: mWithDpu.ID but sets scp to the value representing "missing capability" (instead of scpOK) and expectedStatus http.StatusForbidden; and a second named e.g. "rejected when not linked to provider account (requirePrivilegedTenant=true)" that keeps scp: scpOK but modifies the tenant/account linkage so the user’s org is not linked to the provider account (use the existing fixture that represents an unlinked tenant or adjust reqOrgName/user to the unlinked fixture) with expectedStatus http.StatusForbidden; ensure both subtests only trigger one validation branch each so failures are deterministic.Source: Learnings
🤖 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 `@rest-api/api/pkg/api/handler/machine_test.go`:
- Around line 3369-3375: The test sets up mock expectations on wrunTimeout and
tscTimeout (e.g., ExecuteWorkflow, TerminateWorkflow, wrunTimeout.Get/GetID) but
never verifies them; add assertions such as tscTimeout.AssertExpectations(t) and
wrunTimeout.AssertExpectations(t) (or specific AssertCalled/AssertNumberOfCalls
checks) after the test exercise so the ExecuteWorkflow and TerminateWorkflow
expectations and the wrunTimeout interactions are validated and regressions in
timeout cleanup are caught.
In `@rest-api/api/pkg/api/handler/machine.go`:
- Around line 2066-2071: The handler currently calls gmdh.scp.GetClientByID (the
site client lookup) before checking whether the machine has an
AttachedDPUMachineID, causing a 500 if the site client pool is unavailable even
though the DB can answer an empty result; update the handler in machine.go to
first check machine.AttachedDPUMachineID (or equivalent field) and immediately
return the empty response (e.g., []) when there's no attached DPU, only then
proceed to call gmdh.scp.GetClientByID; apply the same change to the other
occurrence that uses gmdh.scp.GetClientByID around the code referenced (lines
2092-2095) so the endpoint returns [] instead of a 500 when the site client is
unavailable but no DPU is attached.
- Around line 2098-2113: The current StartWorkflowOptions uses a fixed
WorkflowID ("dpu-machines-get-"+mID) which can cause Temporal to reuse an
existing run and return stale inputs; update the workflowOptions (where
StartWorkflowOptions is constructed for ExecuteWorkflow/GetDpuMachines with
dpuMachineIDs) to either omit WorkflowID so Temporal auto-generates a unique ID
or generate a request-scoped unique ID (e.g., append a UUID/timestamp) and/or
set WorkflowIDReusePolicy/WorkflowIDConflictPolicy to fail on conflict so each
request creates its own run; change the construction of workflowOptions before
calling stc.ExecuteWorkflow("GetDpuMachines", ...) accordingly.
In `@rest-api/api/pkg/api/model/dpumachine.go`:
- Around line 354-367: FromResponseProto currently appends an APIDpuMachine even
when APIDpuMachine.FromProto no-ops (producing a zero-value), which leaks empty
entries; update the loop in FromResponseProto to skip appending when
protoDpuMachine is nil or when the converted apiDpuMachine is empty/invalid —
for example, after calling apiDpuMachine.FromProto(protoDpuMachine, ctx) check a
definitive field (e.g., apiDpuMachine.Machine != nil or implement an
IsZero/IsValid method on APIDpuMachine) and only append to *apds when that check
passes, preserving existing symbols FromResponseProto, APIDpuMachines,
APIDpuMachine.FromProto and protoDpuMachine.
In `@rest-api/api/pkg/api/model/machine.go`:
- Around line 555-557: APIMachineHealth.FromProto and
APIMachineHealthProbeAlert.FromProto currently call ObservedAt.AsTime() and
InAlertSince.AsTime() unconditionally, which yields the 1970-01-01 epoch when
the protobuf Timestamp is nil; update both methods to check for nil (or the
Timestamp.IsValid/Has) before calling AsTime().Format(time.RFC3339) and only set
mh.ObservedAt, mh.ObservedAtDeprecated, and the probe's InAlertSince pointer
fields when the proto timestamp is present, leaving the *string fields nil when
absent to avoid emitting epoch strings.
In `@rest-api/openapi/spec.yaml`:
- Around line 9148-9152: The example response in the OpenAPI spec uses the same
value for the DPU Machine identifier and its host machine ("id" and
"hostMachineId"), which are distinct entities; update the example under the
relevant schema so "id" and "hostMachineId" use different unique values (e.g.,
different UUID-like strings) while keeping "infrastructureProviderId" and
"siteId" unchanged to clearly convey the DPU vs host relationship.
In `@rest-api/sdk/standard/model_dpu_machine.go`:
- Around line 533-572: The UnmarshalJSON currently only verifies keys exist in
allProperties but doesn't reject JSON nulls; update the requiredProperties check
in DpuMachine.UnmarshalJSON to also fail when the value is nil (e.g., after err
= json.Unmarshal into allProperties, loop: for _, requiredProperty := range
requiredProperties { val, exists := allProperties[requiredProperty]; if !exists
|| val == nil { return fmt.Errorf("no value given for required property %v",
requiredProperty) } } ), ensuring null values are rejected before decoding into
varDpuMachine and using decoder.DisallowUnknownFields().
---
Nitpick comments:
In `@rest-api/api/pkg/api/handler/machine_test.go`:
- Around line 3441-3447: The test case "non-privileged tenant is rejected
(requirePrivilegedTenant=true)" bundles two failure reasons; split it into two
focused subtests: one named e.g. "rejected when missing creation capability
(requirePrivilegedTenant=true)" that keeps reqOrgName: tnOrgRegular, user:
tnuRegular, mID: mWithDpu.ID but sets scp to the value representing "missing
capability" (instead of scpOK) and expectedStatus http.StatusForbidden; and a
second named e.g. "rejected when not linked to provider account
(requirePrivilegedTenant=true)" that keeps scp: scpOK but modifies the
tenant/account linkage so the user’s org is not linked to the provider account
(use the existing fixture that represents an unlinked tenant or adjust
reqOrgName/user to the unlinked fixture) with expectedStatus
http.StatusForbidden; ensure both subtests only trigger one validation branch
each so failures are deterministic.
In `@rest-api/api/pkg/api/routes_test.go`:
- Around line 36-58: The test currently only increments the "machine" bucket in
routeCount which won't verify the exact new GET /machine/:id/dpu endpoint;
update routes_test.go to add an explicit assertion using the test helper (e.g.,
call assertRouteExists or the existing route assertion function) to verify a GET
route for the path "/machine/:id/dpu" (or its test-path equivalent) is
registered and uses the correct method, in addition to leaving the "machine"
count change; locate the assertion helpers and the routeCount map to insert the
new assertRouteExists("GET", "/machine/:id/dpu") call so the SDK/OpenAPI
contract is verified directly.
🪄 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: cb93aa76-dd45-485b-a7ac-056f19a88ca1
📒 Files selected for processing (25)
rest-api/api/pkg/api/handler/machine.gorest-api/api/pkg/api/handler/machine_test.gorest-api/api/pkg/api/model/dpumachine.gorest-api/api/pkg/api/model/dpumachine_test.gorest-api/api/pkg/api/model/machine.gorest-api/api/pkg/api/routes.gorest-api/api/pkg/api/routes_test.gorest-api/cli/tui/commands.gorest-api/cli/tui/repl.gorest-api/docs/index.htmlrest-api/openapi/spec.yamlrest-api/sdk/simple/client.gorest-api/sdk/simple/machine.gorest-api/sdk/standard/api_expected_rack.gorest-api/sdk/standard/api_machine.gorest-api/sdk/standard/model_dpu_interface_config.gorest-api/sdk/standard/model_dpu_machine.gorest-api/sdk/standard/model_dpu_machine_interface.gorest-api/sdk/standard/model_dpu_machine_software_component.gorest-api/sdk/standard/model_dpu_network_config.gorest-api/sdk/standard/model_interface_network_security_group_config.gorest-api/sdk/standard/model_managed_host_network_config.gorest-api/sdk/standard/model_managed_host_quarantine_state.gorest-api/sdk/standard/model_resolved_network_security_group_rule.gorest-api/site-agent/pkg/components/managers/machine/subscriber.go
🔐 TruffleHog Secret Scan✅ No secrets or credentials found! Your code has been scanned for 700+ types of secrets and credentials. All clear! 🎉 🕐 Last updated: 2026-06-12 21:55:38 UTC | Commit: 0085855 |
🔍 Container Scan Summary
Per-CVE detail lives in the per-service |
0085855 to
933e461
Compare
|
/ok to test 933e461 |
22d60b5 to
c8ee61c
Compare
|
/ok to test c8ee61c |
c8ee61c to
0894dcd
Compare
thossain-nv
left a comment
There was a problem hiding this comment.
Overall looks great @parmani-nv, added a few notes.
| @@ -0,0 +1,573 @@ | |||
| // checks if the {{classname}} type satisfies the MappedNullable interface at compile time | |||
There was a problem hiding this comment.
@parmani-nv This seems very useful, can you please summarize the effect of using this template?
0894dcd to
5caa900
Compare
thossain-nv
left a comment
There was a problem hiding this comment.
Thanks for porting this @parmani-nv Left some final suggestions.
3d7d78f to
bd5f067
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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 `@rest-api/api/pkg/api/handler/machine.go`:
- Around line 2035-2043: Move the SiteStatusRegistered check in machine handler
flow so it runs only after authorization and association validation. In the
relevant machine endpoint logic around the IsProviderOrTenant and
site-association checks, return the 403 for unauthorized callers first, and only
then enforce the registered-site precondition for authorized requests. Apply the
same ordering consistently in the related duplicated path mentioned in the
review so the handler behavior remains aligned.
- Around line 2081-2085: The DPU ID collection in machine.go should de-duplicate
repeated AttachedDPUMachineID values before the workflow is invoked, since
multiple interfaces can point to the same DPU and create duplicate DpuMachine
entries. Update the dpuMachineIDs gathering logic to track seen IDs while
iterating over machineInterfaces, and only append each non-empty ID once; keep
the fix localized around the loop that builds dpuMachineIDs and the subsequent
workflow call that consumes it.
🪄 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: b3a8551e-5a52-406c-82f2-ceff0e13a9f0
⛔ Files ignored due to path filters (80)
rest-api/flow/internal/nicoapi/gen/fmds.pb.gois excluded by!**/*.pb.go,!**/gen/**,!rest-api/**/*.pb.gorest-api/flow/internal/nicoapi/gen/fmds_grpc.pb.gois excluded by!**/*.pb.go,!**/gen/**,!rest-api/**/*.pb.go,!rest-api/**/*_grpc.pb.gorest-api/sdk/standard/api_expected_rack.gois excluded by!rest-api/sdk/standard/api_*.gorest-api/sdk/standard/api_machine.gois excluded by!rest-api/sdk/standard/api_*.gorest-api/sdk/standard/model_action_config.gois excluded by!rest-api/sdk/standard/model_*.gorest-api/sdk/standard/model_allocation_constraint_create_request.gois excluded by!rest-api/sdk/standard/model_*.gorest-api/sdk/standard/model_allocation_constraint_update_request.gois excluded by!rest-api/sdk/standard/model_*.gorest-api/sdk/standard/model_allocation_create_request.gois excluded by!rest-api/sdk/standard/model_*.gorest-api/sdk/standard/model_batch_bring_up_rack_request.gois excluded by!rest-api/sdk/standard/model_*.gorest-api/sdk/standard/model_batch_instance_create_request.gois excluded by!rest-api/sdk/standard/model_*.gorest-api/sdk/standard/model_batch_rack_firmware_update_request.gois excluded by!rest-api/sdk/standard/model_*.gorest-api/sdk/standard/model_batch_tray_firmware_update_request.gois excluded by!rest-api/sdk/standard/model_*.gorest-api/sdk/standard/model_batch_update_rack_power_state_request.gois excluded by!rest-api/sdk/standard/model_*.gorest-api/sdk/standard/model_batch_update_tray_power_state_request.gois excluded by!rest-api/sdk/standard/model_*.gorest-api/sdk/standard/model_bmc_credential.gois excluded by!rest-api/sdk/standard/model_*.gorest-api/sdk/standard/model_bmc_credential_request.gois excluded by!rest-api/sdk/standard/model_*.gorest-api/sdk/standard/model_bring_up_rack_request.gois excluded by!rest-api/sdk/standard/model_*.gorest-api/sdk/standard/model_cancel_task_request.gois excluded by!rest-api/sdk/standard/model_*.gorest-api/sdk/standard/model_create_rule_request.gois excluded by!rest-api/sdk/standard/model_*.gorest-api/sdk/standard/model_deletion_accepted_response.gois excluded by!rest-api/sdk/standard/model_*.gorest-api/sdk/standard/model_dpu_extension_service_create_request.gois excluded by!rest-api/sdk/standard/model_*.gorest-api/sdk/standard/model_dpu_extension_service_observability_logging.gois excluded by!rest-api/sdk/standard/model_*.gorest-api/sdk/standard/model_dpu_extension_service_observability_prometheus.gois excluded by!rest-api/sdk/standard/model_*.gorest-api/sdk/standard/model_dpu_interface_config.gois excluded by!rest-api/sdk/standard/model_*.gorest-api/sdk/standard/model_dpu_machine.gois excluded by!rest-api/sdk/standard/model_*.gorest-api/sdk/standard/model_dpu_machine_interface.gois excluded by!rest-api/sdk/standard/model_*.gorest-api/sdk/standard/model_dpu_machine_software_component.gois excluded by!rest-api/sdk/standard/model_*.gorest-api/sdk/standard/model_dpu_network_config.gois excluded by!rest-api/sdk/standard/model_*.gorest-api/sdk/standard/model_expected_machine_create_request.gois excluded by!rest-api/sdk/standard/model_*.gorest-api/sdk/standard/model_expected_power_shelf_create_request.gois excluded by!rest-api/sdk/standard/model_*.gorest-api/sdk/standard/model_expected_rack_create_request.gois excluded by!rest-api/sdk/standard/model_*.gorest-api/sdk/standard/model_expected_rack_list.gois excluded by!rest-api/sdk/standard/model_*.gorest-api/sdk/standard/model_expected_switch_create_request.gois excluded by!rest-api/sdk/standard/model_*.gorest-api/sdk/standard/model_firmware_update_request.gois excluded by!rest-api/sdk/standard/model_*.gorest-api/sdk/standard/model_infini_band_partition_create_request.gois excluded by!rest-api/sdk/standard/model_*.gorest-api/sdk/standard/model_infini_band_partition_update_request.gois excluded by!rest-api/sdk/standard/model_*.gorest-api/sdk/standard/model_instance_create_request.gois excluded by!rest-api/sdk/standard/model_*.gorest-api/sdk/standard/model_instance_type_create_request.gois excluded by!rest-api/sdk/standard/model_*.gorest-api/sdk/standard/model_interface_network_security_group_config.gois excluded by!rest-api/sdk/standard/model_*.gorest-api/sdk/standard/model_ip_block_create_request.gois excluded by!rest-api/sdk/standard/model_*.gorest-api/sdk/standard/model_machine.gois excluded by!rest-api/sdk/standard/model_*.gorest-api/sdk/standard/model_machine_health_issue.gois excluded by!rest-api/sdk/standard/model_*.gorest-api/sdk/standard/model_machine_instance_type_create_request.gois excluded by!rest-api/sdk/standard/model_*.gorest-api/sdk/standard/model_machine_online_repair.gois excluded by!rest-api/sdk/standard/model_*.gorest-api/sdk/standard/model_machine_online_repair_acknowledgments.gois excluded by!rest-api/sdk/standard/model_*.gorest-api/sdk/standard/model_machine_online_repair_policy.gois excluded by!rest-api/sdk/standard/model_*.gorest-api/sdk/standard/model_managed_host_network_config.gois excluded by!rest-api/sdk/standard/model_*.gorest-api/sdk/standard/model_managed_host_quarantine_state.gois excluded by!rest-api/sdk/standard/model_*.gorest-api/sdk/standard/model_network_security_group_create_request.gois excluded by!rest-api/sdk/standard/model_*.gorest-api/sdk/standard/model_network_security_group_rule.gois excluded by!rest-api/sdk/standard/model_*.gorest-api/sdk/standard/model_nv_link_logical_partition_create_request.gois excluded by!rest-api/sdk/standard/model_*.gorest-api/sdk/standard/model_operating_system_create_request.gois excluded by!rest-api/sdk/standard/model_*.gorest-api/sdk/standard/model_operation_rule.gois excluded by!rest-api/sdk/standard/model_*.gorest-api/sdk/standard/model_placement_in_rack.gois excluded by!rest-api/sdk/standard/model_*.gorest-api/sdk/standard/model_resolved_network_security_group_rule.gois excluded by!rest-api/sdk/standard/model_*.gorest-api/sdk/standard/model_retry_policy.gois excluded by!rest-api/sdk/standard/model_*.gorest-api/sdk/standard/model_rule_definition.gois excluded by!rest-api/sdk/standard/model_*.gorest-api/sdk/standard/model_sequence_step.gois excluded by!rest-api/sdk/standard/model_*.gorest-api/sdk/standard/model_site_create_request.gois excluded by!rest-api/sdk/standard/model_*.gorest-api/sdk/standard/model_ssh_key_create_request.gois excluded by!rest-api/sdk/standard/model_*.gorest-api/sdk/standard/model_ssh_key_group_create_request.gois excluded by!rest-api/sdk/standard/model_*.gorest-api/sdk/standard/model_ssh_key_group_update_request.gois excluded by!rest-api/sdk/standard/model_*.gorest-api/sdk/standard/model_subnet_create_request.gois excluded by!rest-api/sdk/standard/model_*.gorest-api/sdk/standard/model_subnet_update_request.gois excluded by!rest-api/sdk/standard/model_*.gorest-api/sdk/standard/model_task_report_v1.gois excluded by!rest-api/sdk/standard/model_*.gorest-api/sdk/standard/model_task_report_v1_stage.gois excluded by!rest-api/sdk/standard/model_*.gorest-api/sdk/standard/model_task_report_v1_step.gois excluded by!rest-api/sdk/standard/model_*.gorest-api/sdk/standard/model_tenant_account_create_request.gois excluded by!rest-api/sdk/standard/model_*.gorest-api/sdk/standard/model_tenant_identity_basic_client_secret_request.gois excluded by!rest-api/sdk/standard/model_*.gorest-api/sdk/standard/model_tenant_identity_config_create_or_update_request_with_key_rotation.gois excluded by!rest-api/sdk/standard/model_*.gorest-api/sdk/standard/model_tenant_identity_config_create_or_update_request_without_key_rotation.gois excluded by!rest-api/sdk/standard/model_*.gorest-api/sdk/standard/model_tenant_identity_jwks.gois excluded by!rest-api/sdk/standard/model_*.gorest-api/sdk/standard/model_tenant_identity_signing_key.gois excluded by!rest-api/sdk/standard/model_*.gorest-api/sdk/standard/model_tenant_identity_token_delegation_create_or_update_request.gois excluded by!rest-api/sdk/standard/model_*.gorest-api/sdk/standard/model_update_power_state_request.gois excluded by!rest-api/sdk/standard/model_*.gorest-api/sdk/standard/model_update_rule_request.gois excluded by!rest-api/sdk/standard/model_*.gorest-api/sdk/standard/model_vpc_create_request.gois excluded by!rest-api/sdk/standard/model_*.gorest-api/sdk/standard/model_vpc_peering_create_request.gois excluded by!rest-api/sdk/standard/model_*.gorest-api/sdk/standard/model_vpc_prefix_create_request.gois excluded by!rest-api/sdk/standard/model_*.gorest-api/sdk/standard/model_vpc_prefix_update_request.gois excluded by!rest-api/sdk/standard/model_*.go
📒 Files selected for processing (17)
rest-api/Makefilerest-api/api/pkg/api/handler/machine.gorest-api/api/pkg/api/handler/machine_test.gorest-api/api/pkg/api/model/dpumachine.gorest-api/api/pkg/api/model/dpumachine_test.gorest-api/api/pkg/api/model/machine.gorest-api/api/pkg/api/routes.gorest-api/api/pkg/api/routes_test.gorest-api/cli/tui/commands.gorest-api/cli/tui/repl.gorest-api/docs/index.htmlrest-api/flow/internal/nicoapi/nicoproto/fmds.protorest-api/openapi/spec.yamlrest-api/openapi/templates/go/model_simple.mustacherest-api/sdk/simple/client.gorest-api/sdk/simple/machine.gorest-api/site-agent/pkg/components/managers/machine/subscriber.go
✅ Files skipped from review due to trivial changes (3)
- rest-api/flow/internal/nicoapi/nicoproto/fmds.proto
- rest-api/cli/tui/repl.go
- rest-api/api/pkg/api/routes_test.go
🚧 Files skipped from review as they are similar to previous changes (7)
- rest-api/api/pkg/api/routes.go
- rest-api/site-agent/pkg/components/managers/machine/subscriber.go
- rest-api/sdk/simple/machine.go
- rest-api/cli/tui/commands.go
- rest-api/sdk/simple/client.go
- rest-api/api/pkg/api/handler/machine_test.go
- rest-api/openapi/spec.yaml
The vendored Flow copy of fmds.proto and its generated code were stale: the source crates/rpc/proto/fmds.proto now carries the full Apache license header, while the committed Flow copy still had the short (duplicated) SPDX header. Regenerated via `make -C flow gen-nicoapi-pb` so the check-protobuf-generated CI gate passes. Signed-off-by: Parham Armani <parmani@nvidia.com> test(rest-api): assert Temporal mock expectations in GetDpuMachines test Add AssertExpectations for the success, error, and timeout Temporal mocks so the timeout path's TerminateWorkflow cleanup is verified instead of passing silently. Addresses a CodeRabbit review comment. Signed-off-by: Parham Armani <parmani@nvidia.com>
5526a38 to
739f510
Compare
| // LoopbackIP is the loopback IP address | ||
| LoopbackIP string `json:"loopbackIp"` | ||
| // QuarantineState is the quarantine state for the managed host | ||
| QuarantineState *APIManagedHostQuarantineState `json:"quarantineState,omitempty"` |
There was a problem hiding this comment.
Let's remove omitempty
| // Mode is the quarantine mode | ||
| Mode string `json:"mode"` | ||
| // Reason is the reason for quarantine | ||
| Reason *string `json:"reason,omitempty"` |
There was a problem hiding this comment.
Let's remove omitempty
##Description
Adds a read endpoint to retrieve the DPU machines attached to a host Machine,
exposing DPU metadata REST API instead of only the internal gRPC/admin surface.
Related issues
#2176
Type of Change
What's included:
GET /v2/org/{org}/nico/machine/{machineId}/dpureturning DPUsattached to the host, backed by a synchronous Temporal
GetDpuMachinesworkflow scoped to the Machine's Site (
api/pkg/api/handler/machine.go,routes.go).DpuMachineAPI models + conversions (api/pkg/api/model/dpumachine.go,machine.go), OpenAPI spec + docs, and generated SDKs (standard + simple)and CLI TUI command.
GetDpuMachinesworkflow andGetDpuMachinesByIDsactivity (
site-agent/.../machine/subscriber.go).Breaking Changes
Testing
machine_test.go,dpumachine_test.go,routes_test.go)