rating profile order + fix general tests

This commit is contained in:
Radu Ioan Fericean
2014-04-25 20:49:44 +03:00
parent bc94fe34d1
commit 6526e52603
7 changed files with 33 additions and 32 deletions

View File

@@ -183,6 +183,7 @@ CREATE TABLE `tp_action_triggers` (
`direction` varchar(8) NOT NULL,
`threshold_type` char(12) NOT NULL,
`threshold_value` double(20,4) NOT NULL,
`recurrent` bool NOT NULL,
`destination_id` varchar(64) NOT NULL,
`actions_id` varchar(64) NOT NULL,
`weight` double(8,2) NOT NULL,
@@ -219,9 +220,9 @@ CREATE TABLE tp_derived_chargers (
tbid int(11) NOT NULL AUTO_INCREMENT,
tpid varchar(64) NOT NULL,
loadid varchar(64) NOT NULL,
direction varchar(8) NOT NULL,
tenant varchar(64) NOT NULL,
tor varchar(16) NOT NULL,
direction varchar(8) NOT NULL,
account varchar(24) NOT NULL,
subject varchar(64) NOT NULL,
runid_field varchar(24) NOT NULL,
@@ -237,4 +238,4 @@ CREATE TABLE tp_derived_chargers (
duration_field varchar(24) NOT NULL,
PRIMARY KEY (`tbid`),
KEY `tpid` (`tpid`)
);
);

View File

@@ -483,7 +483,7 @@ func (csvr *CSVReader) LoadRatingProfiles() (err error) {
defer fp.Close()
}
for record, err := csvReader.Read(); err == nil; record, err = csvReader.Read() {
tenant, tor, direction, subject, fallbacksubject := record[0], record[1], record[2], record[3], record[6]
direction, tenant, tor, subject, fallbacksubject := record[0], record[1], record[2], record[3], record[6]
at, err := utils.ParseDate(record[4])
if err != nil {
return fmt.Errorf("Cannot parse activation time from %v", record[4])

View File

@@ -110,25 +110,25 @@ RP_UK,DR_UK_Mobile_BIG5,ALWAYS,10
RP_DATA,DATA_RATE,ALWAYS,10
`
ratingProfiles = `
CUSTOMER_1,0,*out,rif:from:tm,2012-01-01T00:00:00Z,PREMIUM,danb
CUSTOMER_1,0,*out,rif:from:tm,2012-02-28T00:00:00Z,STANDARD,danb
CUSTOMER_2,0,*out,danb:87.139.12.167,2012-01-01T00:00:00Z,STANDARD,danb
CUSTOMER_1,0,*out,danb,2012-01-01T00:00:00Z,PREMIUM,
vdf,0,*out,rif,2012-01-01T00:00:00Z,EVENING,
vdf,0,*out,rif,2012-02-28T00:00:00Z,EVENING,
vdf,0,*out,minu;a1;a2;a3,2012-01-01T00:00:00Z,EVENING,
vdf,0,*out,*any,2012-02-28T00:00:00Z,EVENING,
vdf,0,*out,one,2012-02-28T00:00:00Z,STANDARD,
vdf,0,*out,inf,2012-02-28T00:00:00Z,STANDARD,inf
vdf,0,*out,fall,2012-02-28T00:00:00Z,PREMIUM,rif
test,0,*out,trp,2013-10-01T00:00:00Z,TDRT,rif;danb
vdf,0,*out,fallback1,2013-11-18T13:45:00Z,G,fallback2
vdf,0,*out,fallback1,2013-11-18T13:46:00Z,G,fallback2
vdf,0,*out,fallback1,2013-11-18T13:47:00Z,G,fallback2
vdf,0,*out,fallback2,2013-11-18T13:45:00Z,R,rif
cgrates.org,call,*out,*any,2013-01-06T00:00:00Z,RP_UK,
cgrates.org,call,*out,discounted_minutes,2013-01-06T00:00:00Z,RP_UK_Mobile_BIG5_PKG,
cgrates.org,data,*out,rif,2013-01-06T00:00:00Z,RP_DATA,
*out,CUSTOMER_1,0,rif:from:tm,2012-01-01T00:00:00Z,PREMIUM,danb
*out,CUSTOMER_1,0,rif:from:tm,2012-02-28T00:00:00Z,STANDARD,danb
*out,CUSTOMER_2,0,danb:87.139.12.167,2012-01-01T00:00:00Z,STANDARD,danb
*out,CUSTOMER_1,0,danb,2012-01-01T00:00:00Z,PREMIUM,
*out,vdf,0,rif,2012-01-01T00:00:00Z,EVENING,
*out,vdf,0,rif,2012-02-28T00:00:00Z,EVENING,
*out,vdf,0,minu;a1;a2;a3,2012-01-01T00:00:00Z,EVENING,
*out,vdf,0,*any,2012-02-28T00:00:00Z,EVENING,
*out,vdf,0,one,2012-02-28T00:00:00Z,STANDARD,
*out,vdf,0,inf,2012-02-28T00:00:00Z,STANDARD,inf
*out,vdf,0,fall,2012-02-28T00:00:00Z,PREMIUM,rif
*out,test,0,trp,2013-10-01T00:00:00Z,TDRT,rif;danb
*out,vdf,0,fallback1,2013-11-18T13:45:00Z,G,fallback2
*out,vdf,0,fallback1,2013-11-18T13:46:00Z,G,fallback2
*out,vdf,0,fallback1,2013-11-18T13:47:00Z,G,fallback2
*out,vdf,0,fallback2,2013-11-18T13:45:00Z,R,rif
*out,cgrates.org,call,*any,2013-01-06T00:00:00Z,RP_UK,
*out,cgrates.org,call,discounted_minutes,2013-01-06T00:00:00Z,RP_UK_Mobile_BIG5_PKG,
*out,cgrates.org,data,rif,2013-01-06T00:00:00Z,RP_DATA,
`
sharedGroups = `
SG1,*any,*lowest,

View File

@@ -1004,7 +1004,7 @@ func (self *SQLStorage) GetTpRatingPlans(tpid, tag string) (map[string][]*utils.
}
func (self *SQLStorage) GetTpRatingProfiles(qryRpf *utils.TPRatingProfile) (map[string]*utils.TPRatingProfile, error) {
q := fmt.Sprintf("SELECT loadid,tenant,tor,direction,subject,activation_time,rating_plan_id,fallback_subjects FROM %s WHERE tpid='%s'",
q := fmt.Sprintf("SELECT loadid,direction,tenant,tor,subject,activation_time,rating_plan_id,fallback_subjects FROM %s WHERE tpid='%s'",
utils.TBL_TP_RATE_PROFILES, qryRpf.TPid)
if len(qryRpf.LoadId) != 0 {
q += fmt.Sprintf(" AND loadid='%s'", qryRpf.LoadId)

View File

@@ -48,11 +48,11 @@ RT_UK_Mobile_BIG5,0.01,0.10,1s,1s,0s,*up,8`
DR_UK_Mobile_BIG5,DST_UK_Mobile_BIG5,RT_UK_Mobile_BIG5`
ratingPlans := `RP_UK_Mobile_BIG5_PKG,DR_UK_Mobile_BIG5_PKG,ALWAYS,10
RP_UK,DR_UK_Mobile_BIG5,ALWAYS,10`
ratingProfiles := `cgrates.org,call,*out,*any,2013-01-06T00:00:00Z,RP_UK,
cgrates.org,call,*out,discounted_minutes,2013-01-06T00:00:00Z,RP_UK_Mobile_BIG5_PKG,`
ratingProfiles := `*out,cgrates.org,call,*any,2013-01-06T00:00:00Z,RP_UK,
*out,cgrates.org,call,discounted_minutes,2013-01-06T00:00:00Z,RP_UK_Mobile_BIG5_PKG,`
sharedGroups := ``
actions := `TOPUP10_AC,*topup_reset,*monetary,*out,10,*unlimited,*any,,10,,,10
TOPUP10_AC1,*topup_reset,*minutes,*out,40,*unlimited,DST_UK_Mobile_BIG5,discounted_minutes,10,,,10`
TOPUP10_AC1,*topup_reset,*call_duration,*out,40,*unlimited,DST_UK_Mobile_BIG5,discounted_minutes,10,,,10`
actionPlans := `TOPUP10_AT,TOPUP10_AC,ASAP,10
TOPUP10_AT,TOPUP10_AC1,ASAP,10`
actionTriggers := ``

View File

@@ -48,11 +48,11 @@ RT_UK_Mobile_BIG5,0.01,0.10,1s,1s,0s,*up,8`
DR_UK_Mobile_BIG5,DST_UK_Mobile_BIG5,RT_UK_Mobile_BIG5`
ratingPlans := `RP_UK_Mobile_BIG5_PKG,DR_UK_Mobile_BIG5_PKG,ALWAYS,10
RP_UK,DR_UK_Mobile_BIG5,ALWAYS,10`
ratingProfiles := `cgrates.org,call,*out,*any,2013-01-06T00:00:00Z,RP_UK,
cgrates.org,call,*out,discounted_minutes,2013-01-06T00:00:00Z,RP_UK_Mobile_BIG5_PKG,`
ratingProfiles := `*out,cgrates.org,call,*any,2013-01-06T00:00:00Z,RP_UK,
*out,cgrates.org,call,discounted_minutes,2013-01-06T00:00:00Z,RP_UK_Mobile_BIG5_PKG,`
sharedGroups := ``
actions := `TOPUP10_AC,*topup_reset,*monetary,*out,0,*unlimited,*any,,10,,,10
TOPUP10_AC1,*topup_reset,*minutes,*out,40,*unlimited,DST_UK_Mobile_BIG5,discounted_minutes,10,,,10`
TOPUP10_AC1,*topup_reset,*call_duration,*out,40,*unlimited,DST_UK_Mobile_BIG5,discounted_minutes,10,,,10`
actionPlans := `TOPUP10_AT,TOPUP10_AC,ASAP,10
TOPUP10_AT,TOPUP10_AC1,ASAP,10`
actionTriggers := ``

View File

@@ -48,10 +48,10 @@ RT_UK_Mobile_BIG5,0.01,0.10,1s,1s,0s,*up,8`
DR_UK_Mobile_BIG5,DST_UK_Mobile_BIG5,RT_UK_Mobile_BIG5`
ratingPlans := `RP_UK_Mobile_BIG5_PKG,DR_UK_Mobile_BIG5_PKG,ALWAYS,10
RP_UK,DR_UK_Mobile_BIG5,ALWAYS,10`
ratingProfiles := `cgrates.org,call,*out,*any,2013-01-06T00:00:00Z,RP_UK,
cgrates.org,call,*out,discounted_minutes,2013-01-06T00:00:00Z,RP_UK_Mobile_BIG5_PKG,`
ratingProfiles := `*out,cgrates.org,call,*any,2013-01-06T00:00:00Z,RP_UK,
*out,cgrates.org,call,discounted_minutes,2013-01-06T00:00:00Z,RP_UK_Mobile_BIG5_PKG,`
sharedGroups := ``
actions := `TOPUP10_AC1,*topup_reset,*minutes,*out,40,*unlimited,DST_UK_Mobile_BIG5,discounted_minutes,10,,,10`
actions := `TOPUP10_AC1,*topup_reset,*call_duration,*out,40,*unlimited,DST_UK_Mobile_BIG5,discounted_minutes,10,,,10`
actionPlans := `TOPUP10_AT,TOPUP10_AC1,ASAP,10`
actionTriggers := ``
accountActions := `cgrates.org,12345,*out,TOPUP10_AT,`