diff --git a/actions/accounts.go b/actions/accounts.go
index 20ec11566..cf0b70bb8 100644
--- a/actions/accounts.go
+++ b/actions/accounts.go
@@ -20,7 +20,6 @@ package actions
import (
"context"
- "fmt"
"github.com/cgrates/cgrates/config"
"github.com/cgrates/cgrates/engine"
@@ -46,35 +45,7 @@ func (aL *actSetBalance) cfg() *engine.APAction {
// execute implements actioner interface
func (aL *actSetBalance) execute(ctx context.Context, data utils.MapStorage, trgID string) (err error) {
- if len(aL.config.ActionSCfg().AccountSConns) == 0 {
- return fmt.Errorf("no connection with AccountS")
- }
-
- args := &utils.ArgsActSetBalance{
- Tenant: aL.tnt,
- AccountID: trgID,
- Reset: aL.reset,
- Diktats: make([]*utils.BalDiktat, len(aL.cfg().Diktats)),
- APIOpts: aL.cfg().Opts,
- }
- for i, actD := range aL.cfg().Diktats {
- var val string
- var rsr config.RSRParsers
- if rsr, err = actD.RSRValues(aL.config.GeneralCfg().RSRSep); err != nil {
- return
- }
- if val, err = rsr.ParseDataProvider(data); err != nil {
- return
- }
-
- args.Diktats[i] = &utils.BalDiktat{
- Path: actD.Path,
- Value: val,
- }
- }
- var rply string
- return aL.connMgr.Call(aL.config.ActionSCfg().AccountSConns, nil,
- utils.AccountSv1ActionSetBalance, args, &rply)
+ return
}
// actRemBalance will remove multiple balances from account
@@ -95,20 +66,5 @@ func (aL *actRemBalance) cfg() *engine.APAction {
// execute implements actioner interface
func (aL *actRemBalance) execute(ctx context.Context, data utils.MapStorage, trgID string) (err error) {
- if len(aL.config.ActionSCfg().AccountSConns) == 0 {
- return fmt.Errorf("no connection with AccountS")
- }
-
- args := &utils.ArgsActRemoveBalances{
- Tenant: aL.tnt,
- AccountID: trgID,
- BalanceIDs: make([]string, len(aL.cfg().Diktats)),
- APIOpts: aL.cfg().Opts,
- }
- for i, actD := range aL.cfg().Diktats {
- args.BalanceIDs[i] = actD.Path
- }
- var rply string
- return aL.connMgr.Call(aL.config.ActionSCfg().AccountSConns, nil,
- utils.AccountSv1ActionRemoveBalance, args, &rply)
+ return
}
diff --git a/apier/v1/accountprofiles.go b/apier/v1/accountprofiles.go
deleted file mode 100644
index a6c4600e7..000000000
--- a/apier/v1/accountprofiles.go
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
-Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments
-Copyright (C) ITsysCOM GmbH
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see
-*/
-
-package v1
-
-import (
- "time"
-
- "github.com/cgrates/cgrates/utils"
-)
-
-// GetAccountProfile returns an Account Profile
-func (apierSv1 *APIerSv1) GetAccountProfile(arg *utils.TenantIDWithAPIOpts, reply *utils.AccountProfile) error {
- if missing := utils.MissingStructFields(arg, []string{utils.ID}); len(missing) != 0 { //Params missing
- return utils.NewErrMandatoryIeMissing(missing...)
- }
- tnt := arg.Tenant
- if tnt == utils.EmptyString {
- tnt = apierSv1.Config.GeneralCfg().DefaultTenant
- }
- ap, err := apierSv1.DataManager.GetAccountProfile(tnt, arg.ID)
- if err != nil {
- if err.Error() != utils.ErrNotFound.Error() {
- err = utils.NewErrServerError(err)
- }
- return err
- }
- *reply = *ap
- return nil
-}
-
-// GetAccountProfileIDs returns list of action profile IDs registered for a tenant
-func (apierSv1 *APIerSv1) GetAccountProfileIDs(args *utils.PaginatorWithTenant, actPrfIDs *[]string) error {
- tnt := args.Tenant
- if tnt == utils.EmptyString {
- tnt = apierSv1.Config.GeneralCfg().DefaultTenant
- }
- prfx := utils.AccountProfilePrefix + tnt + utils.ConcatenatedKeySep
- keys, err := apierSv1.DataManager.DataDB().GetKeysForPrefix(prfx)
- if err != nil {
- return err
- }
- if len(keys) == 0 {
- return utils.ErrNotFound
- }
- retIDs := make([]string, len(keys))
- for i, key := range keys {
- retIDs[i] = key[len(prfx):]
- }
- *actPrfIDs = args.PaginateStringSlice(retIDs)
- return nil
-}
-
-// GetAccountProfileIDsCount sets in reply var the total number of AccountProfileIDs registered for a tenant
-// returns ErrNotFound in case of 0 AccountProfileIDs
-func (apierSv1 *APIerSv1) GetAccountProfileIDsCount(args *utils.TenantWithAPIOpts, reply *int) (err error) {
- tnt := args.Tenant
- if tnt == utils.EmptyString {
- tnt = apierSv1.Config.GeneralCfg().DefaultTenant
- }
- var keys []string
- prfx := utils.AccountProfilePrefix + tnt + utils.ConcatenatedKeySep
- if keys, err = apierSv1.DataManager.DataDB().GetKeysForPrefix(prfx); err != nil {
- return err
- }
- if len(keys) == 0 {
- return utils.ErrNotFound
- }
- *reply = len(keys)
- return
-}
-
-//SetAccountProfile add/update a new Account Profile
-func (apierSv1 *APIerSv1) SetAccountProfile(extAp *utils.APIAccountProfileWithOpts, reply *string) error {
- if missing := utils.MissingStructFields(extAp.APIAccountProfile, []string{utils.ID}); len(missing) != 0 {
- return utils.NewErrMandatoryIeMissing(missing...)
- }
- if extAp.Tenant == utils.EmptyString {
- extAp.Tenant = apierSv1.Config.GeneralCfg().DefaultTenant
- }
- ap, err := extAp.AsAccountProfile()
- if err != nil {
- return err
- }
- if err := apierSv1.DataManager.SetAccountProfile(ap, true); err != nil {
- return utils.APIErrorHandler(err)
- }
- //generate a loadID for CacheAccountProfiles and store it in database
- if err := apierSv1.DataManager.SetLoadIDs(map[string]int64{utils.CacheAccountProfiles: time.Now().UnixNano()}); err != nil {
- return utils.APIErrorHandler(err)
- }
- *reply = utils.OK
- return nil
-}
-
-// RemoveAccountProfile remove a specific Account Profile
-func (apierSv1 *APIerSv1) RemoveAccountProfile(arg *utils.TenantIDWithAPIOpts, reply *string) error {
- if missing := utils.MissingStructFields(arg, []string{utils.ID}); len(missing) != 0 { //Params missing
- return utils.NewErrMandatoryIeMissing(missing...)
- }
- tnt := arg.Tenant
- if tnt == utils.EmptyString {
- tnt = apierSv1.Config.GeneralCfg().DefaultTenant
- }
- if err := apierSv1.DataManager.RemoveAccountProfile(tnt, arg.ID,
- utils.NonTransactional, true); err != nil {
- return utils.APIErrorHandler(err)
- }
- //generate a loadID for CacheAccountProfiles and store it in database
- if err := apierSv1.DataManager.SetLoadIDs(map[string]int64{utils.CacheAccountProfiles: time.Now().UnixNano()}); err != nil {
- return utils.APIErrorHandler(err)
- }
- *reply = utils.OK
- return nil
-}
diff --git a/apier/v1/accountprofiles_it_test.go b/apier/v1/accountprofiles_it_test.go
deleted file mode 100644
index 39d7145b0..000000000
--- a/apier/v1/accountprofiles_it_test.go
+++ /dev/null
@@ -1,364 +0,0 @@
-// +build integration
-
-/*
-Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments
-Copyright (C) ITsysCOM GmbH
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see
-*/
-
-package v1
-
-import (
- "net/rpc"
- "path"
- "reflect"
- "testing"
- "time"
-
- "github.com/cgrates/cgrates/config"
- "github.com/cgrates/cgrates/engine"
- "github.com/cgrates/cgrates/utils"
- "github.com/ericlagergren/decimal"
-)
-
-var (
- accPrfCfgPath string
- accPrfCfg *config.CGRConfig
- accSRPC *rpc.Client
- apiAccPrf *utils.APIAccountProfileWithOpts
- accPrf *utils.AccountProfile
- accPrfConfigDIR string //run tests for specific configuration
-
- sTestsAccPrf = []func(t *testing.T){
- testAccountSInitCfg,
- testAccountSInitDataDb,
- testAccountSResetStorDb,
- testAccountSStartEngine,
- testAccountSRPCConn,
- testAccountSLoadFromFolder,
- testAccountSGetAccountProfile,
- testAccountSSettAccountProfile,
- testAccountSGetAccountProfileIDs,
- testAccountSGetAccountProfileIDsCount,
- testAccountSUpdateAccountProfile,
- testAccountSRemoveAccountProfile,
- testAccountSKillEngine,
- }
-)
-
-//Test start here
-func TestAccountSIT(t *testing.T) {
- switch *dbType {
- case utils.MetaInternal:
- accPrfConfigDIR = "tutinternal"
- case utils.MetaMySQL:
- accPrfConfigDIR = "tutmysql"
- case utils.MetaMongo:
- accPrfConfigDIR = "tutmongo"
- case utils.MetaPostgres:
- t.SkipNow()
- default:
- t.Fatal("Unknown Database type")
- }
- for _, stest := range sTestsAccPrf {
- t.Run(accPrfConfigDIR, stest)
- }
-}
-
-func testAccountSInitCfg(t *testing.T) {
- var err error
- accPrfCfgPath = path.Join(*dataDir, "conf", "samples", accPrfConfigDIR)
- accPrfCfg, err = config.NewCGRConfigFromPath(accPrfCfgPath)
- if err != nil {
- t.Error(err)
- }
-}
-
-func testAccountSInitDataDb(t *testing.T) {
- if err := engine.InitDataDb(accPrfCfg); err != nil {
- t.Fatal(err)
- }
-}
-
-// Wipe out the cdr database
-func testAccountSResetStorDb(t *testing.T) {
- if err := engine.InitStorDb(accPrfCfg); err != nil {
- t.Fatal(err)
- }
-}
-
-// Start CGR Engine
-func testAccountSStartEngine(t *testing.T) {
- if _, err := engine.StopStartEngine(accPrfCfgPath, *waitRater); err != nil {
- t.Fatal(err)
- }
-}
-
-// Connect rpc client to rater
-func testAccountSRPCConn(t *testing.T) {
- var err error
- accSRPC, err = newRPCClient(accPrfCfg.ListenCfg()) // We connect over JSON so we can also troubleshoot if needed
- if err != nil {
- t.Fatal(err)
- }
-}
-
-func testAccountSLoadFromFolder(t *testing.T) {
- var reply string
- acts := &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "tutaccounts")}
- if err := accSRPC.Call(utils.APIerSv1LoadTariffPlanFromFolder, acts, &reply); err != nil {
- t.Error(err)
- }
- time.Sleep(100 * time.Millisecond)
-}
-
-func testAccountSGetAccountProfile(t *testing.T) {
- eAcnt := &utils.AccountProfile{
- Tenant: "cgrates.org",
- ID: "1001",
- FilterIDs: []string{"*string:~*req.Account:1001"},
- Balances: map[string]*utils.Balance{
- "GenericBalance1": &utils.Balance{
- ID: "GenericBalance1",
- Weights: []*utils.DynamicWeight{
- {
- Weight: 20,
- },
- },
- Type: utils.MetaAbstract,
- Units: &utils.Decimal{decimal.New(int64(time.Hour), 0)},
- UnitFactors: []*utils.UnitFactor{
- &utils.UnitFactor{
- FilterIDs: []string{"*string:~*req.ToR:*data"},
- Factor: &utils.Decimal{decimal.New(1024, 3)},
- },
- },
- CostIncrements: []*utils.CostIncrement{
- &utils.CostIncrement{
- FilterIDs: []string{"*string:~*req.ToR:*voice"},
- Increment: &utils.Decimal{decimal.New(int64(time.Second), 0)},
- FixedFee: &utils.Decimal{decimal.New(0, 0)},
- RecurrentFee: &utils.Decimal{decimal.New(1, 2)},
- },
- &utils.CostIncrement{
- FilterIDs: []string{"*string:~*req.ToR:*data"},
- Increment: &utils.Decimal{decimal.New(1024, 0)},
- FixedFee: &utils.Decimal{decimal.New(0, 0)},
- RecurrentFee: &utils.Decimal{decimal.New(1, 2)},
- },
- },
- },
- "MonetaryBalance1": &utils.Balance{
- ID: "MonetaryBalance1",
- Weights: utils.DynamicWeights{
- {
- Weight: 30,
- },
- },
- Type: utils.MetaConcrete,
- Units: &utils.Decimal{decimal.New(5, 0)},
- CostIncrements: []*utils.CostIncrement{
- &utils.CostIncrement{
- FilterIDs: []string{"*string:~*req.ToR:*voice"},
- Increment: &utils.Decimal{decimal.New(int64(time.Second), 0)},
- FixedFee: &utils.Decimal{decimal.New(0, 0)},
- RecurrentFee: &utils.Decimal{decimal.New(1, 2)},
- },
- &utils.CostIncrement{
- FilterIDs: []string{"*string:~*req.ToR:*data"},
- Increment: &utils.Decimal{decimal.New(1024, 0)},
- FixedFee: &utils.Decimal{decimal.New(0, 0)},
- RecurrentFee: &utils.Decimal{decimal.New(1, 2)},
- },
- },
- },
- "MonetaryBalance2": &utils.Balance{
- ID: "MonetaryBalance2",
- Weights: utils.DynamicWeights{
- {
- Weight: 10,
- },
- },
- Type: utils.MetaConcrete,
- Units: &utils.Decimal{decimal.New(3, 0)},
- CostIncrements: []*utils.CostIncrement{
- &utils.CostIncrement{
- FilterIDs: []string{"*string:~*req.ToR:*voice"},
- Increment: &utils.Decimal{decimal.New(int64(time.Second), 0)},
- FixedFee: &utils.Decimal{decimal.New(0, 0)},
- RecurrentFee: &utils.Decimal{decimal.New(1, 0)},
- },
- },
- },
- },
- ThresholdIDs: []string{utils.MetaNone},
- }
- var reply *utils.AccountProfile
- if err := accSRPC.Call(utils.APIerSv1GetAccountProfile,
- utils.TenantIDWithAPIOpts{TenantID: &utils.TenantID{Tenant: "cgrates.org", ID: "1001"}}, &reply); err != nil {
- t.Fatal(err)
- } else if !reflect.DeepEqual(eAcnt, reply) {
- t.Errorf("Expecting : %+v \n received: %+v", utils.ToJSON(eAcnt), utils.ToJSON(reply))
- }
-}
-
-func testAccountSSettAccountProfile(t *testing.T) {
- apiAccPrf = &utils.APIAccountProfileWithOpts{
- APIAccountProfile: &utils.APIAccountProfile{
- Tenant: "cgrates.org",
- ID: "id_test",
- Weights: ";10",
- Balances: map[string]*utils.APIBalance{
- "MonetaryBalance": &utils.APIBalance{
- ID: "MonetaryBalance",
- Weights: ";10",
- Type: utils.MetaMonetary,
- CostIncrements: []*utils.APICostIncrement{
- {
- FilterIDs: []string{"fltr1", "fltr2"},
- Increment: utils.Float64Pointer(1.3),
- FixedFee: utils.Float64Pointer(2.3),
- RecurrentFee: utils.Float64Pointer(3.3),
- },
- },
- AttributeIDs: []string{"attr1", "attr2"},
- UnitFactors: []*utils.APIUnitFactor{
- {
- FilterIDs: []string{"fltr1", "fltr2"},
- Factor: 100,
- },
- {
- FilterIDs: []string{"fltr3"},
- Factor: 200,
- },
- },
- Units: 14,
- },
- "VoiceBalance": &utils.APIBalance{
- ID: "VoiceBalance",
- Weights: ";10",
- Type: utils.MetaVoice,
- Units: 3600000000000,
- },
- },
- ThresholdIDs: []string{utils.MetaNone},
- },
- }
- var result string
- expErr := utils.ErrNotFound.Error()
- if err := accSRPC.Call(utils.APIerSv1GetAccountProfile, &utils.TenantIDWithAPIOpts{
- TenantID: &utils.TenantID{Tenant: "cgrates.org", ID: "id_test"}}, &result); err == nil || err.Error() != expErr {
- t.Errorf("Expected error: %v received: %v", expErr, err)
- }
- var reply string
- if err := accSRPC.Call(utils.APIerSv1SetAccountProfile, apiAccPrf, &reply); err != nil {
- t.Error(err)
- } else if reply != utils.OK {
- t.Error("Unexpected reply returned", reply)
- }
- var err error
- if accPrf, err = apiAccPrf.AsAccountProfile(); err != nil {
- t.Error(err)
- }
- var reply2 *utils.AccountProfile
- if err := accSRPC.Call(utils.APIerSv1GetAccountProfile, &utils.TenantIDWithAPIOpts{
- TenantID: &utils.TenantID{Tenant: "cgrates.org", ID: "id_test"}}, &reply2); err != nil {
- t.Error(err)
- } else if !reflect.DeepEqual(accPrf, reply2) {
- t.Errorf("Expecting : %+v, received: %+v", accPrf, reply2)
- }
-
-}
-
-func testAccountSGetAccountProfileIDs(t *testing.T) {
- expected := []string{"id_test", "1001", "1002"}
- var result []string
- if err := accSRPC.Call(utils.APIerSv1GetAccountProfileIDs, utils.PaginatorWithTenant{}, &result); err != nil {
- t.Error(err)
- } else if len(expected) != len(result) {
- t.Errorf("Expecting : %+v, received: %+v", expected, result)
- }
- if err := accSRPC.Call(utils.APIerSv1GetAccountProfileIDs, utils.PaginatorWithTenant{Tenant: "cgrates.org"}, &result); err != nil {
- t.Error(err)
- } else if len(expected) != len(result) {
- t.Errorf("Expecting : %+v, received: %+v", expected, result)
- }
- if err := accSRPC.Call(utils.APIerSv1GetAccountProfileIDs, utils.PaginatorWithTenant{
- Tenant: "cgrates.org",
- Paginator: utils.Paginator{Limit: utils.IntPointer(1)},
- }, &result); err != nil {
- t.Error(err)
- } else if 1 != len(result) {
- t.Errorf("Expecting : %+v, received: %+v", 1, result)
- }
-
-}
-
-func testAccountSGetAccountProfileIDsCount(t *testing.T) {
- var reply int
- if err := accSRPC.Call(utils.APIerSv1GetAccountProfileIDsCount,
- &utils.TenantWithAPIOpts{Tenant: "cgrates.org"}, &reply); err != nil {
- t.Error(err)
- } else if reply != 3 {
- t.Errorf("Expecting: 3, received: %+v", reply)
- }
-
-}
-
-func testAccountSUpdateAccountProfile(t *testing.T) {
- var reply string
- apiAccPrf.Weights = ";2"
- apiAccPrf.Balances["MonetaryBalance"].CostIncrements[0].FixedFee = utils.Float64Pointer(123.5)
- if err := accSRPC.Call(utils.APIerSv1SetAccountProfile, apiAccPrf, &reply); err != nil {
- t.Error(err)
- } else if reply != utils.OK {
- t.Error("Unexpected reply returned", reply)
- }
- var err error
- if accPrf, err = apiAccPrf.AsAccountProfile(); err != nil {
- t.Error(err)
- }
- var reply2 *utils.AccountProfile
- if err := accSRPC.Call(utils.APIerSv1GetAccountProfile, &utils.TenantIDWithAPIOpts{
- TenantID: &utils.TenantID{Tenant: "cgrates.org", ID: "id_test"}}, &reply2); err != nil {
- t.Error(err)
- } else if !reflect.DeepEqual(accPrf, reply2) {
- t.Errorf("Expecting : %+v, received: %+v", accPrf, reply2)
- }
-}
-
-func testAccountSRemoveAccountProfile(t *testing.T) {
- var reply string
- if err := accSRPC.Call(utils.APIerSv1RemoveAccountProfile, &utils.TenantIDWithAPIOpts{TenantID: &utils.TenantID{Tenant: "cgrates.org", ID: "id_test"}}, &reply); err != nil {
- t.Error(err)
- } else if reply != utils.OK {
- t.Error("Unexpected reply returned", reply)
- }
- var reply2 *utils.AccountProfile
- expErr := utils.ErrNotFound.Error()
- if err := accSRPC.Call(utils.APIerSv1GetAccountProfile, &utils.TenantIDWithAPIOpts{
- TenantID: &utils.TenantID{Tenant: "cgrates.org", ID: "id_test"}}, &reply2); err == nil || err.Error() != expErr {
- t.Errorf("Expected error: %v received: %v", expErr, err)
- }
- if err := accSRPC.Call(utils.APIerSv1RemoveAccountProfile, &utils.TenantIDWithAPIOpts{TenantID: &utils.TenantID{Tenant: "cgrates.org", ID: "id_test"}}, &reply2); err == nil || err.Error() != expErr {
- t.Errorf("Expected error: %v received: %v", expErr, err)
- }
-}
-
-func testAccountSKillEngine(t *testing.T) {
- if err := engine.KillEngine(100); err != nil {
- t.Error(err)
- }
-}
diff --git a/apier/v1/api_interfaces.go b/apier/v1/api_interfaces.go
index 4dd1427d6..e296aed44 100644
--- a/apier/v1/api_interfaces.go
+++ b/apier/v1/api_interfaces.go
@@ -272,10 +272,6 @@ type ReplicatorSv1Interface interface {
SetIndexes(args *utils.SetIndexesArg, reply *string) error
RemoveIndexes(args *utils.GetIndexesArg, reply *string) error
- GetAccountProfile(tntID *utils.TenantIDWithAPIOpts, reply *utils.AccountProfile) error
- SetAccountProfile(args *utils.AccountProfileWithAPIOpts, reply *string) error
- RemoveAccountProfile(args *utils.TenantIDWithAPIOpts, reply *string) error
-
GetActionProfile(tntID *utils.TenantIDWithAPIOpts, reply *engine.ActionProfile) error
SetActionProfile(args *engine.ActionProfileWithAPIOpts, reply *string) error
RemoveActionProfile(args *utils.TenantIDWithAPIOpts, reply *string) error
@@ -286,14 +282,3 @@ type ActionSv1Interface interface {
ExecuteActions(args *utils.ArgActionSv1ScheduleActions, rpl *string) error
Ping(ign *utils.CGREvent, reply *string) error
}
-
-type AccountSv1Interface interface {
- Ping(ign *utils.CGREvent, reply *string) error
- AccountProfilesForEvent(args *utils.ArgsAccountsForEvent, aps *[]*utils.AccountProfile) error
- MaxAbstracts(args *utils.ArgsAccountsForEvent, eEc *utils.ExtEventCharges) error
- DebitAbstracts(args *utils.ArgsAccountsForEvent, eEc *utils.ExtEventCharges) error
- ActionSetBalance(args *utils.ArgsActSetBalance, eEc *string) (err error)
- MaxConcretes(args *utils.ArgsAccountsForEvent, eEc *utils.ExtEventCharges) (err error)
- DebitConcretes(args *utils.ArgsAccountsForEvent, eEc *utils.ExtEventCharges) (err error)
- ActionRemoveBalance(args *utils.ArgsActRemoveBalances, eEc *string) (err error)
-}
diff --git a/apier/v1/apier.go b/apier/v1/apier.go
index 1ed9e1f8f..d3472224c 100644
--- a/apier/v1/apier.go
+++ b/apier/v1/apier.go
@@ -1537,7 +1537,7 @@ func (apierSv1 *APIerSv1) ExportToFolder(arg *utils.ArgExportToFolder, reply *st
if len(arg.Items) == 0 {
arg.Items = []string{utils.MetaAttributes, utils.MetaChargers, utils.MetaDispatchers,
utils.MetaDispatcherHosts, utils.MetaFilters, utils.MetaResources, utils.MetaStats,
- utils.MetaRoutes, utils.MetaThresholds, utils.MetaRateProfiles, utils.MetaActionProfiles, utils.MetaAccountProfiles}
+ utils.MetaRoutes, utils.MetaThresholds, utils.MetaRateProfiles, utils.MetaActionProfiles}
}
if _, err := os.Stat(arg.Path); os.IsNotExist(err) {
os.Mkdir(arg.Path, os.ModeDir)
@@ -1959,42 +1959,7 @@ func (apierSv1 *APIerSv1) ExportToFolder(arg *utils.ArgExportToFolder, reply *st
}
}
csvWriter.Flush()
- case utils.MetaAccountProfiles:
- prfx := utils.AccountProfilePrefix
- keys, err := apierSv1.DataManager.DataDB().GetKeysForPrefix(prfx)
- if err != nil {
- return err
- }
- if len(keys) == 0 {
- continue
- }
- f, err := os.Create(path.Join(arg.Path, utils.AccountProfilesCsv))
- if err != nil {
- return err
- }
- defer f.Close()
- csvWriter := csv.NewWriter(f)
- csvWriter.Comma = utils.CSVSep
- //write the header of the file
- if err := csvWriter.Write(engine.AccountProfileMdls{}.CSVHeader()); err != nil {
- return err
- }
- for _, key := range keys {
- tntID := strings.SplitN(key[len(prfx):], utils.InInFieldSep, 2)
- accPrf, err := apierSv1.DataManager.GetAccountProfile(tntID[0], tntID[1])
- if err != nil {
- return err
- }
- for _, model := range engine.APItoModelTPAccountProfile(engine.AccountProfileToAPI(accPrf)) {
- if record, err := engine.CsvDump(model); err != nil {
- return err
- } else if err := csvWriter.Write(record); err != nil {
- return err
- }
- }
- }
- csvWriter.Flush()
}
}
*reply = utils.OK
diff --git a/apier/v1/dispatcher.go b/apier/v1/dispatcher.go
index 1696c8eb1..f0d8290c9 100755
--- a/apier/v1/dispatcher.go
+++ b/apier/v1/dispatcher.go
@@ -1291,21 +1291,6 @@ func (dS *DispatcherReplicatorSv1) RemoveIndexes(args *utils.GetIndexesArg, repl
return dS.dS.ReplicatorSv1RemoveIndexes(args, reply)
}
-// GetAccountProfile .
-func (dS *DispatcherReplicatorSv1) GetAccountProfile(tntID *utils.TenantIDWithAPIOpts, reply *utils.AccountProfile) error {
- return dS.dS.ReplicatorSv1GetAccountProfile(tntID, reply)
-}
-
-// SetAccountProfile .
-func (dS *DispatcherReplicatorSv1) SetAccountProfile(args *utils.AccountProfileWithAPIOpts, reply *string) error {
- return dS.dS.ReplicatorSv1SetAccountProfile(args, reply)
-}
-
-// RemoveAccountProfile .
-func (dS *DispatcherReplicatorSv1) RemoveAccountProfile(args *utils.TenantIDWithAPIOpts, reply *string) error {
- return dS.dS.ReplicatorSv1RemoveAccountProfile(args, reply)
-}
-
// GetActionProfile .
func (dS *DispatcherReplicatorSv1) GetActionProfile(tntID *utils.TenantIDWithAPIOpts, reply *engine.ActionProfile) error {
return dS.dS.ReplicatorSv1GetActionProfile(tntID, reply)
@@ -1368,36 +1353,3 @@ func NewDispatcherAccountSv1(dps *dispatchers.DispatcherService) *DispatcherAcco
type DispatcherAccountSv1 struct {
dR *dispatchers.DispatcherService
}
-
-// Ping implements AccountSv1Ping
-func (dR *DispatcherAccountSv1) Ping(args *utils.CGREvent, reply *string) error {
- return dR.dR.AccountSv1Ping(args, reply)
-}
-
-func (dR *DispatcherAccountSv1) AccountProfilesForEvent(args *utils.ArgsAccountsForEvent, aps *[]*utils.AccountProfile) error {
- return dR.dR.AccountProfilesForEvent(args, aps)
-}
-
-func (dR *DispatcherAccountSv1) MaxAbstracts(args *utils.ArgsAccountsForEvent, eEc *utils.ExtEventCharges) error {
- return dR.dR.MaxAbstracts(args, eEc)
-}
-
-func (dR *DispatcherAccountSv1) DebitAbstracts(args *utils.ArgsAccountsForEvent, eEc *utils.ExtEventCharges) error {
- return dR.dR.DebitAbstracts(args, eEc)
-}
-
-func (dR *DispatcherAccountSv1) MaxConcretes(args *utils.ArgsAccountsForEvent, eEc *utils.ExtEventCharges) error {
- return dR.dR.MaxConcretes(args, eEc)
-}
-
-func (dR *DispatcherAccountSv1) DebitConcretes(args *utils.ArgsAccountsForEvent, eEc *utils.ExtEventCharges) error {
- return dR.dR.DebitConcretes(args, eEc)
-}
-
-func (dR *DispatcherAccountSv1) ActionSetBalance(args *utils.ArgsActSetBalance, eEc *string) (err error) {
- return dR.dR.AccountSv1ActionSetBalance(args, eEc)
-}
-
-func (dR *DispatcherAccountSv1) ActionRemoveBalance(args *utils.ArgsActRemoveBalances, eEc *string) (err error) {
- return dR.dR.AccountSv1ActionRemoveBalance(args, eEc)
-}
diff --git a/apier/v1/filter_indexes.go b/apier/v1/filter_indexes.go
index 9575696f0..711da7443 100644
--- a/apier/v1/filter_indexes.go
+++ b/apier/v1/filter_indexes.go
@@ -61,8 +61,6 @@ func (apierSv1 *APIerSv1) RemoveFilterIndexes(arg *AttrRemFilterIndexes, reply *
arg.ItemType = utils.CacheResourceFilterIndexes
case utils.MetaChargers:
arg.ItemType = utils.CacheChargerFilterIndexes
- case utils.MetaAccountProfiles:
- arg.ItemType = utils.CacheAccountProfilesFilterIndexes
case utils.MetaActionProfiles:
arg.ItemType = utils.CacheActionProfilesFilterIndexes
case utils.MetaRateProfiles:
@@ -116,8 +114,6 @@ func (apierSv1 *APIerSv1) GetFilterIndexes(arg *AttrGetFilterIndexes, reply *[]s
arg.ItemType = utils.CacheResourceFilterIndexes
case utils.MetaChargers:
arg.ItemType = utils.CacheChargerFilterIndexes
- case utils.MetaAccountProfiles:
- arg.ItemType = utils.CacheAccountProfilesFilterIndexes
case utils.MetaActionProfiles:
arg.ItemType = utils.CacheActionProfilesFilterIndexes
case utils.MetaRateProfiles:
@@ -326,23 +322,6 @@ func (apierSv1 *APIerSv1) ComputeFilterIndexes(args *utils.ArgsComputeFilterInde
return utils.APIErrorHandler(err)
}
}
- //AccountProfile Indexes
- if args.AccountS {
- if args.AccountS, err = engine.ComputeIndexes(apierSv1.DataManager, tnt, args.Context, utils.CacheAccountProfilesFilterIndexes,
- nil, transactionID, func(tnt, id, ctx string) (*[]string, error) {
- acp, e := apierSv1.DataManager.GetAccountProfile(tnt, id)
- if e != nil {
- return nil, e
- }
- fltrIDs := make([]string, len(acp.FilterIDs))
- for i, fltrID := range acp.FilterIDs {
- fltrIDs[i] = fltrID
- }
- return &fltrIDs, nil
- }); err != nil && err != utils.ErrNotFound {
- return utils.APIErrorHandler(err)
- }
- }
//ActionProfile Indexes
if args.ActionS {
if args.ActionS, err = engine.ComputeIndexes(apierSv1.DataManager, tnt, args.Context, utils.CacheActionProfilesFilterIndexes,
@@ -465,12 +444,6 @@ func (apierSv1 *APIerSv1) ComputeFilterIndexes(args *utils.ArgsComputeFilterInde
return
}
}
- //AccountProfile Indexes
- if args.AccountS {
- if err = apierSv1.DataManager.SetIndexes(utils.CacheAccountProfilesFilterIndexes, tnt, nil, true, transactionID); err != nil {
- return
- }
- }
//ActionProfile Indexes
if args.ActionS {
if err = apierSv1.DataManager.SetIndexes(utils.CacheActionProfilesFilterIndexes, tnt, nil, true, transactionID); err != nil {
@@ -577,21 +550,6 @@ func (apierSv1 *APIerSv1) ComputeFilterIndexIDs(args *utils.ArgsComputeFilterInd
}); err != nil && err != utils.ErrNotFound {
return utils.APIErrorHandler(err)
}
- //AccountProfile Indexes
- if _, err = engine.ComputeIndexes(apierSv1.DataManager, tnt, args.Context, utils.CacheAccountProfilesFilterIndexes,
- &args.AccountProfileIDs, transactionID, func(tnt, id, ctx string) (*[]string, error) {
- acp, e := apierSv1.DataManager.GetAccountProfile(tnt, id)
- if e != nil {
- return nil, e
- }
- fltrIDs := make([]string, len(acp.FilterIDs))
- for i, fltrID := range acp.FilterIDs {
- fltrIDs[i] = fltrID
- }
- return &fltrIDs, nil
- }); err != nil && err != utils.ErrNotFound {
- return utils.APIErrorHandler(err)
- }
//ActionProfile Indexes
if _, err = engine.ComputeIndexes(apierSv1.DataManager, tnt, args.Context, utils.CacheActionProfilesFilterIndexes,
&args.ActionProfileIDs, transactionID, func(tnt, id, ctx string) (*[]string, error) {
diff --git a/apier/v1/replicator.go b/apier/v1/replicator.go
index f27247288..b252a4882 100644
--- a/apier/v1/replicator.go
+++ b/apier/v1/replicator.go
@@ -332,17 +332,6 @@ func (rplSv1 *ReplicatorSv1) GetActionProfile(tntID *utils.TenantIDWithAPIOpts,
return nil
}
-// GetAccountProfile is the remote method coresponding to the dataDb driver method
-func (rplSv1 *ReplicatorSv1) GetAccountProfile(tntID *utils.TenantIDWithAPIOpts, reply *utils.AccountProfile) error {
- engine.UpdateReplicationFilters(utils.AccountProfilePrefix, tntID.TenantID.TenantID(), utils.IfaceAsString(tntID.APIOpts[utils.RemoteHostOpt]))
- rcv, err := rplSv1.dm.DataDB().GetAccountProfileDrv(tntID.Tenant, tntID.ID)
- if err != nil {
- return err
- }
- *reply = *rcv
- return nil
-}
-
// GetItemLoadIDs is the remote method coresponding to the dataDb driver method
func (rplSv1 *ReplicatorSv1) GetItemLoadIDs(itemID *utils.StringWithAPIOpts, reply *map[string]int64) error {
engine.UpdateReplicationFilters(utils.LoadIDPrefix, itemID.Arg, utils.IfaceAsString(itemID.APIOpts[utils.RemoteHostOpt]))
@@ -687,19 +676,6 @@ func (rplSv1 *ReplicatorSv1) SetActionProfile(acp *engine.ActionProfileWithAPIOp
return
}
-// SetAccountProfile is the replication method coresponding to the dataDb driver method
-func (rplSv1 *ReplicatorSv1) SetAccountProfile(acp *utils.AccountProfileWithAPIOpts, reply *string) (err error) {
- if err = rplSv1.dm.DataDB().SetAccountProfileDrv(acp.AccountProfile); err != nil {
- return
- }
- if err = rplSv1.v1.CallCache(utils.IfaceAsString(acp.APIOpts[utils.CacheOpt]),
- acp.Tenant, utils.CacheAccountProfiles, acp.TenantID(), &acp.FilterIDs, nil, acp.APIOpts); err != nil {
- return
- }
- *reply = utils.OK
- return
-}
-
// SetLoadIDs is the replication method coresponding to the dataDb driver method
func (rplSv1 *ReplicatorSv1) SetLoadIDs(args *utils.LoadIDsWithAPIOpts, reply *string) (err error) {
if err = rplSv1.dm.DataDB().SetLoadIDsDrv(args.LoadIDs); err != nil {
@@ -1030,19 +1006,6 @@ func (rplSv1 *ReplicatorSv1) RemoveActionProfile(args *utils.TenantIDWithAPIOpts
return
}
-// RemoveAccountProfile is the replication method coresponding to the dataDb driver method
-func (rplSv1 *ReplicatorSv1) RemoveAccountProfile(args *utils.TenantIDWithAPIOpts, reply *string) (err error) {
- if err = rplSv1.dm.DataDB().RemoveAccountProfileDrv(args.Tenant, args.ID); err != nil {
- return
- }
- if err = rplSv1.v1.CallCache(utils.IfaceAsString(args.APIOpts[utils.CacheOpt]),
- args.Tenant, utils.CacheAccountProfiles, args.TenantID.TenantID(), nil, nil, args.APIOpts); err != nil {
- return
- }
- *reply = utils.OK
- return
-}
-
// RemoveDispatcherHost is the replication method coresponding to the dataDb driver method
func (rplSv1 *ReplicatorSv1) RemoveDispatcherHost(args *utils.TenantIDWithAPIOpts, reply *string) (err error) {
if err = rplSv1.dm.DataDB().RemoveDispatcherHostDrv(args.Tenant, args.ID); err != nil {
diff --git a/apier/v1/tpaccountprofiles.go b/apier/v1/tpaccountprofiles.go
deleted file mode 100644
index b9d487843..000000000
--- a/apier/v1/tpaccountprofiles.go
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
-Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments
-Copyright (C) ITsysCOM GmbH
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see
-*/
-
-package v1
-
-import (
- "github.com/cgrates/cgrates/utils"
-)
-
-// SetTPAccountProfile creates a new TPAccountProfile within a tariff plan
-func (apierSv1 *APIerSv1) SetTPAccountProfile(attrs *utils.TPAccountProfile, reply *string) error {
- if missing := utils.MissingStructFields(attrs, []string{utils.TPid, utils.ID}); len(missing) != 0 {
- return utils.NewErrMandatoryIeMissing(missing...)
- }
- if attrs.Tenant == utils.EmptyString {
- attrs.Tenant = apierSv1.Config.GeneralCfg().DefaultTenant
- }
- if err := apierSv1.StorDb.SetTPAccountProfiles([]*utils.TPAccountProfile{attrs}); err != nil {
- return utils.NewErrServerError(err)
- }
- *reply = utils.OK
- return nil
-}
-
-// GetTPAccountProfile queries specific TPAccountProfile on tariff plan
-func (apierSv1 *APIerSv1) GetTPAccountProfile(attr *utils.TPTntID, reply *utils.TPAccountProfile) error {
- if missing := utils.MissingStructFields(attr, []string{utils.TPid, utils.ID}); len(missing) != 0 { //Params missing
- return utils.NewErrMandatoryIeMissing(missing...)
- }
- if attr.Tenant == utils.EmptyString {
- attr.Tenant = apierSv1.Config.GeneralCfg().DefaultTenant
- }
- spp, err := apierSv1.StorDb.GetTPAccountProfiles(attr.TPid, attr.Tenant, attr.ID)
- if err != nil {
- if err.Error() != utils.ErrNotFound.Error() {
- err = utils.NewErrServerError(err)
- }
- return err
- }
- *reply = *spp[0]
- return nil
-}
-
-type AttrGetTPAccountProfileIDs struct {
- TPid string // Tariff plan id
- utils.PaginatorWithSearch
-}
-
-// GetTPRouteProfileIDs queries TPAccountProfiles identities on specific tariff plan.
-func (apierSv1 *APIerSv1) GetTPAccountProfileIDs(attrs *AttrGetTPAccountProfileIDs, reply *[]string) error {
- if missing := utils.MissingStructFields(attrs, []string{utils.TPid}); len(missing) != 0 { //Params missing
- return utils.NewErrMandatoryIeMissing(missing...)
- }
- ids, err := apierSv1.StorDb.GetTpTableIds(attrs.TPid, utils.TBLTPAccountProfiles,
- utils.TPDistinctIds{"tenant", "id"}, nil, &attrs.PaginatorWithSearch)
- if err != nil {
- if err.Error() != utils.ErrNotFound.Error() {
- err = utils.NewErrServerError(err)
- }
- return err
- }
- *reply = ids
- return nil
-}
-
-// RemoveTPAccountProfile removes specific TPAccountProfile on Tariff plan
-func (apierSv1 *APIerSv1) RemoveTPAccountProfile(attrs *utils.TPTntID, reply *string) error {
- if missing := utils.MissingStructFields(attrs, []string{utils.TPid, utils.ID}); len(missing) != 0 { //Params missing
- return utils.NewErrMandatoryIeMissing(missing...)
- }
- if attrs.Tenant == utils.EmptyString {
- attrs.Tenant = apierSv1.Config.GeneralCfg().DefaultTenant
- }
- if err := apierSv1.StorDb.RemTpData(utils.TBLTPAccountProfiles, attrs.TPid,
- map[string]string{utils.TenantCfg: attrs.Tenant, utils.IDCfg: attrs.ID}); err != nil {
- return utils.NewErrServerError(err)
- }
- *reply = utils.OK
- return nil
-}
diff --git a/console/accounts_profile.go b/console/accounts_profile.go
deleted file mode 100644
index f0b24e91f..000000000
--- a/console/accounts_profile.go
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
-Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments
-Copyright (C) ITsysCOM GmbH
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see
-*/
-
-package console
-
-import (
- "github.com/cgrates/cgrates/utils"
-)
-
-func init() {
- c := &CmdGetAccountsProfile{
- name: "accounts_profile",
- rpcMethod: utils.APIerSv1GetAccountProfile,
- rpcParams: &utils.TenantIDWithAPIOpts{},
- }
- commands[c.Name()] = c
- c.CommandExecuter = &CommandExecuter{c}
-}
-
-// Commander implementation
-type CmdGetAccountsProfile struct {
- name string
- rpcMethod string
- rpcParams *utils.TenantIDWithAPIOpts
- *CommandExecuter
-}
-
-func (self *CmdGetAccountsProfile) Name() string {
- return self.name
-}
-
-func (self *CmdGetAccountsProfile) RpcMethod() string {
- return self.rpcMethod
-}
-
-func (self *CmdGetAccountsProfile) RpcParams(reset bool) interface{} {
- if reset || self.rpcParams == nil {
- self.rpcParams = &utils.TenantIDWithAPIOpts{}
- }
- return self.rpcParams
-}
-
-func (self *CmdGetAccountsProfile) PostprocessRpcParams() error {
- return nil
-}
-
-func (self *CmdGetAccountsProfile) RpcResult() interface{} {
- var atr utils.AccountProfile
- return &atr
-}
diff --git a/console/accounts_profile_ids.go b/console/accounts_profile_ids.go
deleted file mode 100644
index 658cd3e67..000000000
--- a/console/accounts_profile_ids.go
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
-Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments
-Copyright (C) ITsysCOM GmbH
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see
-*/
-
-package console
-
-import (
- "github.com/cgrates/cgrates/utils"
-)
-
-func init() {
- c := &CmdGetAccountsProfileIDs{
- name: "accounts_profile_ids",
- rpcMethod: utils.APIerSv1GetAccountProfileIDs,
- rpcParams: &utils.PaginatorWithTenant{},
- }
- commands[c.Name()] = c
- c.CommandExecuter = &CommandExecuter{c}
-}
-
-// Commander implementation
-type CmdGetAccountsProfileIDs struct {
- name string
- rpcMethod string
- rpcParams *utils.PaginatorWithTenant
- *CommandExecuter
-}
-
-func (self *CmdGetAccountsProfileIDs) Name() string {
- return self.name
-}
-
-func (self *CmdGetAccountsProfileIDs) RpcMethod() string {
- return self.rpcMethod
-}
-
-func (self *CmdGetAccountsProfileIDs) RpcParams(reset bool) interface{} {
- if reset || self.rpcParams == nil {
- self.rpcParams = &utils.PaginatorWithTenant{}
- }
- return self.rpcParams
-}
-
-func (self *CmdGetAccountsProfileIDs) PostprocessRpcParams() error {
- return nil
-}
-
-func (self *CmdGetAccountsProfileIDs) RpcResult() interface{} {
- var atr []string
- return &atr
-}
diff --git a/console/accounts_profile_ids_test.go b/console/accounts_profile_ids_test.go
deleted file mode 100644
index cc7277d36..000000000
--- a/console/accounts_profile_ids_test.go
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
-Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments
-Copyright (C) ITsysCOM GmbH
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see
-*/
-
-package console
-
-import (
- "reflect"
- "strings"
- "testing"
-
- v1 "github.com/cgrates/cgrates/apier/v1"
-
- "github.com/cgrates/cgrates/utils"
-)
-
-func TestCmdAccountsProfileIDs(t *testing.T) {
- // commands map is initiated in init function
- command := commands["accounts_profile_ids"]
- // verify if ApierSv1 object has method on it
- m, ok := reflect.TypeOf(new(v1.APIerSv1)).MethodByName(strings.Split(command.RpcMethod(), utils.NestingSep)[1])
- if !ok {
- t.Fatal("method not found")
- }
- if m.Type.NumIn() != 3 { // ApierSv1 is consider and we expect 3 inputs
- t.Fatalf("invalid number of input parameters ")
- }
- // verify the type of input parameter
- if ok := m.Type.In(1).AssignableTo(reflect.TypeOf(command.RpcParams(true))); !ok {
- t.Fatalf("cannot assign input parameter")
- }
- // verify the type of output parameter
- if ok := m.Type.In(2).AssignableTo(reflect.TypeOf(command.RpcResult())); !ok {
- t.Fatalf("cannot assign output parameter")
- }
- // for coverage purpose
- if err := command.PostprocessRpcParams(); err != nil {
- t.Fatal(err)
- }
-}
diff --git a/console/accounts_profile_rem.go b/console/accounts_profile_rem.go
deleted file mode 100644
index dfae57eb0..000000000
--- a/console/accounts_profile_rem.go
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
-Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments
-Copyright (C) ITsysCOM GmbH
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see
-*/
-
-package console
-
-import "github.com/cgrates/cgrates/utils"
-
-func init() {
- c := &CmdRemoveAccountsProfile{
- name: "accounts_profile_remove",
- rpcMethod: utils.APIerSv1RemoveAccountProfile,
- rpcParams: &utils.TenantIDWithAPIOpts{},
- }
- commands[c.Name()] = c
- c.CommandExecuter = &CommandExecuter{c}
-}
-
-type CmdRemoveAccountsProfile struct {
- name string
- rpcMethod string
- rpcParams *utils.TenantIDWithAPIOpts
- *CommandExecuter
-}
-
-func (self *CmdRemoveAccountsProfile) Name() string {
- return self.name
-}
-
-func (self *CmdRemoveAccountsProfile) RpcMethod() string {
- return self.rpcMethod
-}
-
-func (self *CmdRemoveAccountsProfile) RpcParams(reset bool) interface{} {
- if reset || self.rpcParams == nil {
- self.rpcParams = &utils.TenantIDWithAPIOpts{APIOpts: make(map[string]interface{})}
- }
- return self.rpcParams
-}
-
-func (self *CmdRemoveAccountsProfile) PostprocessRpcParams() error {
- return nil
-}
-
-func (self *CmdRemoveAccountsProfile) RpcResult() interface{} {
- var s string
- return &s
-}
diff --git a/console/accounts_profile_rem_test.go b/console/accounts_profile_rem_test.go
deleted file mode 100644
index 7b2fc420f..000000000
--- a/console/accounts_profile_rem_test.go
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
-Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments
-Copyright (C) ITsysCOM GmbH
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see
-*/
-
-package console
-
-import (
- "reflect"
- "strings"
- "testing"
-
- v1 "github.com/cgrates/cgrates/apier/v1"
-
- "github.com/cgrates/cgrates/utils"
-)
-
-func TestCmdAccountsProfileRem(t *testing.T) {
- // commands map is initiated in init function
- command := commands["accounts_profile_remove"]
- // verify if ApierSv1 object has method on it
- m, ok := reflect.TypeOf(new(v1.APIerSv1)).MethodByName(strings.Split(command.RpcMethod(), utils.NestingSep)[1])
- if !ok {
- t.Fatal("method not found")
- }
- if m.Type.NumIn() != 3 { // ApierSv1 is consider and we expect 3 inputs
- t.Fatalf("invalid number of input parameters ")
- }
- // verify the type of input parameter
- if ok := m.Type.In(1).AssignableTo(reflect.TypeOf(command.RpcParams(true))); !ok {
- t.Fatalf("cannot assign input parameter")
- }
- // verify the type of output parameter
- if ok := m.Type.In(2).AssignableTo(reflect.TypeOf(command.RpcResult())); !ok {
- t.Fatalf("cannot assign output parameter")
- }
- // for coverage purpose
- if err := command.PostprocessRpcParams(); err != nil {
- t.Fatal(err)
- }
-}
diff --git a/console/accounts_profile_set.go b/console/accounts_profile_set.go
deleted file mode 100644
index 42d85d3e2..000000000
--- a/console/accounts_profile_set.go
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
-Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments
-Copyright (C) ITsysCOM GmbH
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see
-*/
-
-package console
-
-import (
- "github.com/cgrates/cgrates/utils"
-)
-
-func init() {
- c := &CmdSetAccountProfile{
- name: "accounts_profile_set",
- rpcMethod: utils.APIerSv1SetAccountProfile,
- rpcParams: &utils.APIAccountProfileWithOpts{},
- }
- commands[c.Name()] = c
- c.CommandExecuter = &CommandExecuter{c}
-}
-
-type CmdSetAccountProfile struct {
- name string
- rpcMethod string
- rpcParams *utils.APIAccountProfileWithOpts
- *CommandExecuter
-}
-
-func (self *CmdSetAccountProfile) Name() string {
- return self.name
-}
-
-func (self *CmdSetAccountProfile) RpcMethod() string {
- return self.rpcMethod
-}
-
-func (self *CmdSetAccountProfile) RpcParams(reset bool) interface{} {
- if reset || self.rpcParams == nil {
- self.rpcParams = &utils.APIAccountProfileWithOpts{APIAccountProfile: new(utils.APIAccountProfile)}
- }
- return self.rpcParams
-}
-
-func (self *CmdSetAccountProfile) PostprocessRpcParams() error {
- return nil
-}
-
-func (self *CmdSetAccountProfile) RpcResult() interface{} {
- var s string
- return &s
-}
diff --git a/console/accounts_profile_set_test.go b/console/accounts_profile_set_test.go
deleted file mode 100644
index 3390597af..000000000
--- a/console/accounts_profile_set_test.go
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
-Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments
-Copyright (C) ITsysCOM GmbH
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see
-*/
-
-package console
-
-import (
- "reflect"
- "strings"
- "testing"
-
- v1 "github.com/cgrates/cgrates/apier/v1"
-
- "github.com/cgrates/cgrates/utils"
-)
-
-func TestCmdAccountsProfileSet(t *testing.T) {
- // commands map is initiated in init function
- command := commands["accounts_profile_set"]
- // verify if ApierSv1 object has method on it
- m, ok := reflect.TypeOf(new(v1.APIerSv1)).MethodByName(strings.Split(command.RpcMethod(), utils.NestingSep)[1])
- if !ok {
- t.Fatal("method not found")
- }
- if m.Type.NumIn() != 3 { // ApierSv1 is consider and we expect 3 inputs
- t.Fatalf("invalid number of input parameters ")
- }
- // verify the type of input parameter
- if ok := m.Type.In(1).AssignableTo(reflect.TypeOf(command.RpcParams(true))); !ok {
- t.Fatalf("cannot assign input parameter")
- }
- // verify the type of output parameter
- if ok := m.Type.In(2).AssignableTo(reflect.TypeOf(command.RpcResult())); !ok {
- t.Fatalf("cannot assign output parameter")
- }
- // for coverage purpose
- if err := command.PostprocessRpcParams(); err != nil {
- t.Fatal(err)
- }
-}
diff --git a/console/accounts_profile_test.go b/console/accounts_profile_test.go
deleted file mode 100644
index e20f5ee30..000000000
--- a/console/accounts_profile_test.go
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
-Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments
-Copyright (C) ITsysCOM GmbH
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see
-*/
-
-package console
-
-import (
- "reflect"
- "strings"
- "testing"
-
- v1 "github.com/cgrates/cgrates/apier/v1"
-
- "github.com/cgrates/cgrates/utils"
-)
-
-func TestCmdAccountsProfile(t *testing.T) {
- // commands map is initiated in init function
- command := commands["accounts_profile"]
- // verify if ApierSv1 object has method on it
- m, ok := reflect.TypeOf(new(v1.APIerSv1)).MethodByName(strings.Split(command.RpcMethod(), utils.NestingSep)[1])
- if !ok {
- t.Fatal("method not found")
- }
- if m.Type.NumIn() != 3 { // ApierSv1 is consider and we expect 3 inputs
- t.Fatalf("invalid number of input parameters ")
- }
- // verify the type of input parameter
- if ok := m.Type.In(1).AssignableTo(reflect.TypeOf(command.RpcParams(true))); !ok {
- t.Fatalf("cannot assign input parameter")
- }
- // verify the type of output parameter
- if ok := m.Type.In(2).AssignableTo(reflect.TypeOf(command.RpcResult())); !ok {
- t.Fatalf("cannot assign output parameter")
- }
- // for coverage purpose
- if err := command.PostprocessRpcParams(); err != nil {
- t.Fatal(err)
- }
-}
diff --git a/dispatchers/accounts.go b/dispatchers/accounts.go
deleted file mode 100644
index 15526aa71..000000000
--- a/dispatchers/accounts.go
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
-Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments
-Copyright (C) ITsysCOM GmbH
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see
-*/
-
-package dispatchers
-
-import (
- "time"
-
- "github.com/cgrates/cgrates/utils"
-)
-
-func (dS *DispatcherService) AccountSv1Ping(args *utils.CGREvent, rpl *string) (err error) {
- if args == nil {
- args = new(utils.CGREvent)
- }
- args.Tenant = utils.FirstNonEmpty(args.Tenant, dS.cfg.GeneralCfg().DefaultTenant)
- if len(dS.cfg.DispatcherSCfg().AttributeSConns) != 0 {
- if err = dS.authorize(utils.AccountSv1Ping, args.Tenant,
- utils.IfaceAsString(args.APIOpts[utils.OptsAPIKey]), args.Time); err != nil {
- return
- }
- }
- return dS.Dispatch(args, utils.MetaAccounts, utils.AccountSv1Ping, args, rpl)
-}
-
-func (dS *DispatcherService) AccountProfilesForEvent(args *utils.ArgsAccountsForEvent, reply *[]*utils.AccountProfile) (err error) {
- tnt := dS.cfg.GeneralCfg().DefaultTenant
- if args.CGREvent != nil && args.CGREvent.Tenant != utils.EmptyString {
- tnt = args.CGREvent.Tenant
- }
- if len(dS.cfg.DispatcherSCfg().AttributeSConns) != 0 {
- if err = dS.authorize(utils.AccountSv1AccountProfilesForEvent, tnt,
- utils.IfaceAsString(args.APIOpts[utils.OptsAPIKey]), args.CGREvent.Time); err != nil {
- return
- }
- }
- return dS.Dispatch(args.CGREvent, utils.MetaAccounts, utils.AccountSv1AccountProfilesForEvent, args, reply)
-}
-
-func (dS *DispatcherService) MaxAbstracts(args *utils.ArgsAccountsForEvent, reply *utils.ExtEventCharges) (err error) {
- tnt := dS.cfg.GeneralCfg().DefaultTenant
- if args.CGREvent != nil && args.CGREvent.Tenant != utils.EmptyString {
- tnt = args.CGREvent.Tenant
- }
- if len(dS.cfg.DispatcherSCfg().AttributeSConns) != 0 {
- if err = dS.authorize(utils.AccountSv1MaxAbstracts, tnt,
- utils.IfaceAsString(args.APIOpts[utils.OptsAPIKey]), args.CGREvent.Time); err != nil {
- return
- }
- }
- return dS.Dispatch(args.CGREvent, utils.MetaAccounts, utils.AccountSv1MaxAbstracts, args, reply)
-}
-
-func (dS *DispatcherService) DebitAbstracts(args *utils.ArgsAccountsForEvent, reply *utils.ExtEventCharges) (err error) {
- tnt := dS.cfg.GeneralCfg().DefaultTenant
- if args.CGREvent != nil && args.CGREvent.Tenant != utils.EmptyString {
- tnt = args.CGREvent.Tenant
- }
- if len(dS.cfg.DispatcherSCfg().AttributeSConns) != 0 {
- if err = dS.authorize(utils.AccountSv1DebitAbstracts, tnt,
- utils.IfaceAsString(args.APIOpts[utils.OptsAPIKey]), args.CGREvent.Time); err != nil {
- return
- }
- }
- return dS.Dispatch(args.CGREvent, utils.MetaAccounts, utils.AccountSv1DebitAbstracts, args, reply)
-}
-
-func (dS *DispatcherService) MaxConcretes(args *utils.ArgsAccountsForEvent, reply *utils.ExtEventCharges) (err error) {
- tnt := dS.cfg.GeneralCfg().DefaultTenant
- if args.CGREvent != nil && args.CGREvent.Tenant != utils.EmptyString {
- tnt = args.CGREvent.Tenant
- }
- if len(dS.cfg.DispatcherSCfg().AttributeSConns) != 0 {
- if err = dS.authorize(utils.AccountSv1MaxConcretes, tnt,
- utils.IfaceAsString(args.APIOpts[utils.OptsAPIKey]), args.CGREvent.Time); err != nil {
- return
- }
- }
- return dS.Dispatch(args.CGREvent, utils.MetaAccounts, utils.AccountSv1MaxConcretes, args, reply)
-}
-
-func (dS *DispatcherService) DebitConcretes(args *utils.ArgsAccountsForEvent, reply *utils.ExtEventCharges) (err error) {
- tnt := dS.cfg.GeneralCfg().DefaultTenant
- if args.CGREvent != nil && args.CGREvent.Tenant != utils.EmptyString {
- tnt = args.CGREvent.Tenant
- }
- if len(dS.cfg.DispatcherSCfg().AttributeSConns) != 0 {
- if err = dS.authorize(utils.AccountSv1DebitConcretes, tnt,
- utils.IfaceAsString(args.APIOpts[utils.OptsAPIKey]), args.CGREvent.Time); err != nil {
- return
- }
- }
- return dS.Dispatch(args.CGREvent, utils.MetaAccounts, utils.AccountSv1DebitConcretes, args, reply)
-}
-
-func (dS *DispatcherService) AccountSv1ActionSetBalance(args *utils.ArgsActSetBalance, reply *string) (err error) {
- tnt := dS.cfg.GeneralCfg().DefaultTenant
- if args.Tenant != utils.EmptyString {
- tnt = args.Tenant
- }
- if len(dS.cfg.DispatcherSCfg().AttributeSConns) != 0 {
- if err = dS.authorize(utils.AccountSv1ActionSetBalance, tnt,
- utils.IfaceAsString(args.APIOpts[utils.OptsAPIKey]), utils.TimePointer(time.Now())); err != nil {
- return
- }
- }
- return dS.Dispatch(&utils.CGREvent{
- Tenant: tnt,
- APIOpts: args.APIOpts,
- }, utils.MetaAccounts, utils.AccountSv1ActionSetBalance, args, reply)
-}
-
-func (dS *DispatcherService) AccountSv1ActionRemoveBalance(args *utils.ArgsActRemoveBalances, reply *string) (err error) {
- tnt := dS.cfg.GeneralCfg().DefaultTenant
- if args.Tenant != utils.EmptyString {
- tnt = args.Tenant
- }
- if len(dS.cfg.DispatcherSCfg().AttributeSConns) != 0 {
- if err = dS.authorize(utils.AccountSv1ActionRemoveBalance, tnt,
- utils.IfaceAsString(args.APIOpts[utils.OptsAPIKey]), utils.TimePointer(time.Now())); err != nil {
- return
- }
- }
- return dS.Dispatch(&utils.CGREvent{
- Tenant: tnt,
- APIOpts: args.APIOpts,
- }, utils.MetaAccounts, utils.AccountSv1ActionRemoveBalance, args, reply)
-}
diff --git a/dispatchers/accounts_it_test.go b/dispatchers/accounts_it_test.go
deleted file mode 100644
index 1116fe3f4..000000000
--- a/dispatchers/accounts_it_test.go
+++ /dev/null
@@ -1,77 +0,0 @@
-// +build integration
-
-/*
-Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments
-Copyright (C) ITsysCOM GmbH
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see
-*/
-
-package dispatchers
-
-import (
- "testing"
-
- "github.com/cgrates/cgrates/utils"
-)
-
-var sTestsDspAccPrf = []func(t *testing.T){
- testDspAccPrfPing,
-}
-
-//Test start here
-func TestDspAccountSIT(t *testing.T) {
- var config1, config2, config3 string
- switch *dbType {
- case utils.MetaInternal:
- t.SkipNow()
- case utils.MetaMySQL:
- config1 = "all_mysql"
- config2 = "all2_mysql"
- config3 = "dispatchers_mysql"
- case utils.MetaMongo:
- config1 = "all_mongo"
- config2 = "all2_mongo"
- config3 = "dispatchers_mongo"
- case utils.MetaPostgres:
- t.SkipNow()
- default:
- t.Fatal("Unknown Database type")
- }
-
- dispDIR := "dispatchers"
- if *encoding == utils.MetaGOB {
- dispDIR += "_gob"
- }
- testDsp(t, sTestsDspAccPrf, "TestDspAccionSIT", config1, config2, config3, "tutorial", "oldtutorial", dispDIR)
-}
-
-func testDspAccPrfPing(t *testing.T) {
- var reply string
- if err := allEngine.RPC.Call(utils.AccountSv1Ping, new(utils.CGREvent), &reply); err != nil {
- t.Error(err)
- } else if reply != utils.Pong {
- t.Errorf("Received: %s", reply)
- }
- if err := dispEngine.RPC.Call(utils.AccountSv1Ping, &utils.CGREvent{
- Tenant: "cgrates.org",
- APIOpts: map[string]interface{}{
- utils.OptsAPIKey: "accPrf12345",
- },
- }, &reply); err != nil {
- t.Error(err)
- } else if reply != utils.Pong {
- t.Errorf("Received: %s", reply)
- }
-}
diff --git a/dispatchers/replicator.go b/dispatchers/replicator.go
index 6c9fd10d1..d67f0002e 100644
--- a/dispatchers/replicator.go
+++ b/dispatchers/replicator.go
@@ -1415,55 +1415,3 @@ func (dS *DispatcherService) ReplicatorSv1RemoveIndexes(args *utils.GetIndexesAr
APIOpts: args.APIOpts,
}, utils.MetaReplicator, utils.ReplicatorSv1RemoveIndexes, args, reply)
}
-
-func (dS *DispatcherService) ReplicatorSv1GetAccountProfile(args *utils.TenantIDWithAPIOpts, reply *utils.AccountProfile) (err error) {
- tnt := dS.cfg.GeneralCfg().DefaultTenant
- if args.TenantID != nil && args.TenantID.Tenant != utils.EmptyString {
- tnt = args.TenantID.Tenant
- }
- if len(dS.cfg.DispatcherSCfg().AttributeSConns) != 0 {
- if err = dS.authorize(utils.ReplicatorSv1GetAccountProfile, tnt,
- utils.IfaceAsString(args.APIOpts[utils.OptsAPIKey]), utils.TimePointer(time.Now())); err != nil {
- return
- }
- }
- return dS.Dispatch(&utils.CGREvent{
- Tenant: tnt,
- ID: args.ID,
- APIOpts: args.APIOpts,
- }, utils.MetaReplicator, utils.ReplicatorSv1GetAccountProfile, args, reply)
-}
-
-func (dS *DispatcherService) ReplicatorSv1SetAccountProfile(args *utils.AccountProfileWithAPIOpts, rpl *string) (err error) {
- if args == nil {
- args = &utils.AccountProfileWithAPIOpts{}
- }
- args.Tenant = utils.FirstNonEmpty(args.Tenant, dS.cfg.GeneralCfg().DefaultTenant)
- if len(dS.cfg.DispatcherSCfg().AttributeSConns) != 0 {
- if err = dS.authorize(utils.ReplicatorSv1SetAccountProfile, args.Tenant,
- utils.IfaceAsString(args.APIOpts[utils.OptsAPIKey]), utils.TimePointer(time.Now())); err != nil {
- return
- }
- }
- return dS.Dispatch(&utils.CGREvent{
- Tenant: args.Tenant,
- APIOpts: args.APIOpts,
- }, utils.MetaReplicator, utils.ReplicatorSv1SetAccountProfile, args, rpl)
-}
-
-func (dS *DispatcherService) ReplicatorSv1RemoveAccountProfile(args *utils.TenantIDWithAPIOpts, rpl *string) (err error) {
- if args == nil {
- args = &utils.TenantIDWithAPIOpts{}
- }
- args.Tenant = utils.FirstNonEmpty(args.Tenant, dS.cfg.GeneralCfg().DefaultTenant)
- if len(dS.cfg.DispatcherSCfg().AttributeSConns) != 0 {
- if err = dS.authorize(utils.ReplicatorSv1RemoveAccountProfile, args.Tenant,
- utils.IfaceAsString(args.APIOpts[utils.OptsAPIKey]), utils.TimePointer(time.Now())); err != nil {
- return
- }
- }
- return dS.Dispatch(&utils.CGREvent{
- Tenant: args.Tenant,
- APIOpts: args.APIOpts,
- }, utils.MetaReplicator, utils.ReplicatorSv1RemoveAccountProfile, args, rpl)
-}
diff --git a/engine/datadbmock.go b/engine/datadbmock.go
index 2ea1d31b8..92941ecad 100644
--- a/engine/datadbmock.go
+++ b/engine/datadbmock.go
@@ -406,14 +406,6 @@ func (dbM *DataDBMock) RemoveActionProfileDrv(string, string) error {
return utils.ErrNotImplemented
}
-func (dbM *DataDBMock) GetAccountProfileDrv(string, string) (*utils.AccountProfile, error) {
- return nil, utils.ErrNotImplemented
-}
-
-func (dbM *DataDBMock) SetAccountProfileDrv(profile *utils.AccountProfile) error {
- return utils.ErrNotImplemented
-}
-
func (dbM *DataDBMock) RemoveAccountProfileDrv(string, string) error {
return utils.ErrNotImplemented
}
diff --git a/engine/datamanager.go b/engine/datamanager.go
index 71b2dbd3f..ce9fdb776 100644
--- a/engine/datamanager.go
+++ b/engine/datamanager.go
@@ -40,7 +40,6 @@ var (
utils.RateFilterIndexPrfx: {},
utils.ActionPlanIndexes: {},
utils.FilterIndexPrfx: {},
- utils.AccountProfileFilterIndexPrfx: {},
}
cachePrefixMap = utils.StringSet{
utils.DestinationPrefix: {},
@@ -289,19 +288,6 @@ func (dm *DataManager) CacheDataFromDB(prfx string, ids []string, mustBeCached b
return
}
_, err = dm.GetIndexes(utils.CacheActionProfilesFilterIndexes, tntCtx, idxKey, false, true)
- case utils.AccountProfileFilterIndexPrfx:
- var tntCtx, idxKey string
- if tntCtx, idxKey, err = splitFilterIndex(dataID); err != nil {
- return
- }
- _, err = dm.GetIndexes(utils.CacheAccountProfilesFilterIndexes, tntCtx, idxKey, false, true)
- case utils.FilterIndexPrfx:
- idx := strings.LastIndexByte(dataID, utils.InInFieldSep[0])
- if idx < 0 {
- err = fmt.Errorf("WRONG_IDX_KEY_FORMAT<%s>", dataID)
- return
- }
- _, err = dm.GetIndexes(utils.CacheReverseFilterIndexes, dataID[:idx], dataID[idx+1:], false, true)
case utils.LoadIDPrefix:
_, err = dm.GetItemLoadIDs(utils.EmptyString, true)
case utils.MetaAPIBan:
@@ -3624,104 +3610,3 @@ func (dm *DataManager) checkFilters(tenant string, ids []string) (brokenReferenc
}
return
}
-
-func (dm *DataManager) GetAccountProfile(tenant, id string) (ap *utils.AccountProfile, err error) {
- if dm == nil {
- err = utils.ErrNoDatabaseConn
- return
- }
- ap, err = dm.dataDB.GetAccountProfileDrv(tenant, id)
- if err != nil {
- if itm := config.CgrConfig().DataDbCfg().Items[utils.MetaAccountProfiles]; err == utils.ErrNotFound && itm.Remote {
- if err = dm.connMgr.Call(config.CgrConfig().DataDbCfg().RmtConns, nil,
- utils.ReplicatorSv1GetAccountProfile,
- &utils.TenantIDWithAPIOpts{
- TenantID: &utils.TenantID{Tenant: tenant, ID: id},
- APIOpts: utils.GenerateDBItemOpts(itm.APIKey, itm.RouteID, utils.EmptyString,
- utils.FirstNonEmpty(config.CgrConfig().DataDbCfg().RmtConnID,
- config.CgrConfig().GeneralCfg().NodeID)),
- }, &ap); err == nil {
- err = dm.dataDB.SetAccountProfileDrv(ap)
- }
- }
- if err != nil {
- return nil, err
- }
- }
- return
-}
-
-func (dm *DataManager) SetAccountProfile(ap *utils.AccountProfile, withIndex bool) (err error) {
- if dm == nil {
- return utils.ErrNoDatabaseConn
- }
- if withIndex {
- if brokenReference := dm.checkFilters(ap.Tenant, ap.FilterIDs); len(brokenReference) != 0 {
- // if we get a broken filter do not set the profile
- return fmt.Errorf("broken reference to filter: %+v for item with ID: %+v",
- brokenReference, ap.TenantID())
- }
- }
- oldRpp, err := dm.GetAccountProfile(ap.Tenant, ap.ID)
- if err != nil && err != utils.ErrNotFound {
- return err
- }
- if err = dm.DataDB().SetAccountProfileDrv(ap); err != nil {
- return err
- }
- if withIndex {
- var oldFiltersIDs *[]string
- if oldRpp != nil {
- oldFiltersIDs = &oldRpp.FilterIDs
- }
- if err := updatedIndexes(dm, utils.CacheAccountProfilesFilterIndexes, ap.Tenant,
- utils.EmptyString, ap.ID, oldFiltersIDs, ap.FilterIDs, false); err != nil {
- return err
- }
- }
- if itm := config.CgrConfig().DataDbCfg().Items[utils.MetaAccountProfiles]; itm.Replicate {
- err = replicate(dm.connMgr, config.CgrConfig().DataDbCfg().RplConns,
- config.CgrConfig().DataDbCfg().RplFiltered,
- utils.AccountProfilePrefix, ap.TenantID(), // this are used to get the host IDs from cache
- utils.ReplicatorSv1SetAccountProfile,
- &utils.AccountProfileWithAPIOpts{
- AccountProfile: ap,
- APIOpts: utils.GenerateDBItemOpts(itm.APIKey, itm.RouteID,
- config.CgrConfig().DataDbCfg().RplCache, utils.EmptyString)})
- }
- return
-}
-
-func (dm *DataManager) RemoveAccountProfile(tenant, id string,
- transactionID string, withIndex bool) (err error) {
- if dm == nil {
- return utils.ErrNoDatabaseConn
- }
- oldRpp, err := dm.GetAccountProfile(tenant, id)
- if err != nil && err != utils.ErrNotFound {
- return err
- }
- if err = dm.DataDB().RemoveAccountProfileDrv(tenant, id); err != nil {
- return
- }
- if oldRpp == nil {
- return utils.ErrNotFound
- }
- if withIndex {
- if err = removeItemFromFilterIndex(dm, utils.CacheAccountProfilesFilterIndexes,
- tenant, utils.EmptyString, id, oldRpp.FilterIDs); err != nil {
- return
- }
- }
- if itm := config.CgrConfig().DataDbCfg().Items[utils.MetaAccountProfiles]; itm.Replicate {
- replicate(dm.connMgr, config.CgrConfig().DataDbCfg().RplConns,
- config.CgrConfig().DataDbCfg().RplFiltered,
- utils.AccountProfilePrefix, utils.ConcatenatedKey(tenant, id), // this are used to get the host IDs from cache
- utils.ReplicatorSv1RemoveAccountProfile,
- &utils.TenantIDWithAPIOpts{
- TenantID: &utils.TenantID{Tenant: tenant, ID: id},
- APIOpts: utils.GenerateDBItemOpts(itm.APIKey, itm.RouteID,
- config.CgrConfig().DataDbCfg().RplCache, utils.EmptyString)})
- }
- return
-}
diff --git a/engine/libindex.go b/engine/libindex.go
index 3c4d55d64..f90ffec5a 100644
--- a/engine/libindex.go
+++ b/engine/libindex.go
@@ -693,26 +693,6 @@ func UpdateFilterIndex(dm *DataManager, oldFlt, newFlt *Filter) (err error) {
}); err != nil && err != utils.ErrNotFound {
return utils.APIErrorHandler(err)
}
- case utils.CacheAccountProfilesFilterIndexes:
- if err = removeFilterIndexesForFilter(dm, idxItmType, newFlt.Tenant, //remove the indexes for the filter
- removeIndexKeys, indx); err != nil {
- return
- }
- idxSlice := indx.AsSlice()
- if _, err = ComputeIndexes(dm, newFlt.Tenant, utils.EmptyString, idxItmType, // compute all the indexes for afected items
- &idxSlice, utils.NonTransactional, func(tnt, id, ctx string) (*[]string, error) {
- ap, e := dm.GetAccountProfile(tnt, id)
- if e != nil {
- return nil, e
- }
- fltrIDs := make([]string, len(ap.FilterIDs))
- for i, fltrID := range ap.FilterIDs {
- fltrIDs[i] = fltrID
- }
- return &fltrIDs, nil
- }); err != nil && err != utils.ErrNotFound {
- return utils.APIErrorHandler(err)
- }
case utils.CacheActionProfilesFilterIndexes:
if err = removeFilterIndexesForFilter(dm, idxItmType, newFlt.Tenant, //remove the indexes for the filter
removeIndexKeys, indx); err != nil {
diff --git a/engine/libtest.go b/engine/libtest.go
index 0ab682fd5..269b27720 100644
--- a/engine/libtest.go
+++ b/engine/libtest.go
@@ -508,61 +508,59 @@ func CallScript(scriptPath string, subcommand string, waitMs int) error {
func GetDefaultEmptyCacheStats() map[string]*ltcache.CacheStats {
return map[string]*ltcache.CacheStats{
- utils.MetaDefault: {},
- utils.CacheAccountActionPlans: {},
- utils.CacheActionPlans: {},
- utils.CacheActionTriggers: {},
- utils.CacheActions: {},
- utils.CacheAttributeFilterIndexes: {},
- utils.CacheAttributeProfiles: {},
- utils.CacheChargerFilterIndexes: {},
- utils.CacheChargerProfiles: {},
- utils.CacheDispatcherFilterIndexes: {},
- utils.CacheDispatcherProfiles: {},
- utils.CacheDispatcherHosts: {},
- utils.CacheDispatcherRoutes: {},
- utils.CacheDispatcherLoads: {},
- utils.CacheDispatchers: {},
- utils.CacheDestinations: {},
- utils.CacheEventResources: {},
- utils.CacheFilters: {},
- utils.CacheRatingPlans: {},
- utils.CacheRatingProfiles: {},
- utils.CacheResourceFilterIndexes: {},
- utils.CacheResourceProfiles: {},
- utils.CacheResources: {},
- utils.CacheReverseDestinations: {},
- utils.CacheRPCResponses: {},
- utils.CacheSharedGroups: {},
- utils.CacheStatFilterIndexes: {},
- utils.CacheStatQueueProfiles: {},
- utils.CacheStatQueues: {},
- utils.CacheSTIR: {},
- utils.CacheRouteFilterIndexes: {},
- utils.CacheRouteProfiles: {},
- utils.CacheThresholdFilterIndexes: {},
- utils.CacheThresholdProfiles: {},
- utils.CacheThresholds: {},
- utils.CacheRateProfiles: {},
- utils.CacheRateProfilesFilterIndexes: {},
- utils.CacheRateFilterIndexes: {},
- utils.CacheTimings: {},
- utils.CacheDiameterMessages: {},
- utils.CacheClosedSessions: {},
- utils.CacheLoadIDs: {},
- utils.CacheRPCConnections: {},
- utils.CacheCDRIDs: {},
- utils.CacheRatingProfilesTmp: {},
- utils.CacheUCH: {},
- utils.CacheEventCharges: {},
- utils.CacheReverseFilterIndexes: {},
- utils.MetaAPIBan: {},
- utils.CacheCapsEvents: {},
- utils.CacheActionProfiles: {},
- utils.CacheActionProfilesFilterIndexes: {},
- utils.CacheAccountProfiles: {},
- utils.CacheAccountProfilesFilterIndexes: {},
- utils.CacheReplicationHosts: {},
+ utils.MetaDefault: {},
+ utils.CacheAccountActionPlans: {},
+ utils.CacheActionPlans: {},
+ utils.CacheActionTriggers: {},
+ utils.CacheActions: {},
+ utils.CacheAttributeFilterIndexes: {},
+ utils.CacheAttributeProfiles: {},
+ utils.CacheChargerFilterIndexes: {},
+ utils.CacheChargerProfiles: {},
+ utils.CacheDispatcherFilterIndexes: {},
+ utils.CacheDispatcherProfiles: {},
+ utils.CacheDispatcherHosts: {},
+ utils.CacheDispatcherRoutes: {},
+ utils.CacheDispatcherLoads: {},
+ utils.CacheDispatchers: {},
+ utils.CacheDestinations: {},
+ utils.CacheEventResources: {},
+ utils.CacheFilters: {},
+ utils.CacheRatingPlans: {},
+ utils.CacheRatingProfiles: {},
+ utils.CacheResourceFilterIndexes: {},
+ utils.CacheResourceProfiles: {},
+ utils.CacheResources: {},
+ utils.CacheReverseDestinations: {},
+ utils.CacheRPCResponses: {},
+ utils.CacheSharedGroups: {},
+ utils.CacheStatFilterIndexes: {},
+ utils.CacheStatQueueProfiles: {},
+ utils.CacheStatQueues: {},
+ utils.CacheSTIR: {},
+ utils.CacheRouteFilterIndexes: {},
+ utils.CacheRouteProfiles: {},
+ utils.CacheThresholdFilterIndexes: {},
+ utils.CacheThresholdProfiles: {},
+ utils.CacheThresholds: {},
+ utils.CacheRateProfiles: {},
+ utils.CacheRateProfilesFilterIndexes: {},
+ utils.CacheRateFilterIndexes: {},
+ utils.CacheTimings: {},
+ utils.CacheDiameterMessages: {},
+ utils.CacheClosedSessions: {},
+ utils.CacheLoadIDs: {},
+ utils.CacheRPCConnections: {},
+ utils.CacheCDRIDs: {},
+ utils.CacheRatingProfilesTmp: {},
+ utils.CacheUCH: {},
+ utils.CacheEventCharges: {},
+ utils.CacheReverseFilterIndexes: {},
+ utils.MetaAPIBan: {},
+ utils.CacheCapsEvents: {},
+ utils.CacheActionProfiles: {},
+ utils.CacheActionProfilesFilterIndexes: {},
+ utils.CacheReplicationHosts: {},
utils.CacheAccounts: {},
utils.CacheVersions: {},
@@ -590,7 +588,6 @@ func GetDefaultEmptyCacheStats() map[string]*ltcache.CacheStats {
utils.CacheTBLTPDispatcherHosts: {},
utils.CacheTBLTPRateProfiles: {},
utils.CacheTBLTPActionProfiles: {},
- utils.CacheTBLTPAccountProfiles: {},
}
}
diff --git a/engine/model_helpers.go b/engine/model_helpers.go
index 5ab70e67c..f61af3602 100644
--- a/engine/model_helpers.go
+++ b/engine/model_helpers.go
@@ -3606,189 +3606,3 @@ func APItoModelTPAccountProfile(tPrf *utils.TPAccountProfile) (mdls AccountProfi
}
return
}
-
-func APItoAccountProfile(tpAp *utils.TPAccountProfile, timezone string) (ap *utils.AccountProfile, err error) {
- ap = &utils.AccountProfile{
- Tenant: tpAp.Tenant,
- ID: tpAp.ID,
- FilterIDs: make([]string, len(tpAp.FilterIDs)),
- Balances: make(map[string]*utils.Balance, len(tpAp.Balances)),
- ThresholdIDs: make([]string, len(tpAp.ThresholdIDs)),
- }
- if tpAp.Weights != utils.EmptyString {
- weight, err := utils.NewDynamicWeightsFromString(tpAp.Weights, ";", "&")
- if err != nil {
- return nil, err
- }
- ap.Weights = weight
- }
- for i, stp := range tpAp.FilterIDs {
- ap.FilterIDs[i] = stp
- }
- if tpAp.ActivationInterval != nil {
- if ap.ActivationInterval, err = tpAp.ActivationInterval.AsActivationInterval(timezone); err != nil {
- return
- }
- }
-
- for id, bal := range tpAp.Balances {
- ap.Balances[id] = &utils.Balance{
- ID: bal.ID,
- FilterIDs: bal.FilterIDs,
- Type: bal.Type,
- Units: utils.NewDecimalFromFloat64(bal.Units),
- }
- if bal.Weights != utils.EmptyString {
- weight, err := utils.NewDynamicWeightsFromString(bal.Weights, ";", "&")
- if err != nil {
- return nil, err
- }
- ap.Balances[id].Weights = weight
- }
- if bal.UnitFactors != nil {
- ap.Balances[id].UnitFactors = make([]*utils.UnitFactor, len(bal.UnitFactors))
- for j, unitFactor := range bal.UnitFactors {
- ap.Balances[id].UnitFactors[j] = &utils.UnitFactor{
- FilterIDs: unitFactor.FilterIDs,
- Factor: utils.NewDecimalFromFloat64(unitFactor.Factor),
- }
- }
- }
- if bal.Opts != utils.EmptyString {
- ap.Balances[id].Opts = make(map[string]interface{})
- for _, opt := range strings.Split(bal.Opts, utils.InfieldSep) { // example of opts: key1:val1;key2:val2;key3:val3
- keyValSls := utils.SplitConcatenatedKey(opt)
- if len(keyValSls) != 2 {
- err = fmt.Errorf("malformed option for ActionProfile <%s> for action <%s>", ap.TenantID(), bal.ID)
- return
- }
- ap.Balances[id].Opts[keyValSls[0]] = keyValSls[1]
- }
- }
- if bal.CostIncrement != nil {
- ap.Balances[id].CostIncrements = make([]*utils.CostIncrement, len(bal.CostIncrement))
- for j, costIncrement := range bal.CostIncrement {
- ap.Balances[id].CostIncrements[j] = &utils.CostIncrement{
- FilterIDs: costIncrement.FilterIDs,
- }
- if costIncrement.Increment != nil {
- ap.Balances[id].CostIncrements[j].Increment = utils.NewDecimalFromFloat64(*costIncrement.Increment)
- }
- if costIncrement.FixedFee != nil {
- ap.Balances[id].CostIncrements[j].FixedFee = utils.NewDecimalFromFloat64(*costIncrement.FixedFee)
- }
- if costIncrement.RecurrentFee != nil {
- ap.Balances[id].CostIncrements[j].RecurrentFee = utils.NewDecimalFromFloat64(*costIncrement.RecurrentFee)
- }
- }
- }
- if bal.AttributeIDs != nil {
- ap.Balances[id].AttributeIDs = make([]string, len(bal.AttributeIDs))
- for j, costAttribute := range bal.AttributeIDs {
- ap.Balances[id].AttributeIDs[j] = costAttribute
- }
- }
- if bal.RateProfileIDs != nil {
- ap.Balances[id].RateProfileIDs = make([]string, len(bal.RateProfileIDs))
- for j, costAttribute := range bal.RateProfileIDs {
- ap.Balances[id].RateProfileIDs[j] = costAttribute
- }
- }
- }
- for i, stp := range tpAp.ThresholdIDs {
- ap.ThresholdIDs[i] = stp
- }
- return
-}
-
-func AccountProfileToAPI(ap *utils.AccountProfile) (tpAp *utils.TPAccountProfile) {
- tpAp = &utils.TPAccountProfile{
- Tenant: ap.Tenant,
- ID: ap.ID,
- Weights: ap.Weights.String(";", "&"),
- FilterIDs: make([]string, len(ap.FilterIDs)),
- ActivationInterval: new(utils.TPActivationInterval),
- Balances: make(map[string]*utils.TPAccountBalance, len(ap.Balances)),
- ThresholdIDs: make([]string, len(ap.ThresholdIDs)),
- }
- for i, fli := range ap.FilterIDs {
- tpAp.FilterIDs[i] = fli
- }
- if ap.ActivationInterval != nil {
- if !ap.ActivationInterval.ActivationTime.IsZero() {
- tpAp.ActivationInterval.ActivationTime = ap.ActivationInterval.ActivationTime.Format(time.RFC3339)
- }
- if !ap.ActivationInterval.ExpiryTime.IsZero() {
- tpAp.ActivationInterval.ExpiryTime = ap.ActivationInterval.ExpiryTime.Format(time.RFC3339)
- }
- }
-
- for i, bal := range ap.Balances {
- tpAp.Balances[i] = &utils.TPAccountBalance{
- ID: bal.ID,
- FilterIDs: make([]string, len(bal.FilterIDs)),
- Weights: bal.Weights.String(";", "&"),
- Type: bal.Type,
- CostIncrement: make([]*utils.TPBalanceCostIncrement, len(bal.CostIncrements)),
- AttributeIDs: make([]string, len(bal.AttributeIDs)),
- RateProfileIDs: make([]string, len(bal.RateProfileIDs)),
- UnitFactors: make([]*utils.TPBalanceUnitFactor, len(bal.UnitFactors)),
- }
- for k, fli := range bal.FilterIDs {
- tpAp.Balances[i].FilterIDs[k] = fli
- }
- //there should not be an invalid value of converting into float64
- tpAp.Balances[i].Units, _ = bal.Units.Float64()
- elems := make([]string, 0, len(bal.Opts))
- for k, v := range bal.Opts {
- elems = append(elems, utils.ConcatenatedKey(k, utils.IfaceAsString(v)))
- }
- for k, cIncrement := range bal.CostIncrements {
- tpAp.Balances[i].CostIncrement[k] = &utils.TPBalanceCostIncrement{
- FilterIDs: make([]string, len(cIncrement.FilterIDs)),
- }
- for kk, fli := range cIncrement.FilterIDs {
- tpAp.Balances[i].CostIncrement[k].FilterIDs[kk] = fli
- }
- if cIncrement.Increment != nil {
- //there should not be an invalid value of converting from Decimal into float64
- incr, _ := cIncrement.Increment.Float64()
- tpAp.Balances[i].CostIncrement[k].Increment = &incr
- }
- if cIncrement.FixedFee != nil {
- //there should not be an invalid value of converting from Decimal into float64
- fxdFee, _ := cIncrement.FixedFee.Float64()
- tpAp.Balances[i].CostIncrement[k].FixedFee = &fxdFee
- }
- if cIncrement.RecurrentFee != nil {
- //there should not be an invalid value of converting from Decimal into float64
- rcrFee, _ := cIncrement.RecurrentFee.Float64()
- tpAp.Balances[i].CostIncrement[k].RecurrentFee = &rcrFee
- }
- }
- for k, attrID := range bal.AttributeIDs {
- tpAp.Balances[i].AttributeIDs[k] = attrID
- }
- for k, ratePrfID := range bal.RateProfileIDs {
- tpAp.Balances[i].RateProfileIDs[k] = ratePrfID
- }
- for k, uFactor := range bal.UnitFactors {
- tpAp.Balances[i].UnitFactors[k] = &utils.TPBalanceUnitFactor{
- FilterIDs: make([]string, len(uFactor.FilterIDs)),
- }
- for kk, fli := range uFactor.FilterIDs {
- tpAp.Balances[i].UnitFactors[k].FilterIDs[kk] = fli
- }
- if uFactor.Factor != nil {
- //there should not be an invalid value of converting from Decimal into float64
- untFctr, _ := uFactor.Factor.Float64()
- tpAp.Balances[i].UnitFactors[k].Factor = untFctr
- }
- }
- tpAp.Balances[i].Opts = strings.Join(elems, utils.InfieldSep)
- }
- for i, fli := range ap.ThresholdIDs {
- tpAp.ThresholdIDs[i] = fli
- }
- return
-}
diff --git a/engine/models.go b/engine/models.go
index 5946914af..8e7f0cbbd 100644
--- a/engine/models.go
+++ b/engine/models.go
@@ -588,7 +588,3 @@ type AccountProfileMdl struct {
ThresholdIDs string `index:"16" re:""`
CreatedAt time.Time
}
-
-func (AccountProfileMdl) TableName() string {
- return utils.TBLTPAccountProfiles
-}
diff --git a/engine/storage_csv.go b/engine/storage_csv.go
index 021e5089c..f207a95e8 100644
--- a/engine/storage_csv.go
+++ b/engine/storage_csv.go
@@ -76,7 +76,7 @@ func NewCSVStorage(sep rune,
actionsFn, actiontimingsFn, actiontriggersFn, accountactionsFn,
resProfilesFn, statsFn, thresholdsFn, filterFn, routeProfilesFn,
attributeProfilesFn, chargerProfilesFn, dispatcherProfilesFn, dispatcherHostsFn,
- rateProfilesFn, actionProfilesFn, accountProfilesFn []string) *CSVStorage {
+ rateProfilesFn, actionProfilesFn []string) *CSVStorage {
return &CSVStorage{
sep: sep,
generator: NewCsvFile,
@@ -102,7 +102,6 @@ func NewCSVStorage(sep rune,
dispatcherHostsFn: dispatcherHostsFn,
rateProfilesFn: rateProfilesFn,
actionProfilesFn: actionProfilesFn,
- accountProfilesFn: accountProfilesFn,
}
}
@@ -134,7 +133,6 @@ func NewFileCSVStorage(sep rune, dataPath string) *CSVStorage {
dispatcherhostsPaths := appendName(allFoldersPath, utils.DispatcherHostsCsv)
rateProfilesFn := appendName(allFoldersPath, utils.RateProfilesCsv)
actionProfilesFn := appendName(allFoldersPath, utils.ActionProfilesCsv)
- accountProfilesFn := appendName(allFoldersPath, utils.AccountProfilesCsv)
return NewCSVStorage(sep,
destinationsPaths,
timingsPaths,
@@ -158,7 +156,6 @@ func NewFileCSVStorage(sep rune, dataPath string) *CSVStorage {
dispatcherhostsPaths,
rateProfilesFn,
actionProfilesFn,
- accountProfilesFn,
)
}
@@ -177,7 +174,7 @@ func NewStringCSVStorage(sep rune,
[]string{resProfilesFn}, []string{statsFn}, []string{thresholdsFn}, []string{filterFn},
[]string{routeProfilesFn}, []string{attributeProfilesFn}, []string{chargerProfilesFn},
[]string{dispatcherProfilesFn}, []string{dispatcherHostsFn}, []string{rateProfilesFn},
- []string{actionProfilesFn}, []string{accountProfilesFn})
+ []string{actionProfilesFn})
c.generator = NewCsvString
return c
}
@@ -220,8 +217,7 @@ func NewGoogleCSVStorage(sep rune, spreadsheetID string) (*CSVStorage, error) {
getIfExist(utils.DispatcherProfiles),
getIfExist(utils.DispatcherHosts),
getIfExist(utils.RateProfiles),
- getIfExist(utils.ActionProfiles),
- getIfExist(utils.AccountProfilesString))
+ getIfExist(utils.ActionProfiles))
c.generator = func() csvReaderCloser {
return &csvGoogle{
spreadsheetID: spreadsheetID,
@@ -255,7 +251,6 @@ func NewURLCSVStorage(sep rune, dataPath string) *CSVStorage {
var dispatcherhostsPaths []string
var rateProfilesPaths []string
var actionProfilesPaths []string
- var accountProfilesPaths []string
for _, baseURL := range strings.Split(dataPath, utils.InfieldSep) {
if !strings.HasSuffix(baseURL, utils.CSVSuffix) {
@@ -281,7 +276,6 @@ func NewURLCSVStorage(sep rune, dataPath string) *CSVStorage {
dispatcherhostsPaths = append(dispatcherhostsPaths, joinURL(baseURL, utils.DispatcherHostsCsv))
rateProfilesPaths = append(rateProfilesPaths, joinURL(baseURL, utils.RateProfilesCsv))
actionProfilesPaths = append(actionProfilesPaths, joinURL(baseURL, utils.ActionProfilesCsv))
- accountProfilesPaths = append(accountProfilesPaths, joinURL(baseURL, utils.AccountProfilesCsv))
continue
}
switch {
@@ -329,8 +323,6 @@ func NewURLCSVStorage(sep rune, dataPath string) *CSVStorage {
rateProfilesPaths = append(rateProfilesPaths, baseURL)
case strings.HasSuffix(baseURL, utils.ActionProfilesCsv):
actionProfilesPaths = append(actionProfilesPaths, baseURL)
- case strings.HasSuffix(baseURL, utils.AccountProfilesCsv):
- accountProfilesPaths = append(accountProfilesPaths, baseURL)
}
}
@@ -358,7 +350,6 @@ func NewURLCSVStorage(sep rune, dataPath string) *CSVStorage {
dispatcherhostsPaths,
rateProfilesPaths,
actionProfilesPaths,
- accountProfilesPaths,
)
c.generator = func() csvReaderCloser {
return &csvURL{}
diff --git a/engine/storage_interface.go b/engine/storage_interface.go
index 7f9f15e1b..cfcc17942 100644
--- a/engine/storage_interface.go
+++ b/engine/storage_interface.go
@@ -135,9 +135,6 @@ type DataDB interface {
GetActionProfileDrv(string, string) (*ActionProfile, error)
SetActionProfileDrv(*ActionProfile) error
RemoveActionProfileDrv(string, string) error
- GetAccountProfileDrv(string, string) (*utils.AccountProfile, error)
- SetAccountProfileDrv(profile *utils.AccountProfile) error
- RemoveAccountProfileDrv(string, string) error
}
type StorDB interface {
@@ -189,7 +186,6 @@ type LoadReader interface {
GetTPDispatcherHosts(string, string, string) ([]*utils.TPDispatcherHost, error)
GetTPRateProfiles(string, string, string) ([]*utils.TPRateProfile, error)
GetTPActionProfiles(string, string, string) ([]*utils.TPActionProfile, error)
- GetTPAccountProfiles(string, string, string) ([]*utils.TPAccountProfile, error)
}
type LoadWriter interface {
@@ -216,7 +212,6 @@ type LoadWriter interface {
SetTPDispatcherHosts([]*utils.TPDispatcherHost) error
SetTPRateProfiles([]*utils.TPRateProfile) error
SetTPActionProfiles([]*utils.TPActionProfile) error
- SetTPAccountProfiles([]*utils.TPAccountProfile) error
}
// NewMarshaler returns the marshaler type selected by mrshlerStr
diff --git a/engine/storage_internal_datadb.go b/engine/storage_internal_datadb.go
index 428899c37..1348b7634 100644
--- a/engine/storage_internal_datadb.go
+++ b/engine/storage_internal_datadb.go
@@ -939,23 +939,3 @@ func (iDB *InternalDB) RemoveIndexesDrv(idxItmType, tntCtx, idxKey string) (err
Cache.RemoveWithoutReplicate(idxItmType, utils.ConcatenatedKey(tntCtx, idxKey), cacheCommit(utils.NonTransactional), utils.NonTransactional)
return
}
-
-func (iDB *InternalDB) GetAccountProfileDrv(tenant, id string) (ap *utils.AccountProfile, err error) {
- x, ok := Cache.Get(utils.CacheAccountProfiles, utils.ConcatenatedKey(tenant, id))
- if !ok || x == nil {
- return nil, utils.ErrNotFound
- }
- return x.(*utils.AccountProfile).Clone(), nil
-}
-
-func (iDB *InternalDB) SetAccountProfileDrv(ap *utils.AccountProfile) (err error) {
- Cache.SetWithoutReplicate(utils.CacheAccountProfiles, ap.TenantID(), ap, nil,
- cacheCommit(utils.NonTransactional), utils.NonTransactional)
- return
-}
-
-func (iDB *InternalDB) RemoveAccountProfileDrv(tenant, id string) (err error) {
- Cache.RemoveWithoutReplicate(utils.CacheAccountProfiles, utils.ConcatenatedKey(tenant, id),
- cacheCommit(utils.NonTransactional), utils.NonTransactional)
- return
-}
diff --git a/engine/storage_internal_stordb.go b/engine/storage_internal_stordb.go
index b1e127e64..8fe5a5de8 100644
--- a/engine/storage_internal_stordb.go
+++ b/engine/storage_internal_stordb.go
@@ -607,28 +607,6 @@ func (iDB *InternalDB) GetTPActionProfiles(tpid, tenant, id string) (tpPrfs []*u
return
}
-func (iDB *InternalDB) GetTPAccountProfiles(tpid, tenant, id string) (tpPrfs []*utils.TPAccountProfile, err error) {
- key := tpid
- if tenant != utils.EmptyString {
- key += utils.ConcatenatedKeySep + tenant
- }
- if id != utils.EmptyString {
- key += utils.ConcatenatedKeySep + id
- }
- ids := Cache.GetItemIDs(utils.CacheTBLTPAccountProfiles, key)
- for _, id := range ids {
- x, ok := Cache.Get(utils.CacheTBLTPAccountProfiles, id)
- if !ok || x == nil {
- return nil, utils.ErrNotFound
- }
- tpPrfs = append(tpPrfs, x.(*utils.TPAccountProfile))
- }
- if len(tpPrfs) == 0 {
- return nil, utils.ErrNotFound
- }
- return
-}
-
//implement LoadWriter interface
func (iDB *InternalDB) RemTpData(table, tpid string, args map[string]string) (err error) {
if table == utils.EmptyString {
@@ -902,17 +880,6 @@ func (iDB *InternalDB) SetTPActionProfiles(tpPrfs []*utils.TPActionProfile) (err
return
}
-func (iDB *InternalDB) SetTPAccountProfiles(tpPrfs []*utils.TPAccountProfile) (err error) {
- if len(tpPrfs) == 0 {
- return nil
- }
- for _, tpPrf := range tpPrfs {
- Cache.SetWithoutReplicate(utils.CacheTBLTPAccountProfiles, utils.ConcatenatedKey(tpPrf.TPid, tpPrf.Tenant, tpPrf.ID), tpPrf, nil,
- cacheCommit(utils.NonTransactional), utils.NonTransactional)
- }
- return
-}
-
//implement CdrStorage interface
func (iDB *InternalDB) SetCDR(cdr *CDR, allowUpdate bool) (err error) {
if cdr.OrderID == 0 {
diff --git a/engine/storage_mongo_datadb.go b/engine/storage_mongo_datadb.go
index 384c4a786..09b0a007a 100644
--- a/engine/storage_mongo_datadb.go
+++ b/engine/storage_mongo_datadb.go
@@ -79,7 +79,6 @@ const (
ColRpp = "rate_profiles"
ColApp = "action_profiles"
ColLID = "load_ids"
- ColAnp = "account_profiles"
)
var (
@@ -316,7 +315,7 @@ func (ms *MongoStorage) ensureIndexesForCol(col string) (err error) { // exporte
if err = ms.enusureIndex(col, true, "key"); err != nil {
return
}
- case ColRsP, ColRes, ColSqs, ColSqp, ColTps, ColThs, ColRts, ColAttr, ColFlt, ColCpp, ColDpp, ColDph, ColRpp, ColApp, ColAnp:
+ case ColRsP, ColRes, ColSqs, ColSqp, ColTps, ColThs, ColRts, ColAttr, ColFlt, ColCpp, ColDpp, ColDph, ColRpp, ColApp:
if err = ms.enusureIndex(col, true, "tenant", "id"); err != nil {
return
}
@@ -381,7 +380,7 @@ func (ms *MongoStorage) EnsureIndexes(cols ...string) (err error) {
for _, col := range []string{ColAct, ColApl, ColAAp, ColAtr,
ColRpl, ColDst, ColRds, ColLht, ColIndx, ColRsP, ColRes, ColSqs, ColSqp,
ColTps, ColThs, ColRts, ColAttr, ColFlt, ColCpp, ColDpp, ColRpp, ColApp,
- ColRpf, ColShg, ColAcc, ColAnp} {
+ ColRpf, ColShg, ColAcc} {
if err = ms.ensureIndexesForCol(col); err != nil {
return
}
@@ -642,8 +641,6 @@ func (ms *MongoStorage) GetKeysForPrefix(prefix string) (result []string, err er
result, err = ms.getField2(sctx, ColRpp, utils.RateProfilePrefix, subject, tntID)
case utils.ActionProfilePrefix:
result, err = ms.getField2(sctx, ColApp, utils.ActionProfilePrefix, subject, tntID)
- case utils.AccountProfilePrefix:
- result, err = ms.getField2(sctx, ColAnp, utils.AccountProfilePrefix, subject, tntID)
case utils.DispatcherHostPrefix:
result, err = ms.getField2(sctx, ColDph, utils.DispatcherHostPrefix, subject, tntID)
case utils.AttributeFilterIndexes:
@@ -664,8 +661,6 @@ func (ms *MongoStorage) GetKeysForPrefix(prefix string) (result []string, err er
result, err = ms.getField3(sctx, ColIndx, utils.ActionPlanIndexes, "key")
case utils.ActionProfilesFilterIndexPrfx:
result, err = ms.getField3(sctx, ColIndx, utils.ActionProfilesFilterIndexPrfx, "key")
- case utils.AccountProfileFilterIndexPrfx:
- result, err = ms.getField3(sctx, ColIndx, utils.AccountProfileFilterIndexPrfx, "key")
case utils.RateProfilesFilterIndexPrfx:
result, err = ms.getField3(sctx, ColIndx, utils.RateProfilesFilterIndexPrfx, "key")
case utils.RateFilterIndexPrfx:
@@ -724,8 +719,6 @@ func (ms *MongoStorage) HasDataDrv(category, subject, tenant string) (has bool,
count, err = ms.getCol(ColRpp).CountDocuments(sctx, bson.M{"tenant": tenant, "id": subject})
case utils.ActionProfilePrefix:
count, err = ms.getCol(ColApp).CountDocuments(sctx, bson.M{"tenant": tenant, "id": subject})
- case utils.AccountProfilePrefix:
- count, err = ms.getCol(ColAnp).CountDocuments(sctx, bson.M{"tenant": tenant, "id": subject})
default:
err = fmt.Errorf("unsupported category in HasData: %s", category)
}
@@ -2210,39 +2203,3 @@ func (ms *MongoStorage) RemoveIndexesDrv(idxItmType, tntCtx, idxKey string) (err
return err
})
}
-
-func (ms *MongoStorage) GetAccountProfileDrv(tenant, id string) (ap *utils.AccountProfile, err error) {
- ap = new(utils.AccountProfile)
- err = ms.query(func(sctx mongo.SessionContext) (err error) {
- cur := ms.getCol(ColAnp).FindOne(sctx, bson.M{"tenant": tenant, "id": id})
- if err := cur.Decode(ap); err != nil {
- ap = nil
- if err == mongo.ErrNoDocuments {
- return utils.ErrNotFound
- }
- return err
- }
- return nil
- })
- return
-}
-
-func (ms *MongoStorage) SetAccountProfileDrv(ap *utils.AccountProfile) (err error) {
- return ms.query(func(sctx mongo.SessionContext) (err error) {
- _, err = ms.getCol(ColAnp).UpdateOne(sctx, bson.M{"tenant": ap.Tenant, "id": ap.ID},
- bson.M{"$set": ap},
- options.Update().SetUpsert(true),
- )
- return err
- })
-}
-
-func (ms *MongoStorage) RemoveAccountProfileDrv(tenant, id string) (err error) {
- return ms.query(func(sctx mongo.SessionContext) (err error) {
- dr, err := ms.getCol(ColAnp).DeleteOne(sctx, bson.M{"tenant": tenant, "id": id})
- if dr.DeletedCount == 0 {
- return utils.ErrNotFound
- }
- return err
- })
-}
diff --git a/engine/storage_mongo_stordb.go b/engine/storage_mongo_stordb.go
index 086c214c5..384a34048 100644
--- a/engine/storage_mongo_stordb.go
+++ b/engine/storage_mongo_stordb.go
@@ -1608,36 +1608,6 @@ func (ms *MongoStorage) GetTPActionProfiles(tpid, tenant, id string) ([]*utils.T
return results, err
}
-func (ms *MongoStorage) GetTPAccountProfiles(tpid, tenant, id string) ([]*utils.TPAccountProfile, error) {
- filter := bson.M{"tpid": tpid}
- if id != "" {
- filter["id"] = id
- }
- if tenant != "" {
- filter["tenant"] = tenant
- }
- var results []*utils.TPAccountProfile
- err := ms.query(func(sctx mongo.SessionContext) (err error) {
- cur, err := ms.getCol(utils.TBLTPAccountProfiles).Find(sctx, filter)
- if err != nil {
- return err
- }
- for cur.Next(sctx) {
- var tp utils.TPAccountProfile
- err := cur.Decode(&tp)
- if err != nil {
- return err
- }
- results = append(results, &tp)
- }
- if len(results) == 0 {
- return utils.ErrNotFound
- }
- return cur.Close(sctx)
- })
- return results, err
-}
-
func (ms *MongoStorage) SetTPActionProfiles(tpAps []*utils.TPActionProfile) (err error) {
if len(tpAps) == 0 {
return
@@ -1656,24 +1626,6 @@ func (ms *MongoStorage) SetTPActionProfiles(tpAps []*utils.TPActionProfile) (err
})
}
-func (ms *MongoStorage) SetTPAccountProfiles(tpAps []*utils.TPAccountProfile) (err error) {
- if len(tpAps) == 0 {
- return
- }
- return ms.query(func(sctx mongo.SessionContext) (err error) {
- for _, tp := range tpAps {
- _, err = ms.getCol(utils.TBLTPAccountProfiles).UpdateOne(sctx, bson.M{"tpid": tp.TPid, "id": tp.ID},
- bson.M{"$set": tp},
- options.Update().SetUpsert(true),
- )
- if err != nil {
- return err
- }
- }
- return nil
- })
-}
-
func (ms *MongoStorage) GetVersions(itm string) (vrs Versions, err error) {
fop := options.FindOne()
if itm != "" {
diff --git a/engine/storage_redis.go b/engine/storage_redis.go
index f9f226f45..61feb0bcc 100644
--- a/engine/storage_redis.go
+++ b/engine/storage_redis.go
@@ -1367,27 +1367,3 @@ func (rs *RedisStorage) RemoveIndexesDrv(idxItmType, tntCtx, idxKey string) (err
}
return rs.Cmd(nil, redis_HDEL, utils.CacheInstanceToPrefix[idxItmType]+tntCtx, idxKey)
}
-
-func (rs *RedisStorage) GetAccountProfileDrv(tenant, id string) (ap *utils.AccountProfile, err error) {
- var values []byte
- if err = rs.Cmd(&values, redis_GET, utils.AccountProfilePrefix+utils.ConcatenatedKey(tenant, id)); err != nil {
- return
- } else if len(values) == 0 {
- err = utils.ErrNotFound
- return
- }
- err = rs.ms.Unmarshal(values, &ap)
- return
-}
-
-func (rs *RedisStorage) SetAccountProfileDrv(ap *utils.AccountProfile) (err error) {
- var result []byte
- if result, err = rs.ms.Marshal(ap); err != nil {
- return
- }
- return rs.Cmd(nil, redis_SET, utils.AccountProfilePrefix+utils.ConcatenatedKey(ap.Tenant, ap.ID), string(result))
-}
-
-func (rs *RedisStorage) RemoveAccountProfileDrv(tenant, id string) (err error) {
- return rs.Cmd(nil, redis_DEL, utils.AccountProfilePrefix+utils.ConcatenatedKey(tenant, id))
-}
diff --git a/engine/storage_sql.go b/engine/storage_sql.go
index f30f2e731..dca147c56 100644
--- a/engine/storage_sql.go
+++ b/engine/storage_sql.go
@@ -241,7 +241,7 @@ func (sqls *SQLStorage) RemTpData(table, tpid string, args map[string]string) er
utils.TBLTPSharedGroups, utils.TBLTPActions, utils.TBLTPActionTriggers,
utils.TBLTPAccountActions, utils.TBLTPResources, utils.TBLTPStats, utils.TBLTPThresholds,
utils.TBLTPFilters, utils.TBLTPActionPlans, utils.TBLTPRoutes, utils.TBLTPAttributes,
- utils.TBLTPChargers, utils.TBLTPDispatchers, utils.TBLTPDispatcherHosts, utils.TBLTPAccountProfiles,
+ utils.TBLTPChargers, utils.TBLTPDispatchers, utils.TBLTPDispatcherHosts,
utils.TBLTPActionProfiles, utils.TBLTPRateProfiles} {
if err := tx.Table(tblName).Where("tpid = ?", tpid).Delete(nil).Error; err != nil {
tx.Rollback()
diff --git a/engine/tpexporter.go b/engine/tpexporter.go
index 722521140..61804c0b9 100644
--- a/engine/tpexporter.go
+++ b/engine/tpexporter.go
@@ -344,18 +344,6 @@ func (tpExp *TPExporter) Run() error {
}
}
- storDataAccountProfiles, err := tpExp.storDb.GetTPAccountProfiles(tpExp.tpID, "", "")
- if err != nil && err.Error() != utils.ErrNotFound.Error() {
- utils.Logger.Warning(fmt.Sprintf("<%s> error: %s, when getting %s from stordb for export", utils.ApierS, err, utils.TpAccountProfiles))
- withError = true
- }
- for _, sd := range storDataAccountProfiles {
- sdModels := APItoModelTPAccountProfile(sd)
- for _, sdModel := range sdModels {
- toExportMap[utils.AccountProfilesCsv] = append(toExportMap[utils.AccountProfilesCsv], sdModel)
- }
- }
-
if len(toExportMap) == 0 { // if we don't have anything to export we return not found error
return utils.ErrNotFound
}
diff --git a/engine/tpimporter_csv.go b/engine/tpimporter_csv.go
index 4b25139b1..f146b83c6 100644
--- a/engine/tpimporter_csv.go
+++ b/engine/tpimporter_csv.go
@@ -62,7 +62,6 @@ var fileHandlers = map[string]func(*TPCSVImporter, string) error{
utils.DispatcherHostsCsv: (*TPCSVImporter).importDispatcherHosts,
utils.RateProfilesCsv: (*TPCSVImporter).importRateProfiles,
utils.ActionProfilesCsv: (*TPCSVImporter).importActionProfiles,
- utils.AccountProfilesCsv: (*TPCSVImporter).importAccountProfiles,
}
func (tpImp *TPCSVImporter) Run() error {
@@ -382,14 +381,3 @@ func (tpImp *TPCSVImporter) importActionProfiles(fn string) error {
}
return tpImp.StorDb.SetTPActionProfiles(rpps)
}
-
-func (tpImp *TPCSVImporter) importAccountProfiles(fn string) error {
- if tpImp.Verbose {
- log.Printf("Processing file: <%s> ", fn)
- }
- rpps, err := tpImp.csvr.GetTPAccountProfiles(tpImp.TPid, "", "")
- if err != nil {
- return err
- }
- return tpImp.StorDb.SetTPAccountProfiles(rpps)
-}
diff --git a/engine/tpreader.go b/engine/tpreader.go
index 646e1f858..06505c55b 100644
--- a/engine/tpreader.go
+++ b/engine/tpreader.go
@@ -1327,26 +1327,6 @@ func (tpr *TpReader) LoadActionProfilesFiltered(tag string) (err error) {
return nil
}
-func (tpr *TpReader) LoadAccountProfiles() error {
- return tpr.LoadAccountProfilesFiltered("")
-}
-
-func (tpr *TpReader) LoadAccountProfilesFiltered(tag string) (err error) {
- aps, err := tpr.lr.GetTPAccountProfiles(tpr.tpid, "", tag)
- if err != nil {
- return err
- }
- mapAccountProfiles := make(map[utils.TenantID]*utils.TPAccountProfile)
- for _, ap := range aps {
- if err = verifyInlineFilterS(ap.FilterIDs); err != nil {
- return
- }
- mapAccountProfiles[utils.TenantID{Tenant: ap.Tenant, ID: ap.ID}] = ap
- }
- tpr.accountProfiles = mapAccountProfiles
- return nil
-}
-
func (tpr *TpReader) LoadDispatcherHosts() error {
return tpr.LoadDispatcherHostsFiltered("")
}
@@ -1418,9 +1398,6 @@ func (tpr *TpReader) LoadAll() (err error) {
if err = tpr.LoadActionProfiles(); err != nil && err.Error() != utils.NotFoundCaps {
return
}
- if err = tpr.LoadAccountProfiles(); err != nil && err.Error() != utils.NotFoundCaps {
- return
- }
return nil
}
@@ -1901,25 +1878,6 @@ func (tpr *TpReader) WriteToDatabase(verbose, disableReverse bool) (err error) {
loadIDs[utils.CacheActionProfiles] = loadID
}
- if verbose {
- log.Print("AccountProfiles:")
- }
- for _, tpAP := range tpr.accountProfiles {
- var ap *utils.AccountProfile
- if ap, err = APItoAccountProfile(tpAP, tpr.timezone); err != nil {
- return
- }
- if err = tpr.dm.SetAccountProfile(ap, true); err != nil {
- return
- }
- if verbose {
- log.Print("\t", ap.TenantID())
- }
- }
- if len(tpr.accountProfiles) != 0 {
- loadIDs[utils.CacheAccountProfiles] = loadID
- }
-
if verbose {
log.Print("Timings:")
}
@@ -2436,19 +2394,6 @@ func (tpr *TpReader) RemoveFromDatabase(verbose, disableReverse bool) (err error
}
}
- if verbose {
- log.Print("AccountProfiles:")
- }
- for _, tpAp := range tpr.accountProfiles {
- if err = tpr.dm.RemoveAccountProfile(tpAp.Tenant, tpAp.ID,
- utils.NonTransactional, true); err != nil {
- return
- }
- if verbose {
- log.Print("\t", utils.ConcatenatedKey(tpAp.Tenant, tpAp.ID))
- }
- }
-
if verbose {
log.Print("Timings:")
}
@@ -2558,9 +2503,6 @@ func (tpr *TpReader) RemoveFromDatabase(verbose, disableReverse bool) (err error
if len(tpr.actionProfiles) != 0 {
loadIDs[utils.CacheActionProfiles] = loadID
}
- if len(tpr.accountProfiles) != 0 {
- loadIDs[utils.CacheAccountProfiles] = loadID
- }
if len(tpr.timings) != 0 {
loadIDs[utils.CacheTimings] = loadID
}
@@ -2599,7 +2541,6 @@ func (tpr *TpReader) ReloadCache(caching string, verbose bool, opts map[string]i
ratePrfIDs, _ := tpr.GetLoadedIds(utils.RateProfilePrefix)
actionPrfIDs, _ := tpr.GetLoadedIds(utils.ActionProfilePrefix)
aps, _ := tpr.GetLoadedIds(utils.ActionPlanPrefix)
- accountPrfIDs, _ := tpr.GetLoadedIds(utils.AccountProfilePrefix)
//compose Reload Cache argument
cacheArgs := utils.AttrReloadCacheWithAPIOpts{
@@ -2686,9 +2627,6 @@ func (tpr *TpReader) ReloadCache(caching string, verbose bool, opts map[string]i
if len(actionPrfIDs) != 0 {
cacheIDs = append(cacheIDs, utils.CacheActionProfilesFilterIndexes)
}
- if len(accountPrfIDs) != 0 {
- cacheIDs = append(cacheIDs, utils.CacheAccountProfilesFilterIndexes)
- }
if len(flrIDs) != 0 {
cacheIDs = append(cacheIDs, utils.CacheReverseFilterIndexes)
}
diff --git a/loaders/loader.go b/loaders/loader.go
index fa432f981..fcf25f95f 100644
--- a/loaders/loader.go
+++ b/loaders/loader.go
@@ -639,38 +639,6 @@ func (ldr *Loader) storeLoadedData(loaderType string,
cacheArgs[utils.ActionProfileIDs] = ids
}
}
- case utils.MetaAccountProfiles:
- cacheIDs = []string{utils.CacheAccountProfilesFilterIndexes}
- for _, lDataSet := range lds {
- acpsModels := make(engine.AccountProfileMdls, len(lDataSet))
- for i, ld := range lDataSet {
- acpsModels[i] = new(engine.AccountProfileMdl)
- if err = utils.UpdateStructWithIfaceMap(acpsModels[i], ld); err != nil {
- return
- }
- }
- accountTPModels, err := acpsModels.AsTPAccountProfile()
- if err != nil {
- return err
- }
- for _, tpAcp := range accountTPModels {
- acp, err := engine.APItoAccountProfile(tpAcp, ldr.timezone)
- if err != nil {
- return err
- }
- if ldr.dryRun {
- utils.Logger.Info(
- fmt.Sprintf("<%s-%s> DRY_RUN: AccountProfiles: %s",
- utils.LoaderS, ldr.ldrID, utils.ToJSON(acp)))
- continue
- }
- // get IDs so we can reload in cache
- ids = append(ids, acp.TenantID())
- if err := ldr.dm.SetAccountProfile(acp, true); err != nil {
- return err
- }
- }
- }
}
if len(ldr.cacheConns) != 0 {
@@ -1010,23 +978,6 @@ func (ldr *Loader) removeLoadedData(loaderType string, lds map[string][]LoaderDa
cacheArgs[utils.ActionProfileIDs] = ids
}
}
- case utils.MetaAccountProfiles:
- cacheIDs = []string{utils.CacheAccountProfiles, utils.CacheAccountProfilesFilterIndexes}
- for tntID := range lds {
- if ldr.dryRun {
- utils.Logger.Info(
- fmt.Sprintf("<%s-%s> DRY_RUN: AccountProfileIDs: %s",
- utils.LoaderS, ldr.ldrID, tntID))
- } else {
- tntIDStruct := utils.NewTenantID(tntID)
- // get IDs so we can reload in cache
- ids = append(ids, tntID)
- if err := ldr.dm.RemoveAccountProfile(tntIDStruct.Tenant,
- tntIDStruct.ID, utils.NonTransactional, true); err != nil {
- return err
- }
- }
- }
}
if len(ldr.cacheConns) != 0 {
diff --git a/migrator/account_profiles.go b/migrator/account_profiles.go
deleted file mode 100644
index 2c0c1c952..000000000
--- a/migrator/account_profiles.go
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
-Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments
-Copyright (C) ITsysCOM GmbH
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see
-*/
-
-package migrator
-
-import (
- "fmt"
- "strings"
-
- "github.com/cgrates/cgrates/engine"
-
- "github.com/cgrates/cgrates/utils"
-)
-
-func (m *Migrator) migrateCurrentAccountProfiles() (err error) {
- var ids []string
- ids, err = m.dmIN.DataManager().DataDB().GetKeysForPrefix(utils.AccountProfilePrefix)
- if err != nil {
- return err
- }
- for _, id := range ids {
- tntID := strings.SplitN(strings.TrimPrefix(id, utils.AccountProfilePrefix), utils.InInFieldSep, 2)
- if len(tntID) < 2 {
- return fmt.Errorf("Invalid key <%s> when migrating from account profiles", id)
- }
- ap, err := m.dmIN.DataManager().GetAccountProfile(tntID[0], tntID[1])
- if err != nil {
- return err
- }
- if ap == nil || m.dryRun {
- continue
- }
- if err := m.dmOut.DataManager().SetAccountProfile(ap, true); err != nil {
- return err
- }
- if err := m.dmIN.DataManager().RemoveAccountProfile(tntID[0], tntID[1], utils.NonTransactional, false); err != nil {
- return err
- }
- m.stats[utils.AccountProfilesString]++
- }
- return
-}
-
-func (m *Migrator) migrateAccountProfiles() (err error) {
- var vrs engine.Versions
- current := engine.CurrentDataDBVersions()
- if vrs, err = m.getVersions(utils.AccountProfilesString); err != nil {
- return
- }
- migrated := true
- for {
- version := vrs[utils.AccountProfilesString]
- for {
- switch version {
- default:
- return fmt.Errorf("Unsupported version %v", version)
- case current[utils.AccountProfilesString]:
- migrated = false
- if m.sameDataDB {
- break
- }
- if err = m.migrateCurrentAccountProfiles(); err != nil {
- return
- }
- }
- if version == current[utils.AccountProfilesString] || err == utils.ErrNoMoreData {
- break
- }
- }
- if err == utils.ErrNoMoreData || !migrated {
- break
- }
- m.stats[utils.AccountProfilesString]++
- }
- //All done, update version with current one
- if err = m.setVersions(utils.AccountProfilesString); err != nil {
- return
- }
- return m.ensureIndexesDataDB(engine.ColApp)
-}
diff --git a/migrator/migrator.go b/migrator/migrator.go
index 00c057f1a..d4e0c212f 100755
--- a/migrator/migrator.go
+++ b/migrator/migrator.go
@@ -129,9 +129,6 @@ func (m *Migrator) Migrate(taskIDs []string) (err error, stats map[string]int) {
err = m.migrateFilters()
case utils.MetaRoutes:
err = m.migrateRouteProfiles()
- case utils.MetaAccountProfiles:
- err = m.migrateAccountProfiles()
- //only Move
case utils.MetaRatingPlans:
err = m.migrateRatingPlans()
case utils.MetaRatingProfiles:
diff --git a/utils/consts.go b/utils/consts.go
index edb4aae0f..8dd7243d2 100755
--- a/utils/consts.go
+++ b/utils/consts.go
@@ -55,55 +55,53 @@ var (
CacheResourceFilterIndexes, CacheStatFilterIndexes, CacheThresholdFilterIndexes, CacheRouteFilterIndexes,
CacheAttributeFilterIndexes, CacheChargerFilterIndexes, CacheDispatcherFilterIndexes, CacheLoadIDs,
CacheRatingProfilesTmp, CacheRateProfiles, CacheRateProfilesFilterIndexes, CacheRateFilterIndexes,
- CacheActionProfilesFilterIndexes, CacheAccountProfilesFilterIndexes, CacheReverseFilterIndexes,
- CacheActionPlans, CacheAccountActionPlans, CacheAccountProfiles, CacheAccounts})
+ CacheActionProfilesFilterIndexes, CacheReverseFilterIndexes,
+ CacheActionPlans, CacheAccountActionPlans, CacheAccounts})
storDBPartition = NewStringSet([]string{CacheTBLTPTimings, CacheTBLTPDestinations, CacheTBLTPRates, CacheTBLTPDestinationRates,
CacheTBLTPRatingPlans, CacheTBLTPRatingProfiles, CacheTBLTPSharedGroups, CacheTBLTPActions,
CacheTBLTPActionPlans, CacheTBLTPActionTriggers, CacheTBLTPAccountActions, CacheTBLTPResources,
CacheTBLTPStats, CacheTBLTPThresholds, CacheTBLTPFilters, CacheSessionCostsTBL, CacheCDRsTBL,
CacheTBLTPRoutes, CacheTBLTPAttributes, CacheTBLTPChargers, CacheTBLTPDispatchers,
- CacheTBLTPDispatcherHosts, CacheTBLTPRateProfiles, CacheTBLTPActionProfiles, CacheTBLTPAccountProfiles})
+ CacheTBLTPDispatcherHosts, CacheTBLTPRateProfiles, CacheTBLTPActionProfiles})
// CachePartitions enables creation of cache partitions
CachePartitions = JoinStringSet(extraDBPartition, dataDBPartition, storDBPartition)
CacheInstanceToPrefix = map[string]string{
- CacheDestinations: DestinationPrefix,
- CacheReverseDestinations: ReverseDestinationPrefix,
- CacheRatingPlans: RatingPlanPrefix,
- CacheRatingProfiles: RatingProfilePrefix,
- CacheActions: ActionPrefix,
- CacheActionPlans: ActionPlanPrefix,
- CacheAccountActionPlans: AccountActionPlansPrefix,
- CacheActionTriggers: ActionTriggerPrefix,
- CacheSharedGroups: SharedGroupPrefix,
- CacheResourceProfiles: ResourceProfilesPrefix,
- CacheResources: ResourcesPrefix,
- CacheTimings: TimingsPrefix,
- CacheStatQueueProfiles: StatQueueProfilePrefix,
- CacheStatQueues: StatQueuePrefix,
- CacheThresholdProfiles: ThresholdProfilePrefix,
- CacheThresholds: ThresholdPrefix,
- CacheFilters: FilterPrefix,
- CacheRouteProfiles: RouteProfilePrefix,
- CacheAttributeProfiles: AttributeProfilePrefix,
- CacheChargerProfiles: ChargerProfilePrefix,
- CacheDispatcherProfiles: DispatcherProfilePrefix,
- CacheDispatcherHosts: DispatcherHostPrefix,
- CacheRateProfiles: RateProfilePrefix,
- CacheActionProfiles: ActionProfilePrefix,
- CacheAccountProfiles: AccountProfilePrefix,
- CacheResourceFilterIndexes: ResourceFilterIndexes,
- CacheStatFilterIndexes: StatFilterIndexes,
- CacheThresholdFilterIndexes: ThresholdFilterIndexes,
- CacheRouteFilterIndexes: RouteFilterIndexes,
- CacheAttributeFilterIndexes: AttributeFilterIndexes,
- CacheChargerFilterIndexes: ChargerFilterIndexes,
- CacheDispatcherFilterIndexes: DispatcherFilterIndexes,
- CacheRateProfilesFilterIndexes: RateProfilesFilterIndexPrfx,
- CacheActionProfilesFilterIndexes: ActionProfilesFilterIndexPrfx,
- CacheAccountProfilesFilterIndexes: AccountProfileFilterIndexPrfx,
+ CacheDestinations: DestinationPrefix,
+ CacheReverseDestinations: ReverseDestinationPrefix,
+ CacheRatingPlans: RatingPlanPrefix,
+ CacheRatingProfiles: RatingProfilePrefix,
+ CacheActions: ActionPrefix,
+ CacheActionPlans: ActionPlanPrefix,
+ CacheAccountActionPlans: AccountActionPlansPrefix,
+ CacheActionTriggers: ActionTriggerPrefix,
+ CacheSharedGroups: SharedGroupPrefix,
+ CacheResourceProfiles: ResourceProfilesPrefix,
+ CacheResources: ResourcesPrefix,
+ CacheTimings: TimingsPrefix,
+ CacheStatQueueProfiles: StatQueueProfilePrefix,
+ CacheStatQueues: StatQueuePrefix,
+ CacheThresholdProfiles: ThresholdProfilePrefix,
+ CacheThresholds: ThresholdPrefix,
+ CacheFilters: FilterPrefix,
+ CacheRouteProfiles: RouteProfilePrefix,
+ CacheAttributeProfiles: AttributeProfilePrefix,
+ CacheChargerProfiles: ChargerProfilePrefix,
+ CacheDispatcherProfiles: DispatcherProfilePrefix,
+ CacheDispatcherHosts: DispatcherHostPrefix,
+ CacheRateProfiles: RateProfilePrefix,
+ CacheActionProfiles: ActionProfilePrefix,
+ CacheResourceFilterIndexes: ResourceFilterIndexes,
+ CacheStatFilterIndexes: StatFilterIndexes,
+ CacheThresholdFilterIndexes: ThresholdFilterIndexes,
+ CacheRouteFilterIndexes: RouteFilterIndexes,
+ CacheAttributeFilterIndexes: AttributeFilterIndexes,
+ CacheChargerFilterIndexes: ChargerFilterIndexes,
+ CacheDispatcherFilterIndexes: DispatcherFilterIndexes,
+ CacheRateProfilesFilterIndexes: RateProfilesFilterIndexPrfx,
+ CacheActionProfilesFilterIndexes: ActionProfilesFilterIndexPrfx,
CacheLoadIDs: LoadIDPrefix,
CacheAccounts: AccountPrefix,
@@ -113,18 +111,17 @@ var (
}
CachePrefixToInstance map[string]string // will be built on init
CacheIndexesToPrefix = map[string]string{ // used by match index to get all the ids when index selects is disabled and for compute indexes
- CacheThresholdFilterIndexes: ThresholdProfilePrefix,
- CacheResourceFilterIndexes: ResourceProfilesPrefix,
- CacheStatFilterIndexes: StatQueueProfilePrefix,
- CacheRouteFilterIndexes: RouteProfilePrefix,
- CacheAttributeFilterIndexes: AttributeProfilePrefix,
- CacheChargerFilterIndexes: ChargerProfilePrefix,
- CacheDispatcherFilterIndexes: DispatcherProfilePrefix,
- CacheRateProfilesFilterIndexes: RateProfilePrefix,
- CacheRateFilterIndexes: RatePrefix,
- CacheActionProfilesFilterIndexes: ActionProfilePrefix,
- CacheAccountProfilesFilterIndexes: AccountProfilePrefix,
- CacheReverseFilterIndexes: FilterPrefix,
+ CacheThresholdFilterIndexes: ThresholdProfilePrefix,
+ CacheResourceFilterIndexes: ResourceProfilesPrefix,
+ CacheStatFilterIndexes: StatQueueProfilePrefix,
+ CacheRouteFilterIndexes: RouteProfilePrefix,
+ CacheAttributeFilterIndexes: AttributeProfilePrefix,
+ CacheChargerFilterIndexes: ChargerProfilePrefix,
+ CacheDispatcherFilterIndexes: DispatcherProfilePrefix,
+ CacheRateProfilesFilterIndexes: RateProfilePrefix,
+ CacheRateFilterIndexes: RatePrefix,
+ CacheActionProfilesFilterIndexes: ActionProfilePrefix,
+ CacheReverseFilterIndexes: FilterPrefix,
}
CacheInstanceToCacheIndex = map[string]string{
@@ -172,7 +169,6 @@ var (
TBLTPDispatcherHosts: CacheTBLTPDispatcherHosts,
TBLTPRateProfiles: CacheTBLTPRateProfiles,
TBLTPActionProfiles: CacheTBLTPActionProfiles,
- TBLTPAccountProfiles: CacheTBLTPAccountProfiles,
}
// ProtectedSFlds are the fields that sessions should not alter
ProtectedSFlds = NewStringSet([]string{CGRID, OriginHost, OriginID, Usage})
@@ -201,19 +197,18 @@ var (
RateProfileIDs: RateProfilePrefix,
ActionProfileIDs: ActionProfilePrefix,
- TimingIDs: TimingsPrefix,
- AttributeFilterIndexIDs: AttributeFilterIndexes,
- ResourceFilterIndexIDs: ResourceFilterIndexes,
- StatFilterIndexIDs: StatFilterIndexes,
- ThresholdFilterIndexIDs: ThresholdFilterIndexes,
- RouteFilterIndexIDs: RouteFilterIndexes,
- ChargerFilterIndexIDs: ChargerFilterIndexes,
- DispatcherFilterIndexIDs: DispatcherFilterIndexes,
- RateProfilesFilterIndexIDs: RateProfilesFilterIndexPrfx,
- RateFilterIndexIDs: RateFilterIndexPrfx,
- ActionProfilesFilterIndexIDs: ActionProfilesFilterIndexPrfx,
- AccountProfilesFilterIndexIDs: AccountProfileFilterIndexPrfx,
- FilterIndexIDs: FilterIndexPrfx,
+ TimingIDs: TimingsPrefix,
+ AttributeFilterIndexIDs: AttributeFilterIndexes,
+ ResourceFilterIndexIDs: ResourceFilterIndexes,
+ StatFilterIndexIDs: StatFilterIndexes,
+ ThresholdFilterIndexIDs: ThresholdFilterIndexes,
+ RouteFilterIndexIDs: RouteFilterIndexes,
+ ChargerFilterIndexIDs: ChargerFilterIndexes,
+ DispatcherFilterIndexIDs: DispatcherFilterIndexes,
+ RateProfilesFilterIndexIDs: RateProfilesFilterIndexPrfx,
+ RateFilterIndexIDs: RateFilterIndexPrfx,
+ ActionProfilesFilterIndexIDs: ActionProfilesFilterIndexPrfx,
+ FilterIndexIDs: FilterIndexPrfx,
}
CacheInstanceToArg map[string]string
ArgCacheToInstance = map[string]string{
@@ -241,19 +236,18 @@ var (
RateProfileIDs: CacheRateProfiles,
ActionProfileIDs: CacheActionProfiles,
- TimingIDs: CacheTimings,
- AttributeFilterIndexIDs: CacheAttributeFilterIndexes,
- ResourceFilterIndexIDs: CacheResourceFilterIndexes,
- StatFilterIndexIDs: CacheStatFilterIndexes,
- ThresholdFilterIndexIDs: CacheThresholdFilterIndexes,
- RouteFilterIndexIDs: CacheRouteFilterIndexes,
- ChargerFilterIndexIDs: CacheChargerFilterIndexes,
- DispatcherFilterIndexIDs: CacheDispatcherFilterIndexes,
- RateProfilesFilterIndexIDs: CacheRateProfilesFilterIndexes,
- RateFilterIndexIDs: CacheRateFilterIndexes,
- FilterIndexIDs: CacheReverseFilterIndexes,
- ActionProfilesFilterIndexIDs: CacheActionProfilesFilterIndexes,
- AccountProfilesFilterIndexIDs: CacheAccountProfilesFilterIndexes,
+ TimingIDs: CacheTimings,
+ AttributeFilterIndexIDs: CacheAttributeFilterIndexes,
+ ResourceFilterIndexIDs: CacheResourceFilterIndexes,
+ StatFilterIndexIDs: CacheStatFilterIndexes,
+ ThresholdFilterIndexIDs: CacheThresholdFilterIndexes,
+ RouteFilterIndexIDs: CacheRouteFilterIndexes,
+ ChargerFilterIndexIDs: CacheChargerFilterIndexes,
+ DispatcherFilterIndexIDs: CacheDispatcherFilterIndexes,
+ RateProfilesFilterIndexIDs: CacheRateProfilesFilterIndexes,
+ RateFilterIndexIDs: CacheRateFilterIndexes,
+ FilterIndexIDs: CacheReverseFilterIndexes,
+ ActionProfilesFilterIndexIDs: CacheActionProfilesFilterIndexes,
}
ConcurrentReqsLimit int
ConcurrentReqsStrategy string
@@ -405,7 +399,6 @@ const (
DispatcherProfilePrefix = "dpp_"
RateProfilePrefix = "rtp_"
ActionProfilePrefix = "acp_"
- AccountProfilePrefix = "anp_"
DispatcherHostPrefix = "dph_"
ThresholdProfilePrefix = "thp_"
StatQueuePrefix = "stq_"
@@ -565,7 +558,6 @@ const (
DispatcherHosts = "DispatcherHosts"
RateProfiles = "RateProfiles"
ActionProfiles = "ActionProfiles"
- AccountProfilesString = "AccountProfiles"
MetaEveryMinute = "*every_minute"
MetaHourly = "*hourly"
ID = "ID"
@@ -1005,7 +997,6 @@ const (
MetaRoutes = "*routes"
MetaAttributes = "*attributes"
MetaActionProfiles = "*action_profiles"
- MetaAccountProfiles = "*account_profiles"
MetaLoadIDs = "*load_ids"
)
@@ -1176,7 +1167,6 @@ const (
TpDispatcherHosts = "TpDispatcherHosts"
TpRateProfiles = "TpRateProfiles"
TpActionProfiles = "TpActionProfiles"
- TpAccountProfiles = "TpAccountProfiles"
)
// Dispatcher Const
@@ -1268,7 +1258,6 @@ const (
ReplicatorSv1GetRateProfile = "ReplicatorSv1.GetRateProfile"
ReplicatorSv1GetActionProfile = "ReplicatorSv1.GetActionProfile"
ReplicatorSv1GetDispatcherHost = "ReplicatorSv1.GetDispatcherHost"
- ReplicatorSv1GetAccountProfile = "ReplicatorSv1.GetAccountProfile"
ReplicatorSv1GetItemLoadIDs = "ReplicatorSv1.GetItemLoadIDs"
ReplicatorSv1SetThresholdProfile = "ReplicatorSv1.SetThresholdProfile"
ReplicatorSv1SetThreshold = "ReplicatorSv1.SetThreshold"
@@ -1294,7 +1283,6 @@ const (
ReplicatorSv1SetDispatcherProfile = "ReplicatorSv1.SetDispatcherProfile"
ReplicatorSv1SetRateProfile = "ReplicatorSv1.SetRateProfile"
ReplicatorSv1SetActionProfile = "ReplicatorSv1.SetActionProfile"
- ReplicatorSv1SetAccountProfile = "ReplicatorSv1.SetAccountProfile"
ReplicatorSv1SetDispatcherHost = "ReplicatorSv1.SetDispatcherHost"
ReplicatorSv1SetLoadIDs = "ReplicatorSv1.SetLoadIDs"
ReplicatorSv1RemoveThreshold = "ReplicatorSv1.RemoveThreshold"
@@ -1321,7 +1309,6 @@ const (
ReplicatorSv1RemoveRateProfile = "ReplicatorSv1.RemoveRateProfile"
ReplicatorSv1RemoveActionProfile = "ReplicatorSv1.RemoveActionProfile"
ReplicatorSv1RemoveDispatcherHost = "ReplicatorSv1.RemoveDispatcherHost"
- ReplicatorSv1RemoveAccountProfile = "ReplicatorSv1.RemoveAccountProfile"
ReplicatorSv1GetIndexes = "ReplicatorSv1.GetIndexes"
ReplicatorSv1SetIndexes = "ReplicatorSv1.SetIndexes"
ReplicatorSv1RemoveIndexes = "ReplicatorSv1.RemoveIndexes"
@@ -1501,15 +1488,6 @@ const (
APIerSv1SetTPRateProfile = "APIerSv1.SetTPRateProfile"
APIerSv1GetTPRateProfileIds = "APIerSv1.GetTPRateProfileIds"
APIerSv1RemoveTPRateProfile = "APIerSv1.RemoveTPRateProfile"
- APIerSv1SetAccountProfile = "APIerSv1.SetAccountProfile"
- APIerSv1GetAccountProfile = "APIerSv1.GetAccountProfile"
- APIerSv1GetAccountProfileIDs = "APIerSv1.GetAccountProfileIDs"
- APIerSv1RemoveAccountProfile = "APIerSv1.RemoveAccountProfile"
- APIerSv1GetAccountProfileIDsCount = "APIerSv1.GetAccountProfileIDsCount"
- APIerSv1GetTPAccountProfileIDs = "APIerSv1.GetTPAccountProfileIDs"
- APIerSv1GetTPAccountProfile = "APIerSv1.GetTPAccountProfile"
- APIerSv1SetTPAccountProfile = "APIerSv1.SetTPAccountProfile"
- APIerSv1RemoveTPAccountProfile = "APIerSv1.RemoveTPAccountProfile"
)
// APIerSv1 TP APIs
@@ -1585,15 +1563,14 @@ const (
)
const (
- AccountSv1 = "AccountSv1"
- AccountSv1Ping = "AccountSv1.Ping"
- AccountSv1AccountProfilesForEvent = "AccountSv1.AccountProfilesForEvent"
- AccountSv1MaxAbstracts = "AccountSv1.MaxAbstracts"
- AccountSv1DebitAbstracts = "AccountSv1.DebitAbstracts"
- AccountSv1MaxConcretes = "AccountSv1.MaxConcretes"
- AccountSv1DebitConcretes = "AccountSv1.DebitConcretes"
- AccountSv1ActionSetBalance = "AccountSv1.ActionSetBalance"
- AccountSv1ActionRemoveBalance = "AccountSv1.ActionRemoveBalance"
+ AccountSv1 = "AccountSv1"
+ AccountSv1Ping = "AccountSv1.Ping"
+ AccountSv1MaxAbstracts = "AccountSv1.MaxAbstracts"
+ AccountSv1DebitAbstracts = "AccountSv1.DebitAbstracts"
+ AccountSv1MaxConcretes = "AccountSv1.MaxConcretes"
+ AccountSv1DebitConcretes = "AccountSv1.DebitConcretes"
+ AccountSv1ActionSetBalance = "AccountSv1.ActionSetBalance"
+ AccountSv1ActionRemoveBalance = "AccountSv1.ActionRemoveBalance"
)
const (
@@ -1891,7 +1868,6 @@ const (
DispatcherHostsCsv = "DispatcherHosts.csv"
RateProfilesCsv = "RateProfiles.csv"
ActionProfilesCsv = "ActionProfiles.csv"
- AccountProfilesCsv = "AccountProfiles.csv"
)
// Table Name
@@ -1922,68 +1898,65 @@ const (
TBLTPDispatcherHosts = "tp_dispatcher_hosts"
TBLTPRateProfiles = "tp_rate_profiles"
TBLTPActionProfiles = "tp_action_profiles"
- TBLTPAccountProfiles = "tp_account_profiles"
)
// Cache Name
const (
- CacheDestinations = "*destinations"
- CacheReverseDestinations = "*reverse_destinations"
- CacheRatingPlans = "*rating_plans"
- CacheRatingProfiles = "*rating_profiles"
- CacheActions = "*actions"
- CacheActionPlans = "*action_plans"
- CacheAccountActionPlans = "*account_action_plans"
- CacheActionTriggers = "*action_triggers"
- CacheSharedGroups = "*shared_groups"
- CacheResources = "*resources"
- CacheResourceProfiles = "*resource_profiles"
- CacheTimings = "*timings"
- CacheEventResources = "*event_resources"
- CacheStatQueueProfiles = "*statqueue_profiles"
- CacheStatQueues = "*statqueues"
- CacheThresholdProfiles = "*threshold_profiles"
- CacheThresholds = "*thresholds"
- CacheFilters = "*filters"
- CacheRouteProfiles = "*route_profiles"
- CacheAttributeProfiles = "*attribute_profiles"
- CacheChargerProfiles = "*charger_profiles"
- CacheDispatcherProfiles = "*dispatcher_profiles"
- CacheDispatcherHosts = "*dispatcher_hosts"
- CacheDispatchers = "*dispatchers"
- CacheDispatcherRoutes = "*dispatcher_routes"
- CacheDispatcherLoads = "*dispatcher_loads"
- CacheRateProfiles = "*rate_profiles"
- CacheActionProfiles = "*action_profiles"
- CacheAccountProfiles = "*account_profiles"
- CacheResourceFilterIndexes = "*resource_filter_indexes"
- CacheStatFilterIndexes = "*stat_filter_indexes"
- CacheThresholdFilterIndexes = "*threshold_filter_indexes"
- CacheRouteFilterIndexes = "*route_filter_indexes"
- CacheAttributeFilterIndexes = "*attribute_filter_indexes"
- CacheChargerFilterIndexes = "*charger_filter_indexes"
- CacheDispatcherFilterIndexes = "*dispatcher_filter_indexes"
- CacheDiameterMessages = "*diameter_messages"
- CacheRPCResponses = "*rpc_responses"
- CacheClosedSessions = "*closed_sessions"
- CacheRateProfilesFilterIndexes = "*rate_profile_filter_indexes"
- CacheActionProfilesFilterIndexes = "*action_profile_filter_indexes"
- CacheAccountProfilesFilterIndexes = "*account_profile_filter_indexes"
- CacheRateFilterIndexes = "*rate_filter_indexes"
- MetaPrecaching = "*precaching"
- MetaReady = "*ready"
- CacheLoadIDs = "*load_ids"
- CacheRPCConnections = "*rpc_connections"
- CacheCDRIDs = "*cdr_ids"
- CacheRatingProfilesTmp = "*tmp_rating_profiles"
- CacheUCH = "*uch"
- CacheSTIR = "*stir"
- CacheEventCharges = "*event_charges"
- CacheReverseFilterIndexes = "*reverse_filter_indexes"
- CacheAccounts = "*accounts"
- CacheVersions = "*versions"
- CacheCapsEvents = "*caps_events"
- CacheReplicationHosts = "*replication_hosts"
+ CacheDestinations = "*destinations"
+ CacheReverseDestinations = "*reverse_destinations"
+ CacheRatingPlans = "*rating_plans"
+ CacheRatingProfiles = "*rating_profiles"
+ CacheActions = "*actions"
+ CacheActionPlans = "*action_plans"
+ CacheAccountActionPlans = "*account_action_plans"
+ CacheActionTriggers = "*action_triggers"
+ CacheSharedGroups = "*shared_groups"
+ CacheResources = "*resources"
+ CacheResourceProfiles = "*resource_profiles"
+ CacheTimings = "*timings"
+ CacheEventResources = "*event_resources"
+ CacheStatQueueProfiles = "*statqueue_profiles"
+ CacheStatQueues = "*statqueues"
+ CacheThresholdProfiles = "*threshold_profiles"
+ CacheThresholds = "*thresholds"
+ CacheFilters = "*filters"
+ CacheRouteProfiles = "*route_profiles"
+ CacheAttributeProfiles = "*attribute_profiles"
+ CacheChargerProfiles = "*charger_profiles"
+ CacheDispatcherProfiles = "*dispatcher_profiles"
+ CacheDispatcherHosts = "*dispatcher_hosts"
+ CacheDispatchers = "*dispatchers"
+ CacheDispatcherRoutes = "*dispatcher_routes"
+ CacheDispatcherLoads = "*dispatcher_loads"
+ CacheRateProfiles = "*rate_profiles"
+ CacheActionProfiles = "*action_profiles"
+ CacheResourceFilterIndexes = "*resource_filter_indexes"
+ CacheStatFilterIndexes = "*stat_filter_indexes"
+ CacheThresholdFilterIndexes = "*threshold_filter_indexes"
+ CacheRouteFilterIndexes = "*route_filter_indexes"
+ CacheAttributeFilterIndexes = "*attribute_filter_indexes"
+ CacheChargerFilterIndexes = "*charger_filter_indexes"
+ CacheDispatcherFilterIndexes = "*dispatcher_filter_indexes"
+ CacheDiameterMessages = "*diameter_messages"
+ CacheRPCResponses = "*rpc_responses"
+ CacheClosedSessions = "*closed_sessions"
+ CacheRateProfilesFilterIndexes = "*rate_profile_filter_indexes"
+ CacheActionProfilesFilterIndexes = "*action_profile_filter_indexes"
+ CacheRateFilterIndexes = "*rate_filter_indexes"
+ MetaPrecaching = "*precaching"
+ MetaReady = "*ready"
+ CacheLoadIDs = "*load_ids"
+ CacheRPCConnections = "*rpc_connections"
+ CacheCDRIDs = "*cdr_ids"
+ CacheRatingProfilesTmp = "*tmp_rating_profiles"
+ CacheUCH = "*uch"
+ CacheSTIR = "*stir"
+ CacheEventCharges = "*event_charges"
+ CacheReverseFilterIndexes = "*reverse_filter_indexes"
+ CacheAccounts = "*accounts"
+ CacheVersions = "*versions"
+ CacheCapsEvents = "*caps_events"
+ CacheReplicationHosts = "*replication_hosts"
// storDB
CacheTBLTPTimings = "*tp_timings"
@@ -2010,7 +1983,6 @@ const (
CacheTBLTPDispatcherHosts = "*tp_dispatcher_hosts"
CacheTBLTPRateProfiles = "*tp_rate_profiles"
CacheTBLTPActionProfiles = "*tp_action_profiles"
- CacheTBLTPAccountProfiles = "*tp_account_profiles"
)
// Prefix for indexing
@@ -2026,7 +1998,6 @@ const (
RateProfilesFilterIndexPrfx = "rpi_"
RateFilterIndexPrfx = "rri_"
ActionProfilesFilterIndexPrfx = "aci_"
- AccountProfileFilterIndexPrfx = "ani_"
FilterIndexPrfx = "fii_"
)
@@ -2635,43 +2606,42 @@ const (
// ArgCache constats
const (
- DestinationIDs = "DestinationIDs"
- ReverseDestinationIDs = "ReverseDestinationIDs"
- RatingPlanIDs = "RatingPlanIDs"
- RatingProfileIDs = "RatingProfileIDs"
- ActionIDs = "ActionIDs"
- ActionPlanIDs = "ActionPlanIDs"
- AccountActionPlanIDs = "AccountActionPlanIDs"
- ActionTriggerIDs = "ActionTriggerIDs"
- SharedGroupIDs = "SharedGroupIDs"
- ResourceProfileIDs = "ResourceProfileIDs"
- ResourceIDs = "ResourceIDs"
- StatsQueueIDs = "StatsQueueIDs"
- StatsQueueProfileIDs = "StatsQueueProfileIDs"
- ThresholdIDs = "ThresholdIDs"
- ThresholdProfileIDs = "ThresholdProfileIDs"
- FilterIDs = "FilterIDs"
- RouteProfileIDs = "RouteProfileIDs"
- AttributeProfileIDs = "AttributeProfileIDs"
- ChargerProfileIDs = "ChargerProfileIDs"
- DispatcherProfileIDs = "DispatcherProfileIDs"
- DispatcherHostIDs = "DispatcherHostIDs"
- DispatcherRoutesIDs = "DispatcherRoutesIDs"
- RateProfileIDs = "RateProfileIDs"
- ActionProfileIDs = "ActionProfileIDs"
- TimingIDs = "TimingIDs"
- AttributeFilterIndexIDs = "AttributeFilterIndexIDs"
- ResourceFilterIndexIDs = "ResourceFilterIndexIDs"
- StatFilterIndexIDs = "StatFilterIndexIDs"
- ThresholdFilterIndexIDs = "ThresholdFilterIndexIDs"
- RouteFilterIndexIDs = "RouteFilterIndexIDs"
- ChargerFilterIndexIDs = "ChargerFilterIndexIDs"
- DispatcherFilterIndexIDs = "DispatcherFilterIndexIDs"
- RateProfilesFilterIndexIDs = "RateProfilesFilterIndexIDs"
- RateFilterIndexIDs = "RateFilterIndexIDs"
- ActionProfilesFilterIndexIDs = "ActionProfilesFilterIndexIDs"
- AccountProfilesFilterIndexIDs = "AccountProfilesFilterIndexIDs"
- FilterIndexIDs = "FilterIndexIDs"
+ DestinationIDs = "DestinationIDs"
+ ReverseDestinationIDs = "ReverseDestinationIDs"
+ RatingPlanIDs = "RatingPlanIDs"
+ RatingProfileIDs = "RatingProfileIDs"
+ ActionIDs = "ActionIDs"
+ ActionPlanIDs = "ActionPlanIDs"
+ AccountActionPlanIDs = "AccountActionPlanIDs"
+ ActionTriggerIDs = "ActionTriggerIDs"
+ SharedGroupIDs = "SharedGroupIDs"
+ ResourceProfileIDs = "ResourceProfileIDs"
+ ResourceIDs = "ResourceIDs"
+ StatsQueueIDs = "StatsQueueIDs"
+ StatsQueueProfileIDs = "StatsQueueProfileIDs"
+ ThresholdIDs = "ThresholdIDs"
+ ThresholdProfileIDs = "ThresholdProfileIDs"
+ FilterIDs = "FilterIDs"
+ RouteProfileIDs = "RouteProfileIDs"
+ AttributeProfileIDs = "AttributeProfileIDs"
+ ChargerProfileIDs = "ChargerProfileIDs"
+ DispatcherProfileIDs = "DispatcherProfileIDs"
+ DispatcherHostIDs = "DispatcherHostIDs"
+ DispatcherRoutesIDs = "DispatcherRoutesIDs"
+ RateProfileIDs = "RateProfileIDs"
+ ActionProfileIDs = "ActionProfileIDs"
+ TimingIDs = "TimingIDs"
+ AttributeFilterIndexIDs = "AttributeFilterIndexIDs"
+ ResourceFilterIndexIDs = "ResourceFilterIndexIDs"
+ StatFilterIndexIDs = "StatFilterIndexIDs"
+ ThresholdFilterIndexIDs = "ThresholdFilterIndexIDs"
+ RouteFilterIndexIDs = "RouteFilterIndexIDs"
+ ChargerFilterIndexIDs = "ChargerFilterIndexIDs"
+ DispatcherFilterIndexIDs = "DispatcherFilterIndexIDs"
+ RateProfilesFilterIndexIDs = "RateProfilesFilterIndexIDs"
+ RateFilterIndexIDs = "RateFilterIndexIDs"
+ ActionProfilesFilterIndexIDs = "ActionProfilesFilterIndexIDs"
+ FilterIndexIDs = "FilterIndexIDs"
)
// Poster and Event reader constants
diff --git a/utils/eventcharges.go b/utils/eventcharges.go
index 4626d5d64..2151bc10c 100644
--- a/utils/eventcharges.go
+++ b/utils/eventcharges.go
@@ -25,9 +25,8 @@ import (
// NewEventChargers instantiates the EventChargers in a central place
func NewEventCharges() (ec *EventCharges) {
ec = &EventCharges{
- Accounting: make(map[string]*AccountCharge),
- UnitFactors: make(map[string]*UnitFactor),
- Rating: make(map[string]*RateSInterval),
+ Accounting: make(map[string]*AccountCharge),
+ Rating: make(map[string]*RateSInterval),
}
return
}
@@ -38,11 +37,9 @@ type EventCharges struct {
Concretes *Decimal // total concrete units charged
ChargingIntervals []*ChargingInterval
- Accounts []*AccountProfile
- Accounting map[string]*AccountCharge
- UnitFactors map[string]*UnitFactor
- Rating map[string]*RateSInterval
+ Accounting map[string]*AccountCharge
+ Rating map[string]*RateSInterval
}
// Merge will merge the event charges into existing
@@ -70,16 +67,6 @@ func (ec *EventCharges) SyncIDs(eCs ...*EventCharges) {
nEcAcntChrg := nEc.Accounting[cIcrm.AccountChargeID]
- // UnitFactors
- if nEcAcntChrg.UnitFactorID != EmptyString {
- if uFctID := ec.UnitFactorID(nEc.UnitFactors[nEcAcntChrg.UnitFactorID]); uFctID != EmptyString &&
- uFctID != nEcAcntChrg.UnitFactorID {
- nEc.UnitFactors[uFctID] = ec.UnitFactors[uFctID]
- delete(nEc.UnitFactors, nEcAcntChrg.UnitFactorID)
- nEcAcntChrg.UnitFactorID = uFctID
- }
- }
-
// Rating
if nEcAcntChrg.RatingID != EmptyString {
if rtID := ec.RatingID(nEc.Rating[nEcAcntChrg.RatingID]); rtID != EmptyString &&
@@ -150,16 +137,6 @@ func (ec *EventCharges) AsExtEventCharges() (eEc *ExtEventCharges, err error) {
return
}
-// UnitFactorID returns the ID of the matching UnitFactor within ec.UnitFactors
-func (ec *EventCharges) UnitFactorID(uF *UnitFactor) (ufID string) {
- for ecUfID, ecUf := range ec.UnitFactors {
- if ecUf.Equals(uF) {
- return ecUfID
- }
- }
- return
-}
-
// RatingID returns the ID of the matching RateSInterval within ec.Rating
func (ec *EventCharges) RatingID(rIl *RateSInterval) (rID string) {
for ecID, ecRtIl := range ec.Rating {