Add an OPM Device Using the API

Overview

You can add devices either through the UI or by using the API. This topic explains how to add an OPM device using a GraphQL mutation.

This procedure assumes basic familiarity with GraphQL. For general GraphQL concepts, see the GraphQL documentation.

Prerequisites

Verify that you have the following:

  • Access to the TOS GraphQL endpoint
  • Required permissions to add devices using the API
  • The relevant OPM device connector installed and registered in TOS
  • Device connection details, including IP address and credentials
  • A GraphQL client or tool to send mutation requests

Steps

  1. Define the fixed GraphQL mutation that creates the device, which references an input object supplied separately as variables, and do not modify its structure.

    mutation AddDevice($input: CreateSystemInput!) {
      system {
        createSystem(input: $input) {
          id
          resultStatus {
            successful
            errors {
              errorMessage
            }
          }
        }
      }
    }
  2. Create the variables JSON that includes your device-specific values. Replace the placeholders with values appropriate for your vendor and environment.

    {
      "input": {
        "opmAgentId": "<opm_agent_name>",
        "name": "<device_display_name>",
        "ipAddress": "<device_ip_address>",
        "model": "UNKNOWN",
        "modelDisplayName": "<device_type_display_name>",
        "vendor": "UNKNOWN",
        "properties": [
          {
            "field": {
              "name": "username",
              "mandatory": true,
              "fieldType": "STRING"
            },
            "value": "<device_username>"
          },
          {
            "field": {
              "name": "password",
              "mandatory": true,
              "fieldType": "SECRET"
            },
            "value": "<device_password>"
          },
          {
            "field": {
              "name": "VENDOR_DISPLAY_NAME",
              "mandatory": false,
              "fieldType": "STRING"
            },
            "value": "<vendor_display_name>"
          }
        ]
      }
    }

    For example:

    • opmAgentId: aruba-switch-agent

    • name: HQ-Switch-01

    • ipAddress: 10.0.5.12

    • modelDisplayName: CX Switch

  3. Send the mutation by submitting the query and variables together using your GraphQL client or tool.

  4. Confirm that the device was created successfully by verifying:

    • The resultStatus.successful field is set to true
    • No error messages appear in the errors list
    • The device appears in the Devices list in SecureTrack

Related topics

Notes

GraphQL mutations can also be sent as a single JSON payload that includes the query and variables together. This format is supported by some GraphQL clients but is not shown here as the primary pattern.