From 0fbd76abea8275569827d4730f8a6ebb5ed989d4 Mon Sep 17 00:00:00 2001 From: DanB Date: Mon, 1 Sep 2014 12:28:50 +0200 Subject: [PATCH] Fix ActionTriggers to load Category from tariffplans folder --- data/tariffplans/tutorial/ActionTriggers.csv | 2 +- engine/loader_helpers.go | 4 ++-- engine/loader_helpers_test.go | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/data/tariffplans/tutorial/ActionTriggers.csv b/data/tariffplans/tutorial/ActionTriggers.csv index ef047da20..e9398ccab 100644 --- a/data/tariffplans/tutorial/ActionTriggers.csv +++ b/data/tariffplans/tutorial/ActionTriggers.csv @@ -1,6 +1,6 @@ #Tag,BalanceTag,Direction,ThresholdType,ThresholdValue,Recurrent,MinSleep,BalanceDestinationTag,BalanceWeight,BalanceExpiryTime,BalanceRatingSubject,BalanceCategory,BalanceSharedGroup,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_counter,5,false,0,FS_USERS,,,,,,,LOG_WARNING,10 STANDARD_TRIGGERS,*monetary,*out,*max_balance,20,false,0,,,,,,,,LOG_WARNING,10 STANDARD_TRIGGERS,*monetary,*out,*max_balance,100,false,0,,,,,,,,DISABLE_AND_LOG,10 CDRST1_WARN,,,*min_asr,45,true,1m,,,,,,,3,LOG_WARNING,10 diff --git a/engine/loader_helpers.go b/engine/loader_helpers.go index 007375f6d..327d14009 100644 --- a/engine/loader_helpers.go +++ b/engine/loader_helpers.go @@ -340,8 +340,8 @@ var FileValidators = map[string]*FileLineRegexValidator{ 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.])"}, - utils.ACTION_TRIGGERS_CSV: &FileLineRegexValidator{utils.ACTION_TRIGGERS_NRCOLS, regexp.MustCompile(`(?:\w+),(?:\*\w+)?,(?:\*out)?,(?:\*\w+),(?:\d+\.?\d*),(?:true|false)?,(?:\d+[smh]?),(?:\w+|\*any)?,(?:\d+\.?\d*)?,(?:\*\w+\s*|\+\d+[smh]\s*|\d+\s*)?,(?:\w+|\*any)?,(?:\w+|\*any)?,(?:\d+)?,(?:\w+),(?:\d+\.?\d*)$`), - "Tag([0-9A-Za-z_]),BalanceType(*[a-z_]),Direction(*out),ThresholdType(*[a-z_]),ThresholdValue([0-9]+),Recurrent(true|false),MinSleep([0-9]+)?,BalanceDestinationTag([0-9A-Za-z_]|*all),BalanceWeight(*[a-z_]),BalanceExpiryTime(*[a-z_]|+[0-9][smh]|[0-9]),BalanceRatingSubject(*[a-z_]),BalanceSharedGroup(*[a-z_]),StatsMinQueuedItems([0-9]+),ActionsTag([0-9A-Za-z_]),Weight([0-9]+)"}, + utils.ACTION_TRIGGERS_CSV: &FileLineRegexValidator{utils.ACTION_TRIGGERS_NRCOLS, regexp.MustCompile(`(?:\w+),(?:\*\w+)?,(?:\*out)?,(?:\*\w+),(?:\d+\.?\d*),(?:true|false)?,(?:\d+[smh]?),(?:\w+|\*any)?,(?:\d+\.?\d*)?,(?:\*\w+\s*|\+\d+[smh]\s*|\d+\s*)?,(?:\w+|\*any)?,(?:\w+|\*any)?,(?:\w+|\*any)?,(?:\d+)?,(?:\w+),(?:\d+\.?\d*)$`), + "Tag([0-9A-Za-z_]),BalanceType(*[a-z_]),Direction(*out),ThresholdType(*[a-z_]),ThresholdValue([0-9]+),Recurrent(true|false),MinSleep([0-9]+)?,BalanceDestinationTag([0-9A-Za-z_]|*all),BalanceWeight(*[a-z_]),BalanceExpiryTime(*[a-z_]|+[0-9][smh]|[0-9]),BalanceRatingSubject(*[a-z_]),BalanceCategory([a-z_]),BalanceSharedGroup(*[a-z_]),StatsMinQueuedItems([0-9]+),ActionsTag([0-9A-Za-z_]),Weight([0-9]+)"}, utils.ACCOUNT_ACTIONS_CSV: &FileLineRegexValidator{utils.ACCOUNT_ACTIONS_NRCOLS, regexp.MustCompile(`(?:\w+\s*),(?:(\w+;?)+\s*),(?:\*out\s*),(?:\w+\s*),(?:\w+\s*)$`), "Tenant([0-9A-Za-z_]),Account([0-9A-Za-z_.]),Direction(*out),ActionTimingsTag([0-9A-Za-z_]),ActionTriggersTag([0-9A-Za-z_])"}, diff --git a/engine/loader_helpers_test.go b/engine/loader_helpers_test.go index b36a0311b..f1d2b3735 100644 --- a/engine/loader_helpers_test.go +++ b/engine/loader_helpers_test.go @@ -75,11 +75,11 @@ PREPAID_10,PREPAID_10,ASAP,10 DUMMY,INVALID;DATA ` -var actionTriggersSample = `#Tag,BalanceTag,Direction,ThresholdType,ThresholdValue,Recurrent,MinSleep,BalanceDestinationTag,BalanceWeight,BalanceExpiryTime,BalanceRatingSubject,BalanceSharedGroup,StatsMinQueuedItems,ActionsTag,Weight -STANDARD_TRIGGERS,*monetary,*out,*min_balance,2,false,0,,,,,,,LOG_WARNING,10 -STANDARD_TRIGGERS,*monetary,*out,*max_balance,20,false,0,,,,,,,LOG_WARNING,10 -STANDARD_TRIGGERS,*monetary,*out,*max_counter,15,false,0,FS_USERS,,,,,,LOG_WARNING,10 -CDRST1_WARN_ASR,,,*min_asr,45,true,1h,,,,,,3,CDRST_WARN_HTTP,10 +var actionTriggersSample = `#Tag,BalanceTag,Direction,ThresholdType,ThresholdValue,Recurrent,MinSleep,BalanceDestinationTag,BalanceWeight,BalanceExpiryTime,BalanceRatingSubject,BalanceCategory,BalanceSharedGroup,StatsMinQueuedItems,ActionsTag,Weight +STANDARD_TRIGGERS,*monetary,*out,*min_balance,2,false,0,,,,,,,,LOG_WARNING,10 +STANDARD_TRIGGERS,*monetary,*out,*max_balance,20,false,0,,,,,,,,LOG_WARNING,10 +STANDARD_TRIGGERS,*monetary,*out,*max_counter,15,false,0,FS_USERS,,,,,,,LOG_WARNING,10 +CDRST1_WARN_ASR,,,*min_asr,45,true,1h,,,,,,,3,CDRST_WARN_HTTP,10 DUMMY,INVALID;DATA `