diff --git a/agents/librad_test.go b/agents/librad_test.go index 347b899de..beaf992df 100644 --- a/agents/librad_test.go +++ b/agents/librad_test.go @@ -158,7 +158,7 @@ func TestRadReplyAppendAttributes(t *testing.T) { type myEv map[string]interface{} -func (ev myEv) AsNavigableMap(tpl []*config.CfgCdrField) (*config.NavigableMap, error) { +func (ev myEv) AsNavigableMap(tpl []*config.FCTemplate) (*config.NavigableMap, error) { return config.NewNavigableMap(ev), nil } diff --git a/config/cfgcdrfield.go b/config/cfgcdrfield.go deleted file mode 100644 index d3a636c83..000000000 --- a/config/cfgcdrfield.go +++ /dev/null @@ -1,139 +0,0 @@ -/* -Real-time Online/Offline Charging System (OCS) 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 -*/ - -package config - -import ( - "github.com/cgrates/cgrates/utils" -) - -func NewCfgCdrFieldFromCdrFieldJsonCfg(jsnCfgFld *CdrFieldJsonCfg) (*CfgCdrField, error) { - var err error - cfgFld := new(CfgCdrField) - if jsnCfgFld.Tag != nil { - cfgFld.Tag = *jsnCfgFld.Tag - } - if jsnCfgFld.Type != nil { - cfgFld.Type = *jsnCfgFld.Type - } - if jsnCfgFld.Field_id != nil { - cfgFld.FieldId = *jsnCfgFld.Field_id - } - if jsnCfgFld.Attribute_id != nil { - cfgFld.AttributeID = *jsnCfgFld.Attribute_id - } - if jsnCfgFld.Handler_id != nil { - cfgFld.HandlerId = *jsnCfgFld.Handler_id - } - if jsnCfgFld.Value != nil { - if cfgFld.Value, err = utils.ParseRSRFields(*jsnCfgFld.Value, utils.INFIELD_SEP); err != nil { - return nil, err - } - } - if jsnCfgFld.Append != nil { - cfgFld.Append = *jsnCfgFld.Append - } - if jsnCfgFld.Field_filter != nil { - if cfgFld.FieldFilter, err = utils.ParseRSRFields(*jsnCfgFld.Field_filter, utils.INFIELD_SEP); err != nil { - return nil, err - } - } - if jsnCfgFld.Filters != nil { - cfgFld.Filters = make([]string, len(*jsnCfgFld.Filters)) - for i, fltr := range *jsnCfgFld.Filters { - cfgFld.Filters[i] = fltr - } - } - if jsnCfgFld.Width != nil { - cfgFld.Width = *jsnCfgFld.Width - } - if jsnCfgFld.Strip != nil { - cfgFld.Strip = *jsnCfgFld.Strip - } - if jsnCfgFld.Padding != nil { - cfgFld.Padding = *jsnCfgFld.Padding - } - if jsnCfgFld.Layout != nil { - cfgFld.Layout = *jsnCfgFld.Layout - } - if jsnCfgFld.Mandatory != nil { - cfgFld.Mandatory = *jsnCfgFld.Mandatory - } - if jsnCfgFld.Cost_shift_digits != nil { - cfgFld.CostShiftDigits = *jsnCfgFld.Cost_shift_digits - } - if jsnCfgFld.Rounding_decimals != nil { - cfgFld.RoundingDecimals = *jsnCfgFld.Rounding_decimals - } - if jsnCfgFld.Timezone != nil { - cfgFld.Timezone = *jsnCfgFld.Timezone - } - if jsnCfgFld.Mask_destinationd_id != nil { - cfgFld.MaskDestID = *jsnCfgFld.Mask_destinationd_id - } - if jsnCfgFld.Mask_length != nil { - cfgFld.MaskLen = *jsnCfgFld.Mask_length - } - if jsnCfgFld.Break_on_success != nil { - cfgFld.BreakOnSuccess = *jsnCfgFld.Break_on_success - } - if jsnCfgFld.New_branch != nil { - cfgFld.NewBranch = *jsnCfgFld.New_branch - } - if jsnCfgFld.Blocker != nil { - cfgFld.Blocker = *jsnCfgFld.Blocker - } - return cfgFld, nil -} - -type CfgCdrField struct { - Tag string // Identifier for the administrator - Type string // Type of field - FieldId string // Field identifier - AttributeID string - Filters []string // list of filter profiles - HandlerId string - Value utils.RSRFields - Append bool - FieldFilter utils.RSRFields - Width int - Strip string - Padding string - Layout string - Mandatory bool - CostShiftDigits int // Used in exports - RoundingDecimals int - Timezone string - MaskDestID string - MaskLen int - BreakOnSuccess bool - NewBranch bool - Blocker bool -} - -func CfgCdrFieldsFromCdrFieldsJsonCfg(jsnCfgFldss []*CdrFieldJsonCfg) ([]*CfgCdrField, error) { - retFields := make([]*CfgCdrField, len(jsnCfgFldss)) - for idx, jsnFld := range jsnCfgFldss { - if cfgFld, err := NewCfgCdrFieldFromCdrFieldJsonCfg(jsnFld); err != nil { - return nil, err - } else { - retFields[idx] = cfgFld - } - } - return retFields, nil -} diff --git a/config/cfgcdrfield_test.go b/config/cfgcdrfield_test.go deleted file mode 100644 index 77948b3bb..000000000 --- a/config/cfgcdrfield_test.go +++ /dev/null @@ -1,18 +0,0 @@ -/* -Real-time Online/Offline Charging System (OCS) 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 -*/ -package config diff --git a/config/libconfig_json.go b/config/libconfig_json.go index d560e4d1f..6be18b9e0 100755 --- a/config/libconfig_json.go +++ b/config/libconfig_json.go @@ -127,41 +127,6 @@ type CdrsJsonCfg struct { Online_cdr_exports *[]string } -type CdrReplicationJsonCfg struct { - Transport *string - Address *string - Synchronous *bool - Attempts *int - Cdr_filter *string - Content_fields *[]*CdrFieldJsonCfg -} - -// One cdr field config, used in cdre and cdrc -type CdrFieldJsonCfg struct { - Tag *string - Type *string - Field_id *string - Attribute_id *string - Handler_id *string - Value *string - Append *bool - Width *int - Strip *string - Padding *string - Layout *string - Field_filter *string - Filters *[]string - Mandatory *bool - Cost_shift_digits *int - Rounding_decimals *int - Timezone *string - Mask_destinationd_id *string - Mask_length *int - Break_on_success *bool - New_branch *bool - Blocker *bool -} - // Cdre config section type CdreJsonCfg struct { Export_format *string diff --git a/config/navigablemap.go b/config/navigablemap.go index 5f41ae25a..73415016f 100644 --- a/config/navigablemap.go +++ b/config/navigablemap.go @@ -33,7 +33,7 @@ import ( // CGRReplier is the interface supported by replies convertible to CGRReply type NavigableMapper interface { - AsNavigableMap([]*CfgCdrField) (*NavigableMap, error) + AsNavigableMap([]*FCTemplate) (*NavigableMap, error) } // NewNavigableMap constructs a NavigableMap diff --git a/engine/tpcsvreader.go b/engine/tpcsvreader.go deleted file mode 100644 index f03ae1e5b..000000000 --- a/engine/tpcsvreader.go +++ /dev/null @@ -1,38 +0,0 @@ -/* -Real-time Online/Offline Charging System (OCS) 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 -*/ - -package engine - -import ( - "encoding/csv" - - "github.com/cgrates/cgrates/config" -) - -// TPcsvReader reads data from csv file based on template -type TPcsvReader struct { - fldsTpl []*config.CfgCdrField - srcType string - srcPath string - csvReaders map[string]*csv.Reader // map[fileName]*csv.Reader for each name in fldsTpl -} - -// Read implements TPReader interface -func (csv *TPcsvReader) Read() (itm interface{}, err error) { - return -} diff --git a/sessions/sessions.go b/sessions/sessions.go index 5f1c6e82b..3dbbb49c0 100644 --- a/sessions/sessions.go +++ b/sessions/sessions.go @@ -1710,7 +1710,7 @@ type V1AuthorizeReply struct { // AsNavigableMap is part of engine.NavigableMapper interface func (v1AuthReply *V1AuthorizeReply) AsNavigableMap( - ignr []*config.CfgCdrField) (*config.NavigableMap, error) { + ignr []*config.FCTemplate) (*config.NavigableMap, error) { cgrReply := make(map[string]interface{}) if v1AuthReply != nil { if v1AuthReply.Attributes != nil { @@ -1969,7 +1969,7 @@ type V1InitSessionReply struct { // AsNavigableMap is part of engine.NavigableMapper interface func (v1Rply *V1InitSessionReply) AsNavigableMap( - ignr []*config.CfgCdrField) (*config.NavigableMap, error) { + ignr []*config.FCTemplate) (*config.NavigableMap, error) { cgrReply := make(map[string]interface{}) if v1Rply != nil { if v1Rply.Attributes != nil { @@ -2207,7 +2207,7 @@ type V1UpdateSessionReply struct { // AsNavigableMap is part of engine.NavigableMapper interface func (v1Rply *V1UpdateSessionReply) AsNavigableMap( - ignr []*config.CfgCdrField) (*config.NavigableMap, error) { + ignr []*config.FCTemplate) (*config.NavigableMap, error) { cgrReply := make(map[string]interface{}) if v1Rply != nil { if v1Rply.Attributes != nil { @@ -2601,7 +2601,7 @@ type V1ProcessEventReply struct { // AsNavigableMap is part of engine.NavigableMapper interface func (v1Rply *V1ProcessEventReply) AsNavigableMap( - ignr []*config.CfgCdrField) (*config.NavigableMap, error) { + ignr []*config.FCTemplate) (*config.NavigableMap, error) { cgrReply := make(map[string]interface{}) if v1Rply != nil { if v1Rply.MaxUsage != nil {