IPPlan Importer

Overview

The IPPlan Importer is a command-line tool to import IPs from an IPPlan database into ProVision. This tool can be used via two approaches: generating .csv files via the tool only, then using the ProVision IP Import UI to import the csv files (Connector), or as a full command-line import solution, bypassing the ProVision UI entirely (Importer).

Options: 

1) Generate .csv files to use with the IP Import - Upload/Import from CSV tool through the ProVision UI.

2) Import IPs directly into ProVision without accessing the UI.

Before you begin:

You will need:

  • A MySQL export of IPPlan created from mysqldump, located on the same server / accessible from the IPPlan Importer tool.
  • Administrative access to your ProVision instance folder

Accessing the Tool and Showing Help Instructions:

The tool is located in tools/ipplan_import.php. A help document is provided listing example commands and detailed situation-specific options.

To execute it, you must preface it with "php" program. From from your instance's root folder, the command would be:

 "php tools/ipplan_import.php --help" 

If you are in the tools folder, the command would be:

"php ipplan_import.php --help"

 This will bring up the help / instruction document. It is also provided below. 

Help File Text
usage: php ipplan_import.php [options] <SQL dump file> 
 
Examples:
    
For creating CSV's for use in ProVision IP importer:
    php ipplan_import.php filename.SQL --csv
 
For creating CSV's, but do not load SQL file if one already has been:
 
    php ipplan_import.php filename.SQL --csv --no-overwrite
   
For importing data from SQL dump. Note that you must specify RIR:
    php ipplan_import.php filename.SQL --rir=1918
 
For importing data from SQL dump, if one hasn't been loaded already:
    php ipplan_import.php filename.SQL --rir=1918 --no-overwrite
 
Caution: By default, SQL dump will be loaded into database 'provision_import_ipplan'. If database already exists it will be dropped, unless --no-overwrite option is specified.
 
options:
 
  --only-import - Skip loading SQL file. Instead, import existing data in database 'provision_import_ipplan'.
 
  --only-sql - Load SQL dump into database 'provision_import_ipplan'. --only-import can be run at a later time to use loaded database.
 
  --rir=RIR - (required for import) RIR for IP's
 
  OPTIONS IF LOADING SQL FILE:
 
  --no-overwrite - Load SQL dump only if database 'provision_import_ipplan' is currently non-existent. Otherwise, drop existing database.
 
  OPTIONS IF IMPORTING DATA:
  
  --csv - generate CSV's instead of importing directly to ProVision.

Connector Method (Results in .csv files only):

This method creates .csv files that you can use with the IP Import - Upload/Import from CSV tool through the ProVision UI.

  1. From the tools/ folder, run the tool with the --csv option. Be sure to reference your sql export file name and location:

    "php ipplan_import.php ../ipplanv6.sql --csv" 

     (where '../ipplanv6.sql'  is the path to your SQL file) 
    This will generate two files: ipplan_aggregates.csv   and ipplan_hosts.csv.  Both can be used to import in the IP import section of ProVision.
  2. Copy / Download the generated .csv files to a browsable directory on your local machine, to be accessed by the ProVision UI. 
  3. Through the ProVision UI, import the ipplan_aggregates.csv file as described in IP Import - Upload/Import from CSV.
  4. Through the ProVision UI, import the ipplan_hosts.csv file as described in IP Import - Upload/Import from CSV.

Note that you must import ipplan_aggregates first. into IP Import - Upload/Import from CSV to create the aggregates ipplan_hosts.csv will use.

Then, import ipplan_hosts.csv as described in IP Import - Upload/Import from CSV.

Importer Method (Results in full import):

This method has the tool process the import task.  Using this case, you must set the RIR in the command line for all of the IP's. 

Run & Set the RIR:

  1. From the tools/ folder, run the tool with the --rir option, referencing your SQL file location:


"php ipplan_import.php ../ipplanv6.sql --rir=1918" 
(where '../ipplanv6.sql'  is the path to your SQL file)


This will load your IPPlan database file into your mysql server and then import the hosts into ProVision. They will each be given the RIR you specified, as well as this text in the Notes field:  'IPPlan import' 

 The import may need to run for a number of minutes, depending on the size of your data. For reference, an import of 2100 hosts inside of 150 aggregates took approximately 10 minutes to complete during our testing.

 

Additional Run Options: 

Additional run options for various combination of conditions are detailed below. The command is the text within the quotes only. 

Load SQL Without Importing

You can load the SQL file, but NOT run an import, with the --only-sql option (feel free to include --no-overwrite option as well in case you don't want to overwrite a prior loaded SQL file): 

 "ipplan_import.php   ../ipplanv6.sql --only-sql" 

 "ipplan_import.php   ../ipplanv6.sql --only-sql --no-overwrite" 

Generate CSV Without Loading SQL

If you have already loaded the sql file previously, you can generate CSV files without having to load the SQL file: 

 "ipplan_import.php  --only-import --csv" 

Generate CSV No Overwrite

 If you want to just generate CSV files without re-loading the database file, you can as well: 

 "ipplan_import.php   ../ipplanv6.sql --no-overwrite --csv" 

Generate CSV With RIR

 You can also generate csv files with the rir option: 

 "ipplan_import.php   ../ipplanv6.sql --no-overwrite --csv --rir=1918" 

Run Only Import

If you have already loaded your IPPlan database with the tool before, you can do --only-import: 

 "php ipplan_import.php --rir=1918 --only-import"

Run Import No Overwrite

If you are not sure whether you have already loaded your IPPlan database with the tool before, you can specify --no-overwrite to NOT load the sql file if it was loaded already, or do load if it wasn't: 

 "ipplan_import.php   ../ipplanv6.sql --rir=1918 --no-overwrite"