Skip to content

Offline Command Outputs Datasource

This datasource provides stored command output files so that TakeSnapshot can collect command output from a Git repository instead of connecting to live devices. This is useful for air-gapped environments where Nautobot cannot reach the devices, or for reproducible testing against fixed data.

Directory Structure

Command output files live under a command_outputs/ directory in the repository:

command_outputs/
└── cisco_ios/
    └── sw1/
        ├── show_version.raw
        └── show_ip_interface_brief.raw

Configuration

Select one or more offline-output repositories on the Operational Compliance Setting (Operations > Setup > Operational Compliance Settings). Configuring at least one repository here forces every device governed by this setting (see Scope: Dynamic Groups and Weight) to collect command output from Git instead of live devices (see Enabling Offline Retrieval):

Operational Compliance Settings Operational Compliance Settings

Setting Description
Command output Git repositories One or more Git repositories providing the offline command outputs content type. They are searched in order for each command file.
Command output path template Jinja2 template for the per-repository relative path. Defaults to {{obj.platform.network_driver}}/{{obj.name}}/{{cmd}}.raw.

The full resolution path is: <repo>/command_outputs/<rendered path template>

Available template variables:

Variable Description
{{ obj }} The device object
{{ obj.platform.network_driver }} The platform's network driver (e.g., cisco_ios)
{{ obj.name }} The device name
{{ cmd }} The command converted to a filename (spaces replaced with underscores)

Offline Command Repository Offline Command Repository

Settings, dynamic groups, and weight

Which setting governs a given device — and therefore which repositories and path template apply to it — is determined by the setting's dynamic group and weight. See Operational Compliance Settings for how device scoping and weight-based precedence work.

Create Offline Compliance Setting Create Offline Compliance Setting

Enabling Offline Retrieval

Offline retrieval is driven per device by its governing Operational Compliance Setting: whenever that setting has one or more Command output Git repositories configured, offline collection is forced for the device. TakeSnapshot reads each command's stored output from Git instead of connecting to the device — no per-device offline_commands custom field or config context is required. A device whose governing setting specifies no repositories is collected live.

Warning

There is no live-device fallback. When offline collection is forced and an expected output file is not present in any configured repository, the snapshot fails with a FileNotFoundError for that command. Every required command must have a stored output file.