Product

Migrate phpIPAM inventory data into Device42

If you currently manage your IP addresses with {php}IPAM, you can now easily migrate phpIPAM IP inventory data into Device42 with our newest open source phpIPAM to Device42 migration script. This Python script connects to your phpIPAM server (v1.2.1 and above), extracts the data, and sends it to Device42 via the REST based APIs.

The script can be run on Windows or Linux with Python 2.7.x.

All of the below details can also be found on our phpIPAM to Device42 Migration GitHub page.

If you have any questions – feel free to leave a comment or to reach out to us. Happy importing!

About the script:

Assumptions:

  • The script assumes that you are running phpIPAM v1.2.1 or newer
  • This script works with Device42 10.5.0.1473709546 or newer

Requirements:

  • python 2.7.x
  • netaddr (you can install it with $ pip install netaddr)
  • pymysql (you can install it with $ pip install pymysql)
  • requests (you can install it with $ pip install requests or $ apt-get install python-requests)
  • must allow remote connections to your phpIPAM MySQL Instance on port 3306

Usage:

  1. copy or rename the sample config conf.sample to conf
  2. add Device42 URL and credentials to the conf file:
  3. # ====== Device42 upload settings ========= #
    D42_USER = 'device42 username'
    D42_PWD = 'device42 password'
    D42_URL = 'https:// device42 server IP address'
    
  4. add phpIPAM DB info and credentials to the conf file:
  5. # ====== MySQL Source (PHPIPAM) ====== #
    DB_IP = 'phpipam server IP'
    DB_PORT = 'phpipam database port'
    DB_NAME = 'phpipam database name'
    DB_USER = 'phpipam database user'
    DB_PWD = 'phpipam database password'
    
  6. adjust the log settings in the conf file
  7. # ====== Log settings ==================== #
    LOGFILE = 'migration.log'
    STDOUT = False # print to STDOUT
    DEBUG = True # write debug log
    DEBUG_LOG = 'debug.log'
    
  8. run the script with $ python phpipam2device42.py

Gotchas

  • Understandable device types : ‘physical’, ‘virtual’, ‘blade’, ‘cluster’, ‘other’.
  • Understandable IP types : ‘static’, ‘dhcp’, ‘reserved’.
  • If type not understandable, ‘default’ type inserted into D42.

The order of function calls in the main() function are important. Do not change them!
For example: subnets must be migrated before IP addresses in order for addresses to be added to the appropriate subnets.

Share this post

About the author