diff --git a/admins/ips.go b/admins/ips.go index d0320b981..4d4ebe510 100644 --- a/admins/ips.go +++ b/admins/ips.go @@ -127,7 +127,7 @@ func (s *AdminS) V1SetIPProfile(ctx *context.Context, arg *utils.IPProfileWithAP loadID := time.Now().UnixNano() if err := s.dm.SetLoadIDs(ctx, map[string]int64{utils.CacheIPProfiles: loadID, - utils.CacheIPs: loadID}); err != nil { + utils.CacheIPAllocations: loadID}); err != nil { return utils.APIErrorHandler(err) } // delay if needed before cache call @@ -169,7 +169,7 @@ func (s *AdminS) V1RemoveIPProfile(ctx *context.Context, arg *utils.TenantIDWith //generate a loadID for CacheIPProfiles and CacheIPs and store it in database //make 1 insert for both IPProfile and IPs instead of 2 loadID := time.Now().UnixNano() - if err := s.dm.SetLoadIDs(ctx, map[string]int64{utils.CacheIPProfiles: loadID, utils.CacheIPs: loadID}); err != nil { + if err := s.dm.SetLoadIDs(ctx, map[string]int64{utils.CacheIPProfiles: loadID, utils.CacheIPAllocations: loadID}); err != nil { return utils.APIErrorHandler(err) } *reply = utils.OK diff --git a/admins/libadmin.go b/admins/libadmin.go index cfca4466a..8a8d0e2a5 100644 --- a/admins/libadmin.go +++ b/admins/libadmin.go @@ -80,7 +80,7 @@ func (admS *AdminS) CallCache(ctx *context.Context, cacheopt string, tnt, cacheI case utils.CacheResourceProfiles: cacheIDs = append(cacheIDs, utils.CacheResources) case utils.CacheIPProfiles: - cacheIDs = append(cacheIDs, utils.CacheIPs) + cacheIDs = append(cacheIDs, utils.CacheIPAllocations) case utils.CacheStatQueueProfiles: cacheIDs = append(cacheIDs, utils.CacheStatQueues) } @@ -106,7 +106,7 @@ func (admS *AdminS) composeArgsReload(ctx *context.Context, tnt, cacheID, itemID case utils.CacheResourceProfiles: argCache[utils.CacheResources] = []string{itemID} case utils.CacheIPProfiles: - argCache[utils.CacheIPs] = []string{itemID} + argCache[utils.CacheIPAllocations] = []string{itemID} case utils.CacheStatQueueProfiles: argCache[utils.CacheStatQueues] = []string{itemID} } diff --git a/apis/ips.go b/apis/ips.go index 079da9297..62b1cdd78 100644 --- a/apis/ips.go +++ b/apis/ips.go @@ -127,7 +127,7 @@ func (s *AdminSv1) SetIPProfile(ctx *context.Context, arg *utils.IPProfileWithAP loadID := time.Now().UnixNano() if err := s.dm.SetLoadIDs(ctx, map[string]int64{utils.CacheIPProfiles: loadID, - utils.CacheIPs: loadID}); err != nil { + utils.CacheIPAllocations: loadID}); err != nil { return utils.APIErrorHandler(err) } // delay if needed before cache call @@ -169,7 +169,7 @@ func (s *AdminSv1) RemoveIPProfile(ctx *context.Context, arg *utils.TenantIDWith //generate a loadID for CacheIPProfiles and CacheIPs and store it in database //make 1 insert for both IPProfile and IPs instead of 2 loadID := time.Now().UnixNano() - if err := s.dm.SetLoadIDs(ctx, map[string]int64{utils.CacheIPProfiles: loadID, utils.CacheIPs: loadID}); err != nil { + if err := s.dm.SetLoadIDs(ctx, map[string]int64{utils.CacheIPProfiles: loadID, utils.CacheIPAllocations: loadID}); err != nil { return utils.APIErrorHandler(err) } *reply = utils.OK diff --git a/apis/libadmin.go b/apis/libadmin.go index d32ffedd2..31efdc2ca 100644 --- a/apis/libadmin.go +++ b/apis/libadmin.go @@ -80,7 +80,7 @@ func (admS *AdminSv1) CallCache(ctx *context.Context, cacheopt string, tnt, cach case utils.CacheResourceProfiles: cacheIDs = append(cacheIDs, utils.CacheResources) case utils.CacheIPProfiles: - cacheIDs = append(cacheIDs, utils.CacheIPs) + cacheIDs = append(cacheIDs, utils.CacheIPAllocations) case utils.CacheStatQueueProfiles: cacheIDs = append(cacheIDs, utils.CacheStatQueues) } @@ -106,7 +106,7 @@ func (admS *AdminSv1) composeArgsReload(ctx *context.Context, tnt, cacheID, item case utils.CacheResourceProfiles: argCache[utils.CacheResources] = []string{itemID} case utils.CacheIPProfiles: - argCache[utils.CacheIPs] = []string{itemID} + argCache[utils.CacheIPAllocations] = []string{itemID} case utils.CacheStatQueueProfiles: argCache[utils.CacheStatQueues] = []string{itemID} } diff --git a/apis/replicator.go b/apis/replicator.go index 2882ed94e..319db05f3 100644 --- a/apis/replicator.go +++ b/apis/replicator.go @@ -157,9 +157,9 @@ func (rplSv1 *ReplicatorSv1) GetResourceProfile(ctx *context.Context, tntID *uti } // GetIP is the remote method coresponding to the dataDb driver method -func (rplSv1 *ReplicatorSv1) GetIP(ctx *context.Context, tntID *utils.TenantIDWithAPIOpts, reply *utils.IP) error { - engine.UpdateReplicationFilters(utils.IPsPrefix, tntID.TenantID.TenantID(), utils.IfaceAsString(tntID.APIOpts[utils.RemoteHostOpt])) - rcv, err := rplSv1.dm.DataDB().GetIPDrv(ctx, tntID.Tenant, tntID.ID) +func (rplSv1 *ReplicatorSv1) GetIP(ctx *context.Context, tntID *utils.TenantIDWithAPIOpts, reply *utils.IPAllocations) error { + engine.UpdateReplicationFilters(utils.IPAllocationsPrefix, tntID.TenantID.TenantID(), utils.IfaceAsString(tntID.APIOpts[utils.RemoteHostOpt])) + rcv, err := rplSv1.dm.DataDB().GetIPAllocationsDrv(ctx, tntID.Tenant, tntID.ID) if err != nil { return err } @@ -424,8 +424,8 @@ func (rplSv1 *ReplicatorSv1) SetIPProfile(ctx *context.Context, ipp *utils.IPPro } // SetIP is the replication method coresponding to the dataDb driver method -func (rplSv1 *ReplicatorSv1) SetIP(ctx *context.Context, ip *utils.IPWithAPIOpts, reply *string) (err error) { - if err = rplSv1.dm.DataDB().SetIPDrv(ctx, ip.IP); err != nil { +func (rplSv1 *ReplicatorSv1) SetIP(ctx *context.Context, ip *utils.IPAllocationsWithAPIOpts, reply *string) (err error) { + if err = rplSv1.dm.DataDB().SetIPAllocationsDrv(ctx, ip.IPAllocations); err != nil { return } // delay if needed before cache call @@ -434,7 +434,7 @@ func (rplSv1 *ReplicatorSv1) SetIP(ctx *context.Context, ip *utils.IPWithAPIOpts time.Sleep(rplSv1.v1.cfg.GeneralCfg().CachingDelay) } if err = rplSv1.v1.CallCache(ctx, utils.IfaceAsString(ip.APIOpts[utils.MetaCache]), - ip.Tenant, utils.CacheIPs, ip.TenantID(), utils.EmptyString, nil, ip.APIOpts); err != nil { + ip.Tenant, utils.CacheIPAllocations, ip.TenantID(), utils.EmptyString, nil, ip.APIOpts); err != nil { return } *reply = utils.OK @@ -703,7 +703,7 @@ func (rplSv1 *ReplicatorSv1) RemoveResourceProfile(ctx *context.Context, args *u // RemoveIP is the replication method coresponding to the dataDb driver method func (rplSv1 *ReplicatorSv1) RemoveIP(ctx *context.Context, args *utils.TenantIDWithAPIOpts, reply *string) (err error) { - if err = rplSv1.dm.DataDB().RemoveIPDrv(ctx, args.Tenant, args.ID); err != nil { + if err = rplSv1.dm.DataDB().RemoveIPAllocationsDrv(ctx, args.Tenant, args.ID); err != nil { return } // delay if needed before cache call @@ -712,7 +712,7 @@ func (rplSv1 *ReplicatorSv1) RemoveIP(ctx *context.Context, args *utils.TenantID time.Sleep(rplSv1.v1.cfg.GeneralCfg().CachingDelay) } if err = rplSv1.v1.CallCache(ctx, utils.IfaceAsString(args.APIOpts[utils.MetaCache]), - args.Tenant, utils.CacheIPs, args.TenantID.TenantID(), utils.EmptyString, nil, args.APIOpts); err != nil { + args.Tenant, utils.CacheIPAllocations, args.TenantID.TenantID(), utils.EmptyString, nil, args.APIOpts); err != nil { return } *reply = utils.OK diff --git a/config/config_defaults.go b/config/config_defaults.go index ddad7fe8d..a7eef7279 100644 --- a/config/config_defaults.go +++ b/config/config_defaults.go @@ -124,7 +124,7 @@ const CGRATES_CFG_JSON = ` "*resource_profiles": {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate":false}, "*resources": {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate":false}, "*ip_profiles": {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate":false}, - "*ips": {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate":false}, + "*ip_allocations": {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate":false}, "*statqueue_profiles": {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate":false}, "*statqueues": {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate":false}, "*threshold_profiles": {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate":false}, @@ -272,8 +272,8 @@ const CGRATES_CFG_JSON = ` "*resources": {"limit": -1, "ttl": "", "static_ttl": false, "precache": false, "remote":false, "replicate": false}, // control resources caching "*event_resources": {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate": false}, // matching resources to events "*ip_profiles": {"limit": -1, "ttl": "", "static_ttl": false, "precache": false, "remote":false, "replicate": false}, // control ip profiles caching - "*ips": {"limit": -1, "ttl": "", "static_ttl": false, "precache": false, "remote":false, "replicate": false}, // control ips caching - "*event_ips": {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate": false}, // matching ips to events + "*ip_allocations": {"limit": -1, "ttl": "", "static_ttl": false, "precache": false, "remote":false, "replicate": false}, // control ip allocations caching + "*event_ips": {"limit": -1, "ttl": "", "static_ttl": false, "remote":false, "replicate": false}, // matching ip allocations to events "*statqueue_profiles": {"limit": -1, "ttl": "", "static_ttl": false, "precache": false, "remote":false, "replicate": false}, // statqueue profiles "*statqueues": {"limit": -1, "ttl": "", "static_ttl": false, "precache": false, "remote":false, "replicate": false}, // statqueues with metrics "*threshold_profiles": {"limit": -1, "ttl": "", "static_ttl": false, "precache": false, "remote":false, "replicate": false}, // control threshold profiles caching diff --git a/config/config_json_test.go b/config/config_json_test.go index 0f5537a92..7002ed8e2 100644 --- a/config/config_json_test.go +++ b/config/config_json_test.go @@ -103,7 +103,7 @@ func TestCacheJsonCfg(t *testing.T) { utils.CacheIPProfiles: {Limit: utils.IntPointer(-1), Ttl: utils.StringPointer(""), Static_ttl: utils.BoolPointer(false), Precache: utils.BoolPointer(false), Remote: utils.BoolPointer(false), Replicate: utils.BoolPointer(false)}, - utils.CacheIPs: {Limit: utils.IntPointer(-1), + utils.CacheIPAllocations: {Limit: utils.IntPointer(-1), Ttl: utils.StringPointer(""), Static_ttl: utils.BoolPointer(false), Precache: utils.BoolPointer(false), Remote: utils.BoolPointer(false), Replicate: utils.BoolPointer(false)}, utils.CacheEventIPs: {Limit: utils.IntPointer(-1), @@ -309,7 +309,7 @@ func TestDfDataDbJsonCfg(t *testing.T) { RedisPoolPipelineLimit: utils.IntPointer(0), }, Items: map[string]*ItemOptsJson{ - utils.MetaAccounts: { + utils.CacheAccounts: { Ttl: utils.StringPointer(utils.EmptyString), Static_ttl: utils.BoolPointer(false), Limit: utils.IntPointer(-1), @@ -323,112 +323,112 @@ func TestDfDataDbJsonCfg(t *testing.T) { Replicate: utils.BoolPointer(false), Remote: utils.BoolPointer(false), }, - utils.MetaResourceProfile: { + utils.CacheResourceProfiles: { Ttl: utils.StringPointer(utils.EmptyString), Static_ttl: utils.BoolPointer(false), Limit: utils.IntPointer(-1), Replicate: utils.BoolPointer(false), Remote: utils.BoolPointer(false), }, - utils.MetaIPProfiles: { + utils.CacheIPProfiles: { Ttl: utils.StringPointer(utils.EmptyString), Static_ttl: utils.BoolPointer(false), Limit: utils.IntPointer(-1), Replicate: utils.BoolPointer(false), Remote: utils.BoolPointer(false), }, - utils.MetaStatQueues: { + utils.CacheStatQueues: { Ttl: utils.StringPointer(utils.EmptyString), Static_ttl: utils.BoolPointer(false), Limit: utils.IntPointer(-1), Replicate: utils.BoolPointer(false), Remote: utils.BoolPointer(false), }, - utils.MetaResources: { + utils.CacheResources: { Ttl: utils.StringPointer(utils.EmptyString), Static_ttl: utils.BoolPointer(false), Limit: utils.IntPointer(-1), Replicate: utils.BoolPointer(false), Remote: utils.BoolPointer(false), }, - utils.MetaIPs: { + utils.CacheIPAllocations: { Ttl: utils.StringPointer(utils.EmptyString), Static_ttl: utils.BoolPointer(false), Limit: utils.IntPointer(-1), Replicate: utils.BoolPointer(false), Remote: utils.BoolPointer(false), }, - utils.MetaStatQueueProfiles: { + utils.CacheStatQueueProfiles: { Ttl: utils.StringPointer(utils.EmptyString), Static_ttl: utils.BoolPointer(false), Limit: utils.IntPointer(-1), Replicate: utils.BoolPointer(false), Remote: utils.BoolPointer(false), }, - utils.MetaThresholds: { + utils.CacheThresholds: { Ttl: utils.StringPointer(utils.EmptyString), Static_ttl: utils.BoolPointer(false), Limit: utils.IntPointer(-1), Replicate: utils.BoolPointer(false), Remote: utils.BoolPointer(false), }, - utils.MetaTrends: { + utils.CacheTrends: { Ttl: utils.StringPointer(utils.EmptyString), Static_ttl: utils.BoolPointer(false), Limit: utils.IntPointer(-1), Replicate: utils.BoolPointer(false), Remote: utils.BoolPointer(false), }, - utils.MetaThresholdProfiles: { + utils.CacheThresholdProfiles: { Ttl: utils.StringPointer(utils.EmptyString), Static_ttl: utils.BoolPointer(false), Limit: utils.IntPointer(-1), Replicate: utils.BoolPointer(false), Remote: utils.BoolPointer(false), }, - utils.MetaFilters: { + utils.CacheFilters: { Ttl: utils.StringPointer(utils.EmptyString), Static_ttl: utils.BoolPointer(false), Limit: utils.IntPointer(-1), Replicate: utils.BoolPointer(false), Remote: utils.BoolPointer(false), }, - utils.MetaRouteProfiles: { + utils.CacheRouteProfiles: { Ttl: utils.StringPointer(utils.EmptyString), Static_ttl: utils.BoolPointer(false), Limit: utils.IntPointer(-1), Replicate: utils.BoolPointer(false), Remote: utils.BoolPointer(false), }, - utils.MetaAttributeProfiles: { + utils.CacheAttributeProfiles: { Ttl: utils.StringPointer(utils.EmptyString), Static_ttl: utils.BoolPointer(false), Limit: utils.IntPointer(-1), Replicate: utils.BoolPointer(false), Remote: utils.BoolPointer(false), }, - utils.MetaRateProfiles: { + utils.CacheRateProfiles: { Ttl: utils.StringPointer(utils.EmptyString), Static_ttl: utils.BoolPointer(false), Limit: utils.IntPointer(-1), Replicate: utils.BoolPointer(false), Remote: utils.BoolPointer(false), }, - utils.MetaActionProfiles: { + utils.CacheActionProfiles: { Ttl: utils.StringPointer(utils.EmptyString), Static_ttl: utils.BoolPointer(false), Limit: utils.IntPointer(-1), Replicate: utils.BoolPointer(false), Remote: utils.BoolPointer(false), }, - utils.MetaChargerProfiles: { + utils.CacheChargerProfiles: { Ttl: utils.StringPointer(utils.EmptyString), Static_ttl: utils.BoolPointer(false), Limit: utils.IntPointer(-1), Replicate: utils.BoolPointer(false), Remote: utils.BoolPointer(false), }, - utils.MetaLoadIDs: { + utils.CacheLoadIDs: { Ttl: utils.StringPointer(utils.EmptyString), Static_ttl: utils.BoolPointer(false), Limit: utils.IntPointer(-1), diff --git a/config/config_test.go b/config/config_test.go index 35f1b4134..a15952814 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -444,7 +444,7 @@ func TestCgrCfgJSONDefaultsCacheCFG(t *testing.T) { utils.CacheResources: {Limit: -1}, utils.CacheEventResources: {Limit: -1, TTL: 0}, utils.CacheIPProfiles: {Limit: -1}, - utils.CacheIPs: {Limit: -1}, + utils.CacheIPAllocations: {Limit: -1}, utils.CacheEventIPs: {Limit: -1, TTL: 0}, utils.CacheStatQueueProfiles: {Limit: -1}, utils.CacheStatQueues: {Limit: -1}, @@ -4743,7 +4743,7 @@ func TestV1GetConfigAsJSONGeneral(t *testing.T) { func TestV1GetConfigAsJSONDataDB(t *testing.T) { var reply string - expected := `{"data_db":{"db_host":"127.0.0.1","db_name":"10","db_password":"","db_port":6379,"db_type":"*redis","db_user":"cgrates","items":{"*account_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*accounts":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*action_profile_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*action_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*actions":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*attribute_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*attribute_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*charger_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*charger_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*filters":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*ip_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*ip_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*ips":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*load_ids":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*ranking_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*rankings":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*rate_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*rate_profile_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*rate_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*resource_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*resource_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*resources":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*reverse_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*route_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*route_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*stat_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*statqueue_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*statqueues":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*threshold_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*threshold_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*thresholds":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*trend_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*trends":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*versions":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false}},"opts":{"internalDBBackupPath":"/var/lib/cgrates/internal_db/backup/datadb","internalDBDumpInterval":"0s","internalDBDumpPath":"/var/lib/cgrates/internal_db/datadb","internalDBFileSizeLimit":1073741824,"internalDBRewriteInterval":"0s","internalDBStartTimeout":"5m0s","mongoConnScheme":"mongodb","mongoQueryTimeout":"10s","redisCACertificate":"","redisClientCertificate":"","redisClientKey":"","redisCluster":false,"redisClusterOndownDelay":"0s","redisClusterSync":"5s","redisConnectAttempts":20,"redisConnectTimeout":"0s","redisMaxConns":10,"redisPoolPipelineLimit":0,"redisPoolPipelineWindow":"150µs","redisReadTimeout":"0s","redisSentinel":"","redisTLS":false,"redisWriteTimeout":"0s"},"remote_conn_id":"","remote_conns":[],"replication_cache":"","replication_conns":[],"replication_filtered":false}}` + expected := `{"data_db":{"db_host":"127.0.0.1","db_name":"10","db_password":"","db_port":6379,"db_type":"*redis","db_user":"cgrates","items":{"*account_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*accounts":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*action_profile_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*action_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*actions":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*attribute_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*attribute_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*charger_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*charger_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*filters":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*ip_allocations":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*ip_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*ip_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*load_ids":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*ranking_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*rankings":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*rate_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*rate_profile_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*rate_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*resource_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*resource_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*resources":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*reverse_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*route_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*route_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*stat_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*statqueue_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*statqueues":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*threshold_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*threshold_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*thresholds":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*trend_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*trends":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*versions":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false}},"opts":{"internalDBBackupPath":"/var/lib/cgrates/internal_db/backup/datadb","internalDBDumpInterval":"0s","internalDBDumpPath":"/var/lib/cgrates/internal_db/datadb","internalDBFileSizeLimit":1073741824,"internalDBRewriteInterval":"0s","internalDBStartTimeout":"5m0s","mongoConnScheme":"mongodb","mongoQueryTimeout":"10s","redisCACertificate":"","redisClientCertificate":"","redisClientKey":"","redisCluster":false,"redisClusterOndownDelay":"0s","redisClusterSync":"5s","redisConnectAttempts":20,"redisConnectTimeout":"0s","redisMaxConns":10,"redisPoolPipelineLimit":0,"redisPoolPipelineWindow":"150µs","redisReadTimeout":"0s","redisSentinel":"","redisTLS":false,"redisWriteTimeout":"0s"},"remote_conn_id":"","remote_conns":[],"replication_cache":"","replication_conns":[],"replication_filtered":false}}` cfgCgr := NewDefaultCGRConfig() if err := cfgCgr.V1GetConfigAsJSON(context.Background(), &SectionWithAPIOpts{Sections: []string{DataDBJSON}}, &reply); err != nil { t.Error(err) @@ -4765,7 +4765,7 @@ func TestV1GetConfigAsJSONTls(t *testing.T) { func TestV1GetConfigAsJSONTCache(t *testing.T) { var reply string - expected := `{"caches":{"partitions":{"*account_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*accounts":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*action_profile_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*action_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*apiban":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"2m0s"},"*attribute_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*attribute_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*caps_events":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*cdr_ids":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"10m0s"},"*charger_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*charger_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*closed_sessions":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"10s"},"*diameter_messages":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"3h0m0s"},"*event_charges":{"limit":0,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"10s"},"*event_ips":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*event_resources":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*filters":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*ip_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*ip_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*ips":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*load_ids":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*ranking_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*rankings":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*rate_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*rate_profile_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*rate_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*replication_hosts":{"limit":0,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*resource_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*resource_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*resources":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*reverse_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*route_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*route_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*rpc_connections":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*rpc_responses":{"limit":0,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"2s"},"*sentrypeer":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":true,"ttl":"24h0m0s"},"*stat_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*statqueue_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*statqueues":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*stir":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"3h0m0s"},"*threshold_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*threshold_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*thresholds":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*trend_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*trends":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*uch":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"3h0m0s"}},"remote_conns":[],"replication_conns":[]}}` + expected := `{"caches":{"partitions":{"*account_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*accounts":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*action_profile_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*action_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*apiban":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"2m0s"},"*attribute_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*attribute_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*caps_events":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*cdr_ids":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"10m0s"},"*charger_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*charger_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*closed_sessions":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"10s"},"*diameter_messages":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"3h0m0s"},"*event_charges":{"limit":0,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"10s"},"*event_ips":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*event_resources":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*filters":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*ip_allocations":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*ip_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*ip_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*load_ids":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*ranking_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*rankings":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*rate_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*rate_profile_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*rate_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*replication_hosts":{"limit":0,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*resource_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*resource_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*resources":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*reverse_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*route_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*route_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*rpc_connections":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*rpc_responses":{"limit":0,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"2s"},"*sentrypeer":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":true,"ttl":"24h0m0s"},"*stat_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*statqueue_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*statqueues":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*stir":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"3h0m0s"},"*threshold_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*threshold_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*thresholds":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*trend_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*trends":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*uch":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"3h0m0s"}},"remote_conns":[],"replication_conns":[]}}` cfgCgr := NewDefaultCGRConfig() if err := cfgCgr.V1GetConfigAsJSON(context.Background(), &SectionWithAPIOpts{Sections: []string{CacheJSON}}, &reply); err != nil { t.Error(err) @@ -5204,7 +5204,7 @@ func TestV1GetConfigAsJSONAllConfig(t *testing.T) { } }` var reply string - expected := `{"accounts":{"attributes_conns":[],"enabled":false,"exists_indexed_fields":[],"indexed_selects":true,"max_iterations":1000,"max_usage":"259200000000000","nested_fields":false,"notexists_indexed_fields":[],"opts":{"*profileIDs":[],"*profileIgnoreFilters":[{"FilterIDs":null,"Tenant":""}],"*usage":[{"FilterIDs":null,"Tenant":""}]},"prefix_indexed_fields":[],"rates_conns":[],"suffix_indexed_fields":[],"thresholds_conns":[]},"actions":{"accounts_conns":[],"cdrs_conns":[],"dynaprepaid_actionprofile":[],"ees_conns":[],"enabled":false,"exists_indexed_fields":[],"indexed_selects":true,"nested_fields":false,"notexists_indexed_fields":[],"opts":{"*posterAttempts":[{"FilterIDs":null,"Tenant":""}],"*profileIDs":[],"*profileIgnoreFilters":[{"FilterIDs":null,"Tenant":""}]},"prefix_indexed_fields":[],"stats_conns":[],"suffix_indexed_fields":[],"tenants":[],"thresholds_conns":[]},"admins":{"actions_conns":[],"attributes_conns":[],"caches_conns":["*internal"],"ees_conns":[],"enabled":false},"analyzers":{"cleanup_interval":"1h0m0s","db_path":"/var/spool/cgrates/analyzers","ees_conns":[],"enabled":false,"index_type":"*scorch","opts":{"*exporterIDs":[]},"ttl":"24h0m0s"},"apiban":{"enabled":false,"keys":[]},"asterisk_agent":{"asterisk_conns":[{"address":"127.0.0.1:8088","alias":"","connect_attempts":3,"max_reconnect_interval":"0s","password":"CGRateS.org","reconnects":5,"user":"cgrates"}],"create_cdr":false,"enabled":false,"sessions_conns":["*birpc_internal"]},"attributes":{"accounts_conns":[],"enabled":false,"exists_indexed_fields":[],"indexed_selects":true,"nested_fields":false,"notexists_indexed_fields":[],"opts":{"*processRuns":[{"FilterIDs":null,"Tenant":""}],"*profileIDs":[],"*profileIgnoreFilters":[{"FilterIDs":null,"Tenant":""}],"*profileRuns":[{"FilterIDs":null,"Tenant":""}]},"prefix_indexed_fields":[],"resources_conns":[],"stats_conns":[],"suffix_indexed_fields":[]},"caches":{"partitions":{"*account_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*accounts":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*action_profile_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*action_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*apiban":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"2m0s"},"*attribute_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*attribute_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*caps_events":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*cdr_ids":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"10m0s"},"*charger_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*charger_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*closed_sessions":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"10s"},"*diameter_messages":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"3h0m0s"},"*event_charges":{"limit":0,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"10s"},"*event_ips":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*event_resources":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*filters":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*ip_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*ip_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*ips":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*load_ids":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*ranking_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*rankings":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*rate_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*rate_profile_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*rate_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*replication_hosts":{"limit":0,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*resource_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*resource_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*resources":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*reverse_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*route_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*route_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*rpc_connections":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*rpc_responses":{"limit":0,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"2s"},"*sentrypeer":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":true,"ttl":"24h0m0s"},"*stat_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*statqueue_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*statqueues":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*stir":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"3h0m0s"},"*threshold_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*threshold_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*thresholds":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*trend_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*trends":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*uch":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"3h0m0s"}},"remote_conns":[],"replication_conns":[]},"cdrs":{"accounts_conns":[],"actions_conns":[],"attributes_conns":[],"chargers_conns":[],"ees_conns":[],"enabled":false,"extra_fields":[],"online_cdr_exports":null,"opts":{"*accounts":[{"FilterIDs":null,"Tenant":""}],"*attributes":[{"FilterIDs":null,"Tenant":""}],"*chargers":[{"FilterIDs":null,"Tenant":""}],"*ees":[{"FilterIDs":null,"Tenant":""}],"*rates":[{"FilterIDs":null,"Tenant":""}],"*refund":[{"FilterIDs":null,"Tenant":""}],"*rerate":[{"FilterIDs":null,"Tenant":""}],"*stats":[{"FilterIDs":null,"Tenant":""}],"*store":[{"FilterIDs":null,"Tenant":""}],"*thresholds":[{"FilterIDs":null,"Tenant":""}]},"rates_conns":[],"session_cost_retries":5,"stats_conns":[],"thresholds_conns":[]},"chargers":{"attributes_conns":[],"enabled":false,"exists_indexed_fields":[],"indexed_selects":true,"nested_fields":false,"notexists_indexed_fields":[],"prefix_indexed_fields":[],"suffix_indexed_fields":[]},"config_db":{"db_host":"","db_name":"","db_password":"","db_port":0,"db_type":"*internal","db_user":"","opts":{"internalDBBackupPath":"/var/lib/cgrates/internal_db/backup/configdb","internalDBDumpInterval":"0s","internalDBDumpPath":"/var/lib/cgrates/internal_db/configdb","internalDBFileSizeLimit":1073741824,"internalDBRewriteInterval":"0s","internalDBStartTimeout":"5m0s","mongoConnScheme":"mongodb","mongoQueryTimeout":"10s","redisCACertificate":"","redisClientCertificate":"","redisClientKey":"","redisCluster":false,"redisClusterOndownDelay":"0s","redisClusterSync":"5s","redisConnectAttempts":20,"redisConnectTimeout":"0s","redisMaxConns":10,"redisReadTimeout":"0s","redisSentinel":"","redisTLS":false,"redisWriteTimeout":"0s"}},"configs":{"enabled":false,"root_dir":"/var/spool/cgrates/configs","url":"/configs/"},"cores":{"caps":0,"caps_stats_interval":"0","caps_strategy":"*busy","ees_conns":[],"shutdown_timeout":"1s"},"data_db":{"db_host":"127.0.0.1","db_name":"10","db_password":"","db_port":6379,"db_type":"*redis","db_user":"cgrates","items":{"*account_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*accounts":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*action_profile_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*action_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*actions":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*attribute_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*attribute_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*charger_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*charger_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*filters":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*ip_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*ip_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*ips":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*load_ids":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*ranking_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*rankings":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*rate_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*rate_profile_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*rate_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*resource_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*resource_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*resources":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*reverse_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*route_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*route_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*stat_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*statqueue_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*statqueues":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*threshold_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*threshold_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*thresholds":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*trend_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*trends":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*versions":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false}},"opts":{"internalDBBackupPath":"/var/lib/cgrates/internal_db/backup/datadb","internalDBDumpInterval":"0s","internalDBDumpPath":"/var/lib/cgrates/internal_db/datadb","internalDBFileSizeLimit":1073741824,"internalDBRewriteInterval":"0s","internalDBStartTimeout":"5m0s","mongoConnScheme":"mongodb","mongoQueryTimeout":"10s","redisCACertificate":"","redisClientCertificate":"","redisClientKey":"","redisCluster":false,"redisClusterOndownDelay":"0s","redisClusterSync":"5s","redisConnectAttempts":20,"redisConnectTimeout":"0s","redisMaxConns":10,"redisPoolPipelineLimit":0,"redisPoolPipelineWindow":"150µs","redisReadTimeout":"0s","redisSentinel":"","redisTLS":false,"redisWriteTimeout":"0s"},"remote_conn_id":"","remote_conns":[],"replication_cache":"","replication_conns":[],"replication_filtered":false},"diameter_agent":{"asr_template":"","dictionaries_path":"/usr/share/cgrates/diameter/dict/","enabled":false,"forced_disconnect":"*none","listen":"127.0.0.1:3868","listen_net":"tcp","origin_host":"CGR-DA","origin_realm":"cgrates.org","product_name":"CGRateS","rar_template":"","request_processors":[],"sessions_conns":["*birpc_internal"],"synced_conn_requests":false,"vendor_id":0},"dns_agent":{"enabled":false,"listeners":[{"address":"127.0.0.1:53","network":"udp"}],"request_processors":[],"sessions_conns":["*internal"],"timezone":""},"ees":{"attributes_conns":[],"cache":{"*fileCSV":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"5s"}},"enabled":false,"exporters":[{"attempts":1,"attribute_context":"","attribute_ids":[],"blocker":false,"concurrent_requests":0,"efs_conns":["*internal"],"export_path":"/var/spool/cgrates/ees","failed_posts_dir":"/var/spool/cgrates/failed_posts","fields":[],"filters":[],"flags":[],"id":"*default","opts":{},"synchronous":false,"timezone":"","type":"*none"}]},"efs":{"enabled":false,"failed_posts_dir":"/var/spool/cgrates/failed_posts","failed_posts_ttl":"5s","poster_attempts":3},"ers":{"enabled":false,"partial_cache_ttl":"1s","readers":[{"cache_dump_fields":[],"concurrent_requests":1024,"fields":[{"mandatory":true,"path":"*cgreq.ToR","tag":"ToR","type":"*variable","value":"~*req.2"},{"mandatory":true,"path":"*cgreq.OriginID","tag":"OriginID","type":"*variable","value":"~*req.3"},{"mandatory":true,"path":"*cgreq.RequestType","tag":"RequestType","type":"*variable","value":"~*req.4"},{"mandatory":true,"path":"*cgreq.Tenant","tag":"Tenant","type":"*variable","value":"~*req.6"},{"mandatory":true,"path":"*cgreq.Category","tag":"Category","type":"*variable","value":"~*req.7"},{"mandatory":true,"path":"*cgreq.Account","tag":"Account","type":"*variable","value":"~*req.8"},{"mandatory":true,"path":"*cgreq.Subject","tag":"Subject","type":"*variable","value":"~*req.9"},{"mandatory":true,"path":"*cgreq.Destination","tag":"Destination","type":"*variable","value":"~*req.10"},{"mandatory":true,"path":"*cgreq.SetupTime","tag":"SetupTime","type":"*variable","value":"~*req.11"},{"mandatory":true,"path":"*cgreq.AnswerTime","tag":"AnswerTime","type":"*variable","value":"~*req.12"},{"mandatory":true,"path":"*cgreq.Usage","tag":"Usage","type":"*variable","value":"~*req.13"}],"filters":[],"flags":[],"id":"*default","max_reconnect_interval":"5m0s","opts":{"csvFieldSeparator":",","csvHeaderDefineChar":":","csvRowLength":0,"natsSubject":"cgrates_cdrs","partialCacheAction":"*none","partialOrderField":"~*req.AnswerTime"},"partial_commit_fields":[],"processed_path":"/var/spool/cgrates/ers/out","reconnects":-1,"run_delay":"0","source_path":"/var/spool/cgrates/ers/in","start_delay":"0","tenant":"","timezone":"","type":"*none"}],"sessions_conns":["*internal"]},"filters":{"accounts_conns":[],"rankings_conns":[],"resources_conns":[],"stats_conns":[],"trends_conns":[]},"freeswitch_agent":{"active_session_delimiter":",","create_cdr":false,"empty_balance_ann_file":"","empty_balance_context":"","enabled":false,"event_socket_conns":[{"address":"127.0.0.1:8021","alias":"127.0.0.1:8021","max_reconnect_interval":"0s","password":"ClueCon","reconnects":5,"reply_timeout":"1m0s"}],"extra_fields":[],"low_balance_ann_file":"","max_wait_connection":"2s","request_processors":[],"sessions_conns":["*birpc_internal"],"subscribe_park":true},"general":{"caching_delay":"0","connect_attempts":5,"connect_timeout":"1s","dbdata_encoding":"*msgpack","decimal_max_scale":0,"decimal_min_scale":0,"decimal_precision":0,"decimal_rounding_mode":"*toNearestEven","default_caching":"*reload","default_category":"call","default_request_type":"*rated","default_tenant":"cgrates.org","default_timezone":"Local","digest_equal":":","digest_separator":",","locking_timeout":"0","max_parallel_conns":100,"max_reconnect_interval":"0","node_id":"ENGINE1","opts":{"*exporterIDs":[]},"reconnects":-1,"reply_timeout":"2s","rounding_decimals":5,"tpexport_dir":"/var/spool/cgrates/tpe"},"http":{"auth_users":{},"client_opts":{"dialFallbackDelay":"300ms","dialKeepAlive":"30s","dialTimeout":"30s","disableCompression":false,"disableKeepAlives":false,"expectContinueTimeout":"0s","forceAttemptHttp2":true,"idleConnTimeout":"1m30s","maxConnsPerHost":0,"maxIdleConns":100,"maxIdleConnsPerHost":2,"responseHeaderTimeout":"0s","skipTLSVerification":false,"tlsHandshakeTimeout":"10s"},"freeswitch_cdrs_url":"/freeswitch_json","http_cdrs":"/cdr_http","json_rpc_url":"/jsonrpc","pprof_path":"/debug/pprof/","registrars_url":"/registrar","use_basic_auth":false,"ws_url":"/ws"},"http_agent":[],"ips":{"enabled":false,"exists_indexed_fields":[],"indexed_selects":true,"nested_fields":false,"notexists_indexed_fields":null,"opts":{"*ttl":[{"FilterIDs":null,"Tenant":""}],"*units":[{"FilterIDs":null,"Tenant":""}],"*usageID":[{"FilterIDs":null,"Tenant":""}]},"prefix_indexed_fields":[],"store_interval":"0s","string_indexed_fields":null,"suffix_indexed_fields":[]},"janus_agent":{"enabled":false,"janus_conns":[{"address":"127.0.0.1:8088","admin_address":"localhost:7188","admin_password":"","type":"*ws"}],"request_processors":[],"sessions_conns":["*internal"],"url":"/janus"},"kamailio_agent":{"create_cdr":false,"enabled":false,"evapi_conns":[{"address":"127.0.0.1:8448","alias":"","max_reconnect_interval":"0s","reconnects":5}],"sessions_conns":["*birpc_internal"],"timezone":""},"listen":{"http":"127.0.0.1:2080","http_tls":"127.0.0.1:2280","rpc_gob":"127.0.0.1:2013","rpc_gob_tls":"127.0.0.1:2023","rpc_json":"127.0.0.1:2012","rpc_json_tls":"127.0.0.1:2022"},"loader":{"actions_conns":["*localhost"],"caches_conns":["*localhost"],"data_path":"./","disable_reverse":false,"field_separator":",","gapi_credentials":".gapi/credentials.json","gapi_token":".gapi/token.json","tpid":""},"loaders":[{"action":"*store","cache":{"*accounts":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"5s"},"*action_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"5s"},"*attributes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"5s"},"*chargers":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"5s"},"*filters":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"5s"},"*ips":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"5s"},"*rankings":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"5s"},"*rate_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"5s"},"*resources":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"5s"},"*routes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"5s"},"*stats":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"5s"},"*thresholds":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"5s"},"*trends":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"5s"}},"caches_conns":["*internal"],"data":[{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"new_branch":true,"path":"Rules.Type","tag":"Type","type":"*variable","value":"~*req.2"},{"path":"Rules.Element","tag":"Element","type":"*variable","value":"~*req.3"},{"path":"Rules.Values","tag":"Values","type":"*variable","value":"~*req.4"}],"file_name":"Filters.csv","flags":null,"type":"*filters"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"TenantID","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ProfileID","type":"*variable","value":"~*req.1"},{"path":"FilterIDs","tag":"FilterIDs","type":"*variable","value":"~*req.2"},{"path":"Weights","tag":"Weights","type":"*variable","value":"~*req.3"},{"path":"Blockers","tag":"Blockers","type":"*variable","value":"~*req.4"},{"new_branch":true,"path":"Attributes.FilterIDs","tag":"AttributeFilterIDs","type":"*variable","value":"~*req.5"},{"path":"Attributes.Blockers","tag":"AttributeBlockers","type":"*variable","value":"~*req.6"},{"path":"Attributes.Path","tag":"Path","type":"*variable","value":"~*req.7"},{"path":"Attributes.Type","tag":"Type","type":"*variable","value":"~*req.8"},{"path":"Attributes.Value","tag":"Value","type":"*variable","value":"~*req.9"}],"file_name":"Attributes.csv","flags":null,"type":"*attributes"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"path":"FilterIDs","tag":"FilterIDs","type":"*variable","value":"~*req.2"},{"path":"Weights","tag":"Weights","type":"*variable","value":"~*req.3"},{"path":"UsageTTL","tag":"TTL","type":"*variable","value":"~*req.4"},{"path":"Limit","tag":"Limit","type":"*variable","value":"~*req.5"},{"path":"AllocationMessage","tag":"AllocationMessage","type":"*variable","value":"~*req.6"},{"path":"Blocker","tag":"Blocker","type":"*variable","value":"~*req.7"},{"path":"Stored","tag":"Stored","type":"*variable","value":"~*req.8"},{"path":"ThresholdIDs","tag":"ThresholdIDs","type":"*variable","value":"~*req.9"}],"file_name":"Resources.csv","flags":null,"type":"*resources"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"path":"FilterIDs","tag":"FilterIDs","type":"*variable","value":"~*req.2"},{"path":"Weights","tag":"Weights","type":"*variable","value":"~*req.3"},{"path":"TTL","tag":"TTL","type":"*variable","value":"~*req.4"},{"path":"Stored","tag":"Stored","type":"*variable","value":"~*req.5"},{"new_branch":true,"path":"Pools.ID","tag":"PoolID","type":"*variable","value":"~*req.6"},{"path":"Pools.FilterIDs","tag":"PoolFilterIDs","type":"*variable","value":"~*req.7"},{"path":"Pools.Type","tag":"PoolType","type":"*variable","value":"~*req.8"},{"path":"Pools.Range","tag":"PoolRange","type":"*variable","value":"~*req.9"},{"path":"Pools.Strategy","tag":"PoolStrategy","type":"*variable","value":"~*req.10"},{"path":"Pools.Message","tag":"PoolMessage","type":"*variable","value":"~*req.11"},{"path":"Pools.Weights","tag":"PoolWeights","type":"*variable","value":"~*req.12"},{"path":"Pools.Blockers","tag":"PoolBlockers","type":"*variable","value":"~*req.13"}],"file_name":"IPs.csv","flags":null,"type":"*ips"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"path":"FilterIDs","tag":"FilterIDs","type":"*variable","value":"~*req.2"},{"path":"Weights","tag":"Weights","type":"*variable","value":"~*req.3"},{"path":"Blockers","tag":"Blockers","type":"*variable","value":"~*req.4"},{"path":"QueueLength","tag":"QueueLength","type":"*variable","value":"~*req.5"},{"path":"TTL","tag":"TTL","type":"*variable","value":"~*req.6"},{"path":"MinItems","tag":"MinItems","type":"*variable","value":"~*req.7"},{"path":"Stored","tag":"Stored","type":"*variable","value":"~*req.8"},{"path":"ThresholdIDs","tag":"ThresholdIDs","type":"*variable","value":"~*req.9"},{"new_branch":true,"path":"Metrics.MetricID","tag":"MetricIDs","type":"*variable","value":"~*req.10"},{"path":"Metrics.FilterIDs","tag":"MetricFilterIDs","type":"*variable","value":"~*req.11"},{"path":"Metrics.Blockers","tag":"MetricBlockers","type":"*variable","value":"~*req.12"}],"file_name":"Stats.csv","flags":null,"type":"*stats"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"path":"FilterIDs","tag":"FilterIDs","type":"*variable","value":"~*req.2"},{"path":"Weights","tag":"Weights","type":"*variable","value":"~*req.3"},{"path":"MaxHits","tag":"MaxHits","type":"*variable","value":"~*req.4"},{"path":"MinHits","tag":"MinHits","type":"*variable","value":"~*req.5"},{"path":"MinSleep","tag":"MinSleep","type":"*variable","value":"~*req.6"},{"path":"Blocker","tag":"Blocker","type":"*variable","value":"~*req.7"},{"path":"ActionProfileIDs","tag":"ActionProfileIDs","type":"*variable","value":"~*req.8"},{"path":"Async","tag":"Async","type":"*variable","value":"~*req.9"}],"file_name":"Thresholds.csv","flags":null,"type":"*thresholds"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"path":"Schedule","tag":"Schedule","type":"*variable","value":"~*req.2"},{"path":"StatID","tag":"StatID","type":"*variable","value":"~*req.3"},{"path":"Metrics","tag":"Metrics","type":"*variable","value":"~*req.4"},{"path":"TTL","tag":"TTL","type":"*variable","value":"~*req.5"},{"path":"QueueLength","tag":"QueueLength","type":"*variable","value":"~*req.6"},{"path":"MinItems","tag":"MinItems","type":"*variable","value":"~*req.7"},{"path":"CorrelationType","tag":"CorrelationType","type":"*variable","value":"~*req.8"},{"path":"Tolerance","tag":"Tolerance","type":"*variable","value":"~*req.9"},{"path":"Stored","tag":"Stored","type":"*variable","value":"~*req.10"},{"path":"ThresholdIDs","tag":"ThresholdIDs","type":"*variable","value":"~*req.11"}],"file_name":"Trends.csv","flags":null,"type":"*trends"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"path":"Schedule","tag":"Schedule","type":"*variable","value":"~*req.2"},{"path":"StatIDs","tag":"StatIDs","type":"*variable","value":"~*req.3"},{"path":"MetricIDs","tag":"MetricIDs","type":"*variable","value":"~*req.4"},{"path":"Sorting","tag":"Sorting","type":"*variable","value":"~*req.5"},{"path":"SortingParameters","tag":"SortingParameters","type":"*variable","value":"~*req.6"},{"path":"Stored","tag":"Stored","type":"*variable","value":"~*req.7"},{"path":"ThresholdIDs","tag":"ThresholdIDs","type":"*variable","value":"~*req.8"}],"file_name":"Rankings.csv","flags":null,"type":"*rankings"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"path":"FilterIDs","tag":"FilterIDs","type":"*variable","value":"~*req.2"},{"path":"Weights","tag":"Weights","type":"*variable","value":"~*req.3"},{"path":"Blockers","tag":"Blockers","type":"*variable","value":"~*req.4"},{"path":"Sorting","tag":"Sorting","type":"*variable","value":"~*req.5"},{"path":"SortingParameters","tag":"SortingParameters","type":"*variable","value":"~*req.6"},{"new_branch":true,"path":"Routes.ID","tag":"RouteID","type":"*variable","value":"~*req.7"},{"path":"Routes.FilterIDs","tag":"RouteFilterIDs","type":"*variable","value":"~*req.8"},{"path":"Routes.AccountIDs","tag":"RouteAccountIDs","type":"*variable","value":"~*req.9"},{"path":"Routes.RateProfileIDs","tag":"RouteRateProfileIDs","type":"*variable","value":"~*req.10"},{"path":"Routes.ResourceIDs","tag":"RouteResourceIDs","type":"*variable","value":"~*req.11"},{"path":"Routes.StatIDs","tag":"RouteStatIDs","type":"*variable","value":"~*req.12"},{"path":"Routes.Weights","tag":"RouteWeights","type":"*variable","value":"~*req.13"},{"path":"Routes.Blockers","tag":"RouteBlockers","type":"*variable","value":"~*req.14"},{"path":"Routes.RouteParameters","tag":"RouteParameters","type":"*variable","value":"~*req.15"}],"file_name":"Routes.csv","flags":null,"type":"*routes"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"path":"FilterIDs","tag":"FilterIDs","type":"*variable","value":"~*req.2"},{"path":"Weights","tag":"Weights","type":"*variable","value":"~*req.3"},{"path":"Blockers","tag":"Blockers","type":"*variable","value":"~*req.4"},{"path":"RunID","tag":"RunID","type":"*variable","value":"~*req.5"},{"path":"AttributeIDs","tag":"AttributeIDs","type":"*variable","value":"~*req.6"}],"file_name":"Chargers.csv","flags":null,"type":"*chargers"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"path":"FilterIDs","tag":"FilterIDs","type":"*variable","value":"~*req.2"},{"path":"Weights","tag":"Weights","type":"*variable","value":"~*req.3"},{"path":"MinCost","tag":"MinCost","type":"*variable","value":"~*req.4"},{"path":"MaxCost","tag":"MaxCost","type":"*variable","value":"~*req.5"},{"path":"MaxCostStrategy","tag":"MaxCostStrategy","type":"*variable","value":"~*req.6"},{"filters":["*notempty:~*req.7:"],"path":"Rates[\u003c~*req.7\u003e].FilterIDs","tag":"RateFilterIDs","type":"*variable","value":"~*req.8"},{"filters":["*notempty:~*req.7:"],"path":"Rates[\u003c~*req.7\u003e].ActivationTimes","tag":"RateActivationTimes","type":"*variable","value":"~*req.9"},{"filters":["*notempty:~*req.7:"],"path":"Rates[\u003c~*req.7\u003e].Weights","tag":"RateWeights","type":"*variable","value":"~*req.10"},{"filters":["*notempty:~*req.7:"],"path":"Rates[\u003c~*req.7\u003e].Blocker","tag":"RateBlocker","type":"*variable","value":"~*req.11"},{"filters":["*notempty:~*req.7:"],"new_branch":true,"path":"Rates[\u003c~*req.7\u003e].IntervalRates.IntervalStart","tag":"RateIntervalStart","type":"*variable","value":"~*req.12"},{"filters":["*notempty:~*req.7:"],"path":"Rates[\u003c~*req.7\u003e].IntervalRates.FixedFee","tag":"RateFixedFee","type":"*variable","value":"~*req.13"},{"filters":["*notempty:~*req.7:"],"path":"Rates[\u003c~*req.7\u003e].IntervalRates.RecurrentFee","tag":"RateRecurrentFee","type":"*variable","value":"~*req.14"},{"filters":["*notempty:~*req.7:"],"path":"Rates[\u003c~*req.7\u003e].IntervalRates.Unit","tag":"RateUnit","type":"*variable","value":"~*req.15"},{"filters":["*notempty:~*req.7:"],"path":"Rates[\u003c~*req.7\u003e].IntervalRates.Increment","tag":"RateIncrement","type":"*variable","value":"~*req.16"}],"file_name":"Rates.csv","flags":null,"type":"*rate_profiles"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"path":"FilterIDs","tag":"FilterIDs","type":"*variable","value":"~*req.2"},{"path":"Weights","tag":"Weights","type":"*variable","value":"~*req.3"},{"path":"Blockers","tag":"Blockers","type":"*variable","value":"~*req.4"},{"path":"Schedule","tag":"Schedule","type":"*variable","value":"~*req.5"},{"path":"Targets[\u003c~*req.6\u003e]","tag":"TargetIDs","type":"*variable","value":"~*req.7"},{"filters":["*notempty:~*req.8:"],"path":"Actions[\u003c~*req.8\u003e].FilterIDs","tag":"ActionFilterIDs","type":"*variable","value":"~*req.9"},{"filters":["*notempty:~*req.8:"],"path":"Actions[\u003c~*req.8\u003e].TTL","tag":"ActionTTL","type":"*variable","value":"~*req.10"},{"filters":["*notempty:~*req.8:"],"path":"Actions[\u003c~*req.8\u003e].Type","tag":"ActionType","type":"*variable","value":"~*req.11"},{"filters":["*notempty:~*req.8:"],"path":"Actions[\u003c~*req.8\u003e].Opts","tag":"ActionOpts","type":"*variable","value":"~*req.12"},{"filters":["*notempty:~*req.8:"],"new_branch":true,"path":"Actions[\u003c~*req.8\u003e].Diktats.Path","tag":"ActionPath","type":"*variable","value":"~*req.13"},{"filters":["*notempty:~*req.8:"],"path":"Actions[\u003c~*req.8\u003e].Diktats.Value","tag":"ActionValue","type":"*variable","value":"~*req.14"}],"file_name":"Actions.csv","flags":null,"type":"*action_profiles"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"path":"FilterIDs","tag":"FilterIDs","type":"*variable","value":"~*req.2"},{"path":"Weights","tag":"Weights","type":"*variable","value":"~*req.3"},{"path":"Blockers","tag":"Blockers","type":"*variable","value":"~*req.4"},{"path":"Opts","tag":"Opts","type":"*variable","value":"~*req.5"},{"filters":["*notempty:~*req.6:"],"path":"Balances[\u003c~*req.6\u003e].FilterIDs","tag":"BalanceFilterIDs","type":"*variable","value":"~*req.7"},{"filters":["*notempty:~*req.6:"],"path":"Balances[\u003c~*req.6\u003e].Weights","tag":"BalanceWeights","type":"*variable","value":"~*req.8"},{"filters":["*notempty:~*req.6:"],"path":"Balances[\u003c~*req.6\u003e].Blockers","tag":"BalanceBlockers","type":"*variable","value":"~*req.9"},{"filters":["*notempty:~*req.6:"],"path":"Balances[\u003c~*req.6\u003e].Type","tag":"BalanceType","type":"*variable","value":"~*req.10"},{"filters":["*notempty:~*req.6:"],"path":"Balances[\u003c~*req.6\u003e].Units","tag":"BalanceUnits","type":"*variable","value":"~*req.11"},{"filters":["*notempty:~*req.6:"],"path":"Balances[\u003c~*req.6\u003e].UnitFactors","tag":"BalanceUnitFactors","type":"*variable","value":"~*req.12"},{"filters":["*notempty:~*req.6:"],"path":"Balances[\u003c~*req.6\u003e].Opts","tag":"BalanceOpts","type":"*variable","value":"~*req.13"},{"filters":["*notempty:~*req.6:"],"path":"Balances[\u003c~*req.6\u003e].CostIncrements","tag":"BalanceCostIncrements","type":"*variable","value":"~*req.14"},{"filters":["*notempty:~*req.6:"],"path":"Balances[\u003c~*req.6\u003e].AttributeIDs","tag":"BalanceAttributeIDs","type":"*variable","value":"~*req.15"},{"filters":["*notempty:~*req.6:"],"path":"Balances[\u003c~*req.6\u003e].RateProfileIDs","tag":"BalanceRateProfileIDs","type":"*variable","value":"~*req.16"},{"path":"ThresholdIDs","tag":"ThresholdIDs","type":"*variable","value":"~*req.17"}],"file_name":"Accounts.csv","flags":null,"type":"*accounts"}],"enabled":false,"field_separator":",","id":"*default","lockfile_path":".cgr.lck","opts":{"*cache":"","*forceLock":false,"*stopOnError":false,"*withIndex":true},"run_delay":"0","tenant":"","tp_in_dir":"/var/spool/cgrates/loader/in","tp_out_dir":"/var/spool/cgrates/loader/out"}],"logger":{"efs_conns":["*internal"],"level":6,"opts":{"failed_posts_dir":"/var/spool/cgrates/failed_posts","kafka_attempts":1,"kafka_conn":"","kafka_topic":""},"type":"*syslog"},"migrator":{"out_datadb_encoding":"msgpack","out_datadb_host":"127.0.0.1","out_datadb_name":"10","out_datadb_opts":{"mongoConnScheme":"mongodb","mongoQueryTimeout":"10s","redisCACertificate":"","redisClientCertificate":"","redisClientKey":"","redisCluster":false,"redisClusterOndownDelay":"0s","redisClusterSync":"5s","redisConnectAttempts":20,"redisConnectTimeout":"0s","redisMaxConns":10,"redisPoolPipelineLimit":0,"redisPoolPipelineWindow":"150µs","redisReadTimeout":"0s","redisSentinel":"","redisTLS":false,"redisWriteTimeout":"0s"},"out_datadb_password":"","out_datadb_port":"6379","out_datadb_type":"*redis","out_datadb_user":"cgrates","users_filters":null},"prometheus_agent":{"collect_go_metrics":false,"collect_process_metrics":false,"cores_conns":[],"enabled":false,"path":"/prometheus","stat_queue_ids":null,"stats_conns":[]},"radius_agent":{"client_dictionaries":{"*default":"/usr/share/cgrates/radius/dict/"},"client_secrets":{"*default":"CGRateS.org"},"enabled":false,"listen_acct":"127.0.0.1:1813","listen_auth":"127.0.0.1:1812","listen_net":"udp","request_processors":[],"sessions_conns":["*internal"]},"rankings":{"ees_conns":[],"ees_exporter_ids":null,"enabled":false,"scheduled_ids":{},"stats_conns":[],"store_interval":"","thresholds_conns":[]},"rates":{"enabled":false,"exists_indexed_fields":[],"indexed_selects":true,"nested_fields":false,"notexists_indexed_fields":[],"opts":{"*intervalStart":[{"FilterIDs":null,"Tenant":""}],"*profileIDs":[],"*profileIgnoreFilters":[{"FilterIDs":null,"Tenant":""}],"*startTime":[{"FilterIDs":null,"Tenant":""}],"*usage":[{"FilterIDs":null,"Tenant":""}]},"prefix_indexed_fields":[],"rate_exists_indexed_fields":[],"rate_indexed_selects":true,"rate_nested_fields":false,"rate_notexists_indexed_fields":[],"rate_prefix_indexed_fields":[],"rate_suffix_indexed_fields":[],"suffix_indexed_fields":[],"verbosity":1000},"registrarc":{"rpc":{"hosts":[],"refresh_interval":"5m0s","registrars_conns":[]}},"resources":{"enabled":false,"exists_indexed_fields":[],"indexed_selects":true,"nested_fields":false,"notexists_indexed_fields":[],"opts":{"*units":[{"FilterIDs":null,"Tenant":""}],"*usageID":[{"FilterIDs":null,"Tenant":""}],"*usageTTL":[{"FilterIDs":null,"Tenant":""}]},"prefix_indexed_fields":[],"store_interval":"","suffix_indexed_fields":[],"thresholds_conns":[]},"routes":{"accounts_conns":[],"attributes_conns":[],"default_ratio":1,"enabled":false,"exists_indexed_fields":[],"indexed_selects":true,"nested_fields":false,"notexists_indexed_fields":[],"opts":{"*context":[{"FilterIDs":null,"Tenant":""}],"*ignoreErrors":[{"FilterIDs":null,"Tenant":""}],"*limit":[],"*maxCost":[{"Tenant":"","Value":""}],"*maxItems":[],"*offset":[],"*profileCount":[{"FilterIDs":null,"Tenant":""}],"*usage":[{"FilterIDs":null,"Tenant":""}]},"prefix_indexed_fields":[],"rates_conns":[],"resources_conns":[],"stats_conns":[],"suffix_indexed_fields":[]},"rpc_conns":{"*bijson_localhost":{"conns":[{"address":"127.0.0.1:2014","transport":"*birpc_json"}],"poolSize":0,"strategy":"*first"},"*birpc_internal":{"conns":[{"address":"*birpc_internal","transport":""}],"poolSize":0,"strategy":"*first"},"*internal":{"conns":[{"address":"*internal","transport":""}],"poolSize":0,"strategy":"*first"},"*localhost":{"conns":[{"address":"127.0.0.1:2012","transport":"*json"}],"poolSize":0,"strategy":"*first"}},"sentrypeer":{"audience":"https://sentrypeer.com/api","client_id":"","client_secret":"","grant_type":"client_credentials","ips_url":"https://sentrypeer.com/api/ip-addresses","numbers_url":"https://sentrypeer.com/api/phone-numbers","token_url":"https://authz.sentrypeer.com/oauth/token"},"sessions":{"accounts_conns":[],"actions_conns":[],"alterable_fields":[],"attributes_conns":[],"cdrs_conns":[],"channel_sync_interval":"0","chargers_conns":[],"client_protocol":1,"default_usage":{"*any":"3h0m0s","*data":"1048576","*sms":"1","*voice":"3h0m0s"},"enabled":false,"ips_conns":[],"listen_bigob":"","listen_bijson":"127.0.0.1:2014","min_dur_low_balance":"0","opts":{"*accounts":[{"FilterIDs":null,"Tenant":""}],"*accountsForceUsage":[],"*attributes":[{"FilterIDs":null,"Tenant":""}],"*attributesDerivedReply":[{"FilterIDs":null,"Tenant":""}],"*blockerError":[{"FilterIDs":null,"Tenant":""}],"*cdrs":[{"FilterIDs":null,"Tenant":""}],"*cdrsDerivedReply":[{"FilterIDs":null,"Tenant":""}],"*chargeable":[{"FilterIDs":null,"Tenant":""}],"*chargers":[{"FilterIDs":null,"Tenant":""}],"*debitInterval":[{"FilterIDs":null,"Tenant":""}],"*forceUsage":[],"*initiate":[{"FilterIDs":null,"Tenant":""}],"*ips":[{"FilterIDs":null,"Tenant":""}],"*ipsAllocate":[{"FilterIDs":null,"Tenant":""}],"*ipsAuthorize":[{"FilterIDs":null,"Tenant":""}],"*ipsRelease":[{"FilterIDs":null,"Tenant":""}],"*maxUsage":[{"FilterIDs":null,"Tenant":""}],"*message":[{"FilterIDs":null,"Tenant":""}],"*originID":[],"*resources":[{"FilterIDs":null,"Tenant":""}],"*resourcesAllocate":[{"FilterIDs":null,"Tenant":""}],"*resourcesAuthorize":[{"FilterIDs":null,"Tenant":""}],"*resourcesDerivedReply":[{"FilterIDs":null,"Tenant":""}],"*resourcesRelease":[{"FilterIDs":null,"Tenant":""}],"*routes":[{"FilterIDs":null,"Tenant":""}],"*routesDerivedReply":[{"FilterIDs":null,"Tenant":""}],"*stats":[{"FilterIDs":null,"Tenant":""}],"*statsDerivedReply":[{"FilterIDs":null,"Tenant":""}],"*terminate":[{"FilterIDs":null,"Tenant":""}],"*thresholds":[{"FilterIDs":null,"Tenant":""}],"*thresholdsDerivedReply":[{"FilterIDs":null,"Tenant":""}],"*ttl":[{"FilterIDs":null,"Tenant":""}],"*ttlLastUsage":[],"*ttlLastUsed":[],"*ttlMaxDelay":[{"FilterIDs":null,"Tenant":""}],"*ttlUsage":[],"*update":[{"FilterIDs":null,"Tenant":""}]},"rates_conns":[],"replication_conns":[],"resources_conns":[],"routes_conns":[],"session_indexes":[],"stats_conns":[],"stir":{"allowed_attest":["*any"],"default_attest":"A","payload_maxduration":"-1","privatekey_path":"","publickey_path":""},"store_session_costs":false,"terminate_attempts":5,"thresholds_conns":[]},"sip_agent":{"enabled":false,"listen":"127.0.0.1:5060","listen_net":"udp","request_processors":[],"retransmission_timer":"1s","sessions_conns":["*internal"],"timezone":""},"stats":{"ees_conns":[],"ees_exporter_ids":null,"enabled":false,"exists_indexed_fields":[],"indexed_selects":true,"nested_fields":false,"notexists_indexed_fields":[],"opts":{"*profileIDs":[],"*profileIgnoreFilters":[{"FilterIDs":null,"Tenant":""}],"*roundingDecimals":[]},"prefix_indexed_fields":[],"store_interval":"","store_uncompressed_limit":0,"suffix_indexed_fields":[],"thresholds_conns":[]},"stor_db":{"db_host":"127.0.0.1","db_name":"cgrates","db_password":"CGRateS.org","db_port":3306,"db_type":"**mysql","db_user":"cgrates","items":{"*cdrs":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false}},"opts":{"internalDBBackupPath":"/var/lib/cgrates/internal_db/backup/stordb","internalDBDumpInterval":"0s","internalDBDumpPath":"/var/lib/cgrates/internal_db/stordb","internalDBFileSizeLimit":1073741824,"internalDBRewriteInterval":"0s","internalDBStartTimeout":"5m0s","mongoConnScheme":"mongodb","mongoQueryTimeout":"10s","mysqlDSNParams":{},"mysqlLocation":"Local","pgSSLMode":"disable","sqlConnMaxLifetime":"0s","sqlLogLevel":3,"sqlMaxIdleConns":10,"sqlMaxOpenConns":100},"prefix_indexed_fields":[],"remote_conns":null,"replication_conns":null,"string_indexed_fields":[]},"suretax":{"bill_to_number":"","business_unit":"","client_number":"","client_tracking":"~*opts.*originID","customer_number":"~*req.Subject","include_local_cost":false,"orig_number":"~*req.Subject","p2pplus4":"","p2pzipcode":"","plus4":"","regulatory_code":"03","response_group":"03","response_type":"D4","return_file_code":"0","sales_type_code":"R","tax_exemption_code_list":"","tax_included":"0","tax_situs_rule":"04","term_number":"~*req.Destination","timezone":"UTC","trans_type_code":"010101","unit_type":"00","units":"1","url":"","validation_key":"","zipcode":""},"templates":{"*asr":[{"mandatory":true,"path":"*diamreq.Session-Id","tag":"SessionId","type":"*variable","value":"~*req.Session-Id"},{"mandatory":true,"path":"*diamreq.Origin-Host","tag":"OriginHost","type":"*variable","value":"~*req.Destination-Host"},{"mandatory":true,"path":"*diamreq.Origin-Realm","tag":"OriginRealm","type":"*variable","value":"~*req.Destination-Realm"},{"mandatory":true,"path":"*diamreq.Destination-Realm","tag":"DestinationRealm","type":"*variable","value":"~*req.Origin-Realm"},{"mandatory":true,"path":"*diamreq.Destination-Host","tag":"DestinationHost","type":"*variable","value":"~*req.Origin-Host"},{"mandatory":true,"path":"*diamreq.Auth-Application-Id","tag":"AuthApplicationId","type":"*variable","value":"~*vars.*appid"}],"*cca":[{"mandatory":true,"path":"*rep.Session-Id","tag":"SessionId","type":"*variable","value":"~*req.Session-Id"},{"path":"*rep.Result-Code","tag":"ResultCode","type":"*constant","value":"2001"},{"mandatory":true,"path":"*rep.Origin-Host","tag":"OriginHost","type":"*variable","value":"~*vars.OriginHost"},{"mandatory":true,"path":"*rep.Origin-Realm","tag":"OriginRealm","type":"*variable","value":"~*vars.OriginRealm"},{"mandatory":true,"path":"*rep.Auth-Application-Id","tag":"AuthApplicationId","type":"*variable","value":"~*vars.*appid"},{"mandatory":true,"path":"*rep.CC-Request-Type","tag":"CCRequestType","type":"*variable","value":"~*req.CC-Request-Type"},{"mandatory":true,"path":"*rep.CC-Request-Number","tag":"CCRequestNumber","type":"*variable","value":"~*req.CC-Request-Number"}],"*cdrLog":[{"mandatory":true,"path":"*cdr.ToR","tag":"ToR","type":"*variable","value":"~*req.BalanceType"},{"mandatory":true,"path":"*cdr.OriginHost","tag":"OriginHost","type":"*constant","value":"127.0.0.1"},{"mandatory":true,"path":"*cdr.RequestType","tag":"RequestType","type":"*constant","value":"*none"},{"mandatory":true,"path":"*cdr.Tenant","tag":"Tenant","type":"*variable","value":"~*req.Tenant"},{"mandatory":true,"path":"*cdr.Account","tag":"Account","type":"*variable","value":"~*req.Account"},{"mandatory":true,"path":"*cdr.Subject","tag":"Subject","type":"*variable","value":"~*req.Account"},{"mandatory":true,"path":"*cdr.Cost","tag":"Cost","type":"*variable","value":"~*req.Cost"},{"mandatory":true,"path":"*cdr.Source","tag":"Source","type":"*constant","value":"*cdrLog"},{"mandatory":true,"path":"*cdr.Usage","tag":"Usage","type":"*constant","value":"1"},{"mandatory":true,"path":"*cdr.RunID","tag":"RunID","type":"*variable","value":"~*req.ActionType"},{"mandatory":true,"path":"*cdr.SetupTime","tag":"SetupTime","type":"*constant","value":"*now"},{"mandatory":true,"path":"*cdr.AnswerTime","tag":"AnswerTime","type":"*constant","value":"*now"},{"mandatory":true,"path":"*cdr.PreRated","tag":"PreRated","type":"*constant","value":"true"}],"*err":[{"mandatory":true,"path":"*rep.Session-Id","tag":"SessionId","type":"*variable","value":"~*req.Session-Id"},{"mandatory":true,"path":"*rep.Origin-Host","tag":"OriginHost","type":"*variable","value":"~*vars.OriginHost"},{"mandatory":true,"path":"*rep.Origin-Realm","tag":"OriginRealm","type":"*variable","value":"~*vars.OriginRealm"}],"*errSip":[{"mandatory":true,"path":"*rep.Request","tag":"Request","type":"*constant","value":"SIP/2.0 500 Internal Server Error"}],"*fsa":[{"path":"*cgreq.ToR","tag":"ToR","type":"*constant","value":"*voice"},{"path":"*cgreq.PDD","tag":"PDD","type":"*composed","value":"~*req.variable_progress_mediamsec;ms"},{"path":"*cgreq.ACD","tag":"ACD","type":"*composed","value":"~*req.variable_cdr_acd;s"},{"path":"*cgreq.OriginID","tag":"OriginID","type":"*variable","value":"~*req.Unique-ID"},{"path":"*opts.*originID","tag":"*originID","type":"*variable","value":"~*req.Unique-ID"},{"path":"*cgreq.OriginHost","tag":"OriginHost","type":"*variable","value":"~*req.variable_cgr_originhost"},{"path":"*cgreq.Account","tag":"Account","type":"*variable","value":"~*req.Caller-Username"},{"path":"*cgreq.Source","tag":"Source","type":"*composed","value":"FS_;~*req.Event-Name"},{"filters":["*string:*req.variable_process_cdr:false"],"path":"*cgreq.RequestType","tag":"RequestType","type":"*constant","value":"*none"},{"filters":["*string:*req.Caller-Dialplan:inline"],"path":"*cgreq.RequestType","tag":"RequestType","type":"*constant","value":"*none"},{"filters":["*exists:*cgreq.RequestType:"],"path":"*cgreq.RequestType","tag":"RequestType","type":"*constant","value":"*prepaid"},{"path":"*cgreq.Tenant","tag":"Tenant","type":"*constant","value":"cgrates.org"},{"path":"*cgreq.Category","tag":"Category","type":"*constant","value":"call"},{"path":"*cgreq.Subject","tag":"Subject","type":"*variable","value":"~*req.Caller-Username"},{"path":"*cgreq.Destination","tag":"Destination","type":"*variable","value":"~*req.Caller-Destination-Number"},{"path":"*cgreq.SetupTime","tag":"SetupTime","type":"*variable","value":"~*req.Caller-Channel-Created-Time"},{"path":"*cgreq.AnswerTime","tag":"AnswerTime","type":"*variable","value":"~*req.Caller-Channel-Answered-Time"},{"path":"*cgreq.Usage","tag":"Usage","type":"*composed","value":"~*req.variable_billsec;s"},{"path":"*cgreq.Route","tag":"Route","type":"*variable","value":"~*req.variable_cgr_route"},{"path":"*cgreq.Cost","tag":"Cost","type":"*constant","value":"-1.0"},{"filters":["*notempty:*req.Hangup-Cause:"],"path":"*cgreq.DisconnectCause","tag":"DisconnectCause","type":"*variable","value":"~*req.Hangup-Cause"}],"*rar":[{"mandatory":true,"path":"*diamreq.Session-Id","tag":"SessionId","type":"*variable","value":"~*req.Session-Id"},{"mandatory":true,"path":"*diamreq.Origin-Host","tag":"OriginHost","type":"*variable","value":"~*req.Destination-Host"},{"mandatory":true,"path":"*diamreq.Origin-Realm","tag":"OriginRealm","type":"*variable","value":"~*req.Destination-Realm"},{"mandatory":true,"path":"*diamreq.Destination-Realm","tag":"DestinationRealm","type":"*variable","value":"~*req.Origin-Realm"},{"mandatory":true,"path":"*diamreq.Destination-Host","tag":"DestinationHost","type":"*variable","value":"~*req.Origin-Host"},{"mandatory":true,"path":"*diamreq.Auth-Application-Id","tag":"AuthApplicationId","type":"*variable","value":"~*vars.*appid"},{"path":"*diamreq.Re-Auth-Request-Type","tag":"ReAuthRequestType","type":"*constant","value":"0"}]},"thresholds":{"actions_conns":[],"enabled":false,"exists_indexed_fields":[],"indexed_selects":true,"nested_fields":false,"notexists_indexed_fields":[],"opts":{"*profileIDs":[],"*profileIgnoreFilters":[{"FilterIDs":null,"Tenant":""}]},"prefix_indexed_fields":[],"store_interval":"","suffix_indexed_fields":[]},"tls":{"ca_certificate":"","client_certificate":"","client_key":"","server_certificate":"","server_key":"","server_name":"","server_policy":4},"tpes":{"enabled":false},"trends":{"ees_conns":[],"ees_exporter_ids":null,"enabled":false,"scheduled_ids":{},"stats_conns":[],"store_interval":"","store_uncompressed_limit":0,"thresholds_conns":[]}}` + expected := `{"accounts":{"attributes_conns":[],"enabled":false,"exists_indexed_fields":[],"indexed_selects":true,"max_iterations":1000,"max_usage":"259200000000000","nested_fields":false,"notexists_indexed_fields":[],"opts":{"*profileIDs":[],"*profileIgnoreFilters":[{"FilterIDs":null,"Tenant":""}],"*usage":[{"FilterIDs":null,"Tenant":""}]},"prefix_indexed_fields":[],"rates_conns":[],"suffix_indexed_fields":[],"thresholds_conns":[]},"actions":{"accounts_conns":[],"cdrs_conns":[],"dynaprepaid_actionprofile":[],"ees_conns":[],"enabled":false,"exists_indexed_fields":[],"indexed_selects":true,"nested_fields":false,"notexists_indexed_fields":[],"opts":{"*posterAttempts":[{"FilterIDs":null,"Tenant":""}],"*profileIDs":[],"*profileIgnoreFilters":[{"FilterIDs":null,"Tenant":""}]},"prefix_indexed_fields":[],"stats_conns":[],"suffix_indexed_fields":[],"tenants":[],"thresholds_conns":[]},"admins":{"actions_conns":[],"attributes_conns":[],"caches_conns":["*internal"],"ees_conns":[],"enabled":false},"analyzers":{"cleanup_interval":"1h0m0s","db_path":"/var/spool/cgrates/analyzers","ees_conns":[],"enabled":false,"index_type":"*scorch","opts":{"*exporterIDs":[]},"ttl":"24h0m0s"},"apiban":{"enabled":false,"keys":[]},"asterisk_agent":{"asterisk_conns":[{"address":"127.0.0.1:8088","alias":"","connect_attempts":3,"max_reconnect_interval":"0s","password":"CGRateS.org","reconnects":5,"user":"cgrates"}],"create_cdr":false,"enabled":false,"sessions_conns":["*birpc_internal"]},"attributes":{"accounts_conns":[],"enabled":false,"exists_indexed_fields":[],"indexed_selects":true,"nested_fields":false,"notexists_indexed_fields":[],"opts":{"*processRuns":[{"FilterIDs":null,"Tenant":""}],"*profileIDs":[],"*profileIgnoreFilters":[{"FilterIDs":null,"Tenant":""}],"*profileRuns":[{"FilterIDs":null,"Tenant":""}]},"prefix_indexed_fields":[],"resources_conns":[],"stats_conns":[],"suffix_indexed_fields":[]},"caches":{"partitions":{"*account_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*accounts":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*action_profile_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*action_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*apiban":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"2m0s"},"*attribute_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*attribute_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*caps_events":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*cdr_ids":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"10m0s"},"*charger_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*charger_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*closed_sessions":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"10s"},"*diameter_messages":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"3h0m0s"},"*event_charges":{"limit":0,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"10s"},"*event_ips":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*event_resources":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*filters":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*ip_allocations":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*ip_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*ip_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*load_ids":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*ranking_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*rankings":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*rate_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*rate_profile_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*rate_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*replication_hosts":{"limit":0,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*resource_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*resource_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*resources":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*reverse_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*route_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*route_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*rpc_connections":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*rpc_responses":{"limit":0,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"2s"},"*sentrypeer":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":true,"ttl":"24h0m0s"},"*stat_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*statqueue_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*statqueues":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*stir":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"3h0m0s"},"*threshold_filter_indexes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*threshold_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*thresholds":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*trend_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*trends":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false},"*uch":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"3h0m0s"}},"remote_conns":[],"replication_conns":[]},"cdrs":{"accounts_conns":[],"actions_conns":[],"attributes_conns":[],"chargers_conns":[],"ees_conns":[],"enabled":false,"extra_fields":[],"online_cdr_exports":null,"opts":{"*accounts":[{"FilterIDs":null,"Tenant":""}],"*attributes":[{"FilterIDs":null,"Tenant":""}],"*chargers":[{"FilterIDs":null,"Tenant":""}],"*ees":[{"FilterIDs":null,"Tenant":""}],"*rates":[{"FilterIDs":null,"Tenant":""}],"*refund":[{"FilterIDs":null,"Tenant":""}],"*rerate":[{"FilterIDs":null,"Tenant":""}],"*stats":[{"FilterIDs":null,"Tenant":""}],"*store":[{"FilterIDs":null,"Tenant":""}],"*thresholds":[{"FilterIDs":null,"Tenant":""}]},"rates_conns":[],"session_cost_retries":5,"stats_conns":[],"thresholds_conns":[]},"chargers":{"attributes_conns":[],"enabled":false,"exists_indexed_fields":[],"indexed_selects":true,"nested_fields":false,"notexists_indexed_fields":[],"prefix_indexed_fields":[],"suffix_indexed_fields":[]},"config_db":{"db_host":"","db_name":"","db_password":"","db_port":0,"db_type":"*internal","db_user":"","opts":{"internalDBBackupPath":"/var/lib/cgrates/internal_db/backup/configdb","internalDBDumpInterval":"0s","internalDBDumpPath":"/var/lib/cgrates/internal_db/configdb","internalDBFileSizeLimit":1073741824,"internalDBRewriteInterval":"0s","internalDBStartTimeout":"5m0s","mongoConnScheme":"mongodb","mongoQueryTimeout":"10s","redisCACertificate":"","redisClientCertificate":"","redisClientKey":"","redisCluster":false,"redisClusterOndownDelay":"0s","redisClusterSync":"5s","redisConnectAttempts":20,"redisConnectTimeout":"0s","redisMaxConns":10,"redisReadTimeout":"0s","redisSentinel":"","redisTLS":false,"redisWriteTimeout":"0s"}},"configs":{"enabled":false,"root_dir":"/var/spool/cgrates/configs","url":"/configs/"},"cores":{"caps":0,"caps_stats_interval":"0","caps_strategy":"*busy","ees_conns":[],"shutdown_timeout":"1s"},"data_db":{"db_host":"127.0.0.1","db_name":"10","db_password":"","db_port":6379,"db_type":"*redis","db_user":"cgrates","items":{"*account_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*accounts":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*action_profile_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*action_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*actions":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*attribute_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*attribute_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*charger_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*charger_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*filters":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*ip_allocations":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*ip_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*ip_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*load_ids":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*ranking_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*rankings":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*rate_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*rate_profile_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*rate_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*resource_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*resource_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*resources":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*reverse_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*route_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*route_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*stat_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*statqueue_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*statqueues":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*threshold_filter_indexes":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*threshold_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*thresholds":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*trend_profiles":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*trends":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false},"*versions":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false}},"opts":{"internalDBBackupPath":"/var/lib/cgrates/internal_db/backup/datadb","internalDBDumpInterval":"0s","internalDBDumpPath":"/var/lib/cgrates/internal_db/datadb","internalDBFileSizeLimit":1073741824,"internalDBRewriteInterval":"0s","internalDBStartTimeout":"5m0s","mongoConnScheme":"mongodb","mongoQueryTimeout":"10s","redisCACertificate":"","redisClientCertificate":"","redisClientKey":"","redisCluster":false,"redisClusterOndownDelay":"0s","redisClusterSync":"5s","redisConnectAttempts":20,"redisConnectTimeout":"0s","redisMaxConns":10,"redisPoolPipelineLimit":0,"redisPoolPipelineWindow":"150µs","redisReadTimeout":"0s","redisSentinel":"","redisTLS":false,"redisWriteTimeout":"0s"},"remote_conn_id":"","remote_conns":[],"replication_cache":"","replication_conns":[],"replication_filtered":false},"diameter_agent":{"asr_template":"","dictionaries_path":"/usr/share/cgrates/diameter/dict/","enabled":false,"forced_disconnect":"*none","listen":"127.0.0.1:3868","listen_net":"tcp","origin_host":"CGR-DA","origin_realm":"cgrates.org","product_name":"CGRateS","rar_template":"","request_processors":[],"sessions_conns":["*birpc_internal"],"synced_conn_requests":false,"vendor_id":0},"dns_agent":{"enabled":false,"listeners":[{"address":"127.0.0.1:53","network":"udp"}],"request_processors":[],"sessions_conns":["*internal"],"timezone":""},"ees":{"attributes_conns":[],"cache":{"*fileCSV":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"5s"}},"enabled":false,"exporters":[{"attempts":1,"attribute_context":"","attribute_ids":[],"blocker":false,"concurrent_requests":0,"efs_conns":["*internal"],"export_path":"/var/spool/cgrates/ees","failed_posts_dir":"/var/spool/cgrates/failed_posts","fields":[],"filters":[],"flags":[],"id":"*default","opts":{},"synchronous":false,"timezone":"","type":"*none"}]},"efs":{"enabled":false,"failed_posts_dir":"/var/spool/cgrates/failed_posts","failed_posts_ttl":"5s","poster_attempts":3},"ers":{"enabled":false,"partial_cache_ttl":"1s","readers":[{"cache_dump_fields":[],"concurrent_requests":1024,"fields":[{"mandatory":true,"path":"*cgreq.ToR","tag":"ToR","type":"*variable","value":"~*req.2"},{"mandatory":true,"path":"*cgreq.OriginID","tag":"OriginID","type":"*variable","value":"~*req.3"},{"mandatory":true,"path":"*cgreq.RequestType","tag":"RequestType","type":"*variable","value":"~*req.4"},{"mandatory":true,"path":"*cgreq.Tenant","tag":"Tenant","type":"*variable","value":"~*req.6"},{"mandatory":true,"path":"*cgreq.Category","tag":"Category","type":"*variable","value":"~*req.7"},{"mandatory":true,"path":"*cgreq.Account","tag":"Account","type":"*variable","value":"~*req.8"},{"mandatory":true,"path":"*cgreq.Subject","tag":"Subject","type":"*variable","value":"~*req.9"},{"mandatory":true,"path":"*cgreq.Destination","tag":"Destination","type":"*variable","value":"~*req.10"},{"mandatory":true,"path":"*cgreq.SetupTime","tag":"SetupTime","type":"*variable","value":"~*req.11"},{"mandatory":true,"path":"*cgreq.AnswerTime","tag":"AnswerTime","type":"*variable","value":"~*req.12"},{"mandatory":true,"path":"*cgreq.Usage","tag":"Usage","type":"*variable","value":"~*req.13"}],"filters":[],"flags":[],"id":"*default","max_reconnect_interval":"5m0s","opts":{"csvFieldSeparator":",","csvHeaderDefineChar":":","csvRowLength":0,"natsSubject":"cgrates_cdrs","partialCacheAction":"*none","partialOrderField":"~*req.AnswerTime"},"partial_commit_fields":[],"processed_path":"/var/spool/cgrates/ers/out","reconnects":-1,"run_delay":"0","source_path":"/var/spool/cgrates/ers/in","start_delay":"0","tenant":"","timezone":"","type":"*none"}],"sessions_conns":["*internal"]},"filters":{"accounts_conns":[],"rankings_conns":[],"resources_conns":[],"stats_conns":[],"trends_conns":[]},"freeswitch_agent":{"active_session_delimiter":",","create_cdr":false,"empty_balance_ann_file":"","empty_balance_context":"","enabled":false,"event_socket_conns":[{"address":"127.0.0.1:8021","alias":"127.0.0.1:8021","max_reconnect_interval":"0s","password":"ClueCon","reconnects":5,"reply_timeout":"1m0s"}],"extra_fields":[],"low_balance_ann_file":"","max_wait_connection":"2s","request_processors":[],"sessions_conns":["*birpc_internal"],"subscribe_park":true},"general":{"caching_delay":"0","connect_attempts":5,"connect_timeout":"1s","dbdata_encoding":"*msgpack","decimal_max_scale":0,"decimal_min_scale":0,"decimal_precision":0,"decimal_rounding_mode":"*toNearestEven","default_caching":"*reload","default_category":"call","default_request_type":"*rated","default_tenant":"cgrates.org","default_timezone":"Local","digest_equal":":","digest_separator":",","locking_timeout":"0","max_parallel_conns":100,"max_reconnect_interval":"0","node_id":"ENGINE1","opts":{"*exporterIDs":[]},"reconnects":-1,"reply_timeout":"2s","rounding_decimals":5,"tpexport_dir":"/var/spool/cgrates/tpe"},"http":{"auth_users":{},"client_opts":{"dialFallbackDelay":"300ms","dialKeepAlive":"30s","dialTimeout":"30s","disableCompression":false,"disableKeepAlives":false,"expectContinueTimeout":"0s","forceAttemptHttp2":true,"idleConnTimeout":"1m30s","maxConnsPerHost":0,"maxIdleConns":100,"maxIdleConnsPerHost":2,"responseHeaderTimeout":"0s","skipTLSVerification":false,"tlsHandshakeTimeout":"10s"},"freeswitch_cdrs_url":"/freeswitch_json","http_cdrs":"/cdr_http","json_rpc_url":"/jsonrpc","pprof_path":"/debug/pprof/","registrars_url":"/registrar","use_basic_auth":false,"ws_url":"/ws"},"http_agent":[],"ips":{"enabled":false,"exists_indexed_fields":[],"indexed_selects":true,"nested_fields":false,"notexists_indexed_fields":null,"opts":{"*ttl":[{"FilterIDs":null,"Tenant":""}],"*units":[{"FilterIDs":null,"Tenant":""}],"*usageID":[{"FilterIDs":null,"Tenant":""}]},"prefix_indexed_fields":[],"store_interval":"0s","string_indexed_fields":null,"suffix_indexed_fields":[]},"janus_agent":{"enabled":false,"janus_conns":[{"address":"127.0.0.1:8088","admin_address":"localhost:7188","admin_password":"","type":"*ws"}],"request_processors":[],"sessions_conns":["*internal"],"url":"/janus"},"kamailio_agent":{"create_cdr":false,"enabled":false,"evapi_conns":[{"address":"127.0.0.1:8448","alias":"","max_reconnect_interval":"0s","reconnects":5}],"sessions_conns":["*birpc_internal"],"timezone":""},"listen":{"http":"127.0.0.1:2080","http_tls":"127.0.0.1:2280","rpc_gob":"127.0.0.1:2013","rpc_gob_tls":"127.0.0.1:2023","rpc_json":"127.0.0.1:2012","rpc_json_tls":"127.0.0.1:2022"},"loader":{"actions_conns":["*localhost"],"caches_conns":["*localhost"],"data_path":"./","disable_reverse":false,"field_separator":",","gapi_credentials":".gapi/credentials.json","gapi_token":".gapi/token.json","tpid":""},"loaders":[{"action":"*store","cache":{"*accounts":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"5s"},"*action_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"5s"},"*attributes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"5s"},"*chargers":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"5s"},"*filters":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"5s"},"*ips":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"5s"},"*rankings":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"5s"},"*rate_profiles":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"5s"},"*resources":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"5s"},"*routes":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"5s"},"*stats":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"5s"},"*thresholds":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"5s"},"*trends":{"limit":-1,"precache":false,"remote":false,"replicate":false,"static_ttl":false,"ttl":"5s"}},"caches_conns":["*internal"],"data":[{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"new_branch":true,"path":"Rules.Type","tag":"Type","type":"*variable","value":"~*req.2"},{"path":"Rules.Element","tag":"Element","type":"*variable","value":"~*req.3"},{"path":"Rules.Values","tag":"Values","type":"*variable","value":"~*req.4"}],"file_name":"Filters.csv","flags":null,"type":"*filters"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"TenantID","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ProfileID","type":"*variable","value":"~*req.1"},{"path":"FilterIDs","tag":"FilterIDs","type":"*variable","value":"~*req.2"},{"path":"Weights","tag":"Weights","type":"*variable","value":"~*req.3"},{"path":"Blockers","tag":"Blockers","type":"*variable","value":"~*req.4"},{"new_branch":true,"path":"Attributes.FilterIDs","tag":"AttributeFilterIDs","type":"*variable","value":"~*req.5"},{"path":"Attributes.Blockers","tag":"AttributeBlockers","type":"*variable","value":"~*req.6"},{"path":"Attributes.Path","tag":"Path","type":"*variable","value":"~*req.7"},{"path":"Attributes.Type","tag":"Type","type":"*variable","value":"~*req.8"},{"path":"Attributes.Value","tag":"Value","type":"*variable","value":"~*req.9"}],"file_name":"Attributes.csv","flags":null,"type":"*attributes"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"path":"FilterIDs","tag":"FilterIDs","type":"*variable","value":"~*req.2"},{"path":"Weights","tag":"Weights","type":"*variable","value":"~*req.3"},{"path":"UsageTTL","tag":"TTL","type":"*variable","value":"~*req.4"},{"path":"Limit","tag":"Limit","type":"*variable","value":"~*req.5"},{"path":"AllocationMessage","tag":"AllocationMessage","type":"*variable","value":"~*req.6"},{"path":"Blocker","tag":"Blocker","type":"*variable","value":"~*req.7"},{"path":"Stored","tag":"Stored","type":"*variable","value":"~*req.8"},{"path":"ThresholdIDs","tag":"ThresholdIDs","type":"*variable","value":"~*req.9"}],"file_name":"Resources.csv","flags":null,"type":"*resources"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"path":"FilterIDs","tag":"FilterIDs","type":"*variable","value":"~*req.2"},{"path":"Weights","tag":"Weights","type":"*variable","value":"~*req.3"},{"path":"TTL","tag":"TTL","type":"*variable","value":"~*req.4"},{"path":"Stored","tag":"Stored","type":"*variable","value":"~*req.5"},{"new_branch":true,"path":"Pools.ID","tag":"PoolID","type":"*variable","value":"~*req.6"},{"path":"Pools.FilterIDs","tag":"PoolFilterIDs","type":"*variable","value":"~*req.7"},{"path":"Pools.Type","tag":"PoolType","type":"*variable","value":"~*req.8"},{"path":"Pools.Range","tag":"PoolRange","type":"*variable","value":"~*req.9"},{"path":"Pools.Strategy","tag":"PoolStrategy","type":"*variable","value":"~*req.10"},{"path":"Pools.Message","tag":"PoolMessage","type":"*variable","value":"~*req.11"},{"path":"Pools.Weights","tag":"PoolWeights","type":"*variable","value":"~*req.12"},{"path":"Pools.Blockers","tag":"PoolBlockers","type":"*variable","value":"~*req.13"}],"file_name":"IPs.csv","flags":null,"type":"*ips"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"path":"FilterIDs","tag":"FilterIDs","type":"*variable","value":"~*req.2"},{"path":"Weights","tag":"Weights","type":"*variable","value":"~*req.3"},{"path":"Blockers","tag":"Blockers","type":"*variable","value":"~*req.4"},{"path":"QueueLength","tag":"QueueLength","type":"*variable","value":"~*req.5"},{"path":"TTL","tag":"TTL","type":"*variable","value":"~*req.6"},{"path":"MinItems","tag":"MinItems","type":"*variable","value":"~*req.7"},{"path":"Stored","tag":"Stored","type":"*variable","value":"~*req.8"},{"path":"ThresholdIDs","tag":"ThresholdIDs","type":"*variable","value":"~*req.9"},{"new_branch":true,"path":"Metrics.MetricID","tag":"MetricIDs","type":"*variable","value":"~*req.10"},{"path":"Metrics.FilterIDs","tag":"MetricFilterIDs","type":"*variable","value":"~*req.11"},{"path":"Metrics.Blockers","tag":"MetricBlockers","type":"*variable","value":"~*req.12"}],"file_name":"Stats.csv","flags":null,"type":"*stats"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"path":"FilterIDs","tag":"FilterIDs","type":"*variable","value":"~*req.2"},{"path":"Weights","tag":"Weights","type":"*variable","value":"~*req.3"},{"path":"MaxHits","tag":"MaxHits","type":"*variable","value":"~*req.4"},{"path":"MinHits","tag":"MinHits","type":"*variable","value":"~*req.5"},{"path":"MinSleep","tag":"MinSleep","type":"*variable","value":"~*req.6"},{"path":"Blocker","tag":"Blocker","type":"*variable","value":"~*req.7"},{"path":"ActionProfileIDs","tag":"ActionProfileIDs","type":"*variable","value":"~*req.8"},{"path":"Async","tag":"Async","type":"*variable","value":"~*req.9"}],"file_name":"Thresholds.csv","flags":null,"type":"*thresholds"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"path":"Schedule","tag":"Schedule","type":"*variable","value":"~*req.2"},{"path":"StatID","tag":"StatID","type":"*variable","value":"~*req.3"},{"path":"Metrics","tag":"Metrics","type":"*variable","value":"~*req.4"},{"path":"TTL","tag":"TTL","type":"*variable","value":"~*req.5"},{"path":"QueueLength","tag":"QueueLength","type":"*variable","value":"~*req.6"},{"path":"MinItems","tag":"MinItems","type":"*variable","value":"~*req.7"},{"path":"CorrelationType","tag":"CorrelationType","type":"*variable","value":"~*req.8"},{"path":"Tolerance","tag":"Tolerance","type":"*variable","value":"~*req.9"},{"path":"Stored","tag":"Stored","type":"*variable","value":"~*req.10"},{"path":"ThresholdIDs","tag":"ThresholdIDs","type":"*variable","value":"~*req.11"}],"file_name":"Trends.csv","flags":null,"type":"*trends"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"path":"Schedule","tag":"Schedule","type":"*variable","value":"~*req.2"},{"path":"StatIDs","tag":"StatIDs","type":"*variable","value":"~*req.3"},{"path":"MetricIDs","tag":"MetricIDs","type":"*variable","value":"~*req.4"},{"path":"Sorting","tag":"Sorting","type":"*variable","value":"~*req.5"},{"path":"SortingParameters","tag":"SortingParameters","type":"*variable","value":"~*req.6"},{"path":"Stored","tag":"Stored","type":"*variable","value":"~*req.7"},{"path":"ThresholdIDs","tag":"ThresholdIDs","type":"*variable","value":"~*req.8"}],"file_name":"Rankings.csv","flags":null,"type":"*rankings"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"path":"FilterIDs","tag":"FilterIDs","type":"*variable","value":"~*req.2"},{"path":"Weights","tag":"Weights","type":"*variable","value":"~*req.3"},{"path":"Blockers","tag":"Blockers","type":"*variable","value":"~*req.4"},{"path":"Sorting","tag":"Sorting","type":"*variable","value":"~*req.5"},{"path":"SortingParameters","tag":"SortingParameters","type":"*variable","value":"~*req.6"},{"new_branch":true,"path":"Routes.ID","tag":"RouteID","type":"*variable","value":"~*req.7"},{"path":"Routes.FilterIDs","tag":"RouteFilterIDs","type":"*variable","value":"~*req.8"},{"path":"Routes.AccountIDs","tag":"RouteAccountIDs","type":"*variable","value":"~*req.9"},{"path":"Routes.RateProfileIDs","tag":"RouteRateProfileIDs","type":"*variable","value":"~*req.10"},{"path":"Routes.ResourceIDs","tag":"RouteResourceIDs","type":"*variable","value":"~*req.11"},{"path":"Routes.StatIDs","tag":"RouteStatIDs","type":"*variable","value":"~*req.12"},{"path":"Routes.Weights","tag":"RouteWeights","type":"*variable","value":"~*req.13"},{"path":"Routes.Blockers","tag":"RouteBlockers","type":"*variable","value":"~*req.14"},{"path":"Routes.RouteParameters","tag":"RouteParameters","type":"*variable","value":"~*req.15"}],"file_name":"Routes.csv","flags":null,"type":"*routes"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"path":"FilterIDs","tag":"FilterIDs","type":"*variable","value":"~*req.2"},{"path":"Weights","tag":"Weights","type":"*variable","value":"~*req.3"},{"path":"Blockers","tag":"Blockers","type":"*variable","value":"~*req.4"},{"path":"RunID","tag":"RunID","type":"*variable","value":"~*req.5"},{"path":"AttributeIDs","tag":"AttributeIDs","type":"*variable","value":"~*req.6"}],"file_name":"Chargers.csv","flags":null,"type":"*chargers"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"path":"FilterIDs","tag":"FilterIDs","type":"*variable","value":"~*req.2"},{"path":"Weights","tag":"Weights","type":"*variable","value":"~*req.3"},{"path":"MinCost","tag":"MinCost","type":"*variable","value":"~*req.4"},{"path":"MaxCost","tag":"MaxCost","type":"*variable","value":"~*req.5"},{"path":"MaxCostStrategy","tag":"MaxCostStrategy","type":"*variable","value":"~*req.6"},{"filters":["*notempty:~*req.7:"],"path":"Rates[\u003c~*req.7\u003e].FilterIDs","tag":"RateFilterIDs","type":"*variable","value":"~*req.8"},{"filters":["*notempty:~*req.7:"],"path":"Rates[\u003c~*req.7\u003e].ActivationTimes","tag":"RateActivationTimes","type":"*variable","value":"~*req.9"},{"filters":["*notempty:~*req.7:"],"path":"Rates[\u003c~*req.7\u003e].Weights","tag":"RateWeights","type":"*variable","value":"~*req.10"},{"filters":["*notempty:~*req.7:"],"path":"Rates[\u003c~*req.7\u003e].Blocker","tag":"RateBlocker","type":"*variable","value":"~*req.11"},{"filters":["*notempty:~*req.7:"],"new_branch":true,"path":"Rates[\u003c~*req.7\u003e].IntervalRates.IntervalStart","tag":"RateIntervalStart","type":"*variable","value":"~*req.12"},{"filters":["*notempty:~*req.7:"],"path":"Rates[\u003c~*req.7\u003e].IntervalRates.FixedFee","tag":"RateFixedFee","type":"*variable","value":"~*req.13"},{"filters":["*notempty:~*req.7:"],"path":"Rates[\u003c~*req.7\u003e].IntervalRates.RecurrentFee","tag":"RateRecurrentFee","type":"*variable","value":"~*req.14"},{"filters":["*notempty:~*req.7:"],"path":"Rates[\u003c~*req.7\u003e].IntervalRates.Unit","tag":"RateUnit","type":"*variable","value":"~*req.15"},{"filters":["*notempty:~*req.7:"],"path":"Rates[\u003c~*req.7\u003e].IntervalRates.Increment","tag":"RateIncrement","type":"*variable","value":"~*req.16"}],"file_name":"Rates.csv","flags":null,"type":"*rate_profiles"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"path":"FilterIDs","tag":"FilterIDs","type":"*variable","value":"~*req.2"},{"path":"Weights","tag":"Weights","type":"*variable","value":"~*req.3"},{"path":"Blockers","tag":"Blockers","type":"*variable","value":"~*req.4"},{"path":"Schedule","tag":"Schedule","type":"*variable","value":"~*req.5"},{"path":"Targets[\u003c~*req.6\u003e]","tag":"TargetIDs","type":"*variable","value":"~*req.7"},{"filters":["*notempty:~*req.8:"],"path":"Actions[\u003c~*req.8\u003e].FilterIDs","tag":"ActionFilterIDs","type":"*variable","value":"~*req.9"},{"filters":["*notempty:~*req.8:"],"path":"Actions[\u003c~*req.8\u003e].TTL","tag":"ActionTTL","type":"*variable","value":"~*req.10"},{"filters":["*notempty:~*req.8:"],"path":"Actions[\u003c~*req.8\u003e].Type","tag":"ActionType","type":"*variable","value":"~*req.11"},{"filters":["*notempty:~*req.8:"],"path":"Actions[\u003c~*req.8\u003e].Opts","tag":"ActionOpts","type":"*variable","value":"~*req.12"},{"filters":["*notempty:~*req.8:"],"new_branch":true,"path":"Actions[\u003c~*req.8\u003e].Diktats.Path","tag":"ActionPath","type":"*variable","value":"~*req.13"},{"filters":["*notempty:~*req.8:"],"path":"Actions[\u003c~*req.8\u003e].Diktats.Value","tag":"ActionValue","type":"*variable","value":"~*req.14"}],"file_name":"Actions.csv","flags":null,"type":"*action_profiles"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"path":"FilterIDs","tag":"FilterIDs","type":"*variable","value":"~*req.2"},{"path":"Weights","tag":"Weights","type":"*variable","value":"~*req.3"},{"path":"Blockers","tag":"Blockers","type":"*variable","value":"~*req.4"},{"path":"Opts","tag":"Opts","type":"*variable","value":"~*req.5"},{"filters":["*notempty:~*req.6:"],"path":"Balances[\u003c~*req.6\u003e].FilterIDs","tag":"BalanceFilterIDs","type":"*variable","value":"~*req.7"},{"filters":["*notempty:~*req.6:"],"path":"Balances[\u003c~*req.6\u003e].Weights","tag":"BalanceWeights","type":"*variable","value":"~*req.8"},{"filters":["*notempty:~*req.6:"],"path":"Balances[\u003c~*req.6\u003e].Blockers","tag":"BalanceBlockers","type":"*variable","value":"~*req.9"},{"filters":["*notempty:~*req.6:"],"path":"Balances[\u003c~*req.6\u003e].Type","tag":"BalanceType","type":"*variable","value":"~*req.10"},{"filters":["*notempty:~*req.6:"],"path":"Balances[\u003c~*req.6\u003e].Units","tag":"BalanceUnits","type":"*variable","value":"~*req.11"},{"filters":["*notempty:~*req.6:"],"path":"Balances[\u003c~*req.6\u003e].UnitFactors","tag":"BalanceUnitFactors","type":"*variable","value":"~*req.12"},{"filters":["*notempty:~*req.6:"],"path":"Balances[\u003c~*req.6\u003e].Opts","tag":"BalanceOpts","type":"*variable","value":"~*req.13"},{"filters":["*notempty:~*req.6:"],"path":"Balances[\u003c~*req.6\u003e].CostIncrements","tag":"BalanceCostIncrements","type":"*variable","value":"~*req.14"},{"filters":["*notempty:~*req.6:"],"path":"Balances[\u003c~*req.6\u003e].AttributeIDs","tag":"BalanceAttributeIDs","type":"*variable","value":"~*req.15"},{"filters":["*notempty:~*req.6:"],"path":"Balances[\u003c~*req.6\u003e].RateProfileIDs","tag":"BalanceRateProfileIDs","type":"*variable","value":"~*req.16"},{"path":"ThresholdIDs","tag":"ThresholdIDs","type":"*variable","value":"~*req.17"}],"file_name":"Accounts.csv","flags":null,"type":"*accounts"}],"enabled":false,"field_separator":",","id":"*default","lockfile_path":".cgr.lck","opts":{"*cache":"","*forceLock":false,"*stopOnError":false,"*withIndex":true},"run_delay":"0","tenant":"","tp_in_dir":"/var/spool/cgrates/loader/in","tp_out_dir":"/var/spool/cgrates/loader/out"}],"logger":{"efs_conns":["*internal"],"level":6,"opts":{"failed_posts_dir":"/var/spool/cgrates/failed_posts","kafka_attempts":1,"kafka_conn":"","kafka_topic":""},"type":"*syslog"},"migrator":{"out_datadb_encoding":"msgpack","out_datadb_host":"127.0.0.1","out_datadb_name":"10","out_datadb_opts":{"mongoConnScheme":"mongodb","mongoQueryTimeout":"10s","redisCACertificate":"","redisClientCertificate":"","redisClientKey":"","redisCluster":false,"redisClusterOndownDelay":"0s","redisClusterSync":"5s","redisConnectAttempts":20,"redisConnectTimeout":"0s","redisMaxConns":10,"redisPoolPipelineLimit":0,"redisPoolPipelineWindow":"150µs","redisReadTimeout":"0s","redisSentinel":"","redisTLS":false,"redisWriteTimeout":"0s"},"out_datadb_password":"","out_datadb_port":"6379","out_datadb_type":"*redis","out_datadb_user":"cgrates","users_filters":null},"prometheus_agent":{"collect_go_metrics":false,"collect_process_metrics":false,"cores_conns":[],"enabled":false,"path":"/prometheus","stat_queue_ids":null,"stats_conns":[]},"radius_agent":{"client_dictionaries":{"*default":"/usr/share/cgrates/radius/dict/"},"client_secrets":{"*default":"CGRateS.org"},"enabled":false,"listen_acct":"127.0.0.1:1813","listen_auth":"127.0.0.1:1812","listen_net":"udp","request_processors":[],"sessions_conns":["*internal"]},"rankings":{"ees_conns":[],"ees_exporter_ids":null,"enabled":false,"scheduled_ids":{},"stats_conns":[],"store_interval":"","thresholds_conns":[]},"rates":{"enabled":false,"exists_indexed_fields":[],"indexed_selects":true,"nested_fields":false,"notexists_indexed_fields":[],"opts":{"*intervalStart":[{"FilterIDs":null,"Tenant":""}],"*profileIDs":[],"*profileIgnoreFilters":[{"FilterIDs":null,"Tenant":""}],"*startTime":[{"FilterIDs":null,"Tenant":""}],"*usage":[{"FilterIDs":null,"Tenant":""}]},"prefix_indexed_fields":[],"rate_exists_indexed_fields":[],"rate_indexed_selects":true,"rate_nested_fields":false,"rate_notexists_indexed_fields":[],"rate_prefix_indexed_fields":[],"rate_suffix_indexed_fields":[],"suffix_indexed_fields":[],"verbosity":1000},"registrarc":{"rpc":{"hosts":[],"refresh_interval":"5m0s","registrars_conns":[]}},"resources":{"enabled":false,"exists_indexed_fields":[],"indexed_selects":true,"nested_fields":false,"notexists_indexed_fields":[],"opts":{"*units":[{"FilterIDs":null,"Tenant":""}],"*usageID":[{"FilterIDs":null,"Tenant":""}],"*usageTTL":[{"FilterIDs":null,"Tenant":""}]},"prefix_indexed_fields":[],"store_interval":"","suffix_indexed_fields":[],"thresholds_conns":[]},"routes":{"accounts_conns":[],"attributes_conns":[],"default_ratio":1,"enabled":false,"exists_indexed_fields":[],"indexed_selects":true,"nested_fields":false,"notexists_indexed_fields":[],"opts":{"*context":[{"FilterIDs":null,"Tenant":""}],"*ignoreErrors":[{"FilterIDs":null,"Tenant":""}],"*limit":[],"*maxCost":[{"Tenant":"","Value":""}],"*maxItems":[],"*offset":[],"*profileCount":[{"FilterIDs":null,"Tenant":""}],"*usage":[{"FilterIDs":null,"Tenant":""}]},"prefix_indexed_fields":[],"rates_conns":[],"resources_conns":[],"stats_conns":[],"suffix_indexed_fields":[]},"rpc_conns":{"*bijson_localhost":{"conns":[{"address":"127.0.0.1:2014","transport":"*birpc_json"}],"poolSize":0,"strategy":"*first"},"*birpc_internal":{"conns":[{"address":"*birpc_internal","transport":""}],"poolSize":0,"strategy":"*first"},"*internal":{"conns":[{"address":"*internal","transport":""}],"poolSize":0,"strategy":"*first"},"*localhost":{"conns":[{"address":"127.0.0.1:2012","transport":"*json"}],"poolSize":0,"strategy":"*first"}},"sentrypeer":{"audience":"https://sentrypeer.com/api","client_id":"","client_secret":"","grant_type":"client_credentials","ips_url":"https://sentrypeer.com/api/ip-addresses","numbers_url":"https://sentrypeer.com/api/phone-numbers","token_url":"https://authz.sentrypeer.com/oauth/token"},"sessions":{"accounts_conns":[],"actions_conns":[],"alterable_fields":[],"attributes_conns":[],"cdrs_conns":[],"channel_sync_interval":"0","chargers_conns":[],"client_protocol":1,"default_usage":{"*any":"3h0m0s","*data":"1048576","*sms":"1","*voice":"3h0m0s"},"enabled":false,"ips_conns":[],"listen_bigob":"","listen_bijson":"127.0.0.1:2014","min_dur_low_balance":"0","opts":{"*accounts":[{"FilterIDs":null,"Tenant":""}],"*accountsForceUsage":[],"*attributes":[{"FilterIDs":null,"Tenant":""}],"*attributesDerivedReply":[{"FilterIDs":null,"Tenant":""}],"*blockerError":[{"FilterIDs":null,"Tenant":""}],"*cdrs":[{"FilterIDs":null,"Tenant":""}],"*cdrsDerivedReply":[{"FilterIDs":null,"Tenant":""}],"*chargeable":[{"FilterIDs":null,"Tenant":""}],"*chargers":[{"FilterIDs":null,"Tenant":""}],"*debitInterval":[{"FilterIDs":null,"Tenant":""}],"*forceUsage":[],"*initiate":[{"FilterIDs":null,"Tenant":""}],"*ips":[{"FilterIDs":null,"Tenant":""}],"*ipsAllocate":[{"FilterIDs":null,"Tenant":""}],"*ipsAuthorize":[{"FilterIDs":null,"Tenant":""}],"*ipsRelease":[{"FilterIDs":null,"Tenant":""}],"*maxUsage":[{"FilterIDs":null,"Tenant":""}],"*message":[{"FilterIDs":null,"Tenant":""}],"*originID":[],"*resources":[{"FilterIDs":null,"Tenant":""}],"*resourcesAllocate":[{"FilterIDs":null,"Tenant":""}],"*resourcesAuthorize":[{"FilterIDs":null,"Tenant":""}],"*resourcesDerivedReply":[{"FilterIDs":null,"Tenant":""}],"*resourcesRelease":[{"FilterIDs":null,"Tenant":""}],"*routes":[{"FilterIDs":null,"Tenant":""}],"*routesDerivedReply":[{"FilterIDs":null,"Tenant":""}],"*stats":[{"FilterIDs":null,"Tenant":""}],"*statsDerivedReply":[{"FilterIDs":null,"Tenant":""}],"*terminate":[{"FilterIDs":null,"Tenant":""}],"*thresholds":[{"FilterIDs":null,"Tenant":""}],"*thresholdsDerivedReply":[{"FilterIDs":null,"Tenant":""}],"*ttl":[{"FilterIDs":null,"Tenant":""}],"*ttlLastUsage":[],"*ttlLastUsed":[],"*ttlMaxDelay":[{"FilterIDs":null,"Tenant":""}],"*ttlUsage":[],"*update":[{"FilterIDs":null,"Tenant":""}]},"rates_conns":[],"replication_conns":[],"resources_conns":[],"routes_conns":[],"session_indexes":[],"stats_conns":[],"stir":{"allowed_attest":["*any"],"default_attest":"A","payload_maxduration":"-1","privatekey_path":"","publickey_path":""},"store_session_costs":false,"terminate_attempts":5,"thresholds_conns":[]},"sip_agent":{"enabled":false,"listen":"127.0.0.1:5060","listen_net":"udp","request_processors":[],"retransmission_timer":"1s","sessions_conns":["*internal"],"timezone":""},"stats":{"ees_conns":[],"ees_exporter_ids":null,"enabled":false,"exists_indexed_fields":[],"indexed_selects":true,"nested_fields":false,"notexists_indexed_fields":[],"opts":{"*profileIDs":[],"*profileIgnoreFilters":[{"FilterIDs":null,"Tenant":""}],"*roundingDecimals":[]},"prefix_indexed_fields":[],"store_interval":"","store_uncompressed_limit":0,"suffix_indexed_fields":[],"thresholds_conns":[]},"stor_db":{"db_host":"127.0.0.1","db_name":"cgrates","db_password":"CGRateS.org","db_port":3306,"db_type":"**mysql","db_user":"cgrates","items":{"*cdrs":{"limit":-1,"remote":false,"replicate":false,"static_ttl":false}},"opts":{"internalDBBackupPath":"/var/lib/cgrates/internal_db/backup/stordb","internalDBDumpInterval":"0s","internalDBDumpPath":"/var/lib/cgrates/internal_db/stordb","internalDBFileSizeLimit":1073741824,"internalDBRewriteInterval":"0s","internalDBStartTimeout":"5m0s","mongoConnScheme":"mongodb","mongoQueryTimeout":"10s","mysqlDSNParams":{},"mysqlLocation":"Local","pgSSLMode":"disable","sqlConnMaxLifetime":"0s","sqlLogLevel":3,"sqlMaxIdleConns":10,"sqlMaxOpenConns":100},"prefix_indexed_fields":[],"remote_conns":null,"replication_conns":null,"string_indexed_fields":[]},"suretax":{"bill_to_number":"","business_unit":"","client_number":"","client_tracking":"~*opts.*originID","customer_number":"~*req.Subject","include_local_cost":false,"orig_number":"~*req.Subject","p2pplus4":"","p2pzipcode":"","plus4":"","regulatory_code":"03","response_group":"03","response_type":"D4","return_file_code":"0","sales_type_code":"R","tax_exemption_code_list":"","tax_included":"0","tax_situs_rule":"04","term_number":"~*req.Destination","timezone":"UTC","trans_type_code":"010101","unit_type":"00","units":"1","url":"","validation_key":"","zipcode":""},"templates":{"*asr":[{"mandatory":true,"path":"*diamreq.Session-Id","tag":"SessionId","type":"*variable","value":"~*req.Session-Id"},{"mandatory":true,"path":"*diamreq.Origin-Host","tag":"OriginHost","type":"*variable","value":"~*req.Destination-Host"},{"mandatory":true,"path":"*diamreq.Origin-Realm","tag":"OriginRealm","type":"*variable","value":"~*req.Destination-Realm"},{"mandatory":true,"path":"*diamreq.Destination-Realm","tag":"DestinationRealm","type":"*variable","value":"~*req.Origin-Realm"},{"mandatory":true,"path":"*diamreq.Destination-Host","tag":"DestinationHost","type":"*variable","value":"~*req.Origin-Host"},{"mandatory":true,"path":"*diamreq.Auth-Application-Id","tag":"AuthApplicationId","type":"*variable","value":"~*vars.*appid"}],"*cca":[{"mandatory":true,"path":"*rep.Session-Id","tag":"SessionId","type":"*variable","value":"~*req.Session-Id"},{"path":"*rep.Result-Code","tag":"ResultCode","type":"*constant","value":"2001"},{"mandatory":true,"path":"*rep.Origin-Host","tag":"OriginHost","type":"*variable","value":"~*vars.OriginHost"},{"mandatory":true,"path":"*rep.Origin-Realm","tag":"OriginRealm","type":"*variable","value":"~*vars.OriginRealm"},{"mandatory":true,"path":"*rep.Auth-Application-Id","tag":"AuthApplicationId","type":"*variable","value":"~*vars.*appid"},{"mandatory":true,"path":"*rep.CC-Request-Type","tag":"CCRequestType","type":"*variable","value":"~*req.CC-Request-Type"},{"mandatory":true,"path":"*rep.CC-Request-Number","tag":"CCRequestNumber","type":"*variable","value":"~*req.CC-Request-Number"}],"*cdrLog":[{"mandatory":true,"path":"*cdr.ToR","tag":"ToR","type":"*variable","value":"~*req.BalanceType"},{"mandatory":true,"path":"*cdr.OriginHost","tag":"OriginHost","type":"*constant","value":"127.0.0.1"},{"mandatory":true,"path":"*cdr.RequestType","tag":"RequestType","type":"*constant","value":"*none"},{"mandatory":true,"path":"*cdr.Tenant","tag":"Tenant","type":"*variable","value":"~*req.Tenant"},{"mandatory":true,"path":"*cdr.Account","tag":"Account","type":"*variable","value":"~*req.Account"},{"mandatory":true,"path":"*cdr.Subject","tag":"Subject","type":"*variable","value":"~*req.Account"},{"mandatory":true,"path":"*cdr.Cost","tag":"Cost","type":"*variable","value":"~*req.Cost"},{"mandatory":true,"path":"*cdr.Source","tag":"Source","type":"*constant","value":"*cdrLog"},{"mandatory":true,"path":"*cdr.Usage","tag":"Usage","type":"*constant","value":"1"},{"mandatory":true,"path":"*cdr.RunID","tag":"RunID","type":"*variable","value":"~*req.ActionType"},{"mandatory":true,"path":"*cdr.SetupTime","tag":"SetupTime","type":"*constant","value":"*now"},{"mandatory":true,"path":"*cdr.AnswerTime","tag":"AnswerTime","type":"*constant","value":"*now"},{"mandatory":true,"path":"*cdr.PreRated","tag":"PreRated","type":"*constant","value":"true"}],"*err":[{"mandatory":true,"path":"*rep.Session-Id","tag":"SessionId","type":"*variable","value":"~*req.Session-Id"},{"mandatory":true,"path":"*rep.Origin-Host","tag":"OriginHost","type":"*variable","value":"~*vars.OriginHost"},{"mandatory":true,"path":"*rep.Origin-Realm","tag":"OriginRealm","type":"*variable","value":"~*vars.OriginRealm"}],"*errSip":[{"mandatory":true,"path":"*rep.Request","tag":"Request","type":"*constant","value":"SIP/2.0 500 Internal Server Error"}],"*fsa":[{"path":"*cgreq.ToR","tag":"ToR","type":"*constant","value":"*voice"},{"path":"*cgreq.PDD","tag":"PDD","type":"*composed","value":"~*req.variable_progress_mediamsec;ms"},{"path":"*cgreq.ACD","tag":"ACD","type":"*composed","value":"~*req.variable_cdr_acd;s"},{"path":"*cgreq.OriginID","tag":"OriginID","type":"*variable","value":"~*req.Unique-ID"},{"path":"*opts.*originID","tag":"*originID","type":"*variable","value":"~*req.Unique-ID"},{"path":"*cgreq.OriginHost","tag":"OriginHost","type":"*variable","value":"~*req.variable_cgr_originhost"},{"path":"*cgreq.Account","tag":"Account","type":"*variable","value":"~*req.Caller-Username"},{"path":"*cgreq.Source","tag":"Source","type":"*composed","value":"FS_;~*req.Event-Name"},{"filters":["*string:*req.variable_process_cdr:false"],"path":"*cgreq.RequestType","tag":"RequestType","type":"*constant","value":"*none"},{"filters":["*string:*req.Caller-Dialplan:inline"],"path":"*cgreq.RequestType","tag":"RequestType","type":"*constant","value":"*none"},{"filters":["*exists:*cgreq.RequestType:"],"path":"*cgreq.RequestType","tag":"RequestType","type":"*constant","value":"*prepaid"},{"path":"*cgreq.Tenant","tag":"Tenant","type":"*constant","value":"cgrates.org"},{"path":"*cgreq.Category","tag":"Category","type":"*constant","value":"call"},{"path":"*cgreq.Subject","tag":"Subject","type":"*variable","value":"~*req.Caller-Username"},{"path":"*cgreq.Destination","tag":"Destination","type":"*variable","value":"~*req.Caller-Destination-Number"},{"path":"*cgreq.SetupTime","tag":"SetupTime","type":"*variable","value":"~*req.Caller-Channel-Created-Time"},{"path":"*cgreq.AnswerTime","tag":"AnswerTime","type":"*variable","value":"~*req.Caller-Channel-Answered-Time"},{"path":"*cgreq.Usage","tag":"Usage","type":"*composed","value":"~*req.variable_billsec;s"},{"path":"*cgreq.Route","tag":"Route","type":"*variable","value":"~*req.variable_cgr_route"},{"path":"*cgreq.Cost","tag":"Cost","type":"*constant","value":"-1.0"},{"filters":["*notempty:*req.Hangup-Cause:"],"path":"*cgreq.DisconnectCause","tag":"DisconnectCause","type":"*variable","value":"~*req.Hangup-Cause"}],"*rar":[{"mandatory":true,"path":"*diamreq.Session-Id","tag":"SessionId","type":"*variable","value":"~*req.Session-Id"},{"mandatory":true,"path":"*diamreq.Origin-Host","tag":"OriginHost","type":"*variable","value":"~*req.Destination-Host"},{"mandatory":true,"path":"*diamreq.Origin-Realm","tag":"OriginRealm","type":"*variable","value":"~*req.Destination-Realm"},{"mandatory":true,"path":"*diamreq.Destination-Realm","tag":"DestinationRealm","type":"*variable","value":"~*req.Origin-Realm"},{"mandatory":true,"path":"*diamreq.Destination-Host","tag":"DestinationHost","type":"*variable","value":"~*req.Origin-Host"},{"mandatory":true,"path":"*diamreq.Auth-Application-Id","tag":"AuthApplicationId","type":"*variable","value":"~*vars.*appid"},{"path":"*diamreq.Re-Auth-Request-Type","tag":"ReAuthRequestType","type":"*constant","value":"0"}]},"thresholds":{"actions_conns":[],"enabled":false,"exists_indexed_fields":[],"indexed_selects":true,"nested_fields":false,"notexists_indexed_fields":[],"opts":{"*profileIDs":[],"*profileIgnoreFilters":[{"FilterIDs":null,"Tenant":""}]},"prefix_indexed_fields":[],"store_interval":"","suffix_indexed_fields":[]},"tls":{"ca_certificate":"","client_certificate":"","client_key":"","server_certificate":"","server_key":"","server_name":"","server_policy":4},"tpes":{"enabled":false},"trends":{"ees_conns":[],"ees_exporter_ids":null,"enabled":false,"scheduled_ids":{},"stats_conns":[],"store_interval":"","store_uncompressed_limit":0,"thresholds_conns":[]}}` cgrCfg, err := NewCGRConfigFromJSONStringWithDefaults(cfgJSON) if err != nil { diff --git a/config/datadbcfg_test.go b/config/datadbcfg_test.go index 1ef4fce5d..10202c64a 100644 --- a/config/datadbcfg_test.go +++ b/config/datadbcfg_test.go @@ -488,7 +488,7 @@ func TestDataDbCfgloadFromJsonCfgItems(t *testing.T) { }, RmtConns: []string{"Conn1"}, Items: map[string]*ItemOpts{ - utils.MetaResourceProfile: {Limit: -1}, + utils.MetaResourceProfiles: {Limit: -1}, utils.MetaResources: {Limit: -1}, utils.MetaStatQueueProfiles: {Limit: -1}, }, diff --git a/engine/datadbmock.go b/engine/datadbmock.go index 9248befb7..78f9c676d 100644 --- a/engine/datadbmock.go +++ b/engine/datadbmock.go @@ -52,9 +52,9 @@ type DataDBMock struct { GetIPProfileDrvF func(ctx *context.Context, tnt, id string) (*utils.IPProfile, error) SetIPProfileDrvF func(ctx *context.Context, ipp *utils.IPProfile) error RemoveIPProfileDrvF func(ctx *context.Context, tnt, id string) error - RemoveIPDrvF func(ctx *context.Context, tnt, id string) error - SetIPDrvF func(ctx *context.Context, ip *utils.IP) error - GetIPDrvF func(ctx *context.Context, tenant, id string) (*utils.IP, error) + RemoveIPAllocationsDrvF func(ctx *context.Context, tnt, id string) error + SetIPAllocationsDrvF func(ctx *context.Context, ip *utils.IPAllocations) error + GetIPAllocationsDrvF func(ctx *context.Context, tenant, id string) (*utils.IPAllocations, error) SetTrendProfileDrvF func(ctx *context.Context, tr *utils.TrendProfile) (err error) GetTrendProfileDrvF func(ctx *context.Context, tenant string, id string) (sq *utils.TrendProfile, err error) RemTrendProfileDrvF func(ctx *context.Context, tenant string, id string) (err error) @@ -190,23 +190,23 @@ func (dbM *DataDBMock) RemoveIPProfileDrv(ctx *context.Context, tnt string, id s return utils.ErrNotImplemented } -func (dbM *DataDBMock) GetIPDrv(ctx *context.Context, tenant, id string) (*utils.IP, error) { - if dbM.GetIPDrvF != nil { - return dbM.GetIPDrvF(ctx, tenant, id) +func (dbM *DataDBMock) GetIPAllocationsDrv(ctx *context.Context, tenant, id string) (*utils.IPAllocations, error) { + if dbM.GetIPAllocationsDrvF != nil { + return dbM.GetIPAllocationsDrvF(ctx, tenant, id) } return nil, utils.ErrNotImplemented } -func (dbM *DataDBMock) SetIPDrv(ctx *context.Context, ip *utils.IP) error { - if dbM.SetIPDrvF != nil { - return dbM.SetIPDrvF(ctx, ip) +func (dbM *DataDBMock) SetIPAllocationsDrv(ctx *context.Context, ip *utils.IPAllocations) error { + if dbM.SetIPAllocationsDrvF != nil { + return dbM.SetIPAllocationsDrvF(ctx, ip) } return utils.ErrNotImplemented } -func (dbM *DataDBMock) RemoveIPDrv(ctx *context.Context, tnt, id string) error { - if dbM.RemoveIPDrvF != nil { - return dbM.RemoveIPDrvF(ctx, tnt, id) +func (dbM *DataDBMock) RemoveIPAllocationsDrv(ctx *context.Context, tnt, id string) error { + if dbM.RemoveIPAllocationsDrvF != nil { + return dbM.RemoveIPAllocationsDrvF(ctx, tnt, id) } return utils.ErrNotImplemented } diff --git a/engine/datamanager.go b/engine/datamanager.go index fe2bc1d94..a16cbf45e 100644 --- a/engine/datamanager.go +++ b/engine/datamanager.go @@ -50,7 +50,7 @@ var ( utils.ResourceProfilesPrefix: {}, utils.ResourcesPrefix: {}, utils.IPProfilesPrefix: {}, - utils.IPsPrefix: {}, + utils.IPAllocationsPrefix: {}, utils.StatQueuePrefix: {}, utils.StatQueueProfilePrefix: {}, utils.ThresholdPrefix: {}, @@ -167,10 +167,10 @@ func (dm *DataManager) CacheDataFromDB(ctx *context.Context, prfx string, ids [] lkID := guardian.Guardian.GuardIDs("", dm.cfg.GeneralCfg().LockingTimeout, utils.IPProfileLockKey(tntID.Tenant, tntID.ID)) _, err = dm.GetIPProfile(ctx, tntID.Tenant, tntID.ID, false, true, utils.NonTransactional) guardian.Guardian.UnguardIDs(lkID) - case utils.IPsPrefix: + case utils.IPAllocationsPrefix: tntID := utils.NewTenantID(dataID) - lkID := guardian.Guardian.GuardIDs("", dm.cfg.GeneralCfg().LockingTimeout, utils.IPLockKey(tntID.Tenant, tntID.ID)) - _, err = dm.GetIP(ctx, tntID.Tenant, tntID.ID, false, true, utils.NonTransactional) + lkID := guardian.Guardian.GuardIDs("", dm.cfg.GeneralCfg().LockingTimeout, utils.IPAllocationsLockKey(tntID.Tenant, tntID.ID)) + _, err = dm.GetIPAllocations(ctx, tntID.Tenant, tntID.ID, false, true, utils.NonTransactional) guardian.Guardian.UnguardIDs(lkID) case utils.StatQueueProfilePrefix: tntID := utils.NewTenantID(dataID) @@ -1554,7 +1554,7 @@ func (dm *DataManager) GetResourceProfile(ctx *context.Context, tenant, id strin } rp, err = dm.dataDB.GetResourceProfileDrv(ctx, tenant, id) if err != nil { - if itm := dm.cfg.DataDbCfg().Items[utils.MetaResourceProfile]; err == utils.ErrNotFound && itm.Remote { + if itm := dm.cfg.DataDbCfg().Items[utils.MetaResourceProfiles]; err == utils.ErrNotFound && itm.Remote { if err = dm.connMgr.Call(ctx, dm.cfg.DataDbCfg().RmtConns, utils.ReplicatorSv1GetResourceProfile, &utils.TenantIDWithAPIOpts{ TenantID: &utils.TenantID{Tenant: tenant, ID: id}, @@ -1615,7 +1615,7 @@ func (dm *DataManager) SetResourceProfile(ctx *context.Context, rp *utils.Resour } Cache.Clear([]string{utils.CacheEventResources}) } - if itm := dm.cfg.DataDbCfg().Items[utils.MetaResourceProfile]; itm.Replicate { + if itm := dm.cfg.DataDbCfg().Items[utils.MetaResourceProfiles]; itm.Replicate { if err = replicate(ctx, dm.connMgr, dm.cfg.DataDbCfg().RplConns, dm.cfg.DataDbCfg().RplFiltered, utils.ResourceProfilesPrefix, rp.TenantID(), // this are used to get the host IDs from cache @@ -1670,7 +1670,7 @@ func (dm *DataManager) RemoveResourceProfile(ctx *context.Context, tenant, id st return } } - if itm := dm.cfg.DataDbCfg().Items[utils.MetaResourceProfile]; itm.Replicate { + if itm := dm.cfg.DataDbCfg().Items[utils.MetaResourceProfiles]; itm.Replicate { replicate(ctx, dm.connMgr, dm.cfg.DataDbCfg().RplConns, dm.cfg.DataDbCfg().RplFiltered, utils.ResourceProfilesPrefix, utils.ConcatenatedKey(tenant, id), // this are used to get the host IDs from cache @@ -1683,39 +1683,39 @@ func (dm *DataManager) RemoveResourceProfile(ctx *context.Context, tenant, id st return dm.RemoveResource(ctx, tenant, id) } -func (dm *DataManager) GetIP(ctx *context.Context, tenant, id string, cacheRead, cacheWrite bool, - transactionID string) (ip *utils.IP, err error) { +func (dm *DataManager) GetIPAllocations(ctx *context.Context, tenant, id string, cacheRead, cacheWrite bool, + transactionID string) (ip *utils.IPAllocations, err error) { tntID := utils.ConcatenatedKey(tenant, id) if cacheRead { - if x, ok := Cache.Get(utils.CacheIPs, tntID); ok { + if x, ok := Cache.Get(utils.CacheIPAllocations, tntID); ok { if x == nil { return nil, utils.ErrNotFound } - return x.(*utils.IP), nil + return x.(*utils.IPAllocations), nil } } if dm == nil { err = utils.ErrNoDatabaseConn return } - ip, err = dm.dataDB.GetIPDrv(ctx, tenant, id) + ip, err = dm.dataDB.GetIPAllocationsDrv(ctx, tenant, id) if err != nil { - if itm := dm.cfg.DataDbCfg().Items[utils.MetaIPs]; err == utils.ErrNotFound && itm.Remote { + if itm := dm.cfg.DataDbCfg().Items[utils.MetaIPAllocations]; err == utils.ErrNotFound && itm.Remote { if err = dm.connMgr.Call(ctx, dm.cfg.DataDbCfg().RmtConns, - utils.ReplicatorSv1GetIP, + utils.ReplicatorSv1GetIPAllocations, &utils.TenantIDWithAPIOpts{ TenantID: &utils.TenantID{Tenant: tenant, ID: id}, APIOpts: utils.GenerateDBItemOpts(itm.APIKey, itm.RouteID, utils.EmptyString, utils.FirstNonEmpty(dm.cfg.DataDbCfg().RmtConnID, dm.cfg.GeneralCfg().NodeID)), }, &ip); err == nil { - err = dm.dataDB.SetIPDrv(ctx, ip) + err = dm.dataDB.SetIPAllocationsDrv(ctx, ip) } } if err != nil { err = utils.CastRPCErr(err) if err == utils.ErrNotFound && cacheWrite { - if errCh := Cache.Set(ctx, utils.CacheIPs, tntID, nil, nil, + if errCh := Cache.Set(ctx, utils.CacheIPAllocations, tntID, nil, nil, cacheCommit(transactionID), transactionID); errCh != nil { return nil, errCh } @@ -1725,7 +1725,7 @@ func (dm *DataManager) GetIP(ctx *context.Context, tenant, id string, cacheRead, } } if cacheWrite { - if errCh := Cache.Set(ctx, utils.CacheIPs, tntID, ip, nil, + if errCh := Cache.Set(ctx, utils.CacheIPAllocations, tntID, ip, nil, cacheCommit(transactionID), transactionID); errCh != nil { return nil, errCh } @@ -1733,38 +1733,38 @@ func (dm *DataManager) GetIP(ctx *context.Context, tenant, id string, cacheRead, return } -func (dm *DataManager) SetIP(ctx *context.Context, ip *utils.IP) (err error) { +func (dm *DataManager) SetIPAllocations(ctx *context.Context, ip *utils.IPAllocations) (err error) { if dm == nil { return utils.ErrNoDatabaseConn } - if err = dm.DataDB().SetIPDrv(ctx, ip); err != nil { + if err = dm.DataDB().SetIPAllocationsDrv(ctx, ip); err != nil { return } - if itm := dm.cfg.DataDbCfg().Items[utils.MetaIPs]; itm.Replicate { + if itm := dm.cfg.DataDbCfg().Items[utils.MetaIPAllocations]; itm.Replicate { err = replicate(ctx, dm.connMgr, dm.cfg.DataDbCfg().RplConns, dm.cfg.DataDbCfg().RplFiltered, - utils.IPsPrefix, ip.TenantID(), // this are used to get the host IDs from cache - utils.ReplicatorSv1SetIP, - &utils.IPWithAPIOpts{ - IP: ip, + utils.IPAllocationsPrefix, ip.TenantID(), // this are used to get the host IDs from cache + utils.ReplicatorSv1SetIPAllocations, + &utils.IPAllocationsWithAPIOpts{ + IPAllocations: ip, APIOpts: utils.GenerateDBItemOpts(itm.APIKey, itm.RouteID, dm.cfg.DataDbCfg().RplCache, utils.EmptyString)}) } return } -func (dm *DataManager) RemoveIP(ctx *context.Context, tenant, id string) (err error) { +func (dm *DataManager) RemoveIPAllocations(ctx *context.Context, tenant, id string) (err error) { if dm == nil { return utils.ErrNoDatabaseConn } - if err = dm.DataDB().RemoveIPDrv(ctx, tenant, id); err != nil { + if err = dm.DataDB().RemoveIPAllocationsDrv(ctx, tenant, id); err != nil { return } - if itm := dm.cfg.DataDbCfg().Items[utils.MetaIPs]; itm.Replicate { + if itm := dm.cfg.DataDbCfg().Items[utils.MetaIPAllocations]; itm.Replicate { replicate(ctx, dm.connMgr, dm.cfg.DataDbCfg().RplConns, dm.cfg.DataDbCfg().RplFiltered, - utils.IPsPrefix, utils.ConcatenatedKey(tenant, id), // this are used to get the host IDs from cache - utils.ReplicatorSv1RemoveIP, + utils.IPAllocationsPrefix, utils.ConcatenatedKey(tenant, id), // this are used to get the host IDs from cache + utils.ReplicatorSv1RemoveIPAllocations, &utils.TenantIDWithAPIOpts{ TenantID: &utils.TenantID{Tenant: tenant, ID: id}, APIOpts: utils.GenerateDBItemOpts(itm.APIKey, itm.RouteID, @@ -1866,14 +1866,14 @@ func (dm *DataManager) SetIPProfile(ctx *context.Context, ipp *utils.IPProfile, if oldIPP == nil || // create the resource if it didn't exist before oldIPP.TTL != ipp.TTL || oldIPP.Stored != ipp.Stored && oldIPP.Stored { // reset the resource if the profile changed this fields - err = dm.SetIP(ctx, &utils.IP{ + err = dm.SetIPAllocations(ctx, &utils.IPAllocations{ Tenant: ipp.Tenant, ID: ipp.ID, Usages: make(map[string]*utils.IPUsage), }) - } else if _, errRs := dm.GetIP(ctx, ipp.Tenant, ipp.ID, // do not try to get the resource if the configuration changed + } else if _, errRs := dm.GetIPAllocations(ctx, ipp.Tenant, ipp.ID, // do not try to get the resource if the configuration changed true, false, utils.NonTransactional); errRs == utils.ErrNotFound { // the resource does not exist - err = dm.SetIP(ctx, &utils.IP{ + err = dm.SetIPAllocations(ctx, &utils.IPAllocations{ Tenant: ipp.Tenant, ID: ipp.ID, Usages: make(map[string]*utils.IPUsage), @@ -1915,7 +1915,7 @@ func (dm *DataManager) RemoveIPProfile(ctx *context.Context, tenant, id string, APIOpts: utils.GenerateDBItemOpts(itm.APIKey, itm.RouteID, dm.cfg.DataDbCfg().RplCache, utils.EmptyString)}) } - return dm.RemoveIP(ctx, tenant, id) + return dm.RemoveIPAllocations(ctx, tenant, id) } func (dm *DataManager) HasData(category, subject, tenant string) (has bool, err error) { diff --git a/engine/datamanager_test.go b/engine/datamanager_test.go index ef7582993..20dc81cc7 100644 --- a/engine/datamanager_test.go +++ b/engine/datamanager_test.go @@ -5019,7 +5019,7 @@ func TestDMGetResourceProfileSetResourceProfileDrvErr(t *testing.T) { }() cfg := config.NewDefaultCGRConfig() - cfg.DataDbCfg().Items[utils.MetaResourceProfile].Remote = true + cfg.DataDbCfg().Items[utils.MetaResourceProfiles].Remote = true cfg.DataDbCfg().RmtConns = []string{utils.ConcatenatedKey(utils.MetaInternal, utils.RemoteConnsCfg)} config.SetCgrConfig(cfg) @@ -5416,7 +5416,7 @@ func TestDMSetResourceProfileErr(t *testing.T) { Cache.Clear(nil) cfg := config.NewDefaultCGRConfig() - cfg.DataDbCfg().Items[utils.MetaResourceProfile].Replicate = true + cfg.DataDbCfg().Items[utils.MetaResourceProfiles].Replicate = true cfg.DataDbCfg().RplConns = []string{utils.ConcatenatedKey(utils.MetaInternal, utils.MetaReplicator)} config.SetCgrConfig(cfg) @@ -5618,7 +5618,7 @@ func TestDMRemoveResourceProfileReplicate(t *testing.T) { } cfg := config.NewDefaultCGRConfig() - cfg.DataDbCfg().Items[utils.MetaResourceProfile].Replicate = true + cfg.DataDbCfg().Items[utils.MetaResourceProfiles].Replicate = true cfg.DataDbCfg().RplConns = []string{utils.ConcatenatedKey(utils.MetaInternal, utils.MetaReplicator)} config.SetCgrConfig(cfg) diff --git a/engine/filterhelpers.go b/engine/filterhelpers.go index ac0a0e0e5..5cbbd46e4 100644 --- a/engine/filterhelpers.go +++ b/engine/filterhelpers.go @@ -163,7 +163,7 @@ func GetSentryPeer(ctx *context.Context, val string, sentryPeerCfg *config.Sentr token = cachedToken.(string) } switch dataType { - case utils.MetaIp: + case utils.MetaIP: apiUrl, err = url.JoinPath(sentryPeerCfg.IpsUrl, val) case utils.MetaNumber: apiUrl, err = url.JoinPath(sentryPeerCfg.NumbersUrl, val) diff --git a/engine/filters.go b/engine/filters.go index bec083e6f..2f5f7bfd7 100644 --- a/engine/filters.go +++ b/engine/filters.go @@ -771,7 +771,7 @@ func (fltr *FilterRule) passSentryPeer(ctx *context.Context, dDP utils.DataProvi } return false, err } - if fltr.Values[0] != utils.MetaNumber && fltr.Values[0] != utils.MetaIp { + if fltr.Values[0] != utils.MetaNumber && fltr.Values[0] != utils.MetaIP { return false, fmt.Errorf("invalid value for sentrypeer filter: <%s>", fltr.Values[0]) } return GetSentryPeer(ctx, strVal, config.CgrConfig().SentryPeerCfg(), fltr.Values[0]) diff --git a/engine/libtest.go b/engine/libtest.go index bf61b09b7..31b4596cc 100644 --- a/engine/libtest.go +++ b/engine/libtest.go @@ -280,7 +280,7 @@ func GetDefaultEmptyCacheStats() map[string]*ltcache.CacheStats { utils.CacheResources: {}, utils.CacheIPFilterIndexes: {}, utils.CacheIPProfiles: {}, - utils.CacheIPs: {}, + utils.CacheIPAllocations: {}, utils.CacheRPCResponses: {}, utils.CacheStatFilterIndexes: {}, utils.CacheStatQueueProfiles: {}, diff --git a/engine/storage_interface.go b/engine/storage_interface.go index 6d84af22b..ad8c00690 100644 --- a/engine/storage_interface.go +++ b/engine/storage_interface.go @@ -49,9 +49,9 @@ type DataDB interface { GetIPProfileDrv(*context.Context, string, string) (*utils.IPProfile, error) SetIPProfileDrv(*context.Context, *utils.IPProfile) error RemoveIPProfileDrv(*context.Context, string, string) error - GetIPDrv(*context.Context, string, string) (*utils.IP, error) - SetIPDrv(*context.Context, *utils.IP) error - RemoveIPDrv(*context.Context, string, string) error + GetIPAllocationsDrv(*context.Context, string, string) (*utils.IPAllocations, error) + SetIPAllocationsDrv(*context.Context, *utils.IPAllocations) error + RemoveIPAllocationsDrv(*context.Context, string, string) error GetLoadHistory(int, bool, string) ([]*utils.LoadInstance, error) AddLoadHistory(*utils.LoadInstance, int, string) error GetIndexesDrv(ctx *context.Context, idxItmType, tntCtx, idxKey, transactionID string) (indexes map[string]utils.StringSet, err error) diff --git a/engine/storage_internal_datadb.go b/engine/storage_internal_datadb.go index a36b70d43..ed80c69cd 100644 --- a/engine/storage_internal_datadb.go +++ b/engine/storage_internal_datadb.go @@ -260,21 +260,21 @@ func (iDB *InternalDB) RemoveIPProfileDrv(_ *context.Context, tenant, id string) return nil } -func (iDB *InternalDB) GetIPDrv(_ *context.Context, tenant, id string) (*utils.IP, error) { - if x, ok := iDB.db.Get(utils.CacheIPs, utils.ConcatenatedKey(tenant, id)); ok && x != nil { - return x.(*utils.IP), nil +func (iDB *InternalDB) GetIPAllocationsDrv(_ *context.Context, tenant, id string) (*utils.IPAllocations, error) { + if x, ok := iDB.db.Get(utils.CacheIPAllocations, utils.ConcatenatedKey(tenant, id)); ok && x != nil { + return x.(*utils.IPAllocations), nil } return nil, utils.ErrNotFound } -func (iDB *InternalDB) SetIPDrv(_ *context.Context, ip *utils.IP) error { - iDB.db.Set(utils.CacheIPs, ip.TenantID(), ip, nil, +func (iDB *InternalDB) SetIPAllocationsDrv(_ *context.Context, ip *utils.IPAllocations) error { + iDB.db.Set(utils.CacheIPAllocations, ip.TenantID(), ip, nil, true, utils.NonTransactional) return nil } -func (iDB *InternalDB) RemoveIPDrv(_ *context.Context, tenant, id string) error { - iDB.db.Remove(utils.CacheIPs, utils.ConcatenatedKey(tenant, id), +func (iDB *InternalDB) RemoveIPAllocationsDrv(_ *context.Context, tenant, id string) error { + iDB.db.Remove(utils.CacheIPAllocations, utils.ConcatenatedKey(tenant, id), true, utils.NonTransactional) return nil } diff --git a/engine/storage_mongo_datadb.go b/engine/storage_mongo_datadb.go index 88f38f48e..29da3a312 100644 --- a/engine/storage_mongo_datadb.go +++ b/engine/storage_mongo_datadb.go @@ -465,8 +465,8 @@ func (ms *MongoStorage) GetKeysForPrefix(ctx *context.Context, prefix string) (k keys, qryErr = ms.getAllKeysMatchingTenantID(sctx, ColRes, utils.ResourcesPrefix, tntID) case utils.IPProfilesPrefix: keys, qryErr = ms.getAllKeysMatchingTenantID(sctx, ColIPp, utils.IPProfilesPrefix, tntID) - case utils.IPsPrefix: - keys, qryErr = ms.getAllKeysMatchingTenantID(sctx, ColIPs, utils.IPsPrefix, tntID) + case utils.IPAllocationsPrefix: + keys, qryErr = ms.getAllKeysMatchingTenantID(sctx, ColIPs, utils.IPAllocationsPrefix, tntID) case utils.StatQueuePrefix: keys, qryErr = ms.getAllKeysMatchingTenantID(sctx, ColSqs, utils.StatQueuePrefix, tntID) case utils.StatQueueProfilePrefix: @@ -539,7 +539,7 @@ func (ms *MongoStorage) HasDataDrv(ctx *context.Context, category, subject, tena count, err = ms.getCol(ColRes).CountDocuments(sctx, bson.M{"tenant": tenant, "id": subject}) case utils.ResourceProfilesPrefix: count, err = ms.getCol(ColRsP).CountDocuments(sctx, bson.M{"tenant": tenant, "id": subject}) - case utils.IPsPrefix: + case utils.IPAllocationsPrefix: count, err = ms.getCol(ColIPs).CountDocuments(sctx, bson.M{"tenant": tenant, "id": subject}) case utils.IPProfilesPrefix: count, err = ms.getCol(ColIPp).CountDocuments(sctx, bson.M{"tenant": tenant, "id": subject}) @@ -785,8 +785,8 @@ func (ms *MongoStorage) RemoveIPProfileDrv(ctx *context.Context, tenant, id stri }) } -func (ms *MongoStorage) GetIPDrv(ctx *context.Context, tenant, id string) (*utils.IP, error) { - ip := new(utils.IP) +func (ms *MongoStorage) GetIPAllocationsDrv(ctx *context.Context, tenant, id string) (*utils.IPAllocations, error) { + ip := new(utils.IPAllocations) err := ms.query(ctx, func(sctx mongo.SessionContext) error { sr := ms.getCol(ColIPs).FindOne(sctx, bson.M{"tenant": tenant, "id": id}) decodeErr := sr.Decode(ip) @@ -798,7 +798,7 @@ func (ms *MongoStorage) GetIPDrv(ctx *context.Context, tenant, id string) (*util return ip, err } -func (ms *MongoStorage) SetIPDrv(ctx *context.Context, ip *utils.IP) error { +func (ms *MongoStorage) SetIPAllocationsDrv(ctx *context.Context, ip *utils.IPAllocations) error { return ms.query(ctx, func(sctx mongo.SessionContext) error { _, err := ms.getCol(ColIPs).UpdateOne(sctx, bson.M{"tenant": ip.Tenant, "id": ip.ID}, bson.M{"$set": ip}, @@ -808,7 +808,7 @@ func (ms *MongoStorage) SetIPDrv(ctx *context.Context, ip *utils.IP) error { }) } -func (ms *MongoStorage) RemoveIPDrv(ctx *context.Context, tenant, id string) error { +func (ms *MongoStorage) RemoveIPAllocationsDrv(ctx *context.Context, tenant, id string) error { return ms.query(ctx, func(sctx mongo.SessionContext) error { dr, err := ms.getCol(ColIPs).DeleteOne(sctx, bson.M{"tenant": tenant, "id": id}) if dr.DeletedCount == 0 { diff --git a/engine/storage_redis.go b/engine/storage_redis.go index 5dcf0366f..1cd07fd61 100644 --- a/engine/storage_redis.go +++ b/engine/storage_redis.go @@ -447,31 +447,31 @@ func (rs *RedisStorage) RemoveIPProfileDrv(ctx *context.Context, tenant, id stri return rs.Cmd(nil, redisDEL, utils.IPProfilesPrefix+utils.ConcatenatedKey(tenant, id)) } -func (rs *RedisStorage) GetIPDrv(ctx *context.Context, tenant, id string) (*utils.IP, error) { +func (rs *RedisStorage) GetIPAllocationsDrv(ctx *context.Context, tenant, id string) (*utils.IPAllocations, error) { var values []byte - if err := rs.Cmd(&values, redisGET, utils.IPsPrefix+utils.ConcatenatedKey(tenant, id)); err != nil { + if err := rs.Cmd(&values, redisGET, utils.IPAllocationsPrefix+utils.ConcatenatedKey(tenant, id)); err != nil { return nil, err } if len(values) == 0 { return nil, utils.ErrNotFound } - var ip *utils.IP + var ip *utils.IPAllocations if err := rs.ms.Unmarshal(values, &ip); err != nil { return nil, err } return ip, nil } -func (rs *RedisStorage) SetIPDrv(ctx *context.Context, ip *utils.IP) error { +func (rs *RedisStorage) SetIPAllocationsDrv(ctx *context.Context, ip *utils.IPAllocations) error { result, err := rs.ms.Marshal(ip) if err != nil { return err } - return rs.Cmd(nil, redisSET, utils.IPsPrefix+ip.TenantID(), string(result)) + return rs.Cmd(nil, redisSET, utils.IPAllocationsPrefix+ip.TenantID(), string(result)) } -func (rs *RedisStorage) RemoveIPDrv(ctx *context.Context, tenant, id string) error { - return rs.Cmd(nil, redisDEL, utils.IPsPrefix+utils.ConcatenatedKey(tenant, id)) +func (rs *RedisStorage) RemoveIPAllocationsDrv(ctx *context.Context, tenant, id string) error { + return rs.Cmd(nil, redisDEL, utils.IPAllocationsPrefix+utils.ConcatenatedKey(tenant, id)) } func (rs *RedisStorage) GetVersions(itm string) (vrs Versions, err error) { diff --git a/general_tests/tut_smgeneric_it_test.go b/general_tests/tut_smgeneric_it_test.go index 976531e58..dd0921b02 100644 --- a/general_tests/tut_smgeneric_it_test.go +++ b/general_tests/tut_smgeneric_it_test.go @@ -150,7 +150,7 @@ func testTutSMGCacheStats(t *testing.T) { expectedStats[utils.CacheResourceProfiles].Items = 1 expectedStats[utils.CacheResources].Items = 1 expectedStats[utils.CacheIPProfiles].Items = 1 - expectedStats[utils.CacheIPs].Items = 1 + expectedStats[utils.CacheIPAllocations].Items = 1 expectedStats[utils.CacheStatQueues].Items = 7 expectedStats[utils.CacheStatQueueProfiles].Items = 7 expectedStats[utils.CacheThresholds].Items = 1 diff --git a/ips/apis.go b/ips/apis.go index 7aeef9606..2d63757a6 100644 --- a/ips/apis.go +++ b/ips/apis.go @@ -28,8 +28,8 @@ import ( "github.com/cgrates/guardian" ) -// V1GetIPsForEvent returns active IPs matching the event. -func (s *IPService) V1GetIPsForEvent(ctx *context.Context, args *utils.CGREvent, reply *IPs) (err error) { +// V1GetIPAllocationsForEvent returns active IPs matching the event. +func (s *IPService) V1GetIPAllocationsForEvent(ctx *context.Context, args *utils.CGREvent, reply *IPAllocationsList) (err error) { if args == nil { return utils.NewErrMandatoryIeMissing(utils.Event) } @@ -60,14 +60,14 @@ func (s *IPService) V1GetIPsForEvent(ctx *context.Context, args *utils.CGREvent, // RPC caching if config.CgrConfig().CacheCfg().Partitions[utils.CacheRPCResponses].Limit != 0 { - cacheKey := utils.ConcatenatedKey(utils.IPsV1GetIPsForEvent, utils.ConcatenatedKey(tnt, args.ID)) + cacheKey := utils.ConcatenatedKey(utils.IPsV1GetIPAllocationsForEvent, utils.ConcatenatedKey(tnt, args.ID)) refID := guardian.Guardian.GuardIDs("", config.CgrConfig().GeneralCfg().LockingTimeout, cacheKey) // RPC caching needs to be atomic defer guardian.Guardian.UnguardIDs(refID) if itm, has := engine.Cache.Get(utils.CacheRPCResponses, cacheKey); has { cachedResp := itm.(*utils.CachedRPCResponse) if cachedResp.Error == nil { - *reply = *cachedResp.Result.(*IPs) + *reply = *cachedResp.Result.(*IPAllocationsList) } return cachedResp.Error } @@ -77,8 +77,8 @@ func (s *IPService) V1GetIPsForEvent(ctx *context.Context, args *utils.CGREvent, } // end of RPC caching - var mtcRLs IPs - if mtcRLs, err = s.matchingIPsForEvent(ctx, tnt, args, usageID, usageTTL); err != nil { + var mtcRLs IPAllocationsList + if mtcRLs, err = s.matchingIPAllocationsForEvent(ctx, tnt, args, usageID, usageTTL); err != nil { return err } *reply = mtcRLs @@ -141,8 +141,8 @@ func (s *IPService) V1AuthorizeIPs(ctx *context.Context, args *utils.CGREvent, r } // end of RPC caching - var mtcRLs IPs - if mtcRLs, err = s.matchingIPsForEvent(ctx, tnt, args, usageID, usageTTL); err != nil { + var mtcRLs IPAllocationsList + if mtcRLs, err = s.matchingIPAllocationsForEvent(ctx, tnt, args, usageID, usageTTL); err != nil { return err } defer mtcRLs.unlock() @@ -211,8 +211,8 @@ func (s *IPService) V1AllocateIPs(ctx *context.Context, args *utils.CGREvent, re } // end of RPC caching - var mtcRLs IPs - if mtcRLs, err = s.matchingIPsForEvent(ctx, tnt, args, usageID, + var mtcRLs IPAllocationsList + if mtcRLs, err = s.matchingIPAllocationsForEvent(ctx, tnt, args, usageID, usageTTL); err != nil { return err } @@ -224,7 +224,7 @@ func (s *IPService) V1AllocateIPs(ctx *context.Context, args *utils.CGREvent, re */ // index it for storing - if err = s.storeMatchedIPs(ctx, mtcRLs); err != nil { + if err = s.storeMatchedIPAllocations(ctx, mtcRLs); err != nil { return } *reply = utils.OK @@ -281,8 +281,8 @@ func (s *IPService) V1ReleaseIPs(ctx *context.Context, args *utils.CGREvent, rep } // end of RPC caching - var mtcRLs IPs - if mtcRLs, err = s.matchingIPsForEvent(ctx, tnt, args, usageID, + var mtcRLs IPAllocationsList + if mtcRLs, err = s.matchingIPAllocationsForEvent(ctx, tnt, args, usageID, usageTTL); err != nil { return } @@ -294,7 +294,7 @@ func (s *IPService) V1ReleaseIPs(ctx *context.Context, args *utils.CGREvent, rep */ // Handle storing - if err = s.storeMatchedIPs(ctx, mtcRLs); err != nil { + if err = s.storeMatchedIPAllocations(ctx, mtcRLs); err != nil { return } @@ -302,8 +302,8 @@ func (s *IPService) V1ReleaseIPs(ctx *context.Context, args *utils.CGREvent, rep return } -// V1GetIP returns a resource configuration -func (s *IPService) V1GetIP(ctx *context.Context, arg *utils.TenantIDWithAPIOpts, reply *utils.IP) error { +// V1GetIPAllocations returns a resource configuration +func (s *IPService) V1GetIPAllocations(ctx *context.Context, arg *utils.TenantIDWithAPIOpts, reply *utils.IPAllocations) error { if missing := utils.MissingStructFields(arg, []string{utils.ID}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } @@ -315,10 +315,10 @@ func (s *IPService) V1GetIP(ctx *context.Context, arg *utils.TenantIDWithAPIOpts // make sure resource is locked at process level lkID := guardian.Guardian.GuardIDs(utils.EmptyString, config.CgrConfig().GeneralCfg().LockingTimeout, - utils.IPLockKey(tnt, arg.ID)) + utils.IPAllocationsLockKey(tnt, arg.ID)) defer guardian.Guardian.UnguardIDs(lkID) - ip, err := s.dm.GetIP(ctx, tnt, arg.ID, true, true, utils.NonTransactional) + ip, err := s.dm.GetIPAllocations(ctx, tnt, arg.ID, true, true, utils.NonTransactional) if err != nil { return err } diff --git a/ips/ips.go b/ips/ips.go index c6b462877..e9e7ab583 100644 --- a/ips/ips.go +++ b/ips/ips.go @@ -33,79 +33,78 @@ import ( "github.com/cgrates/guardian" ) -// ipProfile represents the user configuration for the ip +// ipProfile wraps IPProfile with lkID. type ipProfile struct { IPProfile *utils.IPProfile lkID string // holds the reference towards guardian lock key - } -// lock will lock the ipProfile using guardian and store the lock within r.lkID +// lock will lock the ipProfile using guardian and store the lock within p.lkID // if lkID is passed as argument, the lock is considered as executed -func (ip *ipProfile) lock(lkID string) { +func (p *ipProfile) lock(lkID string) { if lkID == utils.EmptyString { lkID = guardian.Guardian.GuardIDs("", config.CgrConfig().GeneralCfg().LockingTimeout, - utils.IPProfileLockKey(ip.IPProfile.Tenant, ip.IPProfile.ID)) + utils.IPProfileLockKey(p.IPProfile.Tenant, p.IPProfile.ID)) } - ip.lkID = lkID + p.lkID = lkID } -// unlock will unlock the ipProfile and clear rp.lkID -func (ip *ipProfile) unlock() { - if ip.lkID == utils.EmptyString { +// unlock will unlock the ipProfile and clear p.lkID. +func (p *ipProfile) unlock() { + if p.lkID == utils.EmptyString { return } - guardian.Guardian.UnguardIDs(ip.lkID) - ip.lkID = utils.EmptyString + guardian.Guardian.UnguardIDs(p.lkID) + p.lkID = utils.EmptyString } // isLocked returns the locks status of this ipProfile -func (ip *ipProfile) isLocked() bool { - return ip.lkID != utils.EmptyString +func (p *ipProfile) isLocked() bool { + return p.lkID != utils.EmptyString } -// ip represents an ip in the system +// ipAllocations represents ipAllocations in the system // not thread safe, needs locking at process level -type ip struct { - IP *utils.IP - lkID string // ID of the lock used when matching the ip - ttl *time.Duration // time to leave for this ip, picked up on each IP initialization out of config - tUsage *float64 // sum of all usages - dirty *bool // the usages were modified, needs save, *bool so we only save if enabled in config - rPrf *ipProfile // for ordering purposes +type ipAllocations struct { + IPAllocations *utils.IPAllocations + lkID string // ID of the lock used when matching the ipAllocations + ttl *time.Duration // time to leave for these ip allocations, picked up on each IPAllocations initialization out of config + tUsage *float64 // sum of all usages + dirty *bool // the usages were modified, needs save, *bool so we only save if enabled in config + cfg *ipProfile // for ordering purposes } -// lock will lock the ip using guardian and store the lock within r.lkID +// lock will lock the ipAllocations using guardian and store the lock within ipAllocations.lkID // if lkID is passed as argument, the lock is considered as executed -func (ip *ip) lock(lkID string) { +func (a *ipAllocations) lock(lkID string) { if lkID == utils.EmptyString { lkID = guardian.Guardian.GuardIDs("", config.CgrConfig().GeneralCfg().LockingTimeout, - utils.IPLockKey(ip.IP.Tenant, ip.IP.ID)) + utils.IPAllocationsLockKey(a.IPAllocations.Tenant, a.IPAllocations.ID)) } - ip.lkID = lkID + a.lkID = lkID } -// unlock will unlock the ip and clear r.lkID -func (ip *ip) unlock() { - if ip.lkID == utils.EmptyString { +// unlock will unlock the ipAllocations and clear ipAllocations.lkID +func (a *ipAllocations) unlock() { + if a.lkID == utils.EmptyString { return } - guardian.Guardian.UnguardIDs(ip.lkID) - ip.lkID = utils.EmptyString + guardian.Guardian.UnguardIDs(a.lkID) + a.lkID = utils.EmptyString } -// isLocked returns the locks status of this ip -func (ip *ip) isLocked() bool { - return ip.lkID != utils.EmptyString +// isLocked returns the locks status of this ipAllocations object. +func (a *ipAllocations) isLocked() bool { + return a.lkID != utils.EmptyString } -// removeExpiredUnits removes units which are expired from the ip -func (ip *ip) removeExpiredUnits() { +// removeExpiredUnits removes units which are expired from the ipAllocations object. +func (a *ipAllocations) removeExpiredUnits() { var firstActive int - for _, usageID := range ip.IP.TTLIdx { - if u, has := ip.IP.Usages[usageID]; has && u.IsActive(time.Now()) { + for _, usageID := range a.IPAllocations.TTLIdx { + if u, has := a.IPAllocations.Usages[usageID]; has && u.IsActive(time.Now()) { break } firstActive++ @@ -113,90 +112,102 @@ func (ip *ip) removeExpiredUnits() { if firstActive == 0 { return } - for _, uID := range ip.IP.TTLIdx[:firstActive] { - usage, has := ip.IP.Usages[uID] + for _, uID := range a.IPAllocations.TTLIdx[:firstActive] { + usage, has := a.IPAllocations.Usages[uID] if !has { continue } - delete(ip.IP.Usages, uID) - if ip.tUsage != nil { // total usage was not yet calculated so we do not need to update it - *ip.tUsage -= usage.Units - if *ip.tUsage < 0 { // something went wrong + delete(a.IPAllocations.Usages, uID) + if a.tUsage != nil { // total usage was not yet calculated so we do not need to update it + *a.tUsage -= usage.Units + if *a.tUsage < 0 { // something went wrong utils.Logger.Warning( - fmt.Sprintf("resetting total usage for ipID: %s, usage smaller than 0: %f", ip.IP.ID, *ip.tUsage)) - ip.tUsage = nil + fmt.Sprintf("resetting total usage for IP allocations %q, usage smaller than 0: %f", a.IPAllocations.ID, *a.tUsage)) + a.tUsage = nil } } } - ip.IP.TTLIdx = ip.IP.TTLIdx[firstActive:] - ip.tUsage = nil + a.IPAllocations.TTLIdx = a.IPAllocations.TTLIdx[firstActive:] + a.tUsage = nil } // recordUsage records a new usage -func (ip *ip) recordUsage(usage *utils.IPUsage) error { - if _, has := ip.IP.Usages[usage.ID]; has { +func (a *ipAllocations) recordUsage(usage *utils.IPUsage) error { + if _, has := a.IPAllocations.Usages[usage.ID]; has { return fmt.Errorf("duplicate ip usage with id: %s", usage.TenantID()) } - if ip.ttl != nil && *ip.ttl != -1 { - if *ip.ttl == 0 { + if a.ttl != nil && *a.ttl != -1 { + if *a.ttl == 0 { return nil // no recording for ttl of 0 } usage = usage.Clone() // don't influence the initial ru - usage.ExpiryTime = time.Now().Add(*ip.ttl) + usage.ExpiryTime = time.Now().Add(*a.ttl) } - ip.IP.Usages[usage.ID] = usage - if ip.tUsage != nil { - *ip.tUsage += usage.Units + a.IPAllocations.Usages[usage.ID] = usage + if a.tUsage != nil { + *a.tUsage += usage.Units } if !usage.ExpiryTime.IsZero() { - ip.IP.TTLIdx = append(ip.IP.TTLIdx, usage.ID) + a.IPAllocations.TTLIdx = append(a.IPAllocations.TTLIdx, usage.ID) } return nil } // clearUsage clears the usage for an ID -func (ip *ip) clearUsage(usageID string) error { - usage, has := ip.IP.Usages[usageID] +func (a *ipAllocations) clearUsage(usageID string) error { + usage, has := a.IPAllocations.Usages[usageID] if !has { return fmt.Errorf("cannot find usage record with id: %s", usageID) } if !usage.ExpiryTime.IsZero() { - for i, uIDIdx := range ip.IP.TTLIdx { + for i, uIDIdx := range a.IPAllocations.TTLIdx { if uIDIdx == usageID { - ip.IP.TTLIdx = slices.Delete(ip.IP.TTLIdx, i, i+1) + a.IPAllocations.TTLIdx = slices.Delete(a.IPAllocations.TTLIdx, i, i+1) break } } } - if ip.tUsage != nil { - *ip.tUsage -= usage.Units + if a.tUsage != nil { + *a.tUsage -= usage.Units } - delete(ip.IP.Usages, usageID) + delete(a.IPAllocations.Usages, usageID) return nil } -// IPs is a collection of IP objects. -type IPs []*ip +// IPAllocationsList is a collection of ipAllocations objects. +type IPAllocationsList []*ipAllocations -// unlock will unlock ips part of this slice -func (ips IPs) unlock() { - for _, ip := range ips { - ip.unlock() - if ip.rPrf != nil { - ip.rPrf.unlock() +// unlock will unlock IP allocations in this slice +func (al IPAllocationsList) unlock() { + for _, allocs := range al { + allocs.unlock() + if allocs.cfg != nil { + allocs.cfg.unlock() } } } -// ids returns a map of ip IDs which is used for caching -func (ips IPs) ids() utils.StringSet { +// ids returns a map of IP allocation IDs which is used for caching +func (al IPAllocationsList) ids() utils.StringSet { ids := make(utils.StringSet) - for _, ip := range ips { - ids.Add(ip.IP.ID) + for _, allocs := range al { + ids.Add(allocs.IPAllocations.ID) } return ids } +// IPService is the service handling IP allocations +type IPService struct { + dm *engine.DataManager // So we can load the data in cache and index it + fltrs *engine.FilterS + storedIPsMux sync.RWMutex // protects storedIPs + storedIPs utils.StringSet // keep a record of IP allocations which need saving, map[allocsID]bool + cfg *config.CGRConfig + stopBackup chan struct{} // control storing process + loopStopped chan struct{} + cm *engine.ConnManager +} + // NewIPService returns a new IPService func NewIPService(dm *engine.DataManager, cfg *config.CGRConfig, fltrs *engine.FilterS, cm *engine.ConnManager) *IPService { @@ -211,18 +222,6 @@ func NewIPService(dm *engine.DataManager, cfg *config.CGRConfig, } -// IPService is the service handling resources -type IPService struct { - dm *engine.DataManager // So we can load the data in cache and index it - fltrs *engine.FilterS - storedIPsMux sync.RWMutex // protects storedIPs - storedIPs utils.StringSet // keep a record of resources which need saving, map[resID]bool - cfg *config.CGRConfig - stopBackup chan struct{} // control storing process - loopStopped chan struct{} - cm *engine.ConnManager -} - // Reload stops the backupLoop and restarts it func (s *IPService) Reload(ctx *context.Context) { close(s.stopBackup) @@ -239,10 +238,10 @@ func (s *IPService) StartLoop(ctx *context.Context) { // Shutdown is called to shutdown the service func (s *IPService) Shutdown(ctx *context.Context) { close(s.stopBackup) - s.storeIPs(ctx) + s.storeIPAllocationsList(ctx) } -// backup will regularly store resources changed to dataDB +// backup will regularly store IP allocations changed to dataDB func (s *IPService) runBackup(ctx *context.Context) { storeInterval := s.cfg.IPsCfg().StoreInterval if storeInterval <= 0 { @@ -250,7 +249,7 @@ func (s *IPService) runBackup(ctx *context.Context) { return } for { - s.storeIPs(ctx) + s.storeIPAllocationsList(ctx) select { case <-s.stopBackup: s.loopStopped <- struct{}{} @@ -260,37 +259,38 @@ func (s *IPService) runBackup(ctx *context.Context) { } } -// storeIPs represents one task of complete backup -func (s *IPService) storeIPs(ctx *context.Context) { +// storeIPAllocationsList represents one task of complete backup +func (s *IPService) storeIPAllocationsList(ctx *context.Context) { var failedRIDs []string - for { // don't stop until we store all dirty resources + for { // don't stop until we store all dirty IP allocations s.storedIPsMux.Lock() - rID := s.storedIPs.GetOne() - if rID != "" { - s.storedIPs.Remove(rID) + allocsID := s.storedIPs.GetOne() + if allocsID != "" { + s.storedIPs.Remove(allocsID) } s.storedIPsMux.Unlock() - if rID == "" { + if allocsID == "" { break // no more keys, backup completed } - rIf, ok := engine.Cache.Get(utils.CacheIPs, rID) + rIf, ok := engine.Cache.Get(utils.CacheIPAllocations, allocsID) if !ok || rIf == nil { - utils.Logger.Warning(fmt.Sprintf("<%s> failed retrieving from cache resource with ID: %s", utils.IPs, rID)) + utils.Logger.Warning(fmt.Sprintf( + "<%s> failed retrieving from cache IP allocations with ID %q", utils.IPs, allocsID)) continue } - r := &ip{ - IP: rIf.(*utils.IP), + allocs := &ipAllocations{ + IPAllocations: rIf.(*utils.IPAllocations), - // NOTE: dirty is hardcoded to true, otherwise resources would + // NOTE: dirty is hardcoded to true, otherwise IP allocations would // never be stored. // Previously, dirty was part of the cached resource. dirty: utils.BoolPointer(true), } - r.lock(utils.EmptyString) - if err := s.storeIP(ctx, r); err != nil { - failedRIDs = append(failedRIDs, rID) // record failure so we can schedule it for next backup + allocs.lock(utils.EmptyString) + if err := s.storeIPAllocations(ctx, allocs); err != nil { + failedRIDs = append(failedRIDs, allocsID) // record failure so we can schedule it for next backup } - r.unlock() + allocs.unlock() // randomize the CPU load and give up thread control runtime.Gosched() } @@ -301,33 +301,32 @@ func (s *IPService) storeIPs(ctx *context.Context) { } } -// StoreIP stores the resource in DB and corrects dirty flag -func (s *IPService) storeIP(ctx *context.Context, r *ip) (err error) { - if r.dirty == nil || !*r.dirty { - return +// storeIPAllocations stores the IP allocations in DB and corrects dirty flag. +func (s *IPService) storeIPAllocations(ctx *context.Context, allocs *ipAllocations) error { + if allocs.dirty == nil || !*allocs.dirty { + return nil } - if err = s.dm.SetIP(ctx, r.IP); err != nil { + if err := s.dm.SetIPAllocations(ctx, allocs.IPAllocations); err != nil { utils.Logger.Warning( - fmt.Sprintf(" failed saving IP with ID: %s, error: %s", - r.IP.ID, err.Error())) - return + fmt.Sprintf(" failed saving IP allocations %q: %v", + allocs.IPAllocations.ID, err)) + return err } //since we no longer handle cache in DataManager do here a manual caching - if tntID := r.IP.TenantID(); engine.Cache.HasItem(utils.CacheIPs, tntID) { // only cache if previously there - if err = engine.Cache.Set(ctx, utils.CacheIPs, tntID, r.IP, nil, + if tntID := allocs.IPAllocations.TenantID(); engine.Cache.HasItem(utils.CacheIPAllocations, tntID) { // only cache if previously there + if err := engine.Cache.Set(ctx, utils.CacheIPAllocations, tntID, allocs.IPAllocations, nil, true, utils.NonTransactional); err != nil { utils.Logger.Warning( - fmt.Sprintf(" failed caching IP with ID: %s, error: %s", - tntID, err.Error())) - return + fmt.Sprintf(" failed caching IP allocations %q: %v", tntID, err)) + return err } } - *r.dirty = false - return + *allocs.dirty = false + return nil } -// storeMatchedIPs will store the list of resources based on the StoreInterval -func (s *IPService) storeMatchedIPs(ctx *context.Context, mtcRLs IPs) (err error) { +// storeMatchedIPAllocations will store the list of IP allocations based on the StoreInterval +func (s *IPService) storeMatchedIPAllocations(ctx *context.Context, matched IPAllocationsList) (err error) { if s.cfg.IPsCfg().StoreInterval == 0 { return } @@ -335,14 +334,14 @@ func (s *IPService) storeMatchedIPs(ctx *context.Context, mtcRLs IPs) (err error s.storedIPsMux.Lock() defer s.storedIPsMux.Unlock() } - for _, r := range mtcRLs { - if r.dirty != nil { - *r.dirty = true // mark it to be saved + for _, allocs := range matched { + if allocs.dirty != nil { + *allocs.dirty = true // mark it to be saved if s.cfg.IPsCfg().StoreInterval > 0 { - s.storedIPs.Add(r.IP.TenantID()) + s.storedIPs.Add(allocs.IPAllocations.TenantID()) continue } - if err = s.storeIP(ctx, r); err != nil { + if err = s.storeIPAllocations(ctx, allocs); err != nil { return } } @@ -351,9 +350,9 @@ func (s *IPService) storeMatchedIPs(ctx *context.Context, mtcRLs IPs) (err error return } -// matchingIPsForEvent returns ordered list of matching resources which are active by the time of the call -func (s *IPService) matchingIPsForEvent(ctx *context.Context, tnt string, ev *utils.CGREvent, - evUUID string, ttl *time.Duration) (ips IPs, err error) { +// matchingIPAllocationsForEvent returns ordered list of matching IP allocations which are active by the time of the call +func (s *IPService) matchingIPAllocationsForEvent(ctx *context.Context, tnt string, ev *utils.CGREvent, + evUUID string, ttl *time.Duration) (al IPAllocationsList, err error) { var rIDs utils.StringSet evNm := utils.MapStorage{ utils.MetaReq: ev.Event, @@ -375,8 +374,7 @@ func (s *IPService) matchingIPsForEvent(ctx *context.Context, tnt string, ev *ut } } }() - - } else { // select the resourceIDs out of dataDB + } else { // select the IP allocation IDs out of dataDB rIDs, err = engine.MatchingItemIDsForEvent(ctx, evNm, s.cfg.IPsCfg().StringIndexedFields, s.cfg.IPsCfg().PrefixIndexedFields, @@ -396,8 +394,8 @@ func (s *IPService) matchingIPsForEvent(ctx *context.Context, tnt string, ev *ut return } } - ips = make(IPs, 0, len(rIDs)) - weights := make(map[string]float64) // stores sorting weights by resource ID + al = make(IPAllocationsList, 0, len(rIDs)) + weights := make(map[string]float64) // stores sorting weights by IP allocation ID for resName := range rIDs { lkPrflID := guardian.Guardian.GuardIDs("", config.CgrConfig().GeneralCfg().LockingTimeout, @@ -409,7 +407,7 @@ func (s *IPService) matchingIPsForEvent(ctx *context.Context, tnt string, ev *ut if err == utils.ErrNotFound { continue } - ips.unlock() + al.unlock() return } rPrf := &ipProfile{ @@ -420,7 +418,7 @@ func (s *IPService) matchingIPsForEvent(ctx *context.Context, tnt string, ev *ut if pass, err = s.fltrs.Pass(ctx, tnt, rPrf.IPProfile.FilterIDs, evNm); err != nil { rPrf.unlock() - ips.unlock() + al.unlock() return nil, err } else if !pass { rPrf.unlock() @@ -428,48 +426,48 @@ func (s *IPService) matchingIPsForEvent(ctx *context.Context, tnt string, ev *ut } lkID := guardian.Guardian.GuardIDs(utils.EmptyString, config.CgrConfig().GeneralCfg().LockingTimeout, - utils.IPLockKey(rPrf.IPProfile.Tenant, rPrf.IPProfile.ID)) - var res *utils.IP - if res, err = s.dm.GetIP(ctx, rPrf.IPProfile.Tenant, rPrf.IPProfile.ID, true, true, ""); err != nil { + utils.IPAllocationsLockKey(rPrf.IPProfile.Tenant, rPrf.IPProfile.ID)) + var res *utils.IPAllocations + if res, err = s.dm.GetIPAllocations(ctx, rPrf.IPProfile.Tenant, rPrf.IPProfile.ID, true, true, ""); err != nil { guardian.Guardian.UnguardIDs(lkID) rPrf.unlock() - ips.unlock() + al.unlock() return nil, err } - r := &ip{ - IP: res, + allocs := &ipAllocations{ + IPAllocations: res, } - r.lock(lkID) // pass the lock into resource so we have it as reference - if rPrf.IPProfile.Stored && r.dirty == nil { - r.dirty = utils.BoolPointer(false) + allocs.lock(lkID) // pass the lock into IP allocations so we have it as reference + if rPrf.IPProfile.Stored && allocs.dirty == nil { + allocs.dirty = utils.BoolPointer(false) } if ttl != nil { if *ttl != 0 { - r.ttl = ttl + allocs.ttl = ttl } } else if rPrf.IPProfile.TTL >= 0 { - r.ttl = utils.DurationPointer(rPrf.IPProfile.TTL) + allocs.ttl = utils.DurationPointer(rPrf.IPProfile.TTL) } - r.rPrf = rPrf + allocs.cfg = rPrf weight, err := engine.WeightFromDynamics(ctx, rPrf.IPProfile.Weights, s.fltrs, tnt, evNm) if err != nil { return nil, err } - weights[r.IP.ID] = weight - ips = append(ips, r) + weights[allocs.IPAllocations.ID] = weight + al = append(al, allocs) } - if len(ips) == 0 { + if len(al) == 0 { return nil, utils.ErrNotFound } // Sort by weight (higher values first). - slices.SortFunc(ips, func(a, b *ip) int { - return cmp.Compare(weights[b.IP.ID], weights[a.IP.ID]) + slices.SortFunc(al, func(a, b *ipAllocations) int { + return cmp.Compare(weights[b.IPAllocations.ID], weights[a.IPAllocations.ID]) }) - if err = engine.Cache.Set(ctx, utils.CacheEventIPs, evUUID, ips.ids(), nil, true, ""); err != nil { - ips.unlock() + if err = engine.Cache.Set(ctx, utils.CacheEventIPs, evUUID, al.ids(), nil, true, ""); err != nil { + al.unlock() } return } diff --git a/ips/ips_it_test.go b/ips/ips_it_test.go index 7ade9214e..0c5264f10 100644 --- a/ips/ips_it_test.go +++ b/ips/ips_it_test.go @@ -215,8 +215,8 @@ cgrates.org,IPs2,*string:~*req.Account:1002,;20,2s,false,POOL1,*string:~*req.Des }) t.Run("ips apis", func(t *testing.T) { - var ip utils.IP - if err := client.Call(context.Background(), utils.IPsV1GetIP, + var ip utils.IPAllocations + if err := client.Call(context.Background(), utils.IPsV1GetIPAllocations, &utils.TenantIDWithAPIOpts{ TenantID: &utils.TenantID{ Tenant: "cgrates.org", @@ -227,8 +227,8 @@ cgrates.org,IPs2,*string:~*req.Account:1002,;20,2s,false,POOL1,*string:~*req.Des } usageID := "api_usage" - var evIPs IPs - if err := client.Call(context.Background(), utils.IPsV1GetIPsForEvent, + var evIPs IPAllocationsList + if err := client.Call(context.Background(), utils.IPsV1GetIPAllocationsForEvent, &utils.CGREvent{ Tenant: "cgrates.org", ID: "GetIPsForEvent1", diff --git a/loaders/loader.go b/loaders/loader.go index 8c0008405..87a7cf5da 100644 --- a/loaders/loader.go +++ b/loaders/loader.go @@ -217,7 +217,7 @@ func (l *loader) process(ctx *context.Context, obj profile, lType, action string case utils.MetaIPs: cacheIDs = []string{utils.CacheIPFilterIndexes} cacheArgs[utils.CacheIPProfiles] = []string{tntId} - cacheArgs[utils.CacheIPs] = []string{tntId} + cacheArgs[utils.CacheIPAllocations] = []string{tntId} case utils.MetaFilters: cacheArgs[utils.CacheFilters] = []string{tntId} case utils.MetaStats: diff --git a/services/ips.go b/services/ips.go index 646c2e0b6..1015f0962 100644 --- a/services/ips.go +++ b/services/ips.go @@ -64,7 +64,7 @@ func (s *IPService) Start(shutdown *utils.SyncedChan, registry *servmanager.Serv cacheS := srvDeps[utils.CacheS].(*CacheService) if err := cacheS.WaitToPrecache(shutdown, utils.CacheIPProfiles, - utils.CacheIPs, + utils.CacheIPAllocations, utils.CacheIPFilterIndexes); err != nil { return err } diff --git a/utils/apitpdata.go b/utils/apitpdata.go index 889832b42..c695b3e8e 100644 --- a/utils/apitpdata.go +++ b/utils/apitpdata.go @@ -443,7 +443,7 @@ func NewAttrReloadCacheWithOptsFromMap(arg map[string][]string, tnt string, opts ResourceProfileIDs: arg[CacheResourceProfiles], ResourceIDs: arg[CacheResources], IPProfileIDs: arg[CacheIPProfiles], - IPIDs: arg[CacheIPs], + IPIDs: arg[CacheIPAllocations], StatsQueueProfileIDs: arg[CacheStatQueueProfiles], StatsQueueIDs: arg[CacheStatQueues], ThresholdProfileIDs: arg[CacheThresholdProfiles], @@ -517,7 +517,7 @@ func (a *AttrReloadCacheWithAPIOpts) Map() map[string][]string { CacheResourceProfiles: a.ResourceProfileIDs, CacheResources: a.ResourceIDs, CacheIPProfiles: a.IPProfileIDs, - CacheIPs: a.IPIDs, + CacheIPAllocations: a.IPIDs, CacheStatQueueProfiles: a.StatsQueueProfileIDs, CacheStatQueues: a.StatsQueueIDs, CacheThresholdProfiles: a.ThresholdProfileIDs, diff --git a/utils/consts.go b/utils/consts.go index 793999b6d..30b86cb09 100644 --- a/utils/consts.go +++ b/utils/consts.go @@ -37,7 +37,7 @@ var ( CacheCapsEvents, CacheReplicationHosts}) DataDBPartitions = NewStringSet([]string{ - CacheResourceProfiles, CacheResources, CacheEventResources, CacheIPProfiles, CacheIPs, + CacheResourceProfiles, CacheResources, CacheEventResources, CacheIPProfiles, CacheIPAllocations, CacheEventIPs, CacheStatQueueProfiles, CacheStatQueues, CacheThresholdProfiles, CacheThresholds, CacheFilters, CacheRouteProfiles, CacheAttributeProfiles, CacheTrendProfiles, CacheChargerProfiles, CacheActionProfiles, CacheRankingProfiles, @@ -55,7 +55,7 @@ var ( CacheResourceProfiles: ResourceProfilesPrefix, CacheResources: ResourcesPrefix, CacheIPProfiles: IPProfilesPrefix, - CacheIPs: IPsPrefix, + CacheIPAllocations: IPAllocationsPrefix, CacheStatQueueProfiles: StatQueueProfilePrefix, CacheStatQueues: StatQueuePrefix, CacheTrendProfiles: TrendProfilePrefix, @@ -251,8 +251,8 @@ const ( ConfigPrefix = "cfg_" ResourcesPrefix = "res_" ResourceProfilesPrefix = "rsp_" - IPsPrefix = "ips_" - IPProfilesPrefix = "ipp_" + IPAllocationsPrefix = "ips_" + IPProfilesPrefix = "ipa_" ThresholdPrefix = "thd_" FilterPrefix = "ftr_" CDRsStatsPrefix = "cst_" @@ -416,7 +416,6 @@ const ( RatingProfiles = "RatingProfiles" AccountActions = "AccountActions" ResourcesStr = "Resources" - IPsStr = "IPs" Stats = "Stats" Rankings = "Rankings" Trends = "Trends" @@ -465,7 +464,6 @@ const ( AccountID = "AccountID" AccountIDs = "AccountIDs" ResourceID = "ResourceID" - IPID = "IPID" TotalUsage = "TotalUsage" StatID = "StatID" BalanceType = "BalanceType" @@ -496,7 +494,6 @@ const ( SessionSCosts = "SessionSCosts" RQF = "RQF" ResourceStr = "Resource" - IPStr = "IP" User = "User" Subscribers = "Subscribers" //Destinations = "Destinations" @@ -680,7 +677,6 @@ const ( VersionName = "Version" MetaTenant = "*tenant" ResourceUsageStr = "ResourceUsage" - IPUsageStr = "IPUsage" MetaDuration = "*duration" MetaLibPhoneNumber = "*libphonenumber" MetaTimeString = "*time_string" @@ -991,7 +987,7 @@ const ( const ( MetaAccounts = "*accounts" MetaActions = "*actions" - MetaResourceProfile = "*resource_profiles" + MetaResourceProfiles = "*resource_profiles" MetaIPProfiles = "*ip_profiles" MetaStatQueueProfiles = "*statqueue_profiles" MetaStatQueues = "*statqueues" @@ -1003,6 +999,7 @@ const ( MetaRateProfiles = "*rate_profiles" MetaRateProfileRates = "*rate_profile_rates" MetaChargerProfiles = "*charger_profiles" + MetaIPAllocations = "*ip_allocations" MetaThresholds = "*thresholds" MetaRoutes = "*routes" MetaAttributes = "*attributes" @@ -1060,7 +1057,6 @@ const ( ChargerSLow = "chargers" RoutesLow = "routes" ResourcesLow = "resources" - IPsLow = "ips" StatServiceLow = "stats" ThresholdsLow = "thresholds" AnalyzerSLow = "analyzers" @@ -1117,7 +1113,6 @@ const ( MetaTpActionProfiles = "*tp_action_profiles" MetaTpRateProfiles = "*tp_rate_profiles" MetaTpResources = "*tp_resources" - MetaTpIPs = "*tp_ips" MetaTpChargers = "*tp_chargers" MetaDurationSeconds = "*duration_seconds" MetaDurationNanoseconds = "*duration_nanoseconds" @@ -1138,8 +1133,6 @@ const ( TpStats = "TpStats" TpResources = "TpResources" TpResource = "TpResource" - TpIPs = "TpIPs" - TpIP = "TpIP" TpChargers = "TpChargers" TpRateProfiles = "TpRateProfiles" TpActionProfiles = "TpActionProfiles" @@ -1192,7 +1185,7 @@ const ( MetaAPIBan = "*apiban" MetaSentryPeer = "*sentrypeer" MetaToken = "*token" - MetaIp = "*ip" + MetaIP = "*ip" MetaNumber = "*number" MetaActivationInterval = "*ai" MetaRegex = "*regex" @@ -1235,7 +1228,7 @@ const ( ReplicatorSv1GetTrend = "ReplicatorSv1.GetTrend" ReplicatorSv1GetResource = "ReplicatorSv1.GetResource" ReplicatorSv1GetResourceProfile = "ReplicatorSv1.GetResourceProfile" - ReplicatorSv1GetIP = "ReplicatorSv1.GetIP" + ReplicatorSv1GetIPAllocations = "ReplicatorSv1.GetIPAllocations" ReplicatorSv1GetIPProfile = "ReplicatorSv1.GetIPProfile" ReplicatorSv1GetRouteProfile = "ReplicatorSv1.GetRouteProfile" ReplicatorSv1GetAttributeProfile = "ReplicatorSv1.GetAttributeProfile" @@ -1257,7 +1250,7 @@ const ( ReplicatorSv1SetTrend ReplicatorSv1SetResource = "ReplicatorSv1.SetResource" ReplicatorSv1SetResourceProfile = "ReplicatorSv1.SetResourceProfile" - ReplicatorSv1SetIP = "ReplicatorSv1.SetIP" + ReplicatorSv1SetIPAllocations = "ReplicatorSv1.SetIPAllocations" ReplicatorSv1SetIPProfile = "ReplicatorSv1.SetIPProfile" ReplicatorSv1SetRouteProfile = "ReplicatorSv1.SetRouteProfile" ReplicatorSv1SetAttributeProfile = "ReplicatorSv1.SetAttributeProfile" @@ -1278,7 +1271,7 @@ const ( ReplicatorSv1RemoveTrend = "ReplicatorSv1.RemoveTrend" ReplicatorSv1RemoveResource = "ReplicatorSv1.RemoveResource" ReplicatorSv1RemoveResourceProfile = "ReplicatorSv1.RemoveResourceProfile" - ReplicatorSv1RemoveIP = "ReplicatorSv1.RemoveIP" + ReplicatorSv1RemoveIPAllocations = "ReplicatorSv1.RemoveIPAllocations" ReplicatorSv1RemoveIPProfile = "ReplicatorSv1.RemoveIPProfile" ReplicatorSv1RemoveRouteProfile = "ReplicatorSv1.RemoveRouteProfile" ReplicatorSv1RemoveAttributeProfile = "ReplicatorSv1.RemoveAttributeProfile" @@ -1617,18 +1610,18 @@ const ( // IPs APIs const ( - IPsV1Ping = "IPsV1.Ping" - IPsV1GetIP = "IPsV1.GetIP" - IPsV1GetIPsForEvent = "IPsV1.GetIPsForEvent" - IPsV1AuthorizeIPs = "IPsV1.AuthorizeIPs" - IPsV1AllocateIPs = "IPsV1.AllocateIPs" - IPsV1ReleaseIPs = "IPsV1.ReleaseIPs" - AdminSv1SetIPProfile = "AdminSv1.SetIPProfile" - AdminSv1GetIPProfiles = "AdminSv1.GetIPProfiles" - AdminSv1RemoveIPProfile = "AdminSv1.RemoveIPProfile" - AdminSv1GetIPProfile = "AdminSv1.GetIPProfile" - AdminSv1GetIPProfileIDs = "AdminSv1.GetIPProfileIDs" - AdminSv1GetIPProfilesCount = "AdminSv1.GetIPProfilesCount" + IPsV1Ping = "IPsV1.Ping" + IPsV1GetIPAllocations = "IPsV1.GetIPAllocations" + IPsV1GetIPAllocationsForEvent = "IPsV1.GetIPAllocationsForEvent" + IPsV1AuthorizeIPs = "IPsV1.AuthorizeIPs" + IPsV1AllocateIPs = "IPsV1.AllocateIPs" + IPsV1ReleaseIPs = "IPsV1.ReleaseIPs" + AdminSv1SetIPProfile = "AdminSv1.SetIPProfile" + AdminSv1GetIPProfiles = "AdminSv1.GetIPProfiles" + AdminSv1RemoveIPProfile = "AdminSv1.RemoveIPProfile" + AdminSv1GetIPProfile = "AdminSv1.GetIPProfile" + AdminSv1GetIPProfileIDs = "AdminSv1.GetIPProfileIDs" + AdminSv1GetIPProfilesCount = "AdminSv1.GetIPProfilesCount" ) // SessionS APIs @@ -1826,7 +1819,6 @@ const ( // Table Name const ( TBLTPResources = "tp_resources" - TBLTPIPs = "tp_ips" TBLTPStats = "tp_stats" TBLTPRankings = "tp_rankings" TBLTPTrends = "tp_trends" @@ -1852,7 +1844,7 @@ const ( CacheResources = "*resources" CacheResourceProfiles = "*resource_profiles" CacheEventResources = "*event_resources" - CacheIPs = "*ips" + CacheIPAllocations = "*ip_allocations" CacheIPProfiles = "*ip_profiles" CacheEventIPs = "*event_ips" CacheStatQueueProfiles = "*statqueue_profiles" diff --git a/utils/ips.go b/utils/ips.go index 0eb3ea944..55a56731a 100644 --- a/utils/ips.go +++ b/utils/ips.go @@ -23,7 +23,7 @@ import ( "time" ) -// IPProfile defines the configuration of the IP. +// IPProfile defines the configuration of an IPAllocations object. type IPProfile struct { Tenant string ID string @@ -34,37 +34,43 @@ type IPProfile struct { Pools []*Pool } +// IPProfileWithAPIOpts wraps IPProfile with APIOpts. +type IPProfileWithAPIOpts struct { + *IPProfile + APIOpts map[string]any +} + // TenantID returns the concatenated tenant and ID. -func (ip *IPProfile) TenantID() string { - return ConcatenatedKey(ip.Tenant, ip.ID) +func (p *IPProfile) TenantID() string { + return ConcatenatedKey(p.Tenant, p.ID) } // Clone creates a deep copy of IPProfile for thread-safe use. -func (ip *IPProfile) Clone() *IPProfile { - if ip == nil { +func (p *IPProfile) Clone() *IPProfile { + if p == nil { return nil } - pools := make([]*Pool, 0, len(ip.Pools)) - for _, pool := range ip.Pools { + pools := make([]*Pool, 0, len(p.Pools)) + for _, pool := range p.Pools { pools = append(pools, pool.Clone()) } return &IPProfile{ - Tenant: ip.Tenant, - ID: ip.ID, - FilterIDs: slices.Clone(ip.FilterIDs), - Weights: ip.Weights.Clone(), - TTL: ip.TTL, - Stored: ip.Stored, + Tenant: p.Tenant, + ID: p.ID, + FilterIDs: slices.Clone(p.FilterIDs), + Weights: p.Weights.Clone(), + TTL: p.TTL, + Stored: p.Stored, Pools: pools, } } // CacheClone returns a clone of IPProfile used by ltcache CacheCloner -func (ip *IPProfile) CacheClone() any { - return ip.Clone() +func (p *IPProfile) CacheClone() any { + return p.Clone() } -func (ip *IPProfile) Set(path []string, val any, newBranch bool) error { +func (p *IPProfile) Set(path []string, val any, newBranch bool) error { if len(path) != 1 && len(path) != 2 { return ErrWrongPath } @@ -73,21 +79,21 @@ func (ip *IPProfile) Set(path []string, val any, newBranch bool) error { default: return ErrWrongPath case Tenant: - ip.Tenant = IfaceAsString(val) + p.Tenant = IfaceAsString(val) case ID: - ip.ID = IfaceAsString(val) + p.ID = IfaceAsString(val) case FilterIDs: var valA []string valA, err = IfaceAsStringSlice(val) - ip.FilterIDs = append(ip.FilterIDs, valA...) + p.FilterIDs = append(p.FilterIDs, valA...) case Weights: if val != "" { - ip.Weights, err = NewDynamicWeightsFromString(IfaceAsString(val), InfieldSep, ANDSep) + p.Weights, err = NewDynamicWeightsFromString(IfaceAsString(val), InfieldSep, ANDSep) } case TTL: - ip.TTL, err = IfaceAsDuration(val) + p.TTL, err = IfaceAsDuration(val) case Stored: - ip.Stored, err = IfaceAsBool(val) + p.Stored, err = IfaceAsBool(val) case Pools: if len(path) != 2 { return ErrWrongPath @@ -95,53 +101,53 @@ func (ip *IPProfile) Set(path []string, val any, newBranch bool) error { if val == EmptyString { return nil } - if len(ip.Pools) == 0 || newBranch { - ip.Pools = append(ip.Pools, new(Pool)) + if len(p.Pools) == 0 || newBranch { + p.Pools = append(p.Pools, new(Pool)) } - pool := ip.Pools[len(ip.Pools)-1] + pool := p.Pools[len(p.Pools)-1] return pool.Set(path[1:], val, newBranch) } return err } -func (ip *IPProfile) Merge(other any) { +func (p *IPProfile) Merge(other any) { o := other.(*IPProfile) if len(o.Tenant) != 0 { - ip.Tenant = o.Tenant + p.Tenant = o.Tenant } if len(o.ID) != 0 { - ip.ID = o.ID + p.ID = o.ID } - ip.FilterIDs = append(ip.FilterIDs, o.FilterIDs...) - ip.Weights = append(ip.Weights, o.Weights...) + p.FilterIDs = append(p.FilterIDs, o.FilterIDs...) + p.Weights = append(p.Weights, o.Weights...) if o.TTL != 0 { - ip.TTL = o.TTL + p.TTL = o.TTL } if o.Stored { - ip.Stored = o.Stored + p.Stored = o.Stored } for _, pool := range o.Pools { - if idx := slices.IndexFunc(ip.Pools, func(p *Pool) bool { + if idx := slices.IndexFunc(p.Pools, func(p *Pool) bool { return p.ID == pool.ID }); idx != -1 { - ip.Pools[idx].Merge(pool) + p.Pools[idx].Merge(pool) continue } - ip.Pools = append(ip.Pools, pool) + p.Pools = append(p.Pools, pool) } } -func (ip *IPProfile) String() string { return ToJSON(ip) } +func (p *IPProfile) String() string { return ToJSON(p) } -func (ip *IPProfile) FieldAsString(fldPath []string) (string, error) { - val, err := ip.FieldAsInterface(fldPath) +func (p *IPProfile) FieldAsString(fldPath []string) (string, error) { + val, err := p.FieldAsInterface(fldPath) if err != nil { return "", err } return IfaceAsString(val), nil } -func (ip *IPProfile) FieldAsInterface(fldPath []string) (any, error) { +func (p *IPProfile) FieldAsInterface(fldPath []string) (any, error) { if len(fldPath) != 1 { return nil, ErrNotFound } @@ -151,44 +157,38 @@ func (ip *IPProfile) FieldAsInterface(fldPath []string) (any, error) { if idx != nil { switch fld { case FilterIDs: - if *idx < len(ip.FilterIDs) { - return ip.FilterIDs[*idx], nil + if *idx < len(p.FilterIDs) { + return p.FilterIDs[*idx], nil } case Pools: - if *idx < len(ip.Pools) { - return ip.Pools[*idx].FieldAsInterface(fldPath[1:]) + if *idx < len(p.Pools) { + return p.Pools[*idx].FieldAsInterface(fldPath[1:]) } } } return nil, ErrNotFound case Tenant: - return ip.Tenant, nil + return p.Tenant, nil case ID: - return ip.ID, nil + return p.ID, nil case FilterIDs: - return ip.FilterIDs, nil + return p.FilterIDs, nil case Weights: - return ip.Weights, nil + return p.Weights, nil case TTL: - return ip.TTL, nil + return p.TTL, nil case Stored: - return ip.Stored, nil + return p.Stored, nil case Pools: - return ip.Pools, nil + return p.Pools, nil } } -// IPProfileLockKey returns the ID used to lock a resourceProfile with guardian +// IPProfileLockKey returns the ID used to lock an IPProfile with guardian func IPProfileLockKey(tnt, id string) string { return ConcatenatedKey(CacheIPProfiles, tnt, id) } -// IPProfileWithAPIOpts wraps IPProfile with APIOpts. -type IPProfileWithAPIOpts struct { - *IPProfile - APIOpts map[string]any -} - type Pool struct { ID string FilterIDs []string @@ -200,7 +200,7 @@ type Pool struct { Blockers DynamicBlockers } -// Clone creates a deep copy of IPProfile for thread-safe use. +// Clone creates a deep copy of Pool for thread-safe use. func (p *Pool) Clone() *Pool { if p == nil { return nil @@ -251,30 +251,30 @@ func (p *Pool) Set(path []string, val any, _ bool) error { return err } -func (p *Pool) Merge(v2 any) { - vi := v2.(*Pool) +func (p *Pool) Merge(other any) { + o := other.(*Pool) // NOTE: Merge gets called when the IDs are equal, so this is a no-op. // Kept for consistency with other components. - if len(vi.ID) != 0 { - p.ID = vi.ID + if len(o.ID) != 0 { + p.ID = o.ID } - p.FilterIDs = append(p.FilterIDs, vi.FilterIDs...) - if vi.Type != "" { - p.Type = vi.Type + p.FilterIDs = append(p.FilterIDs, o.FilterIDs...) + if o.Type != "" { + p.Type = o.Type } - if vi.Range != "" { - p.Range = vi.Range + if o.Range != "" { + p.Range = o.Range } - if vi.Strategy != "" { - p.Strategy = vi.Strategy + if o.Strategy != "" { + p.Strategy = o.Strategy } - if vi.Message != "" { - p.Message = vi.Message + if o.Message != "" { + p.Message = o.Message } - p.Weights = append(p.Weights, vi.Weights...) - p.Blockers = append(p.Blockers, vi.Blockers...) + p.Weights = append(p.Weights, o.Weights...) + p.Blockers = append(p.Blockers, o.Blockers...) } func (p *Pool) String() string { return ToJSON(p) } @@ -325,7 +325,7 @@ func (p *Pool) FieldAsInterface(fldPath []string) (any, error) { } } -// IPUsage represents an usage counted. +// IPUsage represents a usage count. type IPUsage struct { Tenant string ID string @@ -338,12 +338,12 @@ func (u *IPUsage) TenantID() string { return ConcatenatedKey(u.Tenant, u.ID) } -// isActive checks ExpiryTime at some time +// IsActive checks ExpiryTime at some time func (u *IPUsage) IsActive(atTime time.Time) bool { return u.ExpiryTime.IsZero() || u.ExpiryTime.Sub(atTime) > 0 } -// Clone duplicates ru +// Clone duplicates the IPUsage func (u *IPUsage) Clone() *IPUsage { if u == nil { return nil @@ -352,60 +352,60 @@ func (u *IPUsage) Clone() *IPUsage { return &clone } -// IP represents ... -type IP struct { +// IPAllocations represents IP allocations with usage tracking and TTL management. +type IPAllocations struct { Tenant string ID string Usages map[string]*IPUsage TTLIdx []string } -// Clone clones *IP (lkID excluded) -func (ip *IP) Clone() *IP { - if ip == nil { +// IPAllocationsWithAPIOpts wraps IPAllocations with APIOpts. +type IPAllocationsWithAPIOpts struct { + *IPAllocations + APIOpts map[string]any +} + +// Clone clones IPAllocations object (lkID excluded) +func (a *IPAllocations) Clone() *IPAllocations { + if a == nil { return nil } - clone := &IP{ - Tenant: ip.Tenant, - ID: ip.ID, - TTLIdx: slices.Clone(ip.TTLIdx), + clone := &IPAllocations{ + Tenant: a.Tenant, + ID: a.ID, + TTLIdx: slices.Clone(a.TTLIdx), } - if ip.Usages != nil { - clone.Usages = make(map[string]*IPUsage, len(ip.Usages)) - for key, usage := range ip.Usages { + if a.Usages != nil { + clone.Usages = make(map[string]*IPUsage, len(a.Usages)) + for key, usage := range a.Usages { clone.Usages[key] = usage.Clone() } } return clone } -// CacheClone returns a clone of IP used by ltcache CacheCloner -func (ip *IP) CacheClone() any { - return ip.Clone() -} - -// IPWithAPIOpts wraps IP with APIOpts. -type IPWithAPIOpts struct { - *IP - APIOpts map[string]any +// CacheClone returns a clone of IPAllocations object used by ltcache CacheCloner. +func (a *IPAllocations) CacheClone() any { + return a.Clone() } // TenantID returns the unique ID in a multi-tenant environment -func (ip *IP) TenantID() string { - return ConcatenatedKey(ip.Tenant, ip.ID) +func (a *IPAllocations) TenantID() string { + return ConcatenatedKey(a.Tenant, a.ID) } // TotalUsage returns the sum of all usage units // Exported to be used in FilterS -func (ip *IP) TotalUsage() float64 { +func (a *IPAllocations) TotalUsage() float64 { var tu float64 - for _, ru := range ip.Usages { + for _, ru := range a.Usages { tu += ru.Units } return tu } -// IPLockKey returns the ID used to lock a resource with guardian -func IPLockKey(tnt, id string) string { - return ConcatenatedKey(CacheIPs, tnt, id) +// IPAllocationsLockKey returns the ID used to lock IP allocations with guardian +func IPAllocationsLockKey(tnt, id string) string { + return ConcatenatedKey(CacheIPAllocations, tnt, id) }