Migrating RackTables data to Device42

Based on user requests, we are excited to add a new open-sourced migration script for migrating your data from existing RackTables install to Device42. The script is available at github repository: https://github.com/device42/Racktables-to-Device42-Migration

The script connects to your RackTables DataBase, get the data and sends it to Device42 appliance using the REST APIs.

Using this script, you can now migrate your RackTables data to Device42 in minutes. The requirements/how-to and gotchas etc. are discussed below.


Device42 v5.7.1.1394099009 and above
python 2.7.x
PyMySQL (python module)
requests (python module)

You can run the script from any box that can connect to RackTables Database and Device42 via https. It could be the rackmonkey host itself or any other machine that satisfies the requirements.
If you run the script from an external box that connects to RackTables DB, you will need following:

Open TCP port 3306 at RackTables server

Allowed remote MySQL connections from computer running migration script to RackTables DB

How To

Once you have pre-requisites taken care of, take a look at the script migrate.py in that repository. It is basically ready to go, all you have to do is add credentials and info for your Device42 appliance and your RackTables database.

If you are running this from an external host from where RackTables DB is installed, please make sure that mysql accepts connections from a remote server. If using default settings, this can be generally achieved by changed bind-address to in my.cnf file and restating mysql.

Enter Device42 URL and credentials, where it says:

# ====== Device42 upload settings ========= #
D42_USER   = 'D42_USER'
D42_PWD    = 'D42_PASSWORD'
D42_URL     = 'D42_API_URL'
DRY_RUN     = False

Enter Racktables Database and credentials, where it says


# ====== MySQL Source (Racktables) ====== #
DB_IP       = 'RT_IP'
DB_NAME  = 'racktables'
DB_PWD    = 'RT_PWD'


Optionally, you can change where you want to log the errors etc.


# ====== MySQL Source (Racktables) ====== #
DB_IP       = 'RT_IP'
DB_NAME  = 'racktables'
DB_PWD    = 'RT_PWD'

Once the script is ready, you can do

python  racktables2device42.py

If successful, you should see your data in Device42.

Migration Components

Migration script consists of several separated functions responsible for different migration data. Main migration components are:

  • Subnets
  • IP addresses
  • Locations
  • Racks
  • Rack data
  • Hardware
  • Devices
  • PDUs

All of the migration components are enabled by default, but they can be disabled at will by commenting out related lines in function main().
Important note: Some of the components depend on some other components. For example: mounting a device to rack requires that a racks are imported.



  • Devices without names are not migrated
  • Patch panels are not migrated.
  • Order of function calls in main() function is important. Do not change it!
  • For example: subnets must be migrated before IP addresses in order for addresses to join appropriate subnets.

Data Migration Help

If you don’t have enough resources to perform the migration yourself – we can do the migration for you. We will give you instructions on how to grab a DB dump and we can do the data conversion for you!