Tests de la préparation pour la base de données pour Asterisk
Nicolas Bondier, 2011-03-15
Switzernet
Ce document décrit un ensemble de tests effectués afin d’évaluer le bon fonctionnement des triggers mis en places pour modifier les tables de ast-replication à partir des modifications effectuées sur les tables de porta-billing. Il fait suite à la publication du document expliquant l’implémentation des triggers: http://switzernet.com/3/public/110314-astrad-triggers/
(1) INSERT
OK
Les ajouts de comptes sont corrects
(2) UPDATE
OK
Voici un exemple de compte sur porta-billing:
mysql> select id,h323_password,A.i_customer,A.i_env,i_rep from Accounts A INNER JOIN Customers C ON C.i_customer=A.i_customer where A.i_customer=18138;
+-------------+---------------+------------+-------+-------+
| id | h323_password | i_customer | i_env | i_rep |
+-------------+---------------+------------+-------+-------+
| 41215507627 | PASSWORD | 18138 | 1 | 3 |
+-------------+---------------+------------+-------+-------+
porta-billing
Et son enregistrement dans la table users de ast-replication:
mysql> select * from users where username=41215507627;
+------+-------------+-----------+
| id | username | md5secret |
+------+-------------+-----------+
| 3780 | 41215507627 | |
+------+-------------+-----------+
ast-replication
On update le compte avec un nouveau numéro:
mysql> UPDATE Accounts SET id=41219999999 where i_customer=18138;
Query OK, 1 row affected, 1 warning (0.10 sec)
Rows matched: 1 Changed: 1 Warnings: 0
porta-billing
L’update est prise en compte dans porta-billing :
mysql> select id,h323_password,A.i_customer,A.i_env,i_rep from Accounts A INNER JOIN Customers C ON C.i_customer=A.i_customer where A.i_customer=18138;
+-------------+---------------+------------+-------+-------+
| id | h323_password | i_customer | i_env | i_rep |
+-------------+---------------+------------+-------+-------+
| 41219999999 | PASSWORD | 18138 | 1 | 3 |
+-------------+---------------+------------+-------+-------+
porta-billing
Et aussi prise en compte dans ast-replication
mysql> select * from users where id=3780;
+------+-------------+-----------+
| id | username | md5secret |
+------+-------------+-----------+
| 3780 | 41219999999 | |
+------+-------------+-----------+
1 row in set (0.00 sec)
ast-replication
(3) DELETE
OK
Sur un account avec id -> ip:
mysql> select id from Accounts where id='94.23.242.200';
+---------------+
| id |
+---------------+
| 94.23.242.200 |
+---------------+
porta-billing
mysql> select remote_ip from ip_customers where remote_ip='94.23.242.200';
+---------------+
| remote_ip |
+---------------+
| 94.23.242.200 |
+---------------+
1 row in set (0.00 sec)
ast-replication
mysql> delete from Accounts where id='94.23.242.200';
Query OK, 1 row affected (0.06 sec)
porta-billing
mysql> select id,remote_ip,is_node from ip_customers where remote_ip='94.23.242.200';
Empty set (0.00 sec)
porta-billing
mysql> select id from Accounts where id='94.23.242.200';
Empty set (0.00 sec)
ast-replication
Sur un account avec id -> numero de tel
mysql> select id,h323_password,A.i_customer,A.i_env,i_rep from Accounts A INNER JOIN Customers C ON C.i_customer=A.i_customer where A.i_customer=18167;
+-------------+---------------+------------+-------+-------+
| id | h323_password | i_customer | i_env | i_rep |
+-------------+---------------+------------+-------+-------+
| 41215507692 | PASSWORD | 18167 | 1 | 12 |
+-------------+---------------+------------+-------+-------+
1 row in set (0.00 sec)
porta-billing
mysql> select username from users where username='41215507692';
+-------------+
| username |
+-------------+
| 41215507692 |
+-------------+
1 row in set (0.00 sec)
ast-replication
mysql> delete from Accounts where id='41215507692';
Query OK, 1 row affected (0.04 sec)
porta-billing
mysql> select id,h323_password,A.i_customer,A.i_env,i_rep from Accounts A INNER JOIN Customers C ON C.i_customer=A.i_customer where A.i_customer=18167;
Empty set (0.00 sec)
porta-billing
mysql> select username from users where username='41215507692';
Empty set (0.00 sec)
ast-replication
OK
Les opérations sont les mêmes que pour les clients à la différence près qu’on les différencie par un id qui est une adresse ip.
OK
Préparation de la base de données (MySQL) pour Asterisk: http://switzernet.com/3/public/110314-astrad-triggers/