DPS Nautobot Integration - Current Use Cases#
Overview#
This document describes the Nautobot import flow as it exists today. It is written for developers and architects working against the import API.
If you are performing an import rather than building against it, refer to Importing External Inventory.
Current implementation spans:
Web UI import wizard
CLI commands for generate/status/cancel/delete
gRPC/HTTP API surfaces used by the UI and clients
It does not currently include saved default queries or import-specific RBAC.
Current API Surface#
The current Nautobot import flow relies on these operations:
GenerateEntities: starts an async fetch and returns arequest_idGetGenerateEntitiesStatus: streams generatedEntitymessages for arequest_idCancelGenerateEntitiesRequest: cancels a pending or running requestDeleteGenerateEntitiesRequest: deletes a terminal request and its staged resultsUpsertEntities: imports selected entities into the main DPS entity store
Interface Scope#
The interfaces do not all expose the same workflow:
Web UI: fetch, review, select, optional edit, and import
CLI: generate, status, cancel, and delete primitives
API: the same low-level primitives used by clients
The guided review-and-import experience is currently a Web UI workflow, not a single dedicated first-class CLI or API workflow but can be accomplished in multiple manual steps.
Filter Semantics#
Nautobot filter handling in the current implementation works as follows:
Structured filters are
locations,racks,device_types, andrequest_stringHuman-friendly values such as location names, rack names, and device type models may be resolved to Nautobot UUIDs before the device query runs
Rack-name lookup is location-scoped when locations are available
UUID values are passed through without lookup
Some parameters in
request_stringare reserved for structured handling, while other parameters are passed through to the Nautobot devices endpoint
Persistence and Cleanup#
Fetched entities are staged before final import:
Async generate requests and fetched entities are stored in the
generate_entities_*tablesThis staging data is separate from the main DPS entity store
GetGenerateEntitiesStatusreads from staged request state and staged entitiesUpsertEntitieswrites selected entities into the main DPS entity storeDeleteGenerateEntitiesRequestremoves staged request data; it does not remove already imported entities
Capability 1: Nautobot-to-DPS Entity Fetch and Import#
Use Case 1.1: Operator Queries Nautobot for Candidate Entities#
Actor: Operator (via Web UI, CLI, or API)
Precondition: DPS is configured with Nautobot access.
Flow:
Operator submits Nautobot filters:
locations,racks,device_types, and/orrequest_string.DPS validates the request.
DPS creates an async
GenerateEntitiesrequest and returns arequest_id.DPS resolves human-friendly filter values to Nautobot UUIDs where needed.
DPS queries Nautobot and stores generated entities in the
generate_entities_*staging tables.Client retrieves the generated entities by calling
GetGenerateEntitiesStatus(request_id), which streamsEntitymessages until completion.Web UI displays the fetched entities for review.
Postcondition: Candidate entities exist in the generate-entities staging tables and are available for review. They are not yet imported into the main DPS entity store.
Current validation rules:
At least one filter is required
Location-only is rejected unless the query string provides an allowed identifier such as
rack=UUIDDevice-type-only is rejected
Rack names require a location filter; rack UUIDs do not
Query-string-only requests are allowed only for specific identifier-style filters
Error paths:
Invalid filters -> validation error
Nautobot unreachable or query failure -> request reaches terminal error state
Missing request ID -> invalid argument
Zero results -> successful request with no streamed entities
Concurrency note: The current implementation does not prevent multiple in-flight GenerateEntities requests per user or session. Each request gets its own request_id. The Web UI tracks a single lastRequestId and cleans up before re-fetch; CLI and API callers are responsible for managing their own request lifecycle.
Use Case 1.2: Operator Reviews and Selects Entities for Import#
Actor: Operator (primarily via Web UI)
Precondition: Candidate entities were fetched via UC 1.1.
Flow:
Operator reviews the fetched entities.
Operator selects which entities to keep in the working set.
Operator optionally edits entities during the review step.
Operator confirms import.
UI uploads the selected entities through the existing
UpsertEntitiespath.
Postcondition: Selected entities are upserted into DPS. They are no longer only staged import results; they are part of the DPS entity inventory and can be used to build a topology afterward.
Notes:
The current repo does not have a dedicated
ImportEntities(selectedEntityIDs)RPC.Selection and review are currently a Web UI workflow, not a first-class CLI workflow.
“Optionally edits entities” refers to UI-level field adjustments before upsert; the specific editable fields and their validation are governed by the
UpsertEntitiesschema, not this import flow.Re-importing the same entities is handled by
UpsertEntitiessemantics (create-or-update); there is no special duplicate detection or merge logic in the import path.
Use Case 1.3: Operator Cancels or Clears a Pending Fetch#
Actor: Operator (via Web UI, CLI, or API)
Precondition: A generate-entities request exists.
Flow:
Operator chooses to cancel a request.
DPS calls
CancelGenerateEntitiesRequest(request_id).If the request is pending or running, DPS cancels the stored context.
DPS marks the request status as
cancelled.If the operator also wants staged results removed, client calls
DeleteGenerateEntitiesRequest(request_id)after the request is terminal.
Postcondition:
After cancel: request is terminal and no more work should continue
After delete: request row and staged entities are removed from the staging tables
Important distinction:
CancelGenerateEntitiesRequestdoes not itself delete the staging rowDeleteGenerateEntitiesRequestis a separate operationIn the current Web UI, “Remove All” performs cancel first and then attempts delete
Use Case 1.4: Operator Re-fetches with New Filters#
Actor: Operator
Precondition: A previous request may still exist.
Flow in the current Web UI:
Operator changes filters and clicks Fetch again.
UI attempts to cancel the previous request.
UI then attempts to delete the previous request and its staged entities.
UI clears the local working set.
UI starts a new
GenerateEntitiesrequest.
Postcondition: The UI presents only the newly fetched candidate entities.
Scope note: Automatic cleanup on re-fetch is currently a Web UI behavior. CLI and direct API clients manage request lifecycle explicitly.
Architecture and Sequences#
UC 1.1 - Query Nautobot for Candidate Entities#
Operator
|
+-----------+-----------+
| | |
Web UI CLI API
| | |
+-----------+-----------+
|
v
+------------------+
| DPS Gateway |
| (gRPC / REST) |
+------------------+
|
1. Validate filters
2. GenerateEntities RPC
|
v
+------------------+
| Topology Manager |
+------------------+
|
3. Resolve names -> UUIDs
4. Query Nautobot API
|
v
+------------------+
| Nautobot Client |
+------------------+
|
v
+------------------+
| Nautobot Instance|
| (REST API) |
+------------------+
|
5. Store staged entities
|
v
+------------------+
| Staging DB |
| (generate_entities_*) |
+------------------+
|
6. GetGenerateEntitiesStatus
7. Stream Entity messages
Sequence:
UC 1.2 - Review and Import Selected Entities#
Expanded sequence:
UC 1.3 - Cancel and Optional Delete#
UC 1.4 - Re-fetch with New Filters#
UC 2.1 - Auto-Import with Continuous Sync#
Request State Diagram#
The async generate-entities request lifecycle is:
Notes:
GenerateEntitiescreates the request inpendingWorker execution moves it to
runningSuccessful generation moves it to
completeBackend failures move it to
errorCancelGenerateEntitiesRequestmoves a request tocancelledDeleteGenerateEntitiesRequestremoves terminal requests from storage; it is not itself a request stateIn the current implementation, delete is rejected for
pendingorrunningrequests