Skip to content

rConfig – Example Workflow - Uploading Device Files via xFTP (Cisco Example)

rConfig – Example Workflow: Uploading Device Files via xFTP (Cisco Example)

This guide walks through how to configure a Cisco device to automatically upload a configuration or binary file to rConfig using the xFTP microservice. It demonstrates how rConfig detects, processes, and stores the uploaded file, linking it to the correct device record.


1. Prerequisites

Before proceeding, ensure:

  • Docker and at least one xFTP microservice (TFTP, FTP, or SFTP) are installed and running.

  • You can verify this from Settings → xFTP Services or via:

    php artisan rconfig:xftp-toggle --status
  • Your rConfig server IP is reachable from the network device.

  • You have CLI access to the Cisco device for sending the copy command.


2. Create a Command Group for xFTP Operations

In rConfig, a Command Group represents a logical collection of commands. Each device can be associated with one or more Command Groups.

  1. Go to Devices → Command Groups and click Add New Group.

  2. Set:

    • Group Name: TftpCommands
    • Description: Commands for file uploads via rConfig xFTP
  3. Save the group.


3. Add a Copy Command to the Group

Inside the TftpCommands group, click Add Command and add the following:

copy running-config tftp://192.168.1.131/{deviceid}-running-config.cfg

Explanation

  • 192.168.1.131 — IP address of your rConfig server

  • {deviceid} — rConfig variable automatically replaced by the actual Device ID when executed

  • The resulting filename will look like:

    87878-running-config.cfg

You can use similar variations for FTP or SFTP:

copy running-config ftp://{ftpusername}:{ftppassword}@192.168.1.131/{deviceid}-running-config.cfg
copy running-config scp://{sftpusername}:{sftppassword}@192.168.1.131/{deviceid}-running-config.cfg

rConfig automatically substitutes the credentials and Device ID during runtime.

Note: You can also define custom logic to match a filename pattern to a given device using pattern-based file matching. See Pattern-Based File Matching in rConfig v7.4.0 for more details.


4. Add a Device and Attach the Command Group

  1. Navigate to Devices → Add Device.

  2. Enter:

    • Device Name: router1-cat16
    • IP Address: 192.168.1.131 (your rConfig server)
    • Device Type: Cisco IOS
  3. Under Command Groups, select TftpCommands.

  4. Save the device. Once saved, verify that it has been assigned a Device ID (e.g., 87878). This ID will be used later in the filename to link uploads to this device.


5. Running the Copy Command

When the scheduled poll or on-demand execution runs for this command group:

  1. rConfig connects to the Cisco device via SSH/Telnet.

  2. It executes:

    copy running-config tftp://192.168.1.131/87878-running-config.cfg
  3. The Cisco device initiates the TFTP connection to the rConfig xFTP microservice (running in Docker).

    • The device acts as the client.
    • The rConfig xFTP service acts as the server.
  4. The file transfer completes, and the file is written to the rConfig xFTP upload directory:

    /srv/xftp/87878-running-config.cfg

6. How rConfig Picks Up the File

The xFTP sweep process automatically detects and processes new uploads.

Automated Sweep (Scheduled)

By default, the sweep task runs every 15 minutes. You can adjust the schedule in Settings → Scheduled Tasks.

Manual Sweep (Immediate)

To process files instantly, run:

php artisan rconfig:sweep-xftp-dir

Sweep Output Example

Loaded 0 active pattern(s) from configuration.
Contents of '/srv/xftp/':
[FILE] 87878-running-config.cfg
Default extraction: '87878-running-config.cfg' -> Device ID: 87878
Copied 87878-running-config-519.cfg to /var/www/html/rconfig7/storage/app/rconfig/data/VlanDatBackup/router1-cat16/xftpuploads/87878-running-config-519.cfg
Found and processed 1 valid file(s) in xFTP directory.

7. Behind the Scenes: What Happens

  1. Filename Parsing: rConfig scans each filename in /srv/xftp/. If the filename includes a valid Device ID (e.g., 87878), it associates that file with the matching device record.

  2. Pattern Matching (Optional): If configured, xftp-device-patterns.json can define advanced filename patterns for automatic mapping.

  3. File Movement: The file is renamed with a timestamp and moved to the device’s folder:

    storage/app/rconfig/data/VlanDatBackup/router1-cat16/xftpuploads/87878-running-config-519.cfg
  4. Database Logging: The operation is logged, and the new file entry is visible in the Device View → Uploaded Files section.

  5. Cleanup: The original file in /srv/xftp/ is deleted once successfully copied.


8. Viewing Uploaded Files in the UI

  1. Open Devices → [Your Device] → View Device.

  2. Scroll to the Uploaded Files section at the bottom.

  3. You’ll see the newly uploaded file:

    • 87878-running-config-519.cfg
  4. Use the View, Download, or Delete options as needed.


9. Example – Complete Workflow Summary

StepActionActorLocation
1Create Command GroupAdminrConfig UI
2Add copy command to the groupAdminrConfig UI
3Create device and attach Command GroupAdminrConfig UI
4Cisco device executes copy commandDeviceNetwork
5File is transferred to rConfig xFTP serviceDevice → rConfig/srv/xftp/
6rConfig sweep task detects fileServer/srv/xftp/
7File matched to Device IDrConfigDB + device mapping
8File copied to device’s folderrConfigstorage/app/rconfig/data/.../xftpuploads/
9File shown in Device UIrConfigWeb UI

10. Notes & Tips

  • Always include {deviceid} in filenames to ensure automatic mapping.
  • Avoid spaces or special characters in filenames.
  • For security, do not expose xFTP ports externally.
  • You can run multiple xFTP services (TFTP + FTP + SFTP) in parallel.
  • Use pattern-based matching (xftp-device-patterns.json) for devices that cannot embed IDs in filenames.

End Result: Your Cisco device automatically transfers configuration backups to rConfig, where they are timestamped, stored, and associated with the correct device — no manual file handling required.