diff --git a/data/conf/samples/cdrsonexpmaster_mongo/cdrsreplicationmaster.json b/data/conf/samples/cdrsonexpmaster_mongo/cdrsreplicationmaster.json new file mode 100644 index 000000000..351d07eb4 --- /dev/null +++ b/data/conf/samples/cdrsonexpmaster_mongo/cdrsreplicationmaster.json @@ -0,0 +1,134 @@ +{ +// CGRateS Configuration file +// +// Used in apier_local_tests +// Starts rater, cdrs and mediator connecting over internal channel + +"general": { + "log_level": 7, + "poster_attempts": 1, +}, + +"data_db": { + "db_type": "mongo", + "db_name": "10", + "db_port": 27017, +}, + +"stor_db": { + "db_type": "mongo", + "db_name": "cgrates", + "db_port": 27017, +}, + + +"rals": { + "enabled": true, // enable Rater service: +}, + +"cdrs": { + "enabled": true, // start the CDR Server service: + "store_cdrs": false, // store cdrs in storDb + "chargers_conns":["*internal"], + "rals_conns": ["*internal"], + "online_cdr_exports": ["http_localhost", "amqp_localhost", "http_test_file", "amqp_test_file","aws_test_file","sqs_test_file","kafka_localhost","s3_test_file"], +}, + +"chargers": { + "enabled": true, +}, + + +"cdre": { + "http_localhost": { + "export_format": "*http_post", + "export_path": "http://127.0.0.1:12080/cdr_http", + "content_fields": [ // template of the exported content fields + {"tag": "CGRID", "type": "*composed", "value": "~CGRID", "field_id": "CGRID"}, + {"tag":"RunID", "type": "*composed", "value": "~RunID", "field_id": "RunID"}, + {"tag":"TOR", "type": "*composed", "value": "~ToR", "field_id": "ToR"}, + {"tag":"OriginID", "type": "*composed", "value": "~OriginID", "field_id": "OriginID"}, + {"tag":"OriginHost", "type": "*composed", "value": "~OriginHost", "field_id": "OriginHost"}, + {"tag":"RequestType", "type": "*composed", "value": "~RequestType", "field_id": "RequestType"}, + {"tag":"Direction", "type": "*composed", "value": "~Direction", "field_id": "Direction"}, + {"tag":"Tenant", "type": "*composed", "value": "~Tenant", "field_id": "Tenant"}, + {"tag":"Category", "type": "*composed", "value": "~Category", "field_id": "Category"}, + {"tag":"Account", "type": "*composed", "value": "~Account", "field_id": "Account"}, + {"tag":"Subject", "type": "*composed", "value": "~Subject", "field_id": "Subject"}, + {"tag":"Destination", "type": "*composed", "value": "~Destination", "field_id": "Destination"}, + {"tag":"SetupTime", "type": "*composed", "value": "~SetupTime", "layout": "2006-01-02T15:04:05Z07:00", "field_id": "SetupTime"}, + {"tag":"AnswerTime", "type": "*composed", "value": "~AnswerTime", "layout": "2006-01-02T15:04:05Z07:00", "field_id": "AnswerTime"}, + {"tag":"Usage", "type": "*composed", "value": "~Usage", "field_id": "Usage"}, + {"tag":"Cost", "type": "*composed", "value": "~Cost", "field_id": "Cost"}, + ], + }, + "amqp_localhost": { + "export_format": "*amqp_json_map", + "export_path": "amqp://guest:guest@localhost:5672/?queue_id=cgrates_cdrs&exchange=exchangename&exchange_type=fanout&routing_key=cgr_cdrs", + "attempts": 3, + "content_fields": [ // template of the exported content fields + {"tag": "CGRID", "type": "*composed", "value": "~CGRID", "field_id": "CGRID"}, + {"tag":"RunID", "type": "*composed", "value": "~RunID", "field_id": "RunID"}, + {"tag":"TOR", "type": "*composed", "value": "~ToR", "field_id": "ToR"}, + {"tag":"OriginID", "type": "*composed", "value": "~OriginID", "field_id": "OriginID"}, + {"tag":"OriginHost", "type": "*composed", "value": "~OriginHost", "field_id": "OriginHost"}, + {"tag":"RequestType", "type": "*composed", "value": "~RequestType", "field_id": "RequestType"}, + {"tag":"Direction", "type": "*composed", "value": "~Direction", "field_id": "Direction"}, + {"tag":"Tenant", "type": "*composed", "value": "~Tenant", "field_id": "Tenant"}, + {"tag":"Category", "type": "*composed", "value": "~Category", "field_id": "Category"}, + {"tag":"Account", "type": "*composed", "value": "~Account", "field_id": "Account"}, + {"tag":"Subject", "type": "*composed", "value": "~Subject", "field_id": "Subject"}, + {"tag":"Destination", "type": "*composed", "value": "~Destination", "field_id": "Destination"}, + {"tag":"SetupTime", "type": "*composed", "value": "~SetupTime", "layout": "2006-01-02T15:04:05Z07:00", "field_id": "SetupTime"}, + {"tag":"AnswerTime", "type": "*composed", "value": "~AnswerTime", "layout": "2006-01-02T15:04:05Z07:00", "field_id": "AnswerTime"}, + {"tag":"Usage", "type": "*composed", "value": "~Usage", "field_id": "Usage"}, + {"tag":"Cost", "type": "*composed", "value": "~Cost", "field_id": "Cost"}, + ], + }, + "http_test_file": { + "export_format": "*http_post", + "export_path": "http://127.0.0.1:12080/invalid", + "content_fields": [ + {"tag": "OriginID", "type": "*composed", "value": "~OriginID", "field_id": "OriginID"}, + ], + }, + "aws_test_file": { + "export_format": "*amqpv1_json_map", + "export_path": "amqps://guest:guest@localhost:25672/?queue_id=cgrates_cdrs", + "content_fields": [ + {"tag": "CGRID", "type": "*composed", "value": "~CGRID", "field_id": "CGRID"}, + ], + }, + "sqs_test_file": { + "export_format": "*sqs_json_map", + // export_path for sqs: "endpoint?aws_region=region&aws_key=IDkey&aws_secret=secret&aws_token=sessionToken&queue_id=cgrates-cdrs" + "export_path": "http://sqs.eu-west-2.amazonaws.com/?aws_region=eu-west-2&aws_key=testkey&aws_secret=testsecret&queue_id=cgrates-cdrs", + "content_fields": [ + {"tag": "CGRID", "type": "*composed", "value": "~CGRID", "field_id": "CGRID"}, + ], + }, + "amqp_test_file": { + "export_format": "*amqp_json_map", + "export_path": "amqp://guest:guest@localhost:25672/?queue_id=cgrates_cdrs", + "content_fields": [ + {"tag": "CGRID", "type": "*composed", "value": "~CGRID", "field_id": "CGRID"}, + ], + }, + "kafka_localhost": { + "export_format": "*kafka_json_map", + "export_path": "localhost:9092?topic=cgrates_cdrs", + "content_fields": [ + {"tag": "CGRID", "type": "*composed", "value": "~CGRID", "field_id": "CGRID"}, + ], + }, + "s3_test_file": { + "export_format": "*s3_json_map", + // export_path for s3: "endpoint?aws_region=region&aws_key=IDkey&aws_secret=secret&aws_token=sessionToken&queue_id=cgrates-cdrs" + "export_path": "http://s3.us-east-2.amazonaws.com/?aws_region=eu-west-2&aws_key=testkey&aws_secret=testsecret&queue_id=cgrates-cdrs", + "content_fields": [ + {"tag": "CGRID", "type": "*composed", "value": "~CGRID", "field_id": "CGRID"}, + ], + }, +}, + +} \ No newline at end of file diff --git a/data/conf/samples/cdrsonexpmaster/cdrsreplicationmaster.json b/data/conf/samples/cdrsonexpmaster_mysql/cdrsreplicationmaster.json similarity index 98% rename from data/conf/samples/cdrsonexpmaster/cdrsreplicationmaster.json rename to data/conf/samples/cdrsonexpmaster_mysql/cdrsreplicationmaster.json index 9ad9fc885..517c65d4b 100644 --- a/data/conf/samples/cdrsonexpmaster/cdrsreplicationmaster.json +++ b/data/conf/samples/cdrsonexpmaster_mysql/cdrsreplicationmaster.json @@ -9,6 +9,11 @@ "poster_attempts": 1, }, +"data_db": { + "db_type": "redis", + "db_port": 6379, + "db_name": "10", +}, "stor_db": { // database used to store offline tariff plans and CDRs "db_password": "CGRateS.org", // password to use when connecting to stordb diff --git a/data/conf/samples/cdrsonexpslave_mongo/cdrsreplicationslave.json b/data/conf/samples/cdrsonexpslave_mongo/cdrsreplicationslave.json new file mode 100644 index 000000000..e6f68cdd2 --- /dev/null +++ b/data/conf/samples/cdrsonexpslave_mongo/cdrsreplicationslave.json @@ -0,0 +1,40 @@ +{ +// CGRateS Configuration file +// +// Used in apier_local_tests +// Starts rater, cdrs and mediator connecting over internal channel + +"listen": { + "rpc_json": "127.0.0.1:12012", // RPC JSON listening address + "rpc_gob": "127.0.0.1:12013", // RPC GOB listening address + "http": "127.0.0.1:12080", // HTTP listening address +}, + +"data_db": { + "db_type": "mongo", + "db_name": "10", + "db_port": 27017, +}, + +"stor_db": { + "db_type": "mongo", + "db_name": "cgrates", + "db_port": 27017, +}, + +"rals": { + "enabled": true, // enable Rater service: +}, + +"cdrs": { + "enabled": true, // start the CDR Server service: + "chargers_conns":["*internal"], + "rals_conns": ["*internal"], +}, + +"chargers": { + "enabled": true, +}, + + +} \ No newline at end of file diff --git a/data/conf/samples/cdrsonexpslave/cdrsreplicationslave.json b/data/conf/samples/cdrsonexpslave_mysql/cdrsreplicationslave.json similarity index 88% rename from data/conf/samples/cdrsonexpslave/cdrsreplicationslave.json rename to data/conf/samples/cdrsonexpslave_mysql/cdrsreplicationslave.json index daccd6ae0..ba290ddf1 100644 --- a/data/conf/samples/cdrsonexpslave/cdrsreplicationslave.json +++ b/data/conf/samples/cdrsonexpslave_mysql/cdrsreplicationslave.json @@ -10,6 +10,12 @@ "http": "127.0.0.1:12080", // HTTP listening address }, +"data_db": { + "db_type": "redis", + "db_port": 6379, + "db_name": "10", +}, + "stor_db": { // database used to store offline tariff plans and CDRs "db_password": "CGRateS.org", // password to use when connecting to stordb }, diff --git a/data/conf/samples/multiral1_internal/cgrates.json b/data/conf/samples/multiral1_internal/cgrates.json new file mode 100644 index 000000000..c21adfeec --- /dev/null +++ b/data/conf/samples/multiral1_internal/cgrates.json @@ -0,0 +1,30 @@ +{ +// CGRateS Configuration file +// +// Used for multiple RAL configuration tests +// Starts rater, scheduler + +"general": { + "node_id":"node1", +}, + +"listen": { + "rpc_json": ":2012", // RPC JSON listening address + "rpc_gob": ":2013", // RPC GOB listening address + "http": ":2080", // HTTP listening address +}, + +"data_db": { + "db_type": "*internal", +}, + + +"stor_db": { + "db_type": "*internal", +}, + +"rals": { + "enabled": true, // enable Rater service: +}, + +} diff --git a/data/conf/samples/multiral1_mongo/cgrates.json b/data/conf/samples/multiral1_mongo/cgrates.json new file mode 100644 index 000000000..5288046c3 --- /dev/null +++ b/data/conf/samples/multiral1_mongo/cgrates.json @@ -0,0 +1,34 @@ +{ +// CGRateS Configuration file +// +// Used for multiple RAL configuration tests +// Starts rater, scheduler + +"general": { + "node_id":"node1", +}, + +"listen": { + "rpc_json": ":2012", // RPC JSON listening address + "rpc_gob": ":2013", // RPC GOB listening address + "http": ":2080", // HTTP listening address +}, + +"data_db": { + "db_type": "mongo", + "db_name": "10", + "db_port": 27017, +}, + +"stor_db": { + "db_type": "mongo", + "db_name": "cgrates", + "db_port": 27017, +}, + + +"rals": { + "enabled": true, // enable Rater service: +}, + +} diff --git a/data/conf/samples/multiral1/cgrates.json b/data/conf/samples/multiral1_mysql/cgrates.json similarity index 84% rename from data/conf/samples/multiral1/cgrates.json rename to data/conf/samples/multiral1_mysql/cgrates.json index 8e75fbc9b..a7ccd3742 100644 --- a/data/conf/samples/multiral1/cgrates.json +++ b/data/conf/samples/multiral1_mysql/cgrates.json @@ -14,6 +14,12 @@ "http": ":2080", // HTTP listening address }, +"data_db": { + "db_type": "redis", + "db_port": 6379, + "db_name": "10", +}, + "stor_db": { // database used to store offline tariff plans and CDRs "db_password": "CGRateS.org", // password to use when connecting to stordb }, diff --git a/data/conf/samples/multiral2_internal/cgrates.json b/data/conf/samples/multiral2_internal/cgrates.json new file mode 100644 index 000000000..185c0b563 --- /dev/null +++ b/data/conf/samples/multiral2_internal/cgrates.json @@ -0,0 +1,42 @@ +{ +// CGRateS Configuration file +// +// Used for multiple RAL configuration tests +// Starts RAL + +"general": { + "node_id":"node2", +}, + +"listen": { + "rpc_json": ":12012", + "rpc_gob": ":12013", + "http": ":12080", +}, + +"data_db": { + "db_type": "*internal", +}, + + +"stor_db": { + "db_type": "*internal", +}, + +"rals": { + "enabled": true, +}, + +"cdrs": { + "enabled": true, +}, + +"chargers": { + "enabled": true, +}, + +"sessions": { + "enabled": true, +}, + +} diff --git a/data/conf/samples/multiral2_mongo/cgrates.json b/data/conf/samples/multiral2_mongo/cgrates.json new file mode 100644 index 000000000..3237f56ad --- /dev/null +++ b/data/conf/samples/multiral2_mongo/cgrates.json @@ -0,0 +1,45 @@ +{ +// CGRateS Configuration file +// +// Used for multiple RAL configuration tests +// Starts RAL + +"general": { + "node_id":"node2", +}, + +"listen": { + "rpc_json": ":12012", + "rpc_gob": ":12013", + "http": ":12080", +}, + +"data_db": { + "db_type": "mongo", + "db_name": "10", + "db_port": 27017, +}, + +"stor_db": { + "db_type": "mongo", + "db_name": "cgrates", + "db_port": 27017, +}, + +"rals": { + "enabled": true, +}, + +"cdrs": { + "enabled": true, +}, + +"chargers": { + "enabled": true, +}, + +"sessions": { + "enabled": true, +}, + +} diff --git a/data/conf/samples/multiral2/cgrates.json b/data/conf/samples/multiral2_mysql/cgrates.json similarity index 83% rename from data/conf/samples/multiral2/cgrates.json rename to data/conf/samples/multiral2_mysql/cgrates.json index 417f47576..cf97f7f95 100644 --- a/data/conf/samples/multiral2/cgrates.json +++ b/data/conf/samples/multiral2_mysql/cgrates.json @@ -14,6 +14,12 @@ "http": ":12080", }, +"data_db": { + "db_type": "redis", + "db_port": 6379, + "db_name": "10", +}, + "stor_db": { // database used to store offline tariff plans and CDRs "db_password": "CGRateS.org", // password to use when connecting to stordb }, diff --git a/data/conf/samples/rpccaching_internal/cgrates.json b/data/conf/samples/rpccaching_internal/cgrates.json deleted file mode 100644 index 3ccc3870d..000000000 --- a/data/conf/samples/rpccaching_internal/cgrates.json +++ /dev/null @@ -1,76 +0,0 @@ -{ - -"general": { - "log_level": 7, - "reply_timeout": "10s", // consider connection down for replies taking longer than this value -}, - -"listen": { - "rpc_json": ":2012", - "rpc_gob": ":2013", - "http": ":2080", -}, - - -"data_db": { - "db_type": "*internal", -}, - - -"stor_db": { - "db_type": "*internal", -}, - -"caches":{ - "*rpc_responses": {"limit": -1, "ttl": "1s"}, -}, - - -"rals": { - "enabled": true, -}, - - -"schedulers": { - "enabled": true, -}, - - -"cdrs": { - "enabled": true, - "session_cost_retries": 2, // number of queries to session_costs before recalculating CDR -}, - - -"attributes": { - "enabled": true, -}, - - -"chargers": { - "enabled": true, - "attributes_conns": ["*internal"], -}, - - -"thresholds": { - "enabled": true, - "store_interval": "-1", -}, - - -"sessions": { - "enabled": true, - "chargers_conns": ["*internal"], - "rals_conns": ["*internal"], - "cdrs_conns": ["*internal"], - "attributes_conns": ["*internal"], -}, - - -"apier": { - "scheduler_conns": ["*internal"], -}, - - -} \ No newline at end of file diff --git a/data/conf/samples/sessions_replication/smgreplcmaster_mongo/cgrates.json b/data/conf/samples/sessions_replication/smgreplcmaster_mongo/cgrates.json new file mode 100644 index 000000000..9a972c0f1 --- /dev/null +++ b/data/conf/samples/sessions_replication/smgreplcmaster_mongo/cgrates.json @@ -0,0 +1,72 @@ +{ +// Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments +// Copyright (C) ITsysCOM GmbH +"general": { + "log_level": 7, + "node_id":"MasterReplication", +}, + +"listen": { + "rpc_json": "127.0.0.1:2012", + "rpc_gob": "127.0.0.1:2013", + "http": "127.0.0.1:2080", +}, + + +"rpc_conns": { + "rplConn": { + "strategy": "*broadcast_sync", + "conns": [{"address": "127.0.0.1:22012", "transport": "*json"}], + }, +}, + + +"data_db": { + "db_type": "mongo", + "db_name": "10", + "db_port": 27017, +}, + + +"stor_db": { + "db_type": "mongo", + "db_name": "cgrates", + "db_port": 27017, +}, + +"rals": { + "enabled": true, +}, + +"schedulers": { + "enabled": true, +}, + +"cdrs": { + "enabled": true, +}, + +"attributes": { + "enabled": true, +}, + + +"chargers": { + "enabled": true, + "attributes_conns": ["*internal"], +}, + +"sessions": { + "enabled": true, + "debit_interval": "5ms", // interval to perform debits on. + "replication_conns": ["rplConn"], + "rals_conns": ["*internal"], + "cdrs_conns": ["*internal"], + "chargers_conns": ["*internal"], +}, + +"apier": { + "scheduler_conns": ["*internal"], +}, + +} diff --git a/data/conf/samples/sessions_replication/smgreplcmaster/cgrates.json b/data/conf/samples/sessions_replication/smgreplcmaster_mysql/cgrates.json similarity index 100% rename from data/conf/samples/sessions_replication/smgreplcmaster/cgrates.json rename to data/conf/samples/sessions_replication/smgreplcmaster_mysql/cgrates.json diff --git a/data/conf/samples/sessions_replication/smgreplcslave_mongo/cgrates.json b/data/conf/samples/sessions_replication/smgreplcslave_mongo/cgrates.json new file mode 100644 index 000000000..5b674c4e1 --- /dev/null +++ b/data/conf/samples/sessions_replication/smgreplcslave_mongo/cgrates.json @@ -0,0 +1,77 @@ +{ +// Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments +// Copyright (C) ITsysCOM GmbH +"general": { + "log_level": 7, + "node_id":"SlaveReplication", +}, + +"listen": { + "rpc_json": "127.0.0.1:22012", // RPC JSON listening address + "rpc_gob": "127.0.0.1:22013", // RPC GOB listening address + "http": "127.0.0.1:22080", // HTTP listening address +}, + + +"rpc_conns": { + "conn1": { + "strategy": "*first", + "conns": [{"address": "127.0.0.1:22012", "transport":"*json"}], + }, + "rplConn": { + "strategy": "*broadcast", + "conns": [{"address": "127.0.0.1:2012", "transport": "*json"}], + } +}, + + +"data_db": { + "db_type": "mongo", + "db_name": "10", + "db_port": 27017, +}, + + +"stor_db": { + "db_type": "mongo", + "db_name": "cgrates", + "db_port": 27017, +}, + +"rals": { + "enabled": true, // enable Rater service: +}, + +"cdrs": { + "enabled": true, // start the CDR Server service: +}, + +"schedulers": { + "enabled": true, +}, + +"attributes": { + "enabled": true, +}, + + +"chargers": { + "enabled": true, + "attributes_conns": ["*internal"], +}, + +"sessions": { + "enabled": true, // starts SessionManager service: + "debit_interval": "5ms", // interval to perform debits on. + "listen_bijson": "127.0.0.1:22014", // address where to listen for bidirectional JSON-RPC requests + "replication_conns": ["rplConn"], + "rals_conns": ["conn1"], + "cdrs_conns": ["*internal"], + "chargers_conns": ["*internal"], +}, + +"apier": { + "scheduler_conns": ["*internal"], +}, + +} diff --git a/data/conf/samples/sessions_replication/smgreplcslave/cgrates.json b/data/conf/samples/sessions_replication/smgreplcslave_mysql/cgrates.json similarity index 100% rename from data/conf/samples/sessions_replication/smgreplcslave/cgrates.json rename to data/conf/samples/sessions_replication/smgreplcslave_mysql/cgrates.json diff --git a/data/conf/samples/smgeneric/cgrates.json b/data/conf/samples/smgeneric_mysql/cgrates.json similarity index 100% rename from data/conf/samples/smgeneric/cgrates.json rename to data/conf/samples/smgeneric_mysql/cgrates.json diff --git a/data/conf/samples/tutinternal_new/cgrates.json b/data/conf/samples/tutinternal_new/cgrates.json new file mode 100644 index 000000000..69aac3999 --- /dev/null +++ b/data/conf/samples/tutinternal_new/cgrates.json @@ -0,0 +1,121 @@ +{ +// CGRateS Configuration file +// +// used by gen/cdre_it_test.go + + +"general": { + "log_level": 7, + "reply_timeout": "50s", +}, + + +"listen": { + "rpc_json": ":2012", + "rpc_gob": ":2013", + "http": ":2080", +}, + + +"data_db": { + "db_type": "*internal", +}, + + +"stor_db": { + "db_type": "*internal", +}, + + +"rals": { + "enabled": true, + "thresholds_conns": ["*internal"], + "max_increments":3000000, +}, + + +"schedulers": { + "enabled": true, + "cdrs_conns": ["*internal"], +}, + +"cdre": { + "TestTutITExportCDR": { + "content_fields": [ + {"tag": "CGRID", "type": "*composed", "value": "~CGRID"}, + {"tag": "RunID", "type": "*composed", "value": "~RunID"}, + {"tag":"OriginID", "type": "*composed", "value": "~OriginID"}, + {"tag":"RequestType", "type": "*composed", "value": "~RequestType"}, + {"tag":"Tenant", "type": "*composed", "value": "~Tenant"}, + {"tag":"Category", "type": "*composed", "value": "~Category"}, + {"tag":"Account", "type": "*composed", "value": "~Account"}, + {"tag":"Destination", "type": "*composed", "value": "~Destination"}, + {"tag":"AnswerTime", "type": "*composed", "value": "~AnswerTime", "layout": "2006-01-02T15:04:05Z07:00"}, + {"tag":"Usage", "type": "*composed", "value": "~Usage"}, + {"tag":"Cost", "type": "*composed", "value": "~Cost", "rounding_decimals": 4}, + {"tag":"MatchedDestinationID", "type": "*composed", "value": "~CostDetails:s/\"MatchedDestId\":.*_(\\w{4})/${1}/:s/\"MatchedDestId\":\"INTERNAL\"/ON010/"}, + ], + }, +}, + +"cdrs": { + "enabled": true, + "chargers_conns":["*internal"], +}, + + +"attributes": { + "enabled": true, +}, + + +"chargers": { + "enabled": true, + "attributes_conns": ["*internal"], +}, + + +"resources": { + "enabled": true, + "store_interval": "-1", + "thresholds_conns": ["*internal"] +}, + + +"stats": { + "enabled": true, + "store_interval": "-1", + "thresholds_conns": ["*internal"], +}, + +"thresholds": { + "enabled": true, + "store_interval": "-1", +}, + + +"suppliers": { + "enabled": true, + "prefix_indexed_fields":["Destination"], + "stats_conns": ["*internal"], + "resources_conns": ["*internal"], +}, + + +"sessions": { + "enabled": true, + "suppliers_conns": ["*internal"], + "resources_conns": ["*internal"], + "attributes_conns": ["*internal"], + "rals_conns": ["*internal"], + "cdrs_conns": ["*internal"], + "chargers_conns": ["*internal"], +}, + + +"apier": { + "scheduler_conns": ["*internal"], +}, + + +} diff --git a/engine/storage_internal_datadb.go b/engine/storage_internal_datadb.go index bc01d4fe6..b5f0b4693 100644 --- a/engine/storage_internal_datadb.go +++ b/engine/storage_internal_datadb.go @@ -608,6 +608,9 @@ func (iDB *InternalDB) UpdateReverseDestinationDrv(oldDest, newDest *Destination var mpRevDst utils.StringMap var addedPrefixes []string var found bool + if oldDest == nil { + oldDest = new(Destination) // so we can process prefixes + } for _, oldPrefix := range oldDest.Prefixes { found = false for _, newPrefix := range newDest.Prefixes { diff --git a/general_tests/cdre_it_test.go b/general_tests/cdre_it_test.go index 5fc0c958b..9a7f627ec 100644 --- a/general_tests/cdre_it_test.go +++ b/general_tests/cdre_it_test.go @@ -55,7 +55,7 @@ var ( func TestCDREIT(t *testing.T) { switch *dbType { case utils.MetaInternal: - cdreConfigDIR = "tutinternal" + cdreConfigDIR = "tutinternal_new" case utils.MetaSQL: cdreConfigDIR = "tutmysql" case utils.MetaMongo: diff --git a/general_tests/cdrs_it_test.go b/general_tests/cdrs_it_test.go index bac09b65c..e06fa989a 100644 --- a/general_tests/cdrs_it_test.go +++ b/general_tests/cdrs_it_test.go @@ -443,7 +443,7 @@ func testV2CDRsGetCdrs4(t *testing.T) { func testV2CDRsGetCdrs5(t *testing.T) { var cdrCnt int64 - req := utils.AttrGetCdrs{Accounts: []string{"testV2CDRsProcessCDR5"}} + req := utils.RPCCDRsFilter{Accounts: []string{"testV2CDRsProcessCDR5"}} if err := cdrsRpc.Call(utils.ApierV2CountCDRs, req, &cdrCnt); err != nil { t.Error("Unexpected error: ", err.Error()) } else if cdrCnt != 0 { diff --git a/general_tests/cdrs_onlexp_it_test.go b/general_tests/cdrs_onlexp_it_test.go index e7a347ae4..29fdcf944 100644 --- a/general_tests/cdrs_onlexp_it_test.go +++ b/general_tests/cdrs_onlexp_it_test.go @@ -43,6 +43,7 @@ import ( var ( cdrsMasterCfgPath, cdrsSlaveCfgPath string + cdrsMasterCfgDIR, cdrsSlaveCfgDIR string cdrsMasterCfg, cdrsSlaveCfg *config.CGRConfig cdrsMasterRpc *rpcclient.RPCClient httpCGRID = utils.UUIDSha1Prefix() @@ -71,18 +72,33 @@ var ( ) func TestCDRsOnExp(t *testing.T) { + switch *dbType { + case utils.MetaInternal: + t.SkipNow() + case utils.MetaSQL: + cdrsMasterCfgDIR = "cdrsonexpmaster_mysql" + cdrsSlaveCfgDIR = "cdrsonexpslave_mysql" + case utils.MetaMongo: + cdrsMasterCfgDIR = "cdrsonexpmaster_mongo" + cdrsSlaveCfgDIR = "cdrsonexpslave_mongo" + case utils.MetaPostgres: + t.SkipNow() + default: + t.Fatal("Unknown Database type") + } + for _, stest := range sTestsCDRsOnExp { - t.Run("TestCDRsOnExp", stest) + t.Run(*dbType, stest) } } func testCDRsOnExpInitConfig(t *testing.T) { var err error - cdrsMasterCfgPath = path.Join(*dataDir, "conf", "samples", "cdrsonexpmaster") + cdrsMasterCfgPath = path.Join(*dataDir, "conf", "samples", cdrsMasterCfgDIR) if cdrsMasterCfg, err = config.NewCGRConfigFromPath(cdrsMasterCfgPath); err != nil { t.Fatal("Got config error: ", err.Error()) } - cdrsSlaveCfgPath = path.Join(*dataDir, "conf", "samples", "cdrsonexpslave") + cdrsSlaveCfgPath = path.Join(*dataDir, "conf", "samples", cdrsSlaveCfgDIR) if cdrsSlaveCfg, err = config.NewCGRConfigFromPath(cdrsSlaveCfgPath); err != nil { t.Fatal("Got config error: ", err.Error()) } diff --git a/general_tests/rpccaching_it_test.go b/general_tests/rpccaching_it_test.go index a672c0df1..c07cd8e58 100644 --- a/general_tests/rpccaching_it_test.go +++ b/general_tests/rpccaching_it_test.go @@ -72,7 +72,7 @@ var ( func TestRPCMethods(t *testing.T) { switch *dbType { case utils.MetaInternal: - rpcConfDIR = "rpccaching_internal" + t.SkipNow() case utils.MetaSQL: rpcConfDIR = "rpccaching_mysql" case utils.MetaMongo: diff --git a/general_tests/rpcclient_it_test.go b/general_tests/rpcclient_it_test.go index 4d6385f4b..beeadceec 100644 --- a/general_tests/rpcclient_it_test.go +++ b/general_tests/rpcclient_it_test.go @@ -39,6 +39,7 @@ var testRemoteRALs = flag.Bool("remote_rals", false, "Perform the tests in integ var ( // shared vars rpcITCfgPath1, rpcITCfgPath2 string + rpcITCfgDIR1, rpcITCfgDIR2 string rpcITCfg1, rpcITCfg2 *config.CGRConfig rpcRAL1, rpcRAL2 *rpcclient.RPCClient rpcPoolFirst, rpcPoolBroadcast *rpcclient.RPCPool @@ -72,14 +73,29 @@ var sTestRPCITLcl = []func(t *testing.T){ } func TestRPCITLcl(t *testing.T) { + switch *dbType { + case utils.MetaInternal: + rpcITCfgDIR1 = "multiral1_internal" + rpcITCfgDIR2 = "multiral2_internal" + case utils.MetaSQL: + rpcITCfgDIR1 = "multiral1_mysql" + rpcITCfgDIR2 = "multiral2_mysql" + case utils.MetaMongo: + rpcITCfgDIR1 = "multiral1_mongo" + rpcITCfgDIR2 = "multiral2_mongo" + case utils.MetaPostgres: + t.SkipNow() + default: + t.Fatal("Unknown Database type") + } for _, stest := range sTestRPCITLcl { - t.Run("sTestRPCITLcl", stest) + t.Run(*dbType, stest) } } func testRPCITLclInitCfg(t *testing.T) { - rpcITCfgPath1 = path.Join(*dataDir, "conf", "samples", "multiral1") - rpcITCfgPath2 = path.Join(*dataDir, "conf", "samples", "multiral2") + rpcITCfgPath1 = path.Join(*dataDir, "conf", "samples", rpcITCfgDIR1) + rpcITCfgPath2 = path.Join(*dataDir, "conf", "samples", rpcITCfgDIR2) rpcITCfg1, err = config.NewCGRConfigFromPath(rpcITCfgPath1) if err != nil { t.Error(err) diff --git a/general_tests/sentinel_it_test.go b/general_tests/sentinel_it_test.go index e414ce7b1..e670840ef 100755 --- a/general_tests/sentinel_it_test.go +++ b/general_tests/sentinel_it_test.go @@ -64,11 +64,22 @@ var ( // Sentinel1 will be started at port 16381 and will watch Node1 // Sentinel2 will be started at port 16382 and will watch Node1 func TestRedisSentinel(t *testing.T) { + switch *dbType { + case utils.MetaInternal: + t.SkipNow() + case utils.MetaSQL: + case utils.MetaMongo: + t.SkipNow() + case utils.MetaPostgres: + t.SkipNow() + default: + t.Fatal("Unknown Database type") + } if !*redisSentinel { return } for _, stest := range sTestsRds { - t.Run("", stest) + t.Run("TestRedisSentinel", stest) } } diff --git a/general_tests/session_replications_automaticdebit_it_test.go b/general_tests/session_replications_automaticdebit_it_test.go index 73a83af99..886737d41 100644 --- a/general_tests/session_replications_automaticdebit_it_test.go +++ b/general_tests/session_replications_automaticdebit_it_test.go @@ -35,6 +35,7 @@ import ( var ( smgRplcMasterCfgPath, smgRplcSlaveCfgPath string + smgRplcMasterCfgDIR, smgRplcSlaveCfgDIR string smgRplcMasterCfg, smgRplcSlaveCfg *config.CGRConfig smgRplcMstrRPC, smgRplcSlvRPC *rpc.Client masterEngine *exec.Cmd @@ -54,8 +55,23 @@ var ( ) func TestSessionSRpl(t *testing.T) { + switch *dbType { + case utils.MetaInternal: + t.SkipNow() + case utils.MetaSQL: + smgRplcMasterCfgDIR = "smgreplcmaster_mysql" + smgRplcSlaveCfgDIR = "smgreplcslave_mysql" + case utils.MetaMongo: + smgRplcMasterCfgDIR = "smgreplcmaster_mongo" + smgRplcSlaveCfgDIR = "smgreplcslave_mongo" + case utils.MetaPostgres: + t.SkipNow() + default: + t.Fatal("Unknown Database type") + } + for _, stest := range sTestsSession { - t.Run("TestSessionSRpl", stest) + t.Run(*dbType, stest) } } @@ -93,13 +109,13 @@ func testSessionSRplAddVoiceBalance(t *testing.T) { //Init Config func testSessionSRplInitCfg(t *testing.T) { - smgRplcMasterCfgPath = path.Join(*dataDir, "conf", "samples", "sessions_replication", "smgreplcmaster") + smgRplcMasterCfgPath = path.Join(*dataDir, "conf", "samples", "sessions_replication", smgRplcMasterCfgDIR) if smgRplcMasterCfg, err = config.NewCGRConfigFromPath(smgRplcMasterCfgPath); err != nil { t.Fatal(err) } smgRplcMasterCfg.DataFolderPath = *dataDir config.SetCgrConfig(smgRplcMasterCfg) - smgRplcSlaveCfgPath = path.Join(*dataDir, "conf", "samples", "sessions_replication", "smgreplcslave") + smgRplcSlaveCfgPath = path.Join(*dataDir, "conf", "samples", "sessions_replication", smgRplcSlaveCfgDIR) if smgRplcSlaveCfg, err = config.NewCGRConfigFromPath(smgRplcSlaveCfgPath); err != nil { t.Fatal(err) } diff --git a/general_tests/smschrg1_test.go b/general_tests/smschrg1_test.go index 5d456e9e3..b5b34bffc 100644 --- a/general_tests/smschrg1_test.go +++ b/general_tests/smschrg1_test.go @@ -27,6 +27,8 @@ import ( ) func TestSMSSetStorageSmsChrg1(t *testing.T) { + dflt, _ := config.NewDefaultCGRConfig() + config.SetCgrConfig(dflt) config.CgrConfig().CacheCfg()[utils.CacheRatingPlans].Precache = true // precache rating plan data := engine.NewInternalDB(nil, nil, true, config.CgrConfig().DataDbCfg().Items) dataDB = engine.NewDataManager(data, config.CgrConfig().CacheCfg(), nil) diff --git a/general_tests/tut_smgeneric_it_test.go b/general_tests/tut_smgeneric_it_test.go index 9c0747c9c..15b9a5e31 100644 --- a/general_tests/tut_smgeneric_it_test.go +++ b/general_tests/tut_smgeneric_it_test.go @@ -35,6 +35,7 @@ import ( var ( tutSMGCfgPath string + tutSMGCfgDIR string tutSMGCfg *config.CGRConfig tutSMGRpc *rpc.Client smgLoadInst utils.LoadInstance // Share load information between tests @@ -52,13 +53,26 @@ var ( ) func TestTutSMG(t *testing.T) { + switch *dbType { + case utils.MetaInternal: + t.SkipNow() + case utils.MetaSQL: + tutSMGCfgDIR = "smgeneric_mysql" + case utils.MetaMongo: + t.SkipNow() + case utils.MetaPostgres: + t.SkipNow() + default: + t.Fatal("Unknown Database type") + } + //mongo and sql tutmongo tutmysql for _, stest := range sTestTutSMG { - t.Run("TestTutSMG", stest) + t.Run(tutSMGCfgDIR, stest) } } func testTutSMGInitCfg(t *testing.T) { - tutSMGCfgPath = path.Join(*dataDir, "conf", "samples", "smgeneric") + tutSMGCfgPath = path.Join(*dataDir, "conf", "samples", tutSMGCfgDIR) // Init config first var err error tutSMGCfg, err = config.NewCGRConfigFromPath(tutSMGCfgPath) diff --git a/general_tests/tutorial2_it_test.go b/general_tests/tutorial2_it_test.go index 14f251d3b..73dd7ce68 100644 --- a/general_tests/tutorial2_it_test.go +++ b/general_tests/tutorial2_it_test.go @@ -66,6 +66,9 @@ func TestTutorial2(t *testing.T) { default: t.Fatal("Unknown Database type") } + if *encoding == utils.MetaGOB { + tutCfgDir += "_gob" + } for _, stest := range sTutTests { t.Run(tutCfgDir, stest) @@ -75,9 +78,6 @@ func TestTutorial2(t *testing.T) { func testTutLoadConfig(t *testing.T) { var err error tutCfgPath = path.Join(*dataDir, "conf", "samples", tutCfgDir) - if *encoding == utils.MetaGOB { - tutCfgPath = path.Join(*dataDir, "conf", "samples", tutCfgDir+"_gob") - } if tutCfg, err = config.NewCGRConfigFromPath(tutCfgPath); err != nil { t.Error(err) } diff --git a/integration_test.sh b/integration_test.sh index 68488378b..e1fc5c6bf 100755 --- a/integration_test.sh +++ b/integration_test.sh @@ -16,10 +16,12 @@ en_internal=$? echo 'go test github.com/cgrates/cgrates/ers -tags=integration -dbtype=*internal' go test github.com/cgrates/cgrates/ers -tags=integration -dbtype=*internal ers_internal=$? - echo 'go test github.com/cgrates/cgrates/loaders -tags=integration -dbtype=*internal' go test github.com/cgrates/cgrates/loaders -tags=integration -dbtype=*internal lds_internal=$? +echo 'go test github.com/cgrates/cgrates/general_tests -tags=integration -dbtype=*internal' +go test github.com/cgrates/cgrates/general_tests -tags=integration -dbtype=*internal +gnr_internal=$? # SQL echo 'go test github.com/cgrates/cgrates/apier/v1 -tags=integration -dbtype=*sql' go test github.com/cgrates/cgrates/apier/v1 -tags=integration -dbtype=*sql @@ -36,6 +38,9 @@ ers_sql=$? echo 'go test github.com/cgrates/cgrates/loaders -tags=integration -dbtype=*sql' go test github.com/cgrates/cgrates/loaders -tags=integration -dbtype=*sql lds_sql=$? +echo 'go test github.com/cgrates/cgrates/general_tests -tags=integration -dbtype=*sql' +go test github.com/cgrates/cgrates/general_tests -tags=integration -dbtype=*sql +gnr_sql=$? # Mongo echo 'go test github.com/cgrates/cgrates/apier/v1 -tags=integration -dbtype=*mongo' go test github.com/cgrates/cgrates/apier/v1 -tags=integration -dbtype=*mongo @@ -52,6 +57,9 @@ ers_mongo=$? echo 'go test github.com/cgrates/cgrates/loaders -tags=integration -dbtype=*mongo' go test github.com/cgrates/cgrates/loaders -tags=integration -dbtype=*mongo lds_mongo=$? +echo 'go test github.com/cgrates/cgrates/general_tests -tags=integration -dbtype=*mongo' +go test github.com/cgrates/cgrates/general_tests -tags=integration -dbtype=*mongo +gnr_mongo=$? # Postgres echo 'go test github.com/cgrates/cgrates/apier/v1 -tags=integration -dbtype=*postgres' go test github.com/cgrates/cgrates/apier/v1 -tags=integration -dbtype=*postgres @@ -68,6 +76,9 @@ ers_postgres=$? echo 'go test github.com/cgrates/cgrates/loaders -tags=integration -dbtype=*postgres' go test github.com/cgrates/cgrates/loaders -tags=integration -dbtype=*postgres lds_postgres=$? +echo 'go test github.com/cgrates/cgrates/general_tests -tags=integration -dbtype=*postgres' +go test github.com/cgrates/cgrates/general_tests -tags=integration -dbtype=*postgres +gnr_postgres=$? echo 'go test github.com/cgrates/cgrates/cdrc -tags=integration' go test github.com/cgrates/cgrates/cdrc -tags=integration @@ -77,9 +88,7 @@ go test github.com/cgrates/cgrates/config -tags=integration cfg=$? #All -echo 'go test github.com/cgrates/cgrates/general_tests -tags=integration' -go test github.com/cgrates/cgrates/general_tests -tags=integration -gnr=$? + echo 'go test github.com/cgrates/cgrates/agents -tags=integration' go test github.com/cgrates/cgrates/agents -tags=integration agts=$?