mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Modified Actions.csv fields order to make easier it's understanding
This commit is contained in:
@@ -15,6 +15,7 @@ store_disable = true
|
||||
[mediator]
|
||||
enabled = true
|
||||
store_disable = true
|
||||
cdrstats = internal
|
||||
|
||||
[cdrstats]
|
||||
enabled = true
|
||||
|
||||
@@ -20,6 +20,7 @@ export_dir = /tmp # Path where the exported CDRs will be placed
|
||||
|
||||
[mediator]
|
||||
enabled = true # Starts Mediator service: <true|false>.
|
||||
cdrstats = internal
|
||||
|
||||
[cdrstats]
|
||||
enabled = true # Starts the cdrstats service: <true|false>
|
||||
@@ -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
|
||||
|
||||
|
@@ -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
|
||||
|
||||
|
@@ -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
|
||||
|
||||
|
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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.])"},
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -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 := ``
|
||||
|
||||
@@ -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 := ``
|
||||
|
||||
@@ -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,`
|
||||
|
||||
@@ -19,7 +19,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
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)
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user