Device Dto
OpenFrame Documentation
Get the most out of OpenFrame · Book 30 minutes with Conrad, 25 years in IT. He'll show you what Mingo and Fae can take off your list.
OpenFrame Documentation
Device Dto is a small set of Java data-transfer objects used by the OpenFrame test service when it deserializes device-oriented API and GraphQL responses. It is supplied by the com.openframe.oss:openframe-test-service-core library and runs in this repository's OpenFrame test service. The types provide a tolerant test-side view of device categories, installed agents, tool connectivity, tags, and filter facets rather than a persistence model or API implementation.
The module has three responsibilities:
All object DTOs use Lombok to generate accessors, constructors, equality, and builders. Their JsonIgnoreProperties(ignoreUnknown = true) annotation lets an older test client deserialize a response that contains fields it does not yet model. The two enumerations deliberately constrain values that tests can assert: connection state and device category.
This module does not make requests, select GraphQL fields, persist data, or determine connectivity. Those concerns belong to the test runner and API-facing test code. It only describes their deserialized payloads.
flowchart LR
Api["OpenFrame API or GraphQL response"] --> Json["Jackson deserialization"]
Json --> DeviceDto["Device Dto"]
DeviceDto --> TestCode["Integration-test assertions"]
DeviceDto --> DeviceView["DeviceWithConnections"]
DeviceView --> ToolConnection["ToolConnection records"]
ToolConnection --> ConnectionState["ConnectionStatus"]
DeviceDto --> Filters["Device and tag filter options"]
DeviceDto --> Inventory["InstalledAgent and Tag"]
DeviceWithConnections is the aggregation point for tool connectivity: it contains a list of ToolConnection records. Each record has identifiers, tool metadata, lifecycle timestamps, and a ConnectionStatus. ToolConnection is defined in the same library package, although it is outside this module's supplied core component list.
| Component | Role | Key data |
|---|---|---|
| ConnectionStatus | Connectivity-state enumeration for a tool connection. | CONNECTED, DISCONNECTED, ERROR |
| DeviceType | Device-category enumeration. | Desktop, laptop, server, mobile device, tablet, network device, IoT device, virtual machine, container host, other |
| DeviceWithConnections | Device response projection focused on integrated-tool connections. | toolConnections |
| InstalledAgent | Installed agent inventory record. | Agent and machine IDs, type, version, creation and update timestamps |
| Tag | Structured device tag returned by the API. | ID, key, values, description, color, creation timestamp |
| DeviceFilterOption | Displayable device-filter facet. | Value, label, count |
| TagFilterOption | Tag-filter facet. | Key, value, count |
classDiagram
class DeviceWithConnections {
List toolConnections
}
class ToolConnection {
String id
String machineId
String toolType
ConnectionStatus status
String connectedAt
String disconnectedAt
}
class ConnectionStatus {
CONNECTED
DISCONNECTED
ERROR
}
class InstalledAgent {
String id
String machineId
String agentType
String version
}
class Tag {
String id
String key
List values
String color
}
class DeviceFilterOption {
String value
String label
Integer count
}
class TagFilterOption {
String key
String value
Integer count
}
DeviceWithConnections "1" --> "many" ToolConnection
ToolConnection --> ConnectionStatus
DeviceWithConnections intentionally carries only toolConnections; it should not be treated as a full device record. A ToolConnection links a machine to a tool through machineId, toolType, and agentToolId, records connection timestamps, and exposes a status from ConnectionStatus.
The ToolConnection.vulnerabilitiesUpdatedAt field is present in the DTO but is not currently selected by the device query. The library's source notes that selecting it against tenant APIs that predate the corresponding schema field causes GraphQL validation to reject the entire query. Keep this field unasserted unless the relevant tenant API schema is known to support it.
InstalledAgent identifies the installed agent and its owning machine, then exposes its agent type, version, and lifecycle timestamps. It is appropriate for assertions about registration or agent-version visibility, but it does not encode installation state transitions.
Tag models a tag as a key plus a list of values, not as one flattened name. This distinction is important when constructing test expectations: a tag can associate one key with multiple values. DeviceFilterOption supplies a selectable value, human-facing label, and count; TagFilterOption instead preserves the tag key and value separately. Counts are nullable Integer values, so test code should only assert a count when the queried response is expected to provide one.
sequenceDiagram
participant Test as "Integration Test"
participant Api as "Device API"
participant Jackson as "Jackson"
participant Dto as "Device Dto"
Test->>Api: Query device, tags, or filters
Api->>Jackson: Return JSON response
Jackson->>Dto: Deserialize known fields
Note over Jackson,Dto: Unknown response fields are ignored
Dto->>Test: Provide typed data for assertions