From 2e80f8a1f410f40653634f00450827fc2a576fa2 Mon Sep 17 00:00:00 2001 From: DanB Date: Mon, 17 Mar 2014 15:58:33 +0100 Subject: [PATCH] Fixup sharedGroup number of columns --- .../fs_json/cgrates/tariffplans/AccountActions.csv | 9 +++++---- .../fs_json/cgrates/tariffplans/ActionPlans.csv | 5 ++++- data/tutorials/fs_json/cgrates/tariffplans/Actions.csv | 5 ++++- engine/loader_csv_test.go | 4 ++-- engine/loader_helpers.go | 2 +- engine/loader_helpers_test.go | 1 + utils/consts.go | 2 +- 7 files changed, 18 insertions(+), 10 deletions(-) diff --git a/data/tutorials/fs_json/cgrates/tariffplans/AccountActions.csv b/data/tutorials/fs_json/cgrates/tariffplans/AccountActions.csv index e00c681bf..4a8ecc33e 100644 --- a/data/tutorials/fs_json/cgrates/tariffplans/AccountActions.csv +++ b/data/tutorials/fs_json/cgrates/tariffplans/AccountActions.csv @@ -1,5 +1,6 @@ #Tenant,Account,Direction,ActionPlanTag,ActionTriggersTag -cgrates.org,1001,*out,PREPAID_10,STANDARD_TRIGGERS -cgrates.org,1002,*out,PREPAID_10,STANDARD_TRIGGERS -cgrates.org,1003,*out,PREPAID_10,STANDARD_TRIGGERS -cgrates.org,1004,*out,PREPAID_10,STANDARD_TRIGGERS +cgrates.org,1001,*out,PACKAGE_10_SHARED_A_5,STANDARD_TRIGGERS +cgrates.org,1002;1006,*out,PACKAGE_10,STANDARD_TRIGGERS +cgrates.org,1003,*out,PACKAGE_10,STANDARD_TRIGGERS +cgrates.org,1004,*out,PACKAGE_10,STANDARD_TRIGGERS +cgrates.org,1007,*out,USE_SHARED_A,STANDARD_TRIGGERS diff --git a/data/tutorials/fs_json/cgrates/tariffplans/ActionPlans.csv b/data/tutorials/fs_json/cgrates/tariffplans/ActionPlans.csv index 24f63c8a8..5a16843ee 100644 --- a/data/tutorials/fs_json/cgrates/tariffplans/ActionPlans.csv +++ b/data/tutorials/fs_json/cgrates/tariffplans/ActionPlans.csv @@ -1,2 +1,5 @@ #Tag,ActionsTag,TimingTag,Weight -PREPAID_10,PREPAID_10,ASAP,10 +PACKAGE_10,TOPUP_RST_10,ASAP,10 +PACKAGE_10_SHAREDA_5,TOPUP_RST_5,ASAP,10 +PACKAGE_10_SHAREDA_5,TOPUP_RST_SHARED_5,ASAP,10 +USE_SHARED_A,SHARED_A_0,ASAP,10 diff --git a/data/tutorials/fs_json/cgrates/tariffplans/Actions.csv b/data/tutorials/fs_json/cgrates/tariffplans/Actions.csv index 103d4070f..f91f6beaf 100644 --- a/data/tutorials/fs_json/cgrates/tariffplans/Actions.csv +++ b/data/tutorials/fs_json/cgrates/tariffplans/Actions.csv @@ -1,3 +1,6 @@ #ActionsTag,Action,BalanceType,Direction,Units,ExpiryTime,DestinationTag,RatingSubject,BalanceWeight,SharedGroup,ExtraParameters,Weight -PREPAID_10,*topup_reset,*monetary,*out,10,*unlimited,*any,,10,,,10 +TOPUP_RST_10,*topup_reset,*monetary,*out,10,*unlimited,*any,,10,,,10 +TOPUP_RST_5,*topup_reset,*monetary,*out,5,*unlimited,*any,,10,,,10 +TOPUP_RST_SHARED_5,*topup_reset,*monetary,*out,5,*unlimited,*any,,20,SHARED_A,,10 +SHARED_A_0,*topup_reset,*monetary,*out,0,*unlimited,*any,,10,SHARED_A,,10 LOG_WARNING,*log,,,,,,,,,,10 diff --git a/engine/loader_csv_test.go b/engine/loader_csv_test.go index b59e18451..635beb09a 100644 --- a/engine/loader_csv_test.go +++ b/engine/loader_csv_test.go @@ -122,8 +122,8 @@ cgrates.directvoip.co.uk,call,*out,*any,2013-01-06T00:00:00Z,RP_UK, cgrates.directvoip.co.uk,call,*out,discounted_minutes,2013-01-06T00:00:00Z,RP_UK_Mobile_BIG5_PKG, ` sharedGroups = ` -SG1,*any,*lowest_first,, -SG2,*any,*lowest_first,EVENING, +SG1,*any,*lowest_first, +SG2,*any,*lowest_first,EVENING ` actions = ` diff --git a/engine/loader_helpers.go b/engine/loader_helpers.go index 5bc2faff2..352e6fbe6 100644 --- a/engine/loader_helpers.go +++ b/engine/loader_helpers.go @@ -203,7 +203,7 @@ var FileValidators = map[string]*FileLineRegexValidator{ regexp.MustCompile(``), ""}, 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*)?,(?:\w+\s*)?,(?:\d+\.?\d*\s*)?,(?:\S+\s*)?,(?:\d+\.?\d*\s*)$`), + 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.])"}, utils.ACTION_PLANS_CSV: &FileLineRegexValidator{utils.ACTION_PLANS_NRCOLS, regexp.MustCompile(`(?:\w+\s*,\s*){3}(?:\d+\.?\d*){1}`), diff --git a/engine/loader_helpers_test.go b/engine/loader_helpers_test.go index 82a014296..dd5c0727e 100644 --- a/engine/loader_helpers_test.go +++ b/engine/loader_helpers_test.go @@ -63,6 +63,7 @@ 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 ` var actionTimingsSample = `#Tag,ActionsTag,TimingTag,Weight diff --git a/utils/consts.go b/utils/consts.go index cdf62b3d1..e13abb31d 100644 --- a/utils/consts.go +++ b/utils/consts.go @@ -52,7 +52,7 @@ const ( DESTINATION_RATES_NRCOLS = 3 DESTRATE_TIMINGS_NRCOLS = 4 RATE_PROFILES_NRCOLS = 7 - SHARED_GROUPS_NRCOLS = 5 + SHARED_GROUPS_NRCOLS = 4 ACTIONS_NRCOLS = 12 ACTION_PLANS_NRCOLS = 4 ACTION_TRIGGERS_NRCOLS = 8