From fd84f0e90e7310c5f6f0dcff67f021b2ccc99f97 Mon Sep 17 00:00:00 2001 From: DanB Date: Sun, 21 Sep 2014 20:25:36 +0200 Subject: [PATCH] Modified Actions.csv fields order to make easier it's understanding --- data/conf/samples/cdrstatsv1_local_test.cfg | 1 + data/conf/samples/tutorial_local_test.cfg | 1 + data/tariffplans/prepaid1centpsec/Actions.csv | 8 ++--- data/tariffplans/tutorial/ActionTriggers.csv | 1 + data/tariffplans/tutorial/Actions.csv | 12 +++---- engine/loader_csv.go | 31 ++++++++++--------- engine/loader_csv_test.go | 20 ++++++------ engine/loader_helpers.go | 24 ++++++++++++-- engine/loader_helpers_test.go | 12 +++---- engine/tpimporter_csv.go | 15 +++++---- general_tests/ddazmbl1_test.go | 4 +-- general_tests/ddazmbl2_test.go | 4 +-- general_tests/ddazmbl3_test.go | 2 +- general_tests/tutorial_local_test.go | 6 ++-- utils/consts.go | 13 ++++++++ 15 files changed, 97 insertions(+), 57 deletions(-) diff --git a/data/conf/samples/cdrstatsv1_local_test.cfg b/data/conf/samples/cdrstatsv1_local_test.cfg index fd39cacec..1ad241112 100644 --- a/data/conf/samples/cdrstatsv1_local_test.cfg +++ b/data/conf/samples/cdrstatsv1_local_test.cfg @@ -15,6 +15,7 @@ store_disable = true [mediator] enabled = true store_disable = true +cdrstats = internal [cdrstats] enabled = true diff --git a/data/conf/samples/tutorial_local_test.cfg b/data/conf/samples/tutorial_local_test.cfg index 96ec8479f..089506a5f 100644 --- a/data/conf/samples/tutorial_local_test.cfg +++ b/data/conf/samples/tutorial_local_test.cfg @@ -20,6 +20,7 @@ export_dir = /tmp # Path where the exported CDRs will be placed [mediator] enabled = true # Starts Mediator service: . +cdrstats = internal [cdrstats] enabled = true # Starts the cdrstats service: \ No newline at end of file diff --git a/data/tariffplans/prepaid1centpsec/Actions.csv b/data/tariffplans/prepaid1centpsec/Actions.csv index bd27aff4c..462f34bff 100644 --- a/data/tariffplans/prepaid1centpsec/Actions.csv +++ b/data/tariffplans/prepaid1centpsec/Actions.csv @@ -1,6 +1,6 @@ -#ActionsTag,Action,BalanceType,Direction,Units,ExpiryTime,DestinationTag,RatingSubject,Category,BalanceWeight,SharedGroup,ExtraParameters,Weight -PREPAID_10,*topup_reset,*monetary,*out,10,*unlimited,*any,,,10,,,10 -BONUS_1,*topup,*monetary,*out,1,*unlimited,*any,,,10,,,10 +#ActionsTag[0],Action[1],ActionExtraParameters[2],BalanceType[3],Direction[4],Category[5],DestinationTag[6],RatingSubject[7],SharedGroup[8],ExpiryTime[9],Units[10],BalanceWeight[11],Weight[12] +PREPAID_10,*topup_reset,,*monetary,*out,,*any,,,*unlimited,10,10,10 +BONUS_1,*topup,,*monetary,*out,,*any,,,*unlimited,1,10,10 LOG_BALANCE,*log,,,,,,,,,,,10 -CDRST_WARN_HTTP,*call_url,,,,,,,,,,http://localhost:8080,10 +CDRST_WARN_HTTP,*call_url,http://localhost:8080,,,,,,,,,,10 CDRST_LOG,*log,,,,,,,,,,,10 diff --git a/data/tariffplans/tutorial/ActionTriggers.csv b/data/tariffplans/tutorial/ActionTriggers.csv index e9398ccab..96a49a73a 100644 --- a/data/tariffplans/tutorial/ActionTriggers.csv +++ b/data/tariffplans/tutorial/ActionTriggers.csv @@ -1,4 +1,5 @@ #Tag,BalanceTag,Direction,ThresholdType,ThresholdValue,Recurrent,MinSleep,BalanceDestinationTag,BalanceWeight,BalanceExpiryTime,BalanceRatingSubject,BalanceCategory,BalanceSharedGroup,StatsMinQueuedItems,ActionsTag,Weight +##Tag,BalanceTag,Direction,ThresholdType,ThresholdValue,Recurrent,MinSleep,BalanceCategory,BalanceRatingSubject,BalanceDestinationTag,BalanceExpiryTime,BalanceSharedGroup,BalanceWeight,StatsMinQueuedItems,ActionsTag,Weight STANDARD_TRIGGERS,*monetary,*out,*min_balance,2,false,0,,,,,,,,LOG_WARNING,10 STANDARD_TRIGGERS,*monetary,*out,*max_counter,5,false,0,FS_USERS,,,,,,,LOG_WARNING,10 STANDARD_TRIGGERS,*monetary,*out,*max_balance,20,false,0,,,,,,,,LOG_WARNING,10 diff --git a/data/tariffplans/tutorial/Actions.csv b/data/tariffplans/tutorial/Actions.csv index 21b33371b..8bc071f08 100644 --- a/data/tariffplans/tutorial/Actions.csv +++ b/data/tariffplans/tutorial/Actions.csv @@ -1,9 +1,9 @@ -#ActionsTag,Action,BalanceType,Direction,Units,ExpiryTime,DestinationTag,RatingSubject,Category,BalanceWeight,SharedGroup,ExtraParameters,Weight -TOPUP_RST_10,*topup_reset,*monetary,*out,10,*unlimited,*any,,,10,,,10 -TOPUP_RST_5,*topup_reset,*monetary,*out,5,*unlimited,*any,,,20,,,10 -TOPUP_RST_5,*topup_reset,*voice,*out,90,*unlimited,DST_1002,SPECIAL_1002,,20,,,10 -TOPUP_RST_SHARED_5,*topup,*monetary,*out,5,*unlimited,*any,,,10,SHARED_A,,10 -SHARED_A_0,*topup_reset,*monetary,*out,0,*unlimited,*any,,,10,SHARED_A,,10 +#ActionsTag[0],Action[1],ExtraParameters[2],BalanceType[3],Direction[4],Category[5],DestinationTag[6],RatingSubject[7],SharedGroup[8],ExpiryTime[9],Units[10],BalanceWeight[11],Weight[12] +TOPUP_RST_10,*topup_reset,,*monetary,*out,,*any,,,*unlimited,10,10,10 +TOPUP_RST_5,*topup_reset,,*monetary,*out,,*any,,,*unlimited,5,20,10 +TOPUP_RST_5,*topup_reset,,*voice,*out,,DST_1002,SPECIAL_1002,,*unlimited,90,20,10 +TOPUP_RST_SHARED_5,*topup,,*monetary,*out,,*any,,SHARED_A,*unlimited,5,10,10 +SHARED_A_0,*topup_reset,,*monetary,*out,,*any,,SHARED_A,*unlimited,0,10,10 LOG_WARNING,*log,,,,,,,,,,,10 DISABLE_AND_LOG,*log,,,,,,,,,,,10 DISABLE_AND_LOG,*disable_account,,,,,,,,,,,10 diff --git a/engine/loader_csv.go b/engine/loader_csv.go index 8b48cffd1..c84c5d38c 100644 --- a/engine/loader_csv.go +++ b/engine/loader_csv.go @@ -654,46 +654,47 @@ func (csvr *CSVReader) LoadActions() (err error) { if fp != nil { defer fp.Close() } + fieldIndex := CSV_FIELD_INDEX[utils.ACTIONS_CSV] for record, err := csvReader.Read(); err == nil; record, err = csvReader.Read() { - tag := record[0] + tag := record[fieldIndex[utils.CSVFLD_ACTIONS_TAG]] var units float64 - if len(record[4]) == 0 { // Not defined + if len(record[fieldIndex[utils.CSVFLD_UNITS]]) == 0 { // Not defined units = 0.0 } else { - units, err = strconv.ParseFloat(record[4], 64) + units, err = strconv.ParseFloat(record[fieldIndex[utils.CSVFLD_UNITS]], 64) if err != nil { return fmt.Errorf("Could not parse action units: %v", err) } } var balanceWeight float64 - if len(record[9]) == 0 { // Not defined + if len(record[fieldIndex[utils.CSVFLD_BALANCE_WEIGHT]]) == 0 { // Not defined balanceWeight = 0.0 } else { - balanceWeight, err = strconv.ParseFloat(record[9], 64) + balanceWeight, err = strconv.ParseFloat(record[fieldIndex[utils.CSVFLD_BALANCE_WEIGHT]], 64) if err != nil { return fmt.Errorf("Could not parse action balance weight: %v", err) } } - weight, err := strconv.ParseFloat(record[12], 64) + weight, err := strconv.ParseFloat(record[fieldIndex[utils.CSVFLD_WEIGHT]], 64) if err != nil { return fmt.Errorf("Could not parse action weight: %v", err) } a := &Action{ Id: utils.GenUUID(), - ActionType: record[1], - BalanceType: record[2], - Direction: record[3], + ActionType: record[fieldIndex[utils.CSVFLD_ACTION]], + BalanceType: record[fieldIndex[utils.CSVFLD_BALANCE_TYPE]], + Direction: record[fieldIndex[utils.CSVFLD_DIRECTION]], Weight: weight, - ExpirationString: record[5], - ExtraParameters: record[11], + ExpirationString: record[fieldIndex[utils.CSVFLD_EXPIRY_TIME]], + ExtraParameters: record[fieldIndex[utils.CSVFLD_EXTRA_PARAMS]], Balance: &Balance{ Uuid: utils.GenUUID(), Value: units, Weight: balanceWeight, - DestinationId: record[6], - RatingSubject: record[7], - Category: record[8], - SharedGroup: record[10], + DestinationId: record[fieldIndex[utils.CSVFLD_DESTINATION_TAG]], + RatingSubject: record[fieldIndex[utils.CSVFLD_RATING_SUBJECT]], + Category: record[fieldIndex[utils.CSVFLD_CATEGORY]], + SharedGroup: record[fieldIndex[utils.CSVFLD_SHARED_GROUP]], }, } if _, err := utils.ParseDate(a.ExpirationString); err != nil { diff --git a/engine/loader_csv_test.go b/engine/loader_csv_test.go index a707f8998..9832d9a62 100644 --- a/engine/loader_csv_test.go +++ b/engine/loader_csv_test.go @@ -140,16 +140,16 @@ SG3,*any,*lowest, ` actions = ` -MINI,*topup_reset,*monetary,*out,10,*unlimited,,,,10,,,10 -MINI,*topup,*voice,*out,100,*unlimited,NAT,test,,10,,,10 -SHARED,*topup,*monetary,*out,100,*unlimited,,,,10,SG1,,10 -TOPUP10_AC,*topup_reset,*monetary,*out,1,*unlimited,*any,,,10,,,10 -TOPUP10_AC1,*topup_reset,*voice,*out,40,*unlimited,DST_UK_Mobile_BIG5,discounted_minutes,,10,,,10 -SE0,*topup_reset,*monetary,*out,0,*unlimited,,,,10,SG2,,10 -SE10,*topup_reset,*monetary,*out,10,*unlimited,,,,5,SG2,,10 -SE10,*topup,*monetary,*out,10,*unlimited,,,,10,,,10 -EE0,*topup_reset,*monetary,*out,0,*unlimited,,,,10,SG3,,10 -EE0,*allow_negative,*monetary,*out,0,*unlimited,,,,10,,,10 +MINI,*topup_reset,,*monetary,*out,,,,,*unlimited,10,10,10 +MINI,*topup,,*voice,*out,,NAT,test,,*unlimited,100,10,10 +SHARED,*topup,,*monetary,*out,,,,SG1,*unlimited,100,10,10 +TOPUP10_AC,*topup_reset,,*monetary,*out,,*any,,,*unlimited,1,10,10 +TOPUP10_AC1,*topup_reset,,*voice,*out,,DST_UK_Mobile_BIG5,discounted_minutes,,*unlimited,40,10,10 +SE0,*topup_reset,,*monetary,*out,,,,SG2,*unlimited,0,10,10 +SE10,*topup_reset,,*monetary,*out,,,,SG2,*unlimited,10,5,10 +SE10,*topup,,*monetary,*out,,,,,*unlimited,10,10,10 +EE0,*topup_reset,,*monetary,*out,,,,SG3,*unlimited,0,10,10 +EE0,*allow_negative,,*monetary,*out,,,,,*unlimited,0,10,10 ` actionTimings = ` MORE_MINUTES,MINI,ONE_TIME_RUN,10 diff --git a/engine/loader_helpers.go b/engine/loader_helpers.go index 08c0f8257..d11851eb8 100644 --- a/engine/loader_helpers.go +++ b/engine/loader_helpers.go @@ -312,6 +312,26 @@ type FileLineRegexValidator struct { Message string // Pass this message as helper } +// Keep here the index reference for all the files, so we can use it as base for both loader and importer +//ToDo: Add the rest of the files +var CSV_FIELD_INDEX = map[string]map[string]int{ + utils.ACTIONS_CSV: map[string]int{ + utils.CSVFLD_ACTIONS_TAG: 0, + utils.CSVFLD_ACTION: 1, + utils.CSVFLD_EXTRA_PARAMS: 2, + utils.CSVFLD_BALANCE_TYPE: 3, + utils.CSVFLD_DIRECTION: 4, + utils.CSVFLD_CATEGORY: 5, + utils.CSVFLD_DESTINATION_TAG: 6, + utils.CSVFLD_RATING_SUBJECT: 7, + utils.CSVFLD_SHARED_GROUP: 8, + utils.CSVFLD_EXPIRY_TIME: 9, + utils.CSVFLD_UNITS: 10, + utils.CSVFLD_BALANCE_WEIGHT: 11, + utils.CSVFLD_WEIGHT: 12, + }, +} + var FileValidators = map[string]*FileLineRegexValidator{ utils.DESTINATIONS_CSV: &FileLineRegexValidator{utils.DESTINATIONS_NRCOLS, regexp.MustCompile(`(?:\w+\s*,\s*){1}(?:\+?\d+.?\d*){1}$`), @@ -335,8 +355,8 @@ var FileValidators = map[string]*FileLineRegexValidator{ regexp.MustCompile(`(?:\w+\s*),(?:\*?\w+\s*),(?:\*\w+\s*),(?:\*?\w]+\s*)?`), "Id([0-9A-Za-z_]),Account(*?[0-9A-Za-z_]),Strategy(*[0-9A-Za-z_]),RatingSubject(*?[0-9A-Za-z_])"}, utils.ACTIONS_CSV: &FileLineRegexValidator{utils.ACTIONS_NRCOLS, - regexp.MustCompile(`^(?:\w+\s*),(?:\*\w+\s*),(?:\*\w+\s*)?,(?:\*out\s*)?,(?:\d+\s*)?,(?:\*\w+\s*|\+\d+[smh]\s*|\d+\s*)?,(?:\*any|\w+\s*)?,(?:\*?\w+\s*)?,(?:\d+\.?\d*\s*)?,(?:\w+\s*)?,(?:\S+\s*)?,(?:\d+\.?\d*\s*)$`), - "Tag([0-9A-Za-z_]),Action([0-9A-Za-z_]),BalanceType([*a-z_]),Direction(*out),Units([0-9]),ExpiryTime(*[a-z_]|+[0-9][smh]|[0-9]),DestinationTag([0-9A-Za-z_]|*all),RatingSubject([0-9A-Za-z_]),BalanceWeight([0-9.]),ExtraParameters([0-9A-Za-z_:;]),Weight([0-9.])"}, + regexp.MustCompile(`^(?:\w+\s*),(?:\*\w+\s*),(?:\S+\s*)?,(?:\*\w+\s*)?,(?:\*out\s*)?,(?:\*?\w+\s*)?,(?:\*any|\w+\s*)?,(?:\w+\s*)?,(?:\w+\s*)?,(?:\*\w+\s*|\+\d+[smh]\s*|\d+\s*)?,(?:\d+\s*)?,(?:\d+\.?\d*\s*)?,(?:\d+\.?\d*\s*)$`), + "Tag([0-9A-Za-z_]),Action([0-9A-Za-z_]),ExtraParameters([0-9A-Za-z_:;]),BalanceType([*a-z_]),Direction(*out),Category([0-9A-Za-z_]),DestinationTag([0-9A-Za-z_]|*any),RatingSubject([0-9A-Za-z_]),SharedGroup([0-9A-Za-z_]),ExpiryTime(*[a-z_]|+[0-9][smh]|[0-9]),Units([0-9]),BalanceWeight([0-9.]),Weight([0-9.])"}, utils.ACTION_PLANS_CSV: &FileLineRegexValidator{utils.ACTION_PLANS_NRCOLS, regexp.MustCompile(`(?:\w+\s*,\s*){3}(?:\d+\.?\d*){1}`), "Tag([0-9A-Za-z_]),ActionsTag([0-9A-Za-z_]),TimingTag([0-9A-Za-z_]),Weight([0-9.])"}, diff --git a/engine/loader_helpers_test.go b/engine/loader_helpers_test.go index f1d2b3735..b78bc889f 100644 --- a/engine/loader_helpers_test.go +++ b/engine/loader_helpers_test.go @@ -61,13 +61,13 @@ DUMMY,INVALID;DATA *out,cgrates.org,call,subj1;alias1,2012-01-01T00:00:00Z,RP_RETAIL, ` -var actionsSample = `#ActionsTag,Action,BalanceType,Direction,Units,ExpiryTime,DestinationTag,RatingSubject,BalanceWeight,SharedGroup,ExtraParameters,Weight -PREPAID_10,*topup_reset,*monetary,*out,5,*unlimited,*any,,,10,,10 -WARN_HTTP,*call_url,,,,,,,,,http://localhost:8000,10 -LOG_BALANCE,*log,,,,,,,,,,10 +var actionsSample = `#ActionsTag[0],Action[1],ExtraParameters[2],BalanceType[3],Direction[4],Category[5],DestinationTag[6],RatingSubject[7],SharedGroup[8],ExpiryTime[9],Units[10],BalanceWeight[11],Weight[12] +PREPAID_10,*topup_reset,,*monetary,*out,,*any,,,*unlimited,5,10,10 +WARN_HTTP,*call_url,http://localhost:8000,,,,,,,,,,10 +LOG_BALANCE,*log,,,,,,,,,,,10 DUMMY,INVALID;DATA -PREPAID_10,*topup_reset,*monetary,*out,5,*unlimited,*any,,10,,10 -TOPUP_RST_SHARED_5,*topup_reset,*monetary,*out,5,*unlimited,*any,subj,20,SHARED_A,param&some,10 +PREPAID_10,*topup_reset,,*monetary,*out,,*any,,*unlimited,5,10,10 +TOPUP_RST_SHARED_5,*topup_reset,param&some,*monetary,*out,,*any,subj,SHARED_A,*unlimited,5,20,10 ` var actionTimingsSample = `#Tag,ActionsTag,TimingTag,Weight diff --git a/engine/tpimporter_csv.go b/engine/tpimporter_csv.go index 8323aaea9..b21d2e4b1 100644 --- a/engine/tpimporter_csv.go +++ b/engine/tpimporter_csv.go @@ -367,6 +367,7 @@ func (self *TPCSVImporter) importActions(fn string) error { if err != nil { return err } + fieldIndex := CSV_FIELD_INDEX[utils.ACTIONS_CSV] acts := make(map[string][]*utils.TPAction) lineNr := 0 for { @@ -380,16 +381,18 @@ func (self *TPCSVImporter) importActions(fn string) error { } continue } - actId, actionType, balanceType, direction, destTag, rateSubject, category, sharedGroup := record[0], record[1], record[2], record[3], record[6], record[7], record[8], record[10] - units, err := strconv.ParseFloat(record[4], 64) - if err != nil && record[4] != "" { + actId, actionType, balanceType, direction, destTag, rateSubject, category, sharedGroup := record[fieldIndex[utils.CSVFLD_ACTIONS_TAG]], record[fieldIndex[utils.CSVFLD_ACTION]], + record[fieldIndex[utils.CSVFLD_BALANCE_TYPE]], record[fieldIndex[utils.CSVFLD_DIRECTION]], record[fieldIndex[utils.CSVFLD_DESTINATION_TAG]], record[fieldIndex[utils.CSVFLD_RATING_SUBJECT]], + record[fieldIndex[utils.CSVFLD_CATEGORY]], record[fieldIndex[utils.CSVFLD_SHARED_GROUP]] + units, err := strconv.ParseFloat(record[fieldIndex[utils.CSVFLD_UNITS]], 64) + if err != nil && record[fieldIndex[utils.CSVFLD_UNITS]] != "" { if self.Verbose { log.Printf("Ignoring line %d, warning: <%s> ", lineNr, err.Error()) } continue } - balanceWeight, _ := strconv.ParseFloat(record[9], 64) - weight, err := strconv.ParseFloat(record[12], 64) + balanceWeight, _ := strconv.ParseFloat(record[fieldIndex[utils.CSVFLD_BALANCE_WEIGHT]], 64) + weight, err := strconv.ParseFloat(record[fieldIndex[utils.CSVFLD_WEIGHT]], 64) if err != nil { if self.Verbose { log.Printf("Ignoring line %d, warning: <%s> ", lineNr, err.Error()) @@ -410,7 +413,7 @@ func (self *TPCSVImporter) importActions(fn string) error { Category: category, SharedGroup: sharedGroup, BalanceWeight: balanceWeight, - ExtraParameters: record[11], + ExtraParameters: record[fieldIndex[utils.CSVFLD_EXTRA_PARAMS]], Weight: weight, }) } diff --git a/general_tests/ddazmbl1_test.go b/general_tests/ddazmbl1_test.go index 10dd86601..0f8540a6a 100644 --- a/general_tests/ddazmbl1_test.go +++ b/general_tests/ddazmbl1_test.go @@ -52,8 +52,8 @@ RP_UK,DR_UK_Mobile_BIG5,ALWAYS,10` *out,cgrates.org,call,discounted_minutes,2013-01-06T00:00:00Z,RP_UK_Mobile_BIG5_PKG,` sharedGroups := `` lcrs := `` - actions := `TOPUP10_AC,*topup_reset,*monetary,*out,10,*unlimited,*any,,,10,,,10 -TOPUP10_AC1,*topup_reset,*voice,*out,40,*unlimited,DST_UK_Mobile_BIG5,discounted_minutes,,10,,,10` + actions := `TOPUP10_AC,*topup_reset,,*monetary,*out,,*any,,,*unlimited,10,10,10 +TOPUP10_AC1,*topup_reset,,*voice,*out,,DST_UK_Mobile_BIG5,discounted_minutes,,*unlimited,40,10,10` actionPlans := `TOPUP10_AT,TOPUP10_AC,ASAP,10 TOPUP10_AT,TOPUP10_AC1,ASAP,10` actionTriggers := `` diff --git a/general_tests/ddazmbl2_test.go b/general_tests/ddazmbl2_test.go index 93d3bda97..159d3ad62 100644 --- a/general_tests/ddazmbl2_test.go +++ b/general_tests/ddazmbl2_test.go @@ -52,8 +52,8 @@ RP_UK,DR_UK_Mobile_BIG5,ALWAYS,10` *out,cgrates.org,call,discounted_minutes,2013-01-06T00:00:00Z,RP_UK_Mobile_BIG5_PKG,` sharedGroups := `` lcrs := `` - actions := `TOPUP10_AC,*topup_reset,*monetary,*out,0,*unlimited,*any,,,10,,,10 -TOPUP10_AC1,*topup_reset,*voice,*out,40,*unlimited,DST_UK_Mobile_BIG5,discounted_minutes,,10,,,10` + actions := `TOPUP10_AC,*topup_reset,,*monetary,*out,,*any,,,*unlimited,0,10,10 +TOPUP10_AC1,*topup_reset,,*voice,*out,,DST_UK_Mobile_BIG5,discounted_minutes,,*unlimited,40,10,10` actionPlans := `TOPUP10_AT,TOPUP10_AC,ASAP,10 TOPUP10_AT,TOPUP10_AC1,ASAP,10` actionTriggers := `` diff --git a/general_tests/ddazmbl3_test.go b/general_tests/ddazmbl3_test.go index 964b0d602..ced11790f 100644 --- a/general_tests/ddazmbl3_test.go +++ b/general_tests/ddazmbl3_test.go @@ -52,7 +52,7 @@ RP_UK,DR_UK_Mobile_BIG5,ALWAYS,10` *out,cgrates.org,call,discounted_minutes,2013-01-06T00:00:00Z,RP_UK_Mobile_BIG5_PKG,` sharedGroups := `` lcrs := `` - actions := `TOPUP10_AC1,*topup_reset,*voice,*out,40,*unlimited,DST_UK_Mobile_BIG5,discounted_minutes,,10,,,10` + actions := `TOPUP10_AC1,*topup_reset,,*voice,*out,,DST_UK_Mobile_BIG5,discounted_minutes,,*unlimited,40,10,10` actionPlans := `TOPUP10_AT,TOPUP10_AC1,ASAP,10` actionTriggers := `` accountActions := `cgrates.org,12346,*out,TOPUP10_AT,` diff --git a/general_tests/tutorial_local_test.go b/general_tests/tutorial_local_test.go index c252c3a5d..b909b800f 100644 --- a/general_tests/tutorial_local_test.go +++ b/general_tests/tutorial_local_test.go @@ -19,7 +19,6 @@ along with this program. If not, see package general_tests import ( - "log" "net/rpc" "net/rpc/jsonrpc" "os/exec" @@ -36,15 +35,16 @@ var tutCfgPath string var tutCfg *config.CGRConfig var tutRpc *rpc.Client -func init() { +func TestInitCfg(t *testing.T) { if !*testLocal { return } + // Init config first tutCfgPath = path.Join(*dataDir, "conf", "samples", "tutorial_local_test.cfg") var err error tutCfg, err = config.NewCGRConfigFromFile(&tutCfgPath) if err != nil { - log.Print("ERROR: ", err) + t.Error(err) } tutCfg.DataFolderPath = *dataDir // Share DataFolderPath through config towards StoreDb for Flush() config.SetCgrConfig(tutCfg) diff --git a/utils/consts.go b/utils/consts.go index b36d486aa..c16a3a32a 100644 --- a/utils/consts.go +++ b/utils/consts.go @@ -53,6 +53,19 @@ const ( ACCOUNT_ACTIONS_CSV = "AccountActions.csv" DERIVED_CHARGERS_CSV = "DerivedChargers.csv" CDR_STATS_CSV = "CdrStats.csv" + CSVFLD_ACTIONS_TAG = "ActionsTag" + CSVFLD_ACTION = "Action" + CSVFLD_EXTRA_PARAMS = "ExtraParameters" + CSVFLD_BALANCE_TYPE = "BalanceType" + CSVFLD_DIRECTION = "Direction" + CSVFLD_CATEGORY = "Category" + CSVFLD_DESTINATION_TAG = "DestinationTag" + CSVFLD_RATING_SUBJECT = "RatingSubject" + CSVFLD_SHARED_GROUP = "SharedGroup" + CSVFLD_EXPIRY_TIME = "ExpiryTime" + CSVFLD_UNITS = "Units" + CSVFLD_BALANCE_WEIGHT = "BalanceWeight" + CSVFLD_WEIGHT = "Weight" TIMINGS_NRCOLS = 6 DESTINATIONS_NRCOLS = 2 RATES_NRCOLS = 6