diff --git a/cmd/cgr-loader/cgr-loader.go b/cmd/cgr-loader/cgr-loader.go index d6681708e..d73f50bbc 100644 --- a/cmd/cgr-loader/cgr-loader.go +++ b/cmd/cgr-loader/cgr-loader.go @@ -156,7 +156,9 @@ func main() { path.Join(*dataPath, utils.ACCOUNT_ACTIONS_CSV), path.Join(*dataPath, utils.DERIVED_CHARGERS_CSV), path.Join(*dataPath, utils.CDR_STATS_CSV), - path.Join(*dataPath, utils.USERS_CSV)) + path.Join(*dataPath, utils.USERS_CSV), + path.Join(*dataPath, utils.ALIASES_CSV), + ) } tpReader := engine.NewTpReader(ratingDb, accountDb, loader, *tpid) err = tpReader.LoadAll() @@ -236,8 +238,7 @@ func main() { rpfIds, _ := tpReader.GetLoadedIds(utils.RATING_PROFILE_PREFIX) actIds, _ := tpReader.GetLoadedIds(utils.ACTION_PREFIX) shgIds, _ := tpReader.GetLoadedIds(utils.SHARED_GROUP_PREFIX) - rpAliases, _ := tpReader.GetLoadedIds(utils.RP_ALIAS_PREFIX) - accAliases, _ := tpReader.GetLoadedIds(utils.ACC_ALIAS_PREFIX) + aliases, _ := tpReader.GetLoadedIds(utils.ALIASES_PREFIX) lcrIds, _ := tpReader.GetLoadedIds(utils.LCR_PREFIX) dcs, _ := tpReader.GetLoadedIds(utils.DERIVEDCHARGERS_PREFIX) // Reload cache first since actions could be calling info from within @@ -245,7 +246,7 @@ func main() { log.Print("Reloading cache") } if *flush { - dstIds, rplIds, rpfIds, rpAliases, lcrIds = nil, nil, nil, nil, nil // Should reload all these on flush + dstIds, rplIds, rpfIds, lcrIds = nil, nil, nil, nil // Should reload all these on flush } if err = rater.Call("ApierV1.ReloadCache", utils.ApiReloadCache{ DestinationIds: dstIds, @@ -253,8 +254,7 @@ func main() { RatingProfileIds: rpfIds, ActionIds: actIds, SharedGroupIds: shgIds, - RpAliases: rpAliases, - AccAliases: accAliases, + Aliases: aliases, LCRIds: lcrIds, DerivedChargers: dcs, }, &reply); err != nil { diff --git a/cmd/cgr-tester/cgr-tester.go b/cmd/cgr-tester/cgr-tester.go index 8e03417c1..1fbdc9c66 100644 --- a/cmd/cgr-tester/cgr-tester.go +++ b/cmd/cgr-tester/cgr-tester.go @@ -77,9 +77,12 @@ func durInternalRater(cd *engine.CallDescriptor) (time.Duration, error) { } defer accountDb.Close() engine.SetAccountingStorage(accountDb) - if err := ratingDb.CacheAll(); err != nil { + if err := ratingDb.CacheRatingAll(); err != nil { return nilDuration, fmt.Errorf("Cache rating error: %s", err.Error()) } + if err := accountDb.CacheAccountingAll(); err != nil { + return nilDuration, fmt.Errorf("Cache accounting error: %s", err.Error()) + } log.Printf("Runnning %d cycles...", *runs) var result *engine.CallCost j := 0 diff --git a/engine/models.go b/engine/models.go index 03f7f2551..483a785a3 100644 --- a/engine/models.go +++ b/engine/models.go @@ -351,6 +351,10 @@ type TpAlias struct { Weight float64 `index:"8" re:""` } +func (ta *TpAlias) TableName() string { + return "tp_aliases" +} + func (ta *TpAlias) GetId() string { return utils.ConcatenatedKey(ta.Direction, ta.Tenant, ta.Category, ta.Account, ta.Subject, ta.Group) } diff --git a/engine/storage_interface.go b/engine/storage_interface.go index 11ef3f65e..c043271ef 100644 --- a/engine/storage_interface.go +++ b/engine/storage_interface.go @@ -142,7 +142,7 @@ type LoadWriter interface { SetTpSharedGroups([]TpSharedGroup) error SetTpCdrStats([]TpCdrstat) error SetTpUsers([]TpUser) error - SetTpAlias([]TpAlias) error + SetTpAliases([]TpAlias) error SetTpDerivedChargers([]TpDerivedCharger) error SetTpLCRs([]TpLcrRule) error SetTpActions([]TpAction) error