diff --git a/apier/v1/cdrstatsv1_local_test.go b/apier/v1/cdrstatsv1_local_test.go index 83a3f240f..3a176414c 100644 --- a/apier/v1/cdrstatsv1_local_test.go +++ b/apier/v1/cdrstatsv1_local_test.go @@ -77,19 +77,6 @@ func TestCDRStatsLclRpcConn(t *testing.T) { } } -func TestCDRStatsLclGetQueueIds(t *testing.T) { - if !*testLocal { - return - } - var queueIds []string - eQueueIds := []string{"*default"} - if err := cdrstRpc.Call("CDRStatsV1.GetQueueIds", "", &queueIds); err != nil { - t.Error("Calling CDRStatsV1.GetQueueIds, got error: ", err.Error()) - } else if !reflect.DeepEqual(eQueueIds, queueIds) { - t.Errorf("Expecting: %v, received: %v", eQueueIds, queueIds) - } -} - func TestCDRStatsLclLoadTariffPlanFromFolder(t *testing.T) { if !*testLocal { return @@ -110,7 +97,7 @@ func TestCDRStatsLclGetQueueIds2(t *testing.T) { return } var queueIds []string - eQueueIds := []string{"*default", "CDRST3", "CDRST4"} + eQueueIds := []string{"CDRST3", "CDRST4"} if err := cdrstRpc.Call("CDRStatsV1.GetQueueIds", "", &queueIds); err != nil { t.Error("Calling CDRStatsV1.GetQueueIds, got error: ", err.Error()) } else if len(eQueueIds) != len(queueIds) { @@ -163,13 +150,6 @@ func TestCDRStatsLclGetMetrics1(t *testing.T) { if !*testLocal { return } - var rcvMetrics1 map[string]float64 - expectedMetrics1 := map[string]float64{"ASR": 75, "ACD": 15, "ACC": 15} - if err := cdrstRpc.Call("CDRStatsV1.GetMetrics", AttrGetMetrics{StatsQueueId: "*default"}, &rcvMetrics1); err != nil { - t.Error("Calling CDRStatsV1.GetMetrics, got error: ", err.Error()) - } else if !reflect.DeepEqual(expectedMetrics1, rcvMetrics1) { - t.Errorf("Expecting: %v, received: %v", expectedMetrics1, rcvMetrics1) - } var rcvMetrics2 map[string]float64 expectedMetrics2 := map[string]float64{"ASR": 75, "ACD": 15} if err := cdrstRpc.Call("CDRStatsV1.GetMetrics", AttrGetMetrics{StatsQueueId: "CDRST4"}, &rcvMetrics2); err != nil { @@ -190,13 +170,6 @@ func TestCDRStatsLclResetMetrics(t *testing.T) { t.Error("Unexpected reply received: ", reply) } time.Sleep(time.Duration(*waitRater) * time.Millisecond) - var rcvMetrics1 map[string]float64 - expectedMetrics1 := map[string]float64{"ASR": 75, "ACD": 15, "ACC": 15} - if err := cdrstRpc.Call("CDRStatsV1.GetMetrics", AttrGetMetrics{StatsQueueId: "*default"}, &rcvMetrics1); err != nil { - t.Error("Calling CDRStatsV1.GetMetrics, got error: ", err.Error()) - } else if !reflect.DeepEqual(expectedMetrics1, rcvMetrics1) { - t.Errorf("Expecting: %v, received: %v", expectedMetrics1, rcvMetrics1) - } var rcvMetrics2 map[string]float64 expectedMetrics2 := map[string]float64{"ASR": -1, "ACD": -1} if err := cdrstRpc.Call("CDRStatsV1.GetMetrics", AttrGetMetrics{StatsQueueId: "CDRST4"}, &rcvMetrics2); err != nil { diff --git a/config/cdrstatsconfig.go b/config/cdrstatsconfig.go index ab859e0db..e0a6202d6 100644 --- a/config/cdrstatsconfig.go +++ b/config/cdrstatsconfig.go @@ -19,7 +19,6 @@ along with this program. If not, see package config import ( - "github.com/cgrates/cgrates/utils" "time" ) @@ -47,85 +46,3 @@ type CdrStatsConfig struct { RatedSubjects []string CostInterval []float64 // 2 or less items, (>=Cost, - "queue_length": 50, // number of items in the stats buffer - "time_window": "1h", // will only keep the CDRs who's call setup time is not older than time.Now()-TimeWindow - "metrics": ["ASR", "ACD", "ACC"], // stat metric ids to build - "setup_interval": [], // filter on CDR SetupTime - "tors": [], // filter on CDR TOR fields - "cdr_hosts": [], // filter on CDR CdrHost fields - "cdr_sources": [], // filter on CDR CdrSource fields - "req_types": [], // filter on CDR ReqType fields - "directions": [], // filter on CDR Direction fields - "tenants": [], // filter on CDR Tenant fields - "categories": [], // filter on CDR Category fields - "accounts": [], // filter on CDR Account fields - "subjects": [], // filter on CDR Subject fields - "destination_prefixes": [], // filter on CDR Destination prefixes - "usage_interval": [], // filter on CDR Usage - "mediation_run_ids": [], // filter on CDR MediationRunId fields - "rated_accounts": [], // filter on CDR RatedAccount fields - "rated_subjects": [], // filter on CDR RatedSubject fields - "cost_interval": [], // filter on CDR Cost }, diff --git a/config/config_json_test.go b/config/config_json_test.go index d07530bd1..1232c1f5a 100644 --- a/config/config_json_test.go +++ b/config/config_json_test.go @@ -154,26 +154,7 @@ func TestDfCdrsJsonCfg(t *testing.T) { func TestDfCdrStatsJsonCfg(t *testing.T) { eCfg := &CdrStatsJsonCfg{ - Enabled: utils.BoolPointer(false), - Queue_length: utils.IntPointer(50), - Time_window: utils.StringPointer("1h"), - Metrics: utils.StringSlicePointer([]string{"ASR", "ACD", "ACC"}), - Setup_interval: utils.StringSlicePointer([]string{}), - Tors: utils.StringSlicePointer([]string{}), - Cdr_hosts: utils.StringSlicePointer([]string{}), - Cdr_sources: utils.StringSlicePointer([]string{}), - Req_types: utils.StringSlicePointer([]string{}), - Directions: utils.StringSlicePointer([]string{}), - Tenants: utils.StringSlicePointer([]string{}), - Categories: utils.StringSlicePointer([]string{}), - Accounts: utils.StringSlicePointer([]string{}), - Subjects: utils.StringSlicePointer([]string{}), - Destination_prefixes: utils.StringSlicePointer([]string{}), - Usage_interval: utils.StringSlicePointer([]string{}), - Mediation_run_ids: utils.StringSlicePointer([]string{}), - Rated_accounts: utils.StringSlicePointer([]string{}), - Rated_subjects: utils.StringSlicePointer([]string{}), - Cost_interval: utils.Float64SlicePointer([]float64{}), + Enabled: utils.BoolPointer(false), } if cfg, err := dfCgrJsonCfg.CdrStatsJsonCfg(); err != nil { t.Error(err) diff --git a/config/libconfig_json.go b/config/libconfig_json.go index e4ea079aa..7a3c7bc84 100644 --- a/config/libconfig_json.go +++ b/config/libconfig_json.go @@ -86,28 +86,7 @@ type CdrReplicationJsonCfg struct { // Cdrstats config section type CdrStatsJsonCfg struct { - Enabled *bool - Queue_length *int - Time_window *string - Metrics *[]string - Setup_interval *[]string - Tors *[]string - Cdr_hosts *[]string - Cdr_sources *[]string - Req_types *[]string - Directions *[]string - Tenants *[]string - Categories *[]string - Accounts *[]string - Subjects *[]string - Destination_prefixes *[]string - Usage_interval *[]string - Suppliers *[]string - Disconnect_causes *[]string - Mediation_run_ids *[]string - Rated_accounts *[]string - Rated_subjects *[]string - Cost_interval *[]float64 + Enabled *bool } // One cdr field config, used in cdre and cdrc diff --git a/data/conf/cgrates/cgrates.json b/data/conf/cgrates/cgrates.json index 5046d8515..1ab166497 100644 --- a/data/conf/cgrates/cgrates.json +++ b/data/conf/cgrates/cgrates.json @@ -12,6 +12,25 @@ // This file contains the default configuration hardcoded into CGRateS. // This is what you get when you load CGRateS with an empty configuration file. +/* +Real-time Charging System for Telecom & ISP environments +Copyright (C) ITsysCOM GmbH + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*/ + + //"general": { // "http_skip_tls_veify": false, // if enabled Http Client will accept any TLS certificate // "rounding_decimals": 10, // system level precision for floats @@ -93,25 +112,6 @@ //"cdrstats": { // "enabled": false, // starts the cdrstats service: -// "queue_length": 50, // number of items in the stats buffer -// "time_window": "1h", // will only keep the CDRs who's call setup time is not older than time.Now()-TimeWindow -// "metrics": ["ASR", "ACD", "ACC"], // stat metric ids to build -// "setup_interval": [], // filter on CDR SetupTime -// "tors": [], // filter on CDR TOR fields -// "cdr_hosts": [], // filter on CDR CdrHost fields -// "cdr_sources": [], // filter on CDR CdrSource fields -// "req_types": [], // filter on CDR ReqType fields -// "directions": [], // filter on CDR Direction fields -// "tenants": [], // filter on CDR Tenant fields -// "categories": [], // filter on CDR Category fields -// "accounts": [], // filter on CDR Account fields -// "subjects": [], // filter on CDR Subject fields -// "destination_prefixes": [], // filter on CDR Destination prefixes -// "usage_interval": [], // filter on CDR Usage -// "mediation_run_ids": [], // filter on CDR MediationRunId fields -// "rated_accounts": [], // filter on CDR RatedAccount fields -// "rated_subjects": [], // filter on CDR RatedSubject fields -// "cost_interval": [], // filter on CDR Cost //}, @@ -143,7 +143,7 @@ // {"tag":"SetupTime", "cdr_field_id": "setup_time", "type": "cdrfield", "value": "setup_time", "layout": "2006-01-02T15:04:05Z07:00"}, // {"tag":"AnswerTime", "cdr_field_id": "answer_time", "type": "cdrfield", "value": "answer_time", "layout": "2006-01-02T15:04:05Z07:00"}, // {"tag":"Usage", "cdr_field_id": "usage", "type": "cdrfield", "value": "usage"}, -// {"tag":"Cost", "cdr_field_id": "cost", "type": "cdrfield", "value": "cost"}, +// {"tag":"Cost", "cdr_field_id": "cost", "type": "cdrfield", "value": "cost"}, // ], // "trailer_fields": [], // template of the exported trailer fields // } @@ -176,7 +176,7 @@ // {"tag": "answer_time", "cdr_field_id": "answer_time", "type": "cdrfield", "value": "12", "mandatory": true}, // {"tag": "usage", "cdr_field_id": "usage", "type": "cdrfield", "value": "13", "mandatory": true}, // ], -// } +// }, //}, //"sm_freeswitch": { @@ -241,7 +241,7 @@ //"mailer": { -// "server": "localhost:25", // the server to use when sending emails out +// "server": "localhost", // the server to use when sending emails out // "auth_user": "cgrates", // authenticate to email server using this user // "auth_passwd": "CGRateS.org", // authenticate to email server with this password // "from_address": "cgr-mailer@localhost.localdomain" // from address used when sending emails out diff --git a/general_tests/tutorial_local_test.go b/general_tests/tutorial_local_test.go index 2e39d0517..67b5bc576 100644 --- a/general_tests/tutorial_local_test.go +++ b/general_tests/tutorial_local_test.go @@ -460,7 +460,7 @@ func TestTutFsCallsCdrStats(t *testing.T) { return } var queueIds []string - eQueueIds := []string{"*default", "CDRST1", "CDRST_1001", "CDRST_1002", "CDRST_1003", "STATS_SUPPL1", "STATS_SUPPL2"} + eQueueIds := []string{"CDRST1", "CDRST_1001", "CDRST_1002", "CDRST_1003", "STATS_SUPPL1", "STATS_SUPPL2"} if err := tutLocalRpc.Call("CDRStatsV1.GetQueueIds", "", &queueIds); err != nil { t.Error("Calling CDRStatsV1.GetQueueIds, got error: ", err.Error()) } else if len(eQueueIds) != len(queueIds) { @@ -860,13 +860,7 @@ func TestTutLocalCdrStatsAfter(t *testing.T) { return } var statMetrics map[string]float64 - eMetrics := map[string]float64{engine.ACC: 0.3452380952, engine.ACD: 111.4761904762, engine.ASR: 100} - if err := tutLocalRpc.Call("CDRStatsV1.GetMetrics", v1.AttrGetMetrics{StatsQueueId: utils.META_DEFAULT}, &statMetrics); err != nil { - t.Error("Calling CDRStatsV1.GetMetrics, got error: ", err.Error()) - //} else if !reflect.DeepEqual(eMetrics, statMetrics) { - // t.Errorf("Expecting: %v, received: %v", eMetrics, statMetrics) - } - eMetrics = map[string]float64{engine.ACD: 90.2, engine.ASR: 100, engine.TCC: 1.675, engine.TCD: 451, engine.ACC: 0.335} + eMetrics := map[string]float64{engine.ACD: 90.2, engine.ASR: 100, engine.TCC: 1.675, engine.TCD: 451, engine.ACC: 0.335} if err := tutLocalRpc.Call("CDRStatsV1.GetMetrics", v1.AttrGetMetrics{StatsQueueId: "CDRST1"}, &statMetrics); err != nil { t.Error("Calling CDRStatsV1.GetMetrics, got error: ", err.Error()) } else if !reflect.DeepEqual(eMetrics, statMetrics) {