Import devices from Oxidized into rConfig V8 Core
The Oxidized Import Tool migrates network devices from Oxidized into rConfig V8 Core using the command line. After reading this page, you can map Oxidized device types to rConfig templates, parse the Oxidized hosts file, validate each device, and bulk import the devices with their vendors, categories, tags, prompts, and credentials.
When to use this
Section titled “When to use this”Use this tool when you are moving an existing Oxidized deployment to rConfig V8 Core and want to onboard devices in bulk rather than adding them by hand. It suits a one-time migration or a phased cut-over where Oxidized and rConfig run in parallel while you validate connectivity. For a handful of devices, adding them through the UI is usually quicker.
Prerequisites
Section titled “Prerequisites”Before importing devices, ensure you have:
- An Oxidized hosts file (
router.dbor equivalent) - Administrator access to rConfig V8 Core
- Device templates configured in rConfig that match your Oxidized device types
- At least one credential set created in rConfig (required for devices without embedded credentials)
- Connection profiles or credential sets created in rConfig
- SSH/command-line access to the rConfig server
How the import works
Section titled “How the import works”The import runs in three commands, each a distinct stage:
- Create device type mappings: define how Oxidized device types translate to rConfig templates, vendors, and categories.
- Load devices from Oxidized: parse the Oxidized hosts file and generate import-ready JSON.
- Import devices to rConfig: bulk import devices with validated configurations.
All three commands support an interactive menu when run without arguments, with guided prompts and validation at each step:
php /var/www/html/rconfig/artisan rconfig:oxidized-device-mappingsphp /var/www/html/rconfig/artisan rconfig:oxidized-load-devicesphp /var/www/html/rconfig/artisan rconfig:oxidized-import-devicesWhere the import files live
Section titled “Where the import files live”The import tool uses these file locations, creating directories automatically if they do not exist:
- Mappings file:
storage/app/rconfig/oxidized_mappings.json - Temporary files:
storage/app/rconfig/tempdir/ - Import JSON files:
storage/app/rconfig/tempdir/rconfig_import_YYYY-MM-DD_HH-mm-ss.json - Failure logs:
storage/app/rconfig/tempdir/oxidized_import_failures_YYYY-MM-DD_HH-mm-ss.txt
Step 1: Create device type mappings
Section titled “Step 1: Create device type mappings”-
Run the mappings command:
Terminal window php /var/www/html/rconfig/artisan rconfig:oxidized-device-mappingsAvailable options:
--list- Display all existing device type mappings--add- Create a new device type mapping interactively--edit=TYPE- Modify an existing mapping for the specified device type--delete=TYPE- Remove a device type mapping--info- Display command help and usage information
-
Add a new mapping:
Terminal window php /var/www/html/rconfig/artisan rconfig:oxidized-device-mappings --addProvide each value when prompted:
- Oxidized device type: the device type from your Oxidized configuration (for example
ios,asa,nxos) - rConfig device type: the internal device type name (for example
cisco_ios) - rConfig template: the device template ID to use for this device type
- Vendor: the vendor ID associated with this device type
- Category: the category ID for organising devices
- Tags: multi-select tags for device classification (Space to select, Enter to confirm)
- Prompts: device enable and main prompts (use
{device_name}as the placeholder)
- Oxidized device type: the device type from your Oxidized configuration (for example
-
Select tags in the interactive multi-select menu:
- Press Space to select or deselect tags
- Press Enter to confirm the selection
- If no tags are selected, the first available tag is assigned automatically
- Tags are stored by ID in the mapping
-
List existing mappings to verify them:
Terminal window php /var/www/html/rconfig/artisan rconfig:oxidized-device-mappings --listThe output displays all configured mappings:
=== IOS ===rConfig Type: cisco_iosTemplate ID: 1Vendor ID: 1Category ID: 2Prompts:- device_enable_prompt: {device_name}>- device_main_prompt: {device_name}#Tags: 5, 8 -
Edit or delete a mapping by device type:
Terminal window php /var/www/html/rconfig/artisan rconfig:oxidized-device-mappings --edit=iosphp /var/www/html/rconfig/artisan rconfig:oxidized-device-mappings --delete=ios
Step 2: Load devices from Oxidized
Section titled “Step 2: Load devices from Oxidized”-
Run the load command against your Oxidized hosts file:
Terminal window php /var/www/html/rconfig/artisan rconfig:oxidized-load-devices /path/to/oxidized/router.dbThe command checks prerequisites automatically. If no mappings file exists, it prompts you to create mappings first. If no credential sets exist in rConfig, the load halts with instructions to create one.
-
Select a default credential set when prompted. If your Oxidized file contains devices without embedded credentials, the command asks which credential set to apply to those devices:
Select a default credential to use for all devices that don't have specific credentials in the Oxidized file:Which credential would you like to use as default?ID #1: Production SSH Credentials (Main production credentials)ID #2: Lab Credentials (Testing environment)This credential set is applied to every device that has no username and password in the Oxidized file.
The Oxidized hosts file uses this format:
hostname:device_type[:username:password[:enable_password]]Examples:
# Basic format (uses default credential set)router1.example.com:iosswitch2.example.com:nxos
# With embedded credentials (no credential set needed)router3.example.com:ios:admin:SecurePass123firewall1.example.com:asa:admin:SecurePass123:EnablePass456
# Mixed configurationscore-sw-01.example.com:nxos:netadmin:Password1edge-rtr-05.example.com:iosWhat happens during loading
Section titled “What happens during loading”Each device passes through these stages, and any device that fails is logged to the failures file:
- File validation: verifies the hosts file exists and is readable
- Prerequisite checks: confirms the mappings file and credential sets exist
- Device parsing: extracts hostname, device type, and optional credentials
- DNS resolution: resolves each hostname to an IP address
- SSH connectivity test: verifies port 22 is accessible
- Mapping application: applies device type mappings to each device
- Credential handling: assigns embedded credentials or the default credential set
- JSON generation: creates the timestamped
rconfig_import_YYYY-MM-DD_HH-mm-ss.json - Error logging: records validation failures to the timestamped failures file
Output files
Section titled “Output files”The command writes two timestamped files:
- Success file:
storage/app/rconfig/tempdir/rconfig_import_2025-01-25_14-30-45.json - Failures file:
storage/app/rconfig/tempdir/oxidized_import_failures_2025-01-25_14-30-45.txt
Example JSON output:
[ { "device_name": "router1.example.com", "device_ip": "192.168.1.1", "device_model": "cisco_ios", "template_id": 1, "vendor_id": 1, "device_category_id": 2, "prompts": { "device_enable_prompt": "router1.example.com>", "device_main_prompt": "router1.example.com#" }, "tags": [5, 8], "device_cred_id": 1, "connection_type": "ssh", "port": 22 }, { "device_name": "router2.example.com", "device_ip": "192.168.1.2", "device_model": "cisco_ios", "template_id": 1, "vendor_id": 1, "device_category_id": 2, "prompts": { "device_enable_prompt": "router2.example.com>", "device_main_prompt": "router2.example.com#" }, "tags": [5, 8], "device_cred_id": 0, "device_username": "admin", "device_password": "SecurePass123", "device_enable_password": null, "connection_type": "ssh", "port": 22 }]The device_cred_id value controls credential handling:
device_cred_id = 0: the device uses embedded credentials (the username and password in the JSON)device_cred_id > 0: the device uses the specified credential set ID from rConfig
Step 3: Import devices to rConfig
Section titled “Step 3: Import devices to rConfig”-
Run the import command against the generated JSON file:
Terminal window php /var/www/html/rconfig/artisan rconfig:oxidized-import-devices /path/to/rconfig_import.jsonRun without a file path to use the interactive menu:
What would you like to do?Show information about this commandImport devices from a JSON fileImport from the latest available JSON fileSelect from all available import filesExitThe latest file option finds and uses the most recent JSON file in the temp directory. The select file option lists every available import file with its filename, modification date and time, file size, and device count.
Available options:
--group=ID- Assign all imported devices to the specified device group (default: 1)--dry-run- Preview the import without modifying the database--info- Display command help and usage information
-
Preview the import with a dry run before committing:
Terminal window php /var/www/html/rconfig/artisan rconfig:oxidized-import-devices \--dry-run \/path/to/rconfig_import.jsonThe output shows validation results and which devices would be imported:
Running in dry-run mode - no database changes will be madeValidating devices ████████████████████ 100%45 devices failed validation:Device: router1.example.com- Template ID 99 not foundContinue with 155 valid devices? (yes/no)Dry run completed. 155 devices would be imported. -
Run the production import, optionally targeting a device group:
Terminal window php /var/www/html/rconfig/artisan rconfig:oxidized-import-devices \--group=5 \/path/to/rconfig_import.jsonThe summary reports imported and skipped counts:
Found 200 devices in the import fileValidating devices ████████████████████ 100%Importing devices ████████████████████ 100%Import completed successfully!Imported: 195 devicesSkipped: 5 devices (already exist)
What the import validates
Section titled “What the import validates”Each device must pass these checks, and the whole import runs inside a single database transaction:
- Required fields:
device_name,device_ip(valid IP format),device_model,template_id,vendor_id,device_category_id, andprompts(must containdevice_enable_promptanddevice_main_prompt) - Template, vendor, and category IDs must exist in the database
- Credentials: if
device_cred_id = 0,device_usernameanddevice_passwordare required; ifdevice_cred_id > 0, the credential set must exist - Duplicate detection: no existing device with the same
device_nameordevice_ip
For each valid device, rConfig creates the device record and links its tags, vendor, category, template, and the default role (role ID 1).
Complete workflow example
Section titled “Complete workflow example”# Step 1: Create device type mappings (interactive mode)php /var/www/html/rconfig/artisan rconfig:oxidized-device-mappings --add
# Verify mappingsphp /var/www/html/rconfig/artisan rconfig:oxidized-device-mappings --list
# Step 2: Load devices from the Oxidized hosts filephp /var/www/html/rconfig/artisan rconfig:oxidized-load-devices \ /opt/oxidized/router.db
# Review the generated JSON and failures logcat storage/app/rconfig/tempdir/rconfig_import_2025-01-25_14-30-45.jsoncat storage/app/rconfig/tempdir/oxidized_import_failures_2025-01-25_14-30-45.txt
# Step 3: Preview import (dry run)php /var/www/html/rconfig/artisan rconfig:oxidized-import-devices \ --dry-run \ storage/app/rconfig/tempdir/rconfig_import_2025-01-25_14-30-45.json
# Step 4: Execute production importphp /var/www/html/rconfig/artisan rconfig:oxidized-import-devices \ --group=1 \ storage/app/rconfig/tempdir/rconfig_import_2025-01-25_14-30-45.json
# Or use the latest file automaticallyphp /var/www/html/rconfig/artisan rconfig:oxidized-import-devices# Select: "Import from the latest available JSON file"Common gotchas
Section titled “Common gotchas”Troubleshooting
Section titled “Troubleshooting”Why are no devices in the generated JSON?
Section titled “Why are no devices in the generated JSON?”This is usually DNS resolution. Devices are logged to the failures file with “Failed to resolve hostname” when the rConfig server cannot resolve them.
# Test DNS resolutionnslookup router1.example.comhost router1.example.comResolve it by adding entries to /etc/hosts, configuring DNS servers in /etc/resolv.conf, or using IP addresses instead of hostnames in the Oxidized file.
Why do devices fail with SSH connectivity errors?
Section titled “Why do devices fail with SSH connectivity errors?”Devices logged with “Failed to connect to SSH (port 22)” are not reachable from the rConfig server.
# Test SSH port connectivitync -zv 192.168.1.1 22telnet 192.168.1.1 22Common causes are a firewall blocking port 22 from the rConfig server, devices that are not reachable from the rConfig server network, or SSH disabled on the device.
Why does the hosts file fail to parse?
Section titled “Why does the hosts file fail to parse?”Device loading fails with “Invalid hosts file format” or some devices are missing from the JSON output. Check for blank lines or malformed entries:
cat /opt/oxidized/router.db | grep -v '^#' | grep -v '^$'
# Valid format examples:# hostname:device_type# hostname:device_type:username:password# hostname:device_type:username:password:enable_passwordRemove or fix any line that does not match the expected format.
Why are devices being skipped as duplicates?
Section titled “Why are devices being skipped as duplicates?”Validation shows “Device with same name or IP already exists”. Duplicates are skipped automatically during import. Search for the device name or IP under Devices in rConfig and delete the existing record if you need to re-import, or remove the duplicate from the JSON file before importing.
Why are prompts showing a literal {device_name}?
Section titled “Why are prompts showing a literal {device_name}?”If devices import with literal {device_name} in their prompts, the device name replacement failed during loading. Confirm the mapping file uses the {device_name} placeholder correctly, then regenerate the JSON:
php /var/www/html/rconfig/artisan rconfig:oxidized-load-devices \ /opt/oxidized/router.dbWhy does the import fail with a JSON error?
Section titled “Why does the import fail with a JSON error?”The import fails with “Invalid JSON structure” when the file is malformed. Validate the syntax, then regenerate if needed:
python -m json.tool /path/to/rconfig_import.jsonjq . /path/to/rconfig_import.jsonWhy did the import roll back?
Section titled “Why did the import roll back?”The import fails with “Import failed: [error message]” and zero devices are imported. Because every import is transactional, any error rolls back all changes. Check the application log and re-run with --dry-run to find the offending device:
tail -f storage/logs/laravel.log
php /var/www/html/rconfig/artisan rconfig:oxidized-import-devices \ --dry-run \ /path/to/file.jsonBest practices
Section titled “Best practices”- Create all device type mappings before loading the hosts file, so devices do not fail validation at import time.
- Pre-create connection profiles and credential sets in rConfig before importing devices.
- Verify DNS and connectivity from the rConfig server before starting the import.
- Review the failures log after loading to identify and fix issues early.
- Always run
--dry-runfirst to preview changes and catch errors before the production import. - Keep copies of your JSON import files for audit trails and potential rollbacks.
- For large deployments (500+ devices), split the hosts file into smaller batches for easier troubleshooting.
- Use the latest file option when re-importing after fixes, to avoid retyping paths.
Post-import tasks
Section titled “Post-import tasks”After a successful import:
- Verify the device inventory: navigate to Devices and confirm all devices imported correctly.
- Review credentials: check that devices have the right credential assignments.
- Test connectivity: use the device debug command to verify connection to sample devices.
- Check relationships: verify tags, vendors, categories, and templates are assigned correctly.
- Review skipped devices: investigate why devices were skipped (usually duplicates).
- Clean up temp files: archive or remove old import JSON files and failure logs.
- Organise devices: create device groups and apply bulk settings as needed.
- Configure schedules: set up automated backup schedules for your device groups.
What’s next
Section titled “What’s next”- Add and manage devices in rConfig V8 Core to work with imported devices.
- Configure connection templates and credentials for the device types you mapped.
- Set up scheduled tasks to automate configuration backups for imported devices.
- Organise devices with tags to group and manage your inventory.