Skip to main content
CloudEnterprise

Getting Started with the Lightyear Integration for NetBox

This guide will help you set up and start using the Lightyear Integration for NetBox.


Prerequisites

Before you begin, ensure you have the following:

  • NetBox Cloud or NetBox Enterprise with NetBox Assurance
  • Orb Agent Pro credentials (required to download the integration agent image)
  • Lightyear.ai account with API access (API Key and API Secret)
  • Host System with Docker support
  • Network connectivity between your host(s) and both your NetBox instance and the Lightyear API

Host Requirements

System

  • Operating System: Linux, macOS, or Windows with Docker support
  • Memory: Minimum 2GB RAM (4GB recommended)
  • Storage: 1GB free disk space
  • Network: Stable internet connection for pulling Docker images
  • Docker: Version 20.10 or later

Network

  • Outbound gRPC/gRPCS access to Diode on your NetBox instance (typically port 443 for gRPCS)
  • Outbound HTTPS access to api.lightyear.ai (port 443)
  • DNS resolution for both NetBox and Lightyear API hostnames
  • Firewall rules configured to allow the above connections from your agent host

NetBox Setup

Generate Diode Client Credentials

  1. Log into your NetBox instance
  2. Navigate to Diode → Client Credentials
  3. Click + Add a Credential
  4. Enter a descriptive name (e.g., "Lightyear Integration")
  5. Click Create Add client credentials
  6. Important: Copy and securely store the Client ID and Client Secret as you will reference these in the agent configuration file in later steps Copy client credentials
  7. Navigate to Diode → Settings
  8. Copy the value of the Diode target as you will reference this in the agent configuration file in later steps Copy Diode target

Agent Setup and Configuration

Step 1: Authenticate to the NetBox Labs Image Registry

From your host machine, authenticate to the NetBox Labs registry, using the CUSTOMER-IDENTIFIER and Token that you have been provided by the NetBox Labs team:

docker login -u<CUSTOMER-IDENTIFIER> netboxlabs.jfrog.io

Example session

% docker login -u<customer-abc123> netboxlabs.jfrog.io # note there are no spaces after -u
# Use the Token provided as the password when prompted
Password:
Login Succeeded

Step 2: Configure the Agent

  1. Create the configuration file (you can name the file anything you like):
touch agent.yaml
  1. Edit the configuration file with your preferred editor and add the following configuration. Important: Replace grpcs://your-instance.netboxcloud.com/diode with the value from Diode > Settings > Diode target in the NetBox UI:
orb:
config_manager:
active: local
backends:
worker:
common:
diode:
target: grpcs://your-instance.netboxcloud.com/diode # Get this value from Diode > Settings > Diode target
client_id: ${DIODE_CLIENT_ID}
client_secret: ${DIODE_CLIENT_SECRET}
agent_name: lightyear-agent # Use a meaningful name to identify this agent
policies:
worker:
lightyear_discovery:
config:
package: nbl_lightyear_lightyear
schedule: "0 */6 * * *" # Every 6 hours. Set your desired schedule (see examples below)
lightyear_api_key: ${LIGHTYEAR_API_KEY}
lightyear_api_secret: ${LIGHTYEAR_API_SECRET}
lightyear_host: https://api.lightyear.ai # Optional: override the default API host
scope:
Schedule Examples

The schedule field uses cron syntax. Here are some common examples:

  • "0 */6 * * *" - Every 6 hours (e.g., 00:00, 06:00, 12:00, 18:00)
  • "0 2 * * *" - Daily at 2:00 AM
  • "0 0 * * 0" - Weekly on Sunday at midnight

Optional - Dry Run Mode

The agent can be run in Dry Run mode, which means discovered data is written to a json formatted file instead of to NetBox. This can be useful for troubleshooting — for example you could share the file with the NetBox Labs support team to investigate issues ingesting certain data.

Enable this in the Diode section of your agent configuration file, by adding the dry_run key and setting the value to true (it is false by default) and set the dry_run_output_dir value to the location you want the file to be saved.

      diode:
dry_run: true
dry_run_output_dir: /opt/orb/ # this will save the output file into the same directory that you run the agent from

Step 3: Run the Agent

Run the agent to synchronize data from Lightyear.ai into NetBox:

Method 1: Set Environment Variables Manually

  1. Export Diode credentials as environment variables:
export DIODE_CLIENT_ID="your-client-id"
export DIODE_CLIENT_SECRET="your-client-secret"
  1. Export Lightyear credentials as environment variables:
export LIGHTYEAR_API_KEY="your-lightyear-api-key"
export LIGHTYEAR_API_SECRET="your-lightyear-api-secret"
  1. Run the agent with the following command:
docker run \
-v $PWD:/opt/orb/ \
-e DIODE_CLIENT_SECRET \
-e DIODE_CLIENT_ID \
-e LIGHTYEAR_API_KEY \
-e LIGHTYEAR_API_SECRET \
netboxlabs.jfrog.io/obs-orb-agent-pro/orb-agent-pro \
run -c /opt/orb/agent.yaml
  1. Create a .env file in your current directory:
touch .env
  1. Edit the .env file with your preferred editor and add the following content:
# NetBox Diode credentials
DIODE_CLIENT_ID=your-client-id
DIODE_CLIENT_SECRET=your-client-secret

