Contents
Install
For deploying NPDB database, I make sure to have the following:
- yate-npdb-init installed on one of the STP machines
- yate-npdb updated, to be the same revision
- minimum revision needed is 6002
More info about installation here: YateNPDB.
Configure
For configuring Yate-NPDB-init use linux commands.
- I start with generating the file and renaming it.
cd /usr/share/yate-npdb-init
cp config.php.sample config.php
- Then I edit config.php and set info to connect to pgsql server + MMI API URL
Notes:
Make sure MMI IP can be accessed from this machine where yate-npdb-init was configured. (I usually ping the IP and make sure I don’t receive errors).
- URL to customer machine where YateMMI is installed
$mmi_url = "http://ip/mmi/api/v1";
- Customer db connection to make PDO connection
$db_type = "pgsql";
$db_host = "localhost";
$db_name = "porting";
$db_user = "postgres";//"nullteam";
$db_pass = "";//"portingpass";
$db_options = array();
- Configuration for how to handle info
Our configuration is ready for two variants:
- A table with both individual numbers and ranges
- Two tables, one with individual numbers and one for ranges.
// in case client has a single table in db -> define length of individual numbers
$length_individual_nr = 9;
// will be added in front of numbers to transform them in international format (in case they aren't)
$prefix = "98";
// table in name in customer db that contains both series and ported -- assuming it's a single one
$table_name = "porting";
// name of column that contains nr
$nr_col = "phoneno";
// name of column that contains the portability prefix
$prefix_col = "nprn";
Notes:
- Easiest way to figure out how the client uses the db is by the length of each number.
If the db of the client is not compatible, contacting the dev team is necessary.
Run
Run can be done from the console command:
- manually: /usr/share/yate-npdb-init/convert_db.php
- or set in cron how often to run (once a day / once every few days)
Estimated run time: for a 4200 000 database the approx run time is between 25 – 15 minutes depending on machine specs
Customizing implementation for different countries or customers
- I could use different database type (ex mysql) in the future — not yet tested
- configuring different info in config.php
- for different client database structure/nr length I have to re-implement all/partially functions from default_customer_specific_functions.php
Functions that might need to be reimplemented:
* is_ported
* write_series_params
* write_ported_params
* retrieve_batch_ported
Troubleshooting
I do these 3 steps to check that everything is configured properly:
1) Verifying database connection
2) Verifying transforming data
/usr/share/yate-npdb-init/convert_db.php --skip_curl
– and then verifying exported data:
sqlite3 /tmp/npdb.db
3) Pushing of data (if I already transformed the db once)
/usr/share/yate-npdb-init/convert_db.php --skip_pg_dump
I should receive aggregated info of all nodes the data reached:
Ex:
{"code":0,"answer_list":[{"npdb":{"code":0,"extra":"Details: total(sec):45; rm:0; wget:19; dearch:1; backup:1; clean_old:6; import:18; mvbackup:0"}},{"npdb-167":{"code":0,"extra":"Details: total(sec):63; rm:0;
wget:26; dearch:1; backup:1; clean_old:9; import:26; mvbackup:0"}},{"npdb-61":{"code":0,"extra":"Details: total(sec):10; rm:0; wget:0; dearch:0; backup:1; clean_old:0; import:9; mvbackup:0"}}]}
Related pages
-
General information about the JSON API and how you can use it for node configuration, set up or management.
-
Generic information about licensing system.