Removing unused LCRPrefixMatching from RALs config

This commit is contained in:
DanB
2019-02-09 18:39:41 +01:00
parent 17c777c1bf
commit d7d9856cc2
7 changed files with 41 additions and 57 deletions

View File

@@ -1380,7 +1380,6 @@ func main() {
// Done initing DBs
engine.SetRoundingDecimals(cfg.GeneralCfg().RoundingDecimals)
engine.SetRpSubjectPrefixMatching(cfg.RalsCfg().RpSubjectPrefixMatching)
engine.SetLcrSubjectPrefixMatching(cfg.RalsCfg().LcrSubjectPrefixMatching)
stopHandled := false
// Rpc/http server

View File

@@ -227,14 +227,13 @@ func TestDfStorDBJsonCfg(t *testing.T) {
func TestDfRalsJsonCfg(t *testing.T) {
eCfg := &RalsJsonCfg{
Enabled: utils.BoolPointer(false),
Thresholds_conns: &[]*HaPoolJsonCfg{},
Stats_conns: &[]*HaPoolJsonCfg{},
Pubsubs_conns: &[]*HaPoolJsonCfg{},
Users_conns: &[]*HaPoolJsonCfg{},
Aliases_conns: &[]*HaPoolJsonCfg{},
Rp_subject_prefix_matching: utils.BoolPointer(false),
Lcr_subject_prefix_matching: utils.BoolPointer(false),
Enabled: utils.BoolPointer(false),
Thresholds_conns: &[]*HaPoolJsonCfg{},
Stats_conns: &[]*HaPoolJsonCfg{},
Pubsubs_conns: &[]*HaPoolJsonCfg{},
Users_conns: &[]*HaPoolJsonCfg{},
Aliases_conns: &[]*HaPoolJsonCfg{},
Rp_subject_prefix_matching: utils.BoolPointer(false),
Max_computed_usage: &map[string]string{
utils.ANY: "189h",
utils.VOICE: "72h",

View File

@@ -477,9 +477,6 @@ func TestCgrCfgJSONDefaultsRALs(t *testing.T) {
if cgrCfg.RalsCfg().RpSubjectPrefixMatching != false {
t.Errorf("Expecting: false , received: %+v", cgrCfg.RalsCfg().RpSubjectPrefixMatching)
}
if cgrCfg.RalsCfg().LcrSubjectPrefixMatching != false {
t.Errorf("Expecting: false , received: %+v", cgrCfg.RalsCfg().LcrSubjectPrefixMatching)
}
eMaxCU := map[string]time.Duration{
utils.ANY: time.Duration(189 * time.Hour),
utils.VOICE: time.Duration(72 * time.Hour),

View File

@@ -98,15 +98,14 @@ type FilterSJsonCfg struct {
// Rater config section
type RalsJsonCfg struct {
Enabled *bool
Thresholds_conns *[]*HaPoolJsonCfg
Stats_conns *[]*HaPoolJsonCfg
Pubsubs_conns *[]*HaPoolJsonCfg
Aliases_conns *[]*HaPoolJsonCfg
Users_conns *[]*HaPoolJsonCfg
Rp_subject_prefix_matching *bool
Lcr_subject_prefix_matching *bool
Max_computed_usage *map[string]string
Enabled *bool
Thresholds_conns *[]*HaPoolJsonCfg
Stats_conns *[]*HaPoolJsonCfg
Pubsubs_conns *[]*HaPoolJsonCfg
Aliases_conns *[]*HaPoolJsonCfg
Users_conns *[]*HaPoolJsonCfg
Rp_subject_prefix_matching *bool
Max_computed_usage *map[string]string
}
// Scheduler config section

View File

@@ -26,15 +26,14 @@ import (
// Rater config section
type RalsCfg struct {
RALsEnabled bool // start standalone server (no balancer)
RALsThresholdSConns []*HaPoolConfig // address where to reach ThresholdS config
RALsStatSConns []*HaPoolConfig
RALsPubSubSConns []*HaPoolConfig
RALsUserSConns []*HaPoolConfig
RALsAliasSConns []*HaPoolConfig
RpSubjectPrefixMatching bool // enables prefix matching for the rating profile subject
LcrSubjectPrefixMatching bool // enables prefix matching for the lcr subject
RALsMaxComputedUsage map[string]time.Duration
RALsEnabled bool // start standalone server (no balancer)
RALsThresholdSConns []*HaPoolConfig // address where to reach ThresholdS config
RALsStatSConns []*HaPoolConfig
RALsPubSubSConns []*HaPoolConfig
RALsUserSConns []*HaPoolConfig
RALsAliasSConns []*HaPoolConfig
RpSubjectPrefixMatching bool // enables prefix matching for the rating profile subject
RALsMaxComputedUsage map[string]time.Duration
}
//loadFromJsonCfg loads Rals config from JsonCfg
@@ -83,9 +82,6 @@ func (ralsCfg *RalsCfg) loadFromJsonCfg(jsnRALsCfg *RalsJsonCfg) (err error) {
if jsnRALsCfg.Rp_subject_prefix_matching != nil {
ralsCfg.RpSubjectPrefixMatching = *jsnRALsCfg.Rp_subject_prefix_matching
}
if jsnRALsCfg.Lcr_subject_prefix_matching != nil {
ralsCfg.LcrSubjectPrefixMatching = *jsnRALsCfg.Lcr_subject_prefix_matching
}
if jsnRALsCfg.Max_computed_usage != nil {
for k, v := range *jsnRALsCfg.Max_computed_usage {
if ralsCfg.RALsMaxComputedUsage[k], err = utils.ParseDurationWithNanosecs(v); err != nil {

View File

@@ -58,14 +58,13 @@ func TestRalsCfgFromJsonCfg(t *testing.T) {
}`
ralscfg.RALsMaxComputedUsage = make(map[string]time.Duration)
expected = RalsCfg{
RALsEnabled: false,
RALsThresholdSConns: []*HaPoolConfig{},
RALsStatSConns: []*HaPoolConfig{},
RALsPubSubSConns: []*HaPoolConfig{},
RALsUserSConns: []*HaPoolConfig{},
RALsAliasSConns: []*HaPoolConfig{},
RpSubjectPrefixMatching: false,
LcrSubjectPrefixMatching: false,
RALsEnabled: false,
RALsThresholdSConns: []*HaPoolConfig{},
RALsStatSConns: []*HaPoolConfig{},
RALsPubSubSConns: []*HaPoolConfig{},
RALsUserSConns: []*HaPoolConfig{},
RALsAliasSConns: []*HaPoolConfig{},
RpSubjectPrefixMatching: false,
RALsMaxComputedUsage: map[string]time.Duration{
utils.ANY: time.Duration(189 * time.Hour),
utils.VOICE: time.Duration(72 * time.Hour),

View File

@@ -53,18 +53,17 @@ func init() {
}
var (
dm *DataManager
cdrStorage CdrStorage
debitPeriod = 10 * time.Second
globalRoundingDecimals = 6
thresholdS rpcclient.RpcClientConnection // used by RALs to communicate with ThresholdS
statS rpcclient.RpcClientConnection
pubSubServer rpcclient.RpcClientConnection
userService rpcclient.RpcClientConnection
aliasService rpcclient.RpcClientConnection
schedCdrsConns rpcclient.RpcClientConnection
rpSubjectPrefixMatching bool
lcrSubjectPrefixMatching bool
dm *DataManager
cdrStorage CdrStorage
debitPeriod = 10 * time.Second
globalRoundingDecimals = 6
thresholdS rpcclient.RpcClientConnection // used by RALs to communicate with ThresholdS
statS rpcclient.RpcClientConnection
pubSubServer rpcclient.RpcClientConnection
userService rpcclient.RpcClientConnection
aliasService rpcclient.RpcClientConnection
schedCdrsConns rpcclient.RpcClientConnection
rpSubjectPrefixMatching bool
)
// Exported method to set the storage getter.
@@ -89,10 +88,6 @@ func SetRpSubjectPrefixMatching(flag bool) {
rpSubjectPrefixMatching = flag
}
func SetLcrSubjectPrefixMatching(flag bool) {
lcrSubjectPrefixMatching = flag
}
/*
Sets the database for CDR storing, used by *cdrlog in first place
*/