# Lightyear credentials
LIGHTYEAR_API_KEY=your-lightyear-api-key
LIGHTYEAR_API_SECRET=your-lightyear-api-secret
Important

Replace the placeholder values with your actual credentials:

  • your-client-id and your-client-secret from the NetBox Diode setup
  • your-lightyear-api-key and your-lightyear-api-secret from your Lightyear.ai account
  1. Run the agent with the following command:
docker run \
-v $PWD:/opt/orb/ \
--env-file .env \
netboxlabs.jfrog.io/obs-orb-agent-pro/orb-agent-pro \
run -c /opt/orb/agent.yaml
Security Best Practice

When using Method 2, add .env to your .gitignore file to prevent accidentally committing sensitive credentials to version control:

echo ".env" >> .gitignore

Expected Output

After you issue the command to run the agent, depending on the schedule you defined in the configuration file, you should see output similar to the following:

{"time":"2025-09-09T10:15:22.487755639Z","level":"INFO","msg":"worker stderr","log":"    tags {"}
{"time":"2025-09-09T10:15:22.487756472Z","level":"INFO","msg":"worker stderr","log":" name: \"discovered\""}
{"time":"2025-09-09T10:15:22.48775743Z","level":"INFO","msg":"worker stderr","log":" }"}
{"time":"2025-09-09T10:15:22.487758389Z","level":"INFO","msg":"worker stderr","log":" }"}
{"time":"2025-09-09T10:15:22.487759722Z","level":"INFO","msg":"worker stderr","log":" tags {"}
{"time":"2025-09-09T10:15:22.487761264Z","level":"INFO","msg":"worker stderr","log":" name: \"lightyear\""}
{"time":"2025-09-09T10:15:22.487762805Z","level":"INFO","msg":"worker stderr","log":" }"}
{"time":"2025-09-09T10:15:22.487764264Z","level":"INFO","msg":"worker stderr","log":" tags {"}
{"time":"2025-09-09T10:15:22.487765222Z","level":"INFO","msg":"worker stderr","log":" name: \"discovered\""}
{"time":"2025-09-09T10:15:22.48776593Z","level":"INFO","msg":"worker stderr","log":" }"}
{"time":"2025-09-09T10:15:22.487769764Z","level":"INFO","msg":"worker stderr","log":"}"}
{"time":"2025-09-09T10:15:22.487777639Z","level":"INFO","msg":"worker stderr","log":"] chunks"}
{"time":"2025-09-09T10:15:22.487779305Z","level":"INFO","msg":"worker stderr","log":"INFO:apscheduler.executors.default:Job \"PolicyRunner.run (trigger: date[2025-09-09 10:13:48 UTC], next run at: 2025-09-09 10:13:48 UTC)\" executed successfully"}
Monitoring and Testing

Success Indicators: Look for the text Successful ingestion in the output, which confirms that data was successfully sent to your NetBox instance via Diode.

One-time run (testing): Omit the schedule field from your config to run the agent once and exit — useful for verifying credentials and connectivity before committing to a schedule.

Continuous Operation: With a schedule set, the agent will continue running on that cron schedule until manually stopped or the container is terminated.


View and Apply Discovered Data in NetBox Assurance

You can now work with the Lightyear data that has been discovered by the agent in the NetBox Assurance UI.

NetBox Assurance gives you control over operational drift by identifying deviations between your operational state and NetBox, and analytics to understand drift and plan for remediation, and ultimately take action.

Understanding Deviations

Deviations are the delta between the data already in NetBox as the Network Source of Truth, versus the actual operational state of the network as discovered by the controller integration.

From an initial run of the integration it could be that ALL discovered data is a deviation as it may not have existed in NetBox previously. Once the initial sync of data has taken place, and NetBox has been updated, then further integration runs would result in new deviations only.

Accessing NetBox Assurance

  1. Navigate to the UI of your NetBox instance
  2. Click on Assurance in the main navigation menu

Explore Deviation Types

  1. Click on Deviation Types to view the types of deviations that have been discovered View deviation types
  2. Click on the Name of a deviation type to view deviations for that type Discovered new circuit
  3. Click on the Name of an individual deviation to view its details Discovered circuit detail

View Active Deviations

  1. Click on Active Deviations to view all the deviations that have not yet been Applied or Ignored Active deviations
  2. Click on the Name of a deviation to view its details

Apply Deviations

  1. Select all the deviations that you'd like to apply. If you are working with a large number of deviations, first set the Per Page view to 500: select 500
  2. Then select the first deviation, hold down SHIFT and select the last one, and then click Apply Selected: Apply deviations
  3. Click Apply X Deviations to apply the deviations to the NetBox database: Confirm apply deviations
Apply Deviations to a Branch

Instead of writing the deviations to the Main NetBox database branch, you can select another branch from the drop down menu and apply the deviations to that branch.

Assurance Docs

For more detailed information on working with NetBox Assurance, please refer to the documentation

View the Lightyear Data in NetBox

Now that you have run the integration at least once and applied the discovered data, you can view the data from Lightyear.ai in the NetBox UI:

  1. Click on Circuits in the main navigation menu to view discovered circuits
  2. Filter by the lightyear tag to show only Lightyear-sourced data: View Lightyear circuits
  3. Select an individual Circuit to view its details, including circuit type, provider, provider account, status, and dates: Lightyear circuit detail

Additional Resources

Support

Email support@netboxlabs.com for support.