diff --git a/agents/diam_it_test.go b/agents/diam_it_test.go index ca07833b5..7d468ec0f 100644 --- a/agents/diam_it_test.go +++ b/agents/diam_it_test.go @@ -238,7 +238,7 @@ func testDiamItApierRpcConn(t *testing.T) { func testDiamItTPFromFolder(t *testing.T) { attrs := &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "tutorial")} var loadInst utils.LoadInstance - if err := apierRpc.Call(utils.ApierV2LoadTariffPlanFromFolder, attrs, &loadInst); err != nil { + if err := apierRpc.Call(utils.APIerSv2LoadTariffPlanFromFolder, attrs, &loadInst); err != nil { t.Error(err) } if isDispatcherActive { @@ -912,7 +912,7 @@ func testDiamInitWithSessionDisconnect(t *testing.T) { }, } var reply string - if err := apierRpc.Call(utils.ApierV2SetBalance, attrSetBalance, &reply); err != nil { + if err := apierRpc.Call(utils.APIerSv2SetBalance, attrSetBalance, &reply); err != nil { t.Error(err) } else if reply != utils.OK { t.Errorf("Received: %s", reply) diff --git a/agents/dnsagent_it_test.go b/agents/dnsagent_it_test.go index 1c71b34f3..eaa2b9a79 100644 --- a/agents/dnsagent_it_test.go +++ b/agents/dnsagent_it_test.go @@ -113,7 +113,7 @@ func testDNSitApierRpcConn(t *testing.T) { func testDNSitTPFromFolder(t *testing.T) { attrs := &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "dnsagent")} var loadInst utils.LoadInstance - if err := dnsRPC.Call(utils.ApierV2LoadTariffPlanFromFolder, + if err := dnsRPC.Call(utils.APIerSv2LoadTariffPlanFromFolder, attrs, &loadInst); err != nil { t.Error(err) } diff --git a/agents/httpagent_it_test.go b/agents/httpagent_it_test.go index e916d2a1c..a41e949cd 100644 --- a/agents/httpagent_it_test.go +++ b/agents/httpagent_it_test.go @@ -183,7 +183,7 @@ func testHAitApierRpcConn(t *testing.T) { func testHAitTPFromFolder(t *testing.T) { attrs := &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "oldtutorial")} var loadInst utils.LoadInstance - if err := haRPC.Call(utils.ApierV2LoadTariffPlanFromFolder, attrs, &loadInst); err != nil { + if err := haRPC.Call(utils.APIerSv2LoadTariffPlanFromFolder, attrs, &loadInst); err != nil { t.Error(err) } time.Sleep(time.Duration(*waitRater) * time.Millisecond) // Give time for scheduler to execute topups @@ -232,7 +232,7 @@ func testHAitAuth1001(t *testing.T) { }, } var reply string - if err := haRPC.Call(utils.ApierV2SetBalance, attrSetBalance, &reply); err != nil { + if err := haRPC.Call(utils.APIerSv2SetBalance, attrSetBalance, &reply); err != nil { t.Error(err) } else if reply != utils.OK { t.Errorf("Received: %s", reply) @@ -293,7 +293,7 @@ func testHAitCDRmtcall(t *testing.T) { time.Sleep(50 * time.Millisecond) var cdrs []*engine.ExternalCDR req := utils.RPCCDRsFilter{RunIDs: []string{utils.MetaDefault}} - if err := haRPC.Call(utils.ApierV2GetCDRs, req, &cdrs); err != nil { + if err := haRPC.Call(utils.APIerSv2GetCDRs, req, &cdrs); err != nil { t.Error("Unexpected error: ", err.Error()) } else if len(cdrs) != 1 { t.Error("Unexpected number of CDRs returned: ", len(cdrs)) @@ -334,7 +334,7 @@ func testHAitCDRmtcall2(t *testing.T) { time.Sleep(50 * time.Millisecond) var cdrs []*engine.ExternalCDR fltr := utils.RPCCDRsFilter{RunIDs: []string{utils.MetaDefault}, Accounts: []string{"447700086788"}} - if err := haRPC.Call(utils.ApierV2GetCDRs, fltr, &cdrs); err != nil { + if err := haRPC.Call(utils.APIerSv2GetCDRs, fltr, &cdrs); err != nil { t.Error("Unexpected error: ", err.Error()) } else if len(cdrs) != 1 { t.Error("Unexpected number of CDRs returned: ", len(cdrs)) diff --git a/agents/radagent_it_test.go b/agents/radagent_it_test.go index 767f61b5c..ddaee1136 100644 --- a/agents/radagent_it_test.go +++ b/agents/radagent_it_test.go @@ -160,7 +160,7 @@ func testRAitApierRpcConn(t *testing.T) { func testRAitTPFromFolder(t *testing.T) { attrs := &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "oldtutorial")} var loadInst utils.LoadInstance - if err := raRPC.Call(utils.ApierV2LoadTariffPlanFromFolder, attrs, &loadInst); err != nil { + if err := raRPC.Call(utils.APIerSv2LoadTariffPlanFromFolder, attrs, &loadInst); err != nil { t.Error(err) } if isDispatcherActive { @@ -378,7 +378,7 @@ func testRAitAcctStop(t *testing.T) { time.Sleep(150 * time.Millisecond) var cdrs []*engine.ExternalCDR args := utils.RPCCDRsFilter{RunIDs: []string{utils.MetaDefault}, DestinationPrefixes: []string{"1002"}} - if err := raRPC.Call(utils.ApierV2GetCDRs, args, &cdrs); err != nil { + if err := raRPC.Call(utils.APIerSv2GetCDRs, args, &cdrs); err != nil { t.Error("Unexpected error: ", err.Error()) } else if len(cdrs) != 1 { t.Error("Unexpected number of CDRs returned: ", len(cdrs)) diff --git a/apier/v1/accounts.go b/apier/v1/accounts.go index eb8768d48..4cee462e3 100644 --- a/apier/v1/accounts.go +++ b/apier/v1/accounts.go @@ -37,7 +37,7 @@ type AccountActionTiming struct { NextExecTime time.Time // Next execution time } -func (api *ApierV1) GetAccountActionPlan(attrs utils.TenantAccount, reply *[]*AccountActionTiming) error { +func (api *APIerSv1) GetAccountActionPlan(attrs utils.TenantAccount, reply *[]*AccountActionTiming) error { if missing := utils.MissingStructFields(&attrs, []string{"Tenant", "Account"}); len(missing) != 0 { return utils.NewErrMandatoryIeMissing(strings.Join(missing, ","), "") } @@ -85,7 +85,7 @@ type AttrRemoveActionTiming struct { } // Removes an ActionTimings or parts of it depending on filters being set -func (api *ApierV1) RemoveActionTiming(attrs AttrRemoveActionTiming, reply *string) (err error) { +func (api *APIerSv1) RemoveActionTiming(attrs AttrRemoveActionTiming, reply *string) (err error) { if missing := utils.MissingStructFields(&attrs, []string{"ActionPlanId"}); len(missing) != 0 { // Only mandatory ActionPlanId return utils.NewErrMandatoryIeMissing(missing...) } @@ -176,7 +176,7 @@ func (api *ApierV1) RemoveActionTiming(attrs AttrRemoveActionTiming, reply *stri } // Ads a new account into dataDb. If already defined, returns success. -func (api *ApierV1) SetAccount(attr utils.AttrSetAccount, reply *string) (err error) { +func (api *APIerSv1) SetAccount(attr utils.AttrSetAccount, reply *string) (err error) { if missing := utils.MissingStructFields(&attr, []string{"Tenant", "Account"}); len(missing) != 0 { return utils.NewErrMandatoryIeMissing(missing...) } @@ -299,7 +299,7 @@ func (api *ApierV1) SetAccount(attr utils.AttrSetAccount, reply *string) (err er return nil } -func (api *ApierV1) RemoveAccount(attr utils.AttrRemoveAccount, reply *string) (err error) { +func (api *APIerSv1) RemoveAccount(attr utils.AttrRemoveAccount, reply *string) (err error) { if missing := utils.MissingStructFields(&attr, []string{"Tenant", "Account"}); len(missing) != 0 { return utils.NewErrMandatoryIeMissing(missing...) } @@ -359,7 +359,7 @@ func (api *ApierV1) RemoveAccount(attr utils.AttrRemoveAccount, reply *string) ( return nil } -func (api *ApierV1) GetAccounts(attr utils.AttrGetAccounts, reply *[]interface{}) error { +func (api *APIerSv1) GetAccounts(attr utils.AttrGetAccounts, reply *[]interface{}) error { if len(attr.Tenant) == 0 { return utils.NewErrMandatoryIeMissing("Tenant") } @@ -406,7 +406,7 @@ func (api *ApierV1) GetAccounts(attr utils.AttrGetAccounts, reply *[]interface{} } // GetAccount returns the account -func (api *ApierV1) GetAccount(attr *utils.AttrGetAccount, reply *interface{}) error { +func (api *APIerSv1) GetAccount(attr *utils.AttrGetAccount, reply *interface{}) error { tag := utils.ConcatenatedKey(attr.Tenant, attr.Account) userBalance, err := api.DataManager.GetAccount(tag) if err != nil { @@ -428,14 +428,14 @@ type AttrAddBalance struct { Cdrlog bool } -func (api *ApierV1) AddBalance(attr *AttrAddBalance, reply *string) error { +func (api *APIerSv1) AddBalance(attr *AttrAddBalance, reply *string) error { return api.modifyBalance(utils.TOPUP, attr, reply) } -func (api *ApierV1) DebitBalance(attr *AttrAddBalance, reply *string) error { +func (api *APIerSv1) DebitBalance(attr *AttrAddBalance, reply *string) error { return api.modifyBalance(utils.DEBIT, attr, reply) } -func (api *ApierV1) modifyBalance(aType string, attr *AttrAddBalance, reply *string) (err error) { +func (api *APIerSv1) modifyBalance(aType string, attr *AttrAddBalance, reply *string) (err error) { if missing := utils.MissingStructFields(attr, []string{"Tenant", "Account", "BalanceType", "Value"}); len(missing) != 0 { return utils.NewErrMandatoryIeMissing(missing...) } @@ -508,7 +508,7 @@ func (api *ApierV1) modifyBalance(aType string, attr *AttrAddBalance, reply *str // SetBalance sets the balance for the given account // if the account is not already created it will create the account also -func (api *ApierV1) SetBalance(attr *utils.AttrSetBalance, reply *string) (err error) { +func (api *APIerSv1) SetBalance(attr *utils.AttrSetBalance, reply *string) (err error) { if missing := utils.MissingStructFields(attr, []string{"Tenant", "Account", "BalanceType"}); len(missing) != 0 { return utils.NewErrMandatoryIeMissing(missing...) } @@ -580,7 +580,7 @@ func (api *ApierV1) SetBalance(attr *utils.AttrSetBalance, reply *string) (err e } // RemoveBalances remove the matching balances for the account -func (api *ApierV1) RemoveBalances(attr *utils.AttrSetBalance, reply *string) (err error) { +func (api *APIerSv1) RemoveBalances(attr *utils.AttrSetBalance, reply *string) (err error) { if missing := utils.MissingStructFields(attr, []string{"Tenant", "Account", "BalanceType"}); len(missing) != 0 { return utils.NewErrMandatoryIeMissing(missing...) } @@ -614,7 +614,7 @@ func (api *ApierV1) RemoveBalances(attr *utils.AttrSetBalance, reply *string) (e return nil } -func (api *ApierV1) GetAccountsCount(attr utils.TenantArg, reply *int) (err error) { +func (api *APIerSv1) GetAccountsCount(attr utils.TenantArg, reply *int) (err error) { if len(attr.Tenant) == 0 { return utils.NewErrMandatoryIeMissing("Tenant") } diff --git a/apier/v1/accounts_it_test.go b/apier/v1/accounts_it_test.go index 9771ee311..e0f78b775 100644 --- a/apier/v1/accounts_it_test.go +++ b/apier/v1/accounts_it_test.go @@ -150,7 +150,7 @@ func testAccountBalance(t *testing.T, sracc, srten, balType string, expected flo Tenant: srten, Account: sracc, } - if err := accRPC.Call(utils.ApierV2GetAccount, attrs, &acnt); err != nil { + if err := accRPC.Call(utils.APIerSv2GetAccount, attrs, &acnt); err != nil { t.Error(err) } else if rply := acnt.BalanceMap[balType].GetTotalValue(); rply != expected { t.Errorf("Expecting: %v, received: %v", @@ -164,7 +164,7 @@ func testBalanceIfExists(t *testing.T, acc, ten, balType, balID string) (has boo Tenant: ten, Account: acc, } - if err := accRPC.Call(utils.ApierV2GetAccount, attrs, &acnt); err != nil { + if err := accRPC.Call(utils.APIerSv2GetAccount, attrs, &acnt); err != nil { t.Error(err) return false } @@ -189,7 +189,7 @@ func testAccITAddVoiceBalance(t *testing.T) { }, } var reply string - if err := accRPC.Call(utils.ApierV2SetBalance, attrSetBalance, &reply); err != nil { + if err := accRPC.Call(utils.APIerSv2SetBalance, attrSetBalance, &reply); err != nil { t.Error(err) } else if reply != utils.OK { t.Errorf("Received: %s", reply) @@ -208,17 +208,17 @@ func testAccITSetBalanceTimingIds(t *testing.T) { Time: "15:00:00Z", } var reply string - if err := accRPC.Call(utils.ApierV1SetTPTiming, tpTiming, &reply); err != nil { + if err := accRPC.Call(utils.APIerSv1SetTPTiming, tpTiming, &reply); err != nil { t.Error(err) } else if reply != utils.OK { t.Error("Unexpected reply returned", reply) } - if err := accRPC.Call(utils.ApierV1LoadTariffPlanFromStorDb, + if err := accRPC.Call(utils.APIerSv1LoadTariffPlanFromStorDb, AttrLoadTpFromStorDb{TPid: "TEST_TPID1"}, &reply); err != nil { - t.Errorf("Got error on %s: %+v", utils.ApierV1LoadTariffPlanFromStorDb, err.Error()) + t.Errorf("Got error on %s: %+v", utils.APIerSv1LoadTariffPlanFromStorDb, err.Error()) } else if reply != utils.OK { - t.Errorf("Calling %s got reply: %+v", utils.ApierV1LoadTariffPlanFromStorDb, reply) + t.Errorf("Calling %s got reply: %+v", utils.APIerSv1LoadTariffPlanFromStorDb, reply) } args := &utils.AttrSetBalance{ @@ -230,7 +230,7 @@ func testAccITSetBalanceTimingIds(t *testing.T) { utils.TimingIDs: "Timing", }, } - if err := accRPC.Call(utils.ApierV1SetBalance, args, &reply); err != nil { + if err := accRPC.Call(utils.APIerSv1SetBalance, args, &reply); err != nil { t.Error("Got error on SetBalance: ", err.Error()) } else if reply != utils.OK { t.Errorf("Calling SetBalance received: %s", reply) @@ -252,7 +252,7 @@ func testAccITSetBalanceTimingIds(t *testing.T) { EndTime: "", }, } - if err := accRPC.Call(utils.ApierV2GetAccount, attrAcc, &acnt); err != nil { + if err := accRPC.Call(utils.APIerSv2GetAccount, attrAcc, &acnt); err != nil { t.Fatal(err) } @@ -270,7 +270,7 @@ func testAccITSetBalanceTimingIds(t *testing.T) { func testAccITDebitBalance(t *testing.T) { time.Sleep(5 * time.Second) var reply string - if err := accRPC.Call(utils.ApierV1DebitBalance, &AttrAddBalance{ + if err := accRPC.Call(utils.APIerSv1DebitBalance, &AttrAddBalance{ Tenant: accTenant, Account: accAcount, BalanceType: utils.VOICE, @@ -300,16 +300,16 @@ func testAccITAddBalance(t *testing.T) { Value: 1.5, Cdrlog: true, } - if err := accRPC.Call(utils.ApierV1AddBalance, attrs, &reply); err != nil { - t.Error("Got error on ApierV1.AddBalance: ", err.Error()) + if err := accRPC.Call(utils.APIerSv1AddBalance, attrs, &reply); err != nil { + t.Error("Got error on APIerSv1.AddBalance: ", err.Error()) } else if reply != utils.OK { - t.Errorf("Calling ApierV1.AddBalance received: %s", reply) + t.Errorf("Calling APIerSv1.AddBalance received: %s", reply) } time.Sleep(50 * time.Millisecond) // verify the cdr from CdrLog var cdrs []*engine.ExternalCDR req := utils.RPCCDRsFilter{Sources: []string{utils.CDRLOG}} - if err := accRPC.Call(utils.ApierV2GetCDRs, req, &cdrs); err != nil { + if err := accRPC.Call(utils.APIerSv2GetCDRs, req, &cdrs); err != nil { t.Error("Unexpected error: ", err.Error()) } else if len(cdrs) != 1 { t.Error("Unexpected number of CDRs returned: ", len(cdrs)) @@ -328,16 +328,16 @@ func testAccITSetBalance(t *testing.T) { }, Cdrlog: true, } - if err := accRPC.Call(utils.ApierV1SetBalance, attrs, &reply); err != nil { - t.Error("Got error on ApierV1.SetBalance: ", err.Error()) + if err := accRPC.Call(utils.APIerSv1SetBalance, attrs, &reply); err != nil { + t.Error("Got error on APIerSv1.SetBalance: ", err.Error()) } else if reply != utils.OK { - t.Errorf("Calling ApierV1.SetBalance received: %s", reply) + t.Errorf("Calling APIerSv1.SetBalance received: %s", reply) } time.Sleep(50 * time.Millisecond) // verify the cdr from CdrLog var cdrs []*engine.ExternalCDR req := utils.RPCCDRsFilter{Sources: []string{utils.CDRLOG}} - if err := accRPC.Call(utils.ApierV2GetCDRs, req, &cdrs); err != nil { + if err := accRPC.Call(utils.APIerSv2GetCDRs, req, &cdrs); err != nil { t.Error("Unexpected error: ", err.Error()) } else if len(cdrs) != 2 { t.Error("Unexpected number of CDRs returned: ", len(cdrs)) @@ -361,16 +361,16 @@ func testAccITSetBalanceWithExtraData(t *testing.T) { Cdrlog: true, ActionExtraData: &extraDataMap, } - if err := accRPC.Call(utils.ApierV1SetBalance, attrs, &reply); err != nil { - t.Error("Got error on ApierV1.SetBalance: ", err.Error()) + if err := accRPC.Call(utils.APIerSv1SetBalance, attrs, &reply); err != nil { + t.Error("Got error on APIerSv1.SetBalance: ", err.Error()) } else if reply != utils.OK { - t.Errorf("Calling ApierV1.SetBalance received: %s", reply) + t.Errorf("Calling APIerSv1.SetBalance received: %s", reply) } time.Sleep(50 * time.Millisecond) // verify the cdr from CdrLog var cdrs []*engine.ExternalCDR req := utils.RPCCDRsFilter{Sources: []string{utils.CDRLOG}, Accounts: []string{"testAccITSetBalanceWithExtraData"}} - if err := accRPC.Call(utils.ApierV2GetCDRs, req, &cdrs); err != nil { + if err := accRPC.Call(utils.APIerSv2GetCDRs, req, &cdrs); err != nil { t.Error("Unexpected error: ", err.Error()) } else if len(cdrs) != 1 { t.Error("Unexpected number of CDRs returned: ", len(cdrs)) @@ -396,16 +396,16 @@ func testAccITSetBalanceWithExtraData2(t *testing.T) { Cdrlog: true, ActionExtraData: &extraDataMap, } - if err := accRPC.Call(utils.ApierV1SetBalance, attrs, &reply); err != nil { - t.Error("Got error on ApierV1.SetBalance: ", err.Error()) + if err := accRPC.Call(utils.APIerSv1SetBalance, attrs, &reply); err != nil { + t.Error("Got error on APIerSv1.SetBalance: ", err.Error()) } else if reply != utils.OK { - t.Errorf("Calling ApierV1.SetBalance received: %s", reply) + t.Errorf("Calling APIerSv1.SetBalance received: %s", reply) } time.Sleep(50 * time.Millisecond) // verify the cdr from CdrLog var cdrs []*engine.ExternalCDR req := utils.RPCCDRsFilter{Sources: []string{utils.CDRLOG}, Accounts: []string{"testAccITSetBalanceWithExtraData2"}} - if err := accRPC.Call(utils.ApierV2GetCDRs, req, &cdrs); err != nil { + if err := accRPC.Call(utils.APIerSv2GetCDRs, req, &cdrs); err != nil { t.Error("Unexpected error: ", err.Error()) } else if len(cdrs) != 1 { t.Error("Unexpected number of CDRs returned: ", len(cdrs)) @@ -423,7 +423,7 @@ func testAccITAddBalanceWithNegative(t *testing.T) { Account: "AddBalanceWithNegative", } - if err := accRPC.Call(utils.ApierV2GetAccount, attrAcc, &acnt); err.Error() != utils.ErrNotFound.Error() { + if err := accRPC.Call(utils.APIerSv2GetAccount, attrAcc, &acnt); err.Error() != utils.ErrNotFound.Error() { t.Error(err) } @@ -435,10 +435,10 @@ func testAccITAddBalanceWithNegative(t *testing.T) { BalanceType: utils.MONETARY, Value: -3.5, } - if err := accRPC.Call(utils.ApierV1AddBalance, attrs, &reply); err != nil { - t.Error("Got error on ApierV1.AddBalance: ", err.Error()) + if err := accRPC.Call(utils.APIerSv1AddBalance, attrs, &reply); err != nil { + t.Error("Got error on APIerSv1.AddBalance: ", err.Error()) } else if reply != utils.OK { - t.Errorf("Calling ApierV1.AddBalance received: %s", reply) + t.Errorf("Calling APIerSv1.AddBalance received: %s", reply) } //give time to create the account and execute the action time.Sleep(50 * time.Millisecond) @@ -447,13 +447,13 @@ func testAccITAddBalanceWithNegative(t *testing.T) { Tenant: "cgrates.org", Account: "AddBalanceWithNegative", } - if err := accRPC.Call(utils.ApierV2GetAccount, attrAcc, &acnt); err != nil { + if err := accRPC.Call(utils.APIerSv2GetAccount, attrAcc, &acnt); err != nil { t.Error(err) } else if acnt.BalanceMap[utils.MONETARY].GetTotalValue() != 3.5 { t.Errorf("Unexpected balance received : %+v", acnt.BalanceMap[utils.MONETARY].GetTotalValue()) } - if err := accRPC.Call(utils.ApierV1DebitBalance, &AttrAddBalance{ + if err := accRPC.Call(utils.APIerSv1DebitBalance, &AttrAddBalance{ Tenant: "cgrates.org", Account: "AddBalanceWithNegative", BalanceType: utils.MONETARY, @@ -464,13 +464,13 @@ func testAccITAddBalanceWithNegative(t *testing.T) { t.Errorf("Received: %s", reply) } - if err := accRPC.Call(utils.ApierV2GetAccount, attrAcc, &acnt); err != nil { + if err := accRPC.Call(utils.APIerSv2GetAccount, attrAcc, &acnt); err != nil { t.Error(err) } else if acnt.BalanceMap[utils.MONETARY].GetTotalValue() != 1.5 { t.Errorf("Unexpected balance received : %+v", acnt.BalanceMap[utils.MONETARY].GetTotalValue()) } - if err := accRPC.Call(utils.ApierV1DebitBalance, &AttrAddBalance{ + if err := accRPC.Call(utils.APIerSv1DebitBalance, &AttrAddBalance{ Tenant: "cgrates.org", Account: "AddBalanceWithNegative", BalanceType: utils.MONETARY, @@ -481,7 +481,7 @@ func testAccITAddBalanceWithNegative(t *testing.T) { t.Errorf("Received: %s", reply) } - if err := accRPC.Call(utils.ApierV2GetAccount, attrAcc, &acnt); err != nil { + if err := accRPC.Call(utils.APIerSv2GetAccount, attrAcc, &acnt); err != nil { t.Error(err) } else if acnt.BalanceMap[utils.MONETARY].GetTotalValue() != 0.5 { t.Errorf("Unexpected balance received : %+v", acnt.BalanceMap[utils.MONETARY].GetTotalValue()) @@ -496,15 +496,15 @@ func testAccITGetDisabledAccounts(t *testing.T) { acnt4 := utils.AttrSetAccount{Tenant: "cgrates.org", Account: "account4", ExtraOptions: map[string]bool{utils.Disabled: true}} for _, account := range []utils.AttrSetAccount{acnt1, acnt2, acnt3, acnt4} { - if err := accRPC.Call(utils.ApierV1SetAccount, account, &reply); err != nil { + if err := accRPC.Call(utils.APIerSv1SetAccount, account, &reply); err != nil { t.Error(err) } else if reply != utils.OK { - t.Errorf("Calling ApierV1.SetAccount received: %s", reply) + t.Errorf("Calling APIerSv1.SetAccount received: %s", reply) } } var acnts []*engine.Account - if err := accRPC.Call(utils.ApierV2GetAccounts, utils.AttrGetAccounts{Tenant: "cgrates.org", Filter: map[string]bool{utils.Disabled: true}}, + if err := accRPC.Call(utils.APIerSv2GetAccounts, utils.AttrGetAccounts{Tenant: "cgrates.org", Filter: map[string]bool{utils.Disabled: true}}, &acnts); err != nil { t.Error(err) } else if len(acnts) != 3 { @@ -516,7 +516,7 @@ func testAccITCountAccounts(t *testing.T) { args := &utils.TenantArg{ Tenant: "cgrates.org", } - if err := accRPC.Call(utils.ApierV1GetAccountsCount, args, &reply); err != nil { + if err := accRPC.Call(utils.APIerSv1GetAccountsCount, args, &reply); err != nil { t.Error(err) } else if reply != 10 { t.Errorf("Expecting: %v, received: %v", 10, reply) @@ -540,7 +540,7 @@ func testAccITSetBalanceWithVaslue0(t *testing.T) { utils.Weight: 10, }, } - if err := accRPC.Call(utils.ApierV1SetBalance, args, &reply); err != nil { + if err := accRPC.Call(utils.APIerSv1SetBalance, args, &reply); err != nil { t.Error("Got error on SetBalance: ", err.Error()) } else if reply != utils.OK { t.Errorf("Calling SetBalance received: %s", reply) @@ -551,7 +551,7 @@ func testAccITSetBalanceWithVaslue0(t *testing.T) { Tenant: accTenant, Account: "testAccSetBalance", } - if err := accRPC.Call(utils.ApierV2GetAccount, attrAcc, &acnt); err != nil { + if err := accRPC.Call(utils.APIerSv2GetAccount, attrAcc, &acnt); err != nil { t.Fatal(err) } @@ -581,7 +581,7 @@ func testAccITSetBalanceWithVaslueInMap(t *testing.T) { utils.Value: 2, }, } - if err := accRPC.Call(utils.ApierV1SetBalance, args, &reply); err != nil { + if err := accRPC.Call(utils.APIerSv1SetBalance, args, &reply); err != nil { t.Error("Got error on SetBalance: ", err.Error()) } else if reply != utils.OK { t.Errorf("Calling SetBalance received: %s", reply) @@ -592,7 +592,7 @@ func testAccITSetBalanceWithVaslueInMap(t *testing.T) { Tenant: accTenant, Account: "testAccSetBalance", } - if err := accRPC.Call(utils.ApierV2GetAccount, attrAcc, &acnt); err != nil { + if err := accRPC.Call(utils.APIerSv2GetAccount, attrAcc, &acnt); err != nil { t.Fatal(err) } @@ -617,10 +617,10 @@ func testAccITAddBalanceWithValue0(t *testing.T) { Account: "testAccAddBalance", BalanceType: utils.MONETARY, } - if err := accRPC.Call(utils.ApierV1AddBalance, attrs, &reply); err != nil { - t.Error("Got error on ApierV1.AddBalance: ", err.Error()) + if err := accRPC.Call(utils.APIerSv1AddBalance, attrs, &reply); err != nil { + t.Error("Got error on APIerSv1.AddBalance: ", err.Error()) } else if reply != utils.OK { - t.Errorf("Calling ApierV1.AddBalance received: %s", reply) + t.Errorf("Calling APIerSv1.AddBalance received: %s", reply) } var acnt engine.Account @@ -628,7 +628,7 @@ func testAccITAddBalanceWithValue0(t *testing.T) { Tenant: accTenant, Account: "testAccAddBalance", } - if err := accRPC.Call(utils.ApierV2GetAccount, attrAcc, &acnt); err != nil { + if err := accRPC.Call(utils.APIerSv2GetAccount, attrAcc, &acnt); err != nil { t.Fatal(err) } @@ -653,10 +653,10 @@ func testAccITAddBalanceWithValueInMap(t *testing.T) { utils.Value: 1.5, }, } - if err := accRPC.Call(utils.ApierV1AddBalance, attrs, &reply); err != nil { - t.Error("Got error on ApierV1.AddBalance: ", err.Error()) + if err := accRPC.Call(utils.APIerSv1AddBalance, attrs, &reply); err != nil { + t.Error("Got error on APIerSv1.AddBalance: ", err.Error()) } else if reply != utils.OK { - t.Errorf("Calling ApierV1.AddBalance received: %s", reply) + t.Errorf("Calling APIerSv1.AddBalance received: %s", reply) } var acnt engine.Account @@ -664,7 +664,7 @@ func testAccITAddBalanceWithValueInMap(t *testing.T) { Tenant: accTenant, Account: "testAccAddBalance", } - if err := accRPC.Call(utils.ApierV2GetAccount, attrAcc, &acnt); err != nil { + if err := accRPC.Call(utils.APIerSv2GetAccount, attrAcc, &acnt); err != nil { t.Fatal(err) } diff --git a/apier/v1/accounts_test.go b/apier/v1/accounts_test.go index dfc679688..7a763d533 100644 --- a/apier/v1/accounts_test.go +++ b/apier/v1/accounts_test.go @@ -27,14 +27,14 @@ import ( ) var ( - apierAcnts *ApierV1 + apierAcnts *APIerSv1 apierAcntsAcntStorage *engine.InternalDB ) func init() { cfg, _ := config.NewDefaultCGRConfig() apierAcntsAcntStorage = engine.NewInternalDB(nil, nil, true, cfg.DataDbCfg().Items) - apierAcnts = &ApierV1{ + apierAcnts = &APIerSv1{ DataManager: engine.NewDataManager(apierAcntsAcntStorage, config.CgrConfig().CacheCfg(), nil), Config: cfg, } diff --git a/apier/v1/apier.go b/apier/v1/apier.go index 7e64bd4be..70bd81a77 100644 --- a/apier/v1/apier.go +++ b/apier/v1/apier.go @@ -40,7 +40,7 @@ type SchedulerGeter interface { GetScheduler() *scheduler.Scheduler } -type ApierV1 struct { +type APIerSv1 struct { StorDb engine.LoadStorage // we should consider keeping only one of StorDB type CdrDb engine.CdrStorage DataManager *engine.DataManager @@ -54,12 +54,12 @@ type ApierV1 struct { } // Call implements rpcclient.ClientConnector interface for internal RPC -func (apiv1 *ApierV1) Call(serviceMethod string, +func (apiv1 *APIerSv1) Call(serviceMethod string, args interface{}, reply interface{}) error { return utils.APIerRPCCall(apiv1, serviceMethod, args, reply) } -func (apiv1 *ApierV1) GetDestination(dstId string, reply *engine.Destination) error { +func (apiv1 *APIerSv1) GetDestination(dstId string, reply *engine.Destination) error { if dst, err := apiv1.DataManager.GetDestination(dstId, false, utils.NonTransactional); err != nil { return utils.ErrNotFound } else { @@ -73,7 +73,7 @@ type AttrRemoveDestination struct { Prefixes []string } -func (apiv1 *ApierV1) RemoveDestination(attr AttrRemoveDestination, reply *string) (err error) { +func (apiv1 *APIerSv1) RemoveDestination(attr AttrRemoveDestination, reply *string) (err error) { for _, dstID := range attr.DestinationIDs { if len(attr.Prefixes) == 0 { if err = apiv1.DataManager.RemoveDestination(dstID, utils.NonTransactional); err != nil { @@ -93,7 +93,7 @@ func (apiv1 *ApierV1) RemoveDestination(attr AttrRemoveDestination, reply *strin } // GetReverseDestination retrieves revese destination list for a prefix -func (apiv1 *ApierV1) GetReverseDestination(prefix string, reply *[]string) (err error) { +func (apiv1 *APIerSv1) GetReverseDestination(prefix string, reply *[]string) (err error) { if prefix == "" { return utils.NewErrMandatoryIeMissing("prefix") } @@ -106,7 +106,7 @@ func (apiv1 *ApierV1) GetReverseDestination(prefix string, reply *[]string) (err } // ComputeReverseDestinations will rebuild complete reverse destinations data -func (apiv1 *ApierV1) ComputeReverseDestinations(ignr string, reply *string) (err error) { +func (apiv1 *APIerSv1) ComputeReverseDestinations(ignr string, reply *string) (err error) { if err = apiv1.DataManager.DataDB().RebuildReverseForPrefix(utils.REVERSE_DESTINATION_PREFIX); err != nil { return } @@ -115,7 +115,7 @@ func (apiv1 *ApierV1) ComputeReverseDestinations(ignr string, reply *string) (er } // ComputeAccountActionPlans will rebuild complete reverse accountActions data -func (apiv1 *ApierV1) ComputeAccountActionPlans(ignr string, reply *string) (err error) { +func (apiv1 *APIerSv1) ComputeAccountActionPlans(ignr string, reply *string) (err error) { if err = apiv1.DataManager.DataDB().RebuildReverseForPrefix(utils.AccountActionPlansPrefix); err != nil { return } @@ -123,7 +123,7 @@ func (apiv1 *ApierV1) ComputeAccountActionPlans(ignr string, reply *string) (err return } -func (apiv1 *ApierV1) GetSharedGroup(sgId string, reply *engine.SharedGroup) error { +func (apiv1 *APIerSv1) GetSharedGroup(sgId string, reply *engine.SharedGroup) error { if sg, err := apiv1.DataManager.GetSharedGroup(sgId, false, utils.NonTransactional); err != nil && err != utils.ErrNotFound { // Not found is not an error here return err } else { @@ -134,7 +134,7 @@ func (apiv1 *ApierV1) GetSharedGroup(sgId string, reply *engine.SharedGroup) err return nil } -func (apiv1 *ApierV1) SetDestination(attrs utils.AttrSetDestination, reply *string) (err error) { +func (apiv1 *APIerSv1) SetDestination(attrs utils.AttrSetDestination, reply *string) (err error) { if missing := utils.MissingStructFields(&attrs, []string{"Id", "Prefixes"}); len(missing) != 0 { return utils.NewErrMandatoryIeMissing(missing...) } @@ -166,7 +166,7 @@ func (apiv1 *ApierV1) SetDestination(attrs utils.AttrSetDestination, reply *stri return nil } -func (apiv1 *ApierV1) GetRatingPlan(rplnId string, reply *engine.RatingPlan) error { +func (apiv1 *APIerSv1) GetRatingPlan(rplnId string, reply *engine.RatingPlan) error { rpln, err := apiv1.DataManager.GetRatingPlan(rplnId, false, utils.NonTransactional) if err != nil { if err.Error() == utils.ErrNotFound.Error() { @@ -178,7 +178,7 @@ func (apiv1 *ApierV1) GetRatingPlan(rplnId string, reply *engine.RatingPlan) err return nil } -func (apiv1 *ApierV1) RemoveRatingPlan(ID string, reply *string) error { +func (apiv1 *APIerSv1) RemoveRatingPlan(ID string, reply *string) error { if len(ID) == 0 { return utils.NewErrMandatoryIeMissing("ID") } @@ -194,7 +194,7 @@ func (apiv1 *ApierV1) RemoveRatingPlan(ID string, reply *string) error { return nil } -func (apiv1 *ApierV1) ExecuteAction(attr *utils.AttrExecuteAction, reply *string) error { +func (apiv1 *APIerSv1) ExecuteAction(attr *utils.AttrExecuteAction, reply *string) error { at := &engine.ActionTiming{ ActionsID: attr.ActionsId, } @@ -215,7 +215,7 @@ type AttrLoadDestination struct { } // Load destinations from storDb into dataDb. -func (apiv1 *ApierV1) LoadDestination(attrs AttrLoadDestination, reply *string) error { +func (apiv1 *APIerSv1) LoadDestination(attrs AttrLoadDestination, reply *string) error { if len(attrs.TPid) == 0 { return utils.NewErrMandatoryIeMissing("TPid") } @@ -248,7 +248,7 @@ type AttrLoadRatingPlan struct { } // Process dependencies and load a specific rating plan from storDb into dataDb. -func (apiv1 *ApierV1) LoadRatingPlan(attrs AttrLoadRatingPlan, reply *string) error { +func (apiv1 *APIerSv1) LoadRatingPlan(attrs AttrLoadRatingPlan, reply *string) error { if len(attrs.TPid) == 0 { return utils.NewErrMandatoryIeMissing("TPid") } @@ -268,7 +268,7 @@ func (apiv1 *ApierV1) LoadRatingPlan(attrs AttrLoadRatingPlan, reply *string) er } // Process dependencies and load a specific rating profile from storDb into dataDb. -func (apiv1 *ApierV1) LoadRatingProfile(attrs utils.TPRatingProfile, reply *string) error { +func (apiv1 *APIerSv1) LoadRatingProfile(attrs utils.TPRatingProfile, reply *string) error { if len(attrs.TPid) == 0 { return utils.NewErrMandatoryIeMissing("TPid") } @@ -291,7 +291,7 @@ type AttrLoadSharedGroup struct { } // Load destinations from storDb into dataDb. -func (apiv1 *ApierV1) LoadSharedGroup(attrs AttrLoadSharedGroup, reply *string) error { +func (apiv1 *APIerSv1) LoadSharedGroup(attrs AttrLoadSharedGroup, reply *string) error { if len(attrs.TPid) == 0 { return utils.NewErrMandatoryIeMissing("TPid") } @@ -317,7 +317,7 @@ type AttrLoadTpFromStorDb struct { } // Loads complete data in a TP from storDb -func (apiv1 *ApierV1) LoadTariffPlanFromStorDb(attrs AttrLoadTpFromStorDb, reply *string) error { +func (apiv1 *APIerSv1) LoadTariffPlanFromStorDb(attrs AttrLoadTpFromStorDb, reply *string) error { if len(attrs.TPid) == 0 { return utils.NewErrMandatoryIeMissing("TPid") } @@ -349,12 +349,12 @@ func (apiv1 *ApierV1) LoadTariffPlanFromStorDb(attrs AttrLoadTpFromStorDb, reply caching = *attrs.Caching } // reload cache - utils.Logger.Info("ApierV1.LoadTariffPlanFromStorDb, reloading cache.") + utils.Logger.Info("APIerSv1.LoadTariffPlanFromStorDb, reloading cache.") if err := dbReader.ReloadCache(caching, true, attrs.ArgDispatcher); err != nil { return utils.NewErrServerError(err) } if len(apiv1.Config.ApierCfg().SchedulerConns) != 0 { - utils.Logger.Info("ApierV1.LoadTariffPlanFromStorDb, reloading scheduler.") + utils.Logger.Info("APIerSv1.LoadTariffPlanFromStorDb, reloading scheduler.") if err := dbReader.ReloadScheduler(true); err != nil { return utils.NewErrServerError(err) } @@ -365,7 +365,7 @@ func (apiv1 *ApierV1) LoadTariffPlanFromStorDb(attrs AttrLoadTpFromStorDb, reply return nil } -func (apiv1 *ApierV1) ImportTariffPlanFromFolder(attrs utils.AttrImportTPFromFolder, reply *string) error { +func (apiv1 *APIerSv1) ImportTariffPlanFromFolder(attrs utils.AttrImportTPFromFolder, reply *string) error { if missing := utils.MissingStructFields(&attrs, []string{"TPid", "FolderPath"}); len(missing) != 0 { return utils.NewErrMandatoryIeMissing(missing...) } @@ -396,7 +396,7 @@ func (apiv1 *ApierV1) ImportTariffPlanFromFolder(attrs utils.AttrImportTPFromFol } // Sets a specific rating profile working with data directly in the DataDB without involving storDb -func (apiv1 *ApierV1) SetRatingProfile(attrs utils.AttrSetRatingProfile, reply *string) (err error) { +func (apiv1 *APIerSv1) SetRatingProfile(attrs utils.AttrSetRatingProfile, reply *string) (err error) { if missing := utils.MissingStructFields(&attrs, []string{"Tenant", "ToR", "Subject", "RatingPlanActivations"}); len(missing) != 0 { return utils.NewErrMandatoryIeMissing(missing...) } @@ -448,7 +448,7 @@ func (apiv1 *ApierV1) SetRatingProfile(attrs utils.AttrSetRatingProfile, reply * } // GetRatingProfileIDs returns list of resourceProfile IDs registered for a tenant -func (apiv1 *ApierV1) GetRatingProfileIDs(args utils.TenantArgWithPaginator, rsPrfIDs *[]string) error { +func (apiv1 *APIerSv1) GetRatingProfileIDs(args utils.TenantArgWithPaginator, rsPrfIDs *[]string) error { if missing := utils.MissingStructFields(&args, []string{utils.Tenant}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } @@ -468,7 +468,7 @@ func (apiv1 *ApierV1) GetRatingProfileIDs(args utils.TenantArgWithPaginator, rsP return nil } -func (apiv1 *ApierV1) GetRatingProfile(attrs utils.AttrGetRatingProfile, reply *engine.RatingProfile) (err error) { +func (apiv1 *APIerSv1) GetRatingProfile(attrs utils.AttrGetRatingProfile, reply *engine.RatingProfile) (err error) { if missing := utils.MissingStructFields(&attrs, []string{"Tenant", "Category", "Subject"}); len(missing) != 0 { return utils.NewErrMandatoryIeMissing(missing...) } @@ -513,7 +513,7 @@ type V1TPAction struct { Weight float64 // Action's weight } -func (apiv1 *ApierV1) SetActions(attrs V1AttrSetActions, reply *string) (err error) { +func (apiv1 *APIerSv1) SetActions(attrs V1AttrSetActions, reply *string) (err error) { if missing := utils.MissingStructFields(&attrs, []string{"ActionsId", "Actions"}); len(missing) != 0 { return utils.NewErrMandatoryIeMissing(missing...) } @@ -588,7 +588,7 @@ func (apiv1 *ApierV1) SetActions(attrs V1AttrSetActions, reply *string) (err err } // Retrieves actions attached to specific ActionsId within cache -func (apiv1 *ApierV1) GetActions(actsId string, reply *[]*utils.TPAction) error { +func (apiv1 *APIerSv1) GetActions(actsId string, reply *[]*utils.TPAction) error { if len(actsId) == 0 { return fmt.Errorf("%s ActionsId: %s", utils.ErrMandatoryIeMissing.Error(), actsId) } @@ -642,7 +642,7 @@ type AttrActionPlan struct { Weight float64 // Binding's weight } -func (apiv1 *ApierV1) SetActionPlan(attrs AttrSetActionPlan, reply *string) (err error) { +func (apiv1 *APIerSv1) SetActionPlan(attrs AttrSetActionPlan, reply *string) (err error) { if missing := utils.MissingStructFields(&attrs, []string{"Id", "ActionPlan"}); len(missing) != 0 { return utils.NewErrMandatoryIeMissing(missing...) } @@ -762,7 +762,7 @@ type AttrGetActionPlan struct { ID string } -func (apiv1 *ApierV1) GetActionPlan(attr AttrGetActionPlan, reply *[]*engine.ActionPlan) error { +func (apiv1 *APIerSv1) GetActionPlan(attr AttrGetActionPlan, reply *[]*engine.ActionPlan) error { var result []*engine.ActionPlan if attr.ID == "" || attr.ID == "*" { result = make([]*engine.ActionPlan, 0) @@ -784,7 +784,7 @@ func (apiv1 *ApierV1) GetActionPlan(attr AttrGetActionPlan, reply *[]*engine.Act return nil } -func (apiv1 *ApierV1) RemoveActionPlan(attr AttrGetActionPlan, reply *string) (err error) { +func (apiv1 *APIerSv1) RemoveActionPlan(attr AttrGetActionPlan, reply *string) (err error) { if missing := utils.MissingStructFields(&attr, []string{"ID"}); len(missing) != 0 { return utils.NewErrMandatoryIeMissing(missing...) } @@ -823,7 +823,7 @@ func (apiv1 *ApierV1) RemoveActionPlan(attr AttrGetActionPlan, reply *string) (e } // Process dependencies and load a specific AccountActions profile from storDb into dataDb. -func (apiv1 *ApierV1) LoadAccountActions(attrs utils.TPAccountActions, reply *string) error { +func (apiv1 *APIerSv1) LoadAccountActions(attrs utils.TPAccountActions, reply *string) error { if len(attrs.TPid) == 0 { return utils.NewErrMandatoryIeMissing("TPid") } @@ -848,7 +848,7 @@ func (apiv1 *ApierV1) LoadAccountActions(attrs utils.TPAccountActions, reply *st return nil } -func (apiv1 *ApierV1) LoadTariffPlanFromFolder(attrs utils.AttrLoadTpFromFolder, reply *string) error { +func (apiv1 *APIerSv1) LoadTariffPlanFromFolder(attrs utils.AttrLoadTpFromFolder, reply *string) error { // verify if FolderPath is present if len(attrs.FolderPath) == 0 { return fmt.Errorf("%s:%s", utils.ErrMandatoryIeMissing.Error(), "FolderPath") @@ -896,12 +896,12 @@ func (apiv1 *ApierV1) LoadTariffPlanFromFolder(attrs utils.AttrLoadTpFromFolder, caching = *attrs.Caching } // reload cache - utils.Logger.Info("ApierV1.LoadTariffPlanFromFolder, reloading cache.") + utils.Logger.Info("APIerSv1.LoadTariffPlanFromFolder, reloading cache.") if err := loader.ReloadCache(caching, true, attrs.ArgDispatcher); err != nil { return utils.NewErrServerError(err) } if len(apiv1.Config.ApierCfg().SchedulerConns) != 0 { - utils.Logger.Info("ApierV1.LoadTariffPlanFromFolder, reloading scheduler.") + utils.Logger.Info("APIerSv1.LoadTariffPlanFromFolder, reloading scheduler.") if err := loader.ReloadScheduler(true); err != nil { return utils.NewErrServerError(err) } @@ -914,7 +914,7 @@ func (apiv1 *ApierV1) LoadTariffPlanFromFolder(attrs utils.AttrLoadTpFromFolder, // RemoveTPFromFolder will load the tarrifplan from folder into TpReader object // and will delete if from database -func (apiv1 *ApierV1) RemoveTPFromFolder(attrs utils.AttrLoadTpFromFolder, reply *string) error { +func (apiv1 *APIerSv1) RemoveTPFromFolder(attrs utils.AttrLoadTpFromFolder, reply *string) error { // verify if FolderPath is present if len(attrs.FolderPath) == 0 { return fmt.Errorf("%s:%s", utils.ErrMandatoryIeMissing.Error(), "FolderPath") @@ -961,12 +961,12 @@ func (apiv1 *ApierV1) RemoveTPFromFolder(attrs utils.AttrLoadTpFromFolder, reply caching = *attrs.Caching } // reload cache - utils.Logger.Info("ApierV1.RemoveTPFromFolder, reloading cache.") + utils.Logger.Info("APIerSv1.RemoveTPFromFolder, reloading cache.") if err := loader.ReloadCache(caching, true, attrs.ArgDispatcher); err != nil { return utils.NewErrServerError(err) } if len(apiv1.Config.ApierCfg().SchedulerConns) != 0 { - utils.Logger.Info("ApierV1.RemoveTPFromFolder, reloading scheduler.") + utils.Logger.Info("APIerSv1.RemoveTPFromFolder, reloading scheduler.") if err := loader.ReloadScheduler(true); err != nil { return utils.NewErrServerError(err) } @@ -979,7 +979,7 @@ func (apiv1 *ApierV1) RemoveTPFromFolder(attrs utils.AttrLoadTpFromFolder, reply // RemoveTPFromStorDB will load the tarrifplan from StorDB into TpReader object // and will delete if from database -func (apiv1 *ApierV1) RemoveTPFromStorDB(attrs AttrLoadTpFromStorDb, reply *string) error { +func (apiv1 *APIerSv1) RemoveTPFromStorDB(attrs AttrLoadTpFromStorDb, reply *string) error { if len(attrs.TPid) == 0 { return utils.NewErrMandatoryIeMissing("TPid") } @@ -1012,12 +1012,12 @@ func (apiv1 *ApierV1) RemoveTPFromStorDB(attrs AttrLoadTpFromStorDb, reply *stri caching = *attrs.Caching } // reload cache - utils.Logger.Info("ApierV1.RemoveTPFromStorDB, reloading cache.") + utils.Logger.Info("APIerSv1.RemoveTPFromStorDB, reloading cache.") if err := dbReader.ReloadCache(caching, true, attrs.ArgDispatcher); err != nil { return utils.NewErrServerError(err) } if len(apiv1.Config.ApierCfg().SchedulerConns) != 0 { - utils.Logger.Info("ApierV1.RemoveTPFromStorDB, reloading scheduler.") + utils.Logger.Info("APIerSv1.RemoveTPFromStorDB, reloading scheduler.") if err := dbReader.ReloadScheduler(true); err != nil { return utils.NewErrServerError(err) } @@ -1053,7 +1053,7 @@ func (arrp *AttrRemoveRatingProfile) GetId() (result string) { return } -func (apiv1 *ApierV1) RemoveRatingProfile(attr AttrRemoveRatingProfile, reply *string) error { +func (apiv1 *APIerSv1) RemoveRatingProfile(attr AttrRemoveRatingProfile, reply *string) error { if (attr.Subject != "" && utils.IsSliceMember([]string{attr.Tenant, attr.Category}, "")) || (attr.Category != "" && attr.Tenant == "") { return utils.ErrMandatoryIeMissing @@ -1073,7 +1073,7 @@ func (apiv1 *ApierV1) RemoveRatingProfile(attr AttrRemoveRatingProfile, reply *s return nil } -func (apiv1 *ApierV1) GetLoadHistory(attrs utils.Paginator, reply *[]*utils.LoadInstance) error { +func (apiv1 *APIerSv1) GetLoadHistory(attrs utils.Paginator, reply *[]*utils.LoadInstance) error { nrItems := -1 offset := 0 if attrs.Offset != nil { // For offset we need full data @@ -1105,7 +1105,7 @@ type AttrRemoveActions struct { ActionIDs []string } -func (apiv1 *ApierV1) RemoveActions(attr AttrRemoveActions, reply *string) error { +func (apiv1 *APIerSv1) RemoveActions(attr AttrRemoveActions, reply *string) error { if attr.ActionIDs == nil { err := utils.ErrNotFound *reply = err.Error() @@ -1170,7 +1170,7 @@ type ArgsReplyFailedPosts struct { } // ReplayFailedPosts will repost failed requests found in the FailedRequestsInDir -func (apiv1 *ApierV1) ReplayFailedPosts(args ArgsReplyFailedPosts, reply *string) (err error) { +func (apiv1 *APIerSv1) ReplayFailedPosts(args ArgsReplyFailedPosts, reply *string) (err error) { failedReqsInDir := apiv1.Config.GeneralCfg().FailedPostsDir if args.FailedRequestsInDir != nil && *args.FailedRequestsInDir != "" { failedReqsInDir = *args.FailedRequestsInDir @@ -1220,8 +1220,8 @@ func (apiv1 *ApierV1) ReplayFailedPosts(args ArgsReplyFailedPosts, reply *string } // CallCache caching the item based on cacheopt -// visible in ApierV2 -func (apiv1 *ApierV1) CallCache(cacheOpt string, args utils.ArgsGetCacheItem) (err error) { +// visible in APIerSv2 +func (apiv1 *APIerSv1) CallCache(cacheOpt string, args utils.ArgsGetCacheItem) (err error) { var reply string switch cacheOpt { case utils.META_NONE: @@ -1254,7 +1254,7 @@ func (apiv1 *ApierV1) CallCache(cacheOpt string, args utils.ArgsGetCacheItem) (e return } -func (apiv1 *ApierV1) GetLoadIDs(args string, reply *map[string]int64) (err error) { +func (apiv1 *APIerSv1) GetLoadIDs(args string, reply *map[string]int64) (err error) { if loadIDs, err := apiv1.DataManager.GetItemLoadIDs(args, false); err != nil { return err } else { @@ -1268,7 +1268,7 @@ type LoadTimeArgs struct { Item string } -func (apiv1 *ApierV1) GetLoadTimes(args LoadTimeArgs, reply *map[string]string) (err error) { +func (apiv1 *APIerSv1) GetLoadTimes(args LoadTimeArgs, reply *map[string]string) (err error) { if loadIDs, err := apiv1.DataManager.GetItemLoadIDs(args.Item, false); err != nil { return err } else { @@ -1285,7 +1285,7 @@ func (apiv1 *ApierV1) GetLoadTimes(args LoadTimeArgs, reply *map[string]string) return } -func (apiv1 *ApierV1) ComputeActionPlanIndexes(_ string, reply *string) (err error) { +func (apiv1 *APIerSv1) ComputeActionPlanIndexes(_ string, reply *string) (err error) { if apiv1.DataManager.DataDB().GetStorageType() != utils.REDIS { return utils.ErrNotImplemented } @@ -1301,7 +1301,7 @@ func (apiv1 *ApierV1) ComputeActionPlanIndexes(_ string, reply *string) (err err } // GetActionPlanIDs returns list of ActionPlan IDs registered for a tenant -func (apiv1 *ApierV1) GetActionPlanIDs(args utils.TenantArgWithPaginator, attrPrfIDs *[]string) error { +func (apiv1 *APIerSv1) GetActionPlanIDs(args utils.TenantArgWithPaginator, attrPrfIDs *[]string) error { prfx := utils.ACTION_PLAN_PREFIX keys, err := apiv1.DataManager.DataDB().GetKeysForPrefix(utils.ACTION_PLAN_PREFIX) if err != nil { @@ -1319,7 +1319,7 @@ func (apiv1 *ApierV1) GetActionPlanIDs(args utils.TenantArgWithPaginator, attrPr } // GetRatingPlanIDs returns list of RatingPlan IDs registered for a tenant -func (apiv1 *ApierV1) GetRatingPlanIDs(args utils.TenantArgWithPaginator, attrPrfIDs *[]string) error { +func (apiv1 *APIerSv1) GetRatingPlanIDs(args utils.TenantArgWithPaginator, attrPrfIDs *[]string) error { prfx := utils.RATING_PLAN_PREFIX keys, err := apiv1.DataManager.DataDB().GetKeysForPrefix(utils.RATING_PLAN_PREFIX) if err != nil { @@ -1337,7 +1337,7 @@ func (apiv1 *ApierV1) GetRatingPlanIDs(args utils.TenantArgWithPaginator, attrPr } // ListenAndServe listen for storbd reload -func (apiv1 *ApierV1) ListenAndServe(stopChan chan struct{}) (err error) { +func (apiv1 *APIerSv1) ListenAndServe(stopChan chan struct{}) (err error) { utils.Logger.Info(fmt.Sprintf("<%s> starting <%s> subsystem", utils.CoreS, utils.ApierS)) for { select { @@ -1354,7 +1354,7 @@ func (apiv1 *ApierV1) ListenAndServe(stopChan chan struct{}) (err error) { } // Ping return pong if the service is active -func (apiv1 *ApierV1) Ping(ign *utils.CGREvent, reply *string) error { +func (apiv1 *APIerSv1) Ping(ign *utils.CGREvent, reply *string) error { *reply = utils.Pong return nil } diff --git a/apier/v1/apier2_it_test.go b/apier/v1/apier2_it_test.go index 788ec3d43..98ea074ec 100644 --- a/apier/v1/apier2_it_test.go +++ b/apier/v1/apier2_it_test.go @@ -38,7 +38,7 @@ var ( apierCfgPath string apierCfg *config.CGRConfig apierRPC *rpc.Client - apierv2ConfigDIR string //run tests for specific configuration + APIerSv2ConfigDIR string //run tests for specific configuration sTestsAPIer = []func(t *testing.T){ testAPIerInitCfg, @@ -66,24 +66,24 @@ func TestApierIT2(t *testing.T) { // no need for a new config with *gob transport in this case switch *dbType { case utils.MetaInternal: - apierv2ConfigDIR = "tutinternal" + APIerSv2ConfigDIR = "tutinternal" case utils.MetaMySQL: - apierv2ConfigDIR = "tutmysql" + APIerSv2ConfigDIR = "tutmysql" case utils.MetaMongo: - apierv2ConfigDIR = "tutmongo" + APIerSv2ConfigDIR = "tutmongo" case utils.MetaPostgres: t.SkipNow() default: t.Fatal("Unknown Database type") } for _, stest := range sTestsAPIer { - t.Run(apierv2ConfigDIR, stest) + t.Run(APIerSv2ConfigDIR, stest) } } func testAPIerInitCfg(t *testing.T) { var err error - apierCfgPath = path.Join(costDataDir, "conf", "samples", apierv2ConfigDIR) + apierCfgPath = path.Join(costDataDir, "conf", "samples", APIerSv2ConfigDIR) apierCfg, err = config.NewCGRConfigFromPath(apierCfgPath) if err != nil { t.Error(err) @@ -124,7 +124,7 @@ func testAPIerRPCConn(t *testing.T) { func testAPIerLoadFromFolder(t *testing.T) { var reply string attrs := &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "tutorial")} - if err := apierRPC.Call(utils.ApierV1LoadTariffPlanFromFolder, attrs, &reply); err != nil { + if err := apierRPC.Call(utils.APIerSv1LoadTariffPlanFromFolder, attrs, &reply); err != nil { t.Error(err) } time.Sleep(500 * time.Millisecond) @@ -184,7 +184,7 @@ func testAPIerVerifyAttributesAfterLoad(t *testing.T) { func testAPIerRemoveTPFromFolder(t *testing.T) { var reply string attrs := &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "tutorial")} - if err := apierRPC.Call(utils.ApierV1RemoveTPFromFolder, attrs, &reply); err != nil { + if err := apierRPC.Call(utils.APIerSv1RemoveTPFromFolder, attrs, &reply); err != nil { t.Error(err) } time.Sleep(500 * time.Millisecond) @@ -192,13 +192,13 @@ func testAPIerRemoveTPFromFolder(t *testing.T) { func testAPIerAfterDelete(t *testing.T) { var reply *engine.AttributeProfile - if err := apierRPC.Call(utils.ApierV1GetAttributeProfile, + if err := apierRPC.Call(utils.APIerSv1GetAttributeProfile, utils.TenantIDWithArgDispatcher{TenantID: &utils.TenantID{Tenant: "cgrates.org", ID: "ATTR_1001_SIMPLEAUTH"}}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Fatal(err) } var replyTh *engine.ThresholdProfile - if err := apierRPC.Call(utils.ApierV1GetThresholdProfile, + if err := apierRPC.Call(utils.APIerSv1GetThresholdProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "THD_ACNT_1001"}, &replyTh); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) @@ -287,7 +287,7 @@ func testAPIerGetRatingPlanCost3(t *testing.T) { func testAPIerGetActionPlanIDs(t *testing.T) { var reply []string - if err := apierRPC.Call(utils.ApierV1GetActionPlanIDs, + if err := apierRPC.Call(utils.APIerSv1GetActionPlanIDs, utils.TenantArgWithPaginator{TenantArg: utils.TenantArg{Tenant: "cgrates.org"}}, &reply); err != nil { t.Error(err) @@ -301,7 +301,7 @@ func testAPIerGetActionPlanIDs(t *testing.T) { func testAPIerGetRatingPlanIDs(t *testing.T) { var reply []string expected := []string{"RP_1002_LOW", "RP_1003", "RP_1001", "RP_SMS", "RP_1002"} - if err := apierRPC.Call(utils.ApierV1GetRatingPlanIDs, + if err := apierRPC.Call(utils.APIerSv1GetRatingPlanIDs, utils.TenantArgWithPaginator{TenantArg: utils.TenantArg{Tenant: "cgrates.org"}}, &reply); err != nil { t.Error(err) diff --git a/apier/v1/apier_it_test.go b/apier/v1/apier_it_test.go index f23a5c88d..f5234b907 100644 --- a/apier/v1/apier_it_test.go +++ b/apier/v1/apier_it_test.go @@ -62,7 +62,7 @@ var ( cfgPath string cfg *config.CGRConfig rater *rpc.Client - apierv1ConfigDIR string + APIerSv1ConfigDIR string apierTests = []func(t *testing.T){ testApierLoadConfig, @@ -86,7 +86,7 @@ var ( testApierLoadAccountActions, testApierReloadScheduler, testApierSetRatingProfile, - testApierV1GetRatingProfile, + testAPIerSv1GetRatingProfile, testApierReloadCache, testApierGetDestination, testApierGetRatingPlan, @@ -144,11 +144,11 @@ func TestApierIT(t *testing.T) { switch *dbType { case utils.MetaInternal: t.SkipNow() // need tests redesign - // apierv1ConfigDIR = "apier_internal" + // APIerSv1ConfigDIR = "apier_internal" case utils.MetaMySQL: - apierv1ConfigDIR = "apier_mysql" + APIerSv1ConfigDIR = "apier_mysql" case utils.MetaMongo: - apierv1ConfigDIR = "apier_mongo" + APIerSv1ConfigDIR = "apier_mongo" case utils.MetaPostgres: t.SkipNow() default: @@ -156,13 +156,13 @@ func TestApierIT(t *testing.T) { } for _, stest := range apierTests { - t.Run(apierv1ConfigDIR, stest) + t.Run(APIerSv1ConfigDIR, stest) } } func testApierLoadConfig(t *testing.T) { var err error - cfgPath = path.Join(*dataDir, "conf", "samples", apierv1ConfigDIR) // no need for a new config with *gob transport in this case + cfgPath = path.Join(*dataDir, "conf", "samples", APIerSv1ConfigDIR) // no need for a new config with *gob transport in this case if cfg, err = config.NewCGRConfigFromPath(cfgPath); err != nil { t.Error(err) } @@ -233,47 +233,47 @@ func testApierTPTiming(t *testing.T) { } var reply string for _, tm := range []*utils.ApierTPTiming{tmAlways, tmAsap, tmAlways2} { - if err := rater.Call(utils.ApierV1SetTPTiming, tm, &reply); err != nil { - t.Error("Got error on ApierV1.SetTPTiming: ", err.Error()) + if err := rater.Call(utils.APIerSv1SetTPTiming, tm, &reply); err != nil { + t.Error("Got error on APIerSv1.SetTPTiming: ", err.Error()) } else if reply != utils.OK { - t.Error("Unexpected reply received when calling ApierV1.SetTPTiming: ", reply) + t.Error("Unexpected reply received when calling APIerSv1.SetTPTiming: ", reply) } } // Check second set - if err := rater.Call(utils.ApierV1SetTPTiming, tmAlways, &reply); err != nil { - t.Error("Got error on second ApierV1.SetTPTiming: ", err.Error()) + if err := rater.Call(utils.APIerSv1SetTPTiming, tmAlways, &reply); err != nil { + t.Error("Got error on second APIerSv1.SetTPTiming: ", err.Error()) } else if reply != utils.OK { - t.Error("Calling ApierV1.SetTPTiming got reply: ", reply) + t.Error("Calling APIerSv1.SetTPTiming got reply: ", reply) } // Check missing params - if err := rater.Call(utils.ApierV1SetTPTiming, new(utils.ApierTPTiming), &reply); err == nil { - t.Error("Calling ApierV1.SetTPTiming, expected error, received: ", reply) + if err := rater.Call(utils.APIerSv1SetTPTiming, new(utils.ApierTPTiming), &reply); err == nil { + t.Error("Calling APIerSv1.SetTPTiming, expected error, received: ", reply) } else if err.Error() != "MANDATORY_IE_MISSING: [TPid ID Years Months MonthDays WeekDays Time]" { - t.Error("Calling ApierV1.SetTPTiming got unexpected error: ", err.Error()) + t.Error("Calling APIerSv1.SetTPTiming got unexpected error: ", err.Error()) } // Test get var rplyTmAlways2 *utils.ApierTPTiming - if err := rater.Call(utils.ApierV1GetTPTiming, AttrGetTPTiming{tmAlways2.TPid, tmAlways2.ID}, &rplyTmAlways2); err != nil { - t.Error("Calling ApierV1.GetTPTiming, got error: ", err.Error()) + if err := rater.Call(utils.APIerSv1GetTPTiming, AttrGetTPTiming{tmAlways2.TPid, tmAlways2.ID}, &rplyTmAlways2); err != nil { + t.Error("Calling APIerSv1.GetTPTiming, got error: ", err.Error()) } else if !reflect.DeepEqual(tmAlways2, rplyTmAlways2) { - t.Errorf("Calling ApierV1.GetTPTiming expected: %v, received: %v", tmAlways, rplyTmAlways2) + t.Errorf("Calling APIerSv1.GetTPTiming expected: %v, received: %v", tmAlways, rplyTmAlways2) } // Test remove - if err := rater.Call(utils.ApierV1RemoveTPTiming, AttrGetTPTiming{tmAlways2.TPid, tmAlways2.ID}, &reply); err != nil { - t.Error("Calling ApierV1.RemoveTPTiming, got error: ", err.Error()) + if err := rater.Call(utils.APIerSv1RemoveTPTiming, AttrGetTPTiming{tmAlways2.TPid, tmAlways2.ID}, &reply); err != nil { + t.Error("Calling APIerSv1.RemoveTPTiming, got error: ", err.Error()) } else if reply != utils.OK { - t.Error("Calling ApierV1.RemoveTPTiming received: ", reply) + t.Error("Calling APIerSv1.RemoveTPTiming received: ", reply) } // Test getIds var rplyTmIds []string expectedTmIds := []string{"ALWAYS", "ASAP"} - if err := rater.Call(utils.ApierV1GetTPTimingIds, AttrGetTPTimingIds{tmAlways.TPid, utils.PaginatorWithSearch{}}, &rplyTmIds); err != nil { - t.Error("Calling ApierV1.GetTPTimingIds, got error: ", err.Error()) + if err := rater.Call(utils.APIerSv1GetTPTimingIds, AttrGetTPTimingIds{tmAlways.TPid, utils.PaginatorWithSearch{}}, &rplyTmIds); err != nil { + t.Error("Calling APIerSv1.GetTPTimingIds, got error: ", err.Error()) } sort.Strings(expectedTmIds) sort.Strings(rplyTmIds) if !reflect.DeepEqual(expectedTmIds, rplyTmIds) { - t.Errorf("Calling ApierV1.GetTPTimingIds expected: %v, received: %v", expectedTmIds, rplyTmIds) + t.Errorf("Calling APIerSv1.GetTPTimingIds expected: %v, received: %v", expectedTmIds, rplyTmIds) } } @@ -287,47 +287,47 @@ func testApierTPDestination(t *testing.T) { *dstDe2 = *dstDe // Data which we use for remove, still keeping the sample data to check proper loading dstDe2.ID = "GERMANY2" for _, dst := range []*utils.TPDestination{dstDe, dstDeMobile, dstFs, dstDe2} { - if err := rater.Call(utils.ApierV1SetTPDestination, dst, &reply); err != nil { - t.Error("Got error on ApierV1.SetTPDestination: ", err.Error()) + if err := rater.Call(utils.APIerSv1SetTPDestination, dst, &reply); err != nil { + t.Error("Got error on APIerSv1.SetTPDestination: ", err.Error()) } else if reply != utils.OK { - t.Error("Unexpected reply received when calling ApierV1.SetTPDestination: ", reply) + t.Error("Unexpected reply received when calling APIerSv1.SetTPDestination: ", reply) } } // Check second set - if err := rater.Call(utils.ApierV1SetTPDestination, dstDe2, &reply); err != nil { - t.Error("Got error on second ApierV1.SetTPDestination: ", err.Error()) + if err := rater.Call(utils.APIerSv1SetTPDestination, dstDe2, &reply); err != nil { + t.Error("Got error on second APIerSv1.SetTPDestination: ", err.Error()) } else if reply != utils.OK { - t.Error("Calling ApierV1.SetTPDestination got reply: ", reply) + t.Error("Calling APIerSv1.SetTPDestination got reply: ", reply) } // Check missing params - if err := rater.Call(utils.ApierV1SetTPDestination, new(utils.TPDestination), &reply); err == nil { - t.Error("Calling ApierV1.SetTPDestination, expected error, received: ", reply) + if err := rater.Call(utils.APIerSv1SetTPDestination, new(utils.TPDestination), &reply); err == nil { + t.Error("Calling APIerSv1.SetTPDestination, expected error, received: ", reply) } else if err.Error() != "MANDATORY_IE_MISSING: [TPid ID Prefixes]" { - t.Error("Calling ApierV1.SetTPDestination got unexpected error: ", err.Error()) + t.Error("Calling APIerSv1.SetTPDestination got unexpected error: ", err.Error()) } // Test get var rplyDstDe2 *utils.TPDestination - if err := rater.Call(utils.ApierV1GetTPDestination, AttrGetTPDestination{dstDe2.TPid, dstDe2.ID}, &rplyDstDe2); err != nil { - t.Error("Calling ApierV1.GetTPDestination, got error: ", err.Error()) + if err := rater.Call(utils.APIerSv1GetTPDestination, AttrGetTPDestination{dstDe2.TPid, dstDe2.ID}, &rplyDstDe2); err != nil { + t.Error("Calling APIerSv1.GetTPDestination, got error: ", err.Error()) } else if !reflect.DeepEqual(dstDe2, rplyDstDe2) { - t.Errorf("Calling ApierV1.GetTPDestination expected: %v, received: %v", dstDe2, rplyDstDe2) + t.Errorf("Calling APIerSv1.GetTPDestination expected: %v, received: %v", dstDe2, rplyDstDe2) } // Test remove - if err := rater.Call(utils.ApierV1RemoveTPDestination, AttrGetTPDestination{dstDe2.TPid, dstDe2.ID}, &reply); err != nil { - t.Error("Calling ApierV1.RemoveTPTiming, got error: ", err.Error()) + if err := rater.Call(utils.APIerSv1RemoveTPDestination, AttrGetTPDestination{dstDe2.TPid, dstDe2.ID}, &reply); err != nil { + t.Error("Calling APIerSv1.RemoveTPTiming, got error: ", err.Error()) } else if reply != utils.OK { - t.Error("Calling ApierV1.RemoveTPTiming received: ", reply) + t.Error("Calling APIerSv1.RemoveTPTiming received: ", reply) } // Test getIds var rplyDstIds []string expectedDstIds := []string{"FS_USERS", "GERMANY", "GERMANY_MOBILE"} - if err := rater.Call(utils.ApierV1GetTPDestinationIDs, AttrGetTPDestinationIds{TPid: dstDe.TPid}, &rplyDstIds); err != nil { - t.Error("Calling ApierV1.GetTPDestinationIDs, got error: ", err.Error()) + if err := rater.Call(utils.APIerSv1GetTPDestinationIDs, AttrGetTPDestinationIds{TPid: dstDe.TPid}, &rplyDstIds); err != nil { + t.Error("Calling APIerSv1.GetTPDestinationIDs, got error: ", err.Error()) } sort.Strings(expectedDstIds) sort.Strings(rplyDstIds) if !reflect.DeepEqual(expectedDstIds, rplyDstIds) { - t.Errorf("Calling ApierV1.GetTPDestinationIDs expected: %v, received: %v", expectedDstIds, rplyDstIds) + t.Errorf("Calling APIerSv1.GetTPDestinationIDs expected: %v, received: %v", expectedDstIds, rplyDstIds) } } @@ -341,44 +341,44 @@ func testApierTPRate(t *testing.T) { *rt2 = *rt rt2.ID = "RT_FS_USERS2" for _, r := range []*utils.TPRate{rt, rt2} { - if err := rater.Call(utils.ApierV1SetTPRate, r, &reply); err != nil { - t.Error("Got error on ApierV1.SetTPRate: ", err.Error()) + if err := rater.Call(utils.APIerSv1SetTPRate, r, &reply); err != nil { + t.Error("Got error on APIerSv1.SetTPRate: ", err.Error()) } else if reply != utils.OK { - t.Error("Unexpected reply received when calling ApierV1.SetTPRate: ", reply) + t.Error("Unexpected reply received when calling APIerSv1.SetTPRate: ", reply) } } // Check second set - if err := rater.Call(utils.ApierV1SetTPRate, rt2, &reply); err != nil { - t.Error("Got error on second ApierV1.SetTPRate: ", err.Error()) + if err := rater.Call(utils.APIerSv1SetTPRate, rt2, &reply); err != nil { + t.Error("Got error on second APIerSv1.SetTPRate: ", err.Error()) } else if reply != utils.OK { - t.Error("Calling ApierV1.SetTPRate got reply: ", reply) + t.Error("Calling APIerSv1.SetTPRate got reply: ", reply) } // Check missing params - if err := rater.Call(utils.ApierV1SetTPRate, new(utils.TPRate), &reply); err == nil { - t.Error("Calling ApierV1.SetTPDestination, expected error, received: ", reply) + if err := rater.Call(utils.APIerSv1SetTPRate, new(utils.TPRate), &reply); err == nil { + t.Error("Calling APIerSv1.SetTPDestination, expected error, received: ", reply) } else if err.Error() != "MANDATORY_IE_MISSING: [TPid ID RateSlots]" { - t.Error("Calling ApierV1.SetTPRate got unexpected error: ", err.Error()) + t.Error("Calling APIerSv1.SetTPRate got unexpected error: ", err.Error()) } // Test get var rplyRt2 *utils.TPRate - if err := rater.Call(utils.ApierV1GetTPRate, AttrGetTPRate{rt2.TPid, rt2.ID}, &rplyRt2); err != nil { - t.Error("Calling ApierV1.GetTPRate, got error: ", err.Error()) + if err := rater.Call(utils.APIerSv1GetTPRate, AttrGetTPRate{rt2.TPid, rt2.ID}, &rplyRt2); err != nil { + t.Error("Calling APIerSv1.GetTPRate, got error: ", err.Error()) } else if !reflect.DeepEqual(rt2, rplyRt2) { - t.Errorf("Calling ApierV1.GetTPRate expected: %+v, received: %+v", rt2, rplyRt2) + t.Errorf("Calling APIerSv1.GetTPRate expected: %+v, received: %+v", rt2, rplyRt2) } // Test remove - if err := rater.Call(utils.ApierV1RemoveTPRate, AttrGetTPRate{rt2.TPid, rt2.ID}, &reply); err != nil { - t.Error("Calling ApierV1.RemoveTPRate, got error: ", err.Error()) + if err := rater.Call(utils.APIerSv1RemoveTPRate, AttrGetTPRate{rt2.TPid, rt2.ID}, &reply); err != nil { + t.Error("Calling APIerSv1.RemoveTPRate, got error: ", err.Error()) } else if reply != utils.OK { - t.Error("Calling ApierV1.RemoveTPRate received: ", reply) + t.Error("Calling APIerSv1.RemoveTPRate received: ", reply) } // Test getIds var rplyRtIds []string expectedRtIds := []string{"RT_FS_USERS"} - if err := rater.Call(utils.ApierV1GetTPRateIds, AttrGetTPRateIds{rt.TPid, utils.PaginatorWithSearch{}}, &rplyRtIds); err != nil { - t.Error("Calling ApierV1.GetTPRateIds, got error: ", err.Error()) + if err := rater.Call(utils.APIerSv1GetTPRateIds, AttrGetTPRateIds{rt.TPid, utils.PaginatorWithSearch{}}, &rplyRtIds); err != nil { + t.Error("Calling APIerSv1.GetTPRateIds, got error: ", err.Error()) } else if !reflect.DeepEqual(expectedRtIds, rplyRtIds) { - t.Errorf("Calling ApierV1.GetTPDestinationIDs expected: %v, received: %v", expectedRtIds, rplyRtIds) + t.Errorf("Calling APIerSv1.GetTPDestinationIDs expected: %v, received: %v", expectedRtIds, rplyRtIds) } } @@ -395,44 +395,44 @@ func testApierTPDestinationRate(t *testing.T) { *dr2 = *dr dr2.ID = utils.TEST_SQL for _, d := range []*utils.TPDestinationRate{dr, dr2, drDe} { - if err := rater.Call(utils.ApierV1SetTPDestinationRate, d, &reply); err != nil { - t.Error("Got error on ApierV1.SetTPDestinationRate: ", err.Error()) + if err := rater.Call(utils.APIerSv1SetTPDestinationRate, d, &reply); err != nil { + t.Error("Got error on APIerSv1.SetTPDestinationRate: ", err.Error()) } else if reply != utils.OK { - t.Error("Unexpected reply received when calling ApierV1.SetTPDestinationRate: ", reply) + t.Error("Unexpected reply received when calling APIerSv1.SetTPDestinationRate: ", reply) } } // Check second set - if err := rater.Call(utils.ApierV1SetTPDestinationRate, dr2, &reply); err != nil { - t.Error("Got error on second ApierV1.SetTPDestinationRate: ", err.Error()) + if err := rater.Call(utils.APIerSv1SetTPDestinationRate, dr2, &reply); err != nil { + t.Error("Got error on second APIerSv1.SetTPDestinationRate: ", err.Error()) } else if reply != utils.OK { - t.Error("Calling ApierV1.SetTPDestinationRate got reply: ", reply) + t.Error("Calling APIerSv1.SetTPDestinationRate got reply: ", reply) } // Check missing params - if err := rater.Call(utils.ApierV1SetTPDestinationRate, new(utils.TPDestinationRate), &reply); err == nil { - t.Error("Calling ApierV1.SetTPDestination, expected error, received: ", reply) + if err := rater.Call(utils.APIerSv1SetTPDestinationRate, new(utils.TPDestinationRate), &reply); err == nil { + t.Error("Calling APIerSv1.SetTPDestination, expected error, received: ", reply) } else if err.Error() != "MANDATORY_IE_MISSING: [TPid ID DestinationRates]" { - t.Error("Calling ApierV1.SetTPDestinationRate got unexpected error: ", err.Error()) + t.Error("Calling APIerSv1.SetTPDestinationRate got unexpected error: ", err.Error()) } // Test get var rplyDr2 *utils.TPDestinationRate - if err := rater.Call(utils.ApierV1GetTPDestinationRate, AttrGetTPDestinationRate{dr2.TPid, dr2.ID, utils.Paginator{}}, &rplyDr2); err != nil { - t.Error("Calling ApierV1.GetTPDestinationRate, got error: ", err.Error()) + if err := rater.Call(utils.APIerSv1GetTPDestinationRate, AttrGetTPDestinationRate{dr2.TPid, dr2.ID, utils.Paginator{}}, &rplyDr2); err != nil { + t.Error("Calling APIerSv1.GetTPDestinationRate, got error: ", err.Error()) } else if !reflect.DeepEqual(dr2, rplyDr2) { - t.Errorf("Calling ApierV1.GetTPDestinationRate expected: %v, received: %v", dr2, rplyDr2) + t.Errorf("Calling APIerSv1.GetTPDestinationRate expected: %v, received: %v", dr2, rplyDr2) } // Test remove - if err := rater.Call(utils.ApierV1RemoveTPDestinationRate, AttrGetTPDestinationRate{dr2.TPid, dr2.ID, utils.Paginator{}}, &reply); err != nil { - t.Error("Calling ApierV1.RemoveTPRate, got error: ", err.Error()) + if err := rater.Call(utils.APIerSv1RemoveTPDestinationRate, AttrGetTPDestinationRate{dr2.TPid, dr2.ID, utils.Paginator{}}, &reply); err != nil { + t.Error("Calling APIerSv1.RemoveTPRate, got error: ", err.Error()) } else if reply != utils.OK { - t.Error("Calling ApierV1.RemoveTPRate received: ", reply) + t.Error("Calling APIerSv1.RemoveTPRate received: ", reply) } // Test getIds var rplyDrIds []string expectedDrIds := []string{"DR_FREESWITCH_USERS"} - if err := rater.Call(utils.ApierV1GetTPDestinationRateIds, AttrTPDestinationRateIds{dr.TPid, utils.PaginatorWithSearch{}}, &rplyDrIds); err != nil { - t.Error("Calling ApierV1.GetTPDestinationRateIds, got error: ", err.Error()) + if err := rater.Call(utils.APIerSv1GetTPDestinationRateIds, AttrTPDestinationRateIds{dr.TPid, utils.PaginatorWithSearch{}}, &rplyDrIds); err != nil { + t.Error("Calling APIerSv1.GetTPDestinationRateIds, got error: ", err.Error()) } else if !reflect.DeepEqual(expectedDrIds, rplyDrIds) { - t.Errorf("Calling ApierV1.GetTPDestinationRateIds expected: %v, received: %v", expectedDrIds, rplyDrIds) + t.Errorf("Calling APIerSv1.GetTPDestinationRateIds expected: %v, received: %v", expectedDrIds, rplyDrIds) } } @@ -446,44 +446,44 @@ func testApierTPRatingPlan(t *testing.T) { *rpTst = *rp rpTst.ID = utils.TEST_SQL for _, rpl := range []*utils.TPRatingPlan{rp, rpTst} { - if err := rater.Call(utils.ApierV1SetTPRatingPlan, rpl, &reply); err != nil { - t.Error("Got error on ApierV1.SetTPRatingPlan: ", err.Error()) + if err := rater.Call(utils.APIerSv1SetTPRatingPlan, rpl, &reply); err != nil { + t.Error("Got error on APIerSv1.SetTPRatingPlan: ", err.Error()) } else if reply != utils.OK { - t.Error("Unexpected reply received when calling ApierV1.SetTPRatingPlan: ", reply) + t.Error("Unexpected reply received when calling APIerSv1.SetTPRatingPlan: ", reply) } } // Check second set - if err := rater.Call(utils.ApierV1SetTPRatingPlan, rpTst, &reply); err != nil { - t.Error("Got error on second ApierV1.SetTPRatingPlan: ", err.Error()) + if err := rater.Call(utils.APIerSv1SetTPRatingPlan, rpTst, &reply); err != nil { + t.Error("Got error on second APIerSv1.SetTPRatingPlan: ", err.Error()) } else if reply != utils.OK { - t.Error("Calling ApierV1.SetTPRatingPlan got reply: ", reply) + t.Error("Calling APIerSv1.SetTPRatingPlan got reply: ", reply) } // Check missing params - if err := rater.Call(utils.ApierV1SetTPRatingPlan, new(utils.TPRatingPlan), &reply); err == nil { - t.Error("Calling ApierV1.SetTPRatingPlan, expected error, received: ", reply) + if err := rater.Call(utils.APIerSv1SetTPRatingPlan, new(utils.TPRatingPlan), &reply); err == nil { + t.Error("Calling APIerSv1.SetTPRatingPlan, expected error, received: ", reply) } else if err.Error() != "MANDATORY_IE_MISSING: [TPid ID RatingPlanBindings]" { - t.Error("Calling ApierV1.SetTPRatingPlan got unexpected error: ", err.Error()) + t.Error("Calling APIerSv1.SetTPRatingPlan got unexpected error: ", err.Error()) } // Test get var rplyRpTst *utils.TPRatingPlan - if err := rater.Call(utils.ApierV1GetTPRatingPlan, AttrGetTPRatingPlan{TPid: rpTst.TPid, ID: rpTst.ID}, &rplyRpTst); err != nil { - t.Error("Calling ApierV1.GetTPRatingPlan, got error: ", err.Error()) + if err := rater.Call(utils.APIerSv1GetTPRatingPlan, AttrGetTPRatingPlan{TPid: rpTst.TPid, ID: rpTst.ID}, &rplyRpTst); err != nil { + t.Error("Calling APIerSv1.GetTPRatingPlan, got error: ", err.Error()) } else if !reflect.DeepEqual(rpTst, rplyRpTst) { - t.Errorf("Calling ApierV1.GetTPRatingPlan expected: %v, received: %v", rpTst, rplyRpTst) + t.Errorf("Calling APIerSv1.GetTPRatingPlan expected: %v, received: %v", rpTst, rplyRpTst) } // Test remove - if err := rater.Call(utils.ApierV1RemoveTPRatingPlan, AttrGetTPRatingPlan{TPid: rpTst.TPid, ID: rpTst.ID}, &reply); err != nil { - t.Error("Calling ApierV1.RemoveTPRatingPlan, got error: ", err.Error()) + if err := rater.Call(utils.APIerSv1RemoveTPRatingPlan, AttrGetTPRatingPlan{TPid: rpTst.TPid, ID: rpTst.ID}, &reply); err != nil { + t.Error("Calling APIerSv1.RemoveTPRatingPlan, got error: ", err.Error()) } else if reply != utils.OK { - t.Error("Calling ApierV1.RemoveTPRatingPlan received: ", reply) + t.Error("Calling APIerSv1.RemoveTPRatingPlan received: ", reply) } // Test getIds var rplyRpIds []string expectedRpIds := []string{"RETAIL1"} - if err := rater.Call(utils.ApierV1GetTPRatingPlanIds, AttrGetTPRatingPlanIds{rp.TPid, utils.PaginatorWithSearch{}}, &rplyRpIds); err != nil { - t.Error("Calling ApierV1.GetTPRatingPlanIds, got error: ", err.Error()) + if err := rater.Call(utils.APIerSv1GetTPRatingPlanIds, AttrGetTPRatingPlanIds{rp.TPid, utils.PaginatorWithSearch{}}, &rplyRpIds); err != nil { + t.Error("Calling APIerSv1.GetTPRatingPlanIds, got error: ", err.Error()) } else if !reflect.DeepEqual(expectedRpIds, rplyRpIds) { - t.Errorf("Calling ApierV1.GetTPRatingPlanIds expected: %v, received: %v", expectedRpIds, rplyRpIds) + t.Errorf("Calling APIerSv1.GetTPRatingPlanIds expected: %v, received: %v", expectedRpIds, rplyRpIds) } } @@ -506,44 +506,44 @@ func testApierTPRatingProfile(t *testing.T) { *rpfTst = *rpf rpfTst.Subject = utils.TEST_SQL for _, rp := range []*utils.TPRatingProfile{rpf, rpfTst} { - if err := rater.Call(utils.ApierV1SetTPRatingProfile, rp, &reply); err != nil { - t.Error("Got error on ApierV1.SetTPRatingProfile: ", err.Error()) + if err := rater.Call(utils.APIerSv1SetTPRatingProfile, rp, &reply); err != nil { + t.Error("Got error on APIerSv1.SetTPRatingProfile: ", err.Error()) } else if reply != utils.OK { - t.Error("Unexpected reply received when calling ApierV1.SetTPRatingProfile: ", reply) + t.Error("Unexpected reply received when calling APIerSv1.SetTPRatingProfile: ", reply) } } // Check second set - if err := rater.Call(utils.ApierV1SetTPRatingProfile, rpfTst, &reply); err != nil { - t.Error("Got error on second ApierV1.SetTPRatingProfile: ", err.Error()) + if err := rater.Call(utils.APIerSv1SetTPRatingProfile, rpfTst, &reply); err != nil { + t.Error("Got error on second APIerSv1.SetTPRatingProfile: ", err.Error()) } else if reply != utils.OK { - t.Error("Calling ApierV1.SetTPRatingProfile got reply: ", reply) + t.Error("Calling APIerSv1.SetTPRatingProfile got reply: ", reply) } // Check missing params - if err := rater.Call(utils.ApierV1SetTPRatingProfile, new(utils.TPRatingProfile), &reply); err == nil { - t.Error("Calling ApierV1.SetTPRatingProfile, expected error, received: ", reply) + if err := rater.Call(utils.APIerSv1SetTPRatingProfile, new(utils.TPRatingProfile), &reply); err == nil { + t.Error("Calling APIerSv1.SetTPRatingProfile, expected error, received: ", reply) } else if err.Error() != "MANDATORY_IE_MISSING: [TPid LoadId Tenant Category Subject RatingPlanActivations]" { - t.Error("Calling ApierV1.SetTPRatingProfile got unexpected error: ", err.Error()) + t.Error("Calling APIerSv1.SetTPRatingProfile got unexpected error: ", err.Error()) } // Test get var rplyRpf *utils.TPRatingProfile - if err := rater.Call(utils.ApierV1GetTPRatingProfile, AttrGetTPRatingProfile{TPid: rpfTst.TPid, RatingProfileID: rpfTst.GetId()}, &rplyRpf); err != nil { - t.Error("Calling ApierV1.GetTPRatingProfiles, got error: ", err.Error()) + if err := rater.Call(utils.APIerSv1GetTPRatingProfile, AttrGetTPRatingProfile{TPid: rpfTst.TPid, RatingProfileID: rpfTst.GetId()}, &rplyRpf); err != nil { + t.Error("Calling APIerSv1.GetTPRatingProfiles, got error: ", err.Error()) } else if !reflect.DeepEqual(rpfTst, rplyRpf) { - t.Errorf("Calling ApierV1.GetTPRatingProfiles expected: %v, received: %v", rpfTst, rplyRpf) + t.Errorf("Calling APIerSv1.GetTPRatingProfiles expected: %v, received: %v", rpfTst, rplyRpf) } // Test remove - if err := rater.Call(utils.ApierV1RemoveTPRatingProfile, AttrGetTPRatingProfile{TPid: rpfTst.TPid, RatingProfileID: rpfTst.GetId()}, &reply); err != nil { - t.Error("Calling ApierV1.RemoveTPRatingProfile, got error: ", err.Error()) + if err := rater.Call(utils.APIerSv1RemoveTPRatingProfile, AttrGetTPRatingProfile{TPid: rpfTst.TPid, RatingProfileID: rpfTst.GetId()}, &reply); err != nil { + t.Error("Calling APIerSv1.RemoveTPRatingProfile, got error: ", err.Error()) } else if reply != utils.OK { - t.Error("Calling ApierV1.RemoveTPRatingProfile received: ", reply) + t.Error("Calling APIerSv1.RemoveTPRatingProfile received: ", reply) } // Test getLoadIds var rplyRpIds []string expectedRpIds := []string{utils.TEST_SQL} - if err := rater.Call(utils.ApierV1GetTPRatingProfileLoadIds, utils.AttrTPRatingProfileIds{TPid: rpf.TPid}, &rplyRpIds); err != nil { - t.Error("Calling ApierV1.GetTPRatingProfileLoadIds, got error: ", err.Error()) + if err := rater.Call(utils.APIerSv1GetTPRatingProfileLoadIds, utils.AttrTPRatingProfileIds{TPid: rpf.TPid}, &rplyRpIds); err != nil { + t.Error("Calling APIerSv1.GetTPRatingProfileLoadIds, got error: ", err.Error()) } else if !reflect.DeepEqual(expectedRpIds, rplyRpIds) { - t.Errorf("Calling ApierV1.GetTPRatingProfileLoadIds expected: %v, received: %v", expectedRpIds, rplyRpIds) + t.Errorf("Calling APIerSv1.GetTPRatingProfileLoadIds expected: %v, received: %v", expectedRpIds, rplyRpIds) } } @@ -565,47 +565,47 @@ func testApierTPActions(t *testing.T) { *actTst = *act actTst.ID = utils.TEST_SQL for _, ac := range []*utils.TPActions{act, actWarn, actTst, actLog} { - if err := rater.Call(utils.ApierV1SetTPActions, ac, &reply); err != nil { - t.Error("Got error on ApierV1.SetTPActions: ", err.Error()) + if err := rater.Call(utils.APIerSv1SetTPActions, ac, &reply); err != nil { + t.Error("Got error on APIerSv1.SetTPActions: ", err.Error()) } else if reply != utils.OK { - t.Error("Unexpected reply received when calling ApierV1.SetTPActions: ", reply) + t.Error("Unexpected reply received when calling APIerSv1.SetTPActions: ", reply) } } // Check second set - if err := rater.Call(utils.ApierV1SetTPActions, actTst, &reply); err != nil { - t.Error("Got error on second ApierV1.SetTPActions: ", err.Error()) + if err := rater.Call(utils.APIerSv1SetTPActions, actTst, &reply); err != nil { + t.Error("Got error on second APIerSv1.SetTPActions: ", err.Error()) } else if reply != utils.OK { - t.Error("Calling ApierV1.SetTPActions got reply: ", reply) + t.Error("Calling APIerSv1.SetTPActions got reply: ", reply) } // Check missing params - if err := rater.Call(utils.ApierV1SetTPActions, new(utils.TPActions), &reply); err == nil { - t.Error("Calling ApierV1.SetTPActions, expected error, received: ", reply) + if err := rater.Call(utils.APIerSv1SetTPActions, new(utils.TPActions), &reply); err == nil { + t.Error("Calling APIerSv1.SetTPActions, expected error, received: ", reply) } else if err.Error() != "MANDATORY_IE_MISSING: [TPid ID Actions]" { - t.Error("Calling ApierV1.SetTPActions got unexpected error: ", err.Error()) + t.Error("Calling APIerSv1.SetTPActions got unexpected error: ", err.Error()) } // Test get var rplyActs *utils.TPActions - if err := rater.Call(utils.ApierV1GetTPActions, AttrGetTPActions{TPid: actTst.TPid, ID: actTst.ID}, &rplyActs); err != nil { - t.Error("Calling ApierV1.GetTPActions, got error: ", err.Error()) + if err := rater.Call(utils.APIerSv1GetTPActions, AttrGetTPActions{TPid: actTst.TPid, ID: actTst.ID}, &rplyActs); err != nil { + t.Error("Calling APIerSv1.GetTPActions, got error: ", err.Error()) } else if !reflect.DeepEqual(actTst, rplyActs) { - t.Errorf("Calling ApierV1.GetTPActions expected: %v, received: %v", actTst, rplyActs) + t.Errorf("Calling APIerSv1.GetTPActions expected: %v, received: %v", actTst, rplyActs) } // Test remove - if err := rater.Call(utils.ApierV1RemoveTPActions, AttrGetTPActions{TPid: actTst.TPid, ID: actTst.ID}, &reply); err != nil { - t.Error("Calling ApierV1.RemoveTPActions, got error: ", err.Error()) + if err := rater.Call(utils.APIerSv1RemoveTPActions, AttrGetTPActions{TPid: actTst.TPid, ID: actTst.ID}, &reply); err != nil { + t.Error("Calling APIerSv1.RemoveTPActions, got error: ", err.Error()) } else if reply != utils.OK { - t.Error("Calling ApierV1.RemoveTPActions received: ", reply) + t.Error("Calling APIerSv1.RemoveTPActions received: ", reply) } // Test getIds var rplyIds []string expectedIds := []string{"LOG_BALANCE", "PREPAID_10", "WARN_VIA_HTTP"} - if err := rater.Call(utils.ApierV1GetTPActionIds, AttrGetTPActionIds{TPid: actTst.TPid}, &rplyIds); err != nil { - t.Error("Calling ApierV1.GetTPActionIds, got error: ", err.Error()) + if err := rater.Call(utils.APIerSv1GetTPActionIds, AttrGetTPActionIds{TPid: actTst.TPid}, &rplyIds); err != nil { + t.Error("Calling APIerSv1.GetTPActionIds, got error: ", err.Error()) } sort.Strings(expectedIds) sort.Strings(rplyIds) if !reflect.DeepEqual(expectedIds, rplyIds) { - t.Errorf("Calling ApierV1.GetTPActionIds expected: %v, received: %v", expectedIds, rplyIds) + t.Errorf("Calling APIerSv1.GetTPActionIds expected: %v, received: %v", expectedIds, rplyIds) } } @@ -618,44 +618,44 @@ func testApierTPActionPlan(t *testing.T) { *atTst = *at atTst.ID = utils.TEST_SQL for _, act := range []*utils.TPActionPlan{at, atTst} { - if err := rater.Call(utils.ApierV1SetTPActionPlan, act, &reply); err != nil { - t.Error("Got error on ApierV1.SetTPActionPlan: ", err.Error()) + if err := rater.Call(utils.APIerSv1SetTPActionPlan, act, &reply); err != nil { + t.Error("Got error on APIerSv1.SetTPActionPlan: ", err.Error()) } else if reply != utils.OK { - t.Error("Unexpected reply received when calling ApierV1.SetTPActionPlan: ", reply) + t.Error("Unexpected reply received when calling APIerSv1.SetTPActionPlan: ", reply) } } // Check second set - if err := rater.Call(utils.ApierV1SetTPActionPlan, atTst, &reply); err != nil { - t.Error("Got error on second ApierV1.SetTPActionPlan: ", err.Error()) + if err := rater.Call(utils.APIerSv1SetTPActionPlan, atTst, &reply); err != nil { + t.Error("Got error on second APIerSv1.SetTPActionPlan: ", err.Error()) } else if reply != utils.OK { - t.Error("Calling ApierV1.SetTPActionPlan got reply: ", reply) + t.Error("Calling APIerSv1.SetTPActionPlan got reply: ", reply) } // Check missing params - if err := rater.Call(utils.ApierV1SetTPActionPlan, new(utils.TPActionPlan), &reply); err == nil { - t.Error("Calling ApierV1.SetTPActionPlan, expected error, received: ", reply) + if err := rater.Call(utils.APIerSv1SetTPActionPlan, new(utils.TPActionPlan), &reply); err == nil { + t.Error("Calling APIerSv1.SetTPActionPlan, expected error, received: ", reply) } else if err.Error() != "MANDATORY_IE_MISSING: [TPid ID ActionPlan]" { - t.Error("Calling ApierV1.SetTPActionPlan got unexpected error: ", err.Error()) + t.Error("Calling APIerSv1.SetTPActionPlan got unexpected error: ", err.Error()) } // Test get var rplyActs *utils.TPActionPlan - if err := rater.Call(utils.ApierV1GetTPActionPlan, AttrGetTPActionPlan{TPid: atTst.TPid, ID: atTst.ID}, &rplyActs); err != nil { - t.Error("Calling ApierV1.GetTPActionPlan, got error: ", err.Error()) + if err := rater.Call(utils.APIerSv1GetTPActionPlan, AttrGetTPActionPlan{TPid: atTst.TPid, ID: atTst.ID}, &rplyActs); err != nil { + t.Error("Calling APIerSv1.GetTPActionPlan, got error: ", err.Error()) } else if !reflect.DeepEqual(atTst, rplyActs) { - t.Errorf("Calling ApierV1.GetTPActionPlan expected: %v, received: %v", atTst, rplyActs) + t.Errorf("Calling APIerSv1.GetTPActionPlan expected: %v, received: %v", atTst, rplyActs) } // Test remove - if err := rater.Call(utils.ApierV1RemoveTPActionPlan, AttrGetTPActionPlan{TPid: atTst.TPid, ID: atTst.ID}, &reply); err != nil { - t.Error("Calling ApierV1.RemoveTPActionPlan, got error: ", err.Error()) + if err := rater.Call(utils.APIerSv1RemoveTPActionPlan, AttrGetTPActionPlan{TPid: atTst.TPid, ID: atTst.ID}, &reply); err != nil { + t.Error("Calling APIerSv1.RemoveTPActionPlan, got error: ", err.Error()) } else if reply != utils.OK { - t.Error("Calling ApierV1.RemoveTPActionPlan received: ", reply) + t.Error("Calling APIerSv1.RemoveTPActionPlan received: ", reply) } // Test getIds var rplyIds []string expectedIds := []string{"PREPAID_10"} - if err := rater.Call(utils.ApierV1GetTPActionPlanIds, AttrGetTPActionPlanIds{TPid: atTst.TPid}, &rplyIds); err != nil { - t.Error("Calling ApierV1.GetTPActionPlanIds, got error: ", err.Error()) + if err := rater.Call(utils.APIerSv1GetTPActionPlanIds, AttrGetTPActionPlanIds{TPid: atTst.TPid}, &rplyIds); err != nil { + t.Error("Calling APIerSv1.GetTPActionPlanIds, got error: ", err.Error()) } else if !reflect.DeepEqual(expectedIds, rplyIds) { - t.Errorf("Calling ApierV1.GetTPActionPlanIds expected: %v, received: %v", expectedIds, rplyIds) + t.Errorf("Calling APIerSv1.GetTPActionPlanIds expected: %v, received: %v", expectedIds, rplyIds) } } @@ -679,44 +679,44 @@ func testApierTPActionTriggers(t *testing.T) { atTst.ID = utils.TEST_SQL atTst.ActionTriggers[0].Id = utils.TEST_SQL for _, act := range []*utils.TPActionTriggers{at, atTst} { - if err := rater.Call(utils.ApierV1SetTPActionTriggers, act, &reply); err != nil { - t.Error("Got error on ApierV1.SetTPActionTriggers: ", err.Error()) + if err := rater.Call(utils.APIerSv1SetTPActionTriggers, act, &reply); err != nil { + t.Error("Got error on APIerSv1.SetTPActionTriggers: ", err.Error()) } else if reply != utils.OK { - t.Error("Unexpected reply received when calling ApierV1.SetTPActionTriggers: ", reply) + t.Error("Unexpected reply received when calling APIerSv1.SetTPActionTriggers: ", reply) } } // Check second set - if err := rater.Call(utils.ApierV1SetTPActionTriggers, atTst, &reply); err != nil { - t.Error("Got error on second ApierV1.SetTPActionTriggers: ", err.Error()) + if err := rater.Call(utils.APIerSv1SetTPActionTriggers, atTst, &reply); err != nil { + t.Error("Got error on second APIerSv1.SetTPActionTriggers: ", err.Error()) } else if reply != utils.OK { - t.Error("Calling ApierV1.SetTPActionTriggers got reply: ", reply) + t.Error("Calling APIerSv1.SetTPActionTriggers got reply: ", reply) } // Check missing params - if err := rater.Call(utils.ApierV1SetTPActionTriggers, new(utils.TPActionTriggers), &reply); err == nil { - t.Error("Calling ApierV1.SetTPActionTriggers, expected error, received: ", reply) + if err := rater.Call(utils.APIerSv1SetTPActionTriggers, new(utils.TPActionTriggers), &reply); err == nil { + t.Error("Calling APIerSv1.SetTPActionTriggers, expected error, received: ", reply) } else if err.Error() != "MANDATORY_IE_MISSING: [TPid ID]" { - t.Error("Calling ApierV1.SetTPActionTriggers got unexpected error: ", err.Error()) + t.Error("Calling APIerSv1.SetTPActionTriggers got unexpected error: ", err.Error()) } // Test get var rplyActs *utils.TPActionTriggers - if err := rater.Call(utils.ApierV1GetTPActionTriggers, AttrGetTPActionTriggers{TPid: atTst.TPid, ID: atTst.ID}, &rplyActs); err != nil { - t.Errorf("Calling ApierV1.GetTPActionTriggers %s, got error: %s", atTst.ID, err.Error()) + if err := rater.Call(utils.APIerSv1GetTPActionTriggers, AttrGetTPActionTriggers{TPid: atTst.TPid, ID: atTst.ID}, &rplyActs); err != nil { + t.Errorf("Calling APIerSv1.GetTPActionTriggers %s, got error: %s", atTst.ID, err.Error()) } else if !reflect.DeepEqual(atTst, rplyActs) { - t.Errorf("Calling ApierV1.GetTPActionTriggers expected: %+v, received: %+v", utils.ToJSON(atTst), utils.ToJSON(rplyActs)) + t.Errorf("Calling APIerSv1.GetTPActionTriggers expected: %+v, received: %+v", utils.ToJSON(atTst), utils.ToJSON(rplyActs)) } // Test remove - if err := rater.Call(utils.ApierV1RemoveTPActionTriggers, AttrGetTPActionTriggers{TPid: atTst.TPid, ID: atTst.ID}, &reply); err != nil { - t.Error("Calling ApierV1.RemoveTPActionTriggers, got error: ", err.Error()) + if err := rater.Call(utils.APIerSv1RemoveTPActionTriggers, AttrGetTPActionTriggers{TPid: atTst.TPid, ID: atTst.ID}, &reply); err != nil { + t.Error("Calling APIerSv1.RemoveTPActionTriggers, got error: ", err.Error()) } else if reply != utils.OK { - t.Error("Calling ApierV1.RemoveTPActionTriggers received: ", reply) + t.Error("Calling APIerSv1.RemoveTPActionTriggers received: ", reply) } // Test getIds var rplyIds []string expectedIds := []string{"STANDARD_TRIGGERS"} - if err := rater.Call(utils.ApierV1GetTPActionTriggerIds, AttrGetTPActionTriggerIds{TPid: atTst.TPid}, &rplyIds); err != nil { - t.Error("Calling ApierV1.GetTPActionTriggerIds, got error: ", err.Error()) + if err := rater.Call(utils.APIerSv1GetTPActionTriggerIds, AttrGetTPActionTriggerIds{TPid: atTst.TPid}, &rplyIds); err != nil { + t.Error("Calling APIerSv1.GetTPActionTriggerIds, got error: ", err.Error()) } else if !reflect.DeepEqual(expectedIds, rplyIds) { - t.Errorf("Calling ApierV1.GetTPActionTriggerIds expected: %v, received: %v", expectedIds, rplyIds) + t.Errorf("Calling APIerSv1.GetTPActionTriggerIds expected: %v, received: %v", expectedIds, rplyIds) } } @@ -737,54 +737,54 @@ func testApierTPAccountActions(t *testing.T) { *aaTst = *aa1 aaTst.Account = utils.TEST_SQL for _, aact := range []*utils.TPAccountActions{aa1, aa2, aa3, aa4, aa5, aaTst} { - if err := rater.Call(utils.ApierV1SetTPAccountActions, aact, &reply); err != nil { - t.Error("Got error on ApierV1.SetTPAccountActions: ", err.Error()) + if err := rater.Call(utils.APIerSv1SetTPAccountActions, aact, &reply); err != nil { + t.Error("Got error on APIerSv1.SetTPAccountActions: ", err.Error()) } else if reply != utils.OK { - t.Error("Unexpected reply received when calling ApierV1.SetTPAccountActions: ", reply) + t.Error("Unexpected reply received when calling APIerSv1.SetTPAccountActions: ", reply) } } // Check second set - if err := rater.Call(utils.ApierV1SetTPAccountActions, aaTst, &reply); err != nil { - t.Error("Got error on second ApierV1.SetTPAccountActions: ", err.Error()) + if err := rater.Call(utils.APIerSv1SetTPAccountActions, aaTst, &reply); err != nil { + t.Error("Got error on second APIerSv1.SetTPAccountActions: ", err.Error()) } else if reply != utils.OK { - t.Error("Calling ApierV1.SetTPAccountActions got reply: ", reply) + t.Error("Calling APIerSv1.SetTPAccountActions got reply: ", reply) } // Check missing params - if err := rater.Call(utils.ApierV1SetTPAccountActions, new(utils.TPAccountActions), &reply); err == nil { - t.Error("Calling ApierV1.SetTPAccountActions, expected error, received: ", reply) + if err := rater.Call(utils.APIerSv1SetTPAccountActions, new(utils.TPAccountActions), &reply); err == nil { + t.Error("Calling APIerSv1.SetTPAccountActions, expected error, received: ", reply) } else if err.Error() != "MANDATORY_IE_MISSING: [TPid LoadId Tenant Account ActionPlanId]" { - t.Error("Calling ApierV1.SetTPAccountActions got unexpected error: ", err.Error()) + t.Error("Calling APIerSv1.SetTPAccountActions got unexpected error: ", err.Error()) } // Test get var rplyaa *utils.TPAccountActions - if err := rater.Call(utils.ApierV1GetTPAccountActions, AttrGetTPAccountActions{TPid: aaTst.TPid, AccountActionsId: aaTst.GetId()}, &rplyaa); err != nil { - t.Error("Calling ApierV1.GetTPAccountActions, got error: ", err.Error()) + if err := rater.Call(utils.APIerSv1GetTPAccountActions, AttrGetTPAccountActions{TPid: aaTst.TPid, AccountActionsId: aaTst.GetId()}, &rplyaa); err != nil { + t.Error("Calling APIerSv1.GetTPAccountActions, got error: ", err.Error()) } else if !reflect.DeepEqual(aaTst, rplyaa) { - t.Errorf("Calling ApierV1.GetTPAccountActions expected: %v, received: %v", aaTst, rplyaa) + t.Errorf("Calling APIerSv1.GetTPAccountActions expected: %v, received: %v", aaTst, rplyaa) } // Test remove - if err := rater.Call(utils.ApierV1RemoveTPAccountActions, AttrGetTPAccountActions{TPid: aaTst.TPid, AccountActionsId: aaTst.GetId()}, &reply); err != nil { - t.Error("Calling ApierV1.RemoveTPAccountActions, got error: ", err.Error()) + if err := rater.Call(utils.APIerSv1RemoveTPAccountActions, AttrGetTPAccountActions{TPid: aaTst.TPid, AccountActionsId: aaTst.GetId()}, &reply); err != nil { + t.Error("Calling APIerSv1.RemoveTPAccountActions, got error: ", err.Error()) } else if reply != utils.OK { - t.Error("Calling ApierV1.RemoveTPAccountActions received: ", reply) + t.Error("Calling APIerSv1.RemoveTPAccountActions received: ", reply) } // Test getLoadIds var rplyRpIds []string expectedRpIds := []string{utils.TEST_SQL} - if err := rater.Call(utils.ApierV1GetTPAccountActionLoadIds, AttrGetTPAccountActionIds{TPid: aaTst.TPid}, &rplyRpIds); err != nil { - t.Error("Calling ApierV1.GetTPAccountActionLoadIds, got error: ", err.Error()) + if err := rater.Call(utils.APIerSv1GetTPAccountActionLoadIds, AttrGetTPAccountActionIds{TPid: aaTst.TPid}, &rplyRpIds); err != nil { + t.Error("Calling APIerSv1.GetTPAccountActionLoadIds, got error: ", err.Error()) } else if !reflect.DeepEqual(expectedRpIds, rplyRpIds) { - t.Errorf("Calling ApierV1.GetTPAccountActionLoadIds expected: %v, received: %v", expectedRpIds, rplyRpIds) + t.Errorf("Calling APIerSv1.GetTPAccountActionLoadIds expected: %v, received: %v", expectedRpIds, rplyRpIds) } } // Test here LoadRatingPlan func testApierLoadRatingPlan(t *testing.T) { var reply string - if err := rater.Call(utils.ApierV1LoadRatingPlan, AttrLoadRatingPlan{TPid: utils.TEST_SQL, RatingPlanId: "RETAIL1"}, &reply); err != nil { - t.Error("Got error on ApierV1.LoadRatingPlan: ", err.Error()) + if err := rater.Call(utils.APIerSv1LoadRatingPlan, AttrLoadRatingPlan{TPid: utils.TEST_SQL, RatingPlanId: "RETAIL1"}, &reply); err != nil { + t.Error("Got error on APIerSv1.LoadRatingPlan: ", err.Error()) } else if reply != utils.OK { - t.Error("Calling ApierV1.LoadRatingPlan got reply: ", reply) + t.Error("Calling APIerSv1.LoadRatingPlan got reply: ", reply) } } @@ -794,10 +794,10 @@ func testApierLoadRatingProfile(t *testing.T) { rpf := &utils.TPRatingProfile{ TPid: utils.TEST_SQL, LoadId: utils.TEST_SQL, Tenant: "cgrates.org", Category: "call", Subject: "*any"} - if err := rater.Call(utils.ApierV1LoadRatingProfile, rpf, &reply); err != nil { - t.Error("Got error on ApierV1.LoadRatingProfile: ", err.Error()) + if err := rater.Call(utils.APIerSv1LoadRatingProfile, rpf, &reply); err != nil { + t.Error("Got error on APIerSv1.LoadRatingProfile: ", err.Error()) } else if reply != utils.OK { - t.Error("Calling ApierV1.LoadRatingProfile got reply: ", reply) + t.Error("Calling APIerSv1.LoadRatingProfile got reply: ", reply) } } @@ -812,10 +812,10 @@ func testApierLoadAccountActions(t *testing.T) { } var reply string aa1 := &utils.TPAccountActions{TPid: utils.TEST_SQL, LoadId: utils.TEST_SQL, Tenant: "cgrates.org", Account: "1001"} - if err := rater.Call(utils.ApierV1LoadAccountActions, aa1, &reply); err != nil { - t.Error("Got error on ApierV1.LoadAccountActions: ", err.Error()) + if err := rater.Call(utils.APIerSv1LoadAccountActions, aa1, &reply); err != nil { + t.Error("Got error on APIerSv1.LoadAccountActions: ", err.Error()) } else if reply != utils.OK { - t.Error("Calling ApierV1.LoadAccountActions got reply: ", reply) + t.Error("Calling APIerSv1.LoadAccountActions got reply: ", reply) } time.Sleep(10 * time.Millisecond) expectedStats[utils.CacheAccountActionPlans].Items = 1 @@ -845,10 +845,10 @@ func testApierSetRatingProfile(t *testing.T) { rpa := &utils.TPRatingActivation{ActivationTime: "2012-01-01T00:00:00Z", RatingPlanId: "RETAIL1", FallbackSubjects: "dan2"} rpf := &utils.AttrSetRatingProfile{Tenant: "cgrates.org", Category: "call", Subject: "dan", RatingPlanActivations: []*utils.TPRatingActivation{rpa}} - if err := rater.Call(utils.ApierV1SetRatingProfile, rpf, &reply); err != nil { - t.Error("Got error on ApierV1.SetRatingProfile: ", err.Error()) + if err := rater.Call(utils.APIerSv1SetRatingProfile, rpf, &reply); err != nil { + t.Error("Got error on APIerSv1.SetRatingProfile: ", err.Error()) } else if reply != utils.OK { - t.Error("Calling ApierV1.SetRatingProfile got reply: ", reply) + t.Error("Calling APIerSv1.SetRatingProfile got reply: ", reply) } var rcvStats map[string]*ltcache.CacheStats expectedStats := engine.GetDefaultEmptyCacheStats() @@ -862,7 +862,7 @@ func testApierSetRatingProfile(t *testing.T) { t.Errorf("Calling CacheSv1.GetCacheStats expected: %+v, received: %+v", expectedStats, rcvStats) } // Calling the second time should not raise EXISTS - if err := rater.Call(utils.ApierV1SetRatingProfile, rpf, &reply); err != nil { + if err := rater.Call(utils.APIerSv1SetRatingProfile, rpf, &reply); err != nil { t.Error("Unexpected result on duplication: ", err.Error()) } // Make sure rates were loaded for account dan @@ -897,7 +897,7 @@ func testApierSetRatingProfile(t *testing.T) { } } -func testApierV1GetRatingProfile(t *testing.T) { +func testAPIerSv1GetRatingProfile(t *testing.T) { var rpl engine.RatingProfile attrGetRatingPlan := &utils.AttrGetRatingProfile{ Tenant: "cgrates.org", Category: "call", Subject: "dan"} @@ -920,24 +920,24 @@ func testApierV1GetRatingProfile(t *testing.T) { }, }, } - if err := rater.Call(utils.ApierV1GetRatingProfile, attrGetRatingPlan, &rpl); err != nil { - t.Errorf("Got error on ApierV1.GetRatingProfile: %+v", err) + if err := rater.Call(utils.APIerSv1GetRatingProfile, attrGetRatingPlan, &rpl); err != nil { + t.Errorf("Got error on APIerSv1.GetRatingProfile: %+v", err) } else if !reflect.DeepEqual(expected, rpl) { - t.Errorf("Calling ApierV1.GetRatingProfile expected: %+v, received: %+v", utils.ToJSON(expected), utils.ToJSON(rpl)) + t.Errorf("Calling APIerSv1.GetRatingProfile expected: %+v, received: %+v", utils.ToJSON(expected), utils.ToJSON(rpl)) } attrGetRatingPlan.Subject = utils.EmptyString - if err := rater.Call(utils.ApierV1GetRatingProfile, attrGetRatingPlan, &rpl); err == nil { - t.Errorf("Expected error on ApierV1.GetRatingProfile, recived : %+v", rpl) + if err := rater.Call(utils.APIerSv1GetRatingProfile, attrGetRatingPlan, &rpl); err == nil { + t.Errorf("Expected error on APIerSv1.GetRatingProfile, recived : %+v", rpl) } attrGetRatingPlan.Subject = "dan" attrGetRatingPlan.Tenant = "other_tenant" - if err := rater.Call(utils.ApierV1GetRatingProfile, attrGetRatingPlan, &rpl); err.Error() != utils.ErrNotFound.Error() { - t.Errorf("Expected error on ApierV1.GetRatingProfile, recived : %+v", err) + if err := rater.Call(utils.APIerSv1GetRatingProfile, attrGetRatingPlan, &rpl); err.Error() != utils.ErrNotFound.Error() { + t.Errorf("Expected error on APIerSv1.GetRatingProfile, recived : %+v", err) } expectedIds := []string{"call:dan", "call:*any"} var result []string - if err := rater.Call(utils.ApierV1GetRatingProfileIDs, utils.TenantArgWithPaginator{TenantArg: utils.TenantArg{Tenant: "cgrates.org"}}, &result); err != nil { + if err := rater.Call(utils.APIerSv1GetRatingProfileIDs, utils.TenantArgWithPaginator{TenantArg: utils.TenantArg{Tenant: "cgrates.org"}}, &result); err != nil { t.Error(err) } else if len(expectedIds) != len(result) { t.Errorf("Expecting : %+v, received: %+v", expected, result) @@ -975,10 +975,10 @@ func testApierGetDestination(t *testing.T) { reply := new(engine.Destination) dstId := "GERMANY_MOBILE" expectedReply := &engine.Destination{Id: dstId, Prefixes: []string{"+4915", "+4916", "+4917"}} - if err := rater.Call(utils.ApierV1GetDestination, dstId, reply); err != nil { - t.Error("Got error on ApierV1.GetDestination: ", err.Error()) + if err := rater.Call(utils.APIerSv1GetDestination, dstId, reply); err != nil { + t.Error("Got error on APIerSv1.GetDestination: ", err.Error()) } else if !reflect.DeepEqual(expectedReply, reply) { - t.Errorf("Calling ApierV1.GetDestination expected: %v, received: %v", expectedReply, reply) + t.Errorf("Calling APIerSv1.GetDestination expected: %v, received: %v", expectedReply, reply) } } @@ -986,8 +986,8 @@ func testApierGetDestination(t *testing.T) { func testApierGetRatingPlan(t *testing.T) { reply := new(engine.RatingPlan) rplnId := "RETAIL1" - if err := rater.Call(utils.ApierV1GetRatingPlan, rplnId, reply); err != nil { - t.Error("Got error on ApierV1.GetRatingPlan: ", err.Error()) + if err := rater.Call(utils.APIerSv1GetRatingPlan, rplnId, reply); err != nil { + t.Error("Got error on APIerSv1.GetRatingPlan: ", err.Error()) } // Check parts of info received since a full one is not possible due to unique map keys inside reply if reply.Id != rplnId { @@ -1012,7 +1012,7 @@ func testApierRemoveRatingPlan(t *testing.T) { rplnId := "RETAIL1" var reply string - err := rater.Call(utils.ApierV1RemoveRatingPlan, rplnId, &reply) + err := rater.Call(utils.APIerSv1RemoveRatingPlan, rplnId, &reply) if err != nil { t.Error(err) } @@ -1021,7 +1021,7 @@ func testApierRemoveRatingPlan(t *testing.T) { } //get rating plan (the one that was removed. should return 'err not found') var ratingPlan *engine.RatingPlan - err = rater.Call(utils.ApierV1GetRatingPlan, rplnId, ratingPlan) + err = rater.Call(utils.APIerSv1GetRatingPlan, rplnId, ratingPlan) if err == nil || err.Error() != utils.ErrNotFound.Error() { t.Errorf("Expecting error: %s, received: %v", utils.ErrNotFound, err) } @@ -1031,46 +1031,46 @@ func testApierRemoveRatingPlan(t *testing.T) { func testApierAddBalance(t *testing.T) { var reply string attrs := &AttrAddBalance{Tenant: "cgrates.org", Account: "1001", BalanceType: utils.MONETARY, Value: 1.5} - if err := rater.Call(utils.ApierV1AddBalance, attrs, &reply); err != nil { - t.Error("Got error on ApierV1.AddBalance: ", err.Error()) + if err := rater.Call(utils.APIerSv1AddBalance, attrs, &reply); err != nil { + t.Error("Got error on APIerSv1.AddBalance: ", err.Error()) } else if reply != utils.OK { - t.Errorf("Calling ApierV1.AddBalance received: %s", reply) + t.Errorf("Calling APIerSv1.AddBalance received: %s", reply) } attrs = &AttrAddBalance{Tenant: "cgrates.org", Account: "dan", BalanceType: utils.MONETARY, Value: 1.5} - if err := rater.Call(utils.ApierV1AddBalance, attrs, &reply); err != nil { - t.Error("Got error on ApierV1.AddBalance: ", err.Error()) + if err := rater.Call(utils.APIerSv1AddBalance, attrs, &reply); err != nil { + t.Error("Got error on APIerSv1.AddBalance: ", err.Error()) } else if reply != utils.OK { - t.Errorf("Calling ApierV1.AddBalance received: %s", reply) + t.Errorf("Calling APIerSv1.AddBalance received: %s", reply) } attrs = &AttrAddBalance{Tenant: "cgrates.org", Account: "dan2", BalanceType: utils.MONETARY, Value: 1.5} - if err := rater.Call(utils.ApierV1AddBalance, attrs, &reply); err != nil { - t.Error("Got error on ApierV1.AddBalance: ", err.Error()) + if err := rater.Call(utils.APIerSv1AddBalance, attrs, &reply); err != nil { + t.Error("Got error on APIerSv1.AddBalance: ", err.Error()) } else if reply != utils.OK { - t.Errorf("Calling ApierV1.AddBalance received: %s", reply) + t.Errorf("Calling APIerSv1.AddBalance received: %s", reply) } attrs = &AttrAddBalance{Tenant: "cgrates.org", Account: "dan3", BalanceType: utils.MONETARY, Value: 1.5} - if err := rater.Call(utils.ApierV1AddBalance, attrs, &reply); err != nil { - t.Error("Got error on ApierV1.AddBalance: ", err.Error()) + if err := rater.Call(utils.APIerSv1AddBalance, attrs, &reply); err != nil { + t.Error("Got error on APIerSv1.AddBalance: ", err.Error()) } else if reply != utils.OK { - t.Errorf("Calling ApierV1.AddBalance received: %s", reply) + t.Errorf("Calling APIerSv1.AddBalance received: %s", reply) } attrs = &AttrAddBalance{Tenant: "cgrates.org", Account: "dan3", BalanceType: utils.MONETARY, Value: 2.1} - if err := rater.Call(utils.ApierV1AddBalance, attrs, &reply); err != nil { - t.Error("Got error on ApierV1.AddBalance: ", err.Error()) + if err := rater.Call(utils.APIerSv1AddBalance, attrs, &reply); err != nil { + t.Error("Got error on APIerSv1.AddBalance: ", err.Error()) } else if reply != utils.OK { - t.Errorf("Calling ApierV1.AddBalance received: %s", reply) + t.Errorf("Calling APIerSv1.AddBalance received: %s", reply) } attrs = &AttrAddBalance{Tenant: "cgrates.org", Account: "dan6", BalanceType: utils.MONETARY, Value: 2.1} - if err := rater.Call(utils.ApierV1AddBalance, attrs, &reply); err != nil { - t.Error("Got error on ApierV1.AddBalance: ", err.Error()) + if err := rater.Call(utils.APIerSv1AddBalance, attrs, &reply); err != nil { + t.Error("Got error on APIerSv1.AddBalance: ", err.Error()) } else if reply != utils.OK { - t.Errorf("Calling ApierV1.AddBalance received: %s", reply) + t.Errorf("Calling APIerSv1.AddBalance received: %s", reply) } attrs = &AttrAddBalance{Tenant: "cgrates.org", Account: "dan6", BalanceType: utils.MONETARY, Value: 1, Overwrite: true} - if err := rater.Call(utils.ApierV1AddBalance, attrs, &reply); err != nil { - t.Error("Got error on ApierV1.AddBalance: ", err.Error()) + if err := rater.Call(utils.APIerSv1AddBalance, attrs, &reply); err != nil { + t.Error("Got error on APIerSv1.AddBalance: ", err.Error()) } else if reply != utils.OK { - t.Errorf("Calling ApierV1.AddBalance received: %s", reply) + t.Errorf("Calling APIerSv1.AddBalance received: %s", reply) } } @@ -1080,16 +1080,16 @@ func testApierExecuteAction(t *testing.T) { var reply string // Add balance to a previously known account attrs := utils.AttrExecuteAction{Tenant: "cgrates.org", Account: "dan2", ActionsId: "PREPAID_10"} - if err := rater.Call(utils.ApierV1ExecuteAction, attrs, &reply); err != nil { - t.Error("Got error on ApierV1.ExecuteAction: ", err.Error()) + if err := rater.Call(utils.APIerSv1ExecuteAction, attrs, &reply); err != nil { + t.Error("Got error on APIerSv1.ExecuteAction: ", err.Error()) } else if reply != utils.OK { - t.Errorf("Calling ApierV1.ExecuteAction received: %s", reply) + t.Errorf("Calling APIerSv1.ExecuteAction received: %s", reply) } reply2 := utils.EmptyString // Add balance to an account which does n exist attrs = utils.AttrExecuteAction{Tenant: "cgrates.org", Account: "dan2", ActionsId: "DUMMY_ACTION"} - if err := rater.Call(utils.ApierV1ExecuteAction, attrs, &reply2); err == nil || reply2 == utils.OK { - t.Error("Expecting error on ApierV1.ExecuteAction.", err, reply2) + if err := rater.Call(utils.APIerSv1ExecuteAction, attrs, &reply2); err == nil || reply2 == utils.OK { + t.Error("Expecting error on APIerSv1.ExecuteAction.", err, reply2) } } @@ -1097,13 +1097,13 @@ func testApierSetActions(t *testing.T) { act1 := &V1TPAction{Identifier: utils.TOPUP_RESET, BalanceType: utils.MONETARY, Units: 75.0, ExpiryTime: utils.UNLIMITED, Weight: 20.0} attrs1 := &V1AttrSetActions{ActionsId: "ACTS_1", Actions: []*V1TPAction{act1}} reply1 := utils.EmptyString - if err := rater.Call(utils.ApierV1SetActions, attrs1, &reply1); err != nil { - t.Error("Got error on ApierV1.SetActions: ", err.Error()) + if err := rater.Call(utils.APIerSv1SetActions, attrs1, &reply1); err != nil { + t.Error("Got error on APIerSv1.SetActions: ", err.Error()) } else if reply1 != utils.OK { - t.Errorf("Calling ApierV1.SetActions received: %s", reply1) + t.Errorf("Calling APIerSv1.SetActions received: %s", reply1) } // Calling the second time should raise EXISTS - if err := rater.Call(utils.ApierV1SetActions, attrs1, &reply1); err == nil || err.Error() != "EXISTS" { + if err := rater.Call(utils.APIerSv1SetActions, attrs1, &reply1); err == nil || err.Error() != "EXISTS" { t.Error("Unexpected result on duplication: ", err.Error()) } } @@ -1115,8 +1115,8 @@ func testApierGetActions(t *testing.T) { BalanceDisabled: "false", ExpiryTime: utils.UNLIMITED, Weight: 20.0}} var reply []*utils.TPAction - if err := rater.Call(utils.ApierV1GetActions, "ACTS_1", &reply); err != nil { - t.Error("Got error on ApierV1.GetActions: ", err.Error()) + if err := rater.Call(utils.APIerSv1GetActions, "ACTS_1", &reply); err != nil { + t.Error("Got error on APIerSv1.GetActions: ", err.Error()) } else if !reflect.DeepEqual(expectActs, reply) { t.Errorf("Expected: %v, received: %v", utils.ToJSON(expectActs), utils.ToJSON(reply)) } @@ -1126,13 +1126,13 @@ func testApierSetActionPlan(t *testing.T) { atm1 := &AttrActionPlan{ActionsId: "ACTS_1", MonthDays: "1", Time: "00:00:00", Weight: 20.0} atms1 := &AttrSetActionPlan{Id: "ATMS_1", ActionPlan: []*AttrActionPlan{atm1}} reply1 := utils.EmptyString - if err := rater.Call(utils.ApierV1SetActionPlan, atms1, &reply1); err != nil { - t.Error("Got error on ApierV1.SetActionPlan: ", err.Error()) + if err := rater.Call(utils.APIerSv1SetActionPlan, atms1, &reply1); err != nil { + t.Error("Got error on APIerSv1.SetActionPlan: ", err.Error()) } else if reply1 != utils.OK { - t.Errorf("Calling ApierV1.SetActionPlan received: %s", reply1) + t.Errorf("Calling APIerSv1.SetActionPlan received: %s", reply1) } // Calling the second time should raise EXISTS - if err := rater.Call(utils.ApierV1SetActionPlan, atms1, &reply1); err == nil || err.Error() != "EXISTS" { + if err := rater.Call(utils.APIerSv1SetActionPlan, atms1, &reply1); err == nil || err.Error() != "EXISTS" { t.Error("Unexpected result on duplication: ", err.Error()) } } @@ -1141,26 +1141,26 @@ func testApierSetActionPlan(t *testing.T) { func testApierAddTriggeredAction(t *testing.T) { var reply string attrs := &AttrAddBalance{Tenant: "cgrates.org", Account: "dan32", BalanceType: utils.MONETARY, Value: 1.5} - if err := rater.Call(utils.ApierV1AddBalance, attrs, &reply); err != nil { - t.Error("Got error on ApierV1.AddBalance: ", err.Error()) + if err := rater.Call(utils.APIerSv1AddBalance, attrs, &reply); err != nil { + t.Error("Got error on APIerSv1.AddBalance: ", err.Error()) } else if reply != utils.OK { - t.Errorf("Calling ApierV1.AddBalance received: %s", reply) + t.Errorf("Calling APIerSv1.AddBalance received: %s", reply) } // Add balance to a previously known account attrsAddTrigger := &AttrAddActionTrigger{Tenant: "cgrates.org", Account: "dan32", BalanceType: utils.MONETARY, ThresholdType: "*min_balance", ThresholdValue: 2, BalanceDestinationIds: utils.META_ANY, Weight: 10, ActionsId: "WARN_VIA_HTTP"} - if err := rater.Call(utils.ApierV1AddTriggeredAction, attrsAddTrigger, &reply); err != nil { - t.Error("Got error on ApierV1.AddTriggeredAction: ", err.Error()) + if err := rater.Call(utils.APIerSv1AddTriggeredAction, attrsAddTrigger, &reply); err != nil { + t.Error("Got error on APIerSv1.AddTriggeredAction: ", err.Error()) } else if reply != utils.OK { - t.Errorf("Calling ApierV1.AddTriggeredAction received: %s", reply) + t.Errorf("Calling APIerSv1.AddTriggeredAction received: %s", reply) } reply2 := utils.EmptyString attrs2 := new(AttrAddActionTrigger) *attrs2 = *attrsAddTrigger attrs2.Account = "dan10" // Does not exist so it should error when adding triggers on it // Add trigger to an account which does n exist - if err := rater.Call(utils.ApierV1AddTriggeredAction, attrs2, &reply2); err == nil { - t.Error("Expecting error on ApierV1.AddTriggeredAction.", err, reply2) + if err := rater.Call(utils.APIerSv1AddTriggeredAction, attrs2, &reply2); err == nil { + t.Error("Expecting error on APIerSv1.AddTriggeredAction.", err, reply2) } } @@ -1168,8 +1168,8 @@ func testApierAddTriggeredAction(t *testing.T) { func testApierGetAccountActionTriggers(t *testing.T) { var reply engine.ActionTriggers req := utils.TenantAccount{Tenant: "cgrates.org", Account: "dan32"} - if err := rater.Call(utils.ApierV1GetAccountActionTriggers, req, &reply); err != nil { - t.Error("Got error on ApierV1.GetAccountActionTimings: ", err.Error()) + if err := rater.Call(utils.APIerSv1GetAccountActionTriggers, req, &reply); err != nil { + t.Error("Got error on APIerSv1.GetAccountActionTimings: ", err.Error()) } else if len(reply) != 1 || reply[0].ActionsID != "WARN_VIA_HTTP" { t.Errorf("Unexpected action triggers received %v", reply) } @@ -1179,18 +1179,18 @@ func testApierAddTriggeredAction2(t *testing.T) { var reply string // Add balance to a previously known account attrs := &AttrAddAccountActionTriggers{ActionTriggerIDs: []string{"STANDARD_TRIGGERS"}, Tenant: "cgrates.org", Account: "dan2"} - if err := rater.Call(utils.ApierV1AddAccountActionTriggers, attrs, &reply); err != nil { - t.Error("Got error on ApierV1.AddAccountActionTriggers: ", err.Error()) + if err := rater.Call(utils.APIerSv1AddAccountActionTriggers, attrs, &reply); err != nil { + t.Error("Got error on APIerSv1.AddAccountActionTriggers: ", err.Error()) } else if reply != utils.OK { - t.Errorf("Calling ApierV1.AddAccountActionTriggers received: %s", reply) + t.Errorf("Calling APIerSv1.AddAccountActionTriggers received: %s", reply) } reply2 := utils.EmptyString attrs2 := new(AttrAddAccountActionTriggers) *attrs2 = *attrs attrs2.Account = "dan10" // Does not exist so it should error when adding triggers on it // Add trigger to an account which does n exist - if err := rater.Call(utils.ApierV1AddAccountActionTriggers, attrs2, &reply2); err == nil || reply2 == utils.OK { - t.Error("Expecting error on ApierV1.AddAccountActionTriggers.", err, reply2) + if err := rater.Call(utils.APIerSv1AddAccountActionTriggers, attrs2, &reply2); err == nil || reply2 == utils.OK { + t.Error("Expecting error on APIerSv1.AddAccountActionTriggers.", err, reply2) } } @@ -1198,8 +1198,8 @@ func testApierAddTriggeredAction2(t *testing.T) { func testApierGetAccountActionTriggers2(t *testing.T) { var reply engine.ActionTriggers req := utils.TenantAccount{Tenant: "cgrates.org", Account: "dan2"} - if err := rater.Call(utils.ApierV1GetAccountActionTriggers, req, &reply); err != nil { - t.Error("Got error on ApierV1.GetAccountActionTimings: ", err.Error()) + if err := rater.Call(utils.APIerSv1GetAccountActionTriggers, req, &reply); err != nil { + t.Error("Got error on APIerSv1.GetAccountActionTimings: ", err.Error()) } else if len(reply) != 1 || reply[0].ActionsID != "LOG_BALANCE" { t.Errorf("Unexpected action triggers received %v", reply) } @@ -1210,8 +1210,8 @@ func testApierSetAccountActionTriggers(t *testing.T) { // Test first get so we can steal the id which we need to remove var reply engine.ActionTriggers req := utils.TenantAccount{Tenant: "cgrates.org", Account: "dan2"} - if err := rater.Call(utils.ApierV1GetAccountActionTriggers, req, &reply); err != nil { - t.Error("Got error on ApierV1.GetAccountActionTimings: ", err.Error()) + if err := rater.Call(utils.APIerSv1GetAccountActionTriggers, req, &reply); err != nil { + t.Error("Got error on APIerSv1.GetAccountActionTimings: ", err.Error()) } else if len(reply) != 1 || reply[0].ActionsID != "LOG_BALANCE" { for _, atr := range reply { t.Logf("ATR: %+v", atr) @@ -1229,18 +1229,18 @@ func testApierSetAccountActionTriggers(t *testing.T) { }, }, } - if err := rater.Call(utils.ApierV1ResetAccountActionTriggers, setReq, &setReply); err != nil { - t.Error("Got error on ApierV1.ResetActionTiming: ", err.Error()) + if err := rater.Call(utils.APIerSv1ResetAccountActionTriggers, setReq, &setReply); err != nil { + t.Error("Got error on APIerSv1.ResetActionTiming: ", err.Error()) } else if setReply != utils.OK { t.Error("Unexpected answer received", setReply) } - if err := rater.Call(utils.ApierV1SetAccountActionTriggers, setReq, &setReply); err != nil { - t.Error("Got error on ApierV1.RemoveActionTiming: ", err.Error()) + if err := rater.Call(utils.APIerSv1SetAccountActionTriggers, setReq, &setReply); err != nil { + t.Error("Got error on APIerSv1.RemoveActionTiming: ", err.Error()) } else if setReply != utils.OK { t.Error("Unexpected answer received", setReply) } - if err := rater.Call(utils.ApierV1GetAccountActionTriggers, req, &reply); err != nil { - t.Error("Got error on ApierV1.GetAccountActionTriggers: ", err.Error()) + if err := rater.Call(utils.APIerSv1GetAccountActionTriggers, req, &reply); err != nil { + t.Error("Got error on APIerSv1.GetAccountActionTriggers: ", err.Error()) } else if len(reply) != 1 || reply[0].ActivationDate != time.Date(2016, 2, 5, 18, 0, 0, 0, time.UTC) { t.Errorf("Unexpected action triggers received %+v", reply[0]) } @@ -1251,8 +1251,8 @@ func testApierRemAccountActionTriggers(t *testing.T) { // Test first get so we can steal the id which we need to remove var reply engine.ActionTriggers req := utils.TenantAccount{Tenant: "cgrates.org", Account: "dan2"} - if err := rater.Call(utils.ApierV1GetAccountActionTriggers, req, &reply); err != nil { - t.Error("Got error on ApierV1.GetAccountActionTimings: ", err.Error()) + if err := rater.Call(utils.APIerSv1GetAccountActionTriggers, req, &reply); err != nil { + t.Error("Got error on APIerSv1.GetAccountActionTimings: ", err.Error()) } else if len(reply) != 1 || reply[0].ActionsID != "LOG_BALANCE" { for _, atr := range reply { t.Logf("ATR: %+v", atr) @@ -1261,18 +1261,18 @@ func testApierRemAccountActionTriggers(t *testing.T) { } var rmReply string rmReq := AttrRemoveAccountActionTriggers{Tenant: "cgrates.org", Account: "dan2", UniqueID: reply[0].UniqueID} - if err := rater.Call(utils.ApierV1ResetAccountActionTriggers, rmReq, &rmReply); err != nil { - t.Error("Got error on ApierV1.ResetActionTiming: ", err.Error()) + if err := rater.Call(utils.APIerSv1ResetAccountActionTriggers, rmReq, &rmReply); err != nil { + t.Error("Got error on APIerSv1.ResetActionTiming: ", err.Error()) } else if rmReply != utils.OK { t.Error("Unexpected answer received", rmReply) } - if err := rater.Call(utils.ApierV1RemoveAccountActionTriggers, rmReq, &rmReply); err != nil { - t.Error("Got error on ApierV1.RemoveActionTiming: ", err.Error()) + if err := rater.Call(utils.APIerSv1RemoveAccountActionTriggers, rmReq, &rmReply); err != nil { + t.Error("Got error on APIerSv1.RemoveActionTiming: ", err.Error()) } else if rmReply != utils.OK { t.Error("Unexpected answer received", rmReply) } - if err := rater.Call(utils.ApierV1GetAccountActionTriggers, req, &reply); err != nil { - t.Error("Got error on ApierV1.GetAccountActionTriggers: ", err.Error()) + if err := rater.Call(utils.APIerSv1GetAccountActionTriggers, req, &reply); err != nil { + t.Error("Got error on APIerSv1.GetAccountActionTriggers: ", err.Error()) } else if len(reply) != 0 { t.Errorf("Unexpected action triggers received %+v", reply[0]) } @@ -1282,18 +1282,18 @@ func testApierRemAccountActionTriggers(t *testing.T) { func testApierSetAccount(t *testing.T) { var reply string attrs := &utils.AttrSetAccount{Tenant: "cgrates.org", Account: "dan7", ActionPlanID: "ATMS_1", ReloadScheduler: true} - if err := rater.Call(utils.ApierV1SetAccount, attrs, &reply); err != nil { - t.Error("Got error on ApierV1.SetAccount: ", err.Error()) + if err := rater.Call(utils.APIerSv1SetAccount, attrs, &reply); err != nil { + t.Error("Got error on APIerSv1.SetAccount: ", err.Error()) } else if reply != utils.OK { - t.Errorf("Calling ApierV1.SetAccount received: %s", reply) + t.Errorf("Calling APIerSv1.SetAccount received: %s", reply) } reply2 := utils.EmptyString attrs2 := new(utils.AttrSetAccount) *attrs2 = *attrs attrs2.ActionPlanID = "DUMMY_DATA" // Does not exist so it should error when adding triggers on it // Add account with actions timing which does not exist - if err := rater.Call(utils.ApierV1SetAccount, attrs2, &reply2); err == nil || reply2 == utils.OK { // OK is not welcomed - t.Error("Expecting error on ApierV1.SetAccount.", err, reply2) + if err := rater.Call(utils.APIerSv1SetAccount, attrs2, &reply2); err == nil || reply2 == utils.OK { // OK is not welcomed + t.Error("Expecting error on APIerSv1.SetAccount.", err, reply2) } } @@ -1301,8 +1301,8 @@ func testApierSetAccount(t *testing.T) { func testApierGetAccountActionPlan(t *testing.T) { var reply []*AccountActionTiming req := utils.TenantAccount{Tenant: "cgrates.org", Account: "dan7"} - if err := rater.Call(utils.ApierV1GetAccountActionPlan, req, &reply); err != nil { - t.Error("Got error on ApierV1.GetAccountActionPlan: ", err.Error()) + if err := rater.Call(utils.APIerSv1GetAccountActionPlan, req, &reply); err != nil { + t.Error("Got error on APIerSv1.GetAccountActionPlan: ", err.Error()) } else if len(reply) != 1 { t.Error("Unexpected action plan received: ", utils.ToJSON(reply)) } else { @@ -1315,7 +1315,7 @@ func testApierGetAccountActionPlan(t *testing.T) { // Make sure we have scheduled actions func testApierITGetScheduledActionsForAccount(t *testing.T) { var rply []*scheduler.ScheduledAction - if err := rater.Call(utils.ApierV1GetScheduledActions, + if err := rater.Call(utils.APIerSv1GetScheduledActions, scheduler.ArgsGetScheduledActions{ Tenant: utils.StringPointer("cgrates.org"), Account: utils.StringPointer("dan7")}, &rply); err != nil { @@ -1329,15 +1329,15 @@ func testApierITGetScheduledActionsForAccount(t *testing.T) { func testApierRemUniqueIDActionTiming(t *testing.T) { var rmReply string rmReq := AttrRemoveActionTiming{ActionPlanId: "ATMS_1", Tenant: "cgrates.org", Account: "dan4"} - if err := rater.Call(utils.ApierV1RemoveActionTiming, rmReq, &rmReply); err != nil { - t.Error("Got error on ApierV1.RemoveActionTiming: ", err.Error()) + if err := rater.Call(utils.APIerSv1RemoveActionTiming, rmReq, &rmReply); err != nil { + t.Error("Got error on APIerSv1.RemoveActionTiming: ", err.Error()) } else if rmReply != utils.OK { t.Error("Unexpected answer received", rmReply) } var reply []*AccountActionTiming req := utils.TenantAccount{Tenant: "cgrates.org", Account: "dan4"} - if err := rater.Call(utils.ApierV1GetAccountActionPlan, req, &reply); err != nil { - t.Error("Got error on ApierV1.GetAccountActionPlan: ", err.Error()) + if err := rater.Call(utils.APIerSv1GetAccountActionPlan, req, &reply); err != nil { + t.Error("Got error on APIerSv1.GetAccountActionPlan: ", err.Error()) } else if len(reply) != 0 { t.Error("Action timings was not removed") } @@ -1347,35 +1347,35 @@ func testApierRemUniqueIDActionTiming(t *testing.T) { func testApierGetAccount(t *testing.T) { var reply *engine.Account attrs := &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "1001"} - if err := rater.Call(utils.ApierV2GetAccount, attrs, &reply); err != nil { - t.Error("Got error on ApierV1.GetAccount: ", err.Error()) + if err := rater.Call(utils.APIerSv2GetAccount, attrs, &reply); err != nil { + t.Error("Got error on APIerSv1.GetAccount: ", err.Error()) } else if reply.BalanceMap[utils.MONETARY].GetTotalValue() != 11.5 { // We expect 11.5 since we have added in the previous test 1.5 - t.Errorf("Calling ApierV1.GetBalance expected: 11.5, received: %f", reply.BalanceMap[utils.MONETARY].GetTotalValue()) + t.Errorf("Calling APIerSv1.GetBalance expected: 11.5, received: %f", reply.BalanceMap[utils.MONETARY].GetTotalValue()) } attrs = &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "dan"} - if err := rater.Call(utils.ApierV2GetAccount, attrs, &reply); err != nil { - t.Error("Got error on ApierV1.GetAccount: ", err.Error()) + if err := rater.Call(utils.APIerSv2GetAccount, attrs, &reply); err != nil { + t.Error("Got error on APIerSv1.GetAccount: ", err.Error()) } else if reply.BalanceMap[utils.MONETARY].GetTotalValue() != 1.5 { - t.Errorf("Calling ApierV1.GetAccount expected: 1.5, received: %f", reply.BalanceMap[utils.MONETARY].GetTotalValue()) + t.Errorf("Calling APIerSv1.GetAccount expected: 1.5, received: %f", reply.BalanceMap[utils.MONETARY].GetTotalValue()) } // The one we have topped up though executeAction attrs = &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "dan2"} - if err := rater.Call(utils.ApierV2GetAccount, attrs, &reply); err != nil { - t.Error("Got error on ApierV1.GetAccount: ", err.Error()) + if err := rater.Call(utils.APIerSv2GetAccount, attrs, &reply); err != nil { + t.Error("Got error on APIerSv1.GetAccount: ", err.Error()) } else if reply.BalanceMap[utils.MONETARY].GetTotalValue() != 11.5 { - t.Errorf("Calling ApierV1.GetAccount expected: 10, received: %f", reply.BalanceMap[utils.MONETARY].GetTotalValue()) + t.Errorf("Calling APIerSv1.GetAccount expected: 10, received: %f", reply.BalanceMap[utils.MONETARY].GetTotalValue()) } attrs = &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "dan3"} - if err := rater.Call(utils.ApierV2GetAccount, attrs, &reply); err != nil { - t.Error("Got error on ApierV1.GetAccount: ", err.Error()) + if err := rater.Call(utils.APIerSv2GetAccount, attrs, &reply); err != nil { + t.Error("Got error on APIerSv1.GetAccount: ", err.Error()) } else if reply.BalanceMap[utils.MONETARY].GetTotalValue() != 3.6 { - t.Errorf("Calling ApierV1.GetAccount expected: 3.6, received: %f", reply.BalanceMap[utils.MONETARY].GetTotalValue()) + t.Errorf("Calling APIerSv1.GetAccount expected: 3.6, received: %f", reply.BalanceMap[utils.MONETARY].GetTotalValue()) } attrs = &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "dan6"} - if err := rater.Call(utils.ApierV2GetAccount, attrs, &reply); err != nil { - t.Error("Got error on ApierV1.GetAccount: ", err.Error()) + if err := rater.Call(utils.APIerSv2GetAccount, attrs, &reply); err != nil { + t.Error("Got error on APIerSv1.GetAccount: ", err.Error()) } else if reply.BalanceMap[utils.MONETARY].GetTotalValue() != 1 { - t.Errorf("Calling ApierV1.GetAccount expected: 1, received: %f", reply.BalanceMap[utils.MONETARY].GetTotalValue()) + t.Errorf("Calling APIerSv1.GetAccount expected: 1, received: %f", reply.BalanceMap[utils.MONETARY].GetTotalValue()) } } @@ -1383,16 +1383,16 @@ func testApierGetAccount(t *testing.T) { func testApierTriggersExecute(t *testing.T) { var reply string attrs := &utils.AttrSetAccount{Tenant: "cgrates.org", Account: "dan8", ReloadScheduler: true} - if err := rater.Call(utils.ApierV1SetAccount, attrs, &reply); err != nil { - t.Error("Got error on ApierV1.SetAccount: ", err.Error()) + if err := rater.Call(utils.APIerSv1SetAccount, attrs, &reply); err != nil { + t.Error("Got error on APIerSv1.SetAccount: ", err.Error()) } else if reply != utils.OK { - t.Errorf("Calling ApierV1.SetAccount received: %s", reply) + t.Errorf("Calling APIerSv1.SetAccount received: %s", reply) } attrAddBlnc := &AttrAddBalance{Tenant: "cgrates.org", Account: "1008", BalanceType: utils.MONETARY, Value: 2} - if err := rater.Call(utils.ApierV1AddBalance, attrAddBlnc, &reply); err != nil { - t.Error("Got error on ApierV1.AddBalance: ", err.Error()) + if err := rater.Call(utils.APIerSv1AddBalance, attrAddBlnc, &reply); err != nil { + t.Error("Got error on APIerSv1.AddBalance: ", err.Error()) } else if reply != utils.OK { - t.Errorf("Calling ApierV1.AddBalance received: %s", reply) + t.Errorf("Calling APIerSv1.AddBalance received: %s", reply) } } @@ -1420,19 +1420,19 @@ func testApierResetDataBeforeLoadFromFolder(t *testing.T) { func testApierLoadTariffPlanFromFolder(t *testing.T) { var reply string attrs := &utils.AttrLoadTpFromFolder{FolderPath: utils.EmptyString} - if err := rater.Call(utils.ApierV1LoadTariffPlanFromFolder, attrs, &reply); err == nil || !strings.HasPrefix(err.Error(), utils.ErrMandatoryIeMissing.Error()) { + if err := rater.Call(utils.APIerSv1LoadTariffPlanFromFolder, attrs, &reply); err == nil || !strings.HasPrefix(err.Error(), utils.ErrMandatoryIeMissing.Error()) { t.Error(err) } attrs = &utils.AttrLoadTpFromFolder{FolderPath: "/INVALID/"} - if err := rater.Call(utils.ApierV1LoadTariffPlanFromFolder, attrs, &reply); err == nil || err.Error() != utils.ErrInvalidPath.Error() { + if err := rater.Call(utils.APIerSv1LoadTariffPlanFromFolder, attrs, &reply); err == nil || err.Error() != utils.ErrInvalidPath.Error() { t.Error(err) } // Simple test that command is executed without errors attrs = &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "testtp")} - if err := rater.Call(utils.ApierV1LoadTariffPlanFromFolder, attrs, &reply); err != nil { - t.Error("Got error on ApierV1.LoadTariffPlanFromFolder: ", err.Error()) + if err := rater.Call(utils.APIerSv1LoadTariffPlanFromFolder, attrs, &reply); err != nil { + t.Error("Got error on APIerSv1.LoadTariffPlanFromFolder: ", err.Error()) } else if reply != utils.OK { - t.Error("Calling ApierV1.LoadTariffPlanFromFolder got reply: ", reply) + t.Error("Calling APIerSv1.LoadTariffPlanFromFolder got reply: ", reply) } time.Sleep(500 * time.Millisecond) } @@ -1440,12 +1440,12 @@ func testApierLoadTariffPlanFromFolder(t *testing.T) { // For now just test that they execute without errors func testApierComputeReverse(t *testing.T) { var reply string - if err := rater.Call(utils.ApierV1ComputeReverseDestinations, utils.EmptyString, &reply); err != nil { + if err := rater.Call(utils.APIerSv1ComputeReverseDestinations, utils.EmptyString, &reply); err != nil { t.Error(err) } else if reply != utils.OK { t.Error("Received: ", reply) } - if err := rater.Call(utils.ApierV1ComputeAccountActionPlans, utils.EmptyString, &reply); err != nil { + if err := rater.Call(utils.APIerSv1ComputeAccountActionPlans, utils.EmptyString, &reply); err != nil { t.Error(err) } else if reply != utils.OK { t.Error("Received: ", reply) @@ -1509,7 +1509,7 @@ func testApierSetChargerS(t *testing.T) { }, } var result string - if err := rater.Call(utils.ApierV1SetChargerProfile, chargerProfile, &result); err != nil { + if err := rater.Call(utils.APIerSv1SetChargerProfile, chargerProfile, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -1521,10 +1521,10 @@ func testApierSetChargerS(t *testing.T) { func testApierGetAccountAfterLoad(t *testing.T) { var reply *engine.Account attrs := &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "1001"} - if err := rater.Call(utils.ApierV2GetAccount, attrs, &reply); err != nil { - t.Error("Got error on ApierV1.GetAccount: ", err.Error()) + if err := rater.Call(utils.APIerSv2GetAccount, attrs, &reply); err != nil { + t.Error("Got error on APIerSv1.GetAccount: ", err.Error()) } else if reply.BalanceMap[utils.MONETARY].GetTotalValue() != 13 { - t.Errorf("Calling ApierV1.GetBalance expected: 13, received: %v \n\n for:%s", reply.BalanceMap[utils.MONETARY].GetTotalValue(), utils.ToJSON(reply)) + t.Errorf("Calling APIerSv1.GetBalance expected: 13, received: %v \n\n for:%s", reply.BalanceMap[utils.MONETARY].GetTotalValue(), utils.ToJSON(reply)) } } @@ -1596,7 +1596,7 @@ func testApierCdrServer(t *testing.T) { func testApierITGetCdrs(t *testing.T) { var reply []*engine.ExternalCDR req := utils.AttrGetCdrs{MediationRunIds: []string{utils.MetaDefault}} - if err := rater.Call(utils.ApierV1GetCDRs, req, &reply); err != nil { + if err := rater.Call(utils.APIerSv1GetCDRs, req, &reply); err != nil { t.Error("Unexpected error: ", err.Error()) } else if len(reply) != 2 { t.Error("Unexpected number of CDRs returned: ", len(reply)) @@ -1620,7 +1620,7 @@ func testApierITProcessCdr(t *testing.T) { } var cdrs []*engine.ExternalCDR req := utils.AttrGetCdrs{MediationRunIds: []string{utils.MetaDefault}} - if err := rater.Call(utils.ApierV1GetCDRs, req, &cdrs); err != nil { + if err := rater.Call(utils.APIerSv1GetCDRs, req, &cdrs); err != nil { t.Error("Unexpected error: ", err.Error()) } else if len(cdrs) != 3 { t.Error("Unexpected number of CDRs returned: ", len(cdrs)) @@ -1632,13 +1632,13 @@ func testApierGetCallCostLog(t *testing.T) { var cc engine.EventCost var attrs utils.AttrGetCallCost // Simple test that command is executed without errors - if err := rater.Call(utils.ApierV1GetEventCost, attrs, &cc); err == nil { - t.Error("Failed to detect missing fields in ApierV1.GetCallCostLog") + if err := rater.Call(utils.APIerSv1GetEventCost, attrs, &cc); err == nil { + t.Error("Failed to detect missing fields in APIerSv1.GetCallCostLog") } attrs.CgrId = "dummyid" attrs.RunId = "default" - if err := rater.Call(utils.ApierV1GetEventCost, attrs, &cc); err == nil || err.Error() != utils.ErrNotFound.Error() { - t.Error("ApierV1.GetCallCostLog: should return NOT_FOUND, got:", err) + if err := rater.Call(utils.APIerSv1GetEventCost, attrs, &cc); err == nil || err.Error() != utils.ErrNotFound.Error() { + t.Error("APIerSv1.GetCallCostLog: should return NOT_FOUND, got:", err) } tm := time.Now().Truncate(time.Millisecond).UTC() cdr := &engine.CDRWithArgDispatcher{ @@ -1694,7 +1694,7 @@ func testApierGetCallCostLog(t *testing.T) { } attrs.CgrId = "Cdr1" attrs.RunId = utils.EmptyString - if err := rater.Call(utils.ApierV1GetEventCost, attrs, &cc); err != nil { + if err := rater.Call(utils.APIerSv1GetEventCost, attrs, &cc); err != nil { t.Error(err) } else if !reflect.DeepEqual(expected, cc) { t.Errorf("Expecting %s ,recived %s", utils.ToJSON(expected), utils.ToJSON(cc)) @@ -1704,30 +1704,30 @@ func testApierGetCallCostLog(t *testing.T) { func testApierITSetDestination(t *testing.T) { attrs := utils.AttrSetDestination{Id: "TEST_SET_DESTINATION", Prefixes: []string{"+4986517174963", "+4986517174960"}} var reply string - if err := rater.Call(utils.ApierV1SetDestination, attrs, &reply); err != nil { + if err := rater.Call(utils.APIerSv1SetDestination, attrs, &reply); err != nil { t.Error("Unexpected error", err.Error()) } else if reply != utils.OK { t.Error("Unexpected reply returned", reply) } - if err := rater.Call(utils.ApierV1SetDestination, attrs, &reply); err == nil || err.Error() != "EXISTS" { // Second time without overwrite should generate error + if err := rater.Call(utils.APIerSv1SetDestination, attrs, &reply); err == nil || err.Error() != "EXISTS" { // Second time without overwrite should generate error t.Error("Unexpected error", err.Error()) } attrs = utils.AttrSetDestination{Id: "TEST_SET_DESTINATION", Prefixes: []string{"+4986517174963", "+4986517174964"}, Overwrite: true} - if err := rater.Call(utils.ApierV1SetDestination, attrs, &reply); err != nil { + if err := rater.Call(utils.APIerSv1SetDestination, attrs, &reply); err != nil { t.Error("Unexpected error", err.Error()) } else if reply != utils.OK { t.Error("Unexpected reply returned", reply) } eDestination := engine.Destination{Id: attrs.Id, Prefixes: attrs.Prefixes} var rcvDestination engine.Destination - if err := rater.Call(utils.ApierV1GetDestination, attrs.Id, &rcvDestination); err != nil { + if err := rater.Call(utils.APIerSv1GetDestination, attrs.Id, &rcvDestination); err != nil { t.Error("Unexpected error", err.Error()) } else if !reflect.DeepEqual(eDestination, rcvDestination) { t.Errorf("Expecting: %+v, received: %+v", eDestination, rcvDestination) } eRcvIDs := []string{attrs.Id} var rcvIDs []string - if err := rater.Call(utils.ApierV1GetReverseDestination, attrs.Prefixes[0], &rcvIDs); err != nil { + if err := rater.Call(utils.APIerSv1GetReverseDestination, attrs.Prefixes[0], &rcvIDs); err != nil { t.Error("Unexpected error", err.Error()) } else if !reflect.DeepEqual(eRcvIDs, rcvIDs) { t.Errorf("Expecting: %+v, received: %+v", eRcvIDs, rcvIDs) @@ -1736,7 +1736,7 @@ func testApierITSetDestination(t *testing.T) { func testApierITGetScheduledActions(t *testing.T) { var rply []*scheduler.ScheduledAction - if err := rater.Call(utils.ApierV1GetScheduledActions, scheduler.ArgsGetScheduledActions{}, &rply); err != nil { + if err := rater.Call(utils.APIerSv1GetScheduledActions, scheduler.ArgsGetScheduledActions{}, &rply); err != nil { t.Error("Unexpected error: ", err) } } @@ -1745,7 +1745,7 @@ func testApierITGetDataCost(t *testing.T) { attrs := AttrGetDataCost{Category: "data", Tenant: "cgrates.org", Subject: "1001", AnswerTime: utils.MetaNow, Usage: 640113} var rply *engine.DataCost - if err := rater.Call(utils.ApierV1GetDataCost, attrs, &rply); err != nil { + if err := rater.Call(utils.APIerSv1GetDataCost, attrs, &rply); err != nil { t.Error("Unexpected nil error received: ", err.Error()) } else if rply.Cost != 128.0240 { t.Errorf("Unexpected cost received: %f", rply.Cost) @@ -1756,7 +1756,7 @@ func testApierITGetCost(t *testing.T) { attrs := AttrGetCost{Category: "data", Tenant: "cgrates.org", Subject: "1001", AnswerTime: utils.MetaNow, Usage: "640113"} var rply *engine.EventCost - if err := rater.Call(utils.ApierV1GetCost, attrs, &rply); err != nil { + if err := rater.Call(utils.APIerSv1GetCost, attrs, &rply); err != nil { t.Error("Unexpected nil error received: ", err.Error()) } else if *rply.Cost != 128.0240 { t.Errorf("Unexpected cost received: %f", *rply.Cost) @@ -1798,23 +1798,23 @@ func testApierReloadScheduler2(t *testing.T) { func testApierImportTPFromFolderPath(t *testing.T) { var reply string - if err := rater.Call(utils.ApierV1ImportTariffPlanFromFolder, + if err := rater.Call(utils.APIerSv1ImportTariffPlanFromFolder, utils.AttrImportTPFromFolder{TPid: "TEST_TPID2", FolderPath: "/usr/share/cgrates/tariffplans/oldtutorial"}, &reply); err != nil { - t.Error("Got error on ApierV1.ImportTarrifPlanFromFolder: ", err.Error()) + t.Error("Got error on APIerSv1.ImportTarrifPlanFromFolder: ", err.Error()) } else if reply != utils.OK { - t.Error("Calling ApierV1.ImportTarrifPlanFromFolder got reply: ", reply) + t.Error("Calling APIerSv1.ImportTarrifPlanFromFolder got reply: ", reply) } time.Sleep(500 * time.Millisecond) } func testApierLoadTariffPlanFromStorDbDryRun(t *testing.T) { var reply string - if err := rater.Call(utils.ApierV1LoadTariffPlanFromStorDb, + if err := rater.Call(utils.APIerSv1LoadTariffPlanFromStorDb, AttrLoadTpFromStorDb{TPid: "TEST_TPID2", DryRun: true}, &reply); err != nil { - t.Error("Got error on ApierV1.LoadTariffPlanFromStorDb: ", err.Error()) + t.Error("Got error on APIerSv1.LoadTariffPlanFromStorDb: ", err.Error()) } else if reply != utils.OK { - t.Error("Calling ApierV1.LoadTariffPlanFromStorDb got reply: ", reply) + t.Error("Calling APIerSv1.LoadTariffPlanFromStorDb got reply: ", reply) } } @@ -1831,11 +1831,11 @@ func testApierGetCacheStats2(t *testing.T) { func testApierLoadTariffPlanFromStorDb(t *testing.T) { var reply string - if err := rater.Call(utils.ApierV1LoadTariffPlanFromStorDb, + if err := rater.Call(utils.APIerSv1LoadTariffPlanFromStorDb, AttrLoadTpFromStorDb{TPid: "TEST_TPID2"}, &reply); err != nil { - t.Error("Got error on ApierV1.LoadTariffPlanFromStorDb: ", err.Error()) + t.Error("Got error on APIerSv1.LoadTariffPlanFromStorDb: ", err.Error()) } else if reply != utils.OK { - t.Error("Calling ApierV1.LoadTariffPlanFromStorDb got reply: ", reply) + t.Error("Calling APIerSv1.LoadTariffPlanFromStorDb got reply: ", reply) } } @@ -1892,8 +1892,8 @@ func testApierReplayFailedPosts(t *testing.T) { fileName := "act>*http_post|63bed4ea-615e-4096-b1f4-499f64f29b28.json" args := ArgsReplyFailedPosts{ - FailedRequestsInDir: utils.StringPointer("/tmp/TestsApierV1/in"), - FailedRequestsOutDir: utils.StringPointer("/tmp/TestsApierV1/out"), + FailedRequestsInDir: utils.StringPointer("/tmp/TestsAPIerSv1/in"), + FailedRequestsOutDir: utils.StringPointer("/tmp/TestsAPIerSv1/out"), } for _, dir := range []string{*args.FailedRequestsInDir, *args.FailedRequestsOutDir} { if err := os.RemoveAll(dir); err != nil { @@ -1908,7 +1908,7 @@ func testApierReplayFailedPosts(t *testing.T) { t.Error(err) } var reply string - if err := rater.Call(utils.ApierV1ReplayFailedPosts, args, &reply); err != nil { + if err := rater.Call(utils.APIerSv1ReplayFailedPosts, args, &reply); err != nil { t.Error(err) } else if reply != utils.OK { t.Error("Unexpected reply: ", reply) @@ -1932,7 +1932,7 @@ func testApierReplayFailedPosts(t *testing.T) { if err != nil { t.Error(err) } - if err := rater.Call(utils.ApierV1ReplayFailedPosts, args, &reply); err != nil { + if err := rater.Call(utils.APIerSv1ReplayFailedPosts, args, &reply); err != nil { t.Error(err) } else if reply != utils.OK { t.Error("Unexpected reply: ", reply) @@ -1983,7 +1983,7 @@ func testApierReplayFailedPosts(t *testing.T) { func testApierGetDataDBVesions(t *testing.T) { var reply *engine.Versions - if err := rater.Call(utils.ApierV1GetDataDBVersions, utils.EmptyString, &reply); err != nil { + if err := rater.Call(utils.APIerSv1GetDataDBVersions, utils.EmptyString, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(engine.CurrentDataDBVersions(), *reply) { t.Errorf("Expecting : %+v, received: %+v", engine.CurrentDataDBVersions(), *reply) @@ -1992,7 +1992,7 @@ func testApierGetDataDBVesions(t *testing.T) { func testApierGetStorDBVesions(t *testing.T) { var reply *engine.Versions - if err := rater.Call(utils.ApierV1GetStorDBVersions, utils.EmptyString, &reply); err != nil { + if err := rater.Call(utils.APIerSv1GetStorDBVersions, utils.EmptyString, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(engine.CurrentStorDBVersions(), *reply) { t.Errorf("Expecting : %+v, received: %+v", engine.CurrentStorDBVersions(), *reply) diff --git a/apier/v1/attributes.go b/apier/v1/attributes.go index cca6ce585..3d2cdce1e 100644 --- a/apier/v1/attributes.go +++ b/apier/v1/attributes.go @@ -26,11 +26,11 @@ import ( ) // GetAttributeProfile returns an Attribute Profile -func (apierV1 *ApierV1) GetAttributeProfile(arg utils.TenantIDWithArgDispatcher, reply *engine.AttributeProfile) error { +func (APIerSv1 *APIerSv1) GetAttributeProfile(arg utils.TenantIDWithArgDispatcher, reply *engine.AttributeProfile) error { if missing := utils.MissingStructFields(&arg, []string{"Tenant", "ID"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } - if alsPrf, err := apierV1.DataManager.GetAttributeProfile(arg.Tenant, arg.ID, true, true, utils.NonTransactional); err != nil { + if alsPrf, err := APIerSv1.DataManager.GetAttributeProfile(arg.Tenant, arg.ID, true, true, utils.NonTransactional); err != nil { if err.Error() != utils.ErrNotFound.Error() { err = utils.NewErrServerError(err) } @@ -42,12 +42,12 @@ func (apierV1 *ApierV1) GetAttributeProfile(arg utils.TenantIDWithArgDispatcher, } // GetAttributeProfileIDs returns list of attributeProfile IDs registered for a tenant -func (apierV1 *ApierV1) GetAttributeProfileIDs(args utils.TenantArgWithPaginator, attrPrfIDs *[]string) error { +func (APIerSv1 *APIerSv1) GetAttributeProfileIDs(args utils.TenantArgWithPaginator, attrPrfIDs *[]string) error { if missing := utils.MissingStructFields(&args, []string{utils.Tenant}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } prfx := utils.AttributeProfilePrefix + args.Tenant + ":" - keys, err := apierV1.DataManager.DataDB().GetKeysForPrefix(prfx) + keys, err := APIerSv1.DataManager.DataDB().GetKeysForPrefix(prfx) if err != nil { return err } @@ -69,7 +69,7 @@ type AttributeWithCache struct { } //SetAttributeProfile add/update a new Attribute Profile -func (apierV1 *ApierV1) SetAttributeProfile(alsWrp *AttributeWithCache, reply *string) error { +func (APIerSv1 *APIerSv1) SetAttributeProfile(alsWrp *AttributeWithCache, reply *string) error { if missing := utils.MissingStructFields(alsWrp.AttributeProfile, []string{"Tenant", "ID", "Attributes"}); len(missing) != 0 { return utils.NewErrMandatoryIeMissing(missing...) } @@ -85,18 +85,18 @@ func (apierV1 *ApierV1) SetAttributeProfile(alsWrp *AttributeWithCache, reply *s } } } - if err := apierV1.DataManager.SetAttributeProfile(alsWrp.AttributeProfile, true); err != nil { + if err := APIerSv1.DataManager.SetAttributeProfile(alsWrp.AttributeProfile, true); err != nil { return utils.APIErrorHandler(err) } //generate a loadID for CacheAttributeProfiles and store it in database - if err := apierV1.DataManager.SetLoadIDs(map[string]int64{utils.CacheAttributeProfiles: time.Now().UnixNano()}); err != nil { + if err := APIerSv1.DataManager.SetLoadIDs(map[string]int64{utils.CacheAttributeProfiles: time.Now().UnixNano()}); err != nil { return utils.APIErrorHandler(err) } args := utils.ArgsGetCacheItem{ CacheID: utils.CacheAttributeProfiles, ItemID: alsWrp.TenantID(), } - if err := apierV1.CallCache(GetCacheOpt(alsWrp.Cache), args); err != nil { + if err := APIerSv1.CallCache(GetCacheOpt(alsWrp.Cache), args); err != nil { return utils.APIErrorHandler(err) } *reply = utils.OK @@ -104,23 +104,23 @@ func (apierV1 *ApierV1) SetAttributeProfile(alsWrp *AttributeWithCache, reply *s } //RemoveAttributeProfile remove a specific Attribute Profile -func (apierV1 *ApierV1) RemoveAttributeProfile(arg *utils.TenantIDWithCache, reply *string) error { +func (APIerSv1 *APIerSv1) RemoveAttributeProfile(arg *utils.TenantIDWithCache, reply *string) error { if missing := utils.MissingStructFields(arg, []string{"Tenant", "ID"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } - if err := apierV1.DataManager.RemoveAttributeProfile(arg.Tenant, arg.ID, + if err := APIerSv1.DataManager.RemoveAttributeProfile(arg.Tenant, arg.ID, utils.NonTransactional, true); err != nil { return utils.APIErrorHandler(err) } //generate a loadID for CacheAttributeProfiles and store it in database - if err := apierV1.DataManager.SetLoadIDs(map[string]int64{utils.CacheAttributeProfiles: time.Now().UnixNano()}); err != nil { + if err := APIerSv1.DataManager.SetLoadIDs(map[string]int64{utils.CacheAttributeProfiles: time.Now().UnixNano()}); err != nil { return utils.APIErrorHandler(err) } args := utils.ArgsGetCacheItem{ CacheID: utils.CacheAttributeProfiles, ItemID: utils.ConcatenatedKey(arg.Tenant, arg.ID), } - if err := apierV1.CallCache(GetCacheOpt(arg.Cache), args); err != nil { + if err := APIerSv1.CallCache(GetCacheOpt(arg.Cache), args); err != nil { return utils.APIErrorHandler(err) } *reply = utils.OK diff --git a/apier/v1/attributes_it_test.go b/apier/v1/attributes_it_test.go index 610162a81..92d1ba302 100644 --- a/apier/v1/attributes_it_test.go +++ b/apier/v1/attributes_it_test.go @@ -149,7 +149,7 @@ func testAttributeSRPCConn(t *testing.T) { func testAttributeSGetAlsPrfBeforeSet(t *testing.T) { var reply *engine.AttributeProfile - if err := attrSRPC.Call(utils.ApierV1GetAttributeProfile, + if err := attrSRPC.Call(utils.APIerSv1GetAttributeProfile, utils.TenantIDWithArgDispatcher{TenantID: &utils.TenantID{Tenant: "cgrates.org", ID: "ApierTest"}}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) @@ -159,7 +159,7 @@ func testAttributeSGetAlsPrfBeforeSet(t *testing.T) { func testAttributeSLoadFromFolder(t *testing.T) { var reply string attrs := &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "oldtutorial")} - if err := attrSRPC.Call(utils.ApierV1LoadTariffPlanFromFolder, attrs, &reply); err != nil { + if err := attrSRPC.Call(utils.APIerSv1LoadTariffPlanFromFolder, attrs, &reply); err != nil { t.Error(err) } time.Sleep(500 * time.Millisecond) @@ -249,13 +249,13 @@ func testAttributeSGetAttributeForEventNotFound(t *testing.T) { } eAttrPrf2.Compile() var result string - if err := attrSRPC.Call(utils.ApierV1SetAttributeProfile, eAttrPrf2, &result); err != nil { + if err := attrSRPC.Call(utils.APIerSv1SetAttributeProfile, eAttrPrf2, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } var reply *engine.AttributeProfile - if err := attrSRPC.Call(utils.ApierV1GetAttributeProfile, + if err := attrSRPC.Call(utils.APIerSv1GetAttributeProfile, utils.TenantIDWithArgDispatcher{TenantID: &utils.TenantID{Tenant: "cgrates.org", ID: "ATTR_3"}}, &reply); err != nil { t.Fatal(err) } @@ -301,13 +301,13 @@ func testAttributeSGetAttributeForEventWithMetaAnyContext(t *testing.T) { } eAttrPrf2.Compile() var result string - if err := attrSRPC.Call(utils.ApierV1SetAttributeProfile, eAttrPrf2, &result); err != nil { + if err := attrSRPC.Call(utils.APIerSv1SetAttributeProfile, eAttrPrf2, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } var reply *engine.AttributeProfile - if err := attrSRPC.Call(utils.ApierV1GetAttributeProfile, + if err := attrSRPC.Call(utils.APIerSv1GetAttributeProfile, utils.TenantIDWithArgDispatcher{TenantID: &utils.TenantID{Tenant: "cgrates.org", ID: "ATTR_2"}}, &reply); err != nil { t.Fatal(err) } @@ -456,7 +456,7 @@ func testAttributeSProcessEventWithNoneSubstitute(t *testing.T) { } alsPrf.Compile() var result string - if err := attrSRPC.Call(utils.ApierV1SetAttributeProfile, alsPrf, &result); err != nil { + if err := attrSRPC.Call(utils.APIerSv1SetAttributeProfile, alsPrf, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -523,7 +523,7 @@ func testAttributeSProcessEventWithNoneSubstitute2(t *testing.T) { }, } var result string - if err := attrSRPC.Call(utils.ApierV1SetAttributeProfile, alsPrf, &result); err != nil { + if err := attrSRPC.Call(utils.APIerSv1SetAttributeProfile, alsPrf, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -603,7 +603,7 @@ func testAttributeSProcessEventWithNoneSubstitute3(t *testing.T) { }, } var result string - if err := attrSRPC.Call(utils.ApierV1SetAttributeProfile, alsPrf, &result); err != nil { + if err := attrSRPC.Call(utils.APIerSv1SetAttributeProfile, alsPrf, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -652,7 +652,7 @@ func testAttributeSProcessEventWithHeader(t *testing.T) { }, } var result string - if err := attrSRPC.Call(utils.ApierV1SetAttributeProfile, attrPrf1, &result); err != nil { + if err := attrSRPC.Call(utils.APIerSv1SetAttributeProfile, attrPrf1, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -693,16 +693,16 @@ func testAttributeSProcessEventWithHeader(t *testing.T) { func testAttributeSGetAttPrfIDs(t *testing.T) { expected := []string{"ATTR_2", "ATTR_1", "ATTR_3", "ATTR_Header", "AttributeWithNonSubstitute"} var result []string - if err := attrSRPC.Call(utils.ApierV1GetAttributeProfileIDs, utils.TenantArgWithPaginator{}, &result); err == nil || + if err := attrSRPC.Call(utils.APIerSv1GetAttributeProfileIDs, utils.TenantArgWithPaginator{}, &result); err == nil || err.Error() != utils.NewErrMandatoryIeMissing("Tenant").Error() { t.Errorf("Expected error recived reply %+v with err=%v", result, err) } - if err := attrSRPC.Call(utils.ApierV1GetAttributeProfileIDs, utils.TenantArgWithPaginator{TenantArg: utils.TenantArg{Tenant: "cgrates.org"}}, &result); err != nil { + if err := attrSRPC.Call(utils.APIerSv1GetAttributeProfileIDs, utils.TenantArgWithPaginator{TenantArg: utils.TenantArg{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 := attrSRPC.Call(utils.ApierV1GetAttributeProfileIDs, utils.TenantArgWithPaginator{ + if err := attrSRPC.Call(utils.APIerSv1GetAttributeProfileIDs, utils.TenantArgWithPaginator{ TenantArg: utils.TenantArg{Tenant: "cgrates.org"}, Paginator: utils.Paginator{Limit: utils.IntPointer(10)}, }, &result); err != nil { @@ -734,13 +734,13 @@ func testAttributeSSetAlsPrf(t *testing.T) { } alsPrf.Compile() var result string - if err := attrSRPC.Call(utils.ApierV1SetAttributeProfile, alsPrf, &result); err != nil { + if err := attrSRPC.Call(utils.APIerSv1SetAttributeProfile, alsPrf, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } var reply *engine.AttributeProfile - if err := attrSRPC.Call(utils.ApierV1GetAttributeProfile, + if err := attrSRPC.Call(utils.APIerSv1GetAttributeProfile, utils.TenantIDWithArgDispatcher{TenantID: &utils.TenantID{Tenant: "cgrates.org", ID: "ApierTest"}}, &reply); err != nil { t.Fatal(err) } @@ -763,13 +763,13 @@ func testAttributeSUpdateAlsPrf(t *testing.T) { } alsPrf.Compile() var result string - if err := attrSRPC.Call(utils.ApierV1SetAttributeProfile, alsPrf, &result); err != nil { + if err := attrSRPC.Call(utils.APIerSv1SetAttributeProfile, alsPrf, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } var reply *engine.AttributeProfile - if err := attrSRPC.Call(utils.ApierV1GetAttributeProfile, + if err := attrSRPC.Call(utils.APIerSv1GetAttributeProfile, utils.TenantIDWithArgDispatcher{TenantID: &utils.TenantID{Tenant: "cgrates.org", ID: "ApierTest"}}, &reply); err != nil { t.Fatal(err) } @@ -785,21 +785,21 @@ func testAttributeSUpdateAlsPrf(t *testing.T) { func testAttributeSRemAlsPrf(t *testing.T) { var resp string - if err := attrSRPC.Call(utils.ApierV1RemoveAttributeProfile, + if err := attrSRPC.Call(utils.APIerSv1RemoveAttributeProfile, &utils.TenantIDWithCache{Tenant: alsPrf.Tenant, ID: alsPrf.ID}, &resp); err != nil { t.Error(err) } else if resp != utils.OK { t.Error("Unexpected reply returned", resp) } var reply *engine.AttributeProfile - if err := attrSRPC.Call(utils.ApierV1GetAttributeProfile, + if err := attrSRPC.Call(utils.APIerSv1GetAttributeProfile, utils.TenantIDWithArgDispatcher{TenantID: &utils.TenantID{Tenant: "cgrates.org", ID: "ApierTest"}}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) } // remove twice shoud return not found resp = "" - if err := attrSRPC.Call(utils.ApierV1RemoveAttributeProfile, + if err := attrSRPC.Call(utils.APIerSv1RemoveAttributeProfile, &utils.TenantIDWithCache{Tenant: alsPrf.Tenant, ID: alsPrf.ID}, &resp); err.Error() != utils.ErrNotFound.Error() { t.Errorf("Expected error: %v recived: %v", utils.ErrNotFound, err) } @@ -833,13 +833,13 @@ func testAttributeSSetAlsPrf2(t *testing.T) { } alsPrf.Compile() var result string - if err := attrSRPC.Call(utils.ApierV1SetAttributeProfile, alsPrf, &result); err != nil { + if err := attrSRPC.Call(utils.APIerSv1SetAttributeProfile, alsPrf, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } var reply *engine.AttributeProfile - if err := attrSRPC.Call(utils.ApierV1GetAttributeProfile, + if err := attrSRPC.Call(utils.APIerSv1GetAttributeProfile, utils.TenantIDWithArgDispatcher{TenantID: &utils.TenantID{Tenant: "golant", ID: "ATTR_972587832508_SESSIONAUTH"}}, &reply); err != nil { t.Fatal(err) } @@ -875,7 +875,7 @@ func testAttributeSSetAlsPrf3(t *testing.T) { }, } var result string - if err := attrSRPC.Call(utils.ApierV1SetAttributeProfile, alsPrf, &result); err == nil { + if err := attrSRPC.Call(utils.APIerSv1SetAttributeProfile, alsPrf, &result); err == nil { t.Error(err) } } @@ -904,7 +904,7 @@ func testAttributeSSetAlsPrf4(t *testing.T) { }, } var result string - if err := attrSRPC.Call(utils.ApierV1SetAttributeProfile, alsPrf, &result); err == nil { + if err := attrSRPC.Call(utils.APIerSv1SetAttributeProfile, alsPrf, &result); err == nil { t.Error(err) } } @@ -939,7 +939,7 @@ func testAttributeSProcessEventWithSearchAndReplace(t *testing.T) { }, } var result string - if err := attrSRPC.Call(utils.ApierV1SetAttributeProfile, attrPrf1, &result); err != nil { + if err := attrSRPC.Call(utils.APIerSv1SetAttributeProfile, attrPrf1, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -1033,17 +1033,17 @@ func testAttributeSProcessWithMultipleRuns(t *testing.T) { } // Add attribute in DM var result string - if err := attrSRPC.Call(utils.ApierV1SetAttributeProfile, attrPrf1, &result); err != nil { + if err := attrSRPC.Call(utils.APIerSv1SetAttributeProfile, attrPrf1, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } - if err := attrSRPC.Call(utils.ApierV1SetAttributeProfile, attrPrf2, &result); err != nil { + if err := attrSRPC.Call(utils.APIerSv1SetAttributeProfile, attrPrf2, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } - if err := attrSRPC.Call(utils.ApierV1SetAttributeProfile, attrPrf3, &result); err != nil { + if err := attrSRPC.Call(utils.APIerSv1SetAttributeProfile, attrPrf3, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -1143,17 +1143,17 @@ func testAttributeSProcessWithMultipleRuns2(t *testing.T) { } // Add attributeProfiles var result string - if err := attrSRPC.Call(utils.ApierV1SetAttributeProfile, attrPrf1, &result); err != nil { + if err := attrSRPC.Call(utils.APIerSv1SetAttributeProfile, attrPrf1, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } - if err := attrSRPC.Call(utils.ApierV1SetAttributeProfile, attrPrf2, &result); err != nil { + if err := attrSRPC.Call(utils.APIerSv1SetAttributeProfile, attrPrf2, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } - if err := attrSRPC.Call(utils.ApierV1SetAttributeProfile, attrPrf3, &result); err != nil { + if err := attrSRPC.Call(utils.APIerSv1SetAttributeProfile, attrPrf3, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -1227,7 +1227,7 @@ func testAttributeSCachingMetaNone(t *testing.T) { } // set the profile var result string - if err := attrSRPC.Call(utils.ApierV1SetAttributeProfile, attrPrf1, &result); err != nil { + if err := attrSRPC.Call(utils.APIerSv1SetAttributeProfile, attrPrf1, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -1256,7 +1256,7 @@ func testAttributeSCachingMetaNone(t *testing.T) { //check in dataManager expected := []string{"ATTR_1"} var rcvIDs []string - if err := attrSRPC.Call(utils.ApierV1GetAttributeProfileIDs, utils.TenantArgWithPaginator{TenantArg: utils.TenantArg{Tenant: "cgrates.org"}}, &rcvIDs); err != nil { + if err := attrSRPC.Call(utils.APIerSv1GetAttributeProfileIDs, utils.TenantArgWithPaginator{TenantArg: utils.TenantArg{Tenant: "cgrates.org"}}, &rcvIDs); err != nil { t.Error(err) } else if !reflect.DeepEqual(expected, rcvIDs) { t.Errorf("Expecting : %+v, received: %+v", expected, rcvIDs) @@ -1286,7 +1286,7 @@ func testAttributeSCachingMetaLoad(t *testing.T) { } // set the profile var result string - if err := attrSRPC.Call(utils.ApierV1SetAttributeProfile, attrPrf1, &result); err != nil { + if err := attrSRPC.Call(utils.APIerSv1SetAttributeProfile, attrPrf1, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -1316,14 +1316,14 @@ func testAttributeSCachingMetaLoad(t *testing.T) { //check in dataManager expected := []string{"ATTR_1"} var rcvIDs []string - if err := attrSRPC.Call(utils.ApierV1GetAttributeProfileIDs, utils.TenantArgWithPaginator{TenantArg: utils.TenantArg{Tenant: "cgrates.org"}}, &rcvIDs); err != nil { + if err := attrSRPC.Call(utils.APIerSv1GetAttributeProfileIDs, utils.TenantArgWithPaginator{TenantArg: utils.TenantArg{Tenant: "cgrates.org"}}, &rcvIDs); err != nil { t.Error(err) } else if !reflect.DeepEqual(expected, rcvIDs) { t.Errorf("Expecting : %+v, received: %+v", expected, rcvIDs) } //remove from cache and DataManager the profile var resp string - if err := attrSRPC.Call(utils.ApierV1RemoveAttributeProfile, + if err := attrSRPC.Call(utils.APIerSv1RemoveAttributeProfile, &utils.TenantIDWithCache{Tenant: attrPrf1.Tenant, ID: attrPrf1.ID, Cache: utils.StringPointer(utils.MetaRemove)}, &resp); err != nil { t.Error(err) @@ -1348,7 +1348,7 @@ func testAttributeSCachingMetaLoad(t *testing.T) { } //check in dataManager - if err := attrSRPC.Call(utils.ApierV1GetAttributeProfileIDs, utils.TenantArgWithPaginator{TenantArg: utils.TenantArg{Tenant: "cgrates.org"}}, &rcvIDs); err == nil || + if err := attrSRPC.Call(utils.APIerSv1GetAttributeProfileIDs, utils.TenantArgWithPaginator{TenantArg: utils.TenantArg{Tenant: "cgrates.org"}}, &rcvIDs); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Fatalf("Expected error: %s received error: %s and reply: %v ", utils.ErrNotFound, err, rcvIDs) @@ -1378,7 +1378,7 @@ func testAttributeSCachingMetaReload1(t *testing.T) { } // set the profile var result string - if err := attrSRPC.Call(utils.ApierV1SetAttributeProfile, attrPrf1, &result); err != nil { + if err := attrSRPC.Call(utils.APIerSv1SetAttributeProfile, attrPrf1, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -1407,7 +1407,7 @@ func testAttributeSCachingMetaReload1(t *testing.T) { //check in dataManager expected := []string{"ATTR_1"} var rcvIDs []string - if err := attrSRPC.Call(utils.ApierV1GetAttributeProfileIDs, utils.TenantArgWithPaginator{TenantArg: utils.TenantArg{Tenant: "cgrates.org"}}, &rcvIDs); err != nil { + if err := attrSRPC.Call(utils.APIerSv1GetAttributeProfileIDs, utils.TenantArgWithPaginator{TenantArg: utils.TenantArg{Tenant: "cgrates.org"}}, &rcvIDs); err != nil { t.Error(err) } else if !reflect.DeepEqual(expected, rcvIDs) { t.Errorf("Expecting : %+v, received: %+v", expected, rcvIDs) @@ -1437,14 +1437,14 @@ func testAttributeSCachingMetaReload2(t *testing.T) { } // set the profile var result string - if err := attrSRPC.Call(utils.ApierV1SetAttributeProfile, attrPrf1, &result); err != nil { + if err := attrSRPC.Call(utils.APIerSv1SetAttributeProfile, attrPrf1, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } var reply *engine.AttributeProfile - if err := attrSRPC.Call(utils.ApierV1GetAttributeProfile, + if err := attrSRPC.Call(utils.APIerSv1GetAttributeProfile, utils.TenantIDWithArgDispatcher{TenantID: &utils.TenantID{Tenant: "cgrates.org", ID: "ATTR_1"}}, &reply); err != nil { t.Fatal(err) } @@ -1476,13 +1476,13 @@ func testAttributeSCachingMetaReload2(t *testing.T) { Cache: utils.StringPointer(utils.MetaReload), } // set the profile - if err := attrSRPC.Call(utils.ApierV1SetAttributeProfile, attrPrf2, &result); err != nil { + if err := attrSRPC.Call(utils.APIerSv1SetAttributeProfile, attrPrf2, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } - if err := attrSRPC.Call(utils.ApierV1GetAttributeProfile, + if err := attrSRPC.Call(utils.APIerSv1GetAttributeProfile, utils.TenantIDWithArgDispatcher{TenantID: &utils.TenantID{Tenant: "cgrates.org", ID: "ATTR_1"}}, &reply); err != nil { t.Fatal(err) } @@ -1516,7 +1516,7 @@ func testAttributeSCachingMetaRemove(t *testing.T) { } // set the profile var result string - if err := attrSRPC.Call(utils.ApierV1SetAttributeProfile, attrPrf1, &result); err != nil { + if err := attrSRPC.Call(utils.APIerSv1SetAttributeProfile, attrPrf1, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -1565,7 +1565,7 @@ func testAttributeSCachingMetaRemove(t *testing.T) { Cache: utils.StringPointer(utils.MetaRemove), } // set the profile - if err := attrSRPC.Call(utils.ApierV1SetAttributeProfile, attrPrf2, &result); err != nil { + if err := attrSRPC.Call(utils.APIerSv1SetAttributeProfile, attrPrf2, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -1586,7 +1586,7 @@ func testAttributeSCachingMetaRemove(t *testing.T) { //check in dataManager expected := []string{"ATTR_1"} var rcvIDs []string - if err := attrSRPC.Call(utils.ApierV1GetAttributeProfileIDs, utils.TenantArgWithPaginator{TenantArg: utils.TenantArg{Tenant: "cgrates.org"}}, &rcvIDs); err != nil { + if err := attrSRPC.Call(utils.APIerSv1GetAttributeProfileIDs, utils.TenantArgWithPaginator{TenantArg: utils.TenantArg{Tenant: "cgrates.org"}}, &rcvIDs); err != nil { t.Error(err) } else if !reflect.DeepEqual(expected, rcvIDs) { t.Errorf("Expecting : %+v, received: %+v", expected, rcvIDs) diff --git a/apier/v1/auth.go b/apier/v1/auth.go index 60a3caf93..5c1d32d0b 100644 --- a/apier/v1/auth.go +++ b/apier/v1/auth.go @@ -27,7 +27,7 @@ import ( ) // Returns MaxUsage (for calls in seconds), -1 for no limit -func (self *ApierV1) GetMaxUsage(usageRecord engine.UsageRecordWithArgDispatcher, maxUsage *int64) error { +func (self *APIerSv1) GetMaxUsage(usageRecord engine.UsageRecordWithArgDispatcher, maxUsage *int64) error { if usageRecord.ToR == "" { usageRecord.ToR = utils.VOICE } diff --git a/apier/v1/caches_it_test.go b/apier/v1/caches_it_test.go index 19e64465b..4477c0a0a 100644 --- a/apier/v1/caches_it_test.go +++ b/apier/v1/caches_it_test.go @@ -119,7 +119,7 @@ func testCacheSRpcConn(t *testing.T) { func testCacheSLoadTariffPlanFromFolder(t *testing.T) { var reply string attrs := &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "testtp")} - if err := chcRPC.Call(utils.ApierV1LoadTariffPlanFromFolder, attrs, &reply); err != nil { + if err := chcRPC.Call(utils.APIerSv1LoadTariffPlanFromFolder, attrs, &reply); err != nil { t.Error(err) } time.Sleep(time.Duration(*waitRater) * time.Millisecond) @@ -238,7 +238,7 @@ func testCacheSGetItemIDs(t *testing.T) { CacheID: utils.CacheThresholdProfiles, } if err := chcRPC.Call(utils.CacheSv1GetItemIDs, argsAPI, &rcvKeys); err != nil { - t.Fatalf("Got error on ApierV1.GetCacheStats: %s ", err.Error()) + t.Fatalf("Got error on APIerSv1.GetCacheStats: %s ", err.Error()) } if !reflect.DeepEqual(expKeys, rcvKeys) { t.Errorf("Expected: %+v, received: %+v", expKeys, rcvKeys) diff --git a/apier/v1/cdre.go b/apier/v1/cdre.go index d76edc5cc..62ca35cc3 100644 --- a/apier/v1/cdre.go +++ b/apier/v1/cdre.go @@ -39,7 +39,7 @@ import ( "github.com/cgrates/cgrates/utils" ) -func (api *ApierV1) ExportCdrsToZipString(attr utils.AttrExpFileCdrs, reply *string) error { +func (api *APIerSv1) ExportCdrsToZipString(attr utils.AttrExpFileCdrs, reply *string) error { tmpDir := "/tmp" attr.ExportDir = &tmpDir // Enforce exporting to tmp always so we avoid cleanup issues efc := utils.ExportedFileCdrs{} @@ -92,7 +92,7 @@ func (api *ApierV1) ExportCdrsToZipString(attr utils.AttrExpFileCdrs, reply *str } // Deprecated by AttrExportCDRsToFile -func (api *ApierV1) ExportCdrsToFile(attr utils.AttrExpFileCdrs, reply *utils.ExportedFileCdrs) (err error) { +func (api *APIerSv1) ExportCdrsToFile(attr utils.AttrExpFileCdrs, reply *utils.ExportedFileCdrs) (err error) { exportTemplate := api.Config.CdreProfiles[utils.MetaDefault] if attr.ExportTemplate != nil && len(*attr.ExportTemplate) != 0 { // Export template prefered, use it var hasIt bool @@ -174,7 +174,7 @@ type ConfigPathArg struct { } // Reloads CDRE configuration out of folder specified -func (apier *ApierV1) ReloadCdreConfig(attrs ConfigPathArg, reply *string) error { +func (apier *APIerSv1) ReloadCdreConfig(attrs ConfigPathArg, reply *string) error { if attrs.ConfigPath == "" { attrs.ConfigPath = utils.CONFIG_PATH } @@ -208,7 +208,7 @@ type RplExportedCDRs struct { } // ExportCDRs exports CDRs on a path (file or remote) -func (api *ApierV1) ExportCDRs(arg ArgExportCDRs, reply *RplExportedCDRs) (err error) { +func (api *APIerSv1) ExportCDRs(arg ArgExportCDRs, reply *RplExportedCDRs) (err error) { cdreReloadStruct := <-api.Config.ConfigReloads[utils.CDRE] // Read the content of the channel, locking it defer func() { api.Config.ConfigReloads[utils.CDRE] <- cdreReloadStruct }() // Unlock reloads at exit exportTemplate := api.Config.CdreProfiles[utils.MetaDefault] diff --git a/apier/v1/cdre_it_test.go b/apier/v1/cdre_it_test.go index 5f9ce56f2..b6bd73c89 100755 --- a/apier/v1/cdre_it_test.go +++ b/apier/v1/cdre_it_test.go @@ -174,7 +174,7 @@ func testCDReExportCDRs(t *testing.T) { Verbose: true, } var rply *RplExportedCDRs - if err := cdreRPC.Call(utils.ApierV1ExportCDRs, attr, &rply); err != nil { + if err := cdreRPC.Call(utils.APIerSv1ExportCDRs, attr, &rply); err != nil { t.Error("Unexpected error: ", err.Error()) } else if len(rply.ExportedCGRIDs) != 2 { t.Errorf("Unexpected number of CDR exported: %s ", utils.ToJSON(rply)) @@ -184,7 +184,7 @@ func testCDReExportCDRs(t *testing.T) { func testCDReFromFolder(t *testing.T) { var reply string attrs := &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "tutorial")} - if err := cdreRPC.Call(utils.ApierV1LoadTariffPlanFromFolder, attrs, &reply); err != nil { + if err := cdreRPC.Call(utils.APIerSv1LoadTariffPlanFromFolder, attrs, &reply); err != nil { t.Error(err) } time.Sleep(500 * time.Millisecond) @@ -217,7 +217,7 @@ func testCDReProcessExternalCdr(t *testing.T) { time.Sleep(50 * time.Millisecond) var cdrs []*engine.ExternalCDR args := utils.RPCCDRsFilter{OriginIDs: []string{"testextcdr1"}} - if err := cdreRPC.Call(utils.ApierV2GetCDRs, args, &cdrs); err != nil { + if err := cdreRPC.Call(utils.APIerSv2GetCDRs, args, &cdrs); err != nil { t.Error("Unexpected error: ", err.Error()) } else if len(cdrs) != 1 { t.Errorf("Unexpected number of CDRs returned: %v, cdrs=%s ", len(cdrs), utils.ToJSON(cdrs)) @@ -304,13 +304,13 @@ func testCDReAddAttributes(t *testing.T) { } alsPrf.Compile() var result string - if err := cdreRPC.Call(utils.ApierV1SetAttributeProfile, alsPrf, &result); err != nil { + if err := cdreRPC.Call(utils.APIerSv1SetAttributeProfile, alsPrf, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } var reply *engine.AttributeProfile - if err := cdreRPC.Call(utils.ApierV1GetAttributeProfile, + if err := cdreRPC.Call(utils.APIerSv1GetAttributeProfile, utils.TenantIDWithArgDispatcher{TenantID: &utils.TenantID{Tenant: "cgrates.org", ID: "ATTR_CDRE"}}, &reply); err != nil { t.Fatal(err) } @@ -328,7 +328,7 @@ func testCDReExportCDRsWithAttributes(t *testing.T) { Verbose: true, } var rply *RplExportedCDRs - if err := cdreRPC.Call(utils.ApierV1ExportCDRs, attr, &rply); err != nil { + if err := cdreRPC.Call(utils.APIerSv1ExportCDRs, attr, &rply); err != nil { t.Fatal("Unexpected error: ", err.Error()) } else if len(rply.ExportedCGRIDs) != 2 { t.Errorf("Unexpected number of CDR exported: %s ", utils.ToJSON(rply)) diff --git a/apier/v1/cdrs.go b/apier/v1/cdrs.go index 4c610ce61..9c01002f7 100644 --- a/apier/v1/cdrs.go +++ b/apier/v1/cdrs.go @@ -24,7 +24,7 @@ import ( ) // Retrieves the callCost out of CGR logDb -func (apier *ApierV1) GetEventCost(attrs utils.AttrGetCallCost, reply *engine.EventCost) error { +func (apier *APIerSv1) GetEventCost(attrs utils.AttrGetCallCost, reply *engine.EventCost) error { if attrs.CgrId == "" { return utils.NewErrMandatoryIeMissing("CgrId") } @@ -50,7 +50,7 @@ func (apier *ApierV1) GetEventCost(attrs utils.AttrGetCallCost, reply *engine.Ev } // Retrieves CDRs based on the filters -func (apier *ApierV1) GetCDRs(attrs utils.AttrGetCdrs, reply *[]*engine.ExternalCDR) error { +func (apier *APIerSv1) GetCDRs(attrs utils.AttrGetCdrs, reply *[]*engine.ExternalCDR) error { cdrsFltr, err := attrs.AsCDRsFilter(apier.Config.GeneralCfg().DefaultTimezone) if err != nil { return utils.NewErrServerError(err) @@ -68,7 +68,7 @@ func (apier *ApierV1) GetCDRs(attrs utils.AttrGetCdrs, reply *[]*engine.External } // New way of removing CDRs -func (apier *ApierV1) RemoveCDRs(attrs utils.RPCCDRsFilter, reply *string) error { +func (apier *APIerSv1) RemoveCDRs(attrs utils.RPCCDRsFilter, reply *string) error { cdrsFilter, err := attrs.AsCDRsFilter(apier.Config.GeneralCfg().DefaultTimezone) if err != nil { return utils.NewErrServerError(err) diff --git a/apier/v1/cdrs_it_test.go b/apier/v1/cdrs_it_test.go index 2be249b6d..f94b17b92 100644 --- a/apier/v1/cdrs_it_test.go +++ b/apier/v1/cdrs_it_test.go @@ -107,7 +107,7 @@ func testV1CDRsRpcConn(t *testing.T) { func testV1CDRsLoadTariffPlanFromFolder(t *testing.T) { var loadInst string - if err := cdrsRpc.Call(utils.ApierV1LoadTariffPlanFromFolder, + if err := cdrsRpc.Call(utils.APIerSv1LoadTariffPlanFromFolder, &utils.AttrLoadTpFromFolder{FolderPath: path.Join( *dataDir, "tariffplans", "testit")}, &loadInst); err != nil { t.Error(err) @@ -131,7 +131,7 @@ func testV1CDRsProcessEventWithRefund(t *testing.T) { }, } var reply string - if err := cdrsRpc.Call(utils.ApierV1SetBalance, attrSetBalance, &reply); err != nil { + if err := cdrsRpc.Call(utils.APIerSv1SetBalance, attrSetBalance, &reply); err != nil { t.Error(err) } else if reply != utils.OK { t.Errorf("received: %s", reply) @@ -146,13 +146,13 @@ func testV1CDRsProcessEventWithRefund(t *testing.T) { utils.Weight: 10, }, } - if err := cdrsRpc.Call(utils.ApierV1SetBalance, attrSetBalance, &reply); err != nil { + if err := cdrsRpc.Call(utils.APIerSv1SetBalance, attrSetBalance, &reply); err != nil { t.Error(err) } else if reply != utils.OK { t.Errorf("received: <%s>", reply) } expectedVoice := 300000000000.0 - if err := cdrsRpc.Call(utils.ApierV2GetAccount, acntAttrs, &acnt); err != nil { + if err := cdrsRpc.Call(utils.APIerSv2GetAccount, acntAttrs, &acnt); err != nil { t.Error(err) } else if rply := acnt.BalanceMap[utils.VOICE].GetTotalValue(); rply != expectedVoice { t.Errorf("Expecting: %v, received: %v", expectedVoice, rply) @@ -178,7 +178,7 @@ func testV1CDRsProcessEventWithRefund(t *testing.T) { t.Error("Unexpected reply received: ", reply) } var cdrs []*engine.ExternalCDR - if err := cdrsRpc.Call(utils.ApierV1GetCDRs, utils.AttrGetCdrs{}, &cdrs); err != nil { + if err := cdrsRpc.Call(utils.APIerSv1GetCDRs, utils.AttrGetCdrs{}, &cdrs); err != nil { t.Error("Unexpected error: ", err.Error()) } else if len(cdrs) != 1 { t.Error("Unexpected number of CDRs returned: ", len(cdrs)) @@ -187,7 +187,7 @@ func testV1CDRsProcessEventWithRefund(t *testing.T) { t.Errorf("Unexpected cost for CDR: %f", cdrs[0].Cost) } } - if err := cdrsRpc.Call(utils.ApierV2GetAccount, acntAttrs, &acnt); err != nil { + if err := cdrsRpc.Call(utils.APIerSv2GetAccount, acntAttrs, &acnt); err != nil { t.Error(err) } else if blc1 := acnt.GetBalanceWithID(utils.VOICE, "BALANCE1"); blc1.Value != 0 { t.Errorf("Balance1 is: %s", utils.ToIJSON(blc1)) @@ -198,7 +198,7 @@ func testV1CDRsProcessEventWithRefund(t *testing.T) { if err := cdrsRpc.Call(utils.CDRsV1ProcessEvent, argsEv, &reply); err == nil { t.Error("should receive error here") } - if err := cdrsRpc.Call(utils.ApierV2GetAccount, acntAttrs, &acnt); err != nil { + if err := cdrsRpc.Call(utils.APIerSv2GetAccount, acntAttrs, &acnt); err != nil { t.Error(err) } else if blc1 := acnt.GetBalanceWithID(utils.VOICE, "BALANCE1"); blc1.Value != 0 { t.Errorf("Balance1 is: %s", utils.ToIJSON(blc1)) @@ -225,7 +225,7 @@ func testV1CDRsProcessEventWithRefund(t *testing.T) { } else if reply != utils.OK { t.Error("Unexpected reply received: ", reply) } - if err := cdrsRpc.Call(utils.ApierV2GetAccount, acntAttrs, &acnt); err != nil { + if err := cdrsRpc.Call(utils.APIerSv2GetAccount, acntAttrs, &acnt); err != nil { t.Error(err) } else if blc1 := acnt.GetBalanceWithID(utils.VOICE, "BALANCE1"); blc1.Value != 120000000000 { // refund is done after debit t.Errorf("Balance1 is: %s", utils.ToIJSON(blc1)) @@ -252,14 +252,14 @@ func testV1CDRsRefundOutOfSessionCost(t *testing.T) { }, } var reply string - if err := cdrsRpc.Call(utils.ApierV1SetBalance, attrSetBalance, &reply); err != nil { + if err := cdrsRpc.Call(utils.APIerSv1SetBalance, attrSetBalance, &reply); err != nil { t.Error(err) } else if reply != utils.OK { t.Errorf("received: %s", reply) } exp := 123.0 - if err := cdrsRpc.Call(utils.ApierV2GetAccount, acntAttrs, &acnt); err != nil { + if err := cdrsRpc.Call(utils.APIerSv2GetAccount, acntAttrs, &acnt); err != nil { t.Error(err) } else if rply := acnt.BalanceMap[utils.MONETARY].GetTotalValue(); rply != exp { t.Errorf("Expecting: %v, received: %v", exp, rply) @@ -377,7 +377,7 @@ func testV1CDRsRefundOutOfSessionCost(t *testing.T) { // Initial the balance was 123.0 // after refunc the balance become 123.0+2.3=125.3 exp = 124.0454 - if err := cdrsRpc.Call(utils.ApierV2GetAccount, acntAttrs, &acnt); err != nil { + if err := cdrsRpc.Call(utils.APIerSv2GetAccount, acntAttrs, &acnt); err != nil { t.Error(err) } else if rply := acnt.BalanceMap[utils.MONETARY].GetTotalValue(); rply != exp { t.Errorf("Expecting: %v, received: %v", exp, rply) @@ -401,14 +401,14 @@ func testV1CDRsRefundCDR(t *testing.T) { }, } var reply string - if err := cdrsRpc.Call(utils.ApierV1SetBalance, attrSetBalance, &reply); err != nil { + if err := cdrsRpc.Call(utils.APIerSv1SetBalance, attrSetBalance, &reply); err != nil { t.Error(err) } else if reply != utils.OK { t.Errorf("received: %s", reply) } exp := 123.0 - if err := cdrsRpc.Call(utils.ApierV2GetAccount, acntAttrs, &acnt); err != nil { + if err := cdrsRpc.Call(utils.APIerSv2GetAccount, acntAttrs, &acnt); err != nil { t.Error(err) } else if rply := acnt.BalanceMap[utils.MONETARY].GetTotalValue(); rply != exp { t.Errorf("Expecting: %v, received: %v", exp, rply) @@ -510,7 +510,7 @@ func testV1CDRsRefundCDR(t *testing.T) { // Initial the balance was 123.0 // after refund the balance become 123.0 + 2.3 = 125.3 exp = 125.3 - if err := cdrsRpc.Call(utils.ApierV2GetAccount, acntAttrs, &acnt); err != nil { + if err := cdrsRpc.Call(utils.APIerSv2GetAccount, acntAttrs, &acnt); err != nil { t.Error(err) } else if rply := acnt.BalanceMap[utils.MONETARY].GetTotalValue(); rply != exp { t.Errorf("Expecting: %v, received: %v", exp, rply) diff --git a/apier/v1/chargers.go b/apier/v1/chargers.go index 7a5d3d204..ef1385da2 100644 --- a/apier/v1/chargers.go +++ b/apier/v1/chargers.go @@ -26,11 +26,11 @@ import ( ) // GetChargerProfile returns a Charger Profile -func (apierV1 *ApierV1) GetChargerProfile(arg *utils.TenantID, reply *engine.ChargerProfile) error { +func (APIerSv1 *APIerSv1) GetChargerProfile(arg *utils.TenantID, reply *engine.ChargerProfile) error { if missing := utils.MissingStructFields(arg, []string{"Tenant", "ID"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } - if cpp, err := apierV1.DataManager.GetChargerProfile(arg.Tenant, arg.ID, true, true, utils.NonTransactional); err != nil { + if cpp, err := APIerSv1.DataManager.GetChargerProfile(arg.Tenant, arg.ID, true, true, utils.NonTransactional); err != nil { return utils.APIErrorHandler(err) } else { *reply = *cpp @@ -39,12 +39,12 @@ func (apierV1 *ApierV1) GetChargerProfile(arg *utils.TenantID, reply *engine.Cha } // GetChargerProfileIDs returns list of chargerProfile IDs registered for a tenant -func (apierV1 *ApierV1) GetChargerProfileIDs(args *utils.TenantArgWithPaginator, chPrfIDs *[]string) error { +func (APIerSv1 *APIerSv1) GetChargerProfileIDs(args *utils.TenantArgWithPaginator, chPrfIDs *[]string) error { if missing := utils.MissingStructFields(args, []string{utils.Tenant}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } prfx := utils.ChargerProfilePrefix + args.Tenant + ":" - keys, err := apierV1.DataManager.DataDB().GetKeysForPrefix(prfx) + keys, err := APIerSv1.DataManager.DataDB().GetKeysForPrefix(prfx) if err != nil { return err } @@ -65,15 +65,15 @@ type ChargerWithCache struct { } //SetChargerProfile add/update a new Charger Profile -func (apierV1 *ApierV1) SetChargerProfile(arg *ChargerWithCache, reply *string) error { +func (APIerSv1 *APIerSv1) SetChargerProfile(arg *ChargerWithCache, reply *string) error { if missing := utils.MissingStructFields(arg.ChargerProfile, []string{"Tenant", "ID"}); len(missing) != 0 { return utils.NewErrMandatoryIeMissing(missing...) } - if err := apierV1.DataManager.SetChargerProfile(arg.ChargerProfile, true); err != nil { + if err := APIerSv1.DataManager.SetChargerProfile(arg.ChargerProfile, true); err != nil { return utils.APIErrorHandler(err) } //generate a loadID for CacheChargerProfiles and store it in database - if err := apierV1.DataManager.SetLoadIDs(map[string]int64{utils.CacheChargerProfiles: time.Now().UnixNano()}); err != nil { + if err := APIerSv1.DataManager.SetLoadIDs(map[string]int64{utils.CacheChargerProfiles: time.Now().UnixNano()}); err != nil { return utils.APIErrorHandler(err) } //handle caching for ChargerProfile @@ -81,7 +81,7 @@ func (apierV1 *ApierV1) SetChargerProfile(arg *ChargerWithCache, reply *string) CacheID: utils.CacheChargerProfiles, ItemID: arg.TenantID(), } - if err := apierV1.CallCache(GetCacheOpt(arg.Cache), argCache); err != nil { + if err := APIerSv1.CallCache(GetCacheOpt(arg.Cache), argCache); err != nil { return utils.APIErrorHandler(err) } *reply = utils.OK @@ -89,16 +89,16 @@ func (apierV1 *ApierV1) SetChargerProfile(arg *ChargerWithCache, reply *string) } //RemoveChargerProfile remove a specific Charger Profile -func (apierV1 *ApierV1) RemoveChargerProfile(arg *utils.TenantIDWithCache, reply *string) error { +func (APIerSv1 *APIerSv1) RemoveChargerProfile(arg *utils.TenantIDWithCache, reply *string) error { if missing := utils.MissingStructFields(arg, []string{"Tenant", "ID"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } - if err := apierV1.DataManager.RemoveChargerProfile(arg.Tenant, + if err := APIerSv1.DataManager.RemoveChargerProfile(arg.Tenant, arg.ID, utils.NonTransactional, true); err != nil { return utils.APIErrorHandler(err) } //generate a loadID for CacheChargerProfiles and store it in database - if err := apierV1.DataManager.SetLoadIDs(map[string]int64{utils.CacheChargerProfiles: time.Now().UnixNano()}); err != nil { + if err := APIerSv1.DataManager.SetLoadIDs(map[string]int64{utils.CacheChargerProfiles: time.Now().UnixNano()}); err != nil { return utils.APIErrorHandler(err) } //handle caching for ChargerProfile @@ -106,7 +106,7 @@ func (apierV1 *ApierV1) RemoveChargerProfile(arg *utils.TenantIDWithCache, reply CacheID: utils.CacheChargerProfiles, ItemID: arg.TenantID(), } - if err := apierV1.CallCache(GetCacheOpt(arg.Cache), argCache); err != nil { + if err := APIerSv1.CallCache(GetCacheOpt(arg.Cache), argCache); err != nil { return utils.APIErrorHandler(err) } *reply = utils.OK diff --git a/apier/v1/chargers_it_test.go b/apier/v1/chargers_it_test.go index c62729532..3eb6359b9 100755 --- a/apier/v1/chargers_it_test.go +++ b/apier/v1/chargers_it_test.go @@ -154,7 +154,7 @@ func testChargerSLoadAddCharger(t *testing.T) { } var result string - if err := chargerRPC.Call(utils.ApierV1SetChargerProfile, chargerProfile, &result); err != nil { + if err := chargerRPC.Call(utils.APIerSv1SetChargerProfile, chargerProfile, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -179,7 +179,7 @@ func testChargerSLoadAddCharger(t *testing.T) { Weight: 10, }, } - if err := chargerRPC.Call(utils.ApierV1SetAttributeProfile, alsPrf, &result); err != nil { + if err := chargerRPC.Call(utils.APIerSv1SetAttributeProfile, alsPrf, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -257,13 +257,13 @@ func testChargerSSetChargerProfile(t *testing.T) { }, } var result string - if err := chargerRPC.Call(utils.ApierV1SetChargerProfile, chargerProfile, &result); err != nil { + if err := chargerRPC.Call(utils.APIerSv1SetChargerProfile, chargerProfile, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } var reply *engine.ChargerProfile - if err := chargerRPC.Call(utils.ApierV1GetChargerProfile, + if err := chargerRPC.Call(utils.APIerSv1GetChargerProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "ApierTest"}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(chargerProfile.ChargerProfile, reply) { @@ -274,12 +274,12 @@ func testChargerSSetChargerProfile(t *testing.T) { func testChargerSGetChargerProfileIDs(t *testing.T) { expected := []string{"Charger1", "ApierTest"} var result []string - if err := chargerRPC.Call(utils.ApierV1GetChargerProfileIDs, utils.TenantArgWithPaginator{TenantArg: utils.TenantArg{Tenant: "cgrates.org"}}, &result); err != nil { + if err := chargerRPC.Call(utils.APIerSv1GetChargerProfileIDs, utils.TenantArgWithPaginator{TenantArg: utils.TenantArg{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 := chargerRPC.Call(utils.ApierV1GetChargerProfileIDs, utils.TenantArgWithPaginator{ + if err := chargerRPC.Call(utils.APIerSv1GetChargerProfileIDs, utils.TenantArgWithPaginator{ TenantArg: utils.TenantArg{Tenant: "cgrates.org"}, Paginator: utils.Paginator{Limit: utils.IntPointer(1)}, }, &result); err != nil { @@ -292,13 +292,13 @@ func testChargerSGetChargerProfileIDs(t *testing.T) { func testChargerSUpdateChargerProfile(t *testing.T) { chargerProfile.RunID = "*rated" var result string - if err := chargerRPC.Call(utils.ApierV1SetChargerProfile, chargerProfile, &result); err != nil { + if err := chargerRPC.Call(utils.APIerSv1SetChargerProfile, chargerProfile, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } var reply *engine.ChargerProfile - if err := chargerRPC.Call(utils.ApierV1GetChargerProfile, + if err := chargerRPC.Call(utils.APIerSv1GetChargerProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "ApierTest"}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(chargerProfile.ChargerProfile, reply) { @@ -308,19 +308,19 @@ func testChargerSUpdateChargerProfile(t *testing.T) { func testChargerSRemChargerProfile(t *testing.T) { var resp string - if err := chargerRPC.Call(utils.ApierV1RemoveChargerProfile, + if err := chargerRPC.Call(utils.APIerSv1RemoveChargerProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "ApierTest"}, &resp); err != nil { t.Error(err) } else if resp != utils.OK { t.Error("Unexpected reply returned", resp) } var reply *engine.AttributeProfile - if err := chargerRPC.Call(utils.ApierV1GetChargerProfile, + if err := chargerRPC.Call(utils.APIerSv1GetChargerProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "ApierTest"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) } - if err := chargerRPC.Call(utils.ApierV1RemoveChargerProfile, + if err := chargerRPC.Call(utils.APIerSv1RemoveChargerProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "ApierTest"}, &resp); err.Error() != utils.ErrNotFound.Error() { t.Errorf("Expected error: %v recived: %v", utils.ErrNotFound, err) } diff --git a/apier/v1/costs.go b/apier/v1/costs.go index 774a0068d..5cbce94b8 100644 --- a/apier/v1/costs.go +++ b/apier/v1/costs.go @@ -35,7 +35,7 @@ type AttrGetCost struct { *utils.ArgDispatcher } -func (apier *ApierV1) GetCost(attrs AttrGetCost, ec *engine.EventCost) error { +func (apier *APIerSv1) GetCost(attrs AttrGetCost, ec *engine.EventCost) error { usage, err := utils.ParseDurationWithNanosecs(attrs.Usage) if err != nil { return err @@ -74,7 +74,7 @@ type AttrGetDataCost struct { *utils.ArgDispatcher } -func (apier *ApierV1) GetDataCost(attrs AttrGetDataCost, reply *engine.DataCost) error { +func (apier *APIerSv1) GetDataCost(attrs AttrGetDataCost, reply *engine.DataCost) error { aTime, err := utils.ParseTimeDetectLayout(attrs.AnswerTime, apier.Config.GeneralCfg().DefaultTimezone) if err != nil { diff --git a/apier/v1/costs_it_test.go b/apier/v1/costs_it_test.go index b6efc60d2..c0e93f1c8 100644 --- a/apier/v1/costs_it_test.go +++ b/apier/v1/costs_it_test.go @@ -112,7 +112,7 @@ func testCostRPCConn(t *testing.T) { func testCostLoadFromFolder(t *testing.T) { var reply string attrs := &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "tutorial")} - if err := costRPC.Call(utils.ApierV1LoadTariffPlanFromFolder, attrs, &reply); err != nil { + if err := costRPC.Call(utils.APIerSv1LoadTariffPlanFromFolder, attrs, &reply); err != nil { t.Error(err) } time.Sleep(500 * time.Millisecond) @@ -122,7 +122,7 @@ func testCostGetCost(t *testing.T) { attrs := AttrGetCost{Category: "call", Tenant: "cgrates.org", Subject: "1001", AnswerTime: "*now", Destination: "1002", Usage: "120000000000"} //120s ( 2m) var rply *engine.EventCost - if err := costRPC.Call(utils.ApierV1GetCost, attrs, &rply); err != nil { + if err := costRPC.Call(utils.APIerSv1GetCost, attrs, &rply); err != nil { t.Error("Unexpected nil error received: ", err.Error()) } else if *rply.Cost != 0.700200 { // expect to get 0.7 (0.4 connect fee 0.2 first minute 0.1 each minute after) t.Errorf("Unexpected cost received: %f", *rply.Cost) diff --git a/apier/v1/debit.go b/apier/v1/debit.go index 98803ca42..63045e713 100644 --- a/apier/v1/debit.go +++ b/apier/v1/debit.go @@ -25,7 +25,7 @@ import ( // DebitUsage will debit the balance for the usage cost, allowing the // account to go negative if the cost calculated is greater than the balance -func (apier *ApierV1) DebitUsage(usageRecord engine.UsageRecordWithArgDispatcher, reply *string) error { +func (apier *APIerSv1) DebitUsage(usageRecord engine.UsageRecordWithArgDispatcher, reply *string) error { return apier.DebitUsageWithOptions(AttrDebitUsageWithOptions{ UsageRecord: &usageRecord, AllowNegativeAccount: true, @@ -40,7 +40,7 @@ type AttrDebitUsageWithOptions struct { // DebitUsageWithOptions will debit the account based on the usage cost with // additional options to control if the balance can go negative -func (apier *ApierV1) DebitUsageWithOptions(args AttrDebitUsageWithOptions, reply *string) error { +func (apier *APIerSv1) DebitUsageWithOptions(args AttrDebitUsageWithOptions, reply *string) error { usageRecord := args.UsageRecord.UsageRecord if missing := utils.MissingStructFields(usageRecord, []string{"Account", "Destination", "Usage"}); len(missing) != 0 { return utils.NewErrMandatoryIeMissing(missing...) diff --git a/apier/v1/debit_test.go b/apier/v1/debit_test.go index 166b5bbcc..76a073a7b 100644 --- a/apier/v1/debit_test.go +++ b/apier/v1/debit_test.go @@ -28,7 +28,7 @@ import ( ) var ( - apierDebit *ApierV1 + apierDebit *APIerSv1 apierDebitStorage *engine.InternalDB responder *engine.Responder dm *engine.DataManager @@ -42,7 +42,7 @@ func init() { responder := &engine.Responder{MaxComputedUsage: cfg.RalsCfg().MaxComputedUsage} dm = engine.NewDataManager(apierDebitStorage, config.CgrConfig().CacheCfg(), nil) engine.SetDataStorage(dm) - apierDebit = &ApierV1{ + apierDebit = &APIerSv1{ DataManager: dm, Config: cfg, Responder: responder, @@ -56,7 +56,7 @@ func TestDebitUsageWithOptionsSetConfig(t *testing.T) { responder := &engine.Responder{MaxComputedUsage: cfg.RalsCfg().MaxComputedUsage} dm = engine.NewDataManager(apierDebitStorage, config.CgrConfig().CacheCfg(), nil) engine.SetDataStorage(dm) - apierDebit = &ApierV1{ + apierDebit = &APIerSv1{ DataManager: dm, Config: cfg, Responder: responder, diff --git a/apier/v1/dispatcher.go b/apier/v1/dispatcher.go index 2a95306f2..b07ca7581 100755 --- a/apier/v1/dispatcher.go +++ b/apier/v1/dispatcher.go @@ -30,11 +30,11 @@ import ( ) // GetDispatcherProfile returns a Dispatcher Profile -func (apierV1 *ApierV1) GetDispatcherProfile(arg *utils.TenantID, reply *engine.DispatcherProfile) error { +func (APIerSv1 *APIerSv1) GetDispatcherProfile(arg *utils.TenantID, reply *engine.DispatcherProfile) error { if missing := utils.MissingStructFields(arg, []string{"Tenant", "ID"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } - if dpp, err := apierV1.DataManager.GetDispatcherProfile(arg.Tenant, arg.ID, true, true, utils.NonTransactional); err != nil { + if dpp, err := APIerSv1.DataManager.GetDispatcherProfile(arg.Tenant, arg.ID, true, true, utils.NonTransactional); err != nil { return utils.APIErrorHandler(err) } else { *reply = *dpp @@ -43,13 +43,13 @@ func (apierV1 *ApierV1) GetDispatcherProfile(arg *utils.TenantID, reply *engine. } // GetDispatcherProfileIDs returns list of dispatcherProfile IDs registered for a tenant -func (apierV1 *ApierV1) GetDispatcherProfileIDs(tenantArg utils.TenantArgWithPaginator, dPrfIDs *[]string) error { +func (APIerSv1 *APIerSv1) GetDispatcherProfileIDs(tenantArg utils.TenantArgWithPaginator, dPrfIDs *[]string) error { if missing := utils.MissingStructFields(&tenantArg, []string{utils.Tenant}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } tenant := tenantArg.Tenant prfx := utils.DispatcherProfilePrefix + tenant + ":" - keys, err := apierV1.DataManager.DataDB().GetKeysForPrefix(prfx) + keys, err := APIerSv1.DataManager.DataDB().GetKeysForPrefix(prfx) if err != nil { return err } @@ -70,15 +70,15 @@ type DispatcherWithCache struct { } //SetDispatcherProfile add/update a new Dispatcher Profile -func (apierV1 *ApierV1) SetDispatcherProfile(args *DispatcherWithCache, reply *string) error { +func (APIerSv1 *APIerSv1) SetDispatcherProfile(args *DispatcherWithCache, reply *string) error { if missing := utils.MissingStructFields(args.DispatcherProfile, []string{"Tenant", "ID"}); len(missing) != 0 { return utils.NewErrMandatoryIeMissing(missing...) } - if err := apierV1.DataManager.SetDispatcherProfile(args.DispatcherProfile, true); err != nil { + if err := APIerSv1.DataManager.SetDispatcherProfile(args.DispatcherProfile, true); err != nil { return utils.APIErrorHandler(err) } //generate a loadID for CacheDispatcherProfiles and store it in database - if err := apierV1.DataManager.SetLoadIDs(map[string]int64{utils.CacheDispatcherProfiles: time.Now().UnixNano()}); err != nil { + if err := APIerSv1.DataManager.SetLoadIDs(map[string]int64{utils.CacheDispatcherProfiles: time.Now().UnixNano()}); err != nil { return utils.APIErrorHandler(err) } //handle caching for DispatcherProfile @@ -86,7 +86,7 @@ func (apierV1 *ApierV1) SetDispatcherProfile(args *DispatcherWithCache, reply *s CacheID: utils.CacheDispatcherProfiles, ItemID: args.TenantID(), } - if err := apierV1.CallCache(GetCacheOpt(args.Cache), argCache); err != nil { + if err := APIerSv1.CallCache(GetCacheOpt(args.Cache), argCache); err != nil { return utils.APIErrorHandler(err) } *reply = utils.OK @@ -94,16 +94,16 @@ func (apierV1 *ApierV1) SetDispatcherProfile(args *DispatcherWithCache, reply *s } //RemoveDispatcherProfile remove a specific Dispatcher Profile -func (apierV1 *ApierV1) RemoveDispatcherProfile(arg *utils.TenantIDWithCache, reply *string) error { +func (APIerSv1 *APIerSv1) RemoveDispatcherProfile(arg *utils.TenantIDWithCache, reply *string) error { if missing := utils.MissingStructFields(arg, []string{"Tenant", "ID"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } - if err := apierV1.DataManager.RemoveDispatcherProfile(arg.Tenant, + if err := APIerSv1.DataManager.RemoveDispatcherProfile(arg.Tenant, arg.ID, utils.NonTransactional, true); err != nil { return utils.APIErrorHandler(err) } //generate a loadID for CacheDispatcherProfiles and store it in database - if err := apierV1.DataManager.SetLoadIDs(map[string]int64{utils.CacheDispatcherProfiles: time.Now().UnixNano()}); err != nil { + if err := APIerSv1.DataManager.SetLoadIDs(map[string]int64{utils.CacheDispatcherProfiles: time.Now().UnixNano()}); err != nil { return utils.APIErrorHandler(err) } //handle caching for DispatcherProfile @@ -111,7 +111,7 @@ func (apierV1 *ApierV1) RemoveDispatcherProfile(arg *utils.TenantIDWithCache, re CacheID: utils.CacheDispatcherProfiles, ItemID: arg.TenantID(), } - if err := apierV1.CallCache(GetCacheOpt(arg.Cache), argCache); err != nil { + if err := APIerSv1.CallCache(GetCacheOpt(arg.Cache), argCache); err != nil { return utils.APIErrorHandler(err) } *reply = utils.OK @@ -119,11 +119,11 @@ func (apierV1 *ApierV1) RemoveDispatcherProfile(arg *utils.TenantIDWithCache, re } // GetDispatcherHost returns a Dispatcher Host -func (apierV1 *ApierV1) GetDispatcherHost(arg *utils.TenantID, reply *engine.DispatcherHost) error { +func (APIerSv1 *APIerSv1) GetDispatcherHost(arg *utils.TenantID, reply *engine.DispatcherHost) error { if missing := utils.MissingStructFields(arg, []string{"Tenant", "ID"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } - if dpp, err := apierV1.DataManager.GetDispatcherHost(arg.Tenant, arg.ID, true, false, utils.NonTransactional); err != nil { + if dpp, err := APIerSv1.DataManager.GetDispatcherHost(arg.Tenant, arg.ID, true, false, utils.NonTransactional); err != nil { return utils.APIErrorHandler(err) } else { *reply = *dpp @@ -132,13 +132,13 @@ func (apierV1 *ApierV1) GetDispatcherHost(arg *utils.TenantID, reply *engine.Dis } // GetDispatcherHostIDs returns list of dispatcherHost IDs registered for a tenant -func (apierV1 *ApierV1) GetDispatcherHostIDs(tenantArg utils.TenantArgWithPaginator, dPrfIDs *[]string) error { +func (APIerSv1 *APIerSv1) GetDispatcherHostIDs(tenantArg utils.TenantArgWithPaginator, dPrfIDs *[]string) error { if missing := utils.MissingStructFields(&tenantArg, []string{utils.Tenant}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } tenant := tenantArg.Tenant prfx := utils.DispatcherHostPrefix + tenant + ":" - keys, err := apierV1.DataManager.DataDB().GetKeysForPrefix(prfx) + keys, err := APIerSv1.DataManager.DataDB().GetKeysForPrefix(prfx) if err != nil { return err } @@ -159,15 +159,15 @@ type DispatcherHostWithCache struct { } //SetDispatcherHost add/update a new Dispatcher Host -func (apierV1 *ApierV1) SetDispatcherHost(args *DispatcherHostWithCache, reply *string) error { +func (APIerSv1 *APIerSv1) SetDispatcherHost(args *DispatcherHostWithCache, reply *string) error { if missing := utils.MissingStructFields(args.DispatcherHost, []string{"Tenant", "ID"}); len(missing) != 0 { return utils.NewErrMandatoryIeMissing(missing...) } - if err := apierV1.DataManager.SetDispatcherHost(args.DispatcherHost); err != nil { + if err := APIerSv1.DataManager.SetDispatcherHost(args.DispatcherHost); err != nil { return utils.APIErrorHandler(err) } //generate a loadID for CacheDispatcherHosts and store it in database - if err := apierV1.DataManager.SetLoadIDs(map[string]int64{utils.CacheDispatcherHosts: time.Now().UnixNano()}); err != nil { + if err := APIerSv1.DataManager.SetLoadIDs(map[string]int64{utils.CacheDispatcherHosts: time.Now().UnixNano()}); err != nil { return utils.APIErrorHandler(err) } //handle caching for DispatcherProfile @@ -175,7 +175,7 @@ func (apierV1 *ApierV1) SetDispatcherHost(args *DispatcherHostWithCache, reply * CacheID: utils.CacheDispatcherHosts, ItemID: args.TenantID(), } - if err := apierV1.CallCache(GetCacheOpt(args.Cache), argCache); err != nil { + if err := APIerSv1.CallCache(GetCacheOpt(args.Cache), argCache); err != nil { return utils.APIErrorHandler(err) } *reply = utils.OK @@ -183,16 +183,16 @@ func (apierV1 *ApierV1) SetDispatcherHost(args *DispatcherHostWithCache, reply * } //RemoveDispatcherHost remove a specific Dispatcher Host -func (apierV1 *ApierV1) RemoveDispatcherHost(arg *utils.TenantIDWithCache, reply *string) error { +func (APIerSv1 *APIerSv1) RemoveDispatcherHost(arg *utils.TenantIDWithCache, reply *string) error { if missing := utils.MissingStructFields(arg, []string{"Tenant", "ID"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } - if err := apierV1.DataManager.RemoveDispatcherHost(arg.Tenant, + if err := APIerSv1.DataManager.RemoveDispatcherHost(arg.Tenant, arg.ID, utils.NonTransactional); err != nil { return utils.APIErrorHandler(err) } //generate a loadID for CacheDispatcherHosts and store it in database - if err := apierV1.DataManager.SetLoadIDs(map[string]int64{utils.CacheDispatcherHosts: time.Now().UnixNano()}); err != nil { + if err := APIerSv1.DataManager.SetLoadIDs(map[string]int64{utils.CacheDispatcherHosts: time.Now().UnixNano()}); err != nil { return utils.APIErrorHandler(err) } //handle caching for DispatcherProfile @@ -200,7 +200,7 @@ func (apierV1 *ApierV1) RemoveDispatcherHost(arg *utils.TenantIDWithCache, reply CacheID: utils.CacheDispatcherHosts, ItemID: arg.TenantID(), } - if err := apierV1.CallCache(GetCacheOpt(arg.Cache), argCache); err != nil { + if err := APIerSv1.CallCache(GetCacheOpt(arg.Cache), argCache); err != nil { return utils.APIErrorHandler(err) } *reply = utils.OK @@ -686,7 +686,7 @@ func (dSv1 DispatcherSv1) GetProfileForEvent(ev *dispatchers.DispatcherEvent, } func (dSv1 DispatcherSv1) Apier(args *utils.MethodParameters, reply *interface{}) (err error) { - return dSv1.dS.V1Apier(new(ApierV1), args, reply) + return dSv1.dS.V1Apier(new(APIerSv1), args, reply) } func NewDispatcherSCDRsV1(dps *dispatchers.DispatcherService) *DispatcherSCDRsV1 { diff --git a/apier/v1/dispatcher_it_test.go b/apier/v1/dispatcher_it_test.go index c7a99ed7a..0774cc417 100644 --- a/apier/v1/dispatcher_it_test.go +++ b/apier/v1/dispatcher_it_test.go @@ -125,7 +125,7 @@ func testDispatcherSRPCConn(t *testing.T) { func testDispatcherSSetDispatcherProfile(t *testing.T) { var reply string - if err := dispatcherRPC.Call(utils.ApierV1GetDispatcherProfile, + if err := dispatcherRPC.Call(utils.APIerSv1GetDispatcherProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "Dsp1"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) @@ -141,7 +141,7 @@ func testDispatcherSSetDispatcherProfile(t *testing.T) { }, } - if err := dispatcherRPC.Call(utils.ApierV1SetDispatcherProfile, + if err := dispatcherRPC.Call(utils.APIerSv1SetDispatcherProfile, dispatcherProfile, &reply); err != nil { t.Error(err) @@ -150,7 +150,7 @@ func testDispatcherSSetDispatcherProfile(t *testing.T) { } var dsp *engine.DispatcherProfile - if err := dispatcherRPC.Call(utils.ApierV1GetDispatcherProfile, + if err := dispatcherRPC.Call(utils.APIerSv1GetDispatcherProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "Dsp1"}, &dsp); err != nil { t.Error(err) @@ -161,12 +161,12 @@ func testDispatcherSSetDispatcherProfile(t *testing.T) { func testDispatcherSGetDispatcherProfileIDs(t *testing.T) { var result []string - if err := dispatcherRPC.Call(utils.ApierV1GetDispatcherProfileIDs, + if err := dispatcherRPC.Call(utils.APIerSv1GetDispatcherProfileIDs, utils.TenantArgWithPaginator{}, &result); err == nil { t.Errorf("Expected: %s , received: %v", utils.NewErrMandatoryIeMissing(utils.Tenant).Error(), err) } expected := []string{"Dsp1"} - if err := dispatcherRPC.Call(utils.ApierV1GetDispatcherProfileIDs, + if err := dispatcherRPC.Call(utils.APIerSv1GetDispatcherProfileIDs, utils.TenantArgWithPaginator{TenantArg: utils.TenantArg{Tenant: dispatcherProfile.Tenant}}, &result); err != nil { t.Error(err) } else if len(result) != len(expected) { @@ -186,7 +186,7 @@ func testDispatcherSUpdateDispatcherProfile(t *testing.T) { &engine.DispatcherHostProfile{ID: "HOST1", Weight: 20.0}, &engine.DispatcherHostProfile{ID: "HOST2", Weight: 10.0}, } - if err := dispatcherRPC.Call(utils.ApierV1SetDispatcherProfile, + if err := dispatcherRPC.Call(utils.APIerSv1SetDispatcherProfile, dispatcherProfile, &result); err != nil { t.Error(err) } else if result != utils.OK { @@ -194,7 +194,7 @@ func testDispatcherSUpdateDispatcherProfile(t *testing.T) { } var dsp *engine.DispatcherProfile - if err := dispatcherRPC.Call(utils.ApierV1GetDispatcherProfile, + if err := dispatcherRPC.Call(utils.APIerSv1GetDispatcherProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "Dsp1"}, &dsp); err != nil { t.Error(err) @@ -217,7 +217,7 @@ func testDispatcherSGetDispatcherProfileCache(t *testing.T) { func testDispatcherSRemDispatcherProfile(t *testing.T) { var result string - if err := dispatcherRPC.Call(utils.ApierV1RemoveDispatcherProfile, + if err := dispatcherRPC.Call(utils.APIerSv1RemoveDispatcherProfile, &utils.TenantIDWithCache{Tenant: "cgrates.org", ID: "Dsp1"}, &result); err != nil { t.Error(err) @@ -226,13 +226,13 @@ func testDispatcherSRemDispatcherProfile(t *testing.T) { } var dsp *engine.DispatcherProfile - if err := dispatcherRPC.Call(utils.ApierV1GetDispatcherProfile, + if err := dispatcherRPC.Call(utils.APIerSv1GetDispatcherProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "Dsp1"}, &dsp); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) } - if err := dispatcherRPC.Call(utils.ApierV1RemoveDispatcherProfile, + if err := dispatcherRPC.Call(utils.APIerSv1RemoveDispatcherProfile, &utils.TenantIDWithCache{Tenant: "cgrates.org", ID: "Dsp1"}, &result); err.Error() != utils.ErrNotFound.Error() { t.Errorf("Expected error: %v recived: %v", utils.ErrNotFound, err) @@ -241,7 +241,7 @@ func testDispatcherSRemDispatcherProfile(t *testing.T) { func testDispatcherSSetDispatcherHost(t *testing.T) { var reply string - if err := dispatcherRPC.Call(utils.ApierV1GetDispatcherHost, + if err := dispatcherRPC.Call(utils.APIerSv1GetDispatcherHost, &utils.TenantID{Tenant: "cgrates.org", ID: "Dsp1"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) @@ -264,7 +264,7 @@ func testDispatcherSSetDispatcherHost(t *testing.T) { }, } - if err := dispatcherRPC.Call(utils.ApierV1SetDispatcherHost, + if err := dispatcherRPC.Call(utils.APIerSv1SetDispatcherHost, dispatcherHost, &reply); err != nil { t.Error(err) @@ -273,7 +273,7 @@ func testDispatcherSSetDispatcherHost(t *testing.T) { } var dsp *engine.DispatcherHost - if err := dispatcherRPC.Call(utils.ApierV1GetDispatcherHost, + if err := dispatcherRPC.Call(utils.APIerSv1GetDispatcherHost, &utils.TenantID{Tenant: "cgrates.org", ID: "DspHst1"}, &dsp); err != nil { t.Error(err) @@ -284,12 +284,12 @@ func testDispatcherSSetDispatcherHost(t *testing.T) { func testDispatcherSGetDispatcherHostIDs(t *testing.T) { var result []string - if err := dispatcherRPC.Call(utils.ApierV1GetDispatcherHostIDs, + if err := dispatcherRPC.Call(utils.APIerSv1GetDispatcherHostIDs, utils.TenantArgWithPaginator{}, &result); err == nil { t.Errorf("Expected: %s , received: %v", utils.NewErrMandatoryIeMissing(utils.Tenant), err) } expected := []string{"DspHst1"} - if err := dispatcherRPC.Call(utils.ApierV1GetDispatcherHostIDs, + if err := dispatcherRPC.Call(utils.APIerSv1GetDispatcherHostIDs, utils.TenantArgWithPaginator{TenantArg: utils.TenantArg{Tenant: dispatcherHost.Tenant}}, &result); err != nil { t.Error(err) } else if len(result) != len(expected) { @@ -304,7 +304,7 @@ func testDispatcherSUpdateDispatcherHost(t *testing.T) { Transport: utils.MetaGOB, TLS: false, }) - if err := dispatcherRPC.Call(utils.ApierV1SetDispatcherHost, + if err := dispatcherRPC.Call(utils.APIerSv1SetDispatcherHost, dispatcherHost, &result); err != nil { t.Error(err) } else if result != utils.OK { @@ -312,7 +312,7 @@ func testDispatcherSUpdateDispatcherHost(t *testing.T) { } var dsp *engine.DispatcherHost - if err := dispatcherRPC.Call(utils.ApierV1GetDispatcherHost, + if err := dispatcherRPC.Call(utils.APIerSv1GetDispatcherHost, &utils.TenantID{Tenant: "cgrates.org", ID: "DspHst1"}, &dsp); err != nil { t.Error(err) @@ -332,7 +332,7 @@ func testDispatcherSGetDispatcherHostCache(t *testing.T) { func testDispatcherSRemDispatcherHost(t *testing.T) { var result string - if err := dispatcherRPC.Call(utils.ApierV1RemoveDispatcherHost, + if err := dispatcherRPC.Call(utils.APIerSv1RemoveDispatcherHost, &utils.TenantIDWithCache{Tenant: "cgrates.org", ID: "DspHst1"}, &result); err != nil { t.Error(err) @@ -341,13 +341,13 @@ func testDispatcherSRemDispatcherHost(t *testing.T) { } var dsp *engine.DispatcherHost - if err := dispatcherRPC.Call(utils.ApierV1GetDispatcherHost, + if err := dispatcherRPC.Call(utils.APIerSv1GetDispatcherHost, &utils.TenantID{Tenant: "cgrates.org", ID: "DspHst1"}, &dsp); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) } - if err := dispatcherRPC.Call(utils.ApierV1RemoveDispatcherHost, + if err := dispatcherRPC.Call(utils.APIerSv1RemoveDispatcherHost, &utils.TenantIDWithCache{Tenant: "cgrates.org", ID: "DspHst1"}, &result); err.Error() != utils.ErrNotFound.Error() { t.Errorf("Expected error: %v recived: %v", utils.ErrNotFound, err) diff --git a/apier/v1/dm_remote_it_test.go b/apier/v1/dm_remote_it_test.go index b228f9edb..f3837e602 100644 --- a/apier/v1/dm_remote_it_test.go +++ b/apier/v1/dm_remote_it_test.go @@ -178,7 +178,7 @@ func testInternalRemoteITRPCConn(t *testing.T) { func testInternalRemoteLoadDataInEngineTwo(t *testing.T) { var reply string attrs := &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "tutorial")} - if err := engineTwoRPC.Call(utils.ApierV1LoadTariffPlanFromFolder, attrs, &reply); err != nil { + if err := engineTwoRPC.Call(utils.APIerSv1LoadTariffPlanFromFolder, attrs, &reply); err != nil { t.Error(err) } time.Sleep(500 * time.Millisecond) @@ -203,7 +203,7 @@ func testInternalRemoteITGetAccount(t *testing.T) { Account: "1001", } // make sure account exist in engine2 - if err := engineTwoRPC.Call(utils.ApierV2GetAccount, attrs, &acnt); err != nil { + if err := engineTwoRPC.Call(utils.APIerSv2GetAccount, attrs, &acnt); err != nil { t.Error(err) } else if acnt.ID != expAcc.ID { t.Errorf("expecting: %+v, received: %+v", expAcc.ID, acnt.ID) @@ -211,7 +211,7 @@ func testInternalRemoteITGetAccount(t *testing.T) { t.Errorf("unexpected number of balances received: %+v", utils.ToJSON(acnt)) } // check the account in internal - if err := internalRPC.Call(utils.ApierV2GetAccount, attrs, &acnt); err != nil { + if err := internalRPC.Call(utils.APIerSv2GetAccount, attrs, &acnt); err != nil { t.Error(err) } else if acnt.ID != expAcc.ID { t.Errorf("expecting: %+v, received: %+v", expAcc.ID, acnt.ID) @@ -223,7 +223,7 @@ func testInternalRemoteITGetAccount(t *testing.T) { Tenant: "cgrates.org", Account: "nonexistAccount", } - if err := internalRPC.Call(utils.ApierV2GetAccount, attrs, &acnt); err == nil || + if err := internalRPC.Call(utils.APIerSv2GetAccount, attrs, &acnt); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Errorf("expecting: %+v, received: %+v", utils.ErrNotFound, err) } @@ -250,7 +250,7 @@ func testInternalRemoteITGetAttribute(t *testing.T) { } alsPrf.Compile() var reply *engine.AttributeProfile - if err := internalRPC.Call(utils.ApierV1GetAttributeProfile, + if err := internalRPC.Call(utils.APIerSv1GetAttributeProfile, utils.TenantIDWithArgDispatcher{TenantID: &utils.TenantID{Tenant: "cgrates.org", ID: "ATTR_1001_SIMPLEAUTH"}}, &reply); err != nil { t.Fatal(err) } @@ -292,7 +292,7 @@ func testInternalRemoteITGetThresholdProfile(t *testing.T) { Async: true, }, } - if err := internalRPC.Call(utils.ApierV1GetThresholdProfile, + if err := internalRPC.Call(utils.APIerSv1GetThresholdProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "THD_ACNT_1001"}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(tPrfl.ThresholdProfile, reply) { @@ -333,7 +333,7 @@ func testInternalRemoteITGetResourceProfile(t *testing.T) { }, } var reply *engine.ResourceProfile - if err := internalRPC.Call(utils.ApierV1GetResourceProfile, + if err := internalRPC.Call(utils.APIerSv1GetResourceProfile, &utils.TenantID{Tenant: "cgrates.org", ID: rlsPrf.ID}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(reply, rlsPrf.ResourceProfile) { @@ -390,7 +390,7 @@ func testInternalRemoteITGetStatQueueProfile(t *testing.T) { ThresholdIDs: []string{utils.META_NONE}, } var reply *engine.StatQueueProfile - if err := internalRPC.Call(utils.ApierV1GetStatQueueProfile, + if err := internalRPC.Call(utils.APIerSv1GetStatQueueProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "Stats2"}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(expStq, reply) && !reflect.DeepEqual(reply, expStq2) { @@ -449,7 +449,7 @@ func testInternalRemoteITGetSupplier(t *testing.T) { splPrf2.SortingParameters = nil } - if err := internalRPC.Call(utils.ApierV1GetSupplierProfile, + if err := internalRPC.Call(utils.APIerSv1GetSupplierProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "SPL_ACNT_1001"}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(splPrf, reply) && !reflect.DeepEqual(splPrf2, reply) { @@ -473,7 +473,7 @@ func testInternalRemoteITGetFilter(t *testing.T) { }, } var reply *engine.Filter - if err := internalRPC.Call(utils.ApierV1GetFilter, + if err := internalRPC.Call(utils.APIerSv1GetFilter, &utils.TenantID{Tenant: "cgrates.org", ID: "FLTR_ACNT_1001"}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(expFltr, reply) { @@ -483,7 +483,7 @@ func testInternalRemoteITGetFilter(t *testing.T) { func testInternalRemoteITGetRatingPlan(t *testing.T) { var reply engine.RatingPlan - if err := internalRPC.Call(utils.ApierV1GetRatingPlan, "RP_1001", &reply); err != nil { + if err := internalRPC.Call(utils.APIerSv1GetRatingPlan, "RP_1001", &reply); err != nil { t.Error(err.Error()) } else if reply.Id != "RP_1001" { t.Errorf("Expected: %+v, received: %+v", "RP_1001", reply.Id) @@ -507,7 +507,7 @@ func testInternalRemoteITGetRatingProfile(t *testing.T) { }, }, } - if err := internalRPC.Call(utils.ApierV1GetRatingProfile, attrGetRatingPlan, &rpl); err != nil { + if err := internalRPC.Call(utils.APIerSv1GetRatingProfile, attrGetRatingPlan, &rpl); err != nil { t.Error(err) } else if !reflect.DeepEqual(expected, rpl) { t.Errorf("Expected: %+v, received: %+v", utils.ToJSON(expected), utils.ToJSON(rpl)) @@ -521,8 +521,8 @@ func testInternalRemoteITGetAction(t *testing.T) { BalanceDisabled: "false", ExpiryTime: utils.UNLIMITED, Weight: 10.0}} var reply []*utils.TPAction - if err := internalRPC.Call(utils.ApierV1GetActions, "ACT_TOPUP_RST_10", &reply); err != nil { - t.Error("Got error on ApierV1.GetActions: ", err.Error()) + if err := internalRPC.Call(utils.APIerSv1GetActions, "ACT_TOPUP_RST_10", &reply); err != nil { + t.Error("Got error on APIerSv1.GetActions: ", err.Error()) } else if !reflect.DeepEqual(expectActs, reply) { t.Errorf("Expected: %v,\n received: %v", utils.ToJSON(expectActs), utils.ToJSON(reply)) } @@ -535,7 +535,7 @@ func testInternalRemoteITGetActionPlan(t *testing.T) { "cgrates.org:1002": true, "cgrates.org:1003": true, } - if err := internalRPC.Call(utils.ApierV1GetActionPlan, + if err := internalRPC.Call(utils.APIerSv1GetActionPlan, AttrGetActionPlan{ID: "AP_PACKAGE_10"}, &aps); err != nil { t.Error(err) } else if len(aps) != 1 { @@ -545,7 +545,7 @@ func testInternalRemoteITGetActionPlan(t *testing.T) { } else if !reflect.DeepEqual(aps[0].AccountIDs, accIDsStrMp) { t.Errorf("Expected: %v,\n received: %v", accIDsStrMp, aps[0].AccountIDs) } - if err := internalRPC.Call(utils.ApierV1GetActionPlan, + if err := internalRPC.Call(utils.APIerSv1GetActionPlan, AttrGetActionPlan{ID: utils.EmptyString}, &aps); err != nil { t.Error(err) } else if len(aps) != 1 { @@ -559,7 +559,7 @@ func testInternalRemoteITGetActionPlan(t *testing.T) { func testInternalRemoteITGetAccountActionPlan(t *testing.T) { var aap []*AccountActionTiming - if err := internalRPC.Call(utils.ApierV1GetAccountActionPlan, + if err := internalRPC.Call(utils.APIerSv1GetAccountActionPlan, utils.TenantAccount{ Tenant: "cgrates.org", Account: "1001", @@ -580,7 +580,7 @@ func testInternalRemoteITGetDestination(t *testing.T) { Id: "DST_1002", Prefixes: []string{"1002"}, } - if err := internalRPC.Call(utils.ApierV1GetDestination, "DST_1002", &dst); err != nil { + if err := internalRPC.Call(utils.APIerSv1GetDestination, "DST_1002", &dst); err != nil { t.Error(err) } else if !reflect.DeepEqual(eDst, dst) { t.Errorf("Expected: %v,\n received: %v", eDst, dst) @@ -590,7 +590,7 @@ func testInternalRemoteITGetDestination(t *testing.T) { func testInternalRemoteITGetReverseDestination(t *testing.T) { var ids []string eIDs := []string{"DST_1002"} - if err := internalRPC.Call(utils.ApierV1GetReverseDestination, "1002", &ids); err != nil { + if err := internalRPC.Call(utils.APIerSv1GetReverseDestination, "1002", &ids); err != nil { t.Error(err) } else if !reflect.DeepEqual(eIDs, ids) { t.Errorf("Expected: %v,\n received: %v", eIDs, ids) @@ -600,7 +600,7 @@ func testInternalRemoteITGetReverseDestination(t *testing.T) { func testInternalReplicationSetThreshold(t *testing.T) { var reply *engine.ThresholdProfile var result string - if err := internalRPC.Call(utils.ApierV1GetThresholdProfile, + if err := internalRPC.Call(utils.APIerSv1GetThresholdProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "THD_Replication"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) @@ -609,7 +609,7 @@ func testInternalReplicationSetThreshold(t *testing.T) { var indexes []string expectedIDX := []string{"*string:~*req.Account:1001:THD_ACNT_1001", "*string:~*req.Account:1002:THD_ACNT_1002"} - if err := engineTwoRPC.Call(utils.ApierV1GetFilterIndexes, &AttrGetFilterIndexes{ + if err := engineTwoRPC.Call(utils.APIerSv1GetFilterIndexes, &AttrGetFilterIndexes{ ItemType: utils.MetaThresholds, Tenant: "cgrates.org", FilterType: utils.MetaString}, &indexes); err != nil { t.Error(err) @@ -620,7 +620,7 @@ func testInternalReplicationSetThreshold(t *testing.T) { expectedIDX, utils.ToJSON(indexes)) } //verify indexes on internal before adding new threshold profile - if err := internalRPC.Call(utils.ApierV1GetFilterIndexes, &AttrGetFilterIndexes{ + if err := internalRPC.Call(utils.APIerSv1GetFilterIndexes, &AttrGetFilterIndexes{ ItemType: utils.MetaThresholds, Tenant: "cgrates.org", FilterType: utils.MetaString}, &indexes); err != nil { t.Error(err) @@ -647,13 +647,13 @@ func testInternalReplicationSetThreshold(t *testing.T) { Async: true, }, } - if err := internalRPC.Call(utils.ApierV1SetThresholdProfile, tPrfl, &result); err != nil { + if err := internalRPC.Call(utils.APIerSv1SetThresholdProfile, tPrfl, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } time.Sleep(50 * time.Millisecond) - if err := internalRPC.Call(utils.ApierV1GetThresholdProfile, + if err := internalRPC.Call(utils.APIerSv1GetThresholdProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "THD_Replication"}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(tPrfl.ThresholdProfile, reply) { @@ -667,7 +667,7 @@ func testInternalReplicationSetThreshold(t *testing.T) { } // verify index on internal sort.Strings(expectedIDX) - if err := internalRPC.Call(utils.ApierV1GetFilterIndexes, &AttrGetFilterIndexes{ + if err := internalRPC.Call(utils.APIerSv1GetFilterIndexes, &AttrGetFilterIndexes{ ItemType: utils.MetaThresholds, Tenant: "cgrates.org", FilterType: utils.MetaString}, &indexes); err != nil { t.Error(err) @@ -678,7 +678,7 @@ func testInternalReplicationSetThreshold(t *testing.T) { expectedIDX, utils.ToJSON(indexes)) } // verify data on engine1 - if err := engineOneRPC.Call(utils.ApierV1GetThresholdProfile, + if err := engineOneRPC.Call(utils.APIerSv1GetThresholdProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "THD_Replication"}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(tPrfl.ThresholdProfile, reply) { @@ -690,7 +690,7 @@ func testInternalReplicationSetThreshold(t *testing.T) { "*string:~*req.CustomField:CustomValue:THD_Replication", } // verify indexes on engine1 (should be the same as internal) - if err := engineOneRPC.Call(utils.ApierV1GetFilterIndexes, &AttrGetFilterIndexes{ + if err := engineOneRPC.Call(utils.APIerSv1GetFilterIndexes, &AttrGetFilterIndexes{ ItemType: utils.MetaThresholds, Tenant: "cgrates.org", FilterType: utils.MetaString}, &indexes); err != nil { t.Error(err) @@ -701,7 +701,7 @@ func testInternalReplicationSetThreshold(t *testing.T) { expectedIDX2, utils.ToJSON(indexes)) } // verify data on engine2 - if err := engineTwoRPC.Call(utils.ApierV1GetThresholdProfile, + if err := engineTwoRPC.Call(utils.APIerSv1GetThresholdProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "THD_Replication"}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(tPrfl.ThresholdProfile, reply) { @@ -713,7 +713,7 @@ func testInternalReplicationSetThreshold(t *testing.T) { "*string:~*req.CustomField:CustomValue:THD_Replication", } // check if indexes was created correctly on engine2 - if err := engineTwoRPC.Call(utils.ApierV1GetFilterIndexes, &AttrGetFilterIndexes{ + if err := engineTwoRPC.Call(utils.APIerSv1GetFilterIndexes, &AttrGetFilterIndexes{ ItemType: utils.MetaThresholds, Tenant: "cgrates.org", FilterType: utils.MetaString}, &indexes); err != nil { t.Error(err) @@ -784,7 +784,7 @@ func testInternalAccountBalanceOperations(t *testing.T) { utils.ID: "testAccSetBalance", }, } - if err := internalRPC.Call(utils.ApierV1SetBalance, attrs, &reply); err != nil { + if err := internalRPC.Call(utils.APIerSv1SetBalance, attrs, &reply); err != nil { t.Error(err) } time.Sleep(100 * time.Millisecond) @@ -794,7 +794,7 @@ func testInternalAccountBalanceOperations(t *testing.T) { Account: "testAccount1", } // verify account on engineOne - if err := engineOneRPC.Call(utils.ApierV2GetAccount, attrAcc, &acnt); err != nil { + if err := engineOneRPC.Call(utils.APIerSv2GetAccount, attrAcc, &acnt); err != nil { t.Error(err) } else if len(acnt.BalanceMap[utils.MONETARY]) != 1 { t.Errorf("Expecting: %+v, received: %+v", @@ -805,7 +805,7 @@ func testInternalAccountBalanceOperations(t *testing.T) { } // verify account on engineTwo - if err := engineTwoRPC.Call(utils.ApierV2GetAccount, attrAcc, &acnt); err != nil { + if err := engineTwoRPC.Call(utils.APIerSv2GetAccount, attrAcc, &acnt); err != nil { t.Error(err) } else if len(acnt.BalanceMap[utils.MONETARY]) != 1 { t.Errorf("Expecting: %+v, received: %+v", @@ -816,7 +816,7 @@ func testInternalAccountBalanceOperations(t *testing.T) { } // debit balance on internal and the account should be replicated to other engines - if err := internalRPC.Call(utils.ApierV1DebitBalance, &AttrAddBalance{ + if err := internalRPC.Call(utils.APIerSv1DebitBalance, &AttrAddBalance{ Tenant: "cgrates.org", Account: "testAccount1", BalanceType: utils.MONETARY, @@ -828,7 +828,7 @@ func testInternalAccountBalanceOperations(t *testing.T) { } time.Sleep(50 * time.Millisecond) // verify debited account on engineOne - if err := engineOneRPC.Call(utils.ApierV2GetAccount, attrAcc, &acnt); err != nil { + if err := engineOneRPC.Call(utils.APIerSv2GetAccount, attrAcc, &acnt); err != nil { t.Error(err) } else if len(acnt.BalanceMap[utils.MONETARY]) != 1 { t.Errorf("Expecting: %+v, received: %+v", @@ -839,7 +839,7 @@ func testInternalAccountBalanceOperations(t *testing.T) { } // verify debited account on engineTwo - if err := engineTwoRPC.Call(utils.ApierV2GetAccount, attrAcc, &acnt); err != nil { + if err := engineTwoRPC.Call(utils.APIerSv2GetAccount, attrAcc, &acnt); err != nil { t.Error(err) } else if len(acnt.BalanceMap[utils.MONETARY]) != 1 { t.Errorf("Expecting: %+v, received: %+v", @@ -856,12 +856,12 @@ func testInternalAccountBalanceOperations(t *testing.T) { Value: 12.765, } // add balance for the account on internal and this should be replicated to other engines - if err := internalRPC.Call(utils.ApierV1AddBalance, addBal, &reply); err != nil { + if err := internalRPC.Call(utils.APIerSv1AddBalance, addBal, &reply); err != nil { t.Error(err) } time.Sleep(50 * time.Millisecond) // verify account on engineOne - if err := engineOneRPC.Call(utils.ApierV2GetAccount, attrAcc, &acnt); err != nil { + if err := engineOneRPC.Call(utils.APIerSv2GetAccount, attrAcc, &acnt); err != nil { t.Error(err) } else if len(acnt.BalanceMap[utils.MONETARY]) != 1 { t.Errorf("Expecting: %+v, received: %+v", @@ -872,7 +872,7 @@ func testInternalAccountBalanceOperations(t *testing.T) { } // verify account on engineTwo - if err := engineTwoRPC.Call(utils.ApierV2GetAccount, attrAcc, &acnt); err != nil { + if err := engineTwoRPC.Call(utils.APIerSv2GetAccount, attrAcc, &acnt); err != nil { t.Error(err) } else if len(acnt.BalanceMap[utils.MONETARY]) != 1 { t.Errorf("Expecting: %+v, received: %+v", @@ -887,7 +887,7 @@ func testInternalAccountBalanceOperations(t *testing.T) { func testInternalSetAccount(t *testing.T) { var reply string - if err := internalRPC.Call(utils.ApierV1SetAccount, + if err := internalRPC.Call(utils.APIerSv1SetAccount, utils.AttrSetAccount{ Tenant: "cgrates.org", Account: "testSetAccount", @@ -905,7 +905,7 @@ func testInternalSetAccount(t *testing.T) { Account: "testSetAccount", } // verify account on engineOne - if err := engineOneRPC.Call(utils.ApierV2GetAccount, attrAcc, &acnt); err != nil { + if err := engineOneRPC.Call(utils.APIerSv2GetAccount, attrAcc, &acnt); err != nil { t.Error(err) } else if len(acnt.BalanceMap[utils.MONETARY]) != 1 { t.Errorf("Expecting: %+v, received: %+v", @@ -916,7 +916,7 @@ func testInternalSetAccount(t *testing.T) { } // verify account on engineTwo - if err := engineTwoRPC.Call(utils.ApierV2GetAccount, attrAcc, &acnt); err != nil { + if err := engineTwoRPC.Call(utils.APIerSv2GetAccount, attrAcc, &acnt); err != nil { t.Error(err) } else if len(acnt.BalanceMap[utils.MONETARY]) != 1 { t.Errorf("Expecting: %+v, received: %+v", @@ -954,20 +954,20 @@ func testInternalReplicateStats(t *testing.T) { }, } - if err := internalRPC.Call(utils.ApierV1SetStatQueueProfile, statConfig, &reply); err != nil { + if err := internalRPC.Call(utils.APIerSv1SetStatQueueProfile, statConfig, &reply); err != nil { t.Error(err) } else if reply != utils.OK { t.Error("Unexpected reply returned", reply) } var rcv *engine.StatQueueProfile - if err := engineOneRPC.Call(utils.ApierV1GetStatQueueProfile, + if err := engineOneRPC.Call(utils.APIerSv1GetStatQueueProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "StatsToReplicate"}, &rcv); err != nil { t.Error(err) } else if !reflect.DeepEqual(statConfig.StatQueueProfile, rcv) { t.Errorf("Expecting: %+v, received: %+v", utils.ToJSON(statConfig.StatQueueProfile), utils.ToJSON(rcv)) } - if err := engineTwoRPC.Call(utils.ApierV1GetStatQueueProfile, + if err := engineTwoRPC.Call(utils.APIerSv1GetStatQueueProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "StatsToReplicate"}, &rcv); err != nil { t.Error(err) } else if !reflect.DeepEqual(statConfig.StatQueueProfile, rcv) { diff --git a/apier/v1/filter_indexes.go b/apier/v1/filter_indexes.go index 06083d158..475631c44 100644 --- a/apier/v1/filter_indexes.go +++ b/apier/v1/filter_indexes.go @@ -42,7 +42,7 @@ type AttrRemFilterIndexes struct { ItemType string } -func (api *ApierV1) RemoveFilterIndexes(arg AttrRemFilterIndexes, reply *string) (err error) { +func (api *APIerSv1) RemoveFilterIndexes(arg AttrRemFilterIndexes, reply *string) (err error) { if missing := utils.MissingStructFields(&arg, []string{"Tenant", "ItemType"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } @@ -78,7 +78,7 @@ func (api *ApierV1) RemoveFilterIndexes(arg AttrRemFilterIndexes, reply *string) return nil } -func (api *ApierV1) GetFilterIndexes(arg AttrGetFilterIndexes, reply *[]string) (err error) { +func (api *APIerSv1) GetFilterIndexes(arg AttrGetFilterIndexes, reply *[]string) (err error) { var indexes map[string]utils.StringMap var indexedSlice []string indexesFilter := make(map[string]utils.StringMap) @@ -201,7 +201,7 @@ func (api *ApierV1) GetFilterIndexes(arg AttrGetFilterIndexes, reply *[]string) } // ComputeFilterIndexes selects which index filters to recompute -func (api *ApierV1) ComputeFilterIndexes(args utils.ArgsComputeFilterIndexes, reply *string) (err error) { +func (api *APIerSv1) ComputeFilterIndexes(args utils.ArgsComputeFilterIndexes, reply *string) (err error) { transactionID := utils.GenUUID() //ThresholdProfile Indexes var thdsIndexers *engine.FilterIndexer @@ -308,7 +308,7 @@ func (api *ApierV1) ComputeFilterIndexes(args utils.ArgsComputeFilterIndexes, re } // ComputeFilterIndexIDs computes specific filter indexes -func (api *ApierV1) ComputeFilterIndexIDs(args utils.ArgsComputeFilterIndexIDs, reply *string) (err error) { +func (api *APIerSv1) ComputeFilterIndexIDs(args utils.ArgsComputeFilterIndexIDs, reply *string) (err error) { transactionID := utils.GenUUID() //ThresholdProfile Indexes thdsIndexers, err := api.computeThresholdIndexes(args.Tenant, &args.ThresholdIDs, transactionID) @@ -456,7 +456,7 @@ func (api *ApierV1) ComputeFilterIndexIDs(args utils.ArgsComputeFilterIndexIDs, return nil } -func (api *ApierV1) computeThresholdIndexes(tenant string, thIDs *[]string, +func (api *APIerSv1) computeThresholdIndexes(tenant string, thIDs *[]string, transactionID string) (filterIndexer *engine.FilterIndexer, err error) { var thresholdIDs []string thdsIndexers := engine.NewFilterIndexer(api.DataManager, utils.ThresholdProfilePrefix, tenant) @@ -522,7 +522,7 @@ func (api *ApierV1) computeThresholdIndexes(tenant string, thIDs *[]string, return thdsIndexers, nil } -func (api *ApierV1) computeAttributeIndexes(tenant, context string, attrIDs *[]string, +func (api *APIerSv1) computeAttributeIndexes(tenant, context string, attrIDs *[]string, transactionID string) (filterIndexer *engine.FilterIndexer, err error) { var attributeIDs []string attrIndexers := engine.NewFilterIndexer(api.DataManager, utils.AttributeProfilePrefix, @@ -592,7 +592,7 @@ func (api *ApierV1) computeAttributeIndexes(tenant, context string, attrIDs *[]s return attrIndexers, nil } -func (api *ApierV1) computeResourceIndexes(tenant string, rsIDs *[]string, +func (api *APIerSv1) computeResourceIndexes(tenant string, rsIDs *[]string, transactionID string) (filterIndexer *engine.FilterIndexer, err error) { var resourceIDs []string rpIndexers := engine.NewFilterIndexer(api.DataManager, utils.ResourceProfilesPrefix, tenant) @@ -658,7 +658,7 @@ func (api *ApierV1) computeResourceIndexes(tenant string, rsIDs *[]string, return rpIndexers, nil } -func (api *ApierV1) computeStatIndexes(tenant string, stIDs *[]string, +func (api *APIerSv1) computeStatIndexes(tenant string, stIDs *[]string, transactionID string) (filterIndexer *engine.FilterIndexer, err error) { var statIDs []string sqpIndexers := engine.NewFilterIndexer(api.DataManager, utils.StatQueueProfilePrefix, tenant) @@ -724,7 +724,7 @@ func (api *ApierV1) computeStatIndexes(tenant string, stIDs *[]string, return sqpIndexers, nil } -func (api *ApierV1) computeSupplierIndexes(tenant string, sppIDs *[]string, +func (api *APIerSv1) computeSupplierIndexes(tenant string, sppIDs *[]string, transactionID string) (filterIndexer *engine.FilterIndexer, err error) { var supplierIDs []string sppIndexers := engine.NewFilterIndexer(api.DataManager, utils.SupplierProfilePrefix, tenant) @@ -790,7 +790,7 @@ func (api *ApierV1) computeSupplierIndexes(tenant string, sppIDs *[]string, return sppIndexers, nil } -func (api *ApierV1) computeChargerIndexes(tenant string, cppIDs *[]string, +func (api *APIerSv1) computeChargerIndexes(tenant string, cppIDs *[]string, transactionID string) (filterIndexer *engine.FilterIndexer, err error) { var chargerIDs []string cppIndexes := engine.NewFilterIndexer(api.DataManager, utils.ChargerProfilePrefix, tenant) @@ -856,7 +856,7 @@ func (api *ApierV1) computeChargerIndexes(tenant string, cppIDs *[]string, return cppIndexes, nil } -func (api *ApierV1) computeDispatcherIndexes(tenant, context string, dspIDs *[]string, +func (api *APIerSv1) computeDispatcherIndexes(tenant, context string, dspIDs *[]string, transactionID string) (filterIndexer *engine.FilterIndexer, err error) { var dispatcherIDs []string dspIndexes := engine.NewFilterIndexer(api.DataManager, utils.DispatcherProfilePrefix, diff --git a/apier/v1/filter_indexes_it_test.go b/apier/v1/filter_indexes_it_test.go index 7898b4c68..106cf45d9 100644 --- a/apier/v1/filter_indexes_it_test.go +++ b/apier/v1/filter_indexes_it_test.go @@ -169,12 +169,12 @@ func testV1FIdxSetThresholdProfile(t *testing.T) { }, } var result string - if err := tFIdxRpc.Call(utils.ApierV1SetFilter, filter, &result); err != nil { + if err := tFIdxRpc.Call(utils.APIerSv1SetFilter, filter, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } - if err := tFIdxRpc.Call(utils.ApierV1GetThresholdProfile, + if err := tFIdxRpc.Call(utils.APIerSv1GetThresholdProfile, &utils.TenantID{Tenant: tenant, ID: "TEST_PROFILE1"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) @@ -196,25 +196,25 @@ func testV1FIdxSetThresholdProfile(t *testing.T) { Async: true, }, } - if err := tFIdxRpc.Call(utils.ApierV1SetThresholdProfile, tPrfl, &result); err != nil { + if err := tFIdxRpc.Call(utils.APIerSv1SetThresholdProfile, tPrfl, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } - if err := tFIdxRpc.Call(utils.ApierV1GetThresholdProfile, + if err := tFIdxRpc.Call(utils.APIerSv1GetThresholdProfile, &utils.TenantID{Tenant: tenant, ID: "TEST_PROFILE1"}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(tPrfl.ThresholdProfile, reply) { t.Errorf("Expecting: %+v, received: %+v", tPrfl.ThresholdProfile, reply) } - if err := tFIdxRpc.Call(utils.ApierV1RemoveFilterIndexes, &AttrRemFilterIndexes{ + if err := tFIdxRpc.Call(utils.APIerSv1RemoveFilterIndexes, &AttrRemFilterIndexes{ ItemType: utils.MetaThresholds, Tenant: tenant}, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } var indexes []string - if err := tFIdxRpc.Call(utils.ApierV1GetFilterIndexes, &AttrGetFilterIndexes{ + if err := tFIdxRpc.Call(utils.APIerSv1GetFilterIndexes, &AttrGetFilterIndexes{ ItemType: utils.MetaThresholds, Tenant: tenant, FilterType: utils.MetaString}, &indexes); err.Error() != utils.ErrNotFound.Error() { t.Error(err) @@ -223,7 +223,7 @@ func testV1FIdxSetThresholdProfile(t *testing.T) { func testV1FIdxComputeThresholdsIndexes(t *testing.T) { var reply2 string - if err := tFIdxRpc.Call(utils.ApierV1ComputeFilterIndexes, + if err := tFIdxRpc.Call(utils.APIerSv1ComputeFilterIndexes, utils.ArgsComputeFilterIndexes{ Tenant: tenant, ThresholdS: true, @@ -235,7 +235,7 @@ func testV1FIdxComputeThresholdsIndexes(t *testing.T) { } expectedIDX := []string{"*string:~*req.Account:1001:TEST_PROFILE1"} var indexes []string - if err := tFIdxRpc.Call(utils.ApierV1GetFilterIndexes, &AttrGetFilterIndexes{ + if err := tFIdxRpc.Call(utils.APIerSv1GetFilterIndexes, &AttrGetFilterIndexes{ ItemType: utils.MetaThresholds, Tenant: tenant, FilterType: utils.MetaString}, &indexes); err != nil { t.Error(err) @@ -264,12 +264,12 @@ func testV1FIdxSetSecondThresholdProfile(t *testing.T) { } var result string - if err := tFIdxRpc.Call(utils.ApierV1SetFilter, filter, &result); err != nil { + if err := tFIdxRpc.Call(utils.APIerSv1SetFilter, filter, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } - if err := tFIdxRpc.Call(utils.ApierV1GetThresholdProfile, + if err := tFIdxRpc.Call(utils.APIerSv1GetThresholdProfile, &utils.TenantID{Tenant: tenant, ID: "TEST_PROFILE2"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) @@ -291,25 +291,25 @@ func testV1FIdxSetSecondThresholdProfile(t *testing.T) { Async: true, }, } - if err := tFIdxRpc.Call(utils.ApierV1SetThresholdProfile, tPrfl, &result); err != nil { + if err := tFIdxRpc.Call(utils.APIerSv1SetThresholdProfile, tPrfl, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } - if err := tFIdxRpc.Call(utils.ApierV1GetThresholdProfile, + if err := tFIdxRpc.Call(utils.APIerSv1GetThresholdProfile, &utils.TenantID{Tenant: tenant, ID: "TEST_PROFILE2"}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(tPrfl.ThresholdProfile, reply) { t.Errorf("Expecting: %+v, received: %+v", tPrfl.ThresholdProfile, reply) } - if err := tFIdxRpc.Call(utils.ApierV1RemoveFilterIndexes, &AttrRemFilterIndexes{ + if err := tFIdxRpc.Call(utils.APIerSv1RemoveFilterIndexes, &AttrRemFilterIndexes{ ItemType: utils.MetaThresholds, Tenant: tenant}, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } var indexes []string - if err := tFIdxRpc.Call(utils.ApierV1GetFilterIndexes, &AttrGetFilterIndexes{ + if err := tFIdxRpc.Call(utils.APIerSv1GetFilterIndexes, &AttrGetFilterIndexes{ ItemType: utils.MetaThresholds, Tenant: tenant, FilterType: utils.MetaString}, &indexes); err.Error() != utils.ErrNotFound.Error() { t.Error(err) @@ -319,7 +319,7 @@ func testV1FIdxSetSecondThresholdProfile(t *testing.T) { func testV1FIdxSecondComputeThresholdsIndexes(t *testing.T) { thid := []string{"TEST_PROFILE2"} var result string - if err := tFIdxRpc.Call(utils.ApierV1ComputeFilterIndexIDs, + if err := tFIdxRpc.Call(utils.APIerSv1ComputeFilterIndexIDs, utils.ArgsComputeFilterIndexIDs{ Tenant: tenant, ThresholdIDs: thid, @@ -331,7 +331,7 @@ func testV1FIdxSecondComputeThresholdsIndexes(t *testing.T) { } expectedIDX := []string{"*string:~*req.Account:1002:TEST_PROFILE2"} var indexes []string - if err := tFIdxRpc.Call(utils.ApierV1GetFilterIndexes, &AttrGetFilterIndexes{ + if err := tFIdxRpc.Call(utils.APIerSv1GetFilterIndexes, &AttrGetFilterIndexes{ ItemType: utils.MetaThresholds, Tenant: tenant, FilterType: utils.MetaString}, &indexes); err != nil && err.Error() != utils.ErrNotFound.Error() { t.Error(err) @@ -343,7 +343,7 @@ func testV1FIdxSecondComputeThresholdsIndexes(t *testing.T) { func testV1FIdxThirdComputeThresholdsIndexes(t *testing.T) { var result string - if err := tFIdxRpc.Call(utils.ApierV1ComputeFilterIndexes, utils.ArgsComputeFilterIndexes{ + if err := tFIdxRpc.Call(utils.APIerSv1ComputeFilterIndexes, utils.ArgsComputeFilterIndexes{ Tenant: tenant, ThresholdS: true, }, &result); err != nil { @@ -355,7 +355,7 @@ func testV1FIdxThirdComputeThresholdsIndexes(t *testing.T) { expectedIDX := []string{"*string:~*req.Account:1001:TEST_PROFILE1", "*string:~*req.Account:1002:TEST_PROFILE2"} sort.Strings(expectedIDX) var indexes []string - if err := tFIdxRpc.Call(utils.ApierV1GetFilterIndexes, &AttrGetFilterIndexes{ + if err := tFIdxRpc.Call(utils.APIerSv1GetFilterIndexes, &AttrGetFilterIndexes{ ItemType: utils.MetaThresholds, Tenant: tenant, FilterType: utils.MetaString}, &indexes); err != nil && err.Error() != utils.ErrNotFound.Error() { t.Error(err) @@ -369,7 +369,7 @@ func testV1FIdxThirdComputeThresholdsIndexes(t *testing.T) { func testV1FIdxRemoveThresholdProfile(t *testing.T) { var result string - if err := tFIdxRpc.Call(utils.ApierV1ComputeFilterIndexes, utils.ArgsComputeFilterIndexes{ + if err := tFIdxRpc.Call(utils.APIerSv1ComputeFilterIndexes, utils.ArgsComputeFilterIndexes{ Tenant: tenant, ThresholdS: true, }, &result); err != nil { @@ -378,31 +378,31 @@ func testV1FIdxRemoveThresholdProfile(t *testing.T) { if result != utils.OK { t.Errorf("Error: %+v", result) } - if err := tFIdxRpc.Call(utils.ApierV1RemoveThresholdProfile, + if err := tFIdxRpc.Call(utils.APIerSv1RemoveThresholdProfile, &utils.TenantID{Tenant: tenant, ID: "TEST_PROFILE1"}, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } - if err := tFIdxRpc.Call(utils.ApierV1RemoveThresholdProfile, + if err := tFIdxRpc.Call(utils.APIerSv1RemoveThresholdProfile, &utils.TenantID{Tenant: tenant, ID: "TEST_PROFILE2"}, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } var sqp *engine.ThresholdProfile - if err := tFIdxRpc.Call(utils.ApierV1GetThresholdProfile, + if err := tFIdxRpc.Call(utils.APIerSv1GetThresholdProfile, &utils.TenantID{Tenant: tenant, ID: "TEST_PROFILE1"}, &sqp); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) } - if err := tFIdxRpc.Call(utils.ApierV1GetThresholdProfile, + if err := tFIdxRpc.Call(utils.APIerSv1GetThresholdProfile, &utils.TenantID{Tenant: tenant, ID: "TEST_PROFILE2"}, &sqp); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) } var indexes []string - if err := tFIdxRpc.Call(utils.ApierV1GetFilterIndexes, &AttrGetFilterIndexes{ + if err := tFIdxRpc.Call(utils.APIerSv1GetFilterIndexes, &AttrGetFilterIndexes{ ItemType: utils.MetaThresholds, Tenant: tenant, FilterType: utils.MetaString}, &indexes); err != nil && err.Error() != utils.ErrNotFound.Error() { t.Error(err) @@ -428,12 +428,12 @@ func testV1FIdxSetStatQueueProfileIndexes(t *testing.T) { }, } var result string - if err := tFIdxRpc.Call(utils.ApierV1SetFilter, filter, &result); err != nil { + if err := tFIdxRpc.Call(utils.APIerSv1SetFilter, filter, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } - if err := tFIdxRpc.Call(utils.ApierV1GetStatQueueProfile, + if err := tFIdxRpc.Call(utils.APIerSv1GetStatQueueProfile, &utils.TenantID{Tenant: tenant, ID: "TEST_PROFILE1"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) @@ -464,25 +464,25 @@ func testV1FIdxSetStatQueueProfileIndexes(t *testing.T) { MinItems: 1, }, } - if err := tFIdxRpc.Call(utils.ApierV1SetStatQueueProfile, statConfig, &result); err != nil { + if err := tFIdxRpc.Call(utils.APIerSv1SetStatQueueProfile, statConfig, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } - if err := tFIdxRpc.Call(utils.ApierV1GetStatQueueProfile, + if err := tFIdxRpc.Call(utils.APIerSv1GetStatQueueProfile, &utils.TenantID{Tenant: tenant, ID: "TEST_PROFILE1"}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(statConfig.StatQueueProfile, reply) { t.Errorf("Expecting: %+v, received: %+v", statConfig.StatQueueProfile, reply) } - if err := tFIdxRpc.Call(utils.ApierV1RemoveFilterIndexes, &AttrRemFilterIndexes{ + if err := tFIdxRpc.Call(utils.APIerSv1RemoveFilterIndexes, &AttrRemFilterIndexes{ ItemType: utils.MetaStats, Tenant: tenant}, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } var indexes []string - if err := tFIdxRpc.Call(utils.ApierV1GetFilterIndexes, &AttrGetFilterIndexes{ + if err := tFIdxRpc.Call(utils.APIerSv1GetFilterIndexes, &AttrGetFilterIndexes{ ItemType: utils.MetaStats, Tenant: tenant, FilterType: utils.MetaString}, &indexes); err.Error() != utils.ErrNotFound.Error() { t.Error(err) @@ -491,7 +491,7 @@ func testV1FIdxSetStatQueueProfileIndexes(t *testing.T) { func testV1FIdxComputeStatQueueProfileIndexes(t *testing.T) { var result string - if err := tFIdxRpc.Call(utils.ApierV1ComputeFilterIndexes, utils.ArgsComputeFilterIndexes{ + if err := tFIdxRpc.Call(utils.APIerSv1ComputeFilterIndexes, utils.ArgsComputeFilterIndexes{ Tenant: tenant, StatS: true, }, &result); err != nil { @@ -502,7 +502,7 @@ func testV1FIdxComputeStatQueueProfileIndexes(t *testing.T) { } expectedIDX := []string{"*string:~*req.Account:1001:TEST_PROFILE1"} var indexes []string - if err := tFIdxRpc.Call(utils.ApierV1GetFilterIndexes, &AttrGetFilterIndexes{ + if err := tFIdxRpc.Call(utils.APIerSv1GetFilterIndexes, &AttrGetFilterIndexes{ ItemType: utils.MetaStats, Tenant: tenant, FilterType: utils.MetaString}, &indexes); err != nil { t.Error(err) @@ -531,12 +531,12 @@ func testV1FIdxSetSecondStatQueueProfileIndexes(t *testing.T) { }, } var result string - if err := tFIdxRpc.Call(utils.ApierV1SetFilter, filter, &result); err != nil { + if err := tFIdxRpc.Call(utils.APIerSv1SetFilter, filter, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } - if err := tFIdxRpc.Call(utils.ApierV1GetStatQueueProfile, + if err := tFIdxRpc.Call(utils.APIerSv1GetStatQueueProfile, &utils.TenantID{Tenant: tenant, ID: "TEST_PROFILE2"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) @@ -567,25 +567,25 @@ func testV1FIdxSetSecondStatQueueProfileIndexes(t *testing.T) { MinItems: 1, }, } - if err := tFIdxRpc.Call(utils.ApierV1SetStatQueueProfile, statConfig, &result); err != nil { + if err := tFIdxRpc.Call(utils.APIerSv1SetStatQueueProfile, statConfig, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } - if err := tFIdxRpc.Call(utils.ApierV1GetStatQueueProfile, + if err := tFIdxRpc.Call(utils.APIerSv1GetStatQueueProfile, &utils.TenantID{Tenant: tenant, ID: "TEST_PROFILE2"}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(statConfig.StatQueueProfile, reply) { t.Errorf("Expecting: %+v, received: %+v", statConfig.StatQueueProfile, reply) } - if err := tFIdxRpc.Call(utils.ApierV1RemoveFilterIndexes, &AttrRemFilterIndexes{ + if err := tFIdxRpc.Call(utils.APIerSv1RemoveFilterIndexes, &AttrRemFilterIndexes{ ItemType: utils.MetaStats, Tenant: tenant}, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } var indexes []string - if err := tFIdxRpc.Call(utils.ApierV1GetFilterIndexes, &AttrGetFilterIndexes{ + if err := tFIdxRpc.Call(utils.APIerSv1GetFilterIndexes, &AttrGetFilterIndexes{ ItemType: utils.MetaStats, Tenant: tenant, FilterType: utils.MetaString}, &indexes); err.Error() != utils.ErrNotFound.Error() { t.Error(err) @@ -595,7 +595,7 @@ func testV1FIdxSetSecondStatQueueProfileIndexes(t *testing.T) { func testV1FIdxSecondComputeStatQueueProfileIndexes(t *testing.T) { var result string if err := tFIdxRpc.Call( - utils.ApierV1ComputeFilterIndexIDs, utils.ArgsComputeFilterIndexIDs{ + utils.APIerSv1ComputeFilterIndexIDs, utils.ArgsComputeFilterIndexIDs{ Tenant: tenant, StatIDs: []string{"TEST_PROFILE2"}, }, &result); err != nil { @@ -606,7 +606,7 @@ func testV1FIdxSecondComputeStatQueueProfileIndexes(t *testing.T) { } expectedIDX := []string{"*string:~*req.Account:1001:TEST_PROFILE2"} var indexes []string - if err := tFIdxRpc.Call(utils.ApierV1GetFilterIndexes, &AttrGetFilterIndexes{ + if err := tFIdxRpc.Call(utils.APIerSv1GetFilterIndexes, &AttrGetFilterIndexes{ ItemType: utils.MetaStats, Tenant: tenant, FilterType: utils.MetaString}, &indexes); err != nil { t.Error(err) @@ -619,7 +619,7 @@ func testV1FIdxSecondComputeStatQueueProfileIndexes(t *testing.T) { func testV1FIdxRemoveStatQueueProfile(t *testing.T) { var result string - if err := tFIdxRpc.Call(utils.ApierV1ComputeFilterIndexes, utils.ArgsComputeFilterIndexes{ + if err := tFIdxRpc.Call(utils.APIerSv1ComputeFilterIndexes, utils.ArgsComputeFilterIndexes{ Tenant: tenant, StatS: true, }, &result); err != nil { @@ -628,30 +628,30 @@ func testV1FIdxRemoveStatQueueProfile(t *testing.T) { if result != utils.OK { t.Errorf("Error: %+v", result) } - if err := tFIdxRpc.Call(utils.ApierV1RemoveStatQueueProfile, + if err := tFIdxRpc.Call(utils.APIerSv1RemoveStatQueueProfile, &utils.TenantID{Tenant: tenant, ID: "TEST_PROFILE1"}, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } - if err := tFIdxRpc.Call(utils.ApierV1RemoveStatQueueProfile, + if err := tFIdxRpc.Call(utils.APIerSv1RemoveStatQueueProfile, &utils.TenantID{Tenant: tenant, ID: "TEST_PROFILE2"}, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } - if err := tFIdxRpc.Call(utils.ApierV1GetStatQueueProfile, + if err := tFIdxRpc.Call(utils.APIerSv1GetStatQueueProfile, &utils.TenantID{Tenant: tenant, ID: "TEST_PROFILE1"}, &result); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) } - if err := tFIdxRpc.Call(utils.ApierV1GetStatQueueProfile, + if err := tFIdxRpc.Call(utils.APIerSv1GetStatQueueProfile, &utils.TenantID{Tenant: tenant, ID: "TEST_PROFILE2"}, &result); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) } var indexes []string - if err := tFIdxRpc.Call(utils.ApierV1GetFilterIndexes, &AttrGetFilterIndexes{ + if err := tFIdxRpc.Call(utils.APIerSv1GetFilterIndexes, &AttrGetFilterIndexes{ ItemType: utils.MetaStats, Tenant: tenant, FilterType: utils.MetaString}, &indexes); err != nil && err.Error() != utils.ErrNotFound.Error() { t.Error(err) @@ -677,12 +677,12 @@ func testV1FIdxSetResourceProfileIndexes(t *testing.T) { }, } var result string - if err := tFIdxRpc.Call(utils.ApierV1SetFilter, filter, &result); err != nil { + if err := tFIdxRpc.Call(utils.APIerSv1SetFilter, filter, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } - if err := tFIdxRpc.Call(utils.ApierV1GetResourceProfile, &utils.TenantID{Tenant: tenant, ID: "RCFG1"}, + if err := tFIdxRpc.Call(utils.APIerSv1GetResourceProfile, &utils.TenantID{Tenant: tenant, ID: "RCFG1"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) } @@ -704,24 +704,24 @@ func testV1FIdxSetResourceProfileIndexes(t *testing.T) { ThresholdIDs: []string{"Val1", "Val2"}, }, } - if err := tFIdxRpc.Call(utils.ApierV1SetFilter, filter, &result); err != nil { + if err := tFIdxRpc.Call(utils.APIerSv1SetFilter, filter, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } - if err := tFIdxRpc.Call(utils.ApierV1SetResourceProfile, rlsConfig, &result); err != nil { + if err := tFIdxRpc.Call(utils.APIerSv1SetResourceProfile, rlsConfig, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } - if err := tFIdxRpc.Call(utils.ApierV1RemoveFilterIndexes, &AttrRemFilterIndexes{ + if err := tFIdxRpc.Call(utils.APIerSv1RemoveFilterIndexes, &AttrRemFilterIndexes{ ItemType: utils.MetaResources, Tenant: tenant}, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } var indexes []string - if err := tFIdxRpc.Call(utils.ApierV1GetFilterIndexes, &AttrGetFilterIndexes{ + if err := tFIdxRpc.Call(utils.APIerSv1GetFilterIndexes, &AttrGetFilterIndexes{ ItemType: utils.MetaResources, Tenant: tenant, FilterType: utils.MetaString}, &indexes); err != nil && err.Error() != utils.ErrNotFound.Error() { t.Error(err) @@ -730,7 +730,7 @@ func testV1FIdxSetResourceProfileIndexes(t *testing.T) { func testV1FIdxComputeResourceProfileIndexes(t *testing.T) { var reply2 string - if err := tFIdxRpc.Call(utils.ApierV1ComputeFilterIndexes, utils.ArgsComputeFilterIndexes{ + if err := tFIdxRpc.Call(utils.APIerSv1ComputeFilterIndexes, utils.ArgsComputeFilterIndexes{ Tenant: tenant, ResourceS: true, }, &reply2); err != nil { @@ -741,7 +741,7 @@ func testV1FIdxComputeResourceProfileIndexes(t *testing.T) { } expectedIDX := []string{"*string:~*req.Account:1001:RCFG1"} var indexes []string - if err := tFIdxRpc.Call(utils.ApierV1GetFilterIndexes, &AttrGetFilterIndexes{ + if err := tFIdxRpc.Call(utils.APIerSv1GetFilterIndexes, &AttrGetFilterIndexes{ ItemType: utils.MetaResources, Tenant: tenant, FilterType: utils.MetaString}, &indexes); err != nil { t.Error(err) @@ -770,12 +770,12 @@ func testV1FIdxSetSecondResourceProfileIndexes(t *testing.T) { }, } var result string - if err := tFIdxRpc.Call(utils.ApierV1SetFilter, filter, &result); err != nil { + if err := tFIdxRpc.Call(utils.APIerSv1SetFilter, filter, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } - if err := tFIdxRpc.Call(utils.ApierV1GetResourceProfile, &utils.TenantID{Tenant: tenant, ID: "RCFG2"}, + if err := tFIdxRpc.Call(utils.APIerSv1GetResourceProfile, &utils.TenantID{Tenant: tenant, ID: "RCFG2"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) } @@ -797,24 +797,24 @@ func testV1FIdxSetSecondResourceProfileIndexes(t *testing.T) { ThresholdIDs: []string{"Val1", "Val2"}, }, } - if err := tFIdxRpc.Call(utils.ApierV1SetFilter, filter, &result); err != nil { + if err := tFIdxRpc.Call(utils.APIerSv1SetFilter, filter, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } - if err := tFIdxRpc.Call(utils.ApierV1SetResourceProfile, rlsConfig, &result); err != nil { + if err := tFIdxRpc.Call(utils.APIerSv1SetResourceProfile, rlsConfig, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } - if err := tFIdxRpc.Call(utils.ApierV1RemoveFilterIndexes, &AttrRemFilterIndexes{ + if err := tFIdxRpc.Call(utils.APIerSv1RemoveFilterIndexes, &AttrRemFilterIndexes{ ItemType: utils.MetaResources, Tenant: tenant}, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } var indexes []string - if err := tFIdxRpc.Call(utils.ApierV1GetFilterIndexes, &AttrGetFilterIndexes{ + if err := tFIdxRpc.Call(utils.APIerSv1GetFilterIndexes, &AttrGetFilterIndexes{ ItemType: utils.MetaResources, Tenant: tenant, FilterType: utils.MetaString}, &indexes); err != nil && err.Error() != utils.ErrNotFound.Error() { t.Error(err) @@ -824,7 +824,7 @@ func testV1FIdxSetSecondResourceProfileIndexes(t *testing.T) { func testV1FIdxSecondComputeResourceProfileIndexes(t *testing.T) { rsid := []string{"RCFG2"} var reply2 string - if err := tFIdxRpc.Call(utils.ApierV1ComputeFilterIndexIDs, + if err := tFIdxRpc.Call(utils.APIerSv1ComputeFilterIndexIDs, utils.ArgsComputeFilterIndexIDs{ Tenant: tenant, ResourceIDs: rsid, @@ -836,7 +836,7 @@ func testV1FIdxSecondComputeResourceProfileIndexes(t *testing.T) { } expectedIDX := []string{"*string:~*req.Account:1001:RCFG2"} var indexes []string - if err := tFIdxRpc.Call(utils.ApierV1GetFilterIndexes, &AttrGetFilterIndexes{ + if err := tFIdxRpc.Call(utils.APIerSv1GetFilterIndexes, &AttrGetFilterIndexes{ ItemType: utils.MetaResources, Tenant: tenant, FilterType: utils.MetaString}, &indexes); err != nil { t.Error(err) @@ -849,7 +849,7 @@ func testV1FIdxSecondComputeResourceProfileIndexes(t *testing.T) { func testV1FIdxRemoveResourceProfile(t *testing.T) { var resp string var reply2 string - if err := tFIdxRpc.Call(utils.ApierV1ComputeFilterIndexes, utils.ArgsComputeFilterIndexes{ + if err := tFIdxRpc.Call(utils.APIerSv1ComputeFilterIndexes, utils.ArgsComputeFilterIndexes{ Tenant: tenant, ResourceS: true, }, &reply2); err != nil { @@ -858,28 +858,28 @@ func testV1FIdxRemoveResourceProfile(t *testing.T) { if reply2 != utils.OK { t.Errorf("Error: %+v", reply2) } - if err := tFIdxRpc.Call(utils.ApierV1RemoveResourceProfile, + if err := tFIdxRpc.Call(utils.APIerSv1RemoveResourceProfile, &utils.TenantID{Tenant: tenant, ID: "RCFG1"}, &resp); err != nil { t.Error(err) } else if resp != utils.OK { t.Error("Unexpected reply returned", resp) } - if err := tFIdxRpc.Call(utils.ApierV1RemoveResourceProfile, + if err := tFIdxRpc.Call(utils.APIerSv1RemoveResourceProfile, &utils.TenantID{Tenant: tenant, ID: "RCFG2"}, &resp); err != nil { t.Error(err) } else if resp != utils.OK { t.Error("Unexpected reply returned", resp) } - if err := tFIdxRpc.Call(utils.ApierV1GetResourceProfile, &utils.TenantID{Tenant: tenant, ID: "RCFG1"}, + if err := tFIdxRpc.Call(utils.APIerSv1GetResourceProfile, &utils.TenantID{Tenant: tenant, ID: "RCFG1"}, &reply2); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) } - if err := tFIdxRpc.Call(utils.ApierV1GetResourceProfile, &utils.TenantID{Tenant: tenant, ID: "RCFG2"}, + if err := tFIdxRpc.Call(utils.APIerSv1GetResourceProfile, &utils.TenantID{Tenant: tenant, ID: "RCFG2"}, &reply2); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) } var indexes []string - if err := tFIdxRpc.Call(utils.ApierV1GetFilterIndexes, &AttrGetFilterIndexes{ + if err := tFIdxRpc.Call(utils.APIerSv1GetFilterIndexes, &AttrGetFilterIndexes{ ItemType: utils.MetaResources, Tenant: tenant, FilterType: utils.MetaString}, &indexes); err != nil && err.Error() != utils.ErrNotFound.Error() { t.Error(err) @@ -907,12 +907,12 @@ func testV1FIdxSetSupplierProfileIndexes(t *testing.T) { }, } var result string - if err := tFIdxRpc.Call(utils.ApierV1SetFilter, filter, &result); err != nil { + if err := tFIdxRpc.Call(utils.APIerSv1SetFilter, filter, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } - if err := tFIdxRpc.Call(utils.ApierV1GetSupplierProfile, + if err := tFIdxRpc.Call(utils.APIerSv1GetSupplierProfile, &utils.TenantID{Tenant: tenant, ID: "TEST_PROFILE1"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) @@ -938,25 +938,25 @@ func testV1FIdxSetSupplierProfileIndexes(t *testing.T) { }, } - if err := tFIdxRpc.Call(utils.ApierV1SetSupplierProfile, splPrf, &result); err != nil { + if err := tFIdxRpc.Call(utils.APIerSv1SetSupplierProfile, splPrf, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } - if err := tFIdxRpc.Call(utils.ApierV1GetSupplierProfile, + if err := tFIdxRpc.Call(utils.APIerSv1GetSupplierProfile, &utils.TenantID{Tenant: tenant, ID: "TEST_PROFILE1"}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(splPrf.SupplierProfile, reply) { t.Errorf("Expecting: %+v, received: %+v", splPrf.SupplierProfile, reply) } - if err := tFIdxRpc.Call(utils.ApierV1RemoveFilterIndexes, &AttrRemFilterIndexes{ + if err := tFIdxRpc.Call(utils.APIerSv1RemoveFilterIndexes, &AttrRemFilterIndexes{ ItemType: utils.MetaSuppliers, Tenant: tenant}, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } var indexes []string - if err := tFIdxRpc.Call(utils.ApierV1GetFilterIndexes, &AttrGetFilterIndexes{ + if err := tFIdxRpc.Call(utils.APIerSv1GetFilterIndexes, &AttrGetFilterIndexes{ ItemType: utils.MetaSuppliers, Tenant: tenant, FilterType: utils.MetaString}, &indexes); err.Error() != utils.ErrNotFound.Error() { t.Error(err) @@ -965,7 +965,7 @@ func testV1FIdxSetSupplierProfileIndexes(t *testing.T) { func testV1FIdxComputeSupplierProfileIndexes(t *testing.T) { var reply2 string - if err := tFIdxRpc.Call(utils.ApierV1ComputeFilterIndexes, utils.ArgsComputeFilterIndexes{ + if err := tFIdxRpc.Call(utils.APIerSv1ComputeFilterIndexes, utils.ArgsComputeFilterIndexes{ Tenant: tenant, SupplierS: true, }, &reply2); err != nil { @@ -976,7 +976,7 @@ func testV1FIdxComputeSupplierProfileIndexes(t *testing.T) { } expectedIDX := []string{"*string:~*req.Account:1001:TEST_PROFILE1"} var indexes []string - if err := tFIdxRpc.Call(utils.ApierV1GetFilterIndexes, &AttrGetFilterIndexes{ + if err := tFIdxRpc.Call(utils.APIerSv1GetFilterIndexes, &AttrGetFilterIndexes{ ItemType: utils.MetaSuppliers, Tenant: tenant, FilterType: utils.MetaString}, &indexes); err != nil { t.Error(err) @@ -1005,12 +1005,12 @@ func testV1FIdxSetSecondSupplierProfileIndexes(t *testing.T) { }, } var result string - if err := tFIdxRpc.Call(utils.ApierV1SetFilter, filter, &result); err != nil { + if err := tFIdxRpc.Call(utils.APIerSv1SetFilter, filter, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } - if err := tFIdxRpc.Call(utils.ApierV1GetSupplierProfile, + if err := tFIdxRpc.Call(utils.APIerSv1GetSupplierProfile, &utils.TenantID{Tenant: tenant, ID: "TEST_PROFILE2"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) @@ -1035,25 +1035,25 @@ func testV1FIdxSetSecondSupplierProfileIndexes(t *testing.T) { Weight: 10, }, } - if err := tFIdxRpc.Call(utils.ApierV1SetSupplierProfile, splPrf, &result); err != nil { + if err := tFIdxRpc.Call(utils.APIerSv1SetSupplierProfile, splPrf, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } - if err := tFIdxRpc.Call(utils.ApierV1GetSupplierProfile, + if err := tFIdxRpc.Call(utils.APIerSv1GetSupplierProfile, &utils.TenantID{Tenant: tenant, ID: "TEST_PROFILE2"}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(splPrf.SupplierProfile, reply) { t.Errorf("Expecting: %+v, received: %+v", splPrf.SupplierProfile, reply) } - if err := tFIdxRpc.Call(utils.ApierV1RemoveFilterIndexes, &AttrRemFilterIndexes{ + if err := tFIdxRpc.Call(utils.APIerSv1RemoveFilterIndexes, &AttrRemFilterIndexes{ ItemType: utils.MetaSuppliers, Tenant: tenant}, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } var indexes []string - if err := tFIdxRpc.Call(utils.ApierV1GetFilterIndexes, &AttrGetFilterIndexes{ + if err := tFIdxRpc.Call(utils.APIerSv1GetFilterIndexes, &AttrGetFilterIndexes{ ItemType: utils.MetaSuppliers, Tenant: tenant, FilterType: utils.MetaString}, &indexes); err.Error() != utils.ErrNotFound.Error() { t.Error(err) @@ -1063,7 +1063,7 @@ func testV1FIdxSetSecondSupplierProfileIndexes(t *testing.T) { func testV1FIdxSecondComputeSupplierProfileIndexes(t *testing.T) { spid := []string{"TEST_PROFILE2"} var reply2 string - if err := tFIdxRpc.Call(utils.ApierV1ComputeFilterIndexIDs, + if err := tFIdxRpc.Call(utils.APIerSv1ComputeFilterIndexIDs, utils.ArgsComputeFilterIndexIDs{ Tenant: tenant, SupplierIDs: spid, @@ -1075,7 +1075,7 @@ func testV1FIdxSecondComputeSupplierProfileIndexes(t *testing.T) { } expectedIDX := []string{"*string:~*req.Account:1001:TEST_PROFILE2"} var indexes []string - if err := tFIdxRpc.Call(utils.ApierV1GetFilterIndexes, &AttrGetFilterIndexes{ + if err := tFIdxRpc.Call(utils.APIerSv1GetFilterIndexes, &AttrGetFilterIndexes{ ItemType: utils.MetaSuppliers, Tenant: tenant, FilterType: utils.MetaString}, &indexes); err != nil { t.Error(err) @@ -1089,7 +1089,7 @@ func testV1FIdxSecondComputeSupplierProfileIndexes(t *testing.T) { func testV1FIdxRemoveSupplierProfile(t *testing.T) { var resp string var reply2 string - if err := tFIdxRpc.Call(utils.ApierV1ComputeFilterIndexes, utils.ArgsComputeFilterIndexes{ + if err := tFIdxRpc.Call(utils.APIerSv1ComputeFilterIndexes, utils.ArgsComputeFilterIndexes{ Tenant: tenant, SupplierS: true, }, &reply2); err != nil { @@ -1098,30 +1098,30 @@ func testV1FIdxRemoveSupplierProfile(t *testing.T) { if reply2 != utils.OK { t.Errorf("Error: %+v", reply2) } - if err := tFIdxRpc.Call(utils.ApierV1RemoveSupplierProfile, + if err := tFIdxRpc.Call(utils.APIerSv1RemoveSupplierProfile, &utils.TenantID{Tenant: tenant, ID: "TEST_PROFILE1"}, &resp); err != nil { t.Error(err) } else if resp != utils.OK { t.Error("Unexpected reply returned", resp) } - if err := tFIdxRpc.Call(utils.ApierV1RemoveSupplierProfile, + if err := tFIdxRpc.Call(utils.APIerSv1RemoveSupplierProfile, &utils.TenantID{Tenant: tenant, ID: "TEST_PROFILE2"}, &resp); err != nil { t.Error(err) } else if resp != utils.OK { t.Error("Unexpected reply returned", resp) } - if err := tFIdxRpc.Call(utils.ApierV1GetSupplierProfile, + if err := tFIdxRpc.Call(utils.APIerSv1GetSupplierProfile, &utils.TenantID{Tenant: tenant, ID: "TEST_PROFILE1"}, &reply2); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) } - if err := tFIdxRpc.Call(utils.ApierV1GetSupplierProfile, + if err := tFIdxRpc.Call(utils.APIerSv1GetSupplierProfile, &utils.TenantID{Tenant: tenant, ID: "TEST_PROFILE2"}, &reply2); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) } var indexes []string - if err := tFIdxRpc.Call(utils.ApierV1GetFilterIndexes, &AttrGetFilterIndexes{ + if err := tFIdxRpc.Call(utils.APIerSv1GetFilterIndexes, &AttrGetFilterIndexes{ ItemType: utils.MetaSuppliers, Tenant: tenant, FilterType: utils.MetaString}, &indexes); err != nil && err.Error() != utils.ErrNotFound.Error() { @@ -1148,12 +1148,12 @@ func testV1FIdxSetAttributeProfileIndexes(t *testing.T) { }, } var result string - if err := tFIdxRpc.Call(utils.ApierV1SetFilter, filter, &result); err != nil { + if err := tFIdxRpc.Call(utils.APIerSv1SetFilter, filter, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } - if err := tFIdxRpc.Call(utils.ApierV1GetAttributeProfile, + if err := tFIdxRpc.Call(utils.APIerSv1GetAttributeProfile, &utils.TenantIDWithArgDispatcher{TenantID: &utils.TenantID{Tenant: tenant, ID: "ApierTest"}}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) @@ -1178,12 +1178,12 @@ func testV1FIdxSetAttributeProfileIndexes(t *testing.T) { Weight: 20, }, } - if err := tFIdxRpc.Call(utils.ApierV1SetAttributeProfile, alsPrf, &result); err != nil { + if err := tFIdxRpc.Call(utils.APIerSv1SetAttributeProfile, alsPrf, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } - if err := tFIdxRpc.Call(utils.ApierV1GetAttributeProfile, + if err := tFIdxRpc.Call(utils.APIerSv1GetAttributeProfile, &utils.TenantIDWithArgDispatcher{TenantID: &utils.TenantID{Tenant: tenant, ID: "ApierTest"}}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(alsPrf.FilterIDs, reply.FilterIDs) { @@ -1196,7 +1196,7 @@ func testV1FIdxSetAttributeProfileIndexes(t *testing.T) { t.Errorf("Expecting : %+v, received: %+v", alsPrf.ID, reply.ID) } - if err := tFIdxRpc.Call(utils.ApierV1RemoveFilterIndexes, &AttrRemFilterIndexes{ + if err := tFIdxRpc.Call(utils.APIerSv1RemoveFilterIndexes, &AttrRemFilterIndexes{ ItemType: utils.MetaAttributes, Tenant: tenant, Context: utils.MetaSessionS}, &result); err != nil { @@ -1205,7 +1205,7 @@ func testV1FIdxSetAttributeProfileIndexes(t *testing.T) { t.Error("Unexpected reply returned", result) } var indexes []string - if err := tFIdxRpc.Call(utils.ApierV1GetFilterIndexes, &AttrGetFilterIndexes{ + if err := tFIdxRpc.Call(utils.APIerSv1GetFilterIndexes, &AttrGetFilterIndexes{ ItemType: utils.MetaAttributes, Tenant: tenant, FilterType: utils.MetaString, Context: utils.MetaSessionS}, &indexes); err.Error() != utils.ErrNotFound.Error() { t.Error(err) @@ -1214,7 +1214,7 @@ func testV1FIdxSetAttributeProfileIndexes(t *testing.T) { func testV1FIdxComputeAttributeProfileIndexes(t *testing.T) { var result string - if err := tFIdxRpc.Call(utils.ApierV1ComputeFilterIndexes, + if err := tFIdxRpc.Call(utils.APIerSv1ComputeFilterIndexes, utils.ArgsComputeFilterIndexes{ Tenant: tenant, Context: utils.MetaSessionS, @@ -1226,7 +1226,7 @@ func testV1FIdxComputeAttributeProfileIndexes(t *testing.T) { } expectedIDX := []string{"*string:~*req.Account:1001:ApierTest"} var indexes []string - if err := tFIdxRpc.Call(utils.ApierV1GetFilterIndexes, &AttrGetFilterIndexes{ + if err := tFIdxRpc.Call(utils.APIerSv1GetFilterIndexes, &AttrGetFilterIndexes{ ItemType: utils.MetaAttributes, Tenant: tenant, FilterType: utils.MetaString, @@ -1256,12 +1256,12 @@ func testV1FIdxSetSecondAttributeProfileIndexes(t *testing.T) { }, } var result string - if err := tFIdxRpc.Call(utils.ApierV1SetFilter, filter, &result); err != nil { + if err := tFIdxRpc.Call(utils.APIerSv1SetFilter, filter, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } - if err := tFIdxRpc.Call(utils.ApierV1GetAttributeProfile, + if err := tFIdxRpc.Call(utils.APIerSv1GetAttributeProfile, &utils.TenantIDWithArgDispatcher{TenantID: &utils.TenantID{ Tenant: tenant, ID: "ApierTest2"}}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { @@ -1285,12 +1285,12 @@ func testV1FIdxSetSecondAttributeProfileIndexes(t *testing.T) { Weight: 20, }, } - if err := tFIdxRpc.Call(utils.ApierV1SetAttributeProfile, alsPrf, &result); err != nil { + if err := tFIdxRpc.Call(utils.APIerSv1SetAttributeProfile, alsPrf, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } - if err := tFIdxRpc.Call(utils.ApierV1GetAttributeProfile, + if err := tFIdxRpc.Call(utils.APIerSv1GetAttributeProfile, &utils.TenantIDWithArgDispatcher{TenantID: &utils.TenantID{ Tenant: tenant, ID: "ApierTest2"}}, &reply); err != nil { t.Error(err) @@ -1304,7 +1304,7 @@ func testV1FIdxSetSecondAttributeProfileIndexes(t *testing.T) { } else if !reflect.DeepEqual(alsPrf.ID, reply.ID) { t.Errorf("Expecting : %+v, received: %+v", alsPrf.ID, reply.ID) } - if err := tFIdxRpc.Call(utils.ApierV1RemoveFilterIndexes, &AttrRemFilterIndexes{ + if err := tFIdxRpc.Call(utils.APIerSv1RemoveFilterIndexes, &AttrRemFilterIndexes{ ItemType: utils.MetaAttributes, Tenant: tenant, Context: utils.MetaSessionS}, &result); err != nil { @@ -1313,7 +1313,7 @@ func testV1FIdxSetSecondAttributeProfileIndexes(t *testing.T) { t.Error("Unexpected reply returned", result) } var indexes []string - if err := tFIdxRpc.Call(utils.ApierV1GetFilterIndexes, &AttrGetFilterIndexes{ + if err := tFIdxRpc.Call(utils.APIerSv1GetFilterIndexes, &AttrGetFilterIndexes{ ItemType: utils.MetaAttributes, Tenant: tenant, FilterType: utils.MetaString, @@ -1324,7 +1324,7 @@ func testV1FIdxSetSecondAttributeProfileIndexes(t *testing.T) { func testV1FIdxSecondComputeAttributeProfileIndexes(t *testing.T) { var result string - if err := tFIdxRpc.Call(utils.ApierV1ComputeFilterIndexIDs, + if err := tFIdxRpc.Call(utils.APIerSv1ComputeFilterIndexIDs, utils.ArgsComputeFilterIndexIDs{ Tenant: tenant, Context: utils.MetaSessionS, @@ -1336,7 +1336,7 @@ func testV1FIdxSecondComputeAttributeProfileIndexes(t *testing.T) { } expectedIDX := []string{"*string:~*req.Account:1001:ApierTest2"} var indexes []string - if err := tFIdxRpc.Call(utils.ApierV1GetFilterIndexes, &AttrGetFilterIndexes{ + if err := tFIdxRpc.Call(utils.APIerSv1GetFilterIndexes, &AttrGetFilterIndexes{ ItemType: utils.MetaAttributes, Tenant: tenant, FilterType: utils.MetaString, @@ -1351,7 +1351,7 @@ func testV1FIdxSecondComputeAttributeProfileIndexes(t *testing.T) { func testV1FIdxComputeWithAnotherContext(t *testing.T) { var result string - if err := tFIdxRpc.Call(utils.ApierV1ComputeFilterIndexes, + if err := tFIdxRpc.Call(utils.APIerSv1ComputeFilterIndexes, utils.ArgsComputeFilterIndexes{ Tenant: tenant, Context: utils.META_ANY, @@ -1364,7 +1364,7 @@ func testV1FIdxComputeWithAnotherContext(t *testing.T) { expectedIDX := []string{"*string:~*req.Account:1001:ApierTest", "*string:~*req.Account:1001:ApierTest2"} revExpectedIDX := []string{"*string:~*req.Account:1001:ApierTest2", "*string:~*req.Account:1001:ApierTest"} var indexes []string - if err := tFIdxRpc.Call(utils.ApierV1GetFilterIndexes, &AttrGetFilterIndexes{ + if err := tFIdxRpc.Call(utils.APIerSv1GetFilterIndexes, &AttrGetFilterIndexes{ ItemType: utils.MetaAttributes, Tenant: tenant, FilterType: utils.MetaString, @@ -1380,7 +1380,7 @@ func testV1FIdxComputeWithAnotherContext(t *testing.T) { func testV1FIdxRemoveAttributeProfile(t *testing.T) { var result string - if err := tFIdxRpc.Call(utils.ApierV1ComputeFilterIndexes, + if err := tFIdxRpc.Call(utils.APIerSv1ComputeFilterIndexes, utils.ArgsComputeFilterIndexes{ Tenant: tenant, Context: utils.MetaSessionS, @@ -1390,14 +1390,14 @@ func testV1FIdxRemoveAttributeProfile(t *testing.T) { } else if result != utils.OK { t.Error("Unexpected reply returned", result) } - if err := tFIdxRpc.Call(utils.ApierV1RemoveAttributeProfile, &utils.TenantIDWithCache{ + if err := tFIdxRpc.Call(utils.APIerSv1RemoveAttributeProfile, &utils.TenantIDWithCache{ Tenant: tenant, ID: "ApierTest"}, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } - if err := tFIdxRpc.Call(utils.ApierV1RemoveAttributeProfile, &utils.TenantIDWithCache{ + if err := tFIdxRpc.Call(utils.APIerSv1RemoveAttributeProfile, &utils.TenantIDWithCache{ Tenant: tenant, ID: "ApierTest2"}, &result); err != nil { t.Error(err) @@ -1405,20 +1405,20 @@ func testV1FIdxRemoveAttributeProfile(t *testing.T) { t.Error("Unexpected reply returned", result) } var reply *engine.AttributeProfile - if err := tFIdxRpc.Call(utils.ApierV1GetAttributeProfile, + if err := tFIdxRpc.Call(utils.APIerSv1GetAttributeProfile, &utils.TenantIDWithArgDispatcher{TenantID: &utils.TenantID{ Tenant: tenant, ID: "ApierTest2"}}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) } - if err := tFIdxRpc.Call(utils.ApierV1GetAttributeProfile, + if err := tFIdxRpc.Call(utils.APIerSv1GetAttributeProfile, &utils.TenantIDWithArgDispatcher{TenantID: &utils.TenantID{ Tenant: tenant, ID: "ApierTest"}}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) } var indexes []string - if err := tFIdxRpc.Call(utils.ApierV1GetFilterIndexes, &AttrGetFilterIndexes{ + if err := tFIdxRpc.Call(utils.APIerSv1GetFilterIndexes, &AttrGetFilterIndexes{ ItemType: utils.MetaAttributes, Tenant: tenant, FilterType: utils.MetaString, @@ -1444,7 +1444,7 @@ func testV1FIdxPopulateDatabase(t *testing.T) { "*string:~*req.Account:1002"}, }, } - if err := tFIdxRpc.Call(utils.ApierV1SetResourceProfile, resPrf, &result); err != nil { + if err := tFIdxRpc.Call(utils.APIerSv1SetResourceProfile, resPrf, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -1463,7 +1463,7 @@ func testV1FIdxPopulateDatabase(t *testing.T) { "*string:~*req.Account:1002"}, }, } - if err := tFIdxRpc.Call(utils.ApierV1SetResourceProfile, resPrf, &result); err != nil { + if err := tFIdxRpc.Call(utils.APIerSv1SetResourceProfile, resPrf, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -1482,7 +1482,7 @@ func testV1FIdxPopulateDatabase(t *testing.T) { "*string:~*req.Account:1003"}, }, } - if err := tFIdxRpc.Call(utils.ApierV1SetResourceProfile, resPrf, &result); err != nil { + if err := tFIdxRpc.Call(utils.APIerSv1SetResourceProfile, resPrf, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -1518,7 +1518,7 @@ func testV1FIdxGetFilterIndexes1(t *testing.T) { "*prefix:~*req.Account:10:ResProfile3"} sort.Strings(expectedIndexes) var reply []string - if err := tFIdxRpc.Call(utils.ApierV1GetFilterIndexes, arg, &reply); err != nil { + if err := tFIdxRpc.Call(utils.APIerSv1GetFilterIndexes, arg, &reply); err != nil { t.Error(err) } else if sort.Strings(reply); !reflect.DeepEqual(expectedIndexes, reply) { t.Errorf("Expecting: %+v, received: %+v", expectedIndexes, reply) @@ -1548,7 +1548,7 @@ func testV1FIdxGetFilterIndexes2(t *testing.T) { "*string:~*req.Account:2002:ResProfile2"} sort.Strings(expectedIndexes) var reply []string - if err := tFIdxRpc.Call(utils.ApierV1GetFilterIndexes, arg, &reply); err != nil { + if err := tFIdxRpc.Call(utils.APIerSv1GetFilterIndexes, arg, &reply); err != nil { t.Error(err) } else if sort.Strings(reply); !reflect.DeepEqual(expectedIndexes, reply) { t.Errorf("Expecting: %+v, received: %+v", expectedIndexes, reply) @@ -1571,7 +1571,7 @@ func testV1FIdxGetFilterIndexes3(t *testing.T) { "*prefix:~*req.Destination:1001:ResProfile3"} sort.Strings(expectedIndexes) var reply []string - if err := tFIdxRpc.Call(utils.ApierV1GetFilterIndexes, arg, &reply); err != nil { + if err := tFIdxRpc.Call(utils.APIerSv1GetFilterIndexes, arg, &reply); err != nil { t.Error(err) } else if sort.Strings(reply); !reflect.DeepEqual(expectedIndexes, reply) { t.Errorf("Expecting: %+v, received: %+v", expectedIndexes, reply) @@ -1596,7 +1596,7 @@ func testV1FIdxGetFilterIndexes4(t *testing.T) { "*string:~*req.Account:2002:ResProfile2"} sort.Strings(expectedIndexes) var reply []string - if err := tFIdxRpc.Call(utils.ApierV1GetFilterIndexes, arg, &reply); err != nil { + if err := tFIdxRpc.Call(utils.APIerSv1GetFilterIndexes, arg, &reply); err != nil { t.Error(err) } else if sort.Strings(reply); !reflect.DeepEqual(expectedIndexes, reply) { t.Errorf("Expecting: %+v, received: %+v", expectedIndexes, reply) @@ -1617,7 +1617,7 @@ func testV1FIdxSetDispatcherProfile(t *testing.T) { }, } - if err := tFIdxRpc.Call(utils.ApierV1SetDispatcherProfile, + if err := tFIdxRpc.Call(utils.APIerSv1SetDispatcherProfile, dispatcherProfile, &reply); err != nil { t.Error(err) @@ -1638,7 +1638,7 @@ func testV1FIdxSetDispatcherProfile(t *testing.T) { } sort.Strings(expectedIndexes) var idx []string - if err := tFIdxRpc.Call(utils.ApierV1GetFilterIndexes, arg, &idx); err != nil { + if err := tFIdxRpc.Call(utils.APIerSv1GetFilterIndexes, arg, &idx); err != nil { t.Error(err) } else if sort.Strings(idx); !reflect.DeepEqual(len(expectedIndexes), len(idx)) { t.Errorf("Expecting: %+v, received: %+v", len(expectedIndexes), len(idx)) @@ -1656,7 +1656,7 @@ func testV1FIdxSetDispatcherProfile(t *testing.T) { "*string:~*req.Subject:2012:DSP_Test1", } sort.Strings(expectedIndexes) - if err := tFIdxRpc.Call(utils.ApierV1GetFilterIndexes, arg, &idx); err != nil { + if err := tFIdxRpc.Call(utils.APIerSv1GetFilterIndexes, arg, &idx); err != nil { t.Error(err) } else if sort.Strings(idx); !reflect.DeepEqual(len(expectedIndexes), len(idx)) { t.Errorf("Expecting: %+v, received: %+v", len(expectedIndexes), len(idx)) @@ -1674,13 +1674,13 @@ func testV1FIdxSetDispatcherProfile(t *testing.T) { "*string:~*req.Subject:2012:DSP_Test1", } sort.Strings(expectedIndexes) - if err := tFIdxRpc.Call(utils.ApierV1GetFilterIndexes, arg, &idx); err != nil { + if err := tFIdxRpc.Call(utils.APIerSv1GetFilterIndexes, arg, &idx); err != nil { t.Error(err) } else if sort.Strings(idx); !reflect.DeepEqual(expectedIndexes, idx) { t.Errorf("Expecting: %+v, received: %+v", expectedIndexes, idx) } //remove the indexes for *sessions subsystem - if err := tFIdxRpc.Call(utils.ApierV1RemoveFilterIndexes, &AttrRemFilterIndexes{ + if err := tFIdxRpc.Call(utils.APIerSv1RemoveFilterIndexes, &AttrRemFilterIndexes{ ItemType: utils.MetaDispatchers, Tenant: tenant, Context: utils.MetaSessionS}, &reply); err != nil { @@ -1691,7 +1691,7 @@ func testV1FIdxSetDispatcherProfile(t *testing.T) { //verify if was removed var indexes []string - if err := tFIdxRpc.Call(utils.ApierV1GetFilterIndexes, arg, + if err := tFIdxRpc.Call(utils.APIerSv1GetFilterIndexes, arg, &indexes); err.Error() != utils.ErrNotFound.Error() { t.Error(err) } @@ -1708,7 +1708,7 @@ func testV1FIdxSetDispatcherProfile(t *testing.T) { "*string:~*req.Subject:2012:DSP_Test1", } sort.Strings(expectedIndexes) - if err := tFIdxRpc.Call(utils.ApierV1GetFilterIndexes, arg, &idx); err != nil { + if err := tFIdxRpc.Call(utils.APIerSv1GetFilterIndexes, arg, &idx); err != nil { t.Error(err) } else if sort.Strings(idx); !reflect.DeepEqual(len(expectedIndexes), len(idx)) { t.Errorf("Expecting: %+v, received: %+v", len(expectedIndexes), len(idx)) @@ -1718,7 +1718,7 @@ func testV1FIdxSetDispatcherProfile(t *testing.T) { func testV1FIdxComputeDispatcherProfileIndexes(t *testing.T) { var result string //recompute indexes for dispatcherProfile for *sessions subsystem - if err := tFIdxRpc.Call(utils.ApierV1ComputeFilterIndexes, + if err := tFIdxRpc.Call(utils.APIerSv1ComputeFilterIndexes, utils.ArgsComputeFilterIndexes{ Tenant: tenant, Context: utils.MetaSessionS, @@ -1735,7 +1735,7 @@ func testV1FIdxComputeDispatcherProfileIndexes(t *testing.T) { } sort.Strings(expectedIndexes) var indexes []string - if err := tFIdxRpc.Call(utils.ApierV1GetFilterIndexes, &AttrGetFilterIndexes{ + if err := tFIdxRpc.Call(utils.APIerSv1GetFilterIndexes, &AttrGetFilterIndexes{ ItemType: utils.MetaDispatchers, Tenant: tenant, Context: utils.MetaSessionS}, &indexes); err != nil { @@ -1758,7 +1758,7 @@ func testV1FIdxSetDispatcherProfile2(t *testing.T) { }, } - if err := tFIdxRpc.Call(utils.ApierV1SetDispatcherProfile, + if err := tFIdxRpc.Call(utils.APIerSv1SetDispatcherProfile, dispatcherProfile, &reply); err != nil { t.Error(err) @@ -1777,7 +1777,7 @@ func testV1FIdxSetDispatcherProfile2(t *testing.T) { }, } - if err := tFIdxRpc.Call(utils.ApierV1SetDispatcherProfile, + if err := tFIdxRpc.Call(utils.APIerSv1SetDispatcherProfile, dispatcherProfile2, &reply); err != nil { t.Error(err) @@ -1799,7 +1799,7 @@ func testV1FIdxSetDispatcherProfile2(t *testing.T) { } sort.Strings(expectedIndexes) var idx []string - if err := tFIdxRpc.Call(utils.ApierV1GetFilterIndexes, arg, &idx); err != nil { + if err := tFIdxRpc.Call(utils.APIerSv1GetFilterIndexes, arg, &idx); err != nil { t.Error(err) } else if sort.Strings(idx); !reflect.DeepEqual(expectedIndexes, idx) { t.Errorf("Expecting: %+v, received: %+v", expectedIndexes, idx) @@ -1818,13 +1818,13 @@ func testV1FIdxSetDispatcherProfile2(t *testing.T) { "*string:~*req.Subject:2012:DSP_Test1", } sort.Strings(expectedIndexes) - if err := tFIdxRpc.Call(utils.ApierV1GetFilterIndexes, arg, &idx); err != nil { + if err := tFIdxRpc.Call(utils.APIerSv1GetFilterIndexes, arg, &idx); err != nil { t.Error(err) } else if sort.Strings(idx); !reflect.DeepEqual(expectedIndexes, idx) { t.Errorf("Expecting: %+v, received: %+v", expectedIndexes, idx) } //remove the indexes for *sessions subsystem - if err := tFIdxRpc.Call(utils.ApierV1RemoveFilterIndexes, &AttrRemFilterIndexes{ + if err := tFIdxRpc.Call(utils.APIerSv1RemoveFilterIndexes, &AttrRemFilterIndexes{ ItemType: utils.MetaDispatchers, Tenant: tenant, Context: utils.MetaSessionS}, &reply); err != nil { @@ -1835,13 +1835,13 @@ func testV1FIdxSetDispatcherProfile2(t *testing.T) { //verify if indexes was removed for *sessions var indexes []string - if err := tFIdxRpc.Call(utils.ApierV1GetFilterIndexes, arg, + if err := tFIdxRpc.Call(utils.APIerSv1GetFilterIndexes, arg, &indexes); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) } //remove the indexes for *attribute subsystem - if err := tFIdxRpc.Call(utils.ApierV1RemoveFilterIndexes, &AttrRemFilterIndexes{ + if err := tFIdxRpc.Call(utils.APIerSv1RemoveFilterIndexes, &AttrRemFilterIndexes{ ItemType: utils.MetaDispatchers, Tenant: tenant, Context: utils.MetaAttributes}, &reply); err != nil { @@ -1856,7 +1856,7 @@ func testV1FIdxSetDispatcherProfile2(t *testing.T) { Context: utils.MetaAttributes, ItemType: utils.MetaDispatchers, } - if err := tFIdxRpc.Call(utils.ApierV1GetFilterIndexes, arg, + if err := tFIdxRpc.Call(utils.APIerSv1GetFilterIndexes, arg, &idx); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) } @@ -1865,7 +1865,7 @@ func testV1FIdxSetDispatcherProfile2(t *testing.T) { func testV1FIdxComputeDispatcherProfileIndexes2(t *testing.T) { var result string //recompute indexes for dispatcherProfile for *sessions subsystem - if err := tFIdxRpc.Call(utils.ApierV1ComputeFilterIndexes, + if err := tFIdxRpc.Call(utils.APIerSv1ComputeFilterIndexes, utils.ArgsComputeFilterIndexes{ Tenant: tenant, Context: utils.MetaSessionS, @@ -1883,7 +1883,7 @@ func testV1FIdxComputeDispatcherProfileIndexes2(t *testing.T) { } sort.Strings(expectedIndexes) var indexes []string - if err := tFIdxRpc.Call(utils.ApierV1GetFilterIndexes, &AttrGetFilterIndexes{ + if err := tFIdxRpc.Call(utils.APIerSv1GetFilterIndexes, &AttrGetFilterIndexes{ ItemType: utils.MetaDispatchers, Tenant: tenant, Context: utils.MetaSessionS}, &indexes); err != nil { @@ -1893,7 +1893,7 @@ func testV1FIdxComputeDispatcherProfileIndexes2(t *testing.T) { } //recompute indexes for dispatcherProfile for *attributes subsystem - if err := tFIdxRpc.Call(utils.ApierV1ComputeFilterIndexes, + if err := tFIdxRpc.Call(utils.APIerSv1ComputeFilterIndexes, utils.ArgsComputeFilterIndexes{ Tenant: tenant, Context: utils.MetaAttributes, @@ -1910,7 +1910,7 @@ func testV1FIdxComputeDispatcherProfileIndexes2(t *testing.T) { "*string:~*req.Subject:2012:DSP_Test1", } sort.Strings(expectedIndexes) - if err := tFIdxRpc.Call(utils.ApierV1GetFilterIndexes, &AttrGetFilterIndexes{ + if err := tFIdxRpc.Call(utils.APIerSv1GetFilterIndexes, &AttrGetFilterIndexes{ ItemType: utils.MetaDispatchers, Tenant: tenant, Context: utils.MetaAttributes}, &indexes); err != nil { diff --git a/apier/v1/filterindexecache_it_test.go b/apier/v1/filterindexecache_it_test.go index a51c4777e..f5106bbfa 100644 --- a/apier/v1/filterindexecache_it_test.go +++ b/apier/v1/filterindexecache_it_test.go @@ -135,7 +135,7 @@ func testV1FIdxCaRpcConn(t *testing.T) { func testV1FIdxCaFromFolder(t *testing.T) { var reply string attrs := &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "oldtutorial")} - if err := tFIdxCaRpc.Call(utils.ApierV1LoadTariffPlanFromFolder, attrs, &reply); err != nil { + if err := tFIdxCaRpc.Call(utils.APIerSv1LoadTariffPlanFromFolder, attrs, &reply); err != nil { t.Error(err) } time.Sleep(500 * time.Millisecond) @@ -179,7 +179,7 @@ func testV1FIdxCaSetThresholdProfile(t *testing.T) { }, } var result string - if err := tFIdxCaRpc.Call(utils.ApierV1SetFilter, filter, &result); err != nil { + if err := tFIdxCaRpc.Call(utils.APIerSv1SetFilter, filter, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -201,7 +201,7 @@ func testV1FIdxCaSetThresholdProfile(t *testing.T) { }, } - if err := tFIdxCaRpc.Call(utils.ApierV1SetThresholdProfile, tPrfl, &result); err != nil { + if err := tFIdxCaRpc.Call(utils.APIerSv1SetThresholdProfile, tPrfl, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -272,7 +272,7 @@ func testV1FIdxCaUpdateThresholdProfile(t *testing.T) { }, }, } - if err := tFIdxCaRpc.Call(utils.ApierV1SetFilter, filter, &result); err != nil { + if err := tFIdxCaRpc.Call(utils.APIerSv1SetFilter, filter, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -292,7 +292,7 @@ func testV1FIdxCaUpdateThresholdProfile(t *testing.T) { Async: true, }, } - if err := tFIdxCaRpc.Call(utils.ApierV1SetThresholdProfile, tPrfl, &result); err != nil { + if err := tFIdxCaRpc.Call(utils.APIerSv1SetThresholdProfile, tPrfl, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -352,14 +352,14 @@ func testV1FIdxCaUpdateThresholdProfileFromTP(t *testing.T) { }, }, } - if err := tFIdxCaRpc.Call(utils.ApierV1SetFilter, filter, &result); err != nil { + if err := tFIdxCaRpc.Call(utils.APIerSv1SetFilter, filter, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } var reply *engine.ThresholdProfile - if err := tFIdxCaRpc.Call(utils.ApierV1GetThresholdProfile, + if err := tFIdxCaRpc.Call(utils.APIerSv1GetThresholdProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "THD_ACNT_BALANCE_1"}, &reply); err != nil { t.Error(err) } @@ -372,7 +372,7 @@ func testV1FIdxCaUpdateThresholdProfileFromTP(t *testing.T) { } reply.FilterIDs = []string{"TestFilter3"} - if err := tFIdxCaRpc.Call(utils.ApierV1SetThresholdProfile, &engine.ThresholdWithCache{ThresholdProfile: reply}, &result); err != nil { + if err := tFIdxCaRpc.Call(utils.APIerSv1SetThresholdProfile, &engine.ThresholdWithCache{ThresholdProfile: reply}, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -437,7 +437,7 @@ func testV1FIdxCaRemoveThresholdProfile(t *testing.T) { t.Errorf("Expecting : %s, received: %s", eIDs, thIDs) } //Remove threshold profile that was set form api - if err := tFIdxCaRpc.Call(utils.ApierV1RemoveThresholdProfile, + if err := tFIdxCaRpc.Call(utils.APIerSv1RemoveThresholdProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "TEST_PROFILE1"}, &resp); err != nil { t.Error(err) } else if resp != utils.OK { @@ -445,20 +445,20 @@ func testV1FIdxCaRemoveThresholdProfile(t *testing.T) { } var sqp *engine.ThresholdProfile //Test the remove - if err := tFIdxCaRpc.Call(utils.ApierV1GetThresholdProfile, + if err := tFIdxCaRpc.Call(utils.APIerSv1GetThresholdProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "TEST_PROFILE1"}, &sqp); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) } //Remove threshold profile that was set form tariffplan - if err := tFIdxCaRpc.Call(utils.ApierV1RemoveThresholdProfile, + if err := tFIdxCaRpc.Call(utils.APIerSv1RemoveThresholdProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "THD_ACNT_BALANCE_1"}, &resp); err != nil { t.Error(err) } else if resp != utils.OK { t.Error("Unexpected reply returned", resp) } //Test the remove - if err := tFIdxCaRpc.Call(utils.ApierV1GetThresholdProfile, + if err := tFIdxCaRpc.Call(utils.APIerSv1GetThresholdProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "THD_ACNT_BALANCE_1"}, &sqp); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) @@ -517,7 +517,7 @@ func testV1FIdxCaSetStatQueueProfile(t *testing.T) { } var result string - if err := tFIdxCaRpc.Call(utils.ApierV1SetFilter, filter, &result); err != nil { + if err := tFIdxCaRpc.Call(utils.APIerSv1SetFilter, filter, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -544,7 +544,7 @@ func testV1FIdxCaSetStatQueueProfile(t *testing.T) { MinItems: 1, }, } - if err := tFIdxCaRpc.Call(utils.ApierV1SetStatQueueProfile, statConfig, &result); err != nil { + if err := tFIdxCaRpc.Call(utils.APIerSv1SetStatQueueProfile, statConfig, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -670,7 +670,7 @@ func testV1FIdxCaUpdateStatQueueProfile(t *testing.T) { }, } var result string - if err := tFIdxCaRpc.Call(utils.ApierV1SetFilter, filter, &result); err != nil { + if err := tFIdxCaRpc.Call(utils.APIerSv1SetFilter, filter, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -697,7 +697,7 @@ func testV1FIdxCaUpdateStatQueueProfile(t *testing.T) { MinItems: 1, }, } - if err := tFIdxCaRpc.Call(utils.ApierV1SetStatQueueProfile, statConfig, &result); err != nil { + if err := tFIdxCaRpc.Call(utils.APIerSv1SetStatQueueProfile, statConfig, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -745,19 +745,19 @@ func testV1FIdxCaUpdateStatQueueProfileFromTP(t *testing.T) { }, } var result string - if err := tFIdxCaRpc.Call(utils.ApierV1SetFilter, filter, &result); err != nil { + if err := tFIdxCaRpc.Call(utils.APIerSv1SetFilter, filter, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } var reply engine.StatQueueProfile - if err := tFIdxCaRpc.Call(utils.ApierV1GetStatQueueProfile, + if err := tFIdxCaRpc.Call(utils.APIerSv1GetStatQueueProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "Stats1"}, &reply); err != nil { t.Error(err) } reply.FilterIDs = []string{"FLTR_3"} reply.ActivationInterval = &utils.ActivationInterval{ActivationTime: time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC)} - if err := tFIdxCaRpc.Call(utils.ApierV1SetStatQueueProfile, + if err := tFIdxCaRpc.Call(utils.APIerSv1SetStatQueueProfile, &StatQueueWithCache{StatQueueProfile: &reply}, &result); err != nil { t.Error(err) } else if result != utils.OK { @@ -826,7 +826,7 @@ func testV1FIdxCaRemoveStatQueueProfile(t *testing.T) { } var result string //Remove threshold profile that was set form api - if err := tFIdxCaRpc.Call(utils.ApierV1RemoveStatQueueProfile, + if err := tFIdxCaRpc.Call(utils.APIerSv1RemoveStatQueueProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "TEST_PROFILE1"}, &result); err != nil { t.Error(err) } else if result != utils.OK { @@ -834,20 +834,20 @@ func testV1FIdxCaRemoveStatQueueProfile(t *testing.T) { } var sqp *engine.StatQueueProfile //Test the remove - if err := tFIdxCaRpc.Call(utils.ApierV1GetStatQueueProfile, + if err := tFIdxCaRpc.Call(utils.APIerSv1GetStatQueueProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "TEST_PROFILE1"}, &sqp); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) } //Remove threshold profile that was set form tariffplan - if err := tFIdxCaRpc.Call(utils.ApierV1RemoveStatQueueProfile, + if err := tFIdxCaRpc.Call(utils.APIerSv1RemoveStatQueueProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "Stats1"}, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } //Test the remove - if err := tFIdxCaRpc.Call(utils.ApierV1GetStatQueueProfile, + if err := tFIdxCaRpc.Call(utils.APIerSv1GetStatQueueProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "Stats1"}, &sqp); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) @@ -906,7 +906,7 @@ func testV1FIdxCaSetAttributeProfile(t *testing.T) { }, } var result string - if err := tFIdxCaRpc.Call(utils.ApierV1SetFilter, filter, &result); err != nil { + if err := tFIdxCaRpc.Call(utils.APIerSv1SetFilter, filter, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -933,7 +933,7 @@ func testV1FIdxCaSetAttributeProfile(t *testing.T) { Weight: 20, }, } - if err := tFIdxCaRpc.Call(utils.ApierV1SetAttributeProfile, alsPrf, &result); err != nil { + if err := tFIdxCaRpc.Call(utils.APIerSv1SetAttributeProfile, alsPrf, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -999,7 +999,7 @@ func testV1FIdxCaUpdateAttributeProfile(t *testing.T) { }, } var result string - if err := tFIdxCaRpc.Call(utils.ApierV1SetFilter, filter, &result); err != nil { + if err := tFIdxCaRpc.Call(utils.APIerSv1SetFilter, filter, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -1026,7 +1026,7 @@ func testV1FIdxCaUpdateAttributeProfile(t *testing.T) { Weight: 20, }, } - if err := tFIdxCaRpc.Call(utils.ApierV1SetAttributeProfile, alsPrf, &result); err != nil { + if err := tFIdxCaRpc.Call(utils.APIerSv1SetAttributeProfile, alsPrf, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -1072,19 +1072,19 @@ func testV1FIdxCaUpdateAttributeProfileFromTP(t *testing.T) { }, } var result string - if err := tFIdxCaRpc.Call(utils.ApierV1SetFilter, filter, &result); err != nil { + if err := tFIdxCaRpc.Call(utils.APIerSv1SetFilter, filter, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } var reply engine.AttributeProfile - if err := tFIdxCaRpc.Call(utils.ApierV1GetAttributeProfile, + if err := tFIdxCaRpc.Call(utils.APIerSv1GetAttributeProfile, &utils.TenantIDWithArgDispatcher{TenantID: &utils.TenantID{Tenant: "cgrates.org", ID: "ATTR_1"}}, &reply); err != nil { t.Error(err) } reply.FilterIDs = []string{"TestFilter3"} - if err := tFIdxCaRpc.Call(utils.ApierV1SetAttributeProfile, &AttributeWithCache{AttributeProfile: &reply}, &result); err != nil { + if err := tFIdxCaRpc.Call(utils.APIerSv1SetAttributeProfile, &AttributeWithCache{AttributeProfile: &reply}, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -1140,7 +1140,7 @@ func testV1FIdxCaRemoveAttributeProfile(t *testing.T) { t.Error(err) } //Remove threshold profile that was set form api - if err := tFIdxCaRpc.Call(utils.ApierV1RemoveAttributeProfile, &utils.TenantIDWithCache{Tenant: "cgrates.org", + if err := tFIdxCaRpc.Call(utils.APIerSv1RemoveAttributeProfile, &utils.TenantIDWithCache{Tenant: "cgrates.org", ID: "TEST_PROFILE1"}, &resp); err != nil { t.Error(err) } else if resp != utils.OK { @@ -1148,21 +1148,21 @@ func testV1FIdxCaRemoveAttributeProfile(t *testing.T) { } var sqp *engine.AttributeProfile //Test the remove - if err := tFIdxCaRpc.Call(utils.ApierV1GetAttributeProfile, + if err := tFIdxCaRpc.Call(utils.APIerSv1GetAttributeProfile, &utils.TenantIDWithArgDispatcher{TenantID: &utils.TenantID{Tenant: "cgrates.org", ID: "TEST_PROFILE1"}}, &sqp); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) } //Remove threshold profile that was set form tariffplan - if err := tFIdxCaRpc.Call(utils.ApierV1RemoveAttributeProfile, &utils.TenantIDWithCache{Tenant: "cgrates.org", + if err := tFIdxCaRpc.Call(utils.APIerSv1RemoveAttributeProfile, &utils.TenantIDWithCache{Tenant: "cgrates.org", ID: "ATTR_1"}, &resp); err != nil { t.Error(err) } else if resp != utils.OK { t.Error("Unexpected reply returned", resp) } //Test the remove - if err := tFIdxCaRpc.Call(utils.ApierV1GetAttributeProfile, + if err := tFIdxCaRpc.Call(utils.APIerSv1GetAttributeProfile, &utils.TenantIDWithArgDispatcher{TenantID: &utils.TenantID{Tenant: "cgrates.org", ID: "ATTR_1"}}, &sqp); err == nil || err.Error() != utils.ErrNotFound.Error() { @@ -1230,7 +1230,7 @@ func testV1FIdxCaSetResourceProfile(t *testing.T) { }, } var result string - if err := tFIdxCaRpc.Call(utils.ApierV1SetFilter, filter, &result); err != nil { + if err := tFIdxCaRpc.Call(utils.APIerSv1SetFilter, filter, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -1252,7 +1252,7 @@ func testV1FIdxCaSetResourceProfile(t *testing.T) { ThresholdIDs: []string{"Val1", "Val2"}, }, } - if err := tFIdxCaRpc.Call(utils.ApierV1SetResourceProfile, rlsConfig, &result); err != nil { + if err := tFIdxCaRpc.Call(utils.APIerSv1SetResourceProfile, rlsConfig, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -1359,7 +1359,7 @@ func testV1FIdxCaUpdateResourceProfile(t *testing.T) { }, } var result string - if err := tFIdxCaRpc.Call(utils.ApierV1SetFilter, filter, &result); err != nil { + if err := tFIdxCaRpc.Call(utils.APIerSv1SetFilter, filter, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -1381,7 +1381,7 @@ func testV1FIdxCaUpdateResourceProfile(t *testing.T) { ThresholdIDs: []string{"Val1", "Val2"}, }, } - if err := tFIdxCaRpc.Call(utils.ApierV1SetResourceProfile, + if err := tFIdxCaRpc.Call(utils.APIerSv1SetResourceProfile, rlsConfig, &result); err != nil { t.Error(err) } else if result != utils.OK { @@ -1435,20 +1435,20 @@ func testV1FIdxCaUpdateResourceProfileFromTP(t *testing.T) { }, } var result string - if err := tFIdxCaRpc.Call(utils.ApierV1SetFilter, filter, &result); err != nil { + if err := tFIdxCaRpc.Call(utils.APIerSv1SetFilter, filter, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } var reply engine.ResourceProfile - if err := tFIdxCaRpc.Call(utils.ApierV1GetResourceProfile, + if err := tFIdxCaRpc.Call(utils.APIerSv1GetResourceProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "ResGroup1"}, &reply); err != nil { t.Error(err) } reply.FilterIDs = []string{"FLTR_RES_RCFG3"} reply.ActivationInterval = &utils.ActivationInterval{ActivationTime: time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC)} - if err := tFIdxCaRpc.Call(utils.ApierV1SetResourceProfile, &ResourceWithCache{ResourceProfile: &reply}, &result); err != nil { + if err := tFIdxCaRpc.Call(utils.APIerSv1SetResourceProfile, &ResourceWithCache{ResourceProfile: &reply}, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -1514,25 +1514,25 @@ func testV1FIdxCaRemoveResourceProfile(t *testing.T) { t.Error("Unexpected reply returned", resp) } - if err := tFIdxCaRpc.Call(utils.ApierV1RemoveResourceProfile, + if err := tFIdxCaRpc.Call(utils.APIerSv1RemoveResourceProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "RCFG1"}, &resp); err != nil { t.Error(err) } else if resp != utils.OK { t.Error("Unexpected reply returned", resp) } - if err := tFIdxCaRpc.Call(utils.ApierV1RemoveResourceProfile, + if err := tFIdxCaRpc.Call(utils.APIerSv1RemoveResourceProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "ResGroup1"}, &resp); err != nil { t.Error(err) } else if resp != utils.OK { t.Error("Unexpected reply returned", resp) } var sqp *engine.ThresholdProfile - if err := tFIdxCaRpc.Call(utils.ApierV1GetResourceProfile, + if err := tFIdxCaRpc.Call(utils.APIerSv1GetResourceProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "RCFG1"}, &sqp); err == nil && err.Error() != utils.ErrNotFound.Error() { t.Error(err) } - if err := tFIdxCaRpc.Call(utils.ApierV1GetResourceProfile, + if err := tFIdxCaRpc.Call(utils.APIerSv1GetResourceProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "ResGroup1"}, &sqp); err == nil && err.Error() != utils.ErrNotFound.Error() { t.Error(err) diff --git a/apier/v1/filters.go b/apier/v1/filters.go index 789d87856..56534d712 100644 --- a/apier/v1/filters.go +++ b/apier/v1/filters.go @@ -31,15 +31,15 @@ type FilterWithCache struct { } //SetFilter add a new Filter -func (apierV1 *ApierV1) SetFilter(arg *FilterWithCache, reply *string) error { +func (APIerSv1 *APIerSv1) SetFilter(arg *FilterWithCache, reply *string) error { if missing := utils.MissingStructFields(arg.Filter, []string{"Tenant", "ID"}); len(missing) != 0 { return utils.NewErrMandatoryIeMissing(missing...) } - if err := apierV1.DataManager.SetFilter(arg.Filter); err != nil { + if err := APIerSv1.DataManager.SetFilter(arg.Filter); err != nil { return utils.APIErrorHandler(err) } //generate a loadID for CacheFilters and store it in database - if err := apierV1.DataManager.SetLoadIDs(map[string]int64{utils.CacheFilters: time.Now().UnixNano()}); err != nil { + if err := APIerSv1.DataManager.SetLoadIDs(map[string]int64{utils.CacheFilters: time.Now().UnixNano()}); err != nil { return utils.APIErrorHandler(err) } //handle caching for Filter @@ -47,7 +47,7 @@ func (apierV1 *ApierV1) SetFilter(arg *FilterWithCache, reply *string) error { CacheID: utils.CacheFilters, ItemID: arg.TenantID(), } - if err := apierV1.CallCache(GetCacheOpt(arg.Cache), argCache); err != nil { + if err := APIerSv1.CallCache(GetCacheOpt(arg.Cache), argCache); err != nil { return utils.APIErrorHandler(err) } *reply = utils.OK @@ -55,11 +55,11 @@ func (apierV1 *ApierV1) SetFilter(arg *FilterWithCache, reply *string) error { } //GetFilter returns a Filter -func (apierV1 *ApierV1) GetFilter(arg utils.TenantID, reply *engine.Filter) error { +func (APIerSv1 *APIerSv1) GetFilter(arg utils.TenantID, reply *engine.Filter) error { if missing := utils.MissingStructFields(&arg, []string{"Tenant", "ID"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } - if fltr, err := engine.GetFilter(apierV1.DataManager, arg.Tenant, arg.ID, true, true, utils.NonTransactional); err != nil { + if fltr, err := engine.GetFilter(APIerSv1.DataManager, arg.Tenant, arg.ID, true, true, utils.NonTransactional); err != nil { return utils.APIErrorHandler(err) } else { *reply = *fltr @@ -68,12 +68,12 @@ func (apierV1 *ApierV1) GetFilter(arg utils.TenantID, reply *engine.Filter) erro } // GetFilterIDs returns list of Filter IDs registered for a tenant -func (apierV1 *ApierV1) GetFilterIDs(args utils.TenantArgWithPaginator, fltrIDs *[]string) error { +func (APIerSv1 *APIerSv1) GetFilterIDs(args utils.TenantArgWithPaginator, fltrIDs *[]string) error { if missing := utils.MissingStructFields(&args, []string{utils.Tenant}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } prfx := utils.FilterPrefix + args.Tenant + ":" - keys, err := apierV1.DataManager.DataDB().GetKeysForPrefix(prfx) + keys, err := APIerSv1.DataManager.DataDB().GetKeysForPrefix(prfx) if err != nil { return err } @@ -89,15 +89,15 @@ func (apierV1 *ApierV1) GetFilterIDs(args utils.TenantArgWithPaginator, fltrIDs } //RemoveFilter remove a specific filter -func (apierV1 *ApierV1) RemoveFilter(arg utils.TenantIDWithCache, reply *string) error { +func (APIerSv1 *APIerSv1) RemoveFilter(arg utils.TenantIDWithCache, reply *string) error { if missing := utils.MissingStructFields(&arg, []string{"Tenant", "ID"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } - if err := apierV1.DataManager.RemoveFilter(arg.Tenant, arg.ID, utils.NonTransactional); err != nil { + if err := APIerSv1.DataManager.RemoveFilter(arg.Tenant, arg.ID, utils.NonTransactional); err != nil { return utils.APIErrorHandler(err) } //generate a loadID for CacheFilters and store it in database - if err := apierV1.DataManager.SetLoadIDs(map[string]int64{utils.CacheFilters: time.Now().UnixNano()}); err != nil { + if err := APIerSv1.DataManager.SetLoadIDs(map[string]int64{utils.CacheFilters: time.Now().UnixNano()}); err != nil { return utils.APIErrorHandler(err) } //handle caching for Filter @@ -105,7 +105,7 @@ func (apierV1 *ApierV1) RemoveFilter(arg utils.TenantIDWithCache, reply *string) CacheID: utils.CacheFilters, ItemID: arg.TenantID(), } - if err := apierV1.CallCache(GetCacheOpt(arg.Cache), argCache); err != nil { + if err := APIerSv1.CallCache(GetCacheOpt(arg.Cache), argCache); err != nil { return utils.APIErrorHandler(err) } *reply = utils.OK diff --git a/apier/v1/filters_it_test.go b/apier/v1/filters_it_test.go index a797186f4..32483409e 100644 --- a/apier/v1/filters_it_test.go +++ b/apier/v1/filters_it_test.go @@ -112,7 +112,7 @@ func testFilterRpcConn(t *testing.T) { func testFilterGetFilterBeforeSet(t *testing.T) { var reply *engine.Filter - if err := filterRPC.Call(utils.ApierV1GetFilter, &utils.TenantID{Tenant: "cgrates.org", ID: "Filter1"}, &reply); err == nil || + if err := filterRPC.Call(utils.APIerSv1GetFilter, &utils.TenantID{Tenant: "cgrates.org", ID: "Filter1"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) } @@ -138,7 +138,7 @@ func testFilterSetFilter(t *testing.T) { } var result string - if err := filterRPC.Call(utils.ApierV1SetFilter, filter, &result); err != nil { + if err := filterRPC.Call(utils.APIerSv1SetFilter, filter, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -148,7 +148,7 @@ func testFilterSetFilter(t *testing.T) { func testFilterGetFilterIDs(t *testing.T) { expected := []string{"Filter1"} var result []string - if err := filterRPC.Call(utils.ApierV1GetFilterIDs, utils.TenantArgWithPaginator{TenantArg: utils.TenantArg{Tenant: "cgrates.org"}}, &result); err != nil { + if err := filterRPC.Call(utils.APIerSv1GetFilterIDs, utils.TenantArgWithPaginator{TenantArg: utils.TenantArg{Tenant: "cgrates.org"}}, &result); err != nil { t.Error(err) } else if len(expected) != len(result) { t.Errorf("Expecting : %+v, received: %+v", expected, result) @@ -157,7 +157,7 @@ func testFilterGetFilterIDs(t *testing.T) { func testFilterGetFilterAfterSet(t *testing.T) { var reply *engine.Filter - if err := filterRPC.Call(utils.ApierV1GetFilter, &utils.TenantID{Tenant: "cgrates.org", ID: "Filter1"}, &reply); err != nil { + if err := filterRPC.Call(utils.APIerSv1GetFilter, &utils.TenantID{Tenant: "cgrates.org", ID: "Filter1"}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(filter.Filter, reply) { t.Errorf("Expecting : %+v, received: %+v", filter.Filter, reply) @@ -178,7 +178,7 @@ func testFilterUpdateFilter(t *testing.T) { }, } var result string - if err := filterRPC.Call(utils.ApierV1SetFilter, filter, &result); err != nil { + if err := filterRPC.Call(utils.APIerSv1SetFilter, filter, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -187,7 +187,7 @@ func testFilterUpdateFilter(t *testing.T) { func testFilterGetFilterAfterUpdate(t *testing.T) { var reply *engine.Filter - if err := filterRPC.Call(utils.ApierV1GetFilter, + if err := filterRPC.Call(utils.APIerSv1GetFilter, &utils.TenantID{Tenant: "cgrates.org", ID: "Filter1"}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(filter.Filter, reply) { @@ -197,7 +197,7 @@ func testFilterGetFilterAfterUpdate(t *testing.T) { func testFilterRemoveFilter(t *testing.T) { var resp string - if err := filterRPC.Call(utils.ApierV1RemoveFilter, + if err := filterRPC.Call(utils.APIerSv1RemoveFilter, &utils.TenantIDWithCache{Tenant: "cgrates.org", ID: "Filter1"}, &resp); err != nil { t.Error(err) } else if resp != utils.OK { @@ -207,7 +207,7 @@ func testFilterRemoveFilter(t *testing.T) { func testFilterGetFilterAfterRemove(t *testing.T) { var reply *engine.Filter - if err := filterRPC.Call(utils.ApierV1GetFilter, + if err := filterRPC.Call(utils.APIerSv1GetFilter, &utils.TenantID{Tenant: "cgrates.org", ID: "Filter1"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) diff --git a/apier/v1/libapier.go b/apier/v1/libapier.go index 86a2beefd..a9395daae 100644 --- a/apier/v1/libapier.go +++ b/apier/v1/libapier.go @@ -25,7 +25,7 @@ import ( // GetCacheOpt receive the apiOpt and compare with default value // overwrite the default if it's present -// visible in ApierV2 +// visible in APIerSv2 func GetCacheOpt(apiOpt *string) string { cacheOpt := config.CgrConfig().GeneralCfg().DefaultCaching if apiOpt != nil && *apiOpt != utils.EmptyString { diff --git a/apier/v1/precache_it_test.go b/apier/v1/precache_it_test.go index 800a3b270..7a14b7e8f 100644 --- a/apier/v1/precache_it_test.go +++ b/apier/v1/precache_it_test.go @@ -131,7 +131,7 @@ func testPrecacheGetCacheStatsBeforeLoad(t *testing.T) { func testPrecacheFromFolder(t *testing.T) { var reply string attrs := &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "precache")} - if err := precacheRPC.Call(utils.ApierV1LoadTariffPlanFromFolder, attrs, &reply); err != nil { + if err := precacheRPC.Call(utils.APIerSv1LoadTariffPlanFromFolder, attrs, &reply); err != nil { t.Error(err) } time.Sleep(500 * time.Millisecond) diff --git a/apier/v1/resourcesv1.go b/apier/v1/resourcesv1.go index 6e2c3a01c..ae7e2bd4b 100644 --- a/apier/v1/resourcesv1.go +++ b/apier/v1/resourcesv1.go @@ -65,11 +65,11 @@ func (rsv1 *ResourceSv1) GetResource(args *utils.TenantID, reply *engine.Resourc } // GetResourceProfile returns a resource configuration -func (apierV1 *ApierV1) GetResourceProfile(arg utils.TenantID, reply *engine.ResourceProfile) error { +func (APIerSv1 *APIerSv1) GetResourceProfile(arg utils.TenantID, reply *engine.ResourceProfile) error { if missing := utils.MissingStructFields(&arg, []string{"Tenant", "ID"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } - if rcfg, err := apierV1.DataManager.GetResourceProfile(arg.Tenant, arg.ID, true, true, utils.NonTransactional); err != nil { + if rcfg, err := APIerSv1.DataManager.GetResourceProfile(arg.Tenant, arg.ID, true, true, utils.NonTransactional); err != nil { return utils.APIErrorHandler(err) } else { *reply = *rcfg @@ -78,12 +78,12 @@ func (apierV1 *ApierV1) GetResourceProfile(arg utils.TenantID, reply *engine.Res } // GetResourceProfileIDs returns list of resourceProfile IDs registered for a tenant -func (apierV1 *ApierV1) GetResourceProfileIDs(args utils.TenantArgWithPaginator, rsPrfIDs *[]string) error { +func (APIerSv1 *APIerSv1) GetResourceProfileIDs(args utils.TenantArgWithPaginator, rsPrfIDs *[]string) error { if missing := utils.MissingStructFields(&args, []string{utils.Tenant}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } prfx := utils.ResourceProfilesPrefix + args.Tenant + ":" - keys, err := apierV1.DataManager.DataDB().GetKeysForPrefix(prfx) + keys, err := APIerSv1.DataManager.DataDB().GetKeysForPrefix(prfx) if err != nil { return err } @@ -104,17 +104,17 @@ type ResourceWithCache struct { } //SetResourceProfile adds a new resource configuration -func (apierV1 *ApierV1) SetResourceProfile(arg *ResourceWithCache, reply *string) error { +func (APIerSv1 *APIerSv1) SetResourceProfile(arg *ResourceWithCache, reply *string) error { if missing := utils.MissingStructFields(arg.ResourceProfile, []string{"Tenant", "ID"}); len(missing) != 0 { return utils.NewErrMandatoryIeMissing(missing...) } - if err := apierV1.DataManager.SetResourceProfile(arg.ResourceProfile, true); err != nil { + if err := APIerSv1.DataManager.SetResourceProfile(arg.ResourceProfile, true); err != nil { return utils.APIErrorHandler(err) } //generate a loadID for CacheResourceProfiles and CacheResources and store it in database //make 1 insert for both ResourceProfile and Resources instead of 2 loadID := time.Now().UnixNano() - if err := apierV1.DataManager.SetLoadIDs( + if err := APIerSv1.DataManager.SetLoadIDs( map[string]int64{utils.CacheResourceProfiles: loadID, utils.CacheResources: loadID}); err != nil { return utils.APIErrorHandler(err) @@ -124,14 +124,14 @@ func (apierV1 *ApierV1) SetResourceProfile(arg *ResourceWithCache, reply *string CacheID: utils.CacheResourceProfiles, ItemID: arg.TenantID(), } - if err := apierV1.CallCache(GetCacheOpt(arg.Cache), argCache); err != nil { + if err := APIerSv1.CallCache(GetCacheOpt(arg.Cache), argCache); err != nil { return utils.APIErrorHandler(err) } //add the resource only if it's not present - if has, err := apierV1.DataManager.HasData(utils.ResourcesPrefix, arg.ID, arg.Tenant); err != nil { + if has, err := APIerSv1.DataManager.HasData(utils.ResourcesPrefix, arg.ID, arg.Tenant); err != nil { return err } else if !has { - if err := apierV1.DataManager.SetResource( + if err := APIerSv1.DataManager.SetResource( &engine.Resource{Tenant: arg.Tenant, ID: arg.ID, Usages: make(map[string]*engine.ResourceUsage)}); err != nil { @@ -142,7 +142,7 @@ func (apierV1 *ApierV1) SetResourceProfile(arg *ResourceWithCache, reply *string CacheID: utils.CacheResources, ItemID: arg.TenantID(), } - if err := apierV1.CallCache(GetCacheOpt(arg.Cache), argCache); err != nil { + if err := APIerSv1.CallCache(GetCacheOpt(arg.Cache), argCache); err != nil { return utils.APIErrorHandler(err) } } @@ -152,11 +152,11 @@ func (apierV1 *ApierV1) SetResourceProfile(arg *ResourceWithCache, reply *string } //RemoveResourceProfile remove a specific resource configuration -func (apierV1 *ApierV1) RemoveResourceProfile(arg utils.TenantIDWithCache, reply *string) error { +func (APIerSv1 *APIerSv1) RemoveResourceProfile(arg utils.TenantIDWithCache, reply *string) error { if missing := utils.MissingStructFields(&arg, []string{"Tenant", "ID"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } - if err := apierV1.DataManager.RemoveResourceProfile(arg.Tenant, arg.ID, utils.NonTransactional, true); err != nil { + if err := APIerSv1.DataManager.RemoveResourceProfile(arg.Tenant, arg.ID, utils.NonTransactional, true); err != nil { return utils.APIErrorHandler(err) } //handle caching for ResourceProfile @@ -164,16 +164,16 @@ func (apierV1 *ApierV1) RemoveResourceProfile(arg utils.TenantIDWithCache, reply CacheID: utils.CacheResourceProfiles, ItemID: arg.TenantID(), } - if err := apierV1.CallCache(GetCacheOpt(arg.Cache), argCache); err != nil { + if err := APIerSv1.CallCache(GetCacheOpt(arg.Cache), argCache); err != nil { return utils.APIErrorHandler(err) } - if err := apierV1.DataManager.RemoveResource(arg.Tenant, arg.ID, utils.NonTransactional); err != nil { + if err := APIerSv1.DataManager.RemoveResource(arg.Tenant, arg.ID, utils.NonTransactional); err != nil { return utils.APIErrorHandler(err) } //generate a loadID for CacheResourceProfiles and CacheResources and store it in database //make 1 insert for both ResourceProfile and Resources instead of 2 loadID := time.Now().UnixNano() - if err := apierV1.DataManager.SetLoadIDs(map[string]int64{utils.CacheResourceProfiles: loadID, utils.CacheResources: loadID}); err != nil { + if err := APIerSv1.DataManager.SetLoadIDs(map[string]int64{utils.CacheResourceProfiles: loadID, utils.CacheResources: loadID}); err != nil { return utils.APIErrorHandler(err) } //handle caching for Resource @@ -181,7 +181,7 @@ func (apierV1 *ApierV1) RemoveResourceProfile(arg utils.TenantIDWithCache, reply CacheID: utils.CacheResources, ItemID: arg.TenantID(), } - if err := apierV1.CallCache(GetCacheOpt(arg.Cache), argCache); err != nil { + if err := APIerSv1.CallCache(GetCacheOpt(arg.Cache), argCache); err != nil { return utils.APIErrorHandler(err) } *reply = utils.OK diff --git a/apier/v1/resourcesv1_it_test.go b/apier/v1/resourcesv1_it_test.go index 966b85d3e..1d47019fe 100644 --- a/apier/v1/resourcesv1_it_test.go +++ b/apier/v1/resourcesv1_it_test.go @@ -122,7 +122,7 @@ func testV1RsRpcConn(t *testing.T) { func testV1RsFromFolder(t *testing.T) { var reply string attrs := &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "oldtutorial")} - if err := rlsV1Rpc.Call(utils.ApierV1LoadTariffPlanFromFolder, attrs, &reply); err != nil { + if err := rlsV1Rpc.Call(utils.APIerSv1LoadTariffPlanFromFolder, attrs, &reply); err != nil { t.Error(err) } time.Sleep(500 * time.Millisecond) @@ -618,7 +618,7 @@ func testV1RsDBStore(t *testing.T) { func testV1RsGetResourceProfileBeforeSet(t *testing.T) { var reply *string - if err := rlsV1Rpc.Call(utils.ApierV1GetResourceProfile, + if err := rlsV1Rpc.Call(utils.APIerSv1GetResourceProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "RCFG1"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) @@ -647,7 +647,7 @@ func testV1RsSetResourceProfile(t *testing.T) { var result string - if err := rlsV1Rpc.Call(utils.ApierV1SetResourceProfile, rlsConfig, &result); err != nil { + if err := rlsV1Rpc.Call(utils.APIerSv1SetResourceProfile, rlsConfig, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -657,7 +657,7 @@ func testV1RsSetResourceProfile(t *testing.T) { func testV1RsGetResourceProfileIDs(t *testing.T) { expected := []string{"ResGroup2", "ResGroup1", "ResGroup3", "RES_GR_TEST"} var result []string - if err := rlsV1Rpc.Call(utils.ApierV1GetResourceProfileIDs, utils.TenantArgWithPaginator{TenantArg: utils.TenantArg{Tenant: "cgrates.org"}}, &result); err != nil { + if err := rlsV1Rpc.Call(utils.APIerSv1GetResourceProfileIDs, utils.TenantArgWithPaginator{TenantArg: utils.TenantArg{Tenant: "cgrates.org"}}, &result); err != nil { t.Error(err) } else if len(expected) != len(result) { t.Errorf("Expecting : %+v, received: %+v", expected, result) @@ -666,7 +666,7 @@ func testV1RsGetResourceProfileIDs(t *testing.T) { func testV1RsGetResourceProfileAfterSet(t *testing.T) { var reply *engine.ResourceProfile - if err := rlsV1Rpc.Call(utils.ApierV1GetResourceProfile, + if err := rlsV1Rpc.Call(utils.APIerSv1GetResourceProfile, &utils.TenantID{Tenant: "cgrates.org", ID: rlsConfig.ID}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(reply, rlsConfig.ResourceProfile) { @@ -677,7 +677,7 @@ func testV1RsGetResourceProfileAfterSet(t *testing.T) { func testV1RsUpdateResourceProfile(t *testing.T) { var result string rlsConfig.FilterIDs = []string{"*string:~*req.Account:1001", "*prefix:~*req.DST:10"} - if err := rlsV1Rpc.Call(utils.ApierV1SetResourceProfile, rlsConfig, &result); err != nil { + if err := rlsV1Rpc.Call(utils.APIerSv1SetResourceProfile, rlsConfig, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -686,7 +686,7 @@ func testV1RsUpdateResourceProfile(t *testing.T) { func testV1RsGetResourceProfileAfterUpdate(t *testing.T) { var reply *engine.ResourceProfile - if err := rlsV1Rpc.Call(utils.ApierV1GetResourceProfile, + if err := rlsV1Rpc.Call(utils.APIerSv1GetResourceProfile, &utils.TenantID{Tenant: "cgrates.org", ID: rlsConfig.ID}, &reply); err != nil { t.Error(err) } else { @@ -700,13 +700,13 @@ func testV1RsGetResourceProfileAfterUpdate(t *testing.T) { func testV1RsRemResourceProfile(t *testing.T) { var resp string - if err := rlsV1Rpc.Call(utils.ApierV1RemoveResourceProfile, + if err := rlsV1Rpc.Call(utils.APIerSv1RemoveResourceProfile, &utils.TenantID{Tenant: "cgrates.org", ID: rlsConfig.ID}, &resp); err != nil { t.Error(err) } else if resp != utils.OK { t.Error("Unexpected reply returned", resp) } - if err := rlsV1Rpc.Call(utils.ApierV1RemoveResourceProfile, + if err := rlsV1Rpc.Call(utils.APIerSv1RemoveResourceProfile, &utils.TenantID{Tenant: "cgrates.org", ID: rlsConfig.ID}, &resp); err.Error() != utils.ErrNotFound.Error() { t.Errorf("Expected error: %v recived: %v", utils.ErrNotFound, err) } @@ -714,7 +714,7 @@ func testV1RsRemResourceProfile(t *testing.T) { func testV1RsGetResourceProfileAfterDelete(t *testing.T) { var reply *string - if err := rlsV1Rpc.Call(utils.ApierV1GetResourceProfile, + if err := rlsV1Rpc.Call(utils.APIerSv1GetResourceProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "RCFG1"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) diff --git a/apier/v1/scheduler.go b/apier/v1/scheduler.go index 83421ac87..f31938adf 100644 --- a/apier/v1/scheduler.go +++ b/apier/v1/scheduler.go @@ -100,7 +100,7 @@ import ( ] */ -func (self *ApierV1) GetScheduledActions(args scheduler.ArgsGetScheduledActions, reply *[]*scheduler.ScheduledAction) error { +func (self *APIerSv1) GetScheduledActions(args scheduler.ArgsGetScheduledActions, reply *[]*scheduler.ScheduledAction) error { sched := self.SchedulerService.GetScheduler() if sched == nil { return errors.New(utils.SchedulerNotRunningCaps) @@ -118,7 +118,7 @@ type AttrsExecuteScheduledActions struct { TimeStart, TimeEnd time.Time // replay the action timings between the two dates } -func (self *ApierV1) ExecuteScheduledActions(attr AttrsExecuteScheduledActions, reply *string) error { +func (self *APIerSv1) ExecuteScheduledActions(attr AttrsExecuteScheduledActions, reply *string) error { if attr.ActionPlanID != "" { // execute by ActionPlanID apl, err := self.DataManager.GetActionPlan(attr.ActionPlanID, false, utils.NonTransactional) if err != nil { diff --git a/apier/v1/schedulers_it_test.go b/apier/v1/schedulers_it_test.go index 7b4af1d74..5bd96623a 100644 --- a/apier/v1/schedulers_it_test.go +++ b/apier/v1/schedulers_it_test.go @@ -146,7 +146,7 @@ func testSchedRpcConn(t *testing.T) { func testSchedFromFolder(t *testing.T) { var reply string attrs := &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "tutorial")} - if err := schedRpc.Call(utils.ApierV1LoadTariffPlanFromFolder, attrs, &reply); err != nil { + if err := schedRpc.Call(utils.APIerSv1LoadTariffPlanFromFolder, attrs, &reply); err != nil { t.Error(err) } time.Sleep(500 * time.Millisecond) @@ -162,7 +162,7 @@ func testSchedVeifyAllAccounts(t *testing.T) { Tenant: "cgrates.org", Account: "1001", } - if err := schedRpc.Call(utils.ApierV2GetAccount, attrs, &acnt); err != nil { + if err := schedRpc.Call(utils.APIerSv2GetAccount, attrs, &acnt); err != nil { t.Error(err) } else if rply := acnt.BalanceMap[utils.MONETARY].GetTotalValue(); rply != 10 { t.Errorf("Expecting: %v, received: %v", @@ -172,7 +172,7 @@ func testSchedVeifyAllAccounts(t *testing.T) { Tenant: "cgrates.org", Account: "1002", } - if err := schedRpc.Call(utils.ApierV2GetAccount, attrs, &acnt); err != nil { + if err := schedRpc.Call(utils.APIerSv2GetAccount, attrs, &acnt); err != nil { t.Error(err) } else if rply := acnt.BalanceMap[utils.MONETARY].GetTotalValue(); rply != 10 { t.Errorf("Expecting: %v, received: %v", @@ -182,7 +182,7 @@ func testSchedVeifyAllAccounts(t *testing.T) { Tenant: "cgrates.org", Account: "1003", } - if err := schedRpc.Call(utils.ApierV2GetAccount, attrs, &acnt); err != nil { + if err := schedRpc.Call(utils.APIerSv2GetAccount, attrs, &acnt); err != nil { t.Error(err) } else if rply := acnt.BalanceMap[utils.MONETARY].GetTotalValue(); rply != 10 { t.Errorf("Expecting: %v, received: %v", @@ -199,7 +199,7 @@ func testSchedVeifyAccount1001(t *testing.T) { Tenant: "cgrates.org", Account: "1001", } - if err := schedRpc.Call(utils.ApierV2GetAccount, attrs, &acnt); err != nil { + if err := schedRpc.Call(utils.APIerSv2GetAccount, attrs, &acnt); err != nil { t.Error(err) } else if rply := acnt.BalanceMap[utils.MONETARY].GetTotalValue(); rply != 10 { t.Errorf("Expecting: %v, received: %v", @@ -211,7 +211,7 @@ func testSchedVeifyAccount1001(t *testing.T) { Tenant: "cgrates.org", Account: "1002", } - if err := schedRpc.Call(utils.ApierV2GetAccount, attrs, &acnt); err != nil { + if err := schedRpc.Call(utils.APIerSv2GetAccount, attrs, &acnt); err != nil { t.Error(err) } else if lenBal := len(acnt.BalanceMap[utils.MONETARY]); lenBal != 0 { t.Errorf("Expecting: %v, received: %v", @@ -222,7 +222,7 @@ func testSchedVeifyAccount1001(t *testing.T) { Tenant: "cgrates.org", Account: "1003", } - if err := schedRpc.Call(utils.ApierV2GetAccount, attrs, &acnt); err != nil { + if err := schedRpc.Call(utils.APIerSv2GetAccount, attrs, &acnt); err != nil { t.Error(err) } else if lenBal := len(acnt.BalanceMap[utils.MONETARY]); lenBal != 0 { t.Errorf("Expecting: %v, received: %v", @@ -240,7 +240,7 @@ func testSchedVeifyAccount1002and1003(t *testing.T) { Tenant: "cgrates.org", Account: "1001", } - if err := schedRpc.Call(utils.ApierV2GetAccount, attrs, &acnt); err != nil { + if err := schedRpc.Call(utils.APIerSv2GetAccount, attrs, &acnt); err != nil { t.Error(err) } else if lenBal := len(acnt.BalanceMap[utils.MONETARY]); lenBal != 0 { t.Errorf("Expecting: %v, received: %v", @@ -251,7 +251,7 @@ func testSchedVeifyAccount1002and1003(t *testing.T) { Tenant: "cgrates.org", Account: "1002", } - if err := schedRpc.Call(utils.ApierV2GetAccount, attrs, &acnt); err != nil { + if err := schedRpc.Call(utils.APIerSv2GetAccount, attrs, &acnt); err != nil { t.Error(err) } else if rply := acnt.BalanceMap[utils.MONETARY].GetTotalValue(); rply != 10 { t.Errorf("Expecting: %v, received: %v", @@ -262,7 +262,7 @@ func testSchedVeifyAccount1002and1003(t *testing.T) { Tenant: "cgrates.org", Account: "1003", } - if err := schedRpc.Call(utils.ApierV2GetAccount, attrs, &acnt); err != nil { + if err := schedRpc.Call(utils.APIerSv2GetAccount, attrs, &acnt); err != nil { t.Error(err) } else if rply := acnt.BalanceMap[utils.MONETARY].GetTotalValue(); rply != 10 { t.Errorf("Expecting: %v, received: %v", diff --git a/apier/v1/sessions_thresholds_it_test.go b/apier/v1/sessions_thresholds_it_test.go index 9938ef549..f12fae7e2 100755 --- a/apier/v1/sessions_thresholds_it_test.go +++ b/apier/v1/sessions_thresholds_it_test.go @@ -143,7 +143,7 @@ func testSessionSv1ItTPFromFolder(t *testing.T) { attrs := &utils.AttrLoadTpFromFolder{ FolderPath: path.Join(*dataDir, "tariffplans", "testit")} var loadInst utils.LoadInstance - if err := sSApierRpc2.Call(utils.ApierV2LoadTariffPlanFromFolder, attrs, &loadInst); err != nil { + if err := sSApierRpc2.Call(utils.APIerSv2LoadTariffPlanFromFolder, attrs, &loadInst); err != nil { t.Error(err) } time.Sleep(500 * time.Millisecond) @@ -165,7 +165,7 @@ func testSessionSv1ItGetThreshold(t *testing.T) { Async: false, } var reply *engine.ThresholdProfile - if err := sSApierRpc2.Call(utils.ApierV1GetThresholdProfile, + if err := sSApierRpc2.Call(utils.APIerSv1GetThresholdProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "THD_ACNT_1001"}, &reply); err != nil { t.Error(err) @@ -188,7 +188,7 @@ func testSessionSv1ItGetThreshold(t *testing.T) { // Uuid will be generated // so we will compare ID from Account and Value from BalanceMap var reply2 *engine.Account - if err := sSApierRpc2.Call(utils.ApierV2GetAccount, + if err := sSApierRpc2.Call(utils.APIerSv2GetAccount, &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "1001"}, &reply2); err != nil { t.Error(err) @@ -247,7 +247,7 @@ func testSessionSv1ItAuth(t *testing.T) { // Uuid will be generated // so we will compare ID from Account and Value from BalanceMap var reply *engine.Account - if err := sSApierRpc2.Call(utils.ApierV2GetAccount, + if err := sSApierRpc2.Call(utils.APIerSv2GetAccount, &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "1001"}, &reply); err != nil { t.Error(err) @@ -310,7 +310,7 @@ func testSessionSv1ItInitiateSession(t *testing.T) { // Uuid will be generated // so we will compare ID from Account and Value from BalanceMap var reply *engine.Account - if err := sSApierRpc2.Call(utils.ApierV2GetAccount, + if err := sSApierRpc2.Call(utils.APIerSv2GetAccount, &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "1001"}, &reply); err != nil { t.Error(err) @@ -367,7 +367,7 @@ func testSessionSv1ItTerminateSession(t *testing.T) { // Uuid will be generated // so we will compare ID from Account and Value from BalanceMap var reply2 *engine.Account - if err := sSApierRpc2.Call(utils.ApierV2GetAccount, + if err := sSApierRpc2.Call(utils.APIerSv2GetAccount, &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "1001"}, &reply2); err != nil { t.Error(err) @@ -509,7 +509,7 @@ func testSessionSv1ItTerminateNotFoundThreshold(t *testing.T) { func testSessionSv1ItAuthNotFoundThresholdAndStats(t *testing.T) { var resp string - if err := sSApierRpc2.Call(utils.ApierV1RemoveStatQueueProfile, + if err := sSApierRpc2.Call(utils.APIerSv1RemoveStatQueueProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "Stat_2"}, &resp); err != nil { t.Error(err) } else if resp != utils.OK { diff --git a/apier/v1/sessionsv1_it_test.go b/apier/v1/sessionsv1_it_test.go index e0d7a450a..0e5f8d8a1 100644 --- a/apier/v1/sessionsv1_it_test.go +++ b/apier/v1/sessionsv1_it_test.go @@ -190,7 +190,7 @@ func testSSv1ItTPFromFolder(t *testing.T) { attrs := &utils.AttrLoadTpFromFolder{ FolderPath: path.Join(*dataDir, "tariffplans", "testit")} var loadInst utils.LoadInstance - if err := sSApierRpc.Call(utils.ApierV2LoadTariffPlanFromFolder, + if err := sSApierRpc.Call(utils.APIerSv2LoadTariffPlanFromFolder, attrs, &loadInst); err != nil { t.Error(err) } @@ -737,7 +737,7 @@ func testSSv1ItForceUpdateSession(t *testing.T) { var acnt *engine.Account attrs := &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "1001"} eAcntVal := 9.55 - if err := sSApierRpc.Call(utils.ApierV2GetAccount, attrs, &acnt); err != nil { + if err := sSApierRpc.Call(utils.APIerSv2GetAccount, attrs, &acnt); err != nil { t.Error(err) } else if acnt.BalanceMap[utils.MONETARY].GetTotalValue() != eAcntVal { t.Errorf("Expected: %f, received: %f", eAcntVal, acnt.BalanceMap[utils.MONETARY].GetTotalValue()) @@ -807,7 +807,7 @@ func testSSv1ItForceUpdateSession(t *testing.T) { } eAcntVal = 9.4 - if err := sSApierRpc.Call(utils.ApierV2GetAccount, attrs, &acnt); err != nil { + if err := sSApierRpc.Call(utils.APIerSv2GetAccount, attrs, &acnt); err != nil { t.Error(err) } else if acnt.BalanceMap[utils.MONETARY].GetTotalValue() != eAcntVal { t.Errorf("Expected: %f, received: %f", eAcntVal, acnt.BalanceMap[utils.MONETARY].GetTotalValue()) @@ -824,7 +824,7 @@ func testSSv1ItForceUpdateSession(t *testing.T) { err.Error() != utils.ErrNotFound.Error() { t.Error(err) } - if err := sSApierRpc.Call(utils.ApierV2GetAccount, attrs, &acnt); err != nil { + if err := sSApierRpc.Call(utils.APIerSv2GetAccount, attrs, &acnt); err != nil { t.Error(err) } else if acnt.BalanceMap[utils.MONETARY].GetTotalValue() != eAcntVal { // no monetary change bacause the sessin was terminated t.Errorf("Expected: %f, received: %f", eAcntVal, acnt.BalanceMap[utils.MONETARY].GetTotalValue()) @@ -879,7 +879,7 @@ func testSSv1ItDynamicDebit(t *testing.T) { }, } var reply string - if err := sSApierRpc.Call(utils.ApierV2SetBalance, attrSetBalance, &reply); err != nil { + if err := sSApierRpc.Call(utils.APIerSv2SetBalance, attrSetBalance, &reply); err != nil { t.Error(err) } else if reply != utils.OK { t.Errorf("Received: %s", reply) @@ -890,7 +890,7 @@ func testSSv1ItDynamicDebit(t *testing.T) { Account: attrSetBalance.Account, } eAcntVal := 2 * float64(time.Second) - if err := sSApierRpc.Call(utils.ApierV2GetAccount, attrs, &acnt); err != nil { + if err := sSApierRpc.Call(utils.APIerSv2GetAccount, attrs, &acnt); err != nil { t.Error(err) } else if acnt.BalanceMap[utils.VOICE].GetTotalValue() != eAcntVal { t.Errorf("Expecting: %v, received: %v", @@ -936,7 +936,7 @@ func testSSv1ItDynamicDebit(t *testing.T) { } time.Sleep(time.Millisecond) eAcntVal -= float64(time.Millisecond) * 30 * 2 // 2 session - if err := sSApierRpc.Call(utils.ApierV2GetAccount, attrs, &acnt); err != nil { + if err := sSApierRpc.Call(utils.APIerSv2GetAccount, attrs, &acnt); err != nil { t.Error(err) } else if acnt.BalanceMap[utils.VOICE].GetTotalValue() != eAcntVal { t.Errorf("Expecting: %v, received: %v", @@ -944,7 +944,7 @@ func testSSv1ItDynamicDebit(t *testing.T) { } time.Sleep(10 * time.Millisecond) - if err := sSApierRpc.Call(utils.ApierV2GetAccount, attrs, &acnt); err != nil { + if err := sSApierRpc.Call(utils.APIerSv2GetAccount, attrs, &acnt); err != nil { t.Error(err) } else if acnt.BalanceMap[utils.VOICE].GetTotalValue() != eAcntVal { t.Errorf("Expecting: %v, received: %v", @@ -952,7 +952,7 @@ func testSSv1ItDynamicDebit(t *testing.T) { } time.Sleep(20 * time.Millisecond) eAcntVal -= float64(time.Millisecond) * 30 * 2 // 2 session - if err := sSApierRpc.Call(utils.ApierV2GetAccount, attrs, &acnt); err != nil { + if err := sSApierRpc.Call(utils.APIerSv2GetAccount, attrs, &acnt); err != nil { t.Error(err) } else if acnt.BalanceMap[utils.VOICE].GetTotalValue() != eAcntVal { t.Errorf("Expecting: %v, received: %v", diff --git a/apier/v1/stats.go b/apier/v1/stats.go index b3da9707a..072421f63 100644 --- a/apier/v1/stats.go +++ b/apier/v1/stats.go @@ -26,11 +26,11 @@ import ( ) // GetStatQueueProfile returns a StatQueue profile -func (apierV1 *ApierV1) GetStatQueueProfile(arg *utils.TenantID, reply *engine.StatQueueProfile) (err error) { +func (APIerSv1 *APIerSv1) GetStatQueueProfile(arg *utils.TenantID, reply *engine.StatQueueProfile) (err error) { if missing := utils.MissingStructFields(arg, []string{"Tenant", "ID"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } - if sCfg, err := apierV1.DataManager.GetStatQueueProfile(arg.Tenant, arg.ID, + if sCfg, err := APIerSv1.DataManager.GetStatQueueProfile(arg.Tenant, arg.ID, true, true, utils.NonTransactional); err != nil { return utils.APIErrorHandler(err) } else { @@ -40,12 +40,12 @@ func (apierV1 *ApierV1) GetStatQueueProfile(arg *utils.TenantID, reply *engine.S } // GetStatQueueProfileIDs returns list of statQueueProfile IDs registered for a tenant -func (apierV1 *ApierV1) GetStatQueueProfileIDs(args utils.TenantArgWithPaginator, stsPrfIDs *[]string) error { +func (APIerSv1 *APIerSv1) GetStatQueueProfileIDs(args utils.TenantArgWithPaginator, stsPrfIDs *[]string) error { if missing := utils.MissingStructFields(&args, []string{utils.Tenant}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } prfx := utils.StatQueueProfilePrefix + args.Tenant + ":" - keys, err := apierV1.DataManager.DataDB().GetKeysForPrefix(prfx) + keys, err := APIerSv1.DataManager.DataDB().GetKeysForPrefix(prfx) if err != nil { return err } @@ -66,17 +66,17 @@ type StatQueueWithCache struct { } // SetStatQueueProfile alters/creates a StatQueueProfile -func (apierV1 *ApierV1) SetStatQueueProfile(arg *StatQueueWithCache, reply *string) error { +func (APIerSv1 *APIerSv1) SetStatQueueProfile(arg *StatQueueWithCache, reply *string) error { if missing := utils.MissingStructFields(arg.StatQueueProfile, []string{"Tenant", "ID"}); len(missing) != 0 { return utils.NewErrMandatoryIeMissing(missing...) } - if err := apierV1.DataManager.SetStatQueueProfile(arg.StatQueueProfile, true); err != nil { + if err := APIerSv1.DataManager.SetStatQueueProfile(arg.StatQueueProfile, true); err != nil { return utils.APIErrorHandler(err) } //generate a loadID for CacheStatQueueProfiles and CacheStatQueues and store it in database //make 1 insert for both StatQueueProfile and StatQueue instead of 2 loadID := time.Now().UnixNano() - if err := apierV1.DataManager.SetLoadIDs(map[string]int64{utils.CacheStatQueueProfiles: loadID, utils.CacheStatQueues: loadID}); err != nil { + if err := APIerSv1.DataManager.SetLoadIDs(map[string]int64{utils.CacheStatQueueProfiles: loadID, utils.CacheStatQueues: loadID}); err != nil { return utils.APIErrorHandler(err) } //handle caching for StatQueueProfile @@ -84,10 +84,10 @@ func (apierV1 *ApierV1) SetStatQueueProfile(arg *StatQueueWithCache, reply *stri CacheID: utils.CacheStatQueueProfiles, ItemID: arg.TenantID(), } - if err := apierV1.CallCache(GetCacheOpt(arg.Cache), argCache); err != nil { + if err := APIerSv1.CallCache(GetCacheOpt(arg.Cache), argCache); err != nil { return utils.APIErrorHandler(err) } - if has, err := apierV1.DataManager.HasData(utils.StatQueuePrefix, arg.ID, arg.Tenant); err != nil { + if has, err := APIerSv1.DataManager.HasData(utils.StatQueuePrefix, arg.ID, arg.Tenant); err != nil { return err } else if !has { //compose metrics for StatQueue @@ -99,7 +99,7 @@ func (apierV1 *ApierV1) SetStatQueueProfile(arg *StatQueueWithCache, reply *stri metrics[metric.MetricID] = stsMetric } } - if err := apierV1.DataManager.SetStatQueue(&engine.StatQueue{Tenant: arg.Tenant, ID: arg.ID, SQMetrics: metrics}); err != nil { + if err := APIerSv1.DataManager.SetStatQueue(&engine.StatQueue{Tenant: arg.Tenant, ID: arg.ID, SQMetrics: metrics}); err != nil { return utils.APIErrorHandler(err) } //handle caching for StatQueues @@ -107,7 +107,7 @@ func (apierV1 *ApierV1) SetStatQueueProfile(arg *StatQueueWithCache, reply *stri CacheID: utils.CacheStatQueues, ItemID: arg.TenantID(), } - if err := apierV1.CallCache(GetCacheOpt(arg.Cache), argCache); err != nil { + if err := APIerSv1.CallCache(GetCacheOpt(arg.Cache), argCache); err != nil { return utils.APIErrorHandler(err) } } @@ -117,11 +117,11 @@ func (apierV1 *ApierV1) SetStatQueueProfile(arg *StatQueueWithCache, reply *stri } // Remove a specific stat configuration -func (apierV1 *ApierV1) RemoveStatQueueProfile(args *utils.TenantIDWithCache, reply *string) error { +func (APIerSv1 *APIerSv1) RemoveStatQueueProfile(args *utils.TenantIDWithCache, reply *string) error { if missing := utils.MissingStructFields(args, []string{"Tenant", "ID"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } - if err := apierV1.DataManager.RemoveStatQueueProfile(args.Tenant, args.ID, utils.NonTransactional, true); err != nil { + if err := APIerSv1.DataManager.RemoveStatQueueProfile(args.Tenant, args.ID, utils.NonTransactional, true); err != nil { return utils.APIErrorHandler(err) } //handle caching for StatQueueProfile @@ -129,16 +129,16 @@ func (apierV1 *ApierV1) RemoveStatQueueProfile(args *utils.TenantIDWithCache, re CacheID: utils.CacheStatQueueProfiles, ItemID: args.TenantID(), } - if err := apierV1.CallCache(GetCacheOpt(args.Cache), argCache); err != nil { + if err := APIerSv1.CallCache(GetCacheOpt(args.Cache), argCache); err != nil { return utils.APIErrorHandler(err) } - if err := apierV1.DataManager.RemoveStatQueue(args.Tenant, args.ID, utils.NonTransactional); err != nil { + if err := APIerSv1.DataManager.RemoveStatQueue(args.Tenant, args.ID, utils.NonTransactional); err != nil { return utils.APIErrorHandler(err) } //generate a loadID for CacheStatQueueProfiles and CacheStatQueues and store it in database //make 1 insert for both StatQueueProfile and StatQueue instead of 2 loadID := time.Now().UnixNano() - if err := apierV1.DataManager.SetLoadIDs(map[string]int64{utils.CacheStatQueueProfiles: loadID, utils.CacheStatQueues: loadID}); err != nil { + if err := APIerSv1.DataManager.SetLoadIDs(map[string]int64{utils.CacheStatQueueProfiles: loadID, utils.CacheStatQueues: loadID}); err != nil { return utils.APIErrorHandler(err) } //handle caching for StatQueues @@ -146,7 +146,7 @@ func (apierV1 *ApierV1) RemoveStatQueueProfile(args *utils.TenantIDWithCache, re CacheID: utils.CacheStatQueues, ItemID: args.TenantID(), } - if err := apierV1.CallCache(GetCacheOpt(args.Cache), argCache); err != nil { + if err := APIerSv1.CallCache(GetCacheOpt(args.Cache), argCache); err != nil { return utils.APIErrorHandler(err) } *reply = utils.OK diff --git a/apier/v1/stats_it_test.go b/apier/v1/stats_it_test.go index 717cdf7c0..b3e7814b7 100644 --- a/apier/v1/stats_it_test.go +++ b/apier/v1/stats_it_test.go @@ -140,7 +140,7 @@ func testV1STSRpcConn(t *testing.T) { func testV1STSFromFolder(t *testing.T) { var reply string attrs := &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "oldtutorial")} - if err := stsV1Rpc.Call(utils.ApierV1LoadTariffPlanFromFolder, attrs, &reply); err != nil { + if err := stsV1Rpc.Call(utils.APIerSv1LoadTariffPlanFromFolder, attrs, &reply); err != nil { t.Error(err) } time.Sleep(500 * time.Millisecond) @@ -352,12 +352,12 @@ func testV1STSSetStatQueueProfile(t *testing.T) { }, } var result string - if err := stsV1Rpc.Call(utils.ApierV1SetFilter, filter, &result); err != nil { + if err := stsV1Rpc.Call(utils.APIerSv1SetFilter, filter, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } - if err := stsV1Rpc.Call(utils.ApierV1GetStatQueueProfile, + if err := stsV1Rpc.Call(utils.APIerSv1GetStatQueueProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "TEST_PROFILE1"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) @@ -389,12 +389,12 @@ func testV1STSSetStatQueueProfile(t *testing.T) { }, } - if err := stsV1Rpc.Call(utils.ApierV1SetStatQueueProfile, statConfig, &result); err != nil { + if err := stsV1Rpc.Call(utils.APIerSv1SetStatQueueProfile, statConfig, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } - if err := stsV1Rpc.Call(utils.ApierV1GetStatQueueProfile, + if err := stsV1Rpc.Call(utils.APIerSv1GetStatQueueProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "TEST_PROFILE1"}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(statConfig.StatQueueProfile, reply) { @@ -405,7 +405,7 @@ func testV1STSSetStatQueueProfile(t *testing.T) { func testV1STSGetStatQueueProfileIDs(t *testing.T) { expected := []string{"Stats1", "TEST_PROFILE1"} var result []string - if err := stsV1Rpc.Call(utils.ApierV1GetStatQueueProfileIDs, utils.TenantArgWithPaginator{TenantArg: utils.TenantArg{Tenant: "cgrates.org"}}, &result); err != nil { + if err := stsV1Rpc.Call(utils.APIerSv1GetStatQueueProfileIDs, utils.TenantArgWithPaginator{TenantArg: utils.TenantArg{Tenant: "cgrates.org"}}, &result); err != nil { t.Error(err) } else if len(expected) != len(result) { t.Errorf("Expecting : %+v, received: %+v", expected, result) @@ -431,19 +431,19 @@ func testV1STSUpdateStatQueueProfile(t *testing.T) { }, }, } - if err := stsV1Rpc.Call(utils.ApierV1SetFilter, filter, &result); err != nil { + if err := stsV1Rpc.Call(utils.APIerSv1SetFilter, filter, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } statConfig.FilterIDs = []string{"FLTR_1", "FLTR_2"} - if err := stsV1Rpc.Call(utils.ApierV1SetStatQueueProfile, statConfig, &result); err != nil { + if err := stsV1Rpc.Call(utils.APIerSv1SetStatQueueProfile, statConfig, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } var reply *engine.StatQueueProfile - if err := stsV1Rpc.Call(utils.ApierV1GetStatQueueProfile, + if err := stsV1Rpc.Call(utils.APIerSv1GetStatQueueProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "TEST_PROFILE1"}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(statConfig.StatQueueProfile, reply) { @@ -453,18 +453,18 @@ func testV1STSUpdateStatQueueProfile(t *testing.T) { func testV1STSRemoveStatQueueProfile(t *testing.T) { var resp string - if err := stsV1Rpc.Call(utils.ApierV1RemoveStatQueueProfile, + if err := stsV1Rpc.Call(utils.APIerSv1RemoveStatQueueProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "TEST_PROFILE1"}, &resp); err != nil { t.Error(err) } else if resp != utils.OK { t.Error("Unexpected reply returned", resp) } var sqp *engine.StatQueueProfile - if err := stsV1Rpc.Call(utils.ApierV1GetStatQueueProfile, + if err := stsV1Rpc.Call(utils.APIerSv1GetStatQueueProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "TEST_PROFILE1"}, &sqp); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) } - if err := stsV1Rpc.Call(utils.ApierV1RemoveStatQueueProfile, + if err := stsV1Rpc.Call(utils.APIerSv1RemoveStatQueueProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "TEST_PROFILE1"}, &resp); err.Error() != utils.ErrNotFound.Error() { t.Errorf("Expected error: %v recived: %v", utils.ErrNotFound, err) } @@ -504,14 +504,14 @@ func testV1STSProcessMetricsWithFilter(t *testing.T) { } //set the custom statProfile var result string - if err := stsV1Rpc.Call(utils.ApierV1SetStatQueueProfile, statConfig, &result); err != nil { + if err := stsV1Rpc.Call(utils.APIerSv1SetStatQueueProfile, statConfig, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } //verify it var reply *engine.StatQueueProfile - if err := stsV1Rpc.Call(utils.ApierV1GetStatQueueProfile, + if err := stsV1Rpc.Call(utils.APIerSv1GetStatQueueProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "CustomStatProfile"}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(statConfig.StatQueueProfile, reply) { @@ -617,14 +617,14 @@ func testV1STSProcessStaticMetrics(t *testing.T) { } //set the custom statProfile var result string - if err := stsV1Rpc.Call(utils.ApierV1SetStatQueueProfile, statConfig, &result); err != nil { + if err := stsV1Rpc.Call(utils.APIerSv1SetStatQueueProfile, statConfig, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } //verify it var reply *engine.StatQueueProfile - if err := stsV1Rpc.Call(utils.ApierV1GetStatQueueProfile, + if err := stsV1Rpc.Call(utils.APIerSv1GetStatQueueProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "StaticStatQueue"}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(statConfig.StatQueueProfile, reply) { @@ -719,7 +719,7 @@ func testV1STSProcessStatWithThreshold(t *testing.T) { }, } var result string - if err := stsV1Rpc.Call(utils.ApierV1SetStatQueueProfile, stTh, &result); err != nil { + if err := stsV1Rpc.Call(utils.APIerSv1SetStatQueueProfile, stTh, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -740,7 +740,7 @@ func testV1STSProcessStatWithThreshold(t *testing.T) { Async: true, }, } - if err := stsV1Rpc.Call(utils.ApierV1SetThresholdProfile, thSts, &result); err != nil { + if err := stsV1Rpc.Call(utils.APIerSv1SetThresholdProfile, thSts, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) diff --git a/apier/v1/suppliers.go b/apier/v1/suppliers.go index 6514e0a4b..3888a8182 100644 --- a/apier/v1/suppliers.go +++ b/apier/v1/suppliers.go @@ -26,11 +26,11 @@ import ( ) // GetSupplierProfile returns a Supplier configuration -func (apierV1 *ApierV1) GetSupplierProfile(arg utils.TenantID, reply *engine.SupplierProfile) error { +func (APIerSv1 *APIerSv1) GetSupplierProfile(arg utils.TenantID, reply *engine.SupplierProfile) error { if missing := utils.MissingStructFields(&arg, []string{"Tenant", "ID"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } - if spp, err := apierV1.DataManager.GetSupplierProfile(arg.Tenant, arg.ID, true, true, utils.NonTransactional); err != nil { + if spp, err := APIerSv1.DataManager.GetSupplierProfile(arg.Tenant, arg.ID, true, true, utils.NonTransactional); err != nil { return utils.APIErrorHandler(err) } else { *reply = *spp @@ -39,12 +39,12 @@ func (apierV1 *ApierV1) GetSupplierProfile(arg utils.TenantID, reply *engine.Sup } // GetSupplierProfileIDs returns list of supplierProfile IDs registered for a tenant -func (apierV1 *ApierV1) GetSupplierProfileIDs(args utils.TenantArgWithPaginator, sppPrfIDs *[]string) error { +func (APIerSv1 *APIerSv1) GetSupplierProfileIDs(args utils.TenantArgWithPaginator, sppPrfIDs *[]string) error { if missing := utils.MissingStructFields(&args, []string{utils.Tenant}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } prfx := utils.SupplierProfilePrefix + args.Tenant + ":" - keys, err := apierV1.DataManager.DataDB().GetKeysForPrefix(prfx) + keys, err := APIerSv1.DataManager.DataDB().GetKeysForPrefix(prfx) if err != nil { return err } @@ -65,15 +65,15 @@ type SupplierWithCache struct { } //SetSupplierProfile add a new Supplier configuration -func (apierV1 *ApierV1) SetSupplierProfile(args *SupplierWithCache, reply *string) error { +func (APIerSv1 *APIerSv1) SetSupplierProfile(args *SupplierWithCache, reply *string) error { if missing := utils.MissingStructFields(args.SupplierProfile, []string{"Tenant", "ID"}); len(missing) != 0 { return utils.NewErrMandatoryIeMissing(missing...) } - if err := apierV1.DataManager.SetSupplierProfile(args.SupplierProfile, true); err != nil { + if err := APIerSv1.DataManager.SetSupplierProfile(args.SupplierProfile, true); err != nil { return utils.APIErrorHandler(err) } //generate a loadID for CacheSupplierProfiles and store it in database - if err := apierV1.DataManager.SetLoadIDs(map[string]int64{utils.CacheSupplierProfiles: time.Now().UnixNano()}); err != nil { + if err := APIerSv1.DataManager.SetLoadIDs(map[string]int64{utils.CacheSupplierProfiles: time.Now().UnixNano()}); err != nil { return utils.APIErrorHandler(err) } //handle caching for SupplierProfile @@ -81,7 +81,7 @@ func (apierV1 *ApierV1) SetSupplierProfile(args *SupplierWithCache, reply *strin CacheID: utils.CacheSupplierProfiles, ItemID: args.TenantID(), } - if err := apierV1.CallCache(GetCacheOpt(args.Cache), argCache); err != nil { + if err := APIerSv1.CallCache(GetCacheOpt(args.Cache), argCache); err != nil { return utils.APIErrorHandler(err) } *reply = utils.OK @@ -89,15 +89,15 @@ func (apierV1 *ApierV1) SetSupplierProfile(args *SupplierWithCache, reply *strin } //RemoveSupplierProfile remove a specific Supplier configuration -func (apierV1 *ApierV1) RemoveSupplierProfile(args *utils.TenantIDWithCache, reply *string) error { +func (APIerSv1 *APIerSv1) RemoveSupplierProfile(args *utils.TenantIDWithCache, reply *string) error { if missing := utils.MissingStructFields(args, []string{"Tenant", "ID"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } - if err := apierV1.DataManager.RemoveSupplierProfile(args.Tenant, args.ID, utils.NonTransactional, true); err != nil { + if err := APIerSv1.DataManager.RemoveSupplierProfile(args.Tenant, args.ID, utils.NonTransactional, true); err != nil { return utils.APIErrorHandler(err) } //generate a loadID for CacheSupplierProfiles and store it in database - if err := apierV1.DataManager.SetLoadIDs(map[string]int64{utils.CacheSupplierProfiles: time.Now().UnixNano()}); err != nil { + if err := APIerSv1.DataManager.SetLoadIDs(map[string]int64{utils.CacheSupplierProfiles: time.Now().UnixNano()}); err != nil { return utils.APIErrorHandler(err) } //handle caching for SupplierProfile @@ -105,7 +105,7 @@ func (apierV1 *ApierV1) RemoveSupplierProfile(args *utils.TenantIDWithCache, rep CacheID: utils.CacheSupplierProfiles, ItemID: args.TenantID(), } - if err := apierV1.CallCache(GetCacheOpt(args.Cache), argCache); err != nil { + if err := APIerSv1.CallCache(GetCacheOpt(args.Cache), argCache); err != nil { return utils.APIErrorHandler(err) } *reply = utils.OK diff --git a/apier/v1/suppliers_it_test.go b/apier/v1/suppliers_it_test.go index eadee039e..a3f1fa8a8 100644 --- a/apier/v1/suppliers_it_test.go +++ b/apier/v1/suppliers_it_test.go @@ -132,7 +132,7 @@ func testV1SplSRpcConn(t *testing.T) { func testV1SplSFromFolder(t *testing.T) { var reply string attrs := &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "testit")} - if err := splSv1Rpc.Call(utils.ApierV1LoadTariffPlanFromFolder, attrs, &reply); err != nil { + if err := splSv1Rpc.Call(utils.APIerSv1LoadTariffPlanFromFolder, attrs, &reply); err != nil { t.Error(err) } time.Sleep(500 * time.Millisecond) @@ -761,7 +761,7 @@ func testV1SplSGetSupplierWithoutFilter(t *testing.T) { func testV1SplSSetSupplierProfiles(t *testing.T) { var reply *engine.SupplierProfile - if err := splSv1Rpc.Call(utils.ApierV1GetSupplierProfile, + if err := splSv1Rpc.Call(utils.APIerSv1GetSupplierProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "TEST_PROFILE1"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) @@ -791,12 +791,12 @@ func testV1SplSSetSupplierProfiles(t *testing.T) { } var result string - if err := splSv1Rpc.Call(utils.ApierV1SetSupplierProfile, splPrf, &result); err != nil { + if err := splSv1Rpc.Call(utils.APIerSv1SetSupplierProfile, splPrf, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } - if err := splSv1Rpc.Call(utils.ApierV1GetSupplierProfile, + if err := splSv1Rpc.Call(utils.APIerSv1GetSupplierProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "TEST_PROFILE1"}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(splPrf.SupplierProfile, reply) { @@ -808,7 +808,7 @@ func testV1SplSGetSupplierProfileIDs(t *testing.T) { expected := []string{"SPL_HIGHESTCOST_1", "SPL_QOS_1", "SPL_QOS_2", "SPL_QOS_FILTRED", "SPL_QOS_FILTRED2", "SPL_ACNT_1001", "SPL_LEASTCOST_1", "SPL_WEIGHT_2", "SPL_WEIGHT_1", "SPL_QOS_3", "TEST_PROFILE1", "SPL_LCR"} var result []string - if err := splSv1Rpc.Call(utils.ApierV1GetSupplierProfileIDs, + if err := splSv1Rpc.Call(utils.APIerSv1GetSupplierProfileIDs, &utils.TenantArgWithPaginator{TenantArg: utils.TenantArg{"cgrates.org"}}, &result); err != nil { t.Error(err) } else if len(expected) != len(result) { @@ -866,13 +866,13 @@ func testV1SplSUpdateSupplierProfiles(t *testing.T) { }, } var result string - if err := splSv1Rpc.Call(utils.ApierV1SetSupplierProfile, splPrf, &result); err != nil { + if err := splSv1Rpc.Call(utils.APIerSv1SetSupplierProfile, splPrf, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } var reply *engine.SupplierProfile - if err := splSv1Rpc.Call(utils.ApierV1GetSupplierProfile, + if err := splSv1Rpc.Call(utils.APIerSv1GetSupplierProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "TEST_PROFILE1"}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(splPrf.Suppliers, reply.Suppliers) && !reflect.DeepEqual(reverseSuppliers, reply.Suppliers) { @@ -882,19 +882,19 @@ func testV1SplSUpdateSupplierProfiles(t *testing.T) { func testV1SplSRemSupplierProfiles(t *testing.T) { var resp string - if err := splSv1Rpc.Call(utils.ApierV1RemoveSupplierProfile, + if err := splSv1Rpc.Call(utils.APIerSv1RemoveSupplierProfile, &utils.TenantIDWithCache{Tenant: "cgrates.org", ID: "TEST_PROFILE1"}, &resp); err != nil { t.Error(err) } else if resp != utils.OK { t.Error("Unexpected reply returned", resp) } var reply *engine.SupplierProfile - if err := splSv1Rpc.Call(utils.ApierV1GetSupplierProfile, + if err := splSv1Rpc.Call(utils.APIerSv1GetSupplierProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "TEST_PROFILE1"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) } - if err := splSv1Rpc.Call(utils.ApierV1RemoveSupplierProfile, + if err := splSv1Rpc.Call(utils.APIerSv1RemoveSupplierProfile, &utils.TenantIDWithCache{Tenant: "cgrates.org", ID: "TEST_PROFILE1"}, &resp); err.Error() != utils.ErrNotFound.Error() { t.Errorf("Expected error: %v recived: %v", utils.ErrNotFound, err) } @@ -983,7 +983,7 @@ func testV1SplSGetSupplierForEvent(t *testing.T) { // supplier1 have attached RP_LOCAL and supplier2 have attach RP_MOBILE func testV1SplsOneSupplierWithoutDestination(t *testing.T) { var reply *engine.SupplierProfile - if err := splSv1Rpc.Call(utils.ApierV1GetSupplierProfile, + if err := splSv1Rpc.Call(utils.APIerSv1GetSupplierProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "SPL_DESTINATION"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) @@ -1012,7 +1012,7 @@ func testV1SplsOneSupplierWithoutDestination(t *testing.T) { } var result string - if err := splSv1Rpc.Call(utils.ApierV1SetSupplierProfile, splPrf, &result); err != nil { + if err := splSv1Rpc.Call(utils.APIerSv1SetSupplierProfile, splPrf, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) diff --git a/apier/v1/thresholds.go b/apier/v1/thresholds.go index 03bd7021d..d975143b4 100644 --- a/apier/v1/thresholds.go +++ b/apier/v1/thresholds.go @@ -61,11 +61,11 @@ func (tSv1 *ThresholdSv1) ProcessEvent(args *engine.ArgsProcessEvent, tIDs *[]st } // GetThresholdProfile returns a Threshold Profile -func (apierV1 *ApierV1) GetThresholdProfile(arg *utils.TenantID, reply *engine.ThresholdProfile) (err error) { +func (APIerSv1 *APIerSv1) GetThresholdProfile(arg *utils.TenantID, reply *engine.ThresholdProfile) (err error) { if missing := utils.MissingStructFields(arg, []string{"Tenant", "ID"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } - if th, err := apierV1.DataManager.GetThresholdProfile(arg.Tenant, arg.ID, true, true, utils.NonTransactional); err != nil { + if th, err := APIerSv1.DataManager.GetThresholdProfile(arg.Tenant, arg.ID, true, true, utils.NonTransactional); err != nil { return utils.APIErrorHandler(err) } else { *reply = *th @@ -74,12 +74,12 @@ func (apierV1 *ApierV1) GetThresholdProfile(arg *utils.TenantID, reply *engine.T } // GetThresholdProfileIDs returns list of thresholdProfile IDs registered for a tenant -func (apierV1 *ApierV1) GetThresholdProfileIDs(args utils.TenantArgWithPaginator, thPrfIDs *[]string) error { +func (APIerSv1 *APIerSv1) GetThresholdProfileIDs(args utils.TenantArgWithPaginator, thPrfIDs *[]string) error { if missing := utils.MissingStructFields(&args, []string{utils.Tenant}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } prfx := utils.ThresholdProfilePrefix + args.Tenant + ":" - keys, err := apierV1.DataManager.DataDB().GetKeysForPrefix(prfx) + keys, err := APIerSv1.DataManager.DataDB().GetKeysForPrefix(prfx) if err != nil { return err } @@ -95,17 +95,17 @@ func (apierV1 *ApierV1) GetThresholdProfileIDs(args utils.TenantArgWithPaginator } // SetThresholdProfile alters/creates a ThresholdProfile -func (apierV1 *ApierV1) SetThresholdProfile(args *engine.ThresholdWithCache, reply *string) error { +func (APIerSv1 *APIerSv1) SetThresholdProfile(args *engine.ThresholdWithCache, reply *string) error { if missing := utils.MissingStructFields(args.ThresholdProfile, []string{"Tenant", "ID"}); len(missing) != 0 { return utils.NewErrMandatoryIeMissing(missing...) } - if err := apierV1.DataManager.SetThresholdProfile(args.ThresholdProfile, true); err != nil { + if err := APIerSv1.DataManager.SetThresholdProfile(args.ThresholdProfile, true); err != nil { return utils.APIErrorHandler(err) } //generate a loadID for CacheThresholdProfiles and CacheThresholds and store it in database //make 1 insert for both ThresholdProfile and Threshold instead of 2 loadID := time.Now().UnixNano() - if err := apierV1.DataManager.SetLoadIDs(map[string]int64{utils.CacheThresholdProfiles: loadID, utils.CacheThresholds: loadID}); err != nil { + if err := APIerSv1.DataManager.SetLoadIDs(map[string]int64{utils.CacheThresholdProfiles: loadID, utils.CacheThresholds: loadID}); err != nil { return utils.APIErrorHandler(err) } //handle caching for ThresholdProfile @@ -113,14 +113,14 @@ func (apierV1 *ApierV1) SetThresholdProfile(args *engine.ThresholdWithCache, rep CacheID: utils.CacheThresholdProfiles, ItemID: args.TenantID(), } - if err := apierV1.CallCache(GetCacheOpt(args.Cache), argCache); err != nil { + if err := APIerSv1.CallCache(GetCacheOpt(args.Cache), argCache); err != nil { return utils.APIErrorHandler(err) } - if has, err := apierV1.DataManager.HasData(utils.ThresholdPrefix, args.ID, args.Tenant); err != nil { + if has, err := APIerSv1.DataManager.HasData(utils.ThresholdPrefix, args.ID, args.Tenant); err != nil { return err } else if !has { - if err := apierV1.DataManager.SetThreshold(&engine.Threshold{Tenant: args.Tenant, ID: args.ID}); err != nil { + if err := APIerSv1.DataManager.SetThreshold(&engine.Threshold{Tenant: args.Tenant, ID: args.ID}); err != nil { return err } //handle caching for Threshold @@ -128,7 +128,7 @@ func (apierV1 *ApierV1) SetThresholdProfile(args *engine.ThresholdWithCache, rep CacheID: utils.CacheThresholds, ItemID: args.TenantID(), } - if err := apierV1.CallCache(GetCacheOpt(args.Cache), argCache); err != nil { + if err := APIerSv1.CallCache(GetCacheOpt(args.Cache), argCache); err != nil { return utils.APIErrorHandler(err) } } @@ -138,11 +138,11 @@ func (apierV1 *ApierV1) SetThresholdProfile(args *engine.ThresholdWithCache, rep } // Remove a specific Threshold Profile -func (apierV1 *ApierV1) RemoveThresholdProfile(args *utils.TenantIDWithCache, reply *string) error { +func (APIerSv1 *APIerSv1) RemoveThresholdProfile(args *utils.TenantIDWithCache, reply *string) error { if missing := utils.MissingStructFields(args, []string{"Tenant", "ID"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } - if err := apierV1.DataManager.RemoveThresholdProfile(args.Tenant, args.ID, utils.NonTransactional, true); err != nil { + if err := APIerSv1.DataManager.RemoveThresholdProfile(args.Tenant, args.ID, utils.NonTransactional, true); err != nil { return utils.APIErrorHandler(err) } //handle caching for ThresholdProfile @@ -150,16 +150,16 @@ func (apierV1 *ApierV1) RemoveThresholdProfile(args *utils.TenantIDWithCache, re CacheID: utils.CacheThresholdProfiles, ItemID: args.TenantID(), } - if err := apierV1.CallCache(GetCacheOpt(args.Cache), argCache); err != nil { + if err := APIerSv1.CallCache(GetCacheOpt(args.Cache), argCache); err != nil { return utils.APIErrorHandler(err) } - if err := apierV1.DataManager.RemoveThreshold(args.Tenant, args.ID, utils.NonTransactional); err != nil { + if err := APIerSv1.DataManager.RemoveThreshold(args.Tenant, args.ID, utils.NonTransactional); err != nil { return utils.APIErrorHandler(err) } //generate a loadID for CacheThresholdProfiles and CacheThresholds and store it in database //make 1 insert for both ThresholdProfile and Threshold instead of 2 loadID := time.Now().UnixNano() - if err := apierV1.DataManager.SetLoadIDs(map[string]int64{utils.CacheThresholdProfiles: loadID, utils.CacheThresholds: loadID}); err != nil { + if err := APIerSv1.DataManager.SetLoadIDs(map[string]int64{utils.CacheThresholdProfiles: loadID, utils.CacheThresholds: loadID}); err != nil { return utils.APIErrorHandler(err) } //handle caching for Threshold @@ -167,7 +167,7 @@ func (apierV1 *ApierV1) RemoveThresholdProfile(args *utils.TenantIDWithCache, re CacheID: utils.CacheThresholds, ItemID: args.TenantID(), } - if err := apierV1.CallCache(GetCacheOpt(args.Cache), argCache); err != nil { + if err := APIerSv1.CallCache(GetCacheOpt(args.Cache), argCache); err != nil { return utils.APIErrorHandler(err) } *reply = utils.OK diff --git a/apier/v1/thresholds_it_test.go b/apier/v1/thresholds_it_test.go index a3a9d6102..50017aaac 100644 --- a/apier/v1/thresholds_it_test.go +++ b/apier/v1/thresholds_it_test.go @@ -255,7 +255,7 @@ func testV1TSRpcConn(t *testing.T) { func testV1TSFromFolder(t *testing.T) { var reply string attrs := &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "oldtutorial")} - if err := tSv1Rpc.Call(utils.ApierV1LoadTariffPlanFromFolder, attrs, &reply); err != nil { + if err := tSv1Rpc.Call(utils.APIerSv1LoadTariffPlanFromFolder, attrs, &reply); err != nil { t.Error(err) } time.Sleep(500 * time.Millisecond) @@ -380,7 +380,7 @@ func testV1TSGetThresholdsAfterRestart(t *testing.T) { func testv1TSGetThresholdProfileIDs(t *testing.T) { expected := []string{"THD_STATS_1", "THD_STATS_2", "THD_STATS_3", "THD_RES_1", "THD_CDRS_1", "THD_ACNT_BALANCE_1", "THD_ACNT_EXPIRED"} var result []string - if err := tSv1Rpc.Call(utils.ApierV1GetThresholdProfileIDs, utils.TenantArgWithPaginator{TenantArg: utils.TenantArg{"cgrates.org"}}, &result); err != nil { + if err := tSv1Rpc.Call(utils.APIerSv1GetThresholdProfileIDs, utils.TenantArgWithPaginator{TenantArg: utils.TenantArg{"cgrates.org"}}, &result); err != nil { t.Error(err) } else if len(expected) != len(result) { t.Errorf("Expecting : %+v, received: %+v", expected, result) @@ -390,7 +390,7 @@ func testv1TSGetThresholdProfileIDs(t *testing.T) { func testV1TSSetThresholdProfile(t *testing.T) { var reply *engine.ThresholdProfile var result string - if err := tSv1Rpc.Call(utils.ApierV1GetThresholdProfile, + if err := tSv1Rpc.Call(utils.APIerSv1GetThresholdProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "THD_Test"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) @@ -412,12 +412,12 @@ func testV1TSSetThresholdProfile(t *testing.T) { Async: true, }, } - if err := tSv1Rpc.Call(utils.ApierV1SetThresholdProfile, tPrfl, &result); err != nil { + if err := tSv1Rpc.Call(utils.APIerSv1SetThresholdProfile, tPrfl, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } - if err := tSv1Rpc.Call(utils.ApierV1GetThresholdProfile, + if err := tSv1Rpc.Call(utils.APIerSv1GetThresholdProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "THD_Test"}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(tPrfl.ThresholdProfile, reply) { @@ -428,13 +428,13 @@ func testV1TSSetThresholdProfile(t *testing.T) { func testV1TSUpdateThresholdProfile(t *testing.T) { var result string tPrfl.FilterIDs = []string{"*string:~Account:1001", "*prefix:~DST:10"} - if err := tSv1Rpc.Call(utils.ApierV1SetThresholdProfile, tPrfl, &result); err != nil { + if err := tSv1Rpc.Call(utils.APIerSv1SetThresholdProfile, tPrfl, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } var reply *engine.ThresholdProfile - if err := tSv1Rpc.Call(utils.ApierV1GetThresholdProfile, + if err := tSv1Rpc.Call(utils.APIerSv1GetThresholdProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "THD_Test"}, &reply); err != nil { t.Error(err) } else { @@ -448,19 +448,19 @@ func testV1TSUpdateThresholdProfile(t *testing.T) { func testV1TSRemoveThresholdProfile(t *testing.T) { var resp string - if err := tSv1Rpc.Call(utils.ApierV1RemoveThresholdProfile, + if err := tSv1Rpc.Call(utils.APIerSv1RemoveThresholdProfile, &utils.TenantIDWithCache{Tenant: "cgrates.org", ID: "THD_Test"}, &resp); err != nil { t.Error(err) } else if resp != utils.OK { t.Error("Unexpected reply returned", resp) } var sqp *engine.ThresholdProfile - if err := tSv1Rpc.Call(utils.ApierV1GetThresholdProfile, + if err := tSv1Rpc.Call(utils.APIerSv1GetThresholdProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "THD_Test"}, &sqp); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Errorf("Recived %s and the error:%+v", utils.ToJSON(sqp), err) } - if err := tSv1Rpc.Call(utils.ApierV1RemoveThresholdProfile, + if err := tSv1Rpc.Call(utils.APIerSv1RemoveThresholdProfile, &utils.TenantIDWithCache{Tenant: "cgrates.org", ID: "THD_Test"}, &resp); err.Error() != utils.ErrNotFound.Error() { t.Errorf("Expected error: %v recived: %v", utils.ErrNotFound, err) } @@ -469,7 +469,7 @@ func testV1TSRemoveThresholdProfile(t *testing.T) { func testV1TSMaxHits(t *testing.T) { var reply string // check if exist - if err := tSv1Rpc.Call(utils.ApierV1GetThresholdProfile, + if err := tSv1Rpc.Call(utils.APIerSv1GetThresholdProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "TH3"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) @@ -482,7 +482,7 @@ func testV1TSMaxHits(t *testing.T) { }, } //set - if err := tSv1Rpc.Call(utils.ApierV1SetThresholdProfile, tPrfl, &reply); err != nil { + if err := tSv1Rpc.Call(utils.APIerSv1SetThresholdProfile, tPrfl, &reply); err != nil { t.Error(err) } else if reply != utils.OK { t.Error("Unexpected reply returned", reply) diff --git a/apier/v1/tp.go b/apier/v1/tp.go index 93c095556..8ed384aed 100644 --- a/apier/v1/tp.go +++ b/apier/v1/tp.go @@ -34,7 +34,7 @@ type AttrGetTPIds struct { } // Queries tarrif plan identities gathered from all tables. -func (self *ApierV1) GetTPIds(attrs AttrGetTPIds, reply *[]string) error { +func (self *APIerSv1) GetTPIds(attrs AttrGetTPIds, reply *[]string) error { if ids, err := self.StorDb.GetTpIds(""); err != nil { return utils.NewErrServerError(err) } else if ids == nil { @@ -50,7 +50,7 @@ type AttrImportTPZipFile struct { File []byte } -func (self *ApierV1) ImportTPZipFile(attrs AttrImportTPZipFile, reply *string) error { +func (self *APIerSv1) ImportTPZipFile(attrs AttrImportTPZipFile, reply *string) error { tmpDir, err := ioutil.TempDir("/tmp", "cgr_") if err != nil { *reply = "ERROR: creating temp directory!" @@ -103,7 +103,7 @@ type AttrRemTp struct { TPid string } -func (self *ApierV1) RemTP(attrs AttrRemTp, reply *string) error { +func (self *APIerSv1) RemTP(attrs AttrRemTp, reply *string) error { if len(attrs.TPid) == 0 { return utils.NewErrMandatoryIeMissing("TPid") } @@ -115,7 +115,7 @@ func (self *ApierV1) RemTP(attrs AttrRemTp, reply *string) error { return nil } -func (self *ApierV1) ExportTPToFolder(attrs utils.AttrDirExportTP, exported *utils.ExportedTPStats) error { +func (self *APIerSv1) ExportTPToFolder(attrs utils.AttrDirExportTP, exported *utils.ExportedTPStats) error { if attrs.TPid == nil || *attrs.TPid == "" { return utils.NewErrMandatoryIeMissing("TPid") } @@ -148,7 +148,7 @@ func (self *ApierV1) ExportTPToFolder(attrs utils.AttrDirExportTP, exported *uti return nil } -func (self *ApierV1) ExportTPToZipString(attrs utils.AttrDirExportTP, reply *string) error { +func (self *APIerSv1) ExportTPToZipString(attrs utils.AttrDirExportTP, reply *string) error { if attrs.TPid == nil || *attrs.TPid == "" { return utils.NewErrMandatoryIeMissing("TPid") } diff --git a/apier/v1/tp_it_test.go b/apier/v1/tp_it_test.go index 230f22fd0..28500262c 100644 --- a/apier/v1/tp_it_test.go +++ b/apier/v1/tp_it_test.go @@ -107,12 +107,12 @@ func testTPRpcConn(t *testing.T) { func testTPImportTPFromFolderPath(t *testing.T) { var reply string - if err := tpRPC.Call(utils.ApierV1ImportTariffPlanFromFolder, + if err := tpRPC.Call(utils.APIerSv1ImportTariffPlanFromFolder, utils.AttrImportTPFromFolder{TPid: "TEST_TPID2", FolderPath: path.Join(tpDataDir, "tariffplans", "tutorial")}, &reply); err != nil { - t.Error("Got error on ApierV1.ImportTarrifPlanFromFolder: ", err.Error()) + t.Error("Got error on APIerSv1.ImportTarrifPlanFromFolder: ", err.Error()) } else if reply != utils.OK { - t.Error("Calling ApierV1.ImportTarrifPlanFromFolder got reply: ", reply) + t.Error("Calling APIerSv1.ImportTarrifPlanFromFolder got reply: ", reply) } time.Sleep(500 * time.Millisecond) } @@ -130,8 +130,8 @@ func testTPExportTPToFolder(t *testing.T) { tpid := "TEST_TPID2" compress := true exportPath := "/tmp/" - if err := tpRPC.Call(utils.ApierV1ExportTPToFolder, &utils.AttrDirExportTP{TPid: &tpid, ExportPath: &exportPath, Compress: &compress}, &reply); err != nil { - t.Error("Got error on ApierV1.ExportTPToFolder: ", err.Error()) + if err := tpRPC.Call(utils.APIerSv1ExportTPToFolder, &utils.AttrDirExportTP{TPid: &tpid, ExportPath: &exportPath, Compress: &compress}, &reply); err != nil { + t.Error("Got error on APIerSv1.ExportTPToFolder: ", err.Error()) } else if !reflect.DeepEqual(reply.ExportPath, expectedTPStas.ExportPath) { t.Errorf("Expecting : %+v, received: %+v", expectedTPStas.ExportPath, reply.ExportPath) } else if !reflect.DeepEqual(reply.Compressed, expectedTPStas.Compressed) { diff --git a/apier/v1/tpaccountactions.go b/apier/v1/tpaccountactions.go index 11073d515..20fb75b92 100644 --- a/apier/v1/tpaccountactions.go +++ b/apier/v1/tpaccountactions.go @@ -24,7 +24,7 @@ import ( ) // Creates a new AccountActions profile within a tariff plan -func (self *ApierV1) SetTPAccountActions(attrs utils.TPAccountActions, reply *string) error { +func (self *APIerSv1) SetTPAccountActions(attrs utils.TPAccountActions, reply *string) error { if missing := utils.MissingStructFields(&attrs, []string{"TPid", "LoadId", "Tenant", "Account", "ActionPlanId"}); len(missing) != 0 { return utils.NewErrMandatoryIeMissing(missing...) @@ -42,7 +42,7 @@ type AttrGetTPAccountActionsByLoadId struct { } // Queries specific AccountActions profile on tariff plan -func (self *ApierV1) GetTPAccountActionsByLoadId(attrs utils.TPAccountActions, reply *[]*utils.TPAccountActions) error { +func (self *APIerSv1) GetTPAccountActionsByLoadId(attrs utils.TPAccountActions, reply *[]*utils.TPAccountActions) error { mndtryFlds := []string{"TPid", "LoadId"} if len(attrs.Account) != 0 { // If account provided as filter, make all related fields mandatory mndtryFlds = append(mndtryFlds, "Tenant", "Account") @@ -67,7 +67,7 @@ type AttrGetTPAccountActions struct { } // Queries specific DerivedCharge on tariff plan -func (self *ApierV1) GetTPAccountActions(attrs AttrGetTPAccountActions, reply *utils.TPAccountActions) error { +func (self *APIerSv1) GetTPAccountActions(attrs AttrGetTPAccountActions, reply *utils.TPAccountActions) error { if missing := utils.MissingStructFields(&attrs, []string{"TPid", "AccountActionsId"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } @@ -92,7 +92,7 @@ type AttrGetTPAccountActionIds struct { } // Queries AccountActions identities on specific tariff plan. -func (self *ApierV1) GetTPAccountActionLoadIds(attrs AttrGetTPAccountActionIds, reply *[]string) error { +func (self *APIerSv1) GetTPAccountActionLoadIds(attrs AttrGetTPAccountActionIds, reply *[]string) error { if missing := utils.MissingStructFields(&attrs, []string{"TPid"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } @@ -109,7 +109,7 @@ func (self *ApierV1) GetTPAccountActionLoadIds(attrs AttrGetTPAccountActionIds, } // Queries DerivedCharges identities on specific tariff plan. -func (self *ApierV1) GetTPAccountActionIds(attrs AttrGetTPAccountActionIds, reply *[]string) error { +func (self *APIerSv1) GetTPAccountActionIds(attrs AttrGetTPAccountActionIds, reply *[]string) error { if missing := utils.MissingStructFields(&attrs, []string{"TPid"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } @@ -126,7 +126,7 @@ func (self *ApierV1) GetTPAccountActionIds(attrs AttrGetTPAccountActionIds, repl } // Removes specific AccountActions on Tariff plan -func (self *ApierV1) RemoveTPAccountActions(attrs AttrGetTPAccountActions, reply *string) error { +func (self *APIerSv1) RemoveTPAccountActions(attrs AttrGetTPAccountActions, reply *string) error { if missing := utils.MissingStructFields(&attrs, []string{"TPid", "LoadId", "Tenant", "Account"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } diff --git a/apier/v1/tpaccountactions_it_test.go b/apier/v1/tpaccountactions_it_test.go index b31fca107..b9d4036b7 100644 --- a/apier/v1/tpaccountactions_it_test.go +++ b/apier/v1/tpaccountactions_it_test.go @@ -128,7 +128,7 @@ func testTPAccActionsRpcConn(t *testing.T) { func testTPAccActionsGetTPAccActionBeforeSet(t *testing.T) { var reply *utils.TPAccountActions - if err := tpAccActionsRPC.Call(utils.ApierV1GetTPAccountActions, + if err := tpAccActionsRPC.Call(utils.APIerSv1GetTPAccountActions, &AttrGetTPAccountActions{TPid: "TPAcc", AccountActionsId: tpAccActionID}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) @@ -148,7 +148,7 @@ func testTPAccActionsSetTPAccAction(t *testing.T) { Disabled: false, } var result string - if err := tpAccActionsRPC.Call(utils.ApierV1SetTPAccountActions, tpAccActions, &result); err != nil { + if err := tpAccActionsRPC.Call(utils.APIerSv1SetTPAccountActions, tpAccActions, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -157,7 +157,7 @@ func testTPAccActionsSetTPAccAction(t *testing.T) { func testTPAccActionsGetTPAccActionAfterSet(t *testing.T) { var reply *utils.TPAccountActions - if err := tpAccActionsRPC.Call(utils.ApierV1GetTPAccountActions, + if err := tpAccActionsRPC.Call(utils.APIerSv1GetTPAccountActions, &AttrGetTPAccountActions{TPid: "TPAcc", AccountActionsId: tpAccActionID}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(tpAccActions, reply) { @@ -167,7 +167,7 @@ func testTPAccActionsGetTPAccActionAfterSet(t *testing.T) { func testTPAccActionsGetTPAccountActionsByLoadId(t *testing.T) { var reply *[]*utils.TPAccountActions - if err := tpAccActionsRPC.Call(utils.ApierV1GetTPAccountActionsByLoadId, + if err := tpAccActionsRPC.Call(utils.APIerSv1GetTPAccountActionsByLoadId, &utils.TPAccountActions{TPid: "TPAcc", LoadId: "ID"}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(tpAccActions, (*reply)[0]) { @@ -178,7 +178,7 @@ func testTPAccActionsGetTPAccountActionsByLoadId(t *testing.T) { func testTPAccActionsGetTPAccountActionLoadIds(t *testing.T) { var result []string expectedTPID := []string{"ID"} - if err := tpAccActionsRPC.Call(utils.ApierV1GetTPAccountActionLoadIds, + if err := tpAccActionsRPC.Call(utils.APIerSv1GetTPAccountActionLoadIds, &AttrGetTPAccountActionIds{TPid: "TPAcc"}, &result); err != nil { t.Error(err) } else if !reflect.DeepEqual(expectedTPID, result) { @@ -189,7 +189,7 @@ func testTPAccActionsGetTPAccountActionLoadIds(t *testing.T) { func testTPAccActionsGetTPAccountActionIds(t *testing.T) { var result []string expectedTPID := []string{"ID:cgrates.org:1001"} - if err := tpAccActionsRPC.Call(utils.ApierV1GetTPAccountActionIds, + if err := tpAccActionsRPC.Call(utils.APIerSv1GetTPAccountActionIds, &AttrGetTPAccountActionIds{TPid: "TPAcc"}, &result); err != nil { t.Error(err) } else if !reflect.DeepEqual(expectedTPID, result) { @@ -200,7 +200,7 @@ func testTPAccActionsGetTPAccountActionIds(t *testing.T) { func testTPAccActionsUpdateTPAccAction(t *testing.T) { tpAccActions.ActionPlanId = "PlanOne" var result string - if err := tpAccActionsRPC.Call(utils.ApierV1SetTPAccountActions, tpAccActions, &result); err != nil { + if err := tpAccActionsRPC.Call(utils.APIerSv1SetTPAccountActions, tpAccActions, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -210,7 +210,7 @@ func testTPAccActionsUpdateTPAccAction(t *testing.T) { func testTPAccActionsGetTPAccActionAfterUpdate(t *testing.T) { var reply *utils.TPAccountActions - if err := tpAccActionsRPC.Call(utils.ApierV1GetTPAccountActions, + if err := tpAccActionsRPC.Call(utils.APIerSv1GetTPAccountActions, &AttrGetTPAccountActions{TPid: "TPAcc", AccountActionsId: tpAccActionID}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(tpAccActions, reply) { @@ -221,7 +221,7 @@ func testTPAccActionsGetTPAccActionAfterUpdate(t *testing.T) { func testTPAccActionsRemTPAccAction(t *testing.T) { var resp string - if err := tpAccActionsRPC.Call(utils.ApierV1RemoveTPAccountActions, + if err := tpAccActionsRPC.Call(utils.APIerSv1RemoveTPAccountActions, &AttrGetTPAccountActions{TPid: "TPAcc", AccountActionsId: tpAccActionID}, &resp); err != nil { t.Error(err) } else if resp != utils.OK { @@ -232,7 +232,7 @@ func testTPAccActionsRemTPAccAction(t *testing.T) { func testTPAccActionsGetTPAccActionAfterRemove(t *testing.T) { var reply *utils.TPAccountActions - if err := tpAccActionsRPC.Call(utils.ApierV1GetTPAccountActions, + if err := tpAccActionsRPC.Call(utils.APIerSv1GetTPAccountActions, &AttrGetTPAccountActions{TPid: "TPAcc", AccountActionsId: tpAccActionID}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) diff --git a/apier/v1/tpactionplans.go b/apier/v1/tpactionplans.go index dbb72f52f..57a0b6c5b 100644 --- a/apier/v1/tpactionplans.go +++ b/apier/v1/tpactionplans.go @@ -25,7 +25,7 @@ import ( ) // Creates a new ActionTimings profile within a tariff plan -func (self *ApierV1) SetTPActionPlan(attrs utils.TPActionPlan, reply *string) error { +func (self *APIerSv1) SetTPActionPlan(attrs utils.TPActionPlan, reply *string) error { if missing := utils.MissingStructFields(&attrs, []string{"TPid", "ID", "ActionPlan"}); len(missing) != 0 { return utils.NewErrMandatoryIeMissing(missing...) } @@ -48,7 +48,7 @@ type AttrGetTPActionPlan struct { } // Queries specific ActionPlan profile on tariff plan -func (self *ApierV1) GetTPActionPlan(attrs AttrGetTPActionPlan, reply *utils.TPActionPlan) error { +func (self *APIerSv1) GetTPActionPlan(attrs AttrGetTPActionPlan, reply *utils.TPActionPlan) error { if missing := utils.MissingStructFields(&attrs, []string{"TPid", "ID"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } @@ -69,7 +69,7 @@ type AttrGetTPActionPlanIds struct { } // Queries ActionPlan identities on specific tariff plan. -func (self *ApierV1) GetTPActionPlanIds(attrs AttrGetTPActionPlanIds, reply *[]string) error { +func (self *APIerSv1) GetTPActionPlanIds(attrs AttrGetTPActionPlanIds, reply *[]string) error { if missing := utils.MissingStructFields(&attrs, []string{"TPid"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } @@ -86,7 +86,7 @@ func (self *ApierV1) GetTPActionPlanIds(attrs AttrGetTPActionPlanIds, reply *[]s } // Removes specific ActionPlan on Tariff plan -func (self *ApierV1) RemoveTPActionPlan(attrs AttrGetTPActionPlan, reply *string) error { +func (self *APIerSv1) RemoveTPActionPlan(attrs AttrGetTPActionPlan, reply *string) error { if missing := utils.MissingStructFields(&attrs, []string{"TPid", "ID"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } diff --git a/apier/v1/tpactionplans_it_test.go b/apier/v1/tpactionplans_it_test.go index 1660bfbb7..c0d303770 100644 --- a/apier/v1/tpactionplans_it_test.go +++ b/apier/v1/tpactionplans_it_test.go @@ -130,7 +130,7 @@ func testTPAccPlansRpcConn(t *testing.T) { func testTPAccPlansGetTPAccPlanBeforeSet(t *testing.T) { var reply *utils.TPActionPlan - if err := tpAccPlansRPC.Call(utils.ApierV1GetTPActionPlan, + if err := tpAccPlansRPC.Call(utils.APIerSv1GetTPActionPlan, &AttrGetTPActionPlan{TPid: "TPAcc", ID: "ID"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) } @@ -154,7 +154,7 @@ func testTPAccPlansSetTPAccPlan(t *testing.T) { }, } var result string - if err := tpAccPlansRPC.Call(utils.ApierV1SetTPActionPlan, tpAccPlan, &result); err != nil { + if err := tpAccPlansRPC.Call(utils.APIerSv1SetTPActionPlan, tpAccPlan, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -163,7 +163,7 @@ func testTPAccPlansSetTPAccPlan(t *testing.T) { func testTPAccPlansGetTPAccPlanAfterSet(t *testing.T) { var reply *utils.TPActionPlan - if err := tpAccPlansRPC.Call(utils.ApierV1GetTPActionPlan, + if err := tpAccPlansRPC.Call(utils.APIerSv1GetTPActionPlan, &AttrGetTPActionPlan{TPid: "TPAcc", ID: "ID"}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(tpAccPlan.TPid, reply.TPid) { @@ -178,7 +178,7 @@ func testTPAccPlansGetTPAccPlanAfterSet(t *testing.T) { func testTPAccPlansGetTPAccPlanIds(t *testing.T) { var result []string expectedTPID := []string{"ID"} - if err := tpAccPlansRPC.Call(utils.ApierV1GetTPActionPlanIds, + if err := tpAccPlansRPC.Call(utils.APIerSv1GetTPActionPlanIds, &AttrGetTPActionPlanIds{TPid: "TPAcc"}, &result); err != nil { t.Error(err) } else if !reflect.DeepEqual(expectedTPID, result) { @@ -206,7 +206,7 @@ func testTPAccPlansUpdateTPAccPlan(t *testing.T) { }, } var result string - if err := tpAccPlansRPC.Call(utils.ApierV1SetTPActionPlan, tpAccPlan, &result); err != nil { + if err := tpAccPlansRPC.Call(utils.APIerSv1SetTPActionPlan, tpAccPlan, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -216,7 +216,7 @@ func testTPAccPlansUpdateTPAccPlan(t *testing.T) { func testTPAccPlansGetTPAccPlanAfterUpdate(t *testing.T) { var reply *utils.TPActionPlan - if err := tpAccPlansRPC.Call(utils.ApierV1GetTPActionPlan, + if err := tpAccPlansRPC.Call(utils.APIerSv1GetTPActionPlan, &AttrGetTPActionPlan{TPid: "TPAcc", ID: "ID"}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(tpAccPlan.TPid, reply.TPid) { @@ -231,7 +231,7 @@ func testTPAccPlansGetTPAccPlanAfterUpdate(t *testing.T) { func testTPAccPlansRemTPAccPlan(t *testing.T) { var resp string - if err := tpAccPlansRPC.Call(utils.ApierV1RemoveTPActionPlan, + if err := tpAccPlansRPC.Call(utils.APIerSv1RemoveTPActionPlan, &AttrGetTPActionPlan{TPid: "TPAcc", ID: "ID"}, &resp); err != nil { t.Error(err) } else if resp != utils.OK { @@ -242,7 +242,7 @@ func testTPAccPlansRemTPAccPlan(t *testing.T) { func testTPAccPlansGetTPAccPlanAfterRemove(t *testing.T) { var reply *utils.TPActionPlan - if err := tpAccPlansRPC.Call(utils.ApierV1GetTPActionPlan, + if err := tpAccPlansRPC.Call(utils.APIerSv1GetTPActionPlan, &AttrGetTPActionPlan{TPid: "TPAcc", ID: "ID"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) } diff --git a/apier/v1/tpactions.go b/apier/v1/tpactions.go index 48e9a7a9f..5603a8b32 100644 --- a/apier/v1/tpactions.go +++ b/apier/v1/tpactions.go @@ -23,7 +23,7 @@ import ( ) // Creates a new Actions profile within a tariff plan -func (self *ApierV1) SetTPActions(attrs utils.TPActions, reply *string) error { +func (self *APIerSv1) SetTPActions(attrs utils.TPActions, reply *string) error { if missing := utils.MissingStructFields(&attrs, []string{"TPid", "ID", "Actions"}); len(missing) != 0 { return utils.NewErrMandatoryIeMissing(missing...) } @@ -40,7 +40,7 @@ type AttrGetTPActions struct { } // Queries specific Actions profile on tariff plan -func (self *ApierV1) GetTPActions(attrs AttrGetTPActions, reply *utils.TPActions) error { +func (self *APIerSv1) GetTPActions(attrs AttrGetTPActions, reply *utils.TPActions) error { if missing := utils.MissingStructFields(&attrs, []string{"TPid", "ID"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } @@ -61,7 +61,7 @@ type AttrGetTPActionIds struct { } // Queries Actions identities on specific tariff plan. -func (self *ApierV1) GetTPActionIds(attrs AttrGetTPActionIds, reply *[]string) error { +func (self *APIerSv1) GetTPActionIds(attrs AttrGetTPActionIds, reply *[]string) error { if missing := utils.MissingStructFields(&attrs, []string{"TPid"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } @@ -78,7 +78,7 @@ func (self *ApierV1) GetTPActionIds(attrs AttrGetTPActionIds, reply *[]string) e } // Removes specific Actions on Tariff plan -func (self *ApierV1) RemoveTPActions(attrs AttrGetTPActions, reply *string) error { +func (self *APIerSv1) RemoveTPActions(attrs AttrGetTPActions, reply *string) error { if missing := utils.MissingStructFields(&attrs, []string{"TPid", "ID"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } diff --git a/apier/v1/tpactions_it_test.go b/apier/v1/tpactions_it_test.go index dc8640480..137ac0c78 100644 --- a/apier/v1/tpactions_it_test.go +++ b/apier/v1/tpactions_it_test.go @@ -130,7 +130,7 @@ func testTPActionsRpcConn(t *testing.T) { func testTPActionsGetTPActionBeforeSet(t *testing.T) { var reply *utils.TPActionPlan - if err := tpActionRPC.Call(utils.ApierV1GetTPActions, + if err := tpActionRPC.Call(utils.APIerSv1GetTPActions, &AttrGetTPActions{TPid: "TPAcc", ID: "ID"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) } @@ -182,7 +182,7 @@ func testTPActionsSetTPAction(t *testing.T) { }, } var result string - if err := tpActionRPC.Call(utils.ApierV1SetTPActions, tpActions, &result); err != nil { + if err := tpActionRPC.Call(utils.APIerSv1SetTPActions, tpActions, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -191,7 +191,7 @@ func testTPActionsSetTPAction(t *testing.T) { func testTPActionsGetTPActionAfterSet(t *testing.T) { var reply *utils.TPActions - if err := tpActionRPC.Call(utils.ApierV1GetTPActions, + if err := tpActionRPC.Call(utils.APIerSv1GetTPActions, &AttrGetTPActions{TPid: "TPAcc", ID: "ID"}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(tpActions.TPid, reply.TPid) { @@ -206,7 +206,7 @@ func testTPActionsGetTPActionAfterSet(t *testing.T) { func testTPActionsGetTPActionIds(t *testing.T) { var result []string expectedTPID := []string{"ID"} - if err := tpActionRPC.Call(utils.ApierV1GetTPActionIds, + if err := tpActionRPC.Call(utils.APIerSv1GetTPActionIds, &AttrGetTPActionIds{TPid: "TPAcc"}, &result); err != nil { t.Error(err) } else if !reflect.DeepEqual(expectedTPID, result) { @@ -275,7 +275,7 @@ func testTPActionsUpdateTPAction(t *testing.T) { }, } var result string - if err := tpActionRPC.Call(utils.ApierV1SetTPActions, tpActions, &result); err != nil { + if err := tpActionRPC.Call(utils.APIerSv1SetTPActions, tpActions, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -285,7 +285,7 @@ func testTPActionsUpdateTPAction(t *testing.T) { func testTPActionsGetTPActionAfterUpdate(t *testing.T) { var reply *utils.TPActions - if err := tpActionRPC.Call(utils.ApierV1GetTPActions, + if err := tpActionRPC.Call(utils.APIerSv1GetTPActions, &AttrGetTPActions{TPid: "TPAcc", ID: "ID"}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(tpActions.TPid, reply.TPid) { @@ -300,7 +300,7 @@ func testTPActionsGetTPActionAfterUpdate(t *testing.T) { func testTPActionsRemTPAction(t *testing.T) { var resp string - if err := tpActionRPC.Call(utils.ApierV1RemoveTPActions, + if err := tpActionRPC.Call(utils.APIerSv1RemoveTPActions, &AttrGetTPActions{TPid: "TPAcc", ID: "ID"}, &resp); err != nil { t.Error(err) } else if resp != utils.OK { @@ -311,7 +311,7 @@ func testTPActionsRemTPAction(t *testing.T) { func testTPActionsGetTPActionAfterRemove(t *testing.T) { var reply *utils.TPActionPlan - if err := tpActionRPC.Call(utils.ApierV1GetTPActions, + if err := tpActionRPC.Call(utils.APIerSv1GetTPActions, &AttrGetTPActions{TPid: "TPAcc", ID: "ID"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) } diff --git a/apier/v1/tpactiontriggers.go b/apier/v1/tpactiontriggers.go index d62c53687..e649ad47c 100644 --- a/apier/v1/tpactiontriggers.go +++ b/apier/v1/tpactiontriggers.go @@ -23,7 +23,7 @@ import ( ) // SetTPActionTriggers creates a new ActionTriggers profile within a tariff plan -func (api *ApierV1) SetTPActionTriggers(attrs utils.TPActionTriggers, reply *string) error { +func (api *APIerSv1) SetTPActionTriggers(attrs utils.TPActionTriggers, reply *string) error { if missing := utils.MissingStructFields(&attrs, []string{"TPid", "ID"}); len(missing) != 0 { return utils.NewErrMandatoryIeMissing(missing...) } @@ -41,7 +41,7 @@ type AttrGetTPActionTriggers struct { } // GetTPActionTriggers queries specific ActionTriggers profile on tariff plan -func (api *ApierV1) GetTPActionTriggers(attrs AttrGetTPActionTriggers, reply *utils.TPActionTriggers) error { +func (api *APIerSv1) GetTPActionTriggers(attrs AttrGetTPActionTriggers, reply *utils.TPActionTriggers) error { if missing := utils.MissingStructFields(&attrs, []string{"TPid", "ID"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } @@ -63,7 +63,7 @@ type AttrGetTPActionTriggerIds struct { } // GetTPActionTriggerIds queries ActionTriggers identities on specific tariff plan. -func (api *ApierV1) GetTPActionTriggerIds(attrs AttrGetTPActionTriggerIds, reply *[]string) error { +func (api *APIerSv1) GetTPActionTriggerIds(attrs AttrGetTPActionTriggerIds, reply *[]string) error { if missing := utils.MissingStructFields(&attrs, []string{"TPid"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } @@ -80,7 +80,7 @@ func (api *ApierV1) GetTPActionTriggerIds(attrs AttrGetTPActionTriggerIds, reply } // RemoveTPActionTriggers removes specific ActionTriggers on Tariff plan -func (api *ApierV1) RemoveTPActionTriggers(attrs AttrGetTPActionTriggers, reply *string) error { +func (api *APIerSv1) RemoveTPActionTriggers(attrs AttrGetTPActionTriggers, reply *string) error { if missing := utils.MissingStructFields(&attrs, []string{"TPid", "ID"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } diff --git a/apier/v1/tpactiontriggers_it_test.go b/apier/v1/tpactiontriggers_it_test.go index 2a571b6d0..ecea476c8 100644 --- a/apier/v1/tpactiontriggers_it_test.go +++ b/apier/v1/tpactiontriggers_it_test.go @@ -130,7 +130,7 @@ func testTPActionTriggersRpcConn(t *testing.T) { func testTPActionTriggersGetTPActionTriggersBeforeSet(t *testing.T) { var reply *utils.TPActionTriggers - if err := tpActionTriggerRPC.Call(utils.ApierV1GetTPActionTriggers, + if err := tpActionTriggerRPC.Call(utils.APIerSv1GetTPActionTriggers, &AttrGetTPActionTriggers{TPid: "TPAct", ID: "ID"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) } @@ -190,7 +190,7 @@ func testTPActionTriggersSetTPActionTriggers(t *testing.T) { }, } var result string - if err := tpActionTriggerRPC.Call(utils.ApierV1SetTPActionTriggers, tpActionTriggers, &result); err != nil { + if err := tpActionTriggerRPC.Call(utils.APIerSv1SetTPActionTriggers, tpActionTriggers, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -199,7 +199,7 @@ func testTPActionTriggersSetTPActionTriggers(t *testing.T) { func testTPActionTriggersGetTPActionTriggersAfterSet(t *testing.T) { var reply *utils.TPActionTriggers - if err := tpActionTriggerRPC.Call(utils.ApierV1GetTPActionTriggers, + if err := tpActionTriggerRPC.Call(utils.APIerSv1GetTPActionTriggers, &AttrGetTPActionTriggers{TPid: "TPAct", ID: "ID"}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(tpActionTriggers.TPid, reply.TPid) { @@ -214,7 +214,7 @@ func testTPActionTriggersGetTPActionTriggersAfterSet(t *testing.T) { func testTPActionTriggersGetTPActionTriggersIds(t *testing.T) { var result []string expectedTPID := []string{"ID"} - if err := tpActionTriggerRPC.Call(utils.ApierV1GetTPActionTriggerIds, + if err := tpActionTriggerRPC.Call(utils.APIerSv1GetTPActionTriggerIds, &AttrGetTPActionTriggerIds{TPid: "TPAct"}, &result); err != nil { t.Error(err) } else if !reflect.DeepEqual(expectedTPID, result) { @@ -296,7 +296,7 @@ func testTPActionTriggersUpdateTPActionTriggers(t *testing.T) { } var result string - if err := tpActionTriggerRPC.Call(utils.ApierV1SetTPActionTriggers, tpActionTriggers, &result); err != nil { + if err := tpActionTriggerRPC.Call(utils.APIerSv1SetTPActionTriggers, tpActionTriggers, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -306,7 +306,7 @@ func testTPActionTriggersUpdateTPActionTriggers(t *testing.T) { func testTPActionTriggersGetTPActionTriggersAfterUpdate(t *testing.T) { var reply *utils.TPActionTriggers - if err := tpActionTriggerRPC.Call(utils.ApierV1GetTPActionTriggers, + if err := tpActionTriggerRPC.Call(utils.APIerSv1GetTPActionTriggers, &AttrGetTPActionTriggers{TPid: "TPAct", ID: "ID"}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(tpActionTriggers.TPid, reply.TPid) { @@ -321,7 +321,7 @@ func testTPActionTriggersGetTPActionTriggersAfterUpdate(t *testing.T) { func testTPActionTriggersRemoveTPActionTriggers(t *testing.T) { var resp string - if err := tpActionTriggerRPC.Call(utils.ApierV1RemoveTPActionTriggers, + if err := tpActionTriggerRPC.Call(utils.APIerSv1RemoveTPActionTriggers, &AttrGetTPActionTriggers{TPid: "TPAct", ID: "ID"}, &resp); err != nil { t.Error(err) } else if resp != utils.OK { @@ -332,7 +332,7 @@ func testTPActionTriggersRemoveTPActionTriggers(t *testing.T) { func testTPActionTriggersGetTPActionTriggersAfterRemove(t *testing.T) { var reply *utils.TPActionTriggers - if err := tpActionTriggerRPC.Call(utils.ApierV1GetTPActionTriggers, + if err := tpActionTriggerRPC.Call(utils.APIerSv1GetTPActionTriggers, &AttrGetTPActionTriggers{TPid: "TPAct", ID: "ID"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) } diff --git a/apier/v1/tpattributes.go b/apier/v1/tpattributes.go index ede02cf0f..20129fee5 100644 --- a/apier/v1/tpattributes.go +++ b/apier/v1/tpattributes.go @@ -23,7 +23,7 @@ import ( ) // Creates a new AttributeProfile within a tariff plan -func (self *ApierV1) SetTPAttributeProfile(attrs *utils.TPAttributeProfile, reply *string) error { +func (self *APIerSv1) SetTPAttributeProfile(attrs *utils.TPAttributeProfile, reply *string) error { if missing := utils.MissingStructFields(attrs, []string{"TPid", "Tenant", "ID"}); len(missing) != 0 { return utils.NewErrMandatoryIeMissing(missing...) } @@ -35,7 +35,7 @@ func (self *ApierV1) SetTPAttributeProfile(attrs *utils.TPAttributeProfile, repl } // Queries specific AttributeProfile on Tariff plan -func (self *ApierV1) GetTPAttributeProfile(attr *utils.TPTntID, reply *utils.TPAttributeProfile) error { +func (self *APIerSv1) GetTPAttributeProfile(attr *utils.TPTntID, reply *utils.TPAttributeProfile) error { if missing := utils.MissingStructFields(attr, []string{"TPid", "Tenant", "ID"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } @@ -56,7 +56,7 @@ type AttrGetTPAttributeProfileIds struct { } // Queries attribute identities on specific tariff plan. -func (self *ApierV1) GetTPAttributeProfileIds(attrs *AttrGetTPAttributeProfileIds, reply *[]string) error { +func (self *APIerSv1) GetTPAttributeProfileIds(attrs *AttrGetTPAttributeProfileIds, reply *[]string) error { if missing := utils.MissingStructFields(attrs, []string{"TPid"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } @@ -72,7 +72,7 @@ func (self *ApierV1) GetTPAttributeProfileIds(attrs *AttrGetTPAttributeProfileId } // Removes specific AttributeProfile on Tariff plan -func (self *ApierV1) RemoveTPAttributeProfile(attrs *utils.TPTntID, reply *string) error { +func (self *APIerSv1) RemoveTPAttributeProfile(attrs *utils.TPTntID, reply *string) error { if missing := utils.MissingStructFields(attrs, []string{"TPid", "Tenant", "ID"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } diff --git a/apier/v1/tpattributes_it_test.go b/apier/v1/tpattributes_it_test.go index 1155cd844..7d71c69b3 100644 --- a/apier/v1/tpattributes_it_test.go +++ b/apier/v1/tpattributes_it_test.go @@ -119,7 +119,7 @@ func testTPAlsPrfRPCConn(t *testing.T) { func testTPAlsPrfGetTPAlsPrfBeforeSet(t *testing.T) { var reply *utils.TPAttributeProfile - if err := tpAlsPrfRPC.Call(utils.ApierV1GetTPAttributeProfile, + if err := tpAlsPrfRPC.Call(utils.APIerSv1GetTPAttributeProfile, &utils.TPTntID{TPid: "TP1", Tenant: "cgrates.org", ID: "Attr1"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) } @@ -147,7 +147,7 @@ func testTPAlsPrfSetTPAlsPrf(t *testing.T) { } sort.Strings(tpAlsPrf.FilterIDs) var result string - if err := tpAlsPrfRPC.Call(utils.ApierV1SetTPAttributeProfile, tpAlsPrf, &result); err != nil { + if err := tpAlsPrfRPC.Call(utils.APIerSv1SetTPAttributeProfile, tpAlsPrf, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -156,7 +156,7 @@ func testTPAlsPrfSetTPAlsPrf(t *testing.T) { func testTPAlsPrfGetTPAlsPrfAfterSet(t *testing.T) { var reply *utils.TPAttributeProfile - if err := tpAlsPrfRPC.Call(utils.ApierV1GetTPAttributeProfile, + if err := tpAlsPrfRPC.Call(utils.APIerSv1GetTPAttributeProfile, &utils.TPTntID{TPid: "TP1", Tenant: "cgrates.org", ID: "Attr1"}, &reply); err != nil { t.Fatal(err) } @@ -169,7 +169,7 @@ func testTPAlsPrfGetTPAlsPrfAfterSet(t *testing.T) { func testTPAlsPrfGetTPAlsPrfIDs(t *testing.T) { var result []string expectedTPID := []string{"Attr1"} - if err := tpAlsPrfRPC.Call(utils.ApierV1GetTPAttributeProfileIds, + if err := tpAlsPrfRPC.Call(utils.APIerSv1GetTPAttributeProfileIds, &AttrGetTPAttributeProfileIds{TPid: "TP1"}, &result); err != nil { t.Error(err) } else if !reflect.DeepEqual(expectedTPID, result) { @@ -191,7 +191,7 @@ func testTPAlsPrfUpdateTPAlsPrf(t *testing.T) { }, } var result string - if err := tpAlsPrfRPC.Call(utils.ApierV1SetTPAttributeProfile, tpAlsPrf, &result); err != nil { + if err := tpAlsPrfRPC.Call(utils.APIerSv1SetTPAttributeProfile, tpAlsPrf, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -228,7 +228,7 @@ func testTPAlsPrfGetTPAlsPrfAfterUpdate(t *testing.T) { sort.Slice(revTPAlsPrf.Attributes, func(i, j int) bool { return strings.Compare(revTPAlsPrf.Attributes[i].Path, revTPAlsPrf.Attributes[j].Path) == -1 }) - if err := tpAlsPrfRPC.Call(utils.ApierV1GetTPAttributeProfile, + if err := tpAlsPrfRPC.Call(utils.APIerSv1GetTPAttributeProfile, &utils.TPTntID{TPid: "TP1", Tenant: "cgrates.org", ID: "Attr1"}, &reply); err != nil { t.Fatal(err) } @@ -243,7 +243,7 @@ func testTPAlsPrfGetTPAlsPrfAfterUpdate(t *testing.T) { func testTPAlsPrfRemTPAlsPrf(t *testing.T) { var resp string - if err := tpAlsPrfRPC.Call(utils.ApierV1RemoveTPAttributeProfile, + if err := tpAlsPrfRPC.Call(utils.APIerSv1RemoveTPAttributeProfile, &utils.TPTntID{TPid: "TP1", Tenant: "cgrates.org", ID: "Attr1"}, &resp); err != nil { t.Error(err) @@ -254,7 +254,7 @@ func testTPAlsPrfRemTPAlsPrf(t *testing.T) { func testTPAlsPrfGetTPAlsPrfAfterRemove(t *testing.T) { var reply *utils.TPAttributeProfile - if err := tpAlsPrfRPC.Call(utils.ApierV1GetTPAttributeProfile, + if err := tpAlsPrfRPC.Call(utils.APIerSv1GetTPAttributeProfile, &utils.TPTntID{TPid: "TP1", Tenant: "cgrates.org", ID: "Attr1"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) diff --git a/apier/v1/tpchargers.go b/apier/v1/tpchargers.go index c65525bdd..2339ab5b5 100755 --- a/apier/v1/tpchargers.go +++ b/apier/v1/tpchargers.go @@ -23,7 +23,7 @@ import ( ) // Creates a new ChargerProfile within a tariff plan -func (self *ApierV1) SetTPCharger(attr *utils.TPChargerProfile, reply *string) error { +func (self *APIerSv1) SetTPCharger(attr *utils.TPChargerProfile, reply *string) error { if missing := utils.MissingStructFields(attr, []string{"TPid", "Tenant", "ID"}); len(missing) != 0 { return utils.NewErrMandatoryIeMissing(missing...) } @@ -35,7 +35,7 @@ func (self *ApierV1) SetTPCharger(attr *utils.TPChargerProfile, reply *string) e } // Queries specific ChargerProfile on Tariff plan -func (self *ApierV1) GetTPCharger(attr *utils.TPTntID, reply *utils.TPChargerProfile) error { +func (self *APIerSv1) GetTPCharger(attr *utils.TPTntID, reply *utils.TPChargerProfile) error { if missing := utils.MissingStructFields(attr, []string{"TPid", "Tenant", "ID"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } @@ -56,7 +56,7 @@ type AttrGetTPChargerIds struct { } // Queries Charger identities on specific tariff plan. -func (self *ApierV1) GetTPChargerIDs(attrs *AttrGetTPChargerIds, reply *[]string) error { +func (self *APIerSv1) GetTPChargerIDs(attrs *AttrGetTPChargerIds, reply *[]string) error { if missing := utils.MissingStructFields(attrs, []string{"TPid"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } @@ -73,7 +73,7 @@ func (self *ApierV1) GetTPChargerIDs(attrs *AttrGetTPChargerIds, reply *[]string } // Removes specific ChargerProfile on Tariff plan -func (self *ApierV1) RemoveTPCharger(attrs *utils.TPTntID, reply *string) error { +func (self *APIerSv1) RemoveTPCharger(attrs *utils.TPTntID, reply *string) error { if missing := utils.MissingStructFields(attrs, []string{"TPid", "Tenant", "ID"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } diff --git a/apier/v1/tpchargers_it_test.go b/apier/v1/tpchargers_it_test.go index ad8c82abf..d8eb48fe1 100644 --- a/apier/v1/tpchargers_it_test.go +++ b/apier/v1/tpchargers_it_test.go @@ -119,7 +119,7 @@ func testTPChrgsRPCConn(t *testing.T) { func testTPChrgsGetTPChrgsBeforeSet(t *testing.T) { var reply *utils.TPChargerProfile - if err := tpChrgsRPC.Call(utils.ApierV1GetTPCharger, + if err := tpChrgsRPC.Call(utils.APIerSv1GetTPCharger, &utils.TPTntID{TPid: "TP1", Tenant: "cgrates.org", ID: "Chrgs"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) @@ -143,7 +143,7 @@ func testTPChrgsSetTPChrgs(t *testing.T) { sort.Strings(tpChrgs.FilterIDs) sort.Strings(tpChrgs.AttributeIDs) var result string - if err := tpChrgsRPC.Call(utils.ApierV1SetTPCharger, tpChrgs, &result); err != nil { + if err := tpChrgsRPC.Call(utils.APIerSv1SetTPCharger, tpChrgs, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -152,7 +152,7 @@ func testTPChrgsSetTPChrgs(t *testing.T) { func testTPChrgsGetTPChrgsAfterSet(t *testing.T) { var reply *utils.TPChargerProfile - if err := tpChrgsRPC.Call(utils.ApierV1GetTPCharger, + if err := tpChrgsRPC.Call(utils.APIerSv1GetTPCharger, &utils.TPTntID{TPid: "TP1", Tenant: "cgrates.org", ID: "Chrgs"}, &reply); err != nil { t.Fatal(err) } @@ -166,7 +166,7 @@ func testTPChrgsGetTPChrgsAfterSet(t *testing.T) { func testTPChrgsGetTPChrgsIDs(t *testing.T) { var result []string expectedTPID := []string{"Chrgs"} - if err := tpChrgsRPC.Call(utils.ApierV1GetTPChargerIDs, + if err := tpChrgsRPC.Call(utils.APIerSv1GetTPChargerIDs, &AttrGetTPAttributeProfileIds{TPid: "TP1"}, &result); err != nil { t.Error(err) } else if !reflect.DeepEqual(expectedTPID, result) { @@ -177,7 +177,7 @@ func testTPChrgsGetTPChrgsIDs(t *testing.T) { func testTPChrgsUpdateTPChrgs(t *testing.T) { tpChrgs.AttributeIDs = []string{"Attr1", "Attr2", "Attr3"} var result string - if err := tpChrgsRPC.Call(utils.ApierV1SetTPCharger, tpChrgs, &result); err != nil { + if err := tpChrgsRPC.Call(utils.APIerSv1SetTPCharger, tpChrgs, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -186,7 +186,7 @@ func testTPChrgsUpdateTPChrgs(t *testing.T) { func testTPChrgsGetTPChrgsAfterUpdate(t *testing.T) { var reply *utils.TPChargerProfile - if err := tpChrgsRPC.Call(utils.ApierV1GetTPCharger, + if err := tpChrgsRPC.Call(utils.APIerSv1GetTPCharger, &utils.TPTntID{TPid: "TP1", Tenant: "cgrates.org", ID: "Chrgs"}, &reply); err != nil { t.Fatal(err) } @@ -199,7 +199,7 @@ func testTPChrgsGetTPChrgsAfterUpdate(t *testing.T) { func testTPChrgsRemTPChrgs(t *testing.T) { var resp string - if err := tpChrgsRPC.Call(utils.ApierV1RemoveTPCharger, + if err := tpChrgsRPC.Call(utils.APIerSv1RemoveTPCharger, &utils.TPTntID{TPid: "TP1", Tenant: "cgrates.org", ID: "Chrgs"}, &resp); err != nil { t.Error(err) @@ -210,7 +210,7 @@ func testTPChrgsRemTPChrgs(t *testing.T) { func testTPChrgsGetTPChrgsAfterRemove(t *testing.T) { var reply *utils.TPChargerProfile - if err := tpChrgsRPC.Call(utils.ApierV1GetTPCharger, + if err := tpChrgsRPC.Call(utils.APIerSv1GetTPCharger, &utils.TPTntID{TPid: "TP1", Tenant: "cgrates.org", ID: "Chrgs"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) diff --git a/apier/v1/tpdestinationrates.go b/apier/v1/tpdestinationrates.go index cd32225d0..042b1a69c 100644 --- a/apier/v1/tpdestinationrates.go +++ b/apier/v1/tpdestinationrates.go @@ -25,7 +25,7 @@ import ( ) // Creates a new DestinationRate profile within a tariff plan -func (self *ApierV1) SetTPDestinationRate(attrs utils.TPDestinationRate, reply *string) error { +func (self *APIerSv1) SetTPDestinationRate(attrs utils.TPDestinationRate, reply *string) error { if missing := utils.MissingStructFields(&attrs, []string{"TPid", "ID", "DestinationRates"}); len(missing) != 0 { return utils.NewErrMandatoryIeMissing(missing...) } @@ -43,7 +43,7 @@ type AttrGetTPDestinationRate struct { } // Queries specific DestinationRate profile on tariff plan -func (self *ApierV1) GetTPDestinationRate(attrs AttrGetTPDestinationRate, reply *utils.TPDestinationRate) error { +func (self *APIerSv1) GetTPDestinationRate(attrs AttrGetTPDestinationRate, reply *utils.TPDestinationRate) error { if missing := utils.MissingStructFields(&attrs, []string{"TPid", "ID"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } @@ -64,7 +64,7 @@ type AttrTPDestinationRateIds struct { } // Queries DestinationRate identities on specific tariff plan. -func (self *ApierV1) GetTPDestinationRateIds(attrs AttrGetTPRateIds, reply *[]string) error { +func (self *APIerSv1) GetTPDestinationRateIds(attrs AttrGetTPRateIds, reply *[]string) error { if missing := utils.MissingStructFields(&attrs, []string{"TPid"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } @@ -81,7 +81,7 @@ func (self *ApierV1) GetTPDestinationRateIds(attrs AttrGetTPRateIds, reply *[]st } // Removes specific DestinationRate on Tariff plan -func (self *ApierV1) RemoveTPDestinationRate(attrs AttrGetTPDestinationRate, reply *string) error { +func (self *APIerSv1) RemoveTPDestinationRate(attrs AttrGetTPDestinationRate, reply *string) error { if missing := utils.MissingStructFields(&attrs, []string{"TPid", "ID"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } diff --git a/apier/v1/tpdestinationrates_it_test.go b/apier/v1/tpdestinationrates_it_test.go index 727d23d17..27a65aeef 100644 --- a/apier/v1/tpdestinationrates_it_test.go +++ b/apier/v1/tpdestinationrates_it_test.go @@ -124,7 +124,7 @@ func testTPDstRateRpcConn(t *testing.T) { func testTPDstRateGetTPDstRateBeforeSet(t *testing.T) { var reply *utils.TPDestinationRate - if err := tpDstRateRPC.Call(utils.ApierV1GetTPDestinationRate, + if err := tpDstRateRPC.Call(utils.APIerSv1GetTPDestinationRate, &AttrGetTPDestinationRate{TPid: "TP1", ID: "DR_FREESWITCH_USERS"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) @@ -145,7 +145,7 @@ func testTPDstRateSetTPDstRate(t *testing.T) { }, } var result string - if err := tpDstRateRPC.Call(utils.ApierV1SetTPDestinationRate, tpDstRate, &result); err != nil { + if err := tpDstRateRPC.Call(utils.APIerSv1SetTPDestinationRate, tpDstRate, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -154,7 +154,7 @@ func testTPDstRateSetTPDstRate(t *testing.T) { func testTPDstRateGetTPDstRateAfterSet(t *testing.T) { var reply *utils.TPDestinationRate - if err := tpDstRateRPC.Call(utils.ApierV1GetTPDestinationRate, + if err := tpDstRateRPC.Call(utils.APIerSv1GetTPDestinationRate, &AttrGetTPDestinationRate{TPid: "TP1", ID: "DR_FREESWITCH_USERS"}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(tpDstRate, reply) { @@ -165,7 +165,7 @@ func testTPDstRateGetTPDstRateAfterSet(t *testing.T) { func testTPDstRateGetTPDstRateIds(t *testing.T) { var result []string expectedTPID := []string{"DR_FREESWITCH_USERS"} - if err := tpDstRateRPC.Call(utils.ApierV1GetTPDestinationRateIds, + if err := tpDstRateRPC.Call(utils.APIerSv1GetTPDestinationRateIds, &AttrTPDestinationRateIds{TPid: "TP1"}, &result); err != nil { t.Error(err) } else if !reflect.DeepEqual(expectedTPID, result) { @@ -180,7 +180,7 @@ func testTPDstRateUpdateTPDstRate(t *testing.T) { func testTPDstRateGetTPDstRateAfterUpdate(t *testing.T) { var reply *utils.TPDestinationRate - if err := tpDstRateRPC.Call(utils.ApierV1GetTPDestinationRate, + if err := tpDstRateRPC.Call(utils.APIerSv1GetTPDestinationRate, &AttrGetTPDestinationRate{TPid: "TP1", ID: "DR_FREESWITCH_USERS"}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(tpDstRate, reply) { @@ -190,7 +190,7 @@ func testTPDstRateGetTPDstRateAfterUpdate(t *testing.T) { func testTPDstRateRemTPDstRate(t *testing.T) { var resp string - if err := tpDstRateRPC.Call(utils.ApierV1RemoveTPDestinationRate, + if err := tpDstRateRPC.Call(utils.APIerSv1RemoveTPDestinationRate, &AttrGetTPDestinationRate{TPid: "TP1", ID: "DR_FREESWITCH_USERS"}, &resp); err != nil { t.Error(err) } else if resp != utils.OK { @@ -201,7 +201,7 @@ func testTPDstRateRemTPDstRate(t *testing.T) { func testTPDstRateGetTPDstRateAfterRemove(t *testing.T) { var reply *utils.TPDestinationRate - if err := tpDstRateRPC.Call(utils.ApierV1GetTPDestinationRate, + if err := tpDstRateRPC.Call(utils.APIerSv1GetTPDestinationRate, &AttrGetTPDestinationRate{TPid: "TP1", ID: "DR_FREESWITCH_USERS"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) diff --git a/apier/v1/tpdestinations.go b/apier/v1/tpdestinations.go index 6d575c259..7bcb969e4 100644 --- a/apier/v1/tpdestinations.go +++ b/apier/v1/tpdestinations.go @@ -23,7 +23,7 @@ import ( ) // Creates a new destination within a tariff plan -func (self *ApierV1) SetTPDestination(attrs utils.TPDestination, reply *string) error { +func (self *APIerSv1) SetTPDestination(attrs utils.TPDestination, reply *string) error { if missing := utils.MissingStructFields(&attrs, []string{"TPid", "ID", "Prefixes"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } @@ -40,7 +40,7 @@ type AttrGetTPDestination struct { } // Queries a specific destination -func (self *ApierV1) GetTPDestination(attrs AttrGetTPDestination, reply *utils.TPDestination) error { +func (self *APIerSv1) GetTPDestination(attrs AttrGetTPDestination, reply *utils.TPDestination) error { if missing := utils.MissingStructFields(&attrs, []string{"TPid", "ID"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } @@ -62,7 +62,7 @@ type AttrGetTPDestinationIds struct { } // Queries destination identities on specific tariff plan. -func (self *ApierV1) GetTPDestinationIDs(attrs AttrGetTPDestinationIds, reply *[]string) error { +func (self *APIerSv1) GetTPDestinationIDs(attrs AttrGetTPDestinationIds, reply *[]string) error { if missing := utils.MissingStructFields(&attrs, []string{"TPid"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } @@ -78,7 +78,7 @@ func (self *ApierV1) GetTPDestinationIDs(attrs AttrGetTPDestinationIds, reply *[ } // Removes specific Destination on Tariff plan -func (self *ApierV1) RemoveTPDestination(attrs AttrGetTPDestination, reply *string) error { +func (self *APIerSv1) RemoveTPDestination(attrs AttrGetTPDestination, reply *string) error { if missing := utils.MissingStructFields(&attrs, []string{"TPid", "ID"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } diff --git a/apier/v1/tpdestinations_it_test.go b/apier/v1/tpdestinations_it_test.go index 1bd213698..1a0cbd009 100644 --- a/apier/v1/tpdestinations_it_test.go +++ b/apier/v1/tpdestinations_it_test.go @@ -129,7 +129,7 @@ func testTPDestinationsRpcConn(t *testing.T) { func testTPDestinationsGetTPDestinationBeforeSet(t *testing.T) { var reply *utils.TPDestination - if err := tpDestinationRPC.Call(utils.ApierV1GetTPDestination, + if err := tpDestinationRPC.Call(utils.APIerSv1GetTPDestination, &AttrGetTPDestination{TPid: "TPD", ID: "GERMANY"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) } @@ -143,7 +143,7 @@ func testTPDestinationsSetTPDestination(t *testing.T) { Prefixes: []string{"+49", "+4915"}, } var result string - if err := tpDestinationRPC.Call(utils.ApierV1SetTPDestination, tpDestination, &result); err != nil { + if err := tpDestinationRPC.Call(utils.APIerSv1SetTPDestination, tpDestination, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -152,7 +152,7 @@ func testTPDestinationsSetTPDestination(t *testing.T) { func testTPDestinationsGetTPDestinationAfterSet(t *testing.T) { var reply *utils.TPDestination - if err := tpDestinationRPC.Call(utils.ApierV1GetTPDestination, + if err := tpDestinationRPC.Call(utils.APIerSv1GetTPDestination, &AttrGetTPDestination{TPid: "TPD", ID: "GERMANY"}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(tpDestination.TPid, reply.TPid) { @@ -168,7 +168,7 @@ func testTPDestinationsGetTPDestinationAfterSet(t *testing.T) { func testTPDestinationsGetTPDestinationIds(t *testing.T) { var result []string expectedTPID := []string{"GERMANY"} - if err := tpDestinationRPC.Call(utils.ApierV1GetTPDestinationIDs, + if err := tpDestinationRPC.Call(utils.APIerSv1GetTPDestinationIDs, &AttrGetTPDestinationIds{TPid: "TPD"}, &result); err != nil { t.Error(err) } else if !reflect.DeepEqual(expectedTPID, result) { @@ -180,7 +180,7 @@ func testTPDestinationsGetTPDestinationIds(t *testing.T) { func testTPDestinationsUpdateTPDestination(t *testing.T) { tpDestination.Prefixes = []string{"+49", "+4915", "+4916"} var result string - if err := tpDestinationRPC.Call(utils.ApierV1SetTPDestination, tpDestination, &result); err != nil { + if err := tpDestinationRPC.Call(utils.APIerSv1SetTPDestination, tpDestination, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -190,7 +190,7 @@ func testTPDestinationsUpdateTPDestination(t *testing.T) { func testTPDestinationsGetTPDestinationAfterUpdate(t *testing.T) { var reply *utils.TPDestination - if err := tpDestinationRPC.Call(utils.ApierV1GetTPDestination, + if err := tpDestinationRPC.Call(utils.APIerSv1GetTPDestination, &AttrGetTPDestination{TPid: "TPD", ID: "GERMANY"}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(tpDestination.TPid, reply.TPid) { @@ -205,7 +205,7 @@ func testTPDestinationsGetTPDestinationAfterUpdate(t *testing.T) { func testTPDestinationsRemoveTPDestination(t *testing.T) { var resp string - if err := tpDestinationRPC.Call(utils.ApierV1RemoveTPDestination, + if err := tpDestinationRPC.Call(utils.APIerSv1RemoveTPDestination, &AttrGetTPDestination{TPid: "TPD", ID: "GERMANY"}, &resp); err != nil { t.Error(err) } else if resp != utils.OK { @@ -216,7 +216,7 @@ func testTPDestinationsRemoveTPDestination(t *testing.T) { func testTPDestinationsGetTPDestinationAfterRemove(t *testing.T) { var reply *utils.TPDestination - if err := tpDestinationRPC.Call(utils.ApierV1GetTPDestination, + if err := tpDestinationRPC.Call(utils.APIerSv1GetTPDestination, &AttrGetTPDestination{TPid: "TPD", ID: "GERMANY"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) } diff --git a/apier/v1/tpdispatchers.go b/apier/v1/tpdispatchers.go index fa5e5d74f..6f37beb07 100644 --- a/apier/v1/tpdispatchers.go +++ b/apier/v1/tpdispatchers.go @@ -23,7 +23,7 @@ import ( ) //SetTPDispatcher creates a new DispatcherProfile within a tariff plan -func (self *ApierV1) SetTPDispatcherProfile(attr *utils.TPDispatcherProfile, reply *string) error { +func (self *APIerSv1) SetTPDispatcherProfile(attr *utils.TPDispatcherProfile, reply *string) error { if missing := utils.MissingStructFields(attr, []string{"TPid", "Tenant", "ID"}); len(missing) != 0 { return utils.NewErrMandatoryIeMissing(missing...) } @@ -35,7 +35,7 @@ func (self *ApierV1) SetTPDispatcherProfile(attr *utils.TPDispatcherProfile, rep } //GetTPCharger queries specific DispatcherProfile on Tariff plan -func (self *ApierV1) GetTPDispatcherProfile(attr *utils.TPTntID, reply *utils.TPDispatcherProfile) error { +func (self *APIerSv1) GetTPDispatcherProfile(attr *utils.TPTntID, reply *utils.TPDispatcherProfile) error { if missing := utils.MissingStructFields(attr, []string{"TPid", "Tenant", "ID"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } @@ -56,7 +56,7 @@ type AttrGetTPDispatcherIds struct { } //GetTPDispatcherIDs queries dispatcher identities on specific tariff plan. -func (self *ApierV1) GetTPDispatcherProfileIDs(attrs *AttrGetTPDispatcherIds, reply *[]string) error { +func (self *APIerSv1) GetTPDispatcherProfileIDs(attrs *AttrGetTPDispatcherIds, reply *[]string) error { if missing := utils.MissingStructFields(attrs, []string{"TPid"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } @@ -73,7 +73,7 @@ func (self *ApierV1) GetTPDispatcherProfileIDs(attrs *AttrGetTPDispatcherIds, re } //RemoveTPCharger removes specific DispatcherProfile on Tariff plan -func (self *ApierV1) RemoveTPDispatcherProfile(attrs *utils.TPTntID, reply *string) error { +func (self *APIerSv1) RemoveTPDispatcherProfile(attrs *utils.TPTntID, reply *string) error { if missing := utils.MissingStructFields(attrs, []string{"TPid", "Tenant", "ID"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } @@ -87,7 +87,7 @@ func (self *ApierV1) RemoveTPDispatcherProfile(attrs *utils.TPTntID, reply *stri } //SetTPDispatcherHost creates a new DispatcherHost within a tariff plan -func (self *ApierV1) SetTPDispatcherHost(attr *utils.TPDispatcherHost, reply *string) error { +func (self *APIerSv1) SetTPDispatcherHost(attr *utils.TPDispatcherHost, reply *string) error { if missing := utils.MissingStructFields(attr, []string{"TPid", "Tenant", "ID"}); len(missing) != 0 { return utils.NewErrMandatoryIeMissing(missing...) } @@ -99,7 +99,7 @@ func (self *ApierV1) SetTPDispatcherHost(attr *utils.TPDispatcherHost, reply *st } //GetTPDispatcherHost queries specific DispatcherHosts on Tariff plan -func (self *ApierV1) GetTPDispatcherHost(attr *utils.TPTntID, reply *utils.TPDispatcherHost) error { +func (self *APIerSv1) GetTPDispatcherHost(attr *utils.TPTntID, reply *utils.TPDispatcherHost) error { if missing := utils.MissingStructFields(attr, []string{"TPid", "Tenant", "ID"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } @@ -115,7 +115,7 @@ func (self *ApierV1) GetTPDispatcherHost(attr *utils.TPTntID, reply *utils.TPDis } //GetTPDispatcherHostIDs queries dispatcher host identities on specific tariff plan. -func (self *ApierV1) GetTPDispatcherHostIDs(attrs *AttrGetTPDispatcherIds, reply *[]string) error { +func (self *APIerSv1) GetTPDispatcherHostIDs(attrs *AttrGetTPDispatcherIds, reply *[]string) error { if missing := utils.MissingStructFields(attrs, []string{"TPid"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } @@ -132,7 +132,7 @@ func (self *ApierV1) GetTPDispatcherHostIDs(attrs *AttrGetTPDispatcherIds, reply } //RemoveTPDispatcherHost removes specific DispatcherHost on Tariff plan -func (self *ApierV1) RemoveTPDispatcherHost(attrs *utils.TPTntID, reply *string) error { +func (self *APIerSv1) RemoveTPDispatcherHost(attrs *utils.TPTntID, reply *string) error { if missing := utils.MissingStructFields(attrs, []string{"TPid", "Tenant", "ID"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } diff --git a/apier/v1/tpdispatchers_it_test.go b/apier/v1/tpdispatchers_it_test.go index c1fbe9cd0..3ffc75eb4 100644 --- a/apier/v1/tpdispatchers_it_test.go +++ b/apier/v1/tpdispatchers_it_test.go @@ -118,7 +118,7 @@ func testTPDispatcherRpcConn(t *testing.T) { func ttestTPDispatcherGetTPDispatcherBeforeSet(t *testing.T) { var reply *utils.TPDispatcherProfile - if err := tpDispatcherRPC.Call(utils.ApierV1GetTPDispatcherProfile, + if err := tpDispatcherRPC.Call(utils.APIerSv1GetTPDispatcherProfile, &utils.TPTntID{TPid: "TP1", Tenant: "cgrates.org", ID: "Dsp1"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) @@ -140,7 +140,7 @@ func testTPDispatcherSetTPDispatcher(t *testing.T) { } var result string - if err := tpDispatcherRPC.Call(utils.ApierV1SetTPDispatcherProfile, tpDispatcher, &result); err != nil { + if err := tpDispatcherRPC.Call(utils.APIerSv1SetTPDispatcherProfile, tpDispatcher, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -149,7 +149,7 @@ func testTPDispatcherSetTPDispatcher(t *testing.T) { func testTPDispatcherGetTPDispatcherAfterSet(t *testing.T) { var reply *utils.TPDispatcherProfile - if err := tpDispatcherRPC.Call(utils.ApierV1GetTPDispatcherProfile, + if err := tpDispatcherRPC.Call(utils.APIerSv1GetTPDispatcherProfile, &utils.TPTntID{TPid: "TP1", Tenant: "cgrates.org", ID: "Dsp1"}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(tpDispatcher, reply) { @@ -160,7 +160,7 @@ func testTPDispatcherGetTPDispatcherAfterSet(t *testing.T) { func testTPDispatcherGetFilterIds(t *testing.T) { var result []string expectedTPID := []string{"Dsp1"} - if err := tpDispatcherRPC.Call(utils.ApierV1GetTPDispatcherProfileIDs, + if err := tpDispatcherRPC.Call(utils.APIerSv1GetTPDispatcherProfileIDs, &AttrGetTPDispatcherIds{TPid: "TP1"}, &result); err != nil { t.Error(err) } else if !reflect.DeepEqual(expectedTPID, result) { @@ -170,7 +170,7 @@ func testTPDispatcherGetFilterIds(t *testing.T) { func testTPDispatcherUpdateTPDispatcher(t *testing.T) { var result string - if err := tpDispatcherRPC.Call(utils.ApierV1SetTPDispatcherProfile, tpDispatcher, &result); err != nil { + if err := tpDispatcherRPC.Call(utils.APIerSv1SetTPDispatcherProfile, tpDispatcher, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -191,7 +191,7 @@ func testTPDispatcherGetTPDispatcherAfterUpdate(t *testing.T) { Strategy: utils.MetaFirst, Weight: 10, } - if err := tpDispatcherRPC.Call(utils.ApierV1GetTPDispatcherProfile, + if err := tpDispatcherRPC.Call(utils.APIerSv1GetTPDispatcherProfile, &utils.TPTntID{TPid: "TP1", Tenant: "cgrates.org", ID: "Dsp1"}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(tpDispatcher, reply) && !reflect.DeepEqual(revHosts, reply) { @@ -201,7 +201,7 @@ func testTPDispatcherGetTPDispatcherAfterUpdate(t *testing.T) { func testTPDispatcherRemTPDispatcher(t *testing.T) { var resp string - if err := tpDispatcherRPC.Call(utils.ApierV1RemoveTPDispatcherProfile, + if err := tpDispatcherRPC.Call(utils.APIerSv1RemoveTPDispatcherProfile, &utils.TPTntID{TPid: "TP1", Tenant: "cgrates.org", ID: "Dsp1"}, &resp); err != nil { t.Error(err) } else if resp != utils.OK { @@ -211,7 +211,7 @@ func testTPDispatcherRemTPDispatcher(t *testing.T) { func testTPDispatcherGetTPDispatcherAfterRemove(t *testing.T) { var reply *utils.TPDispatcherProfile - if err := tpDispatcherRPC.Call(utils.ApierV1GetTPDispatcherProfile, + if err := tpDispatcherRPC.Call(utils.APIerSv1GetTPDispatcherProfile, &utils.TPTntID{TPid: "TP1", Tenant: "cgrates.org", ID: "Dsp1"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) diff --git a/apier/v1/tpfilters.go b/apier/v1/tpfilters.go index d0ebcdec7..65c942375 100644 --- a/apier/v1/tpfilters.go +++ b/apier/v1/tpfilters.go @@ -23,7 +23,7 @@ import ( ) // Creates a new FilterProfile within a tariff plan -func (self *ApierV1) SetTPFilterProfile(attrs *utils.TPFilterProfile, reply *string) error { +func (self *APIerSv1) SetTPFilterProfile(attrs *utils.TPFilterProfile, reply *string) error { if missing := utils.MissingStructFields(attrs, []string{"TPid", "Tenant", "ID"}); len(missing) != 0 { return utils.NewErrMandatoryIeMissing(missing...) } @@ -35,7 +35,7 @@ func (self *ApierV1) SetTPFilterProfile(attrs *utils.TPFilterProfile, reply *str } // Queries specific FilterProfile on tariff plan -func (self *ApierV1) GetTPFilterProfile(attr *utils.TPTntID, reply *utils.TPFilterProfile) error { +func (self *APIerSv1) GetTPFilterProfile(attr *utils.TPTntID, reply *utils.TPFilterProfile) error { if missing := utils.MissingStructFields(attr, []string{"TPid", "Tenant", "ID"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } @@ -56,7 +56,7 @@ type AttrGetTPFilterProfileIds struct { } // Queries FilterProfile identities on specific tariff plan. -func (self *ApierV1) GetTPFilterProfileIds(attrs *AttrGetTPFilterProfileIds, reply *[]string) error { +func (self *APIerSv1) GetTPFilterProfileIds(attrs *AttrGetTPFilterProfileIds, reply *[]string) error { if missing := utils.MissingStructFields(attrs, []string{"TPid"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } @@ -73,7 +73,7 @@ func (self *ApierV1) GetTPFilterProfileIds(attrs *AttrGetTPFilterProfileIds, rep } // Removes specific FilterProfile on Tariff plan -func (self *ApierV1) RemoveTPFilterProfile(attrs *utils.TPTntID, reply *string) error { +func (self *APIerSv1) RemoveTPFilterProfile(attrs *utils.TPTntID, reply *string) error { if missing := utils.MissingStructFields(attrs, []string{"TPid", "Tenant", "ID"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } diff --git a/apier/v1/tpfilters_it_test.go b/apier/v1/tpfilters_it_test.go index 69d696913..77b2c3883 100644 --- a/apier/v1/tpfilters_it_test.go +++ b/apier/v1/tpfilters_it_test.go @@ -127,7 +127,7 @@ func testTPFilterRpcConn(t *testing.T) { func ttestTPFilterGetTPFilterBeforeSet(t *testing.T) { var reply *utils.TPFilterProfile - if err := tpFilterRPC.Call(utils.ApierV1GetTPFilterProfile, + if err := tpFilterRPC.Call(utils.APIerSv1GetTPFilterProfile, &utils.TPTntID{TPid: "TP1", Tenant: "cgrates.org", ID: "Filter"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) @@ -154,7 +154,7 @@ func testTPFilterSetTPFilter(t *testing.T) { sort.Strings(tpFilter.Filters[0].Values) var result string - if err := tpFilterRPC.Call(utils.ApierV1SetTPFilterProfile, tpFilter, &result); err != nil { + if err := tpFilterRPC.Call(utils.APIerSv1SetTPFilterProfile, tpFilter, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -163,7 +163,7 @@ func testTPFilterSetTPFilter(t *testing.T) { func testTPFilterGetTPFilterAfterSet(t *testing.T) { var reply *utils.TPFilterProfile - if err := tpFilterRPC.Call(utils.ApierV1GetTPFilterProfile, + if err := tpFilterRPC.Call(utils.APIerSv1GetTPFilterProfile, &utils.TPTntID{TPid: "TP1", Tenant: "cgrates.org", ID: "Filter"}, &reply); err != nil { t.Fatal(err) } @@ -176,7 +176,7 @@ func testTPFilterGetTPFilterAfterSet(t *testing.T) { func testTPFilterGetFilterIds(t *testing.T) { var result []string expectedTPID := []string{"Filter"} - if err := tpFilterRPC.Call(utils.ApierV1GetTPFilterProfileIds, + if err := tpFilterRPC.Call(utils.APIerSv1GetTPFilterProfileIds, &AttrGetTPFilterProfileIds{TPid: "TP1"}, &result); err != nil { t.Error(err) } else if !reflect.DeepEqual(expectedTPID, result) { @@ -203,7 +203,7 @@ func testTPFilterUpdateTPFilter(t *testing.T) { return strings.Compare(tpFilter.Filters[i].Element, tpFilter.Filters[j].Element) == -1 }) var result string - if err := tpFilterRPC.Call(utils.ApierV1SetTPFilterProfile, tpFilter, &result); err != nil { + if err := tpFilterRPC.Call(utils.APIerSv1SetTPFilterProfile, tpFilter, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -212,7 +212,7 @@ func testTPFilterUpdateTPFilter(t *testing.T) { func testTPFilterGetTPFilterAfterUpdate(t *testing.T) { var reply *utils.TPFilterProfile - if err := tpFilterRPC.Call(utils.ApierV1GetTPFilterProfile, + if err := tpFilterRPC.Call(utils.APIerSv1GetTPFilterProfile, &utils.TPTntID{TPid: "TP1", Tenant: "cgrates.org", ID: "Filter"}, &reply); err != nil { t.Fatal(err) } @@ -228,7 +228,7 @@ func testTPFilterGetTPFilterAfterUpdate(t *testing.T) { func testTPFilterRemTPFilter(t *testing.T) { var resp string - if err := tpFilterRPC.Call(utils.ApierV1RemoveTPFilterProfile, + if err := tpFilterRPC.Call(utils.APIerSv1RemoveTPFilterProfile, &utils.TPTntID{TPid: "TP1", Tenant: "cgrates.org", ID: "Filter"}, &resp); err != nil { t.Error(err) } else if resp != utils.OK { @@ -238,7 +238,7 @@ func testTPFilterRemTPFilter(t *testing.T) { func testTPFilterGetTPFilterAfterRemove(t *testing.T) { var reply *utils.TPFilterProfile - if err := tpFilterRPC.Call(utils.ApierV1GetTPFilterProfile, + if err := tpFilterRPC.Call(utils.APIerSv1GetTPFilterProfile, &utils.TPTntID{TPid: "TP1", Tenant: "cgrates.org", ID: "Filter"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) diff --git a/apier/v1/tprates.go b/apier/v1/tprates.go index 73143f78d..c992043fa 100644 --- a/apier/v1/tprates.go +++ b/apier/v1/tprates.go @@ -25,7 +25,7 @@ import ( ) // Creates a new rate within a tariff plan -func (self *ApierV1) SetTPRate(attrs utils.TPRate, reply *string) error { +func (self *APIerSv1) SetTPRate(attrs utils.TPRate, reply *string) error { if missing := utils.MissingStructFields(&attrs, []string{"TPid", "ID", "RateSlots"}); len(missing) != 0 { return utils.NewErrMandatoryIeMissing(missing...) } @@ -42,7 +42,7 @@ type AttrGetTPRate struct { } // Queries specific Rate on tariff plan -func (self *ApierV1) GetTPRate(attrs AttrGetTPRate, reply *utils.TPRate) error { +func (self *APIerSv1) GetTPRate(attrs AttrGetTPRate, reply *utils.TPRate) error { if missing := utils.MissingStructFields(&attrs, []string{"TPid", "ID"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } @@ -63,7 +63,7 @@ type AttrGetTPRateIds struct { } // Queries rate identities on specific tariff plan. -func (self *ApierV1) GetTPRateIds(attrs AttrGetTPRateIds, reply *[]string) error { +func (self *APIerSv1) GetTPRateIds(attrs AttrGetTPRateIds, reply *[]string) error { if missing := utils.MissingStructFields(&attrs, []string{"TPid"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } @@ -80,7 +80,7 @@ func (self *ApierV1) GetTPRateIds(attrs AttrGetTPRateIds, reply *[]string) error } // Removes specific Rate on Tariff plan -func (self *ApierV1) RemoveTPRate(attrs AttrGetTPRate, reply *string) error { +func (self *APIerSv1) RemoveTPRate(attrs AttrGetTPRate, reply *string) error { if missing := utils.MissingStructFields(&attrs, []string{"TPid", "ID"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } diff --git a/apier/v1/tprates_it_test.go b/apier/v1/tprates_it_test.go index ab158bf54..010ce23c4 100644 --- a/apier/v1/tprates_it_test.go +++ b/apier/v1/tprates_it_test.go @@ -129,7 +129,7 @@ func testTPRatesRpcConn(t *testing.T) { func testTPRatesGetTPRateforeSet(t *testing.T) { var reply *utils.TPRate - if err := tpRateRPC.Call(utils.ApierV1GetTPRate, + if err := tpRateRPC.Call(utils.APIerSv1GetTPRate, &AttrGetTPRate{TPid: "TPidTpRate", ID: "RT_FS_USERS"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) } @@ -157,7 +157,7 @@ func testTPRatesSetTPRate(t *testing.T) { }, } var result string - if err := tpRateRPC.Call(utils.ApierV1SetTPRate, tpRate, &result); err != nil { + if err := tpRateRPC.Call(utils.APIerSv1SetTPRate, tpRate, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -166,7 +166,7 @@ func testTPRatesSetTPRate(t *testing.T) { func testTPRatesGetTPRateAfterSet(t *testing.T) { var reply *utils.TPRate - if err := tpRateRPC.Call(utils.ApierV1GetTPRate, &AttrGetTPRate{TPid: "TPidTpRate", ID: tpRate.ID}, &reply); err != nil { + if err := tpRateRPC.Call(utils.APIerSv1GetTPRate, &AttrGetTPRate{TPid: "TPidTpRate", ID: tpRate.ID}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(tpRate, reply) { t.Errorf("Expecting : %+v, received: %+v", tpRate, reply) @@ -176,7 +176,7 @@ func testTPRatesGetTPRateAfterSet(t *testing.T) { func testTPRatesGetTPRateIds(t *testing.T) { var result []string expectedTPID := []string{"RT_FS_USERS"} - if err := tpRateRPC.Call(utils.ApierV1GetTPRateIds, &AttrGetTPRateIds{TPid: "TPidTpRate"}, &result); err != nil { + if err := tpRateRPC.Call(utils.APIerSv1GetTPRateIds, &AttrGetTPRateIds{TPid: "TPidTpRate"}, &result); err != nil { t.Error(err) } else if !reflect.DeepEqual(expectedTPID, result) { t.Errorf("Expecting: %+v, received: %+v", expectedTPID, result) @@ -208,7 +208,7 @@ func testTPRatesUpdateTPRate(t *testing.T) { GroupIntervalStart: "3s", }, } - if err := tpRateRPC.Call(utils.ApierV1SetTPRate, tpRate, &result); err != nil { + if err := tpRateRPC.Call(utils.APIerSv1SetTPRate, tpRate, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -217,7 +217,7 @@ func testTPRatesUpdateTPRate(t *testing.T) { func testTPRatesGetTPRateAfterUpdate(t *testing.T) { var reply *utils.TPRate - if err := tpRateRPC.Call(utils.ApierV1GetTPRate, + if err := tpRateRPC.Call(utils.APIerSv1GetTPRate, &AttrGetTPRate{TPid: "TPidTpRate", ID: tpRate.ID}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(tpRate, reply) { @@ -228,7 +228,7 @@ func testTPRatesGetTPRateAfterUpdate(t *testing.T) { func testTPRatesRemoveTPRate(t *testing.T) { var resp string - if err := tpRateRPC.Call(utils.ApierV1RemoveTPRate, + if err := tpRateRPC.Call(utils.APIerSv1RemoveTPRate, &AttrGetTPRate{TPid: "TPidTpRate", ID: "RT_FS_USERS"}, &resp); err != nil { t.Error(err) } else if resp != utils.OK { @@ -238,7 +238,7 @@ func testTPRatesRemoveTPRate(t *testing.T) { func testTPRatesGetTPRateAfterRemove(t *testing.T) { var reply *utils.TPRate - if err := tpRateRPC.Call(utils.ApierV1GetTPRate, + if err := tpRateRPC.Call(utils.APIerSv1GetTPRate, &AttrGetTPRate{TPid: "TPidTpRate", ID: "RT_FS_USERS"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) } diff --git a/apier/v1/tpratingplans.go b/apier/v1/tpratingplans.go index 533fb9a60..02421efc8 100644 --- a/apier/v1/tpratingplans.go +++ b/apier/v1/tpratingplans.go @@ -25,7 +25,7 @@ import ( ) // Creates a new DestinationRateTiming profile within a tariff plan -func (self *ApierV1) SetTPRatingPlan(attrs utils.TPRatingPlan, reply *string) error { +func (self *APIerSv1) SetTPRatingPlan(attrs utils.TPRatingPlan, reply *string) error { if missing := utils.MissingStructFields(&attrs, []string{"TPid", "ID", "RatingPlanBindings"}); len(missing) != 0 { return utils.NewErrMandatoryIeMissing(missing...) } @@ -43,7 +43,7 @@ type AttrGetTPRatingPlan struct { } // Queries specific RatingPlan profile on tariff plan -func (self *ApierV1) GetTPRatingPlan(attrs AttrGetTPRatingPlan, reply *utils.TPRatingPlan) error { +func (self *APIerSv1) GetTPRatingPlan(attrs AttrGetTPRatingPlan, reply *utils.TPRatingPlan) error { if missing := utils.MissingStructFields(&attrs, []string{"TPid", "ID"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } @@ -64,7 +64,7 @@ type AttrGetTPRatingPlanIds struct { } // Queries RatingPlan identities on specific tariff plan. -func (self *ApierV1) GetTPRatingPlanIds(attrs AttrGetTPRatingPlanIds, reply *[]string) error { +func (self *APIerSv1) GetTPRatingPlanIds(attrs AttrGetTPRatingPlanIds, reply *[]string) error { if missing := utils.MissingStructFields(&attrs, []string{"TPid"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } @@ -81,7 +81,7 @@ func (self *ApierV1) GetTPRatingPlanIds(attrs AttrGetTPRatingPlanIds, reply *[]s } // Removes specific RatingPlan on Tariff plan -func (self *ApierV1) RemoveTPRatingPlan(attrs AttrGetTPRatingPlan, reply *string) error { +func (self *APIerSv1) RemoveTPRatingPlan(attrs AttrGetTPRatingPlan, reply *string) error { if missing := utils.MissingStructFields(&attrs, []string{"TPid", "ID"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } diff --git a/apier/v1/tpratingplans_it_test.go b/apier/v1/tpratingplans_it_test.go index 42e79514e..16b7694f0 100644 --- a/apier/v1/tpratingplans_it_test.go +++ b/apier/v1/tpratingplans_it_test.go @@ -129,7 +129,7 @@ func testTPRatingPlansRpcConn(t *testing.T) { func testTPRatingPlansGetTPRatingPlanBeforeSet(t *testing.T) { var reply *utils.TPRatingPlan - if err := tpRatingPlanRPC.Call(utils.ApierV1GetTPRatingPlan, + if err := tpRatingPlanRPC.Call(utils.APIerSv1GetTPRatingPlan, &AttrGetTPRatingPlan{TPid: "TPRP1", ID: "Plan1"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) } @@ -153,7 +153,7 @@ func testTPRatingPlansSetTPRatingPlan(t *testing.T) { }, } var result string - if err := tpRatingPlanRPC.Call(utils.ApierV1SetTPRatingPlan, tpRatingPlan, &result); err != nil { + if err := tpRatingPlanRPC.Call(utils.APIerSv1SetTPRatingPlan, tpRatingPlan, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -162,7 +162,7 @@ func testTPRatingPlansSetTPRatingPlan(t *testing.T) { func testTPRatingPlansGetTPRatingPlanAfterSet(t *testing.T) { var respond *utils.TPRatingPlan - if err := tpRatingPlanRPC.Call(utils.ApierV1GetTPRatingPlan, + if err := tpRatingPlanRPC.Call(utils.APIerSv1GetTPRatingPlan, &AttrGetTPRatingPlan{TPid: "TPRP1", ID: "Plan1"}, &respond); err != nil { t.Error(err) } else if !reflect.DeepEqual(tpRatingPlan.TPid, respond.TPid) { @@ -177,7 +177,7 @@ func testTPRatingPlansGetTPRatingPlanAfterSet(t *testing.T) { func testTPRatingPlansGetTPRatingPlanIds(t *testing.T) { var result []string expected := []string{"Plan1"} - if err := tpRatingPlanRPC.Call(utils.ApierV1GetTPRatingPlanIds, + if err := tpRatingPlanRPC.Call(utils.APIerSv1GetTPRatingPlanIds, &AttrGetTPRatingPlanIds{TPid: tpRatingPlan.TPid}, &result); err != nil { t.Error(err) } else if !reflect.DeepEqual(expected, result) { @@ -204,7 +204,7 @@ func testTPRatingPlansUpdateTPRatingPlan(t *testing.T) { }, } var result string - if err := tpRatingPlanRPC.Call(utils.ApierV1SetTPRatingPlan, tpRatingPlan, &result); err != nil { + if err := tpRatingPlanRPC.Call(utils.APIerSv1SetTPRatingPlan, tpRatingPlan, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -213,7 +213,7 @@ func testTPRatingPlansUpdateTPRatingPlan(t *testing.T) { func testTPRatingPlansGetTPRatingPlanAfterUpdate(t *testing.T) { var respond *utils.TPRatingPlan - if err := tpRatingPlanRPC.Call(utils.ApierV1GetTPRatingPlan, + if err := tpRatingPlanRPC.Call(utils.APIerSv1GetTPRatingPlan, &AttrGetTPRatingPlan{TPid: "TPRP1", ID: "Plan1"}, &respond); err != nil { t.Error(err) } else if !reflect.DeepEqual(tpRatingPlan.TPid, respond.TPid) { @@ -227,7 +227,7 @@ func testTPRatingPlansGetTPRatingPlanAfterUpdate(t *testing.T) { func testTPRatingPlansRemoveTPRatingPlan(t *testing.T) { var resp string - if err := tpRatingPlanRPC.Call(utils.ApierV1RemoveTPRatingPlan, + if err := tpRatingPlanRPC.Call(utils.APIerSv1RemoveTPRatingPlan, &AttrGetTPRatingPlan{TPid: "TPRP1", ID: "Plan1"}, &resp); err != nil { t.Error(err) } else if resp != utils.OK { @@ -237,7 +237,7 @@ func testTPRatingPlansRemoveTPRatingPlan(t *testing.T) { func testTPRatingPlansGetTPRatingPlanAfterRemove(t *testing.T) { var respond *utils.TPRatingPlan - if err := tpRatingPlanRPC.Call(utils.ApierV1GetTPRatingPlan, + if err := tpRatingPlanRPC.Call(utils.APIerSv1GetTPRatingPlan, &AttrGetTPRatingPlan{TPid: "TPRP1", ID: "Plan1"}, &respond); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) } diff --git a/apier/v1/tpratingprofiles.go b/apier/v1/tpratingprofiles.go index 664a631ce..676c7bb4b 100644 --- a/apier/v1/tpratingprofiles.go +++ b/apier/v1/tpratingprofiles.go @@ -26,7 +26,7 @@ import ( ) // SetTPRatingProfile creates a new RatingProfile within a tariff plan -func (api *ApierV1) SetTPRatingProfile(attrs utils.TPRatingProfile, reply *string) error { +func (api *APIerSv1) SetTPRatingProfile(attrs utils.TPRatingProfile, reply *string) error { if missing := utils.MissingStructFields(&attrs, []string{"TPid", "LoadId", "Tenant", "Category", "Subject", "RatingPlanActivations"}); len(missing) != 0 { return utils.NewErrMandatoryIeMissing(missing...) @@ -39,7 +39,7 @@ func (api *ApierV1) SetTPRatingProfile(attrs utils.TPRatingProfile, reply *strin } // GetTPRatingProfilesByLoadID queries specific RatingProfile on tariff plan -func (api *ApierV1) GetTPRatingProfilesByLoadID(attrs utils.TPRatingProfile, reply *[]*utils.TPRatingProfile) error { +func (api *APIerSv1) GetTPRatingProfilesByLoadID(attrs utils.TPRatingProfile, reply *[]*utils.TPRatingProfile) error { mndtryFlds := []string{"TPid", "LoadId"} if len(attrs.Subject) != 0 { // If Subject provided as filter, make all related fields mandatory mndtryFlds = append(mndtryFlds, "Tenant", "Category", "Subject") @@ -59,7 +59,7 @@ func (api *ApierV1) GetTPRatingProfilesByLoadID(attrs utils.TPRatingProfile, rep } // GetTPRatingProfileLoadIds queries RatingProfile identities on specific tariff plan. -func (api *ApierV1) GetTPRatingProfileLoadIds(attrs utils.AttrTPRatingProfileIds, reply *[]string) error { +func (api *APIerSv1) GetTPRatingProfileLoadIds(attrs utils.AttrTPRatingProfileIds, reply *[]string) error { if missing := utils.MissingStructFields(&attrs, []string{"TPid"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } @@ -86,7 +86,7 @@ type AttrGetTPRatingProfile struct { } // GetTPRatingProfile queries specific RatingProfile on tariff plan -func (api *ApierV1) GetTPRatingProfile(attrs AttrGetTPRatingProfile, reply *utils.TPRatingProfile) error { +func (api *APIerSv1) GetTPRatingProfile(attrs AttrGetTPRatingProfile, reply *utils.TPRatingProfile) error { if missing := utils.MissingStructFields(&attrs, []string{"TPid", "RatingProfileID"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } @@ -112,7 +112,7 @@ type AttrGetTPRatingProfileIds struct { } // GetTPRatingProfileIds queries RatingProfiles identities on specific tariff plan. -func (api *ApierV1) GetTPRatingProfileIds(attrs AttrGetTPRatingProfileIds, reply *[]string) error { +func (api *APIerSv1) GetTPRatingProfileIds(attrs AttrGetTPRatingProfileIds, reply *[]string) error { if missing := utils.MissingStructFields(&attrs, []string{"TPid"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } @@ -130,7 +130,7 @@ func (api *ApierV1) GetTPRatingProfileIds(attrs AttrGetTPRatingProfileIds, reply } // RemoveTPRatingProfile removes specific RatingProfiles on Tariff plan -func (api *ApierV1) RemoveTPRatingProfile(attrs AttrGetTPRatingProfile, reply *string) (err error) { +func (api *APIerSv1) RemoveTPRatingProfile(attrs AttrGetTPRatingProfile, reply *string) (err error) { if missing := utils.MissingStructFields(&attrs, []string{"TPid", "RatingProfileID"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } diff --git a/apier/v1/tpratingprofiles_it_test.go b/apier/v1/tpratingprofiles_it_test.go index 8f093d383..253ea9b20 100644 --- a/apier/v1/tpratingprofiles_it_test.go +++ b/apier/v1/tpratingprofiles_it_test.go @@ -133,7 +133,7 @@ func testTPRatingProfilesRpcConn(t *testing.T) { func testTPRatingProfilesGetTPRatingProfileBeforeSet(t *testing.T) { var reply *utils.TPRatingProfile - if err := tpRatingProfileRPC.Call(utils.ApierV1GetTPRatingProfile, + if err := tpRatingProfileRPC.Call(utils.APIerSv1GetTPRatingProfile, &AttrGetTPRatingProfile{TPid: "TPRProf1", RatingProfileID: tpRatingProfileID}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) } @@ -160,7 +160,7 @@ func testTPRatingProfilesSetTPRatingProfile(t *testing.T) { }, } var result string - if err := tpRatingProfileRPC.Call(utils.ApierV1SetTPRatingProfile, tpRatingProfile, &result); err != nil { + if err := tpRatingProfileRPC.Call(utils.APIerSv1SetTPRatingProfile, tpRatingProfile, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -169,7 +169,7 @@ func testTPRatingProfilesSetTPRatingProfile(t *testing.T) { func testTPRatingProfilesGetTPRatingProfileAfterSet(t *testing.T) { var respond *utils.TPRatingProfile - if err := tpRatingProfileRPC.Call(utils.ApierV1GetTPRatingProfile, + if err := tpRatingProfileRPC.Call(utils.APIerSv1GetTPRatingProfile, &AttrGetTPRatingProfile{TPid: "TPRProf1", RatingProfileID: tpRatingProfileID}, &respond); err != nil { t.Error(err) } else if !reflect.DeepEqual(tpRatingProfile.TPid, respond.TPid) { @@ -190,7 +190,7 @@ func testTPRatingProfilesGetTPRatingProfileAfterSet(t *testing.T) { func testTPRatingProfilesGetTPRatingProfileLoadIds(t *testing.T) { var result []string expected := []string{"RPrf"} - if err := tpRatingProfileRPC.Call(utils.ApierV1GetTPRatingProfileLoadIds, + if err := tpRatingProfileRPC.Call(utils.APIerSv1GetTPRatingProfileLoadIds, &utils.AttrTPRatingProfileIds{TPid: tpRatingProfile.TPid, Tenant: tpRatingProfile.Tenant, Category: tpRatingProfile.Category, Subject: tpRatingProfile.Subject}, &result); err != nil { t.Error(err) @@ -201,7 +201,7 @@ func testTPRatingProfilesGetTPRatingProfileLoadIds(t *testing.T) { func testTPRatingProfilesGetTPRatingProfilesByLoadID(t *testing.T) { var respond *[]*utils.TPRatingProfile - if err := tpRatingProfileRPC.Call(utils.ApierV1GetTPRatingProfilesByLoadID, + if err := tpRatingProfileRPC.Call(utils.APIerSv1GetTPRatingProfilesByLoadID, &utils.TPRatingProfile{TPid: "TPRProf1", LoadId: "RPrf"}, &respond); err != nil { t.Error(err) } else if !reflect.DeepEqual(tpRatingProfile.TPid, (*respond)[0].TPid) { @@ -238,7 +238,7 @@ func testTPRatingProfilesUpdateTPRatingProfile(t *testing.T) { FallbackSubjects: "Retreat", }, } - if err := tpRatingProfileRPC.Call(utils.ApierV1SetTPRatingProfile, tpRatingProfile, &result); err != nil { + if err := tpRatingProfileRPC.Call(utils.APIerSv1SetTPRatingProfile, tpRatingProfile, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -247,7 +247,7 @@ func testTPRatingProfilesUpdateTPRatingProfile(t *testing.T) { func testTPRatingProfilesGetTPRatingProfileAfterUpdate(t *testing.T) { var respond *utils.TPRatingProfile - if err := tpRatingProfileRPC.Call(utils.ApierV1GetTPRatingProfile, + if err := tpRatingProfileRPC.Call(utils.APIerSv1GetTPRatingProfile, &AttrGetTPRatingProfile{TPid: "TPRProf1", RatingProfileID: tpRatingProfileID}, &respond); err != nil { t.Error(err) } else if !reflect.DeepEqual(tpRatingProfile.TPid, respond.TPid) { @@ -268,7 +268,7 @@ func testTPRatingProfilesGetTPRatingProfileAfterUpdate(t *testing.T) { func testTPRatingProfilesGetTPRatingProfileIds(t *testing.T) { var respond []string expected := []string{"RPrf:Tenant1:Category:Subject"} - if err := tpRatingProfileRPC.Call(utils.ApierV1GetTPRatingProfileIds, + if err := tpRatingProfileRPC.Call(utils.APIerSv1GetTPRatingProfileIds, &AttrGetTPRatingProfileIds{TPid: "TPRProf1"}, &respond); err != nil { t.Error(err) } else if !reflect.DeepEqual(expected, respond) { @@ -278,7 +278,7 @@ func testTPRatingProfilesGetTPRatingProfileIds(t *testing.T) { func testTPRatingProfilesRemoveTPRatingProfile(t *testing.T) { var resp string - if err := tpRatingProfileRPC.Call(utils.ApierV1RemoveTPRatingProfile, + if err := tpRatingProfileRPC.Call(utils.APIerSv1RemoveTPRatingProfile, &AttrGetTPRatingProfile{TPid: "TPRProf1", RatingProfileID: tpRatingProfile.GetId()}, &resp); err != nil { t.Error(err) } else if resp != utils.OK { @@ -289,7 +289,7 @@ func testTPRatingProfilesRemoveTPRatingProfile(t *testing.T) { func testTPRatingProfilesGetTPRatingProfileAfterRemove(t *testing.T) { var respond *utils.TPRatingProfile - if err := tpRatingProfileRPC.Call(utils.ApierV1GetTPRatingProfile, + if err := tpRatingProfileRPC.Call(utils.APIerSv1GetTPRatingProfile, &AttrGetTPRatingProfile{TPid: "TPRProf1", RatingProfileID: tpRatingProfileID}, &respond); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) } diff --git a/apier/v1/tpresources.go b/apier/v1/tpresources.go index 9f72000d9..a8e9693d0 100644 --- a/apier/v1/tpresources.go +++ b/apier/v1/tpresources.go @@ -23,7 +23,7 @@ import ( ) // Creates a new resource within a tariff plan -func (self *ApierV1) SetTPResource(attr *utils.TPResourceProfile, reply *string) error { +func (self *APIerSv1) SetTPResource(attr *utils.TPResourceProfile, reply *string) error { if missing := utils.MissingStructFields(attr, []string{"TPid", "Tenant", "ID", "Limit"}); len(missing) != 0 { return utils.NewErrMandatoryIeMissing(missing...) } @@ -35,7 +35,7 @@ func (self *ApierV1) SetTPResource(attr *utils.TPResourceProfile, reply *string) } // Queries specific Resource on Tariff plan -func (self *ApierV1) GetTPResource(attr *utils.TPTntID, reply *utils.TPResourceProfile) error { +func (self *APIerSv1) GetTPResource(attr *utils.TPTntID, reply *utils.TPResourceProfile) error { if missing := utils.MissingStructFields(attr, []string{"TPid", "Tenant", "ID"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } @@ -56,7 +56,7 @@ type AttrGetTPResourceIds struct { } // Queries Resource identities on specific tariff plan. -func (self *ApierV1) GetTPResourceIDs(attrs *AttrGetTPResourceIds, reply *[]string) error { +func (self *APIerSv1) GetTPResourceIDs(attrs *AttrGetTPResourceIds, reply *[]string) error { if missing := utils.MissingStructFields(attrs, []string{"TPid"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } @@ -73,7 +73,7 @@ func (self *ApierV1) GetTPResourceIDs(attrs *AttrGetTPResourceIds, reply *[]stri } // Removes specific Resource on Tariff plan -func (self *ApierV1) RemoveTPResource(attrs *utils.TPTntID, reply *string) error { +func (self *APIerSv1) RemoveTPResource(attrs *utils.TPTntID, reply *string) error { if missing := utils.MissingStructFields(attrs, []string{"TPid", "Tenant", "ID"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } diff --git a/apier/v1/tpresources_it_test.go b/apier/v1/tpresources_it_test.go index b36a41065..076f2c1b5 100644 --- a/apier/v1/tpresources_it_test.go +++ b/apier/v1/tpresources_it_test.go @@ -124,7 +124,7 @@ func testTPResRpcConn(t *testing.T) { func testTPResGetTPResourceBeforeSet(t *testing.T) { var reply *utils.TPResourceProfile - if err := tpResRPC.Call(utils.ApierV1GetTPResource, + if err := tpResRPC.Call(utils.APIerSv1GetTPResource, &utils.TPTntID{TPid: "TPR1", Tenant: "cgrates.org", ID: "ResGroup1"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) @@ -151,7 +151,7 @@ func testTPResSetTPResource(t *testing.T) { } sort.Strings(tpRes.ThresholdIDs) var result string - if err := tpResRPC.Call(utils.ApierV1SetTPResource, tpRes, &result); err != nil { + if err := tpResRPC.Call(utils.APIerSv1SetTPResource, tpRes, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -160,7 +160,7 @@ func testTPResSetTPResource(t *testing.T) { func testTPResGetTPResourceAfterSet(t *testing.T) { var respond *utils.TPResourceProfile - if err := tpResRPC.Call(utils.ApierV1GetTPResource, &utils.TPTntID{TPid: "TPR1", Tenant: "cgrates.org", ID: "ResGroup1"}, + if err := tpResRPC.Call(utils.APIerSv1GetTPResource, &utils.TPTntID{TPid: "TPR1", Tenant: "cgrates.org", ID: "ResGroup1"}, &respond); err != nil { t.Fatal(err) } @@ -174,7 +174,7 @@ func testTPResUpdateTPResource(t *testing.T) { var result string tpRes.FilterIDs = []string{"FLTR_1", "FLTR_STS1"} sort.Strings(tpRes.FilterIDs) - if err := tpResRPC.Call(utils.ApierV1SetTPResource, tpRes, &result); err != nil { + if err := tpResRPC.Call(utils.APIerSv1SetTPResource, tpRes, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -183,7 +183,7 @@ func testTPResUpdateTPResource(t *testing.T) { func testTPResGetTPResourceAfterUpdate(t *testing.T) { var expectedTPR *utils.TPResourceProfile - if err := tpResRPC.Call(utils.ApierV1GetTPResource, &utils.TPTntID{TPid: "TPR1", Tenant: "cgrates.org", ID: "ResGroup1"}, + if err := tpResRPC.Call(utils.APIerSv1GetTPResource, &utils.TPTntID{TPid: "TPR1", Tenant: "cgrates.org", ID: "ResGroup1"}, &expectedTPR); err != nil { t.Fatal(err) } @@ -196,7 +196,7 @@ func testTPResGetTPResourceAfterUpdate(t *testing.T) { func testTPResRemoveTPResource(t *testing.T) { var resp string - if err := tpResRPC.Call(utils.ApierV1RemoveTPResource, &utils.TPTntID{TPid: "TPR1", Tenant: "cgrates.org", ID: "ResGroup1"}, + if err := tpResRPC.Call(utils.APIerSv1RemoveTPResource, &utils.TPTntID{TPid: "TPR1", Tenant: "cgrates.org", ID: "ResGroup1"}, &resp); err != nil { t.Error(err) } else if resp != utils.OK { @@ -206,7 +206,7 @@ func testTPResRemoveTPResource(t *testing.T) { func testTPResGetTPResourceAfterRemove(t *testing.T) { var respond *utils.TPResourceProfile - if err := tpResRPC.Call(utils.ApierV1GetTPResource, &utils.TPTntID{TPid: "TPR1", Tenant: "cgrates.org", ID: "ResGroup1"}, + if err := tpResRPC.Call(utils.APIerSv1GetTPResource, &utils.TPTntID{TPid: "TPR1", Tenant: "cgrates.org", ID: "ResGroup1"}, &respond); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) } diff --git a/apier/v1/tpsharedgroups.go b/apier/v1/tpsharedgroups.go index 88d1efb1a..e0e8d59fc 100644 --- a/apier/v1/tpsharedgroups.go +++ b/apier/v1/tpsharedgroups.go @@ -23,7 +23,7 @@ import ( ) // Creates a new SharedGroups profile within a tariff plan -func (self *ApierV1) SetTPSharedGroups(attrs utils.TPSharedGroups, reply *string) error { +func (self *APIerSv1) SetTPSharedGroups(attrs utils.TPSharedGroups, reply *string) error { if missing := utils.MissingStructFields(&attrs, []string{"TPid", "ID", "SharedGroups"}); len(missing) != 0 { return utils.NewErrMandatoryIeMissing(missing...) } @@ -40,7 +40,7 @@ type AttrGetTPSharedGroups struct { } // Queries specific SharedGroup on tariff plan -func (self *ApierV1) GetTPSharedGroups(attrs AttrGetTPSharedGroups, reply *utils.TPSharedGroups) error { +func (self *APIerSv1) GetTPSharedGroups(attrs AttrGetTPSharedGroups, reply *utils.TPSharedGroups) error { if missing := utils.MissingStructFields(&attrs, []string{"TPid", "ID"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } @@ -61,7 +61,7 @@ type AttrGetTPSharedGroupIds struct { } // Queries SharedGroups identities on specific tariff plan. -func (self *ApierV1) GetTPSharedGroupIds(attrs AttrGetTPSharedGroupIds, reply *[]string) error { +func (self *APIerSv1) GetTPSharedGroupIds(attrs AttrGetTPSharedGroupIds, reply *[]string) error { if missing := utils.MissingStructFields(&attrs, []string{"TPid"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } @@ -78,7 +78,7 @@ func (self *ApierV1) GetTPSharedGroupIds(attrs AttrGetTPSharedGroupIds, reply *[ } // Removes specific SharedGroups on Tariff plan -func (self *ApierV1) RemoveTPSharedGroups(attrs AttrGetTPSharedGroups, reply *string) error { +func (self *APIerSv1) RemoveTPSharedGroups(attrs AttrGetTPSharedGroups, reply *string) error { if missing := utils.MissingStructFields(&attrs, []string{"TPid", "ID"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } diff --git a/apier/v1/tpsharedgroups_it_test.go b/apier/v1/tpsharedgroups_it_test.go index 9adaf1cb5..99018d316 100644 --- a/apier/v1/tpsharedgroups_it_test.go +++ b/apier/v1/tpsharedgroups_it_test.go @@ -129,7 +129,7 @@ func testTPSharedGroupsRpcConn(t *testing.T) { func testTPSharedGroupsBeforeSet(t *testing.T) { var reply *utils.TPSharedGroups - if err := tpSharedGroupRPC.Call(utils.ApierV1GetTPSharedGroups, AttrGetTPSharedGroups{TPid: "TPS1", ID: "Group1"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { + if err := tpSharedGroupRPC.Call(utils.APIerSv1GetTPSharedGroups, AttrGetTPSharedGroups{TPid: "TPS1", ID: "Group1"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) } } @@ -152,7 +152,7 @@ func testTPSharedGroupsSetSharedGroups(t *testing.T) { }, } var result string - if err := tpSharedGroupRPC.Call(utils.ApierV1SetTPSharedGroups, tpSharedGroups, &result); err != nil { + if err := tpSharedGroupRPC.Call(utils.APIerSv1SetTPSharedGroups, tpSharedGroups, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -161,7 +161,7 @@ func testTPSharedGroupsSetSharedGroups(t *testing.T) { func testTPSharedGroupsAfterSet(t *testing.T) { var respond *utils.TPSharedGroups - if err := tpSharedGroupRPC.Call(utils.ApierV1GetTPSharedGroups, &AttrGetTPSharedGroups{TPid: tpSharedGroups.TPid, ID: tpSharedGroups.ID}, &respond); err != nil { + if err := tpSharedGroupRPC.Call(utils.APIerSv1GetTPSharedGroups, &AttrGetTPSharedGroups{TPid: tpSharedGroups.TPid, ID: tpSharedGroups.ID}, &respond); err != nil { t.Error(err) } else if !reflect.DeepEqual(tpSharedGroups.TPid, respond.TPid) { t.Errorf("Expecting: %+v, received: %+v", tpSharedGroups.TPid, respond.TPid) @@ -175,7 +175,7 @@ func testTPSharedGroupsAfterSet(t *testing.T) { func testTPSharedGroupsGetTPSharedGroupIds(t *testing.T) { var result []string expectedTPID := []string{"Group1"} - if err := tpSharedGroupRPC.Call(utils.ApierV1GetTPSharedGroupIds, + if err := tpSharedGroupRPC.Call(utils.APIerSv1GetTPSharedGroupIds, AttrGetTPSharedGroupIds{tpSharedGroups.TPid, utils.PaginatorWithSearch{}}, &result); err != nil { t.Error(err) } else if !reflect.DeepEqual(result, expectedTPID) { @@ -202,7 +202,7 @@ func testTPSharedGroupsUpdateTPShareGroups(t *testing.T) { RatingSubject: "SubPlus", }, } - if err := tpSharedGroupRPC.Call(utils.ApierV1SetTPSharedGroups, tpSharedGroups, &result); err != nil { + if err := tpSharedGroupRPC.Call(utils.APIerSv1SetTPSharedGroups, tpSharedGroups, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -211,7 +211,7 @@ func testTPSharedGroupsUpdateTPShareGroups(t *testing.T) { func testTpSharedGroupsGetTPSharedGroupsAfterUpdate(t *testing.T) { var expectedTPS *utils.TPSharedGroups - if err := tpSharedGroupRPC.Call(utils.ApierV1GetTPSharedGroups, &AttrGetTPSharedGroups{TPid: tpSharedGroups.TPid, ID: tpSharedGroups.ID}, &expectedTPS); err != nil { + if err := tpSharedGroupRPC.Call(utils.APIerSv1GetTPSharedGroups, &AttrGetTPSharedGroups{TPid: tpSharedGroups.TPid, ID: tpSharedGroups.ID}, &expectedTPS); err != nil { t.Error(err) } else if !reflect.DeepEqual(tpSharedGroups.TPid, expectedTPS.TPid) { t.Errorf("Expecting: %+v, received: %+v", tpSharedGroups.TPid, expectedTPS.TPid) @@ -224,7 +224,7 @@ func testTpSharedGroupsGetTPSharedGroupsAfterUpdate(t *testing.T) { func testTPSharedGroupsRemoveTPSharedGroups(t *testing.T) { var resp string - if err := tpSharedGroupRPC.Call(utils.ApierV1RemoveTPSharedGroups, &AttrGetTPSharedGroups{TPid: tpSharedGroups.TPid, ID: tpSharedGroups.ID}, &resp); err != nil { + if err := tpSharedGroupRPC.Call(utils.APIerSv1RemoveTPSharedGroups, &AttrGetTPSharedGroups{TPid: tpSharedGroups.TPid, ID: tpSharedGroups.ID}, &resp); err != nil { t.Error(err) } else if resp != utils.OK { t.Error("Unexpected reply returned", resp) @@ -233,7 +233,7 @@ func testTPSharedGroupsRemoveTPSharedGroups(t *testing.T) { func testTPSharedGroupsGetTPSharedGroupsAfterRemove(t *testing.T) { var reply *utils.TPSharedGroups - if err := tpSharedGroupRPC.Call(utils.ApierV1GetTPSharedGroups, AttrGetTPSharedGroups{TPid: "TPS1", ID: "Group1"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { + if err := tpSharedGroupRPC.Call(utils.APIerSv1GetTPSharedGroups, AttrGetTPSharedGroups{TPid: "TPS1", ID: "Group1"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) } } diff --git a/apier/v1/tpstats.go b/apier/v1/tpstats.go index 22e4d4543..8f4ceaab3 100644 --- a/apier/v1/tpstats.go +++ b/apier/v1/tpstats.go @@ -23,7 +23,7 @@ import ( ) // Creates a new stat within a tariff plan -func (self *ApierV1) SetTPStat(attr *utils.TPStatProfile, reply *string) error { +func (self *APIerSv1) SetTPStat(attr *utils.TPStatProfile, reply *string) error { if missing := utils.MissingStructFields(attr, []string{"TPid", "Tenant", "ID"}); len(missing) != 0 { return utils.NewErrMandatoryIeMissing(missing...) } @@ -35,7 +35,7 @@ func (self *ApierV1) SetTPStat(attr *utils.TPStatProfile, reply *string) error { } // Queries specific Stat on Tariff plan -func (self *ApierV1) GetTPStat(attr *utils.TPTntID, reply *utils.TPStatProfile) error { +func (self *APIerSv1) GetTPStat(attr *utils.TPTntID, reply *utils.TPStatProfile) error { if missing := utils.MissingStructFields(attr, []string{"TPid", "Tenant", "ID"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } @@ -57,7 +57,7 @@ type AttrGetTPStatIds struct { } // Queries Stat identities on specific tariff plan. -func (self *ApierV1) GetTPStatIDs(attrs *AttrGetTPStatIds, reply *[]string) error { +func (self *APIerSv1) GetTPStatIDs(attrs *AttrGetTPStatIds, reply *[]string) error { if missing := utils.MissingStructFields(&attrs, []string{"TPid"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } @@ -74,7 +74,7 @@ func (self *ApierV1) GetTPStatIDs(attrs *AttrGetTPStatIds, reply *[]string) erro } // Removes specific Stat on Tariff plan -func (self *ApierV1) RemoveTPStat(attrs *utils.TPTntID, reply *string) error { +func (self *APIerSv1) RemoveTPStat(attrs *utils.TPTntID, reply *string) error { if missing := utils.MissingStructFields(attrs, []string{"TPid", "Tenant", "ID"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } diff --git a/apier/v1/tpstats_it_test.go b/apier/v1/tpstats_it_test.go index 7e02cdc89..93e601767 100644 --- a/apier/v1/tpstats_it_test.go +++ b/apier/v1/tpstats_it_test.go @@ -125,7 +125,7 @@ func testTPStatsRpcConn(t *testing.T) { func testTPStatsGetTPStatBeforeSet(t *testing.T) { var reply *utils.TPStatProfile - if err := tpStatRPC.Call(utils.ApierV1GetTPStat, + if err := tpStatRPC.Call(utils.APIerSv1GetTPStat, &utils.TPTntID{TPid: "TPS1", Tenant: "cgrates.org", ID: "Stat1"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) @@ -156,7 +156,7 @@ func testTPStatsSetTPStat(t *testing.T) { } sort.Strings(tpStat.ThresholdIDs) var result string - if err := tpStatRPC.Call(utils.ApierV1SetTPStat, tpStat, &result); err != nil { + if err := tpStatRPC.Call(utils.APIerSv1SetTPStat, tpStat, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -165,7 +165,7 @@ func testTPStatsSetTPStat(t *testing.T) { func testTPStatsGetTPStatAfterSet(t *testing.T) { var respond *utils.TPStatProfile - if err := tpStatRPC.Call(utils.ApierV1GetTPStat, + if err := tpStatRPC.Call(utils.APIerSv1GetTPStat, &utils.TPTntID{TPid: "TPS1", Tenant: "cgrates.org", ID: "Stat1"}, &respond); err != nil { t.Fatal(err) } @@ -189,7 +189,7 @@ func testTPStatsUpdateTPStat(t *testing.T) { sort.Slice(tpStat.Metrics, func(i, j int) bool { return strings.Compare(tpStat.Metrics[i].MetricID, tpStat.Metrics[j].MetricID) == -1 }) - if err := tpStatRPC.Call(utils.ApierV1SetTPStat, tpStat, &result); err != nil { + if err := tpStatRPC.Call(utils.APIerSv1SetTPStat, tpStat, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -198,7 +198,7 @@ func testTPStatsUpdateTPStat(t *testing.T) { func testTPStatsGetTPStatAfterUpdate(t *testing.T) { var expectedTPS *utils.TPStatProfile - if err := tpStatRPC.Call(utils.ApierV1GetTPStat, + if err := tpStatRPC.Call(utils.APIerSv1GetTPStat, &utils.TPTntID{TPid: "TPS1", Tenant: "cgrates.org", ID: "Stat1"}, &expectedTPS); err != nil { t.Fatal(err) } @@ -213,7 +213,7 @@ func testTPStatsGetTPStatAfterUpdate(t *testing.T) { func testTPStatsRemoveTPStat(t *testing.T) { var resp string - if err := tpStatRPC.Call(utils.ApierV1RemoveTPStat, + if err := tpStatRPC.Call(utils.APIerSv1RemoveTPStat, &utils.TPTntID{TPid: "TPS1", Tenant: "cgrates.org", ID: "Stat1"}, &resp); err != nil { t.Error(err) } else if resp != utils.OK { @@ -223,7 +223,7 @@ func testTPStatsRemoveTPStat(t *testing.T) { func testTPStatsGetTPStatAfterRemove(t *testing.T) { var respond *utils.TPStatProfile - if err := tpStatRPC.Call(utils.ApierV1GetTPStat, + if err := tpStatRPC.Call(utils.APIerSv1GetTPStat, &utils.TPTntID{TPid: "TPS1", Tenant: "cgrates.org", ID: "Stat1"}, &respond); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) diff --git a/apier/v1/tpsuppliers.go b/apier/v1/tpsuppliers.go index 01a2e05af..8491cee78 100644 --- a/apier/v1/tpsuppliers.go +++ b/apier/v1/tpsuppliers.go @@ -23,7 +23,7 @@ import ( ) // Creates a new SupplierProfile within a tariff plan -func (self *ApierV1) SetTPSupplierProfile(attrs *utils.TPSupplierProfile, reply *string) error { +func (self *APIerSv1) SetTPSupplierProfile(attrs *utils.TPSupplierProfile, reply *string) error { if missing := utils.MissingStructFields(attrs, []string{"TPid", "Tenant", "ID"}); len(missing) != 0 { return utils.NewErrMandatoryIeMissing(missing...) } @@ -35,7 +35,7 @@ func (self *ApierV1) SetTPSupplierProfile(attrs *utils.TPSupplierProfile, reply } // Queries specific SupplierProfile on tariff plan -func (self *ApierV1) GetTPSupplierProfile(attr *utils.TPTntID, reply *utils.TPSupplierProfile) error { +func (self *APIerSv1) GetTPSupplierProfile(attr *utils.TPTntID, reply *utils.TPSupplierProfile) error { if missing := utils.MissingStructFields(attr, []string{"TPid", "Tenant", "ID"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } @@ -56,7 +56,7 @@ type AttrGetTPSupplierProfileIDs struct { } // Queries SupplierProfile identities on specific tariff plan. -func (self *ApierV1) GetTPSupplierProfileIDs(attrs *AttrGetTPSupplierProfileIDs, reply *[]string) error { +func (self *APIerSv1) GetTPSupplierProfileIDs(attrs *AttrGetTPSupplierProfileIDs, reply *[]string) error { if missing := utils.MissingStructFields(attrs, []string{"TPid"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } @@ -73,7 +73,7 @@ func (self *ApierV1) GetTPSupplierProfileIDs(attrs *AttrGetTPSupplierProfileIDs, } // Removes specific SupplierProfile on Tariff plan -func (self *ApierV1) RemoveTPSupplierProfile(attrs *utils.TPTntID, reply *string) error { +func (self *APIerSv1) RemoveTPSupplierProfile(attrs *utils.TPTntID, reply *string) error { if missing := utils.MissingStructFields(attrs, []string{"TPid", "Tenant", "ID"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } diff --git a/apier/v1/tpsuppliers_it_test.go b/apier/v1/tpsuppliers_it_test.go index 50f69f8ee..fd5c050c8 100644 --- a/apier/v1/tpsuppliers_it_test.go +++ b/apier/v1/tpsuppliers_it_test.go @@ -120,7 +120,7 @@ func testTPSplPrfRPCConn(t *testing.T) { func testTPSplPrfGetTPSplPrfBeforeSet(t *testing.T) { var reply *utils.TPSupplier - if err := tpSplPrfRPC.Call(utils.ApierV1GetTPSupplierProfile, + if err := tpSplPrfRPC.Call(utils.APIerSv1GetTPSupplierProfile, &utils.TPTntID{TPid: "TP1", Tenant: "cgrates.org", ID: "SUPL_1"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) @@ -156,7 +156,7 @@ func testTPSplPrfSetTPSplPrf(t *testing.T) { } sort.Strings(tpSplPr.FilterIDs) var result string - if err := tpSplPrfRPC.Call(utils.ApierV1SetTPSupplierProfile, + if err := tpSplPrfRPC.Call(utils.APIerSv1SetTPSupplierProfile, tpSplPr, &result); err != nil { t.Error(err) } else if result != utils.OK { @@ -166,7 +166,7 @@ func testTPSplPrfSetTPSplPrf(t *testing.T) { func testTPSplPrfGetTPSplPrfAfterSet(t *testing.T) { var reply *utils.TPSupplierProfile - if err := tpSplPrfRPC.Call(utils.ApierV1GetTPSupplierProfile, + if err := tpSplPrfRPC.Call(utils.APIerSv1GetTPSupplierProfile, &utils.TPTntID{TPid: "TP1", Tenant: "cgrates.org", ID: "SUPL_1"}, &reply); err != nil { t.Fatal(err) } @@ -179,7 +179,7 @@ func testTPSplPrfGetTPSplPrfAfterSet(t *testing.T) { func testTPSplPrfGetTPSplPrfIDs(t *testing.T) { var result []string expectedTPID := []string{"SUPL_1"} - if err := tpSplPrfRPC.Call(utils.ApierV1GetTPSupplierProfileIDs, + if err := tpSplPrfRPC.Call(utils.APIerSv1GetTPSupplierProfileIDs, &AttrGetTPSupplierProfileIDs{TPid: "TP1"}, &result); err != nil { t.Error(err) } else if !reflect.DeepEqual(expectedTPID, result) { @@ -214,7 +214,7 @@ func testTPSplPrfUpdateTPSplPrf(t *testing.T) { }, } var result string - if err := tpSplPrfRPC.Call(utils.ApierV1SetTPSupplierProfile, + if err := tpSplPrfRPC.Call(utils.APIerSv1SetTPSupplierProfile, tpSplPr, &result); err != nil { t.Error(err) } else if result != utils.OK { @@ -227,7 +227,7 @@ func testTPSplPrfUpdateTPSplPrf(t *testing.T) { func testTPSplPrfGetTPSplPrfAfterUpdate(t *testing.T) { var reply *utils.TPSupplierProfile - if err := tpSplPrfRPC.Call(utils.ApierV1GetTPSupplierProfile, + if err := tpSplPrfRPC.Call(utils.APIerSv1GetTPSupplierProfile, &utils.TPTntID{TPid: "TP1", Tenant: "cgrates.org", ID: "SUPL_1"}, &reply); err != nil { t.Fatal(err) } @@ -242,7 +242,7 @@ func testTPSplPrfGetTPSplPrfAfterUpdate(t *testing.T) { func testTPSplPrfRemTPSplPrf(t *testing.T) { var resp string - if err := tpSplPrfRPC.Call(utils.ApierV1RemoveTPSupplierProfile, + if err := tpSplPrfRPC.Call(utils.APIerSv1RemoveTPSupplierProfile, &utils.TPTntID{TPid: "TP1", Tenant: "cgrates.org", ID: "SUPL_1"}, &resp); err != nil { t.Error(err) @@ -253,7 +253,7 @@ func testTPSplPrfRemTPSplPrf(t *testing.T) { func testTPSplPrfGetTPSplPrfAfterRemove(t *testing.T) { var reply *utils.TPSupplierProfile - if err := tpSplPrfRPC.Call(utils.ApierV1GetTPSupplierProfile, + if err := tpSplPrfRPC.Call(utils.APIerSv1GetTPSupplierProfile, &utils.TPTntID{TPid: "TP1", Tenant: "cgrates.org", ID: "SUPL_1"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) diff --git a/apier/v1/tpthresholds.go b/apier/v1/tpthresholds.go index 797126625..721ad58d2 100644 --- a/apier/v1/tpthresholds.go +++ b/apier/v1/tpthresholds.go @@ -23,7 +23,7 @@ import ( ) // Creates a new threshold within a tariff plan -func (self *ApierV1) SetTPThreshold(attr *utils.TPThresholdProfile, reply *string) error { +func (self *APIerSv1) SetTPThreshold(attr *utils.TPThresholdProfile, reply *string) error { if missing := utils.MissingStructFields(attr, []string{"TPid", "Tenant", "ID"}); len(missing) != 0 { return utils.NewErrMandatoryIeMissing(missing...) } @@ -35,7 +35,7 @@ func (self *ApierV1) SetTPThreshold(attr *utils.TPThresholdProfile, reply *strin } // Queries specific Threshold on Tariff plan -func (self *ApierV1) GetTPThreshold(attr *utils.TPTntID, reply *utils.TPThresholdProfile) error { +func (self *APIerSv1) GetTPThreshold(attr *utils.TPTntID, reply *utils.TPThresholdProfile) error { if missing := utils.MissingStructFields(attr, []string{"TPid", "Tenant", "ID"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } @@ -57,7 +57,7 @@ type AttrGetTPThresholdIds struct { } // Queries Threshold identities on specific tariff plan. -func (self *ApierV1) GetTPThresholdIDs(attrs *AttrGetTPThresholdIds, reply *[]string) error { +func (self *APIerSv1) GetTPThresholdIDs(attrs *AttrGetTPThresholdIds, reply *[]string) error { if missing := utils.MissingStructFields(attrs, []string{"TPid"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } @@ -74,7 +74,7 @@ func (self *ApierV1) GetTPThresholdIDs(attrs *AttrGetTPThresholdIds, reply *[]st } // Removes specific Threshold on Tariff plan -func (self *ApierV1) RemoveTPThreshold(attrs *utils.TPTntID, reply *string) error { +func (self *APIerSv1) RemoveTPThreshold(attrs *utils.TPTntID, reply *string) error { if missing := utils.MissingStructFields(attrs, []string{"TPid", "Tenant", "ID"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } diff --git a/apier/v1/tpthresholds_it_test.go b/apier/v1/tpthresholds_it_test.go index c3c08feab..8d699be57 100644 --- a/apier/v1/tpthresholds_it_test.go +++ b/apier/v1/tpthresholds_it_test.go @@ -126,7 +126,7 @@ func testTPThreholdRpcConn(t *testing.T) { func testTPThreholdGetTPThreholdBeforeSet(t *testing.T) { var reply *utils.TPThresholdProfile - if err := tpThresholdRPC.Call(utils.ApierV1GetTPThreshold, + if err := tpThresholdRPC.Call(utils.APIerSv1GetTPThreshold, &utils.TPTntID{TPid: "TH1", Tenant: "cgrates.org", ID: "Threshold"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) @@ -152,7 +152,7 @@ func testTPThreholdSetTPThrehold(t *testing.T) { sort.Strings(tpThreshold.FilterIDs) sort.Strings(tpThreshold.ActionIDs) var result string - if err := tpThresholdRPC.Call(utils.ApierV1SetTPThreshold, tpThreshold, &result); err != nil { + if err := tpThresholdRPC.Call(utils.APIerSv1SetTPThreshold, tpThreshold, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -161,7 +161,7 @@ func testTPThreholdSetTPThrehold(t *testing.T) { func testTPThreholdGetTPThreholdAfterSet(t *testing.T) { var respond *utils.TPThresholdProfile - if err := tpThresholdRPC.Call(utils.ApierV1GetTPThreshold, + if err := tpThresholdRPC.Call(utils.APIerSv1GetTPThreshold, &utils.TPTntID{TPid: "TH1", Tenant: "cgrates.org", ID: "Threshold"}, &respond); err != nil { t.Fatal(err) } @@ -175,7 +175,7 @@ func testTPThreholdGetTPThreholdAfterSet(t *testing.T) { func testTPThreholdGetTPThreholdIds(t *testing.T) { var result []string expectedTPID := []string{"Threshold"} - if err := tpThresholdRPC.Call(utils.ApierV1GetTPThresholdIDs, + if err := tpThresholdRPC.Call(utils.APIerSv1GetTPThresholdIDs, &AttrGetTPThresholdIds{TPid: tpThreshold.TPid}, &result); err != nil { t.Fatal(err) } else if !reflect.DeepEqual(result, expectedTPID) { @@ -186,7 +186,7 @@ func testTPThreholdGetTPThreholdIds(t *testing.T) { func testTPThreholdUpdateTPThrehold(t *testing.T) { var result string tpThreshold.FilterIDs = []string{"FLTR_1", "FLTR_2", "FLTR_3"} - if err := tpThresholdRPC.Call(utils.ApierV1SetTPThreshold, tpThreshold, &result); err != nil { + if err := tpThresholdRPC.Call(utils.APIerSv1SetTPThreshold, tpThreshold, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -195,7 +195,7 @@ func testTPThreholdUpdateTPThrehold(t *testing.T) { func testTPThreholdGetTPThreholdAfterUpdate(t *testing.T) { var respond *utils.TPThresholdProfile - if err := tpThresholdRPC.Call(utils.ApierV1GetTPThreshold, + if err := tpThresholdRPC.Call(utils.APIerSv1GetTPThreshold, &utils.TPTntID{TPid: "TH1", Tenant: "cgrates.org", ID: "Threshold"}, &respond); err != nil { t.Fatal(err) } @@ -208,7 +208,7 @@ func testTPThreholdGetTPThreholdAfterUpdate(t *testing.T) { func testTPThreholdRemTPThrehold(t *testing.T) { var resp string - if err := tpThresholdRPC.Call(utils.ApierV1RemoveTPThreshold, + if err := tpThresholdRPC.Call(utils.APIerSv1RemoveTPThreshold, &utils.TPTntID{TPid: "TH1", Tenant: "cgrates.org", ID: "Threshold"}, &resp); err != nil { t.Error(err) } else if resp != utils.OK { @@ -218,7 +218,7 @@ func testTPThreholdRemTPThrehold(t *testing.T) { func testTPThreholdGetTPThreholdAfterRemove(t *testing.T) { var reply *utils.TPThresholdProfile - if err := tpThresholdRPC.Call(utils.ApierV1GetTPThreshold, + if err := tpThresholdRPC.Call(utils.APIerSv1GetTPThreshold, &utils.TPTntID{TPid: "TH1", Tenant: "cgrates.org", ID: "Threshold"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) diff --git a/apier/v1/tptimings.go b/apier/v1/tptimings.go index ba61d9f44..cf30f375d 100644 --- a/apier/v1/tptimings.go +++ b/apier/v1/tptimings.go @@ -23,7 +23,7 @@ import ( ) // Creates a new timing within a tariff plan -func (self *ApierV1) SetTPTiming(attrs utils.ApierTPTiming, reply *string) error { +func (self *APIerSv1) SetTPTiming(attrs utils.ApierTPTiming, reply *string) error { if missing := utils.MissingStructFields(&attrs, []string{"TPid", "ID", "Years", "Months", "MonthDays", "WeekDays", "Time"}); len(missing) != 0 { return utils.NewErrMandatoryIeMissing(missing...) } @@ -40,7 +40,7 @@ type AttrGetTPTiming struct { } // Queries specific Timing on Tariff plan -func (self *ApierV1) GetTPTiming(attrs AttrGetTPTiming, reply *utils.ApierTPTiming) error { +func (self *APIerSv1) GetTPTiming(attrs AttrGetTPTiming, reply *utils.ApierTPTiming) error { if missing := utils.MissingStructFields(&attrs, []string{"TPid", "ID"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } @@ -61,7 +61,7 @@ type AttrGetTPTimingIds struct { } // Queries timing identities on specific tariff plan. -func (self *ApierV1) GetTPTimingIds(attrs AttrGetTPTimingIds, reply *[]string) error { +func (self *APIerSv1) GetTPTimingIds(attrs AttrGetTPTimingIds, reply *[]string) error { if missing := utils.MissingStructFields(&attrs, []string{"TPid"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } @@ -78,7 +78,7 @@ func (self *ApierV1) GetTPTimingIds(attrs AttrGetTPTimingIds, reply *[]string) e } // Removes specific Timing on Tariff plan -func (self *ApierV1) RemoveTPTiming(attrs AttrGetTPTiming, reply *string) error { +func (self *APIerSv1) RemoveTPTiming(attrs AttrGetTPTiming, reply *string) error { if missing := utils.MissingStructFields(&attrs, []string{"TPid", "ID"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } diff --git a/apier/v1/tptimings_it_test.go b/apier/v1/tptimings_it_test.go index 241ad0e16..fe74c4775 100644 --- a/apier/v1/tptimings_it_test.go +++ b/apier/v1/tptimings_it_test.go @@ -129,7 +129,7 @@ func testTPTimingsRpcConn(t *testing.T) { func testTPTimingsGetTPTimingBeforeSet(t *testing.T) { var reply *utils.ApierTPTiming - if err := tpTimingRPC.Call(utils.ApierV1GetTPTiming, AttrGetTPTiming{TPid: "TPT1", ID: "Timining"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { + if err := tpTimingRPC.Call(utils.APIerSv1GetTPTiming, AttrGetTPTiming{TPid: "TPT1", ID: "Timining"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) } } @@ -145,7 +145,7 @@ func testTPTimingsSetTPTiming(t *testing.T) { Time: "15:00:00Z", } var result string - if err := tpTimingRPC.Call(utils.ApierV1SetTPTiming, tpTiming, &result); err != nil { + if err := tpTimingRPC.Call(utils.APIerSv1SetTPTiming, tpTiming, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -154,7 +154,7 @@ func testTPTimingsSetTPTiming(t *testing.T) { func testTPTimingsGetTPTimingAfterSet(t *testing.T) { var respond *utils.ApierTPTiming - if err := tpTimingRPC.Call(utils.ApierV1GetTPTiming, &AttrGetTPTiming{TPid: tpTiming.TPid, ID: tpTiming.ID}, &respond); err != nil { + if err := tpTimingRPC.Call(utils.APIerSv1GetTPTiming, &AttrGetTPTiming{TPid: tpTiming.TPid, ID: tpTiming.ID}, &respond); err != nil { t.Error(err) } else if !reflect.DeepEqual(tpTiming, respond) { t.Errorf("Expecting: %+v, received: %+v", tpTiming, respond) @@ -164,7 +164,7 @@ func testTPTimingsGetTPTimingAfterSet(t *testing.T) { func testTPTimingsGetTPTimingIds(t *testing.T) { var result []string expectedTPID := []string{"Timing"} - if err := tpTimingRPC.Call(utils.ApierV1GetTPTimingIds, &AttrGetTPTimingIds{TPid: tpTiming.TPid}, &result); err != nil { + if err := tpTimingRPC.Call(utils.APIerSv1GetTPTimingIds, &AttrGetTPTimingIds{TPid: tpTiming.TPid}, &result); err != nil { t.Error(err) } else if !reflect.DeepEqual(result, expectedTPID) { t.Errorf("Expecting: %+v, received: %+v", result, expectedTPID) @@ -174,7 +174,7 @@ func testTPTimingsGetTPTimingIds(t *testing.T) { func testTPTimingsUpdateTPTiming(t *testing.T) { var result string tpTiming.Years = "2015" - if err := tpTimingRPC.Call(utils.ApierV1SetTPTiming, tpTiming, &result); err != nil { + if err := tpTimingRPC.Call(utils.APIerSv1SetTPTiming, tpTiming, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -183,7 +183,7 @@ func testTPTimingsUpdateTPTiming(t *testing.T) { func testTPTimingsGetTPTimingAfterUpdate(t *testing.T) { var expectedTPS *utils.ApierTPTiming - if err := tpTimingRPC.Call(utils.ApierV1GetTPTiming, &AttrGetTPTiming{TPid: tpTiming.TPid, ID: tpTiming.ID}, &expectedTPS); err != nil { + if err := tpTimingRPC.Call(utils.APIerSv1GetTPTiming, &AttrGetTPTiming{TPid: tpTiming.TPid, ID: tpTiming.ID}, &expectedTPS); err != nil { t.Error(err) } else if !reflect.DeepEqual(tpTiming, expectedTPS) { t.Errorf("Expecting: %+v, received: %+v", tpTiming, expectedTPS) @@ -192,7 +192,7 @@ func testTPTimingsGetTPTimingAfterUpdate(t *testing.T) { func testTPTimingsRemoveTPTiming(t *testing.T) { var resp string - if err := tpTimingRPC.Call(utils.ApierV1RemoveTPTiming, &AttrGetTPTiming{TPid: tpTiming.TPid, ID: tpTiming.ID}, &resp); err != nil { + if err := tpTimingRPC.Call(utils.APIerSv1RemoveTPTiming, &AttrGetTPTiming{TPid: tpTiming.TPid, ID: tpTiming.ID}, &resp); err != nil { t.Error(err) } else if resp != utils.OK { t.Error("Unexpected reply returned", resp) @@ -201,7 +201,7 @@ func testTPTimingsRemoveTPTiming(t *testing.T) { func testTPTimingsGetTPTimingAfterRemove(t *testing.T) { var reply *utils.ApierTPTiming - if err := tpTimingRPC.Call(utils.ApierV1GetTPTiming, AttrGetTPTiming{TPid: "TPT1", ID: "Timining"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { + if err := tpTimingRPC.Call(utils.APIerSv1GetTPTiming, AttrGetTPTiming{TPid: "TPT1", ID: "Timining"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) } } diff --git a/apier/v1/triggers.go b/apier/v1/triggers.go index ecd40e31b..322664dbf 100644 --- a/apier/v1/triggers.go +++ b/apier/v1/triggers.go @@ -30,7 +30,7 @@ import ( ) // Returns a list of ActionTriggers on an account -func (api *ApierV1) GetAccountActionTriggers(attrs utils.TenantAccount, reply *engine.ActionTriggers) error { +func (api *APIerSv1) GetAccountActionTriggers(attrs utils.TenantAccount, reply *engine.ActionTriggers) error { if missing := utils.MissingStructFields(&attrs, []string{"Tenant", "Account"}); len(missing) != 0 { return utils.NewErrMandatoryIeMissing(missing...) } @@ -55,7 +55,7 @@ type AttrAddAccountActionTriggers struct { Executed bool } -func (api *ApierV1) AddAccountActionTriggers(attr AttrAddAccountActionTriggers, reply *string) (err error) { +func (api *APIerSv1) AddAccountActionTriggers(attr AttrAddAccountActionTriggers, reply *string) (err error) { if missing := utils.MissingStructFields(&attr, []string{"Tenant", "Account"}); len(missing) != 0 { return utils.NewErrMandatoryIeMissing(missing...) } @@ -110,7 +110,7 @@ type AttrRemoveAccountActionTriggers struct { UniqueID string } -func (api *ApierV1) RemoveAccountActionTriggers(attr AttrRemoveAccountActionTriggers, reply *string) error { +func (api *APIerSv1) RemoveAccountActionTriggers(attr AttrRemoveAccountActionTriggers, reply *string) error { if missing := utils.MissingStructFields(&attr, []string{"Tenant", "Account"}); len(missing) != 0 { return utils.NewErrMandatoryIeMissing(missing...) } @@ -151,7 +151,7 @@ type AttrResetAccountActionTriggers struct { Executed bool } -func (api *ApierV1) ResetAccountActionTriggers(attr AttrResetAccountActionTriggers, reply *string) error { +func (api *APIerSv1) ResetAccountActionTriggers(attr AttrResetAccountActionTriggers, reply *string) error { if missing := utils.MissingStructFields(&attr, []string{"Tenant", "Account"}); len(missing) != 0 { return utils.NewErrMandatoryIeMissing(missing...) @@ -336,7 +336,7 @@ func (attr *AttrSetActionTrigger) UpdateActionTrigger(at *engine.ActionTrigger, } // SetAccountActionTriggers updates or creates if not present the ActionTrigger for an Account -func (api *ApierV1) SetAccountActionTriggers(attr AttrSetAccountActionTriggers, reply *string) error { +func (api *APIerSv1) SetAccountActionTriggers(attr AttrSetAccountActionTriggers, reply *string) error { if missing := utils.MissingStructFields(&attr, []string{"Tenant", "Account"}); len(missing) != 0 { return utils.NewErrMandatoryIeMissing(missing...) } @@ -382,7 +382,7 @@ type AttrRemoveActionTrigger struct { UniqueID string } -func (api *ApierV1) RemoveActionTrigger(attr AttrRemoveActionTrigger, reply *string) error { +func (api *APIerSv1) RemoveActionTrigger(attr AttrRemoveActionTrigger, reply *string) error { if missing := utils.MissingStructFields(&attr, []string{"GroupID"}); len(missing) != 0 { return utils.NewErrMandatoryIeMissing(missing...) } @@ -419,7 +419,7 @@ func (api *ApierV1) RemoveActionTrigger(attr AttrRemoveActionTrigger, reply *str } // SetActionTrigger updates a ActionTrigger -func (api *ApierV1) SetActionTrigger(attr AttrSetActionTrigger, reply *string) (err error) { +func (api *APIerSv1) SetActionTrigger(attr AttrSetActionTrigger, reply *string) (err error) { if missing := utils.MissingStructFields(&attr, []string{"GroupID"}); len(missing) != 0 { return utils.NewErrMandatoryIeMissing(missing...) } @@ -462,7 +462,7 @@ type AttrGetActionTriggers struct { GroupIDs []string } -func (api *ApierV1) GetActionTriggers(attr AttrGetActionTriggers, atrs *engine.ActionTriggers) error { +func (api *APIerSv1) GetActionTriggers(attr AttrGetActionTriggers, atrs *engine.ActionTriggers) error { var allAttrs engine.ActionTriggers if len(attr.GroupIDs) > 0 { for _, key := range attr.GroupIDs { @@ -508,7 +508,7 @@ type AttrAddActionTrigger struct { } // Deprecated in rc8, replaced by AddAccountActionTriggers -func (api *ApierV1) AddTriggeredAction(attr AttrAddActionTrigger, reply *string) error { +func (api *APIerSv1) AddTriggeredAction(attr AttrAddActionTrigger, reply *string) error { if missing := utils.MissingStructFields(&attr, []string{"Tenant", "Account"}); len(missing) != 0 { return utils.NewErrMandatoryIeMissing(missing...) } diff --git a/apier/v1/versions.go b/apier/v1/versions.go index 7ef82970d..f168207ac 100644 --- a/apier/v1/versions.go +++ b/apier/v1/versions.go @@ -24,7 +24,7 @@ import ( ) // Queries all versions from dataDB -func (self *ApierV1) GetDataDBVersions(ign string, reply *engine.Versions) error { +func (self *APIerSv1) GetDataDBVersions(ign string, reply *engine.Versions) error { if vrs, err := self.DataManager.DataDB().GetVersions(""); err != nil { return utils.NewErrServerError(err) } else if len(vrs) == 0 { @@ -36,7 +36,7 @@ func (self *ApierV1) GetDataDBVersions(ign string, reply *engine.Versions) error } // Queries all versions from stordb -func (self *ApierV1) GetStorDBVersions(ign string, reply *engine.Versions) error { +func (self *APIerSv1) GetStorDBVersions(ign string, reply *engine.Versions) error { if vrs, err := self.StorDb.GetVersions(""); err != nil { return utils.NewErrServerError(err) } else if len(vrs) == 0 { @@ -53,7 +53,7 @@ type SetVersionsArg struct { } // Queries all versions from dataDB -func (self *ApierV1) SetDataDBVersions(arg SetVersionsArg, reply *string) error { +func (self *APIerSv1) SetDataDBVersions(arg SetVersionsArg, reply *string) error { if arg.Versions == nil { arg.Versions = engine.CurrentDataDBVersions() } @@ -65,7 +65,7 @@ func (self *ApierV1) SetDataDBVersions(arg SetVersionsArg, reply *string) error } // Queries all versions from stordb -func (self *ApierV1) SetStorDBVersions(arg SetVersionsArg, reply *string) error { +func (self *APIerSv1) SetStorDBVersions(arg SetVersionsArg, reply *string) error { if arg.Versions == nil { arg.Versions = engine.CurrentDataDBVersions() } diff --git a/apier/v1/versions_it_test.go b/apier/v1/versions_it_test.go index bec85e8c2..fb964b8d3 100644 --- a/apier/v1/versions_it_test.go +++ b/apier/v1/versions_it_test.go @@ -125,7 +125,7 @@ func testVrsDataDB(t *testing.T) { "RatingProfile": 1, "User": 1, "Accounts": 3, "ActionPlans": 3, "Chargers": 1, "Destinations": 1, "LoadIDs": 1, "SharedGroups": 2, "Stats": 2, "Resource": 1, "Subscribers": 1, "Suppliers": 1, "Thresholds": 3, "Timing": 1} - if err := vrsRPC.Call(utils.ApierV1GetDataDBVersions, "", &result); err != nil { + if err := vrsRPC.Call(utils.APIerSv1GetDataDBVersions, "", &result); err != nil { t.Error(err) } else if expectedVrs.Compare(result, vrsStorageType, true) != "" { t.Errorf("Expecting: %+v, received: %+v", expectedVrs, result) @@ -139,7 +139,7 @@ func testVrsStorDB(t *testing.T) { "TpSharedGroups": 1, "TpSuppliers": 1, "SessionSCosts": 3, "TpRatingProfiles": 1, "TpStats": 1, "TpTiming": 1, "CostDetails": 2, "TpAccountActions": 1, "TpActionPlans": 1, "TpChargers": 1, "TpRatingProfile": 1, "TpRatingPlan": 1, "TpResources": 1} - if err := vrsRPC.Call(utils.ApierV1GetStorDBVersions, "", &result); err != nil { + if err := vrsRPC.Call(utils.APIerSv1GetStorDBVersions, "", &result); err != nil { t.Error(err) } else if expectedVrs.Compare(result, vrsStorageType, true) != "" { t.Errorf("Expecting: %+v, received: %+v", result, expectedVrs) @@ -153,7 +153,7 @@ func testVrsSetDataDBVrs(t *testing.T) { "Attributes": 3, }, } - if err := vrsRPC.Call(utils.ApierV1SetDataDBVersions, args, &reply); err != nil { + if err := vrsRPC.Call(utils.APIerSv1SetDataDBVersions, args, &reply); err != nil { t.Error(err) } else if reply != utils.OK { t.Errorf("Expecting: %+v, received: %+v", utils.OK, reply) @@ -165,7 +165,7 @@ func testVrsSetDataDBVrs(t *testing.T) { "RatingProfile": 1, "User": 1, "Accounts": 3, "ActionPlans": 3, "Chargers": 1, "Destinations": 1, "LoadIDs": 1, "SharedGroups": 2, "Stats": 2, "Resource": 1, "Subscribers": 1, "Suppliers": 1, "Thresholds": 3, "Timing": 1} - if err := vrsRPC.Call(utils.ApierV1GetDataDBVersions, "", &result); err != nil { + if err := vrsRPC.Call(utils.APIerSv1GetDataDBVersions, "", &result); err != nil { t.Error(err) } else if expectedVrs.Compare(result, vrsStorageType, true) != "" { t.Errorf("Expecting: %+v, received: %+v", expectedVrs, result) @@ -174,7 +174,7 @@ func testVrsSetDataDBVrs(t *testing.T) { args = SetVersionsArg{ Versions: nil, } - if err := vrsRPC.Call(utils.ApierV1SetDataDBVersions, args, &reply); err != nil { + if err := vrsRPC.Call(utils.APIerSv1SetDataDBVersions, args, &reply); err != nil { t.Error(err) } else if reply != utils.OK { t.Errorf("Expecting: %+v, received: %+v", utils.OK, reply) @@ -188,7 +188,7 @@ func testVrsSetStorDBVrs(t *testing.T) { "TpResources": 2, }, } - if err := vrsRPC.Call(utils.ApierV1SetStorDBVersions, args, &reply); err != nil { + if err := vrsRPC.Call(utils.APIerSv1SetStorDBVersions, args, &reply); err != nil { t.Error(err) } else if reply != utils.OK { t.Errorf("Expecting: %+v, received: %+v", utils.OK, reply) @@ -200,7 +200,7 @@ func testVrsSetStorDBVrs(t *testing.T) { "TpSharedGroups": 1, "TpSuppliers": 1, "SessionSCosts": 3, "TpRatingProfiles": 1, "TpStats": 1, "TpTiming": 1, "CostDetails": 2, "TpAccountActions": 1, "TpActionPlans": 1, "TpChargers": 1, "TpRatingProfile": 1, "TpRatingPlan": 1, "TpResources": 2} - if err := vrsRPC.Call(utils.ApierV1GetStorDBVersions, "", &result); err != nil { + if err := vrsRPC.Call(utils.APIerSv1GetStorDBVersions, "", &result); err != nil { t.Error(err) } else if expectedVrs.Compare(result, vrsStorageType, true) != "" { t.Errorf("Expecting: %+v, received: %+v", result, expectedVrs) @@ -209,7 +209,7 @@ func testVrsSetStorDBVrs(t *testing.T) { args = SetVersionsArg{ Versions: nil, } - if err := vrsRPC.Call(utils.ApierV1SetStorDBVersions, args, &reply); err != nil { + if err := vrsRPC.Call(utils.APIerSv1SetStorDBVersions, args, &reply); err != nil { t.Error(err) } else if reply != utils.OK { t.Errorf("Expecting: %+v, received: %+v", utils.OK, reply) diff --git a/apier/v2/accounts.go b/apier/v2/accounts.go index 9ee31891f..d85460e2f 100644 --- a/apier/v2/accounts.go +++ b/apier/v2/accounts.go @@ -28,7 +28,7 @@ import ( "github.com/cgrates/cgrates/utils" ) -func (apiv2 *ApierV2) GetAccounts(attr utils.AttrGetAccounts, reply *[]*engine.Account) error { +func (apiv2 *APIerSv2) GetAccounts(attr utils.AttrGetAccounts, reply *[]*engine.Account) error { if len(attr.Tenant) == 0 { return utils.NewErrMandatoryIeMissing("Tenant") } @@ -81,7 +81,7 @@ func (apiv2 *ApierV2) GetAccounts(attr utils.AttrGetAccounts, reply *[]*engine.A } // Get balance -func (apiv2 *ApierV2) GetAccount(attr *utils.AttrGetAccount, reply *engine.Account) error { +func (apiv2 *APIerSv2) GetAccount(attr *utils.AttrGetAccount, reply *engine.Account) error { tag := utils.ConcatenatedKey(attr.Tenant, attr.Account) account, err := apiv2.DataManager.GetAccount(tag) if err != nil { @@ -102,7 +102,7 @@ type AttrSetAccount struct { ReloadScheduler bool } -func (apiv2 *ApierV2) SetAccount(attr AttrSetAccount, reply *string) error { +func (apiv2 *APIerSv2) SetAccount(attr AttrSetAccount, reply *string) error { if missing := utils.MissingStructFields(&attr, []string{"Tenant", "Account"}); len(missing) != 0 { return utils.NewErrMandatoryIeMissing(missing...) } diff --git a/apier/v2/apier.go b/apier/v2/apier.go index a51d8a80b..a0a901c9d 100644 --- a/apier/v2/apier.go +++ b/apier/v2/apier.go @@ -34,12 +34,12 @@ import ( "github.com/cgrates/cgrates/utils" ) -type ApierV2 struct { - v1.ApierV1 +type APIerSv2 struct { + v1.APIerSv1 } // Call implements rpcclient.ClientConnector interface for internal RPC -func (apiv2 *ApierV2) Call(serviceMethod string, +func (apiv2 *APIerSv2) Call(serviceMethod string, args interface{}, reply interface{}) error { return utils.APIerRPCCall(apiv2, serviceMethod, args, reply) } @@ -50,7 +50,7 @@ type AttrLoadRatingProfile struct { } // Process dependencies and load a specific rating profile from storDb into dataDb. -func (apiv2 *ApierV2) LoadRatingProfile(attrs AttrLoadRatingProfile, reply *string) error { +func (apiv2 *APIerSv2) LoadRatingProfile(attrs AttrLoadRatingProfile, reply *string) error { if len(attrs.TPid) == 0 { return utils.NewErrMandatoryIeMissing("TPid") } @@ -74,7 +74,7 @@ type AttrLoadAccountActions struct { } // Process dependencies and load a specific AccountActions profile from storDb into dataDb. -func (apiv2 *ApierV2) LoadAccountActions(attrs AttrLoadAccountActions, reply *string) error { +func (apiv2 *APIerSv2) LoadAccountActions(attrs AttrLoadAccountActions, reply *string) error { if len(attrs.TPid) == 0 { return utils.NewErrMandatoryIeMissing("TPid") } @@ -99,7 +99,7 @@ func (apiv2 *ApierV2) LoadAccountActions(attrs AttrLoadAccountActions, reply *st return nil } -func (apiv2 *ApierV2) LoadTariffPlanFromFolder(attrs utils.AttrLoadTpFromFolder, reply *utils.LoadInstance) error { +func (apiv2 *APIerSv2) LoadTariffPlanFromFolder(attrs utils.AttrLoadTpFromFolder, reply *utils.LoadInstance) error { if len(attrs.FolderPath) == 0 { return fmt.Errorf("%s:%s", utils.ErrMandatoryIeMissing.Error(), "FolderPath") } @@ -135,7 +135,7 @@ func (apiv2 *ApierV2) LoadTariffPlanFromFolder(attrs utils.AttrLoadTpFromFolder, return utils.NewErrServerError(err) } - utils.Logger.Info("ApierV2.LoadTariffPlanFromFolder, reloading cache.") + utils.Logger.Info("APIerSv2.LoadTariffPlanFromFolder, reloading cache.") //verify If Caching is present in arguments caching := config.CgrConfig().GeneralCfg().DefaultCaching if attrs.Caching != nil { @@ -145,7 +145,7 @@ func (apiv2 *ApierV2) LoadTariffPlanFromFolder(attrs utils.AttrLoadTpFromFolder, return utils.NewErrServerError(err) } if len(apiv2.Config.ApierCfg().SchedulerConns) != 0 { - utils.Logger.Info("ApierV2.LoadTariffPlanFromFolder, reloading scheduler.") + utils.Logger.Info("APIerSv2.LoadTariffPlanFromFolder, reloading scheduler.") if err := loader.ReloadScheduler(true); err != nil { return utils.NewErrServerError(err) } @@ -169,7 +169,7 @@ type AttrGetActions struct { } // Retrieves actions attached to specific ActionsId within cache -func (apiv2 *ApierV2) GetActions(attr AttrGetActions, reply *map[string]engine.Actions) error { +func (apiv2 *APIerSv2) GetActions(attr AttrGetActions, reply *map[string]engine.Actions) error { var actionKeys []string var err error if len(attr.ActionIDs) == 0 { @@ -222,7 +222,7 @@ type AttrGetDestinations struct { } // GetDestinations returns a list of destination based on the destinationIDs given -func (apiv2 *ApierV2) GetDestinations(attr AttrGetDestinations, reply *[]*engine.Destination) (err error) { +func (apiv2 *APIerSv2) GetDestinations(attr AttrGetDestinations, reply *[]*engine.Destination) (err error) { if len(attr.DestinationIDs) == 0 { // get all destination ids if attr.DestinationIDs, err = apiv2.DataManager.DataDB().GetKeysForPrefix(utils.DESTINATION_PREFIX); err != nil { @@ -242,7 +242,7 @@ func (apiv2 *ApierV2) GetDestinations(attr AttrGetDestinations, reply *[]*engine return } -func (apiv2 *ApierV2) SetActions(attrs utils.AttrSetActions, reply *string) error { +func (apiv2 *APIerSv2) SetActions(attrs utils.AttrSetActions, reply *string) error { if missing := utils.MissingStructFields(&attrs, []string{"ActionsId", "Actions"}); len(missing) != 0 { return utils.NewErrMandatoryIeMissing(missing...) } diff --git a/apier/v2/apierv2_it_test.go b/apier/v2/apierv2_it_test.go index f37534987..3e2218dc1 100644 --- a/apier/v2/apierv2_it_test.go +++ b/apier/v2/apierv2_it_test.go @@ -38,24 +38,24 @@ var ( apierCfg *config.CGRConfig apierRPC *rpc.Client dm *engine.DataManager // share db connection here so we can check data we set through APIs - apierv2ConfDIR string + APIerSv2ConfDIR string sTestsv2it = []func(t *testing.T){ - testApierV2itLoadConfig, - testApierV2itResetDataDb, - testApierV2itResetStorDb, - testApierV2itConnectDataDB, - testApierV2itStartEngine, - testApierV2itRpcConn, - testApierV2itAddBalance, - testApierV2itSetAction, - testApierV2itSetAccountActionTriggers, - testApierV2itFraudMitigation, - testApierV2itSetAccountWithAP, - testApierV2itSetActionWithCategory, - testApierV2itSetActionPlanWithWrongTiming, - testApierV2itSetActionPlanWithWrongTiming2, - testApierV2itKillEngine, + testAPIerSv2itLoadConfig, + testAPIerSv2itResetDataDb, + testAPIerSv2itResetStorDb, + testAPIerSv2itConnectDataDB, + testAPIerSv2itStartEngine, + testAPIerSv2itRpcConn, + testAPIerSv2itAddBalance, + testAPIerSv2itSetAction, + testAPIerSv2itSetAccountActionTriggers, + testAPIerSv2itFraudMitigation, + testAPIerSv2itSetAccountWithAP, + testAPIerSv2itSetActionWithCategory, + testAPIerSv2itSetActionPlanWithWrongTiming, + testAPIerSv2itSetActionPlanWithWrongTiming2, + testAPIerSv2itKillEngine, } ) @@ -64,9 +64,9 @@ func TestV2IT(t *testing.T) { case utils.MetaInternal: t.Skip() case utils.MetaMySQL: - apierv2ConfDIR = "tutmysql" + APIerSv2ConfDIR = "tutmysql" case utils.MetaMongo: - apierv2ConfDIR = "tutmongo" + APIerSv2ConfDIR = "tutmongo" case utils.MetaPostgres: t.SkipNow() default: @@ -74,32 +74,32 @@ func TestV2IT(t *testing.T) { } for _, stest := range sTestsv2it { - t.Run(apierv2ConfDIR, stest) + t.Run(APIerSv2ConfDIR, stest) } } -func testApierV2itLoadConfig(t *testing.T) { - apierCfgPath = path.Join(*dataDir, "conf", "samples", apierv2ConfDIR) +func testAPIerSv2itLoadConfig(t *testing.T) { + apierCfgPath = path.Join(*dataDir, "conf", "samples", APIerSv2ConfDIR) if apierCfg, err = config.NewCGRConfigFromPath(apierCfgPath); err != nil { t.Error(err) } } // Remove data in both rating and accounting db -func testApierV2itResetDataDb(t *testing.T) { +func testAPIerSv2itResetDataDb(t *testing.T) { if err := engine.InitDataDb(apierCfg); err != nil { t.Fatal(err) } } // Wipe out the cdr database -func testApierV2itResetStorDb(t *testing.T) { +func testAPIerSv2itResetStorDb(t *testing.T) { if err := engine.InitStorDb(apierCfg); err != nil { t.Fatal(err) } } -func testApierV2itConnectDataDB(t *testing.T) { +func testAPIerSv2itConnectDataDB(t *testing.T) { rdsITdb, err := engine.NewDataDBConn(apierCfg.DataDbCfg().DataDbType, apierCfg.DataDbCfg().DataDbHost, apierCfg.DataDbCfg().DataDbPort, apierCfg.DataDbCfg().DataDbName, apierCfg.DataDbCfg().DataDbUser, @@ -112,21 +112,21 @@ func testApierV2itConnectDataDB(t *testing.T) { } // Start CGR Engine -func testApierV2itStartEngine(t *testing.T) { +func testAPIerSv2itStartEngine(t *testing.T) { if _, err := engine.StopStartEngine(apierCfgPath, 200); err != nil { // Mongo requires more time to start t.Fatal(err) } } // Connect rpc client to rater -func testApierV2itRpcConn(t *testing.T) { +func testAPIerSv2itRpcConn(t *testing.T) { apierRPC, err = newRPCClient(apierCfg.ListenCfg()) // We connect over JSON so we can also troubleshoot if needed if err != nil { t.Fatal(err) } } -func testApierV2itAddBalance(t *testing.T) { +func testAPIerSv2itAddBalance(t *testing.T) { attrs := &utils.AttrSetBalance{ Tenant: "cgrates.org", Account: "dan", @@ -138,34 +138,34 @@ func testApierV2itAddBalance(t *testing.T) { }, } var reply string - if err := apierRPC.Call(utils.ApierV2SetBalance, attrs, &reply); err != nil { + if err := apierRPC.Call(utils.APIerSv2SetBalance, attrs, &reply); err != nil { t.Fatal(err) } var acnt engine.Account - if err := apierRPC.Call(utils.ApierV2GetAccount, &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "dan"}, &acnt); err != nil { + if err := apierRPC.Call(utils.APIerSv2GetAccount, &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "dan"}, &acnt); err != nil { t.Error(err) } else if acnt.BalanceMap[utils.MONETARY][0].Value != 5.0 { t.Errorf("Unexpected balance received: %+v", acnt.BalanceMap[utils.MONETARY][0]) } } -func testApierV2itSetAction(t *testing.T) { +func testAPIerSv2itSetAction(t *testing.T) { attrs := utils.AttrSetActions{ActionsId: "DISABLE_ACCOUNT", Actions: []*utils.TPAction{ {Identifier: utils.DISABLE_ACCOUNT, Weight: 10.0}, }} var reply string - if err := apierRPC.Call(utils.ApierV2SetActions, attrs, &reply); err != nil { + if err := apierRPC.Call(utils.APIerSv2SetActions, attrs, &reply); err != nil { t.Error(err) } var acts map[string]engine.Actions - if err := apierRPC.Call(utils.ApierV2GetActions, AttrGetActions{ActionIDs: []string{attrs.ActionsId}}, &acts); err != nil { + if err := apierRPC.Call(utils.APIerSv2GetActions, AttrGetActions{ActionIDs: []string{attrs.ActionsId}}, &acts); err != nil { t.Error(err) } else if len(acts) != 1 { t.Errorf("Received actions: %+v", acts) } } -func testApierV2itSetAccountActionTriggers(t *testing.T) { +func testAPIerSv2itSetAccountActionTriggers(t *testing.T) { attrs := v1.AttrSetAccountActionTriggers{ Tenant: "cgrates.org", Account: "dan", @@ -180,27 +180,27 @@ func testApierV2itSetAccountActionTriggers(t *testing.T) { }, } var reply string - if err := apierRPC.Call(utils.ApierV2SetAccountActionTriggers, attrs, &reply); err != nil { + if err := apierRPC.Call(utils.APIerSv2SetAccountActionTriggers, attrs, &reply); err != nil { t.Error(err) } var ats engine.ActionTriggers - if err := apierRPC.Call(utils.ApierV2GetAccountActionTriggers, utils.TenantAccount{Tenant: "cgrates.org", Account: "dan"}, &ats); err != nil { + if err := apierRPC.Call(utils.APIerSv2GetAccountActionTriggers, utils.TenantAccount{Tenant: "cgrates.org", Account: "dan"}, &ats); err != nil { t.Error(err) } else if len(ats) != 1 || ats[0].ID != attrs.GroupID || ats[0].ThresholdValue != 50.0 { t.Errorf("Received: %+v", ats) } attrs.ActionTrigger[utils.ThresholdValue] = 55 // Change the threshold - if err := apierRPC.Call(utils.ApierV2SetAccountActionTriggers, attrs, &reply); err != nil { + if err := apierRPC.Call(utils.APIerSv2SetAccountActionTriggers, attrs, &reply); err != nil { t.Error(err) } - if err := apierRPC.Call(utils.ApierV2GetAccountActionTriggers, utils.TenantAccount{Tenant: "cgrates.org", Account: "dan"}, &ats); err != nil { + if err := apierRPC.Call(utils.APIerSv2GetAccountActionTriggers, utils.TenantAccount{Tenant: "cgrates.org", Account: "dan"}, &ats); err != nil { t.Error(err) } else if len(ats) != 1 || ats[0].ID != attrs.GroupID || ats[0].ThresholdValue != 55.0 { t.Errorf("Received: %+v", ats) } } -func testApierV2itFraudMitigation(t *testing.T) { +func testAPIerSv2itFraudMitigation(t *testing.T) { attrs := &utils.AttrSetBalance{ Tenant: "cgrates.org", Account: "dan", @@ -212,11 +212,11 @@ func testApierV2itFraudMitigation(t *testing.T) { }, } var reply string - if err := apierRPC.Call(utils.ApierV2SetBalance, attrs, &reply); err != nil { + if err := apierRPC.Call(utils.APIerSv2SetBalance, attrs, &reply); err != nil { t.Fatal(err) } var acnt engine.Account - if err := apierRPC.Call(utils.ApierV2GetAccount, &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "dan"}, &acnt); err != nil { + if err := apierRPC.Call(utils.APIerSv2GetAccount, &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "dan"}, &acnt); err != nil { t.Error(err) } else if len(acnt.BalanceMap) != 1 || acnt.BalanceMap[utils.MONETARY][0].Value != 60.0 { t.Errorf("Unexpected balance received: %+v", acnt.BalanceMap[utils.MONETARY][0]) @@ -230,11 +230,11 @@ func testApierV2itFraudMitigation(t *testing.T) { utils.Disabled: false, }, } - if err := apierRPC.Call(utils.ApierV2SetAccount, attrSetAcnt, &reply); err != nil { + if err := apierRPC.Call(utils.APIerSv2SetAccount, attrSetAcnt, &reply); err != nil { t.Fatal(err) } acnt = engine.Account{} // gob doesn't update the fields with default values - if err := apierRPC.Call(utils.ApierV2GetAccount, &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "dan"}, &acnt); err != nil { + if err := apierRPC.Call(utils.APIerSv2GetAccount, &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "dan"}, &acnt); err != nil { t.Error(err) } else if len(acnt.BalanceMap) != 1 || acnt.BalanceMap[utils.MONETARY][0].Value != 60.0 { t.Errorf("Unexpected balance received: %+v", acnt.BalanceMap[utils.MONETARY][0]) @@ -243,18 +243,18 @@ func testApierV2itFraudMitigation(t *testing.T) { } } -func testApierV2itSetAccountWithAP(t *testing.T) { - argActs1 := utils.AttrSetActions{ActionsId: "TestApierV2itSetAccountWithAP_ACT_1", +func testAPIerSv2itSetAccountWithAP(t *testing.T) { + argActs1 := utils.AttrSetActions{ActionsId: "TestAPIerSv2itSetAccountWithAP_ACT_1", Actions: []*utils.TPAction{ {Identifier: utils.TOPUP_RESET, BalanceType: utils.MONETARY, Units: "5.0", Weight: 20.0}, }} var reply string - if err := apierRPC.Call(utils.ApierV2SetActions, argActs1, &reply); err != nil { + if err := apierRPC.Call(utils.APIerSv2SetActions, argActs1, &reply); err != nil { t.Error(err) } tNow := time.Now().Add(time.Duration(time.Minute)) - argAP1 := &v1.AttrSetActionPlan{Id: "TestApierV2itSetAccountWithAP_AP_1", + argAP1 := &v1.AttrSetActionPlan{Id: "TestAPIerSv2itSetAccountWithAP_AP_1", ActionPlan: []*v1.AttrActionPlan{ {ActionsId: argActs1.ActionsId, Time: fmt.Sprintf("%v:%v:%v", tNow.Hour(), tNow.Minute(), tNow.Second()), // 10:4:12 @@ -262,21 +262,21 @@ func testApierV2itSetAccountWithAP(t *testing.T) { if _, err := dm.GetActionPlan(argAP1.Id, true, utils.NonTransactional); err == nil || err != utils.ErrNotFound { t.Error(err) } - if err := apierRPC.Call(utils.ApierV1SetActionPlan, argAP1, &reply); err != nil { - t.Error("Got error on ApierV1.SetActionPlan: ", err.Error()) + if err := apierRPC.Call(utils.APIerSv1SetActionPlan, argAP1, &reply); err != nil { + t.Error("Got error on APIerSv1.SetActionPlan: ", err.Error()) } else if reply != utils.OK { - t.Errorf("Calling ApierV1.SetActionPlan received: %s", reply) + t.Errorf("Calling APIerSv1.SetActionPlan received: %s", reply) } argSetAcnt1 := AttrSetAccount{ Tenant: "cgrates.org", - Account: "TestApierV2itSetAccountWithAP1", + Account: "TestAPIerSv2itSetAccountWithAP1", ActionPlanIDs: []string{argAP1.Id}, } acntID := utils.ConcatenatedKey(argSetAcnt1.Tenant, argSetAcnt1.Account) if _, err := dm.GetAccountActionPlans(acntID, true, utils.NonTransactional); err == nil || err != utils.ErrNotFound { t.Error(err) } - if err := apierRPC.Call(utils.ApierV2SetAccount, argSetAcnt1, &reply); err != nil { + if err := apierRPC.Call(utils.APIerSv2SetAccount, argSetAcnt1, &reply); err != nil { t.Fatal(err) } if ap, err := dm.GetActionPlan(argAP1.Id, true, utils.NonTransactional); err != nil { @@ -291,24 +291,24 @@ func testApierV2itSetAccountWithAP(t *testing.T) { t.Errorf("Expecting: %+v, received: %+v", eAAPids, aapIDs) } // Set second AP so we can see the proper indexing done - argAP2 := &v1.AttrSetActionPlan{Id: "TestApierV2itSetAccountWithAP_AP_2", + argAP2 := &v1.AttrSetActionPlan{Id: "TestAPIerSv2itSetAccountWithAP_AP_2", ActionPlan: []*v1.AttrActionPlan{ {ActionsId: argActs1.ActionsId, MonthDays: "1", Time: "00:00:00", Weight: 20.0}}} if _, err := dm.GetActionPlan(argAP2.Id, true, utils.NonTransactional); err == nil || err != utils.ErrNotFound { t.Error(err) } - if err := apierRPC.Call(utils.ApierV2SetActionPlan, argAP2, &reply); err != nil { - t.Error("Got error on ApierV2.SetActionPlan: ", err.Error()) + if err := apierRPC.Call(utils.APIerSv2SetActionPlan, argAP2, &reply); err != nil { + t.Error("Got error on APIerSv2.SetActionPlan: ", err.Error()) } else if reply != utils.OK { - t.Errorf("Calling ApierV2.SetActionPlan received: %s", reply) + t.Errorf("Calling APIerSv2.SetActionPlan received: %s", reply) } // Test adding new AP argSetAcnt2 := AttrSetAccount{ Tenant: "cgrates.org", - Account: "TestApierV2itSetAccountWithAP1", + Account: "TestAPIerSv2itSetAccountWithAP1", ActionPlanIDs: []string{argAP2.Id}, } - if err := apierRPC.Call(utils.ApierV2SetAccount, argSetAcnt2, &reply); err != nil { + if err := apierRPC.Call(utils.APIerSv2SetAccount, argSetAcnt2, &reply); err != nil { t.Fatal(err) } if ap, err := dm.GetActionPlan(argAP2.Id, true, utils.NonTransactional); err != nil { @@ -330,11 +330,11 @@ func testApierV2itSetAccountWithAP(t *testing.T) { // test remove and overwrite argSetAcnt2 = AttrSetAccount{ Tenant: "cgrates.org", - Account: "TestApierV2itSetAccountWithAP1", + Account: "TestAPIerSv2itSetAccountWithAP1", ActionPlanIDs: []string{argAP2.Id}, ActionPlansOverwrite: true, } - if err := apierRPC.Call(utils.ApierV2SetAccount, argSetAcnt2, &reply); err != nil { + if err := apierRPC.Call(utils.APIerSv2SetAccount, argSetAcnt2, &reply); err != nil { t.Fatal(err) } if ap, err := dm.GetActionPlan(argAP1.Id, true, utils.NonTransactional); err != nil { @@ -355,35 +355,35 @@ func testApierV2itSetAccountWithAP(t *testing.T) { } } -func testApierV2itSetActionWithCategory(t *testing.T) { +func testAPIerSv2itSetActionWithCategory(t *testing.T) { var reply string - attrsSetAccount := &utils.AttrSetAccount{Tenant: "cgrates.org", Account: "TestApierV2itSetActionWithCategory"} - if err := apierRPC.Call(utils.ApierV1SetAccount, attrsSetAccount, &reply); err != nil { - t.Error("Got error on ApierV1.SetAccount: ", err.Error()) + attrsSetAccount := &utils.AttrSetAccount{Tenant: "cgrates.org", Account: "TestAPIerSv2itSetActionWithCategory"} + if err := apierRPC.Call(utils.APIerSv1SetAccount, attrsSetAccount, &reply); err != nil { + t.Error("Got error on APIerSv1.SetAccount: ", err.Error()) } else if reply != utils.OK { - t.Errorf("Calling ApierV1.SetAccount received: %s", reply) + t.Errorf("Calling APIerSv1.SetAccount received: %s", reply) } - argActs1 := utils.AttrSetActions{ActionsId: "TestApierV2itSetActionWithCategory_ACT", + argActs1 := utils.AttrSetActions{ActionsId: "TestAPIerSv2itSetActionWithCategory_ACT", Actions: []*utils.TPAction{ {Identifier: utils.TOPUP_RESET, BalanceType: utils.MONETARY, Categories: "test", Units: "5.0", Weight: 20.0}, }} - if err := apierRPC.Call(utils.ApierV2SetActions, argActs1, &reply); err != nil { + if err := apierRPC.Call(utils.APIerSv2SetActions, argActs1, &reply); err != nil { t.Error(err) } attrsEA := &utils.AttrExecuteAction{Tenant: attrsSetAccount.Tenant, Account: attrsSetAccount.Account, ActionsId: argActs1.ActionsId} - if err := apierRPC.Call(utils.ApierV1ExecuteAction, attrsEA, &reply); err != nil { - t.Error("Got error on ApierV1.ExecuteAction: ", err.Error()) + if err := apierRPC.Call(utils.APIerSv1ExecuteAction, attrsEA, &reply); err != nil { + t.Error("Got error on APIerSv1.ExecuteAction: ", err.Error()) } else if reply != utils.OK { - t.Errorf("Calling ApierV1.ExecuteAction received: %s", reply) + t.Errorf("Calling APIerSv1.ExecuteAction received: %s", reply) } var acnt engine.Account - if err := apierRPC.Call(utils.ApierV2GetAccount, &utils.AttrGetAccount{Tenant: "cgrates.org", - Account: "TestApierV2itSetActionWithCategory"}, &acnt); err != nil { + if err := apierRPC.Call(utils.APIerSv2GetAccount, &utils.AttrGetAccount{Tenant: "cgrates.org", + Account: "TestAPIerSv2itSetActionWithCategory"}, &acnt); err != nil { t.Error(err) } else if len(acnt.BalanceMap) != 1 || acnt.BalanceMap[utils.MONETARY][0].Value != 5.0 { t.Errorf("Unexpected balance received: %+v", acnt.BalanceMap[utils.MONETARY][0]) @@ -393,44 +393,44 @@ func testApierV2itSetActionWithCategory(t *testing.T) { } } -func testApierV2itSetActionPlanWithWrongTiming(t *testing.T) { +func testAPIerSv2itSetActionPlanWithWrongTiming(t *testing.T) { var reply string tNow := time.Now().Add(time.Duration(time.Minute)).String() - argAP1 := &v1.AttrSetActionPlan{Id: "TestApierV2itSetAccountWithAPWithWrongTiming", + argAP1 := &v1.AttrSetActionPlan{Id: "TestAPIerSv2itSetAccountWithAPWithWrongTiming", ActionPlan: []*v1.AttrActionPlan{ &v1.AttrActionPlan{ - ActionsId: "TestApierV2itSetAccountWithAP_ACT_1", + ActionsId: "TestAPIerSv2itSetAccountWithAP_ACT_1", Time: tNow, Weight: 20.0, }, }, } - if err := apierRPC.Call(utils.ApierV1SetActionPlan, argAP1, &reply); err == nil || + if err := apierRPC.Call(utils.APIerSv1SetActionPlan, argAP1, &reply); err == nil || err.Error() != fmt.Sprintf("UNSUPPORTED_FORMAT:%s", tNow) { t.Error("Expecting error ", err) } } -func testApierV2itSetActionPlanWithWrongTiming2(t *testing.T) { +func testAPIerSv2itSetActionPlanWithWrongTiming2(t *testing.T) { var reply string - argAP1 := &v1.AttrSetActionPlan{Id: "TestApierV2itSetAccountWithAPWithWrongTiming", + argAP1 := &v1.AttrSetActionPlan{Id: "TestAPIerSv2itSetAccountWithAPWithWrongTiming", ActionPlan: []*v1.AttrActionPlan{ &v1.AttrActionPlan{ - ActionsId: "TestApierV2itSetAccountWithAP_ACT_1", + ActionsId: "TestAPIerSv2itSetAccountWithAP_ACT_1", Time: "aa:bb:cc", Weight: 20.0, }, }, } - if err := apierRPC.Call(utils.ApierV1SetActionPlan, argAP1, &reply); err == nil || + if err := apierRPC.Call(utils.APIerSv1SetActionPlan, argAP1, &reply); err == nil || err.Error() != fmt.Sprintf("UNSUPPORTED_FORMAT:aa:bb:cc") { t.Error("Expecting error ", err) } } -func testApierV2itKillEngine(t *testing.T) { +func testAPIerSv2itKillEngine(t *testing.T) { if err := engine.KillEngine(delay); err != nil { t.Error(err) } diff --git a/apier/v2/attributes.go b/apier/v2/attributes.go index 50feb0249..e59613aee 100644 --- a/apier/v2/attributes.go +++ b/apier/v2/attributes.go @@ -32,7 +32,7 @@ type AttributeWithCache struct { } //SetAttributeProfile add/update a new Attribute Profile -func (apierV2 *ApierV2) SetAttributeProfile(arg *AttributeWithCache, reply *string) error { +func (APIerSv2 *APIerSv2) SetAttributeProfile(arg *AttributeWithCache, reply *string) error { if missing := utils.MissingStructFields(arg.ExternalAttributeProfile, []string{utils.Tenant, utils.ID}); len(missing) != 0 { return utils.NewErrMandatoryIeMissing(missing...) } @@ -40,11 +40,11 @@ func (apierV2 *ApierV2) SetAttributeProfile(arg *AttributeWithCache, reply *stri if err != nil { return utils.APIErrorHandler(err) } - if err := apierV2.DataManager.SetAttributeProfile(alsPrf, true); err != nil { + if err := APIerSv2.DataManager.SetAttributeProfile(alsPrf, true); err != nil { return utils.APIErrorHandler(err) } //generate a loadID for CacheAttributeProfiles and store it in database - if err := apierV2.DataManager.SetLoadIDs( + if err := APIerSv2.DataManager.SetLoadIDs( map[string]int64{utils.CacheAttributeProfiles: time.Now().UnixNano()}); err != nil { return utils.APIErrorHandler(err) } @@ -52,7 +52,7 @@ func (apierV2 *ApierV2) SetAttributeProfile(arg *AttributeWithCache, reply *stri CacheID: utils.CacheAttributeProfiles, ItemID: alsPrf.TenantID(), } - if err := apierV2.ApierV1.CallCache( + if err := APIerSv2.APIerSv1.CallCache( v1.GetCacheOpt(arg.Cache), args); err != nil { return utils.APIErrorHandler(err) diff --git a/apier/v2/attributes_it_test.go b/apier/v2/attributes_it_test.go index 270e79cf2..c2da64d51 100644 --- a/apier/v2/attributes_it_test.go +++ b/apier/v2/attributes_it_test.go @@ -135,7 +135,7 @@ func testAttributeSSetAlsPrf(t *testing.T) { }, } var result string - if err := attrSRPC.Call(utils.ApierV2SetAttributeProfile, extAlsPrf, &result); err != nil { + if err := attrSRPC.Call(utils.APIerSv2SetAttributeProfile, extAlsPrf, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -162,7 +162,7 @@ func testAttributeSSetAlsPrf(t *testing.T) { } alsPrf.Compile() var reply *engine.AttributeProfile - if err := attrSRPC.Call(utils.ApierV1GetAttributeProfile, + if err := attrSRPC.Call(utils.APIerSv1GetAttributeProfile, utils.TenantIDWithArgDispatcher{TenantID: &utils.TenantID{Tenant: "cgrates.org", ID: "ExternalAttribute"}}, &reply); err != nil { t.Fatal(err) } @@ -197,7 +197,7 @@ func testAttributeSUpdateAlsPrf(t *testing.T) { }, } var result string - if err := attrSRPC.Call(utils.ApierV2SetAttributeProfile, extAlsPrf, &result); err != nil { + if err := attrSRPC.Call(utils.APIerSv2SetAttributeProfile, extAlsPrf, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -229,7 +229,7 @@ func testAttributeSUpdateAlsPrf(t *testing.T) { sort.Strings(alsPrf.AttributeProfile.Contexts) alsPrf.Compile() var reply *engine.AttributeProfile - if err := attrSRPC.Call(utils.ApierV1GetAttributeProfile, + if err := attrSRPC.Call(utils.APIerSv1GetAttributeProfile, utils.TenantIDWithArgDispatcher{TenantID: &utils.TenantID{Tenant: "cgrates.org", ID: "ExternalAttribute"}}, &reply); err != nil { t.Fatal(err) } diff --git a/apier/v2/cdre.go b/apier/v2/cdre.go index e1bbb11cd..6f2343a63 100644 --- a/apier/v2/cdre.go +++ b/apier/v2/cdre.go @@ -41,8 +41,8 @@ type AttrExportCdrsToFile struct { utils.RPCCDRsFilter // Inherit the CDR filter attributes } -// Deprecated, please use ApierV1.ExportCDRs instead -func (apiv2 *ApierV2) ExportCdrsToFile(attr AttrExportCdrsToFile, reply *utils.ExportedFileCdrs) (err error) { +// Deprecated, please use APIerSv1.ExportCDRs instead +func (apiv2 *APIerSv2) ExportCdrsToFile(attr AttrExportCdrsToFile, reply *utils.ExportedFileCdrs) (err error) { cdreReloadStruct := <-apiv2.Config.ConfigReloads[utils.CDRE] // Read the content of the channel, locking it defer func() { apiv2.Config.ConfigReloads[utils.CDRE] <- cdreReloadStruct }() // Unlock reloads at exit exportTemplate := apiv2.Config.CdreProfiles[utils.MetaDefault] diff --git a/apier/v2/cdrs.go b/apier/v2/cdrs.go index 41389446c..810654f57 100644 --- a/apier/v2/cdrs.go +++ b/apier/v2/cdrs.go @@ -26,7 +26,7 @@ import ( ) // Retrieves CDRs based on the filters -func (apier *ApierV2) GetCDRs(attrs utils.RPCCDRsFilter, reply *[]*engine.ExternalCDR) error { +func (apier *APIerSv2) GetCDRs(attrs utils.RPCCDRsFilter, reply *[]*engine.ExternalCDR) error { cdrsFltr, err := attrs.AsCDRsFilter(apier.Config.GeneralCfg().DefaultTimezone) if err != nil { return utils.NewErrServerError(err) @@ -46,7 +46,7 @@ func (apier *ApierV2) GetCDRs(attrs utils.RPCCDRsFilter, reply *[]*engine.Extern return nil } -func (apier *ApierV2) CountCDRs(attrs utils.RPCCDRsFilter, reply *int64) error { +func (apier *APIerSv2) CountCDRs(attrs utils.RPCCDRsFilter, reply *int64) error { cdrsFltr, err := attrs.AsCDRsFilter(apier.Config.GeneralCfg().DefaultTimezone) if err != nil { if err.Error() != utils.NotFoundCaps { diff --git a/apier/v2/cdrs_it_test.go b/apier/v2/cdrs_it_test.go index dc61e994c..8b82ad4d2 100644 --- a/apier/v2/cdrs_it_test.go +++ b/apier/v2/cdrs_it_test.go @@ -125,7 +125,7 @@ func testV2CDRsRpcConn(t *testing.T) { func testV2CDRsLoadTariffPlanFromFolder(t *testing.T) { var loadInst utils.LoadInstance - if err := cdrsRpc.Call(utils.ApierV2LoadTariffPlanFromFolder, + if err := cdrsRpc.Call(utils.APIerSv2LoadTariffPlanFromFolder, &utils.AttrLoadTpFromFolder{FolderPath: path.Join( *dataDir, "tariffplans", "testit")}, &loadInst); err != nil { t.Error(err) @@ -166,14 +166,14 @@ func testV2CDRsProcessCDR(t *testing.T) { func testV2CDRsGetCdrs(t *testing.T) { var cdrCnt int64 req := utils.AttrGetCdrs{} - if err := cdrsRpc.Call(utils.ApierV2CountCDRs, req, &cdrCnt); err != nil { + if err := cdrsRpc.Call(utils.APIerSv2CountCDRs, req, &cdrCnt); err != nil { t.Error("Unexpected error: ", err.Error()) } else if cdrCnt != 3 { t.Error("Unexpected number of CDRs returned: ", cdrCnt) } var cdrs []*engine.ExternalCDR args := utils.RPCCDRsFilter{RunIDs: []string{utils.MetaRaw}} - if err := cdrsRpc.Call(utils.ApierV2GetCDRs, args, &cdrs); err != nil { + if err := cdrsRpc.Call(utils.APIerSv2GetCDRs, args, &cdrs); err != nil { t.Error("Unexpected error: ", err.Error()) } else if len(cdrs) != 1 { t.Error("Unexpected number of CDRs returned: ", len(cdrs)) @@ -187,7 +187,7 @@ func testV2CDRsGetCdrs(t *testing.T) { } } args = utils.RPCCDRsFilter{RunIDs: []string{"CustomerCharges"}} - if err := cdrsRpc.Call(utils.ApierV2GetCDRs, args, &cdrs); err != nil { + if err := cdrsRpc.Call(utils.APIerSv2GetCDRs, args, &cdrs); err != nil { t.Error("Unexpected error: ", err.Error()) } else if len(cdrs) != 1 { t.Error("Unexpected number of CDRs returned: ", len(cdrs)) @@ -201,7 +201,7 @@ func testV2CDRsGetCdrs(t *testing.T) { } } args = utils.RPCCDRsFilter{RunIDs: []string{"SupplierCharges"}} - if err := cdrsRpc.Call(utils.ApierV2GetCDRs, args, &cdrs); err != nil { + if err := cdrsRpc.Call(utils.APIerSv2GetCDRs, args, &cdrs); err != nil { t.Error("Unexpected error: ", err.Error()) } else if len(cdrs) != 1 { t.Error("Unexpected number of CDRs returned: ", len(cdrs)) @@ -234,10 +234,10 @@ func testV2CDRsRateCDRs(t *testing.T) { }, }, } - if err := cdrsRpc.Call(utils.ApierV1GetRatingProfile, attrGetRatingPlan, &rpl); err != nil { - t.Errorf("Got error on ApierV1.GetRatingProfile: %+v", err) + if err := cdrsRpc.Call(utils.APIerSv1GetRatingProfile, attrGetRatingPlan, &rpl); err != nil { + t.Errorf("Got error on APIerSv1.GetRatingProfile: %+v", err) } else if !reflect.DeepEqual(expected, rpl) { - t.Errorf("Calling ApierV1.GetRatingProfile expected: %+v, received: %+v", utils.ToJSON(expected), utils.ToJSON(rpl)) + t.Errorf("Calling APIerSv1.GetRatingProfile expected: %+v, received: %+v", utils.ToJSON(expected), utils.ToJSON(rpl)) } rpf := &utils.AttrSetRatingProfile{ @@ -251,10 +251,10 @@ func testV2CDRsRateCDRs(t *testing.T) { Overwrite: true, } var reply string - if err := cdrsRpc.Call(utils.ApierV1SetRatingProfile, rpf, &reply); err != nil { - t.Error("Got error on ApierV1.SetRatingProfile: ", err.Error()) + if err := cdrsRpc.Call(utils.APIerSv1SetRatingProfile, rpf, &reply); err != nil { + t.Error("Got error on APIerSv1.SetRatingProfile: ", err.Error()) } else if reply != utils.OK { - t.Error("Calling ApierV1.SetRatingProfile got reply: ", reply) + t.Error("Calling APIerSv1.SetRatingProfile got reply: ", reply) } expected = engine.RatingProfile{ @@ -266,10 +266,10 @@ func testV2CDRsRateCDRs(t *testing.T) { }, }, } - if err := cdrsRpc.Call(utils.ApierV1GetRatingProfile, attrGetRatingPlan, &rpl); err != nil { - t.Errorf("Got error on ApierV1.GetRatingProfile: %+v", err) + if err := cdrsRpc.Call(utils.APIerSv1GetRatingProfile, attrGetRatingPlan, &rpl); err != nil { + t.Errorf("Got error on APIerSv1.GetRatingProfile: %+v", err) } else if !reflect.DeepEqual(expected, rpl) { - t.Errorf("Calling ApierV1.GetRatingProfile expected: %+v, received: %+v", utils.ToJSON(expected), utils.ToJSON(rpl)) + t.Errorf("Calling APIerSv1.GetRatingProfile expected: %+v, received: %+v", utils.ToJSON(expected), utils.ToJSON(rpl)) } if err := cdrsRpc.Call(utils.CDRsV1RateCDRs, &engine.ArgRateCDRs{ @@ -285,14 +285,14 @@ func testV2CDRsRateCDRs(t *testing.T) { func testV2CDRsGetCdrs2(t *testing.T) { var cdrCnt int64 req := utils.AttrGetCdrs{} - if err := cdrsRpc.Call(utils.ApierV2CountCDRs, req, &cdrCnt); err != nil { + if err := cdrsRpc.Call(utils.APIerSv2CountCDRs, req, &cdrCnt); err != nil { t.Error("Unexpected error: ", err.Error()) } else if cdrCnt != 3 { t.Error("Unexpected number of CDRs returned: ", cdrCnt) } var cdrs []*engine.ExternalCDR args := utils.RPCCDRsFilter{RunIDs: []string{utils.MetaRaw}} - if err := cdrsRpc.Call(utils.ApierV2GetCDRs, args, &cdrs); err != nil { + if err := cdrsRpc.Call(utils.APIerSv2GetCDRs, args, &cdrs); err != nil { t.Error("Unexpected error: ", err.Error()) } else if len(cdrs) != 1 { t.Error("Unexpected number of CDRs returned: ", len(cdrs)) @@ -302,7 +302,7 @@ func testV2CDRsGetCdrs2(t *testing.T) { } } args = utils.RPCCDRsFilter{RunIDs: []string{"CustomerCharges"}} - if err := cdrsRpc.Call(utils.ApierV2GetCDRs, args, &cdrs); err != nil { + if err := cdrsRpc.Call(utils.APIerSv2GetCDRs, args, &cdrs); err != nil { t.Error("Unexpected error: ", err.Error()) } else if len(cdrs) != 1 { t.Error("Unexpected number of CDRs returned: ", len(cdrs)) @@ -312,7 +312,7 @@ func testV2CDRsGetCdrs2(t *testing.T) { } } args = utils.RPCCDRsFilter{RunIDs: []string{"SupplierCharges"}} - if err := cdrsRpc.Call(utils.ApierV2GetCDRs, args, &cdrs); err != nil { + if err := cdrsRpc.Call(utils.APIerSv2GetCDRs, args, &cdrs); err != nil { t.Error("Unexpected error: ", err.Error()) } else if len(cdrs) != 1 { t.Error("Unexpected number of CDRs returned: ", len(cdrs)) @@ -353,7 +353,7 @@ func testV2CDRsUsageNegative(t *testing.T) { var cdrs []*engine.ExternalCDR args := utils.RPCCDRsFilter{RunIDs: []string{utils.MetaRaw}, OriginIDs: []string{"testV2CDRsUsageNegative"}} - if err := cdrsRpc.Call(utils.ApierV2GetCDRs, args, &cdrs); err != nil { + if err := cdrsRpc.Call(utils.APIerSv2GetCDRs, args, &cdrs); err != nil { t.Error("Unexpected error: ", err.Error()) } else if len(cdrs) != 1 { t.Error("Unexpected number of CDRs returned: ", len(cdrs)) @@ -367,7 +367,7 @@ func testV2CDRsUsageNegative(t *testing.T) { } cdrs = nil // gob doesn't modify zero-value fields args = utils.RPCCDRsFilter{RunIDs: []string{"CustomerCharges"}, OriginIDs: []string{"testV2CDRsUsageNegative"}} - if err := cdrsRpc.Call(utils.ApierV2GetCDRs, args, &cdrs); err != nil { + if err := cdrsRpc.Call(utils.APIerSv2GetCDRs, args, &cdrs); err != nil { t.Error("Unexpected error: ", err.Error()) } else if len(cdrs) != 1 { t.Error("Unexpected number of CDRs returned: ", len(cdrs)) @@ -381,7 +381,7 @@ func testV2CDRsUsageNegative(t *testing.T) { } cdrs = nil // gob doesn't modify zero-value fields args = utils.RPCCDRsFilter{RunIDs: []string{"SupplierCharges"}, OriginIDs: []string{"testV2CDRsUsageNegative"}} - if err := cdrsRpc.Call(utils.ApierV2GetCDRs, args, &cdrs); err != nil { + if err := cdrsRpc.Call(utils.APIerSv2GetCDRs, args, &cdrs); err != nil { t.Error("Unexpected error: ", err.Error()) } else if len(cdrs) != 1 { t.Error("Unexpected number of CDRs returned: ", len(cdrs)) @@ -435,13 +435,13 @@ func testV2CDRsDifferentTenants(t *testing.T) { } alsPrf.Compile() var result string - if err := cdrsRpc.Call(utils.ApierV1SetAttributeProfile, alsPrf, &result); err != nil { + if err := cdrsRpc.Call(utils.APIerSv1SetAttributeProfile, alsPrf, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } var reply *engine.AttributeProfile - if err := cdrsRpc.Call(utils.ApierV1GetAttributeProfile, + if err := cdrsRpc.Call(utils.APIerSv1GetAttributeProfile, &utils.TenantIDWithArgDispatcher{TenantID: &utils.TenantID{Tenant: "cgrates.com", ID: "ATTR_Tenant"}}, &reply); err != nil { t.Fatal(err) } @@ -464,13 +464,13 @@ func testV2CDRsDifferentTenants(t *testing.T) { }, Cache: utils.StringPointer(utils.MetaReload), } - if err := cdrsRpc.Call(utils.ApierV1SetChargerProfile, chargerProfile, &result); err != nil { + if err := cdrsRpc.Call(utils.APIerSv1SetChargerProfile, chargerProfile, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } var reply2 *engine.ChargerProfile - if err := cdrsRpc.Call(utils.ApierV1GetChargerProfile, + if err := cdrsRpc.Call(utils.APIerSv1GetChargerProfile, &utils.TenantID{Tenant: "CustomTenant", ID: "CustomCharger"}, &reply2); err != nil { t.Error(err) } else if !reflect.DeepEqual(chargerProfile.ChargerProfile, reply2) { @@ -506,7 +506,7 @@ func testV2CDRsDifferentTenants(t *testing.T) { var cdrs []*engine.ExternalCDR args := utils.RPCCDRsFilter{Tenants: []string{"CustomTenant"}} - if err := cdrsRpc.Call(utils.ApierV2GetCDRs, args, &cdrs); err != nil { + if err := cdrsRpc.Call(utils.APIerSv2GetCDRs, args, &cdrs); err != nil { t.Error("Unexpected error: ", err.Error()) } else if len(cdrs) != 1 { // no raw Charger defined t.Error("Unexpected number of CDRs returned: ", len(cdrs)) @@ -515,7 +515,7 @@ func testV2CDRsDifferentTenants(t *testing.T) { func testV2CDRsRemoveRatingProfiles(t *testing.T) { var reply string - if err := cdrsRpc.Call(utils.ApierV1RemoveRatingProfile, &v1.AttrRemoveRatingProfile{ + if err := cdrsRpc.Call(utils.APIerSv1RemoveRatingProfile, &v1.AttrRemoveRatingProfile{ Tenant: "cgrates.org", Category: utils.CALL, Subject: utils.ANY, @@ -524,7 +524,7 @@ func testV2CDRsRemoveRatingProfiles(t *testing.T) { } else if reply != utils.OK { t.Errorf("Expected: %s, received: %s ", utils.OK, reply) } - if err := cdrsRpc.Call(utils.ApierV1RemoveRatingProfile, &v1.AttrRemoveRatingProfile{ + if err := cdrsRpc.Call(utils.APIerSv1RemoveRatingProfile, &v1.AttrRemoveRatingProfile{ Tenant: "cgrates.org", Category: utils.CALL, Subject: "SUPPLIER1", @@ -567,14 +567,14 @@ func testV2CDRsProcessCDRNoRattingPlan(t *testing.T) { func testV2CDRsGetCdrsNoRattingPlan(t *testing.T) { var cdrCnt int64 req := utils.AttrGetCdrs{} - if err := cdrsRpc.Call(utils.ApierV2CountCDRs, req, &cdrCnt); err != nil { + if err := cdrsRpc.Call(utils.APIerSv2CountCDRs, req, &cdrCnt); err != nil { t.Error("Unexpected error: ", err.Error()) } else if cdrCnt != 10 { t.Error("Unexpected number of CDRs returned: ", cdrCnt) } var cdrs []*engine.ExternalCDR args := utils.RPCCDRsFilter{RunIDs: []string{utils.MetaRaw}, Accounts: []string{"testV2CDRsProcessCDR4"}} - if err := cdrsRpc.Call(utils.ApierV2GetCDRs, args, &cdrs); err != nil { + if err := cdrsRpc.Call(utils.APIerSv2GetCDRs, args, &cdrs); err != nil { t.Error("Unexpected error: ", err.Error()) } else if len(cdrs) != 1 { t.Error("Unexpected number of CDRs returned: ", len(cdrs)) @@ -584,7 +584,7 @@ func testV2CDRsGetCdrsNoRattingPlan(t *testing.T) { } } args = utils.RPCCDRsFilter{RunIDs: []string{"CustomerCharges"}, Accounts: []string{"testV2CDRsProcessCDR4"}} - if err := cdrsRpc.Call(utils.ApierV2GetCDRs, args, &cdrs); err != nil { + if err := cdrsRpc.Call(utils.APIerSv2GetCDRs, args, &cdrs); err != nil { t.Error("Unexpected error: ", err.Error()) } else if len(cdrs) != 1 { t.Error("Unexpected number of CDRs returned: ", len(cdrs)) @@ -597,7 +597,7 @@ func testV2CDRsGetCdrsNoRattingPlan(t *testing.T) { } } args = utils.RPCCDRsFilter{RunIDs: []string{"SupplierCharges"}, Accounts: []string{"testV2CDRsProcessCDR4"}} - if err := cdrsRpc.Call(utils.ApierV2GetCDRs, args, &cdrs); err != nil { + if err := cdrsRpc.Call(utils.APIerSv2GetCDRs, args, &cdrs); err != nil { t.Error("Unexpected error: ", err.Error()) } else if len(cdrs) != 1 { t.Error("Unexpected number of CDRs returned: ", len(cdrs)) @@ -624,10 +624,10 @@ func testV2CDRsRateCDRsWithRatingPlan(t *testing.T) { Overwrite: true, } var reply string - if err := cdrsRpc.Call(utils.ApierV1SetRatingProfile, rpf, &reply); err != nil { - t.Error("Got error on ApierV1.SetRatingProfile: ", err.Error()) + if err := cdrsRpc.Call(utils.APIerSv1SetRatingProfile, rpf, &reply); err != nil { + t.Error("Got error on APIerSv1.SetRatingProfile: ", err.Error()) } else if reply != utils.OK { - t.Error("Calling ApierV1.SetRatingProfile got reply: ", reply) + t.Error("Calling APIerSv1.SetRatingProfile got reply: ", reply) } rpf = &utils.AttrSetRatingProfile{ @@ -640,10 +640,10 @@ func testV2CDRsRateCDRsWithRatingPlan(t *testing.T) { RatingPlanId: "RP_TESTIT1"}}, Overwrite: true, } - if err := cdrsRpc.Call(utils.ApierV1SetRatingProfile, rpf, &reply); err != nil { - t.Error("Got error on ApierV1.SetRatingProfile: ", err.Error()) + if err := cdrsRpc.Call(utils.APIerSv1SetRatingProfile, rpf, &reply); err != nil { + t.Error("Got error on APIerSv1.SetRatingProfile: ", err.Error()) } else if reply != utils.OK { - t.Error("Calling ApierV1.SetRatingProfile got reply: ", reply) + t.Error("Calling APIerSv1.SetRatingProfile got reply: ", reply) } if err := cdrsRpc.Call(utils.CDRsV1RateCDRs, &engine.ArgRateCDRs{ @@ -659,14 +659,14 @@ func testV2CDRsRateCDRsWithRatingPlan(t *testing.T) { func testV2CDRsGetCdrsWithRattingPlan(t *testing.T) { var cdrCnt int64 req := utils.AttrGetCdrs{} - if err := cdrsRpc.Call(utils.ApierV2CountCDRs, req, &cdrCnt); err != nil { + if err := cdrsRpc.Call(utils.APIerSv2CountCDRs, req, &cdrCnt); err != nil { t.Error("Unexpected error: ", err.Error()) } else if cdrCnt != 10 { t.Error("Unexpected number of CDRs returned: ", cdrCnt) } var cdrs []*engine.ExternalCDR args := utils.RPCCDRsFilter{RunIDs: []string{utils.MetaRaw}, Accounts: []string{"testV2CDRsProcessCDR4"}} - if err := cdrsRpc.Call(utils.ApierV2GetCDRs, args, &cdrs); err != nil { + if err := cdrsRpc.Call(utils.APIerSv2GetCDRs, args, &cdrs); err != nil { t.Error("Unexpected error: ", err.Error()) } else if len(cdrs) != 1 { t.Error("Unexpected number of CDRs returned: ", len(cdrs)) @@ -677,7 +677,7 @@ func testV2CDRsGetCdrsWithRattingPlan(t *testing.T) { } cdrs = []*engine.ExternalCDR{} // gob will not update zero value fields args = utils.RPCCDRsFilter{RunIDs: []string{"CustomerCharges"}, Accounts: []string{"testV2CDRsProcessCDR4"}} - if err := cdrsRpc.Call(utils.ApierV2GetCDRs, args, &cdrs); err != nil { + if err := cdrsRpc.Call(utils.APIerSv2GetCDRs, args, &cdrs); err != nil { t.Error("Unexpected error: ", err.Error()) } else if len(cdrs) != 1 { t.Error("Unexpected number of CDRs returned: ", len(cdrs)) @@ -691,7 +691,7 @@ func testV2CDRsGetCdrsWithRattingPlan(t *testing.T) { } cdrs = []*engine.ExternalCDR{} // gob will not update zero value fields args = utils.RPCCDRsFilter{RunIDs: []string{"SupplierCharges"}, Accounts: []string{"testV2CDRsProcessCDR4"}} - if err := cdrsRpc.Call(utils.ApierV2GetCDRs, args, &cdrs); err != nil { + if err := cdrsRpc.Call(utils.APIerSv2GetCDRs, args, &cdrs); err != nil { t.Error("Unexpected error: ", err.Error()) } else if len(cdrs) != 1 { t.Error("Unexpected number of CDRs returned: ", len(cdrs)) @@ -706,13 +706,13 @@ func testV2CDRsGetCdrsWithRattingPlan(t *testing.T) { } func testV2CDRsSetThreshold(t *testing.T) { var reply string - if err := cdrsRpc.Call(utils.ApierV2SetActions, &utils.AttrSetActions{ + if err := cdrsRpc.Call(utils.APIerSv2SetActions, &utils.AttrSetActions{ ActionsId: "ACT_LOG", Actions: []*utils.TPAction{{Identifier: utils.LOG}}, }, &reply); err != nil && err.Error() != utils.ErrExists.Error() { t.Error(err) } else if reply != utils.OK { - t.Errorf("Calling ApierV2.SetActions received: %s", reply) + t.Errorf("Calling APIerSv2.SetActions received: %s", reply) } tPrfl := engine.ThresholdWithCache{ ThresholdProfile: &engine.ThresholdProfile{ @@ -727,7 +727,7 @@ func testV2CDRsSetThreshold(t *testing.T) { ActionIDs: []string{"ACT_LOG"}, }, } - if err := cdrsRpc.Call(utils.ApierV1SetThresholdProfile, tPrfl, &reply); err != nil { + if err := cdrsRpc.Call(utils.APIerSv1SetThresholdProfile, tPrfl, &reply); err != nil { t.Error(err) } else if reply != utils.OK { t.Error("Unexpected reply returned", reply) @@ -739,7 +739,7 @@ func testV2CDRsSetThreshold(t *testing.T) { utils.AllowNegative: true, }, } - if err := cdrsRpc.Call(utils.ApierV2SetAccount, attrSetAcnt, &reply); err != nil { + if err := cdrsRpc.Call(utils.APIerSv2SetAccount, attrSetAcnt, &reply); err != nil { t.Fatal(err) } attrs := &utils.AttrSetBalance{ @@ -752,7 +752,7 @@ func testV2CDRsSetThreshold(t *testing.T) { utils.Weight: 10.0, }, } - if err := cdrsRpc.Call(utils.ApierV2SetBalance, attrs, &reply); err != nil { + if err := cdrsRpc.Call(utils.APIerSv2SetBalance, attrs, &reply); err != nil { t.Fatal(err) } } diff --git a/apier/v2/cdrs_offline_it_test.go b/apier/v2/cdrs_offline_it_test.go index f28a1ece7..b47a94644 100644 --- a/apier/v2/cdrs_offline_it_test.go +++ b/apier/v2/cdrs_offline_it_test.go @@ -110,7 +110,7 @@ func testV2cdrsOfflineRpcConn(t *testing.T) { func testV2CDRsOfflineLoadData(t *testing.T) { var loadInst utils.LoadInstance - if err := cdrsOfflineRpc.Call(utils.ApierV2LoadTariffPlanFromFolder, + if err := cdrsOfflineRpc.Call(utils.APIerSv2LoadTariffPlanFromFolder, &utils.AttrLoadTpFromFolder{FolderPath: path.Join( *dataDir, "tariffplans", "testit")}, &loadInst); err != nil { t.Error(err) @@ -131,11 +131,11 @@ func testV2CDRsOfflineBalanceUpdate(t *testing.T) { }, } var reply string - if err := cdrsOfflineRpc.Call(utils.ApierV2SetBalance, attrs, &reply); err != nil { + if err := cdrsOfflineRpc.Call(utils.APIerSv2SetBalance, attrs, &reply); err != nil { t.Fatal(err) } var acnt *engine.Account - if err := cdrsOfflineRpc.Call(utils.ApierV2GetAccount, &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "test"}, &acnt); err != nil { + if err := cdrsOfflineRpc.Call(utils.APIerSv2GetAccount, &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "test"}, &acnt); err != nil { t.Error(err) } else if len(acnt.BalanceMap) != 1 || acnt.BalanceMap[utils.MONETARY][0].Value != 10.0 { t.Errorf("Unexpected balance received: %+v", acnt.BalanceMap[utils.MONETARY][0]) @@ -148,13 +148,13 @@ func testV2CDRsOfflineBalanceUpdate(t *testing.T) { attrsAA := &utils.AttrSetActions{ActionsId: "ACT_LOG", Actions: []*utils.TPAction{ {Identifier: utils.LOG}, }} - if err := cdrsOfflineRpc.Call(utils.ApierV2SetActions, attrsAA, &reply); err != nil && err.Error() != utils.ErrExists.Error() { - t.Error("Got error on ApierV2.SetActions: ", err.Error()) + if err := cdrsOfflineRpc.Call(utils.APIerSv2SetActions, attrsAA, &reply); err != nil && err.Error() != utils.ErrExists.Error() { + t.Error("Got error on APIerSv2.SetActions: ", err.Error()) } else if reply != utils.OK { - t.Errorf("Calling ApierV2.SetActions received: %s", reply) + t.Errorf("Calling APIerSv2.SetActions received: %s", reply) } //make sure that the threshold don't exit - if err := cdrsOfflineRpc.Call(utils.ApierV1GetThresholdProfile, + if err := cdrsOfflineRpc.Call(utils.APIerSv1GetThresholdProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "THD_Test"}, &thReply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) @@ -173,12 +173,12 @@ func testV2CDRsOfflineBalanceUpdate(t *testing.T) { Async: false, }, } - if err := cdrsOfflineRpc.Call(utils.ApierV1SetThresholdProfile, tPrfl, &result); err != nil { + if err := cdrsOfflineRpc.Call(utils.APIerSv1SetThresholdProfile, tPrfl, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } - if err := cdrsOfflineRpc.Call(utils.ApierV1GetThresholdProfile, + if err := cdrsOfflineRpc.Call(utils.APIerSv1GetThresholdProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "THD_Test"}, &thReply); err != nil { t.Error(err) } else if !reflect.DeepEqual(tPrfl.ThresholdProfile, thReply) { @@ -224,33 +224,33 @@ func testV2CDRsOfflineExpiryBalance(t *testing.T) { &utils.TPAction{Identifier: utils.TOPUP, BalanceType: utils.MONETARY, BalanceId: "NewBalance", Units: "10", ExpiryTime: utils.UNLIMITED, BalanceWeight: "10", Weight: 20.0}, }} - if err := cdrsOfflineRpc.Call(utils.ApierV2SetActions, acc, &reply); err != nil && err.Error() != utils.ErrExists.Error() { - t.Error("Got error on ApierV2.SetActions: ", err.Error()) + if err := cdrsOfflineRpc.Call(utils.APIerSv2SetActions, acc, &reply); err != nil && err.Error() != utils.ErrExists.Error() { + t.Error("Got error on APIerSv2.SetActions: ", err.Error()) } else if reply != utils.OK { - t.Errorf("Calling ApierV2.SetActions received: %s", reply) + t.Errorf("Calling APIerSv2.SetActions received: %s", reply) } atm1 := &v1.AttrActionPlan{ActionsId: "ACT_TOPUP_TEST2", Time: "*asap", Weight: 20.0} atms1 := &v1.AttrSetActionPlan{Id: "AP_TEST2", ActionPlan: []*v1.AttrActionPlan{atm1}} - if err := cdrsOfflineRpc.Call(utils.ApierV1SetActionPlan, atms1, &reply); err != nil { - t.Error("Got error on ApierV1.SetActionPlan: ", err.Error()) + if err := cdrsOfflineRpc.Call(utils.APIerSv1SetActionPlan, atms1, &reply); err != nil { + t.Error("Got error on APIerSv1.SetActionPlan: ", err.Error()) } else if reply != utils.OK { - t.Errorf("Calling ApierV1.SetActionPlan received: %s", reply) + t.Errorf("Calling APIerSv1.SetActionPlan received: %s", reply) } - if err := cdrsOfflineRpc.Call(utils.ApierV2SetAccount, + if err := cdrsOfflineRpc.Call(utils.APIerSv2SetAccount, &AttrSetAccount{Tenant: "cgrates.org", Account: "test2", ActionPlanIDs: []string{"AP_TEST2"}, ReloadScheduler: true}, &reply); err != nil { t.Error(err) } else if reply != utils.OK { - t.Errorf("Calling ApierV2.SetAccount received: %s", reply) + t.Errorf("Calling APIerSv2.SetAccount received: %s", reply) } time.Sleep(50 * time.Millisecond) var acnt *engine.Account //verify if the third balance was added - if err := cdrsOfflineRpc.Call(utils.ApierV2GetAccount, + if err := cdrsOfflineRpc.Call(utils.APIerSv2GetAccount, &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "test2"}, &acnt); err != nil { t.Error(err) } else if acnt.BalanceMap[utils.MONETARY].Len() != 1 { @@ -264,13 +264,13 @@ func testV2CDRsOfflineExpiryBalance(t *testing.T) { attrsA := &utils.AttrSetActions{ActionsId: "ACT_LOG", Actions: []*utils.TPAction{ {Identifier: utils.LOG}, }} - if err := cdrsOfflineRpc.Call(utils.ApierV2SetActions, attrsA, &reply); err != nil && err.Error() != utils.ErrExists.Error() { - t.Error("Got error on ApierV2.SetActions: ", err.Error()) + if err := cdrsOfflineRpc.Call(utils.APIerSv2SetActions, attrsA, &reply); err != nil && err.Error() != utils.ErrExists.Error() { + t.Error("Got error on APIerSv2.SetActions: ", err.Error()) } else if reply != utils.OK { - t.Errorf("Calling ApierV2.SetActions received: %s", reply) + t.Errorf("Calling APIerSv2.SetActions received: %s", reply) } //make sure that the threshold don't exit - if err := cdrsOfflineRpc.Call(utils.ApierV1GetThresholdProfile, + if err := cdrsOfflineRpc.Call(utils.APIerSv1GetThresholdProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "THD_Test2"}, &thReply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) @@ -293,12 +293,12 @@ func testV2CDRsOfflineExpiryBalance(t *testing.T) { Async: false, }, } - if err := cdrsOfflineRpc.Call(utils.ApierV1SetThresholdProfile, tPrfl, &result); err != nil { + if err := cdrsOfflineRpc.Call(utils.APIerSv1SetThresholdProfile, tPrfl, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } - if err := cdrsOfflineRpc.Call(utils.ApierV1GetThresholdProfile, + if err := cdrsOfflineRpc.Call(utils.APIerSv1GetThresholdProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "THD_Test2"}, &thReply); err != nil { t.Error(err) } else if !reflect.DeepEqual(tPrfl.ThresholdProfile, thReply) { @@ -344,15 +344,15 @@ func testV2CDRsBalancesWithSameWeight(t *testing.T) { }, } var reply string - if err := cdrsOfflineRpc.Call(utils.ApierV2SetBalance, attrs, &reply); err != nil { + if err := cdrsOfflineRpc.Call(utils.APIerSv2SetBalance, attrs, &reply); err != nil { t.Fatal(err) } attrs.Balance[utils.ID] = "SpecialBalance2" - if err := cdrsOfflineRpc.Call(utils.ApierV2SetBalance, attrs, &reply); err != nil { + if err := cdrsOfflineRpc.Call(utils.APIerSv2SetBalance, attrs, &reply); err != nil { t.Fatal(err) } var acnt *engine.Account - if err := cdrsOfflineRpc.Call(utils.ApierV2GetAccount, + if err := cdrsOfflineRpc.Call(utils.APIerSv2GetAccount, &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "specialTest"}, &acnt); err != nil { t.Error(err) } else if len(acnt.BalanceMap) != 1 || len(acnt.BalanceMap[utils.MONETARY]) != 2 { diff --git a/apier/v2/tp_it_test.go b/apier/v2/tp_it_test.go index c806eb885..115bcbb2f 100644 --- a/apier/v2/tp_it_test.go +++ b/apier/v2/tp_it_test.go @@ -173,39 +173,39 @@ func testTPitTimings(t *testing.T) { // Test set var reply string for _, tm := range []*utils.ApierTPTiming{tmPeak, tmOffPeakMorning, tmOffPeakEvening, tmOffPeakWeekend, tmDummyRemove} { - if err := tpRPC.Call(utils.ApierV2SetTPTiming, tm, &reply); err != nil { - t.Error("Got error on ApierV2.SetTPTiming: ", err.Error()) + if err := tpRPC.Call(utils.APIerSv2SetTPTiming, tm, &reply); err != nil { + t.Error("Got error on APIerSv2.SetTPTiming: ", err.Error()) } else if reply != utils.OK { - t.Error("Unexpected reply received when calling ApierV2.SetTPTiming: ", reply) + t.Error("Unexpected reply received when calling APIerSv2.SetTPTiming: ", reply) } } // Test get var rplyTmDummy *utils.ApierTPTiming - if err := tpRPC.Call(utils.ApierV2GetTPTiming, v1.AttrGetTPTiming{tmDummyRemove.TPid, tmDummyRemove.ID}, &rplyTmDummy); err != nil { - t.Error("Calling ApierV2.GetTPTiming, got error: ", err.Error()) + if err := tpRPC.Call(utils.APIerSv2GetTPTiming, v1.AttrGetTPTiming{tmDummyRemove.TPid, tmDummyRemove.ID}, &rplyTmDummy); err != nil { + t.Error("Calling APIerSv2.GetTPTiming, got error: ", err.Error()) } else if !reflect.DeepEqual(tmDummyRemove, rplyTmDummy) { - t.Errorf("Calling ApierV2.GetTPTiming expected: %v, received: %v", tmDummyRemove, rplyTmDummy) + t.Errorf("Calling APIerSv2.GetTPTiming expected: %v, received: %v", tmDummyRemove, rplyTmDummy) } var rplyTmIDs []string expectedTmIDs := []string{"OFFPEAK_EVENING", "OFFPEAK_MORNING", "OFFPEAK_WEEKEND", "PEAK", tmDummyRemove.ID} - if err := tpRPC.Call(utils.ApierV1GetTPTimingIds, v1.AttrGetTPTimingIds{testTPid, utils.PaginatorWithSearch{}}, &rplyTmIDs); err != nil { - t.Error("Calling ApierV1.GetTPTimingIds, got error: ", err.Error()) + if err := tpRPC.Call(utils.APIerSv1GetTPTimingIds, v1.AttrGetTPTimingIds{testTPid, utils.PaginatorWithSearch{}}, &rplyTmIDs); err != nil { + t.Error("Calling APIerSv1.GetTPTimingIds, got error: ", err.Error()) } else if len(expectedTmIDs) != len(rplyTmIDs) { - t.Errorf("Calling ApierV1.GetTPTimingIds expected: %v, received: %v", expectedTmIDs, rplyTmIDs) + t.Errorf("Calling APIerSv1.GetTPTimingIds expected: %v, received: %v", expectedTmIDs, rplyTmIDs) } // Test remove - if err := tpRPC.Call(utils.ApierV2RemoveTPTiming, v1.AttrGetTPTiming{tmDummyRemove.TPid, tmDummyRemove.ID}, &reply); err != nil { - t.Error("Calling ApierV2.RemoveTPTiming, got error: ", err.Error()) + if err := tpRPC.Call(utils.APIerSv2RemoveTPTiming, v1.AttrGetTPTiming{tmDummyRemove.TPid, tmDummyRemove.ID}, &reply); err != nil { + t.Error("Calling APIerSv2.RemoveTPTiming, got error: ", err.Error()) } else if reply != utils.OK { - t.Error("Calling ApierV2.RemoveTPTiming received: ", reply) + t.Error("Calling APIerSv2.RemoveTPTiming received: ", reply) } // Test getIds rplyTmIDs = []string{} expectedTmIDs = []string{"OFFPEAK_EVENING", "OFFPEAK_MORNING", "OFFPEAK_WEEKEND", "PEAK"} - if err := tpRPC.Call(utils.ApierV1GetTPTimingIds, v1.AttrGetTPTimingIds{testTPid, utils.PaginatorWithSearch{}}, &rplyTmIDs); err != nil { - t.Error("Calling ApierV1.GetTPTimingIds, got error: ", err.Error()) + if err := tpRPC.Call(utils.APIerSv1GetTPTimingIds, v1.AttrGetTPTimingIds{testTPid, utils.PaginatorWithSearch{}}, &rplyTmIDs); err != nil { + t.Error("Calling APIerSv1.GetTPTimingIds, got error: ", err.Error()) } else if len(expectedTmIDs) != len(rplyTmIDs) { - t.Errorf("Calling ApierV1.GetTPTimingIds expected: %v, received: %v", expectedTmIDs, rplyTmIDs) + t.Errorf("Calling APIerSv1.GetTPTimingIds expected: %v, received: %v", expectedTmIDs, rplyTmIDs) } } @@ -225,21 +225,21 @@ func testTPitDestinations(t *testing.T) { dstDEMobile := &utils.TPDestination{TPid: testTPid, ID: "DST_DE_MOBILE", Prefixes: []string{"+49151", "+49161", "+49171"}} dstDUMMY := &utils.TPDestination{TPid: testTPid, ID: "DUMMY_REMOVE", Prefixes: []string{"999"}} for _, dst := range []*utils.TPDestination{dst1002, dst1003, dst1007, dstFS, dstDEMobile, dstDUMMY} { - if err := tpRPC.Call(utils.ApierV2SetTPDestination, dst, &reply); err != nil { - t.Error("Got error on ApierV2.SetTPDestination: ", err.Error()) + if err := tpRPC.Call(utils.APIerSv2SetTPDestination, dst, &reply); err != nil { + t.Error("Got error on APIerSv2.SetTPDestination: ", err.Error()) } else if reply != utils.OK { - t.Error("Unexpected reply received when calling ApierV2.SetTPDestination: ", reply) + t.Error("Unexpected reply received when calling APIerSv2.SetTPDestination: ", reply) } } // Test get var rplyDst *utils.TPDestination - if err := tpRPC.Call(utils.ApierV2GetTPDestination, AttrGetTPDestination{testTPid, dstDEMobile.ID}, &rplyDst); err != nil { - t.Error("Calling ApierV2.GetTPDestination, got error: ", err.Error()) + if err := tpRPC.Call(utils.APIerSv2GetTPDestination, AttrGetTPDestination{testTPid, dstDEMobile.ID}, &rplyDst); err != nil { + t.Error("Calling APIerSv2.GetTPDestination, got error: ", err.Error()) } else if len(dstDEMobile.Prefixes) != len(rplyDst.Prefixes) { - t.Errorf("Calling ApierV2.GetTPDestination expected: %v, received: %v", dstDEMobile, rplyDst) + t.Errorf("Calling APIerSv2.GetTPDestination expected: %v, received: %v", dstDEMobile, rplyDst) } // Test remove - if err := tpRPC.Call(utils.ApierV2RemoveTPDestination, AttrGetTPDestination{testTPid, dstDUMMY.ID}, &reply); err != nil { + if err := tpRPC.Call(utils.APIerSv2RemoveTPDestination, AttrGetTPDestination{testTPid, dstDUMMY.ID}, &reply); err != nil { t.Error(err) } else if reply != utils.OK { t.Error("Received: ", reply) @@ -247,10 +247,10 @@ func testTPitDestinations(t *testing.T) { // Test getIds var rplyDstIds []string expectedDstIds := []string{"DST_1002", "DST_1003", "DST_1007", "DST_DE_MOBILE", "DST_FS"} - if err := tpRPC.Call(utils.ApierV2GetTPDestinationIDs, v1.AttrGetTPDestinationIds{TPid: testTPid}, &rplyDstIds); err != nil { - t.Error("Calling ApierV1.GetTPDestinationIDs, got error: ", err.Error()) + if err := tpRPC.Call(utils.APIerSv2GetTPDestinationIDs, v1.AttrGetTPDestinationIds{TPid: testTPid}, &rplyDstIds); err != nil { + t.Error("Calling APIerSv1.GetTPDestinationIDs, got error: ", err.Error()) } else if len(expectedDstIds) != len(rplyDstIds) { - t.Errorf("Calling ApierV2.GetTPDestinationIDs expected: %v, received: %v", expectedDstIds, rplyDstIds) + t.Errorf("Calling APIerSv2.GetTPDestinationIDs expected: %v, received: %v", expectedDstIds, rplyDstIds) } } diff --git a/apier/v2/tpdestinations.go b/apier/v2/tpdestinations.go index b37b6bc70..a4c7f5ecf 100644 --- a/apier/v2/tpdestinations.go +++ b/apier/v2/tpdestinations.go @@ -23,7 +23,7 @@ import ( ) // Creates a new destination within a tariff plan -func (self *ApierV2) SetTPDestination(attrs utils.TPDestination, reply *string) error { +func (self *APIerSv2) SetTPDestination(attrs utils.TPDestination, reply *string) error { if missing := utils.MissingStructFields(&attrs, []string{"TPid", "Tag", "Prefixes"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } @@ -40,7 +40,7 @@ type AttrGetTPDestination struct { } // Queries a specific destination -func (self *ApierV2) GetTPDestination(attrs AttrGetTPDestination, reply *utils.TPDestination) error { +func (self *APIerSv2) GetTPDestination(attrs AttrGetTPDestination, reply *utils.TPDestination) error { if missing := utils.MissingStructFields(&attrs, []string{"TPid", "Tag"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } @@ -54,7 +54,7 @@ func (self *ApierV2) GetTPDestination(attrs AttrGetTPDestination, reply *utils.T return nil } -func (self *ApierV2) RemoveTPDestination(attrs AttrGetTPDestination, reply *string) error { +func (self *APIerSv2) RemoveTPDestination(attrs AttrGetTPDestination, reply *string) error { if missing := utils.MissingStructFields(&attrs, []string{"TPid", "Tag"}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } diff --git a/cmd/cgr-engine/cgr-engine.go b/cmd/cgr-engine/cgr-engine.go index abbee5cde..150a3b9ba 100644 --- a/cmd/cgr-engine/cgr-engine.go +++ b/cmd/cgr-engine/cgr-engine.go @@ -409,15 +409,15 @@ func main() { internalSchedulerSChan := make(chan rpcclient.ClientConnector, 1) internalRALsChan := make(chan rpcclient.ClientConnector, 1) internalResponderChan := make(chan rpcclient.ClientConnector, 1) - internalAPIerV1Chan := make(chan rpcclient.ClientConnector, 1) - internalAPIerV2Chan := make(chan rpcclient.ClientConnector, 1) + internalAPIerSv1Chan := make(chan rpcclient.ClientConnector, 1) + internalAPIerSv2Chan := make(chan rpcclient.ClientConnector, 1) internalLoaderSChan := make(chan rpcclient.ClientConnector, 1) // initialize the connManager before creating the DMService // because we need to pass the connection to it connManager := engine.NewConnManager(cfg, map[string]chan rpcclient.ClientConnector{ utils.ConcatenatedKey(utils.MetaInternal, utils.MetaAnalyzer): internalAnalyzerSChan, - utils.ConcatenatedKey(utils.MetaInternal, utils.MetaApier): internalAPIerV1Chan, + utils.ConcatenatedKey(utils.MetaInternal, utils.MetaApier): internalAPIerSv1Chan, utils.ConcatenatedKey(utils.MetaInternal, utils.MetaAttributes): internalAttributeSChan, utils.ConcatenatedKey(utils.MetaInternal, utils.MetaCaches): internalCacheSChan, utils.ConcatenatedKey(utils.MetaInternal, utils.MetaCDRs): internalCDRServerChan, @@ -490,10 +490,10 @@ func main() { internalRALsChan, internalResponderChan, exitChan, connManager) - apierV1 := services.NewApierV1Service(cfg, dmService, storDBService, filterSChan, server, schS, rals.GetResponderService(), - internalAPIerV1Chan, connManager) + APIerSv1 := services.NewAPIerSv1Service(cfg, dmService, storDBService, filterSChan, server, schS, rals.GetResponderService(), + internalAPIerSv1Chan, connManager) - apierV2 := services.NewApierV2Service(apierV1, cfg, server, internalAPIerV2Chan) + APIerSv2 := services.NewAPIerSv2Service(APIerSv1, cfg, server, internalAPIerSv2Chan) cdrS := services.NewCDRServer(cfg, dmService, storDBService, filterSChan, server, internalCDRServerChan, connManager) @@ -505,7 +505,7 @@ func main() { anz := services.NewAnalyzerService(cfg, server, exitChan, internalAnalyzerSChan) srvManager.AddServices(attrS, chrS, tS, stS, reS, supS, schS, rals, - rals.GetResponder(), apierV1, apierV2, cdrS, smg, + rals.GetResponder(), APIerSv1, APIerSv2, cdrS, smg, services.NewEventReaderService(cfg, filterSChan, exitChan, connManager), services.NewDNSAgent(cfg, filterSChan, exitChan, connManager), services.NewFreeswitchAgent(cfg, exitChan, connManager), @@ -527,8 +527,8 @@ func main() { engine.IntRPC = engine.NewRPCClientSet() if cfg.DispatcherSCfg().Enabled { engine.IntRPC.AddInternalRPCClient(utils.AnalyzerSv1, anz.GetIntenternalChan()) - engine.IntRPC.AddInternalRPCClient(utils.ApierV1, apierV1.GetIntenternalChan()) - engine.IntRPC.AddInternalRPCClient(utils.ApierV2, apierV2.GetIntenternalChan()) + engine.IntRPC.AddInternalRPCClient(utils.APIerSv1, APIerSv1.GetIntenternalChan()) + engine.IntRPC.AddInternalRPCClient(utils.APIerSv2, APIerSv2.GetIntenternalChan()) engine.IntRPC.AddInternalRPCClient(utils.AttributeSv1, attrS.GetIntenternalChan()) engine.IntRPC.AddInternalRPCClient(utils.CacheSv1, internalCacheSChan) engine.IntRPC.AddInternalRPCClient(utils.CDRsV1, cdrS.GetIntenternalChan()) diff --git a/cmd/cgr-tester/parallel/parallel.go b/cmd/cgr-tester/parallel/parallel.go index 1e83d902a..e63746b61 100644 --- a/cmd/cgr-tester/parallel/parallel.go +++ b/cmd/cgr-tester/parallel/parallel.go @@ -35,7 +35,7 @@ func main() { for i := 1; i < 1002; i++ { go func(index int) { wg.Add(1) - resp, err := http.Post("http://localhost:2080/jsonrpc", "application/json", bytes.NewBuffer([]byte(fmt.Sprintf(`{"method": "ApierV1.SetAccount","params": [{"Tenant":"reglo","Account":"100%d","ActionPlanId":"PACKAGE_NEW_FOR795", "ReloadScheduler":false}], "id":%d}`, index, index)))) + resp, err := http.Post("http://localhost:2080/jsonrpc", "application/json", bytes.NewBuffer([]byte(fmt.Sprintf(`{"method": "APIerSv1.SetAccount","params": [{"Tenant":"reglo","Account":"100%d","ActionPlanId":"PACKAGE_NEW_FOR795", "ReloadScheduler":false}], "id":%d}`, index, index)))) if err != nil { log.Print("Post error: ", err) } @@ -49,7 +49,7 @@ func main() { } wg.Wait() for index := 1; index < 1002; index++ { - resp, err := http.Post("http://localhost:2080/jsonrpc", "application/json", bytes.NewBuffer([]byte(fmt.Sprintf(`{"method": "%s","params": [{"Tenant":"reglo","Account":"100%d"}], "id":%d}`, utils.ApierV1GetAccountActionPlan, index, index)))) + resp, err := http.Post("http://localhost:2080/jsonrpc", "application/json", bytes.NewBuffer([]byte(fmt.Sprintf(`{"method": "%s","params": [{"Tenant":"reglo","Account":"100%d"}], "id":%d}`, utils.APIerSv1GetAccountActionPlan, index, index)))) if err != nil { log.Print("Post error: ", err) } diff --git a/config/configsanity.go b/config/configsanity.go index 502ae3881..6f93aff30 100644 --- a/config/configsanity.go +++ b/config/configsanity.go @@ -462,18 +462,18 @@ func (cfg *CGRConfig) checkConfigSanity() error { // APIer sanity checks for _, connID := range cfg.apier.AttributeSConns { if strings.HasPrefix(connID, utils.MetaInternal) && !cfg.attributeSCfg.Enabled { - return fmt.Errorf("<%s> not enabled but requested by <%s> component.", utils.AttributeS, utils.ApierV1) + return fmt.Errorf("<%s> not enabled but requested by <%s> component.", utils.AttributeS, utils.APIerSv1) } if _, has := cfg.rpcConns[connID]; !has && !strings.HasPrefix(connID, utils.MetaInternal) { - return fmt.Errorf("<%s> connection with id: <%s> not defined", utils.ApierV1, connID) + return fmt.Errorf("<%s> connection with id: <%s> not defined", utils.APIerSv1, connID) } } for _, connID := range cfg.apier.SchedulerConns { if strings.HasPrefix(connID, utils.MetaInternal) && !cfg.schedulerCfg.Enabled { - return fmt.Errorf("<%s> not enabled but requested by <%s> component.", utils.SchedulerS, utils.ApierV1) + return fmt.Errorf("<%s> not enabled but requested by <%s> component.", utils.SchedulerS, utils.APIerSv1) } if _, has := cfg.rpcConns[connID]; !has && !strings.HasPrefix(connID, utils.MetaInternal) { - return fmt.Errorf("<%s> connection with id: <%s> not defined", utils.ApierV1, connID) + return fmt.Errorf("<%s> connection with id: <%s> not defined", utils.APIerSv1, connID) } } // Dispatcher sanity check diff --git a/config/configsanity_test.go b/config/configsanity_test.go index 108811dc4..98333f4fe 100644 --- a/config/configsanity_test.go +++ b/config/configsanity_test.go @@ -794,11 +794,11 @@ func TestConfigSanityAPIer(t *testing.T) { cfg, _ = NewDefaultCGRConfig() cfg.apier.AttributeSConns = []string{utils.MetaInternal} - if err := cfg.checkConfigSanity(); err == nil || err.Error() != " not enabled but requested by component." { + if err := cfg.checkConfigSanity(); err == nil || err.Error() != " not enabled but requested by component." { t.Error(err) } cfg.apier.AttributeSConns = []string{"test"} - expected := " connection with id: not defined" + expected := " connection with id: not defined" if err := cfg.checkConfigSanity(); err == nil || err.Error() != expected { t.Errorf("Expecting: %+q received: %+q", expected, err) } @@ -806,11 +806,11 @@ func TestConfigSanityAPIer(t *testing.T) { cfg.attributeSCfg.Enabled = true cfg.apier.SchedulerConns = []string{utils.MetaInternal} - if err := cfg.checkConfigSanity(); err == nil || err.Error() != " not enabled but requested by component." { + if err := cfg.checkConfigSanity(); err == nil || err.Error() != " not enabled but requested by component." { t.Error(err) } cfg.apier.SchedulerConns = []string{"test"} - expected = " connection with id: not defined" + expected = " connection with id: not defined" if err := cfg.checkConfigSanity(); err == nil || err.Error() != expected { t.Errorf("Expecting: %+q received: %+q", expected, err) } diff --git a/console/account_actionplan_get.go b/console/account_actionplan_get.go index cfdfdefab..b22a27f68 100644 --- a/console/account_actionplan_get.go +++ b/console/account_actionplan_get.go @@ -26,7 +26,7 @@ import ( func init() { c := &CmdGetAccountActionPlan{ name: "account_actionplan_get", - rpcMethod: utils.ApierV1GetAccountActionPlan, + rpcMethod: utils.APIerSv1GetAccountActionPlan, rpcParams: &utils.TenantAccount{}, } commands[c.Name()] = c diff --git a/console/account_remove.go b/console/account_remove.go index dfb7520d6..38ddc0274 100644 --- a/console/account_remove.go +++ b/console/account_remove.go @@ -23,7 +23,7 @@ import "github.com/cgrates/cgrates/utils" func init() { c := &CmdRemoveAccount{ name: "account_remove", - rpcMethod: utils.ApierV1RemoveAccount, + rpcMethod: utils.APIerSv1RemoveAccount, } commands[c.Name()] = c c.CommandExecuter = &CommandExecuter{c} diff --git a/console/account_set.go b/console/account_set.go index 0e2f9d1a0..a825afb33 100644 --- a/console/account_set.go +++ b/console/account_set.go @@ -26,7 +26,7 @@ import ( func init() { c := &CmdAddAccount{ name: "account_set", - rpcMethod: utils.ApierV2SetAccount, + rpcMethod: utils.APIerSv2SetAccount, } commands[c.Name()] = c c.CommandExecuter = &CommandExecuter{c} diff --git a/console/account_trigger_add.go b/console/account_trigger_add.go index 3176200d0..152d3a6f1 100644 --- a/console/account_trigger_add.go +++ b/console/account_trigger_add.go @@ -26,7 +26,7 @@ import ( func init() { c := &CmdAccountAddTriggers{ name: "account_triggers_add", - rpcMethod: utils.ApierV1AddAccountActionTriggers, + rpcMethod: utils.APIerSv1AddAccountActionTriggers, rpcParams: &v1.AttrAddAccountActionTriggers{}, } commands[c.Name()] = c diff --git a/console/account_trigger_remove.go b/console/account_trigger_remove.go index 6e3367026..0b3277320 100644 --- a/console/account_trigger_remove.go +++ b/console/account_trigger_remove.go @@ -26,7 +26,7 @@ import ( func init() { c := &CmdAccountRemoveTriggers{ name: "account_triggers_remove", - rpcMethod: utils.ApierV1RemoveAccountActionTriggers, + rpcMethod: utils.APIerSv1RemoveAccountActionTriggers, rpcParams: &v1.AttrRemoveAccountActionTriggers{}, } commands[c.Name()] = c diff --git a/console/account_trigger_reset.go b/console/account_trigger_reset.go index d8235965b..8e9ac9d72 100644 --- a/console/account_trigger_reset.go +++ b/console/account_trigger_reset.go @@ -26,7 +26,7 @@ import ( func init() { c := &CmdAccountResetTriggers{ name: "account_triggers_reset", - rpcMethod: utils.ApierV1ResetAccountActionTriggers, + rpcMethod: utils.APIerSv1ResetAccountActionTriggers, rpcParams: &v1.AttrRemoveAccountActionTriggers{}, } commands[c.Name()] = c diff --git a/console/account_trigger_set.go b/console/account_trigger_set.go index e6b85d315..97f5df218 100644 --- a/console/account_trigger_set.go +++ b/console/account_trigger_set.go @@ -26,7 +26,7 @@ import ( func init() { c := &CmdAccountSetTriggers{ name: "account_triggers_set", - rpcMethod: utils.ApierV1SetAccountActionTriggers, + rpcMethod: utils.APIerSv1SetAccountActionTriggers, rpcParams: &v1.AttrSetAccountActionTriggers{}, } commands[c.Name()] = c diff --git a/console/accounts.go b/console/accounts.go index 7e00070b6..3419aa12b 100644 --- a/console/accounts.go +++ b/console/accounts.go @@ -26,7 +26,7 @@ import ( func init() { c := &CmdGetAccounts{ name: "accounts", - rpcMethod: utils.ApierV2GetAccounts, + rpcMethod: utils.APIerSv2GetAccounts, rpcParams: &utils.AttrGetAccounts{}, } commands[c.Name()] = c diff --git a/console/action_execute.go b/console/action_execute.go index 98d6845a1..e9d997c41 100644 --- a/console/action_execute.go +++ b/console/action_execute.go @@ -25,7 +25,7 @@ import ( func init() { c := &CmdExecuteAction{ name: "action_execute", - rpcMethod: utils.ApierV1ExecuteAction, + rpcMethod: utils.APIerSv1ExecuteAction, rpcParams: &utils.AttrExecuteAction{}, } commands[c.Name()] = c diff --git a/console/actionplan_get.go b/console/actionplan_get.go index 533f78458..9d8c90b81 100644 --- a/console/actionplan_get.go +++ b/console/actionplan_get.go @@ -27,7 +27,7 @@ import ( func init() { c := &CmdGetActionPlan{ name: "actionplan_get", - rpcMethod: utils.ApierV1GetActionPlan, + rpcMethod: utils.APIerSv1GetActionPlan, rpcParams: &v1.AttrGetActionPlan{}, } commands[c.Name()] = c diff --git a/console/actionplan_remove.go b/console/actionplan_remove.go index 99db10c00..3a38c33aa 100644 --- a/console/actionplan_remove.go +++ b/console/actionplan_remove.go @@ -26,7 +26,7 @@ import ( func init() { c := &CmdRemoveActionPlan{ name: "actionplan_remove", - rpcMethod: utils.ApierV1RemoveActionPlan, + rpcMethod: utils.APIerSv1RemoveActionPlan, rpcParams: &v1.AttrGetActionPlan{}, } commands[c.Name()] = c diff --git a/console/actionplan_set.go b/console/actionplan_set.go index 5258342a7..c67550633 100644 --- a/console/actionplan_set.go +++ b/console/actionplan_set.go @@ -26,7 +26,7 @@ import ( func init() { c := &CmdSetActionPlan{ name: "actionplan_set", - rpcMethod: utils.ApierV1SetActionPlan, + rpcMethod: utils.APIerSv1SetActionPlan, rpcParams: &v1.AttrSetActionPlan{}, } commands[c.Name()] = c diff --git a/console/actions.go b/console/actions.go index 9cf8d8cbb..2765a5c28 100644 --- a/console/actions.go +++ b/console/actions.go @@ -27,7 +27,7 @@ import ( func init() { c := &CmdGetActions{ name: "actions", - rpcMethod: utils.ApierV2GetActions, + rpcMethod: utils.APIerSv2GetActions, } commands[c.Name()] = c c.CommandExecuter = &CommandExecuter{c} diff --git a/console/actions_remove.go b/console/actions_remove.go index ca9b730ac..a0a0d8348 100644 --- a/console/actions_remove.go +++ b/console/actions_remove.go @@ -26,7 +26,7 @@ import ( func init() { c := &CmdRemoveActions{ name: "actions_remove", - rpcMethod: utils.ApierV1RemoveActions, + rpcMethod: utils.APIerSv1RemoveActions, } commands[c.Name()] = c c.CommandExecuter = &CommandExecuter{c} diff --git a/console/attributes.go b/console/attributes.go index 36c41e135..39690f745 100644 --- a/console/attributes.go +++ b/console/attributes.go @@ -26,7 +26,7 @@ import ( func init() { c := &CmdGetAttributes{ name: "attributes", - rpcMethod: utils.ApierV1GetAttributeProfile, + rpcMethod: utils.APIerSv1GetAttributeProfile, rpcParams: &utils.TenantID{}, } commands[c.Name()] = c diff --git a/console/attributes_ids.go b/console/attributes_ids.go index 2b2ec9266..4d3f01e54 100644 --- a/console/attributes_ids.go +++ b/console/attributes_ids.go @@ -25,7 +25,7 @@ import ( func init() { c := &CmdGetAttributeIDs{ name: "attribute_ids", - rpcMethod: utils.ApierV1GetAttributeProfileIDs, + rpcMethod: utils.APIerSv1GetAttributeProfileIDs, rpcParams: &utils.TenantArgWithPaginator{}, } commands[c.Name()] = c diff --git a/console/attributes_remove.go b/console/attributes_remove.go index e1114e3b1..ace8a8701 100644 --- a/console/attributes_remove.go +++ b/console/attributes_remove.go @@ -23,7 +23,7 @@ import "github.com/cgrates/cgrates/utils" func init() { c := &CmdRemoveAttributes{ name: "attributes_remove", - rpcMethod: utils.ApierV1RemoveAttributeProfile, + rpcMethod: utils.APIerSv1RemoveAttributeProfile, rpcParams: &utils.TenantIDWithCache{}, } commands[c.Name()] = c diff --git a/console/attributes_set.go b/console/attributes_set.go index e1fe3da6e..5d4f7c179 100644 --- a/console/attributes_set.go +++ b/console/attributes_set.go @@ -27,7 +27,7 @@ import ( func init() { c := &CmdSetAttributes{ name: "attributes_set", - rpcMethod: utils.ApierV2SetAttributeProfile, + rpcMethod: utils.APIerSv2SetAttributeProfile, rpcParams: &v2.AttributeWithCache{}, } commands[c.Name()] = c diff --git a/console/balance_add.go b/console/balance_add.go index 8fc6c4260..141b795d4 100644 --- a/console/balance_add.go +++ b/console/balance_add.go @@ -26,7 +26,7 @@ import ( func init() { c := &CmdAddBalance{ name: "balance_add", - rpcMethod: utils.ApierV1AddBalance, + rpcMethod: utils.APIerSv1AddBalance, } commands[c.Name()] = c c.CommandExecuter = &CommandExecuter{c} diff --git a/console/balance_debit.go b/console/balance_debit.go index 5890e866b..8e025e983 100644 --- a/console/balance_debit.go +++ b/console/balance_debit.go @@ -26,7 +26,7 @@ import ( func init() { c := &CmdBalanceDebit{ name: "balance_debit", - rpcMethod: utils.ApierV1DebitBalance, + rpcMethod: utils.APIerSv1DebitBalance, } commands[c.Name()] = c c.CommandExecuter = &CommandExecuter{c} diff --git a/console/balance_remove.go b/console/balance_remove.go index 5ee5565e3..df02a5367 100644 --- a/console/balance_remove.go +++ b/console/balance_remove.go @@ -26,7 +26,7 @@ import ( func init() { c := &CmdRemoveBalance{ name: "balance_remove", - rpcMethod: utils.ApierV1RemoveBalances, + rpcMethod: utils.APIerSv1RemoveBalances, } commands[c.Name()] = c c.CommandExecuter = &CommandExecuter{c} diff --git a/console/balance_set.go b/console/balance_set.go index b2ba51a3d..fa2d5e1e6 100644 --- a/console/balance_set.go +++ b/console/balance_set.go @@ -25,7 +25,7 @@ import ( func init() { c := &CmdSetBalance{ name: "balance_set", - rpcMethod: utils.ApierV1SetBalance, + rpcMethod: utils.APIerSv1SetBalance, } commands[c.Name()] = c c.CommandExecuter = &CommandExecuter{c} diff --git a/console/cdre_config_reload.go b/console/cdre_config_reload.go index 69adb901d..40638a194 100644 --- a/console/cdre_config_reload.go +++ b/console/cdre_config_reload.go @@ -26,7 +26,7 @@ import ( func init() { c := &CmdCdreConfigReload{ name: "cdre_config_reload", - rpcMethod: utils.ApierV1ReloadCdreConfig, + rpcMethod: utils.APIerSv1ReloadCdreConfig, } commands[c.Name()] = c c.CommandExecuter = &CommandExecuter{c} diff --git a/console/cdrs_export.go b/console/cdrs_export.go index fbd438d3c..12870cf78 100644 --- a/console/cdrs_export.go +++ b/console/cdrs_export.go @@ -26,7 +26,7 @@ import ( func init() { c := &CmdExportCdrs{ name: "cdrs_export", - rpcMethod: utils.ApierV1ExportCDRs, + rpcMethod: utils.APIerSv1ExportCDRs, } commands[c.Name()] = c c.CommandExecuter = &CommandExecuter{c} diff --git a/console/charger_ids.go b/console/charger_ids.go index 3109257dc..4d036749c 100644 --- a/console/charger_ids.go +++ b/console/charger_ids.go @@ -25,7 +25,7 @@ import ( func init() { c := &CmdGetChargerIDs{ name: "chargers_ids", - rpcMethod: utils.ApierV1GetChargerProfileIDs, + rpcMethod: utils.APIerSv1GetChargerProfileIDs, rpcParams: &utils.TenantArgWithPaginator{}, } commands[c.Name()] = c diff --git a/console/chargers.go b/console/chargers.go index c889387ad..112e09151 100644 --- a/console/chargers.go +++ b/console/chargers.go @@ -26,7 +26,7 @@ import ( func init() { c := &CmdGetChargers{ name: "chargers", - rpcMethod: utils.ApierV1GetChargerProfile, + rpcMethod: utils.APIerSv1GetChargerProfile, rpcParams: &utils.TenantID{}, } commands[c.Name()] = c diff --git a/console/chargers_remove.go b/console/chargers_remove.go index 5c0139bde..9a7c75887 100644 --- a/console/chargers_remove.go +++ b/console/chargers_remove.go @@ -23,7 +23,7 @@ import "github.com/cgrates/cgrates/utils" func init() { c := &CmdRemoveChargers{ name: "chargers_remove", - rpcMethod: utils.ApierV1RemoveChargerProfile, + rpcMethod: utils.APIerSv1RemoveChargerProfile, rpcParams: &utils.TenantID{}, } commands[c.Name()] = c diff --git a/console/chargers_set.go b/console/chargers_set.go index 43208234e..a6a19a9fb 100644 --- a/console/chargers_set.go +++ b/console/chargers_set.go @@ -27,7 +27,7 @@ import ( func init() { c := &CmdSetChargers{ name: "chargers_set", - rpcMethod: utils.ApierV1SetChargerProfile, + rpcMethod: utils.APIerSv1SetChargerProfile, rpcParams: &v1.ChargerWithCache{}, } commands[c.Name()] = c diff --git a/console/compute_actionplan_indexes.go b/console/compute_actionplan_indexes.go index 35c4423cd..e77a870aa 100644 --- a/console/compute_actionplan_indexes.go +++ b/console/compute_actionplan_indexes.go @@ -25,7 +25,7 @@ import ( func init() { c := &CmdComputeActionPlanIndexes{ name: "compute_actionplan_indexes", - rpcMethod: utils.ApierV1ComputeActionPlanIndexes, + rpcMethod: utils.APIerSv1ComputeActionPlanIndexes, rpcParams: new(EmptyWrapper), } commands[c.Name()] = c diff --git a/console/compute_filter_indexes.go b/console/compute_filter_indexes.go index 2afe2cd74..91e3f6f67 100644 --- a/console/compute_filter_indexes.go +++ b/console/compute_filter_indexes.go @@ -25,7 +25,7 @@ import ( func init() { c := &CmdComputeFilterIndexes{ name: "compute_filter_indexes", - rpcMethod: "ApierV1.ComputeFilterIndexes", + rpcMethod: "APIerSv1.ComputeFilterIndexes", } commands[c.Name()] = c c.CommandExecuter = &CommandExecuter{c} diff --git a/console/cost.go b/console/cost.go index 3da0df073..94b075da0 100644 --- a/console/cost.go +++ b/console/cost.go @@ -27,7 +27,7 @@ import ( func init() { c := &CmdGetCost{ name: "cost", - rpcMethod: utils.ApierV1GetCost, + rpcMethod: utils.APIerSv1GetCost, clientArgs: []string{"Tenant", "Category", "Subject", "AnswerTime", "Destination", "Usage"}, rpcParams: &v1.AttrGetCost{}, } diff --git a/console/cost_details.go b/console/cost_details.go index 242098159..90f065f06 100644 --- a/console/cost_details.go +++ b/console/cost_details.go @@ -26,7 +26,7 @@ import ( func init() { c := &CmdGetCostDetails{ name: "cost_details", - rpcMethod: utils.ApierV1GetEventCost, + rpcMethod: utils.APIerSv1GetEventCost, } commands[c.Name()] = c c.CommandExecuter = &CommandExecuter{c} diff --git a/console/datacost.go b/console/datacost.go index 5da56951a..01352497e 100644 --- a/console/datacost.go +++ b/console/datacost.go @@ -27,7 +27,7 @@ import ( func init() { c := &CmdGetDataCost{ name: "datacost", - rpcMethod: utils.ApierV1GetDataCost, + rpcMethod: utils.APIerSv1GetDataCost, clientArgs: []string{"Category", "Tenant", "Account", "Subject", "StartTime", "Usage"}, } commands[c.Name()] = c diff --git a/console/datadb_versions.go b/console/datadb_versions.go index 4626a35e4..acea92b68 100644 --- a/console/datadb_versions.go +++ b/console/datadb_versions.go @@ -26,7 +26,7 @@ import ( func init() { c := &CmdGetDataDBVersions{ name: "datadb_versions", - rpcMethod: utils.ApierV1GetDataDBVersions, + rpcMethod: utils.APIerSv1GetDataDBVersions, } commands[c.Name()] = c c.CommandExecuter = &CommandExecuter{c} diff --git a/console/destination_set.go b/console/destination_set.go index 2b4181e06..88f457467 100644 --- a/console/destination_set.go +++ b/console/destination_set.go @@ -23,7 +23,7 @@ import "github.com/cgrates/cgrates/utils" func init() { c := &CmdSetDestination{ name: "destination_set", - rpcMethod: utils.ApierV1SetDestination, + rpcMethod: utils.APIerSv1SetDestination, } commands[c.Name()] = c c.CommandExecuter = &CommandExecuter{c} diff --git a/console/destinations.go b/console/destinations.go index 56e881798..7fab9e81c 100644 --- a/console/destinations.go +++ b/console/destinations.go @@ -27,7 +27,7 @@ import ( func init() { c := &CmdGetDestination{ name: "destinations", - rpcMethod: utils.ApierV2GetDestinations, + rpcMethod: utils.APIerSv2GetDestinations, } commands[c.Name()] = c c.CommandExecuter = &CommandExecuter{c} diff --git a/console/dispatcher_host.go b/console/dispatcher_host.go index f3e62dea3..f491cf07c 100644 --- a/console/dispatcher_host.go +++ b/console/dispatcher_host.go @@ -26,7 +26,7 @@ import ( func init() { c := &CmdGetDispatcherHost{ name: "dispatcher_host", - rpcMethod: utils.ApierV1GetDispatcherHost, + rpcMethod: utils.APIerSv1GetDispatcherHost, } commands[c.Name()] = c c.CommandExecuter = &CommandExecuter{c} diff --git a/console/dispatcher_host_ids.go b/console/dispatcher_host_ids.go index ba7d849b3..650255563 100644 --- a/console/dispatcher_host_ids.go +++ b/console/dispatcher_host_ids.go @@ -25,7 +25,7 @@ import ( func init() { c := &CmdGetDispatcherHostIDs{ name: "dispatcher_host_ids", - rpcMethod: utils.ApierV1GetDispatcherHostIDs, + rpcMethod: utils.APIerSv1GetDispatcherHostIDs, } commands[c.Name()] = c c.CommandExecuter = &CommandExecuter{c} diff --git a/console/dispatcher_host_remove.go b/console/dispatcher_host_remove.go index 457eb0845..e90668043 100644 --- a/console/dispatcher_host_remove.go +++ b/console/dispatcher_host_remove.go @@ -25,7 +25,7 @@ import ( func init() { c := &CmdRemoveDispatcherHost{ name: "dispatcher_host_remove", - rpcMethod: utils.ApierV1RemoveDispatcherHost, + rpcMethod: utils.APIerSv1RemoveDispatcherHost, } commands[c.Name()] = c c.CommandExecuter = &CommandExecuter{c} diff --git a/console/dispatcher_host_set.go b/console/dispatcher_host_set.go index 709ed4018..a88f34914 100644 --- a/console/dispatcher_host_set.go +++ b/console/dispatcher_host_set.go @@ -26,7 +26,7 @@ import ( func init() { c := &CmdSetDispatcherHost{ name: "dispatcher_host_set", - rpcMethod: utils.ApierV1SetDispatcherHost, + rpcMethod: utils.APIerSv1SetDispatcherHost, } commands[c.Name()] = c c.CommandExecuter = &CommandExecuter{c} diff --git a/console/dispatcherprofile_get.go b/console/dispatcherprofile_get.go index 79b53020a..2e9374e04 100644 --- a/console/dispatcherprofile_get.go +++ b/console/dispatcherprofile_get.go @@ -26,7 +26,7 @@ import ( func init() { c := &CmdGetDispatcherProfile{ name: "dispatcherprofile_get", - rpcMethod: utils.ApierV1GetDispatcherProfile, + rpcMethod: utils.APIerSv1GetDispatcherProfile, } commands[c.Name()] = c c.CommandExecuter = &CommandExecuter{c} diff --git a/console/dispatcherprofile_ids.go b/console/dispatcherprofile_ids.go index 60ffc6165..bfbcb4bcf 100644 --- a/console/dispatcherprofile_ids.go +++ b/console/dispatcherprofile_ids.go @@ -25,7 +25,7 @@ import ( func init() { c := &CmdGetDispatcherProfileIDs{ name: "dispatcherprofile_ids", - rpcMethod: utils.ApierV1GetDispatcherProfileIDs, + rpcMethod: utils.APIerSv1GetDispatcherProfileIDs, } commands[c.Name()] = c c.CommandExecuter = &CommandExecuter{c} diff --git a/console/dispatcherprofile_remove.go b/console/dispatcherprofile_remove.go index 09bdeaa7a..988055151 100644 --- a/console/dispatcherprofile_remove.go +++ b/console/dispatcherprofile_remove.go @@ -25,7 +25,7 @@ import ( func init() { c := &CmdRemoveDispatcherProfile{ name: "dispatcherprofile_remove", - rpcMethod: utils.ApierV1RemoveDispatcherProfile, + rpcMethod: utils.APIerSv1RemoveDispatcherProfile, } commands[c.Name()] = c c.CommandExecuter = &CommandExecuter{c} diff --git a/console/dispatcherprofile_set.go b/console/dispatcherprofile_set.go index d2815594d..ef4cddd93 100644 --- a/console/dispatcherprofile_set.go +++ b/console/dispatcherprofile_set.go @@ -26,7 +26,7 @@ import ( func init() { c := &CmdSetDispatcherProfile{ name: "dispatcherprofile_set", - rpcMethod: utils.ApierV1SetDispatcherProfile, + rpcMethod: utils.APIerSv1SetDispatcherProfile, } commands[c.Name()] = c c.CommandExecuter = &CommandExecuter{c} diff --git a/console/filter.go b/console/filter.go index 51c7ed995..8306c54a5 100644 --- a/console/filter.go +++ b/console/filter.go @@ -26,7 +26,7 @@ import ( func init() { c := &CmdGetFilter{ name: "filter", - rpcMethod: utils.ApierV1GetFilter, + rpcMethod: utils.APIerSv1GetFilter, rpcParams: &utils.TenantID{}, } commands[c.Name()] = c diff --git a/console/filter_ids.go b/console/filter_ids.go index 2c0f4add9..40321c9f1 100644 --- a/console/filter_ids.go +++ b/console/filter_ids.go @@ -25,7 +25,7 @@ import ( func init() { c := &CmdGetFilterIDs{ name: "filter_ids", - rpcMethod: utils.ApierV1GetFilterIDs, + rpcMethod: utils.APIerSv1GetFilterIDs, rpcParams: &utils.TenantArgWithPaginator{}, } commands[c.Name()] = c diff --git a/console/filter_indexes.go b/console/filter_indexes.go index 594715ae1..14e45e090 100755 --- a/console/filter_indexes.go +++ b/console/filter_indexes.go @@ -26,7 +26,7 @@ import ( func init() { c := &CmdGetFilterIndexes{ name: "filter_indexes", - rpcMethod: utils.ApierV1GetFilterIndexes, + rpcMethod: utils.APIerSv1GetFilterIndexes, rpcParams: &v1.AttrGetFilterIndexes{}, } commands[c.Name()] = c diff --git a/console/filter_indexes_remove.go b/console/filter_indexes_remove.go index 430fe8885..694ea2c02 100644 --- a/console/filter_indexes_remove.go +++ b/console/filter_indexes_remove.go @@ -26,7 +26,7 @@ import ( func init() { c := &CmdRemoveFilterIndexes{ name: "filter_indexes_remove", - rpcMethod: utils.ApierV1RemoveFilterIndexes, + rpcMethod: utils.APIerSv1RemoveFilterIndexes, rpcParams: &v1.AttrRemFilterIndexes{}, } commands[c.Name()] = c diff --git a/console/filter_remove.go b/console/filter_remove.go index 85b3b1574..58d7ba296 100644 --- a/console/filter_remove.go +++ b/console/filter_remove.go @@ -23,7 +23,7 @@ import "github.com/cgrates/cgrates/utils" func init() { c := &CmdRemoveFilter{ name: "filter_remove", - rpcMethod: utils.ApierV1RemoveFilter, + rpcMethod: utils.APIerSv1RemoveFilter, rpcParams: &utils.TenantIDWithCache{}, } commands[c.Name()] = c diff --git a/console/filter_set.go b/console/filter_set.go index 1609bd098..a1cf5d723 100644 --- a/console/filter_set.go +++ b/console/filter_set.go @@ -27,7 +27,7 @@ import ( func init() { c := &CmdSetFilter{ name: "filter_set", - rpcMethod: utils.ApierV1SetFilter, + rpcMethod: utils.APIerSv1SetFilter, rpcParams: &v1.FilterWithCache{}, } commands[c.Name()] = c diff --git a/console/import_tp_from_folder.go b/console/import_tp_from_folder.go index dcf9ab6f8..41866f85c 100644 --- a/console/import_tp_from_folder.go +++ b/console/import_tp_from_folder.go @@ -23,7 +23,7 @@ import "github.com/cgrates/cgrates/utils" func init() { c := &ImportTpFromFolder{ name: "import_tp_from_folder", - rpcMethod: utils.ApierV1ImportTariffPlanFromFolder, + rpcMethod: utils.APIerSv1ImportTariffPlanFromFolder, } commands[c.Name()] = c c.CommandExecuter = &CommandExecuter{c} diff --git a/console/load_history.go b/console/load_history.go index e1dc0df10..6d9dd0e09 100644 --- a/console/load_history.go +++ b/console/load_history.go @@ -23,7 +23,7 @@ import "github.com/cgrates/cgrates/utils" func init() { c := &CmdGetLoadHistory{ name: "load_history", - rpcMethod: utils.ApierV1GetLoadHistory, + rpcMethod: utils.APIerSv1GetLoadHistory, rpcParams: new(utils.Paginator), } commands[c.Name()] = c diff --git a/console/load_ids.go b/console/load_ids.go index ac146988c..c1c89a554 100644 --- a/console/load_ids.go +++ b/console/load_ids.go @@ -23,7 +23,7 @@ import "github.com/cgrates/cgrates/utils" func init() { c := &CmdCacheVersions{ name: "get_load_ids", - rpcMethod: utils.ApierV1GetLoadIDs, + rpcMethod: utils.APIerSv1GetLoadIDs, } commands[c.Name()] = c c.CommandExecuter = &CommandExecuter{c} diff --git a/console/load_times.go b/console/load_times.go index 61f96c36e..9f3dfc4e8 100644 --- a/console/load_times.go +++ b/console/load_times.go @@ -26,7 +26,7 @@ import ( func init() { c := &CmdLoadTimes{ name: "get_load_times", - rpcMethod: utils.ApierV1GetLoadTimes, + rpcMethod: utils.APIerSv1GetLoadTimes, rpcParams: &v1.LoadTimeArgs{}, } commands[c.Name()] = c diff --git a/console/load_tp_from_folder.go b/console/load_tp_from_folder.go index a73170ec6..05ac9528f 100644 --- a/console/load_tp_from_folder.go +++ b/console/load_tp_from_folder.go @@ -23,7 +23,7 @@ import "github.com/cgrates/cgrates/utils" func init() { c := &LoadTpFromFolder{ name: "load_tp_from_folder", - rpcMethod: utils.ApierV1LoadTariffPlanFromFolder, + rpcMethod: utils.APIerSv1LoadTariffPlanFromFolder, } commands[c.Name()] = c c.CommandExecuter = &CommandExecuter{c} diff --git a/console/load_tp_from_stordb.go b/console/load_tp_from_stordb.go index 1d60b39d1..55de48873 100644 --- a/console/load_tp_from_stordb.go +++ b/console/load_tp_from_stordb.go @@ -26,7 +26,7 @@ import ( func init() { c := &LoadTpFromStorDb{ name: "load_tp_from_stordb", - rpcMethod: utils.ApierV1LoadTariffPlanFromStorDb, + rpcMethod: utils.APIerSv1LoadTariffPlanFromStorDb, } commands[c.Name()] = c c.CommandExecuter = &CommandExecuter{c} diff --git a/console/maxusage.go b/console/maxusage.go index e1bca37d5..e992f7b7b 100644 --- a/console/maxusage.go +++ b/console/maxusage.go @@ -23,7 +23,7 @@ import "github.com/cgrates/cgrates/engine" func init() { c := &CmdGetMaxUsage{ name: "maxusage", - rpcMethod: "ApierV1.GetMaxUsage", + rpcMethod: "APIerSv1.GetMaxUsage", clientArgs: []string{"ToR", "RequestType", "Tenant", "Category", "Account", "Subject", "Destination", "SetupTime", "AnswerTime", "Usage", "ExtraFields"}, diff --git a/console/ping.go b/console/ping.go index 36eaffd1b..e29ef0653 100644 --- a/console/ping.go +++ b/console/ping.go @@ -78,7 +78,7 @@ func (self *CmdApierPing) RpcMethod() string { case utils.ReplicatorLow: return utils.ReplicatorSv1Ping case utils.ApierSLow: - return utils.ApierV1Ping + return utils.APIerSv1Ping default: } return self.rpcMethod diff --git a/console/ratingprofile.go b/console/ratingprofile.go index 62adc7ffd..4bc003c63 100755 --- a/console/ratingprofile.go +++ b/console/ratingprofile.go @@ -26,7 +26,7 @@ import ( func init() { c := &CmdGetRatingProfile{ name: "ratingprofile", - rpcMethod: utils.ApierV1GetRatingProfile, + rpcMethod: utils.APIerSv1GetRatingProfile, } commands[c.Name()] = c c.CommandExecuter = &CommandExecuter{c} diff --git a/console/ratingprofile_rem.go b/console/ratingprofile_rem.go index a84613ae5..ab5c0dc66 100644 --- a/console/ratingprofile_rem.go +++ b/console/ratingprofile_rem.go @@ -28,7 +28,7 @@ import ( func init() { c := &CmdRemRatingProfile{ name: "ratingprofile_rem", - rpcMethod: utils.ApierV1RemoveRatingProfile, + rpcMethod: utils.APIerSv1RemoveRatingProfile, } commands[c.Name()] = c c.CommandExecuter = &CommandExecuter{c} diff --git a/console/ratingprofile_set.go b/console/ratingprofile_set.go index ac59054d4..7cb4ab634 100644 --- a/console/ratingprofile_set.go +++ b/console/ratingprofile_set.go @@ -25,7 +25,7 @@ import ( func init() { c := &CmdSetRatingProfile{ name: "ratingprofile_set", - rpcMethod: utils.ApierV1SetRatingProfile, + rpcMethod: utils.APIerSv1SetRatingProfile, } commands[c.Name()] = c c.CommandExecuter = &CommandExecuter{c} diff --git a/console/rattingprofile_ids.go b/console/rattingprofile_ids.go index 7b38daa0e..8b681de06 100644 --- a/console/rattingprofile_ids.go +++ b/console/rattingprofile_ids.go @@ -25,7 +25,7 @@ import ( func init() { c := &CmdGetRatingProfileIDs{ name: "ratingprofil_ids", - rpcMethod: utils.ApierV1GetRatingProfileIDs, + rpcMethod: utils.APIerSv1GetRatingProfileIDs, } commands[c.Name()] = c c.CommandExecuter = &CommandExecuter{c} diff --git a/console/resource_ids.go b/console/resource_ids.go index c72ec638e..e0273d9e9 100644 --- a/console/resource_ids.go +++ b/console/resource_ids.go @@ -25,7 +25,7 @@ import ( func init() { c := &CmdGetResourceIDs{ name: "resource_ids", - rpcMethod: utils.ApierV1GetResourceProfileIDs, + rpcMethod: utils.APIerSv1GetResourceProfileIDs, rpcParams: &utils.TenantArgWithPaginator{}, } commands[c.Name()] = c diff --git a/console/resource_profile.go b/console/resource_profile.go index 19f8ff047..6e0c8d635 100644 --- a/console/resource_profile.go +++ b/console/resource_profile.go @@ -26,7 +26,7 @@ import ( func init() { c := &CmdGetResourceProfile{ name: "resource_profile", - rpcMethod: utils.ApierV1GetResourceProfile, + rpcMethod: utils.APIerSv1GetResourceProfile, rpcParams: &utils.TenantID{}, } commands[c.Name()] = c diff --git a/console/resource_remove.go b/console/resource_remove.go index f2067b5e2..f3907fa7e 100644 --- a/console/resource_remove.go +++ b/console/resource_remove.go @@ -23,7 +23,7 @@ import "github.com/cgrates/cgrates/utils" func init() { c := &CmdRemoveResource{ name: "resource_remove", - rpcMethod: utils.ApierV1RemoveResourceProfile, + rpcMethod: utils.APIerSv1RemoveResourceProfile, rpcParams: &utils.TenantIDWithCache{}, } commands[c.Name()] = c diff --git a/console/resource_set.go b/console/resource_set.go index 94e730b76..298e02203 100644 --- a/console/resource_set.go +++ b/console/resource_set.go @@ -26,7 +26,7 @@ import ( func init() { c := &CmdSetResource{ name: "resource_set", - rpcMethod: utils.ApierV1SetResourceProfile, + rpcMethod: utils.APIerSv1SetResourceProfile, rpcParams: &v1.ResourceWithCache{}, } commands[c.Name()] = c diff --git a/console/scheduler_execute.go b/console/scheduler_execute.go index ecd311f2c..33116673f 100644 --- a/console/scheduler_execute.go +++ b/console/scheduler_execute.go @@ -26,7 +26,7 @@ import ( func init() { c := &CmdExecuteScheduledActions{ name: "scheduler_execute", - rpcMethod: utils.ApierV1ExecuteScheduledActions, + rpcMethod: utils.APIerSv1ExecuteScheduledActions, rpcParams: &v1.AttrsExecuteScheduledActions{}, } commands[c.Name()] = c diff --git a/console/scheduler_queue.go b/console/scheduler_queue.go index 2e1d24af4..3de9ad07f 100644 --- a/console/scheduler_queue.go +++ b/console/scheduler_queue.go @@ -26,7 +26,7 @@ import ( func init() { c := &CmdGetScheduledActions{ name: "scheduler_queue", - rpcMethod: utils.ApierV1GetScheduledActions, + rpcMethod: utils.APIerSv1GetScheduledActions, rpcParams: &scheduler.ArgsGetScheduledActions{}, } commands[c.Name()] = c diff --git a/console/set_datadb_versions.go b/console/set_datadb_versions.go index fc566b02a..b2a769fd1 100644 --- a/console/set_datadb_versions.go +++ b/console/set_datadb_versions.go @@ -26,7 +26,7 @@ import ( func init() { c := &CmdSetDataDBVersions{ name: "set_datadb_versions", - rpcMethod: utils.ApierV1SetDataDBVersions, + rpcMethod: utils.APIerSv1SetDataDBVersions, rpcParams: &v1.SetVersionsArg{}, } commands[c.Name()] = c diff --git a/console/set_stordb_versions.go b/console/set_stordb_versions.go index 7ba062223..8a4658b7b 100644 --- a/console/set_stordb_versions.go +++ b/console/set_stordb_versions.go @@ -26,7 +26,7 @@ import ( func init() { c := &CmdSetStorDBVersions{ name: "set_stordb_versions", - rpcMethod: utils.ApierV1SetStorDBVersions, + rpcMethod: utils.APIerSv1SetStorDBVersions, rpcParams: &v1.SetVersionsArg{}, } commands[c.Name()] = c diff --git a/console/sharedgroup.go b/console/sharedgroup.go index eb5937317..ba0468222 100644 --- a/console/sharedgroup.go +++ b/console/sharedgroup.go @@ -26,7 +26,7 @@ import ( func init() { c := &CmdGetSharedGroup{ name: "sharedgroup", - rpcMethod: utils.ApierV1GetSharedGroup, + rpcMethod: utils.APIerSv1GetSharedGroup, } commands[c.Name()] = c c.CommandExecuter = &CommandExecuter{c} diff --git a/console/statqueue.go b/console/statqueue.go index b05386a0d..3e8f36b40 100644 --- a/console/statqueue.go +++ b/console/statqueue.go @@ -26,7 +26,7 @@ import ( func init() { c := &CmdGetStatQueueProfile{ name: "statqueue_profile", - rpcMethod: utils.ApierV1GetStatQueueProfile, + rpcMethod: utils.APIerSv1GetStatQueueProfile, rpcParams: &utils.TenantID{}, } commands[c.Name()] = c diff --git a/console/statqueue_ids.go b/console/statqueue_ids.go index ff677fd7b..27c66e176 100644 --- a/console/statqueue_ids.go +++ b/console/statqueue_ids.go @@ -25,7 +25,7 @@ import ( func init() { c := &CmdGetStatQueueIDs{ name: "statqueue_ids", - rpcMethod: utils.ApierV1GetStatQueueProfileIDs, + rpcMethod: utils.APIerSv1GetStatQueueProfileIDs, rpcParams: &utils.TenantArgWithPaginator{}, } commands[c.Name()] = c diff --git a/console/statqueue_remove.go b/console/statqueue_remove.go index cf0e83474..fe88f973e 100644 --- a/console/statqueue_remove.go +++ b/console/statqueue_remove.go @@ -23,7 +23,7 @@ import "github.com/cgrates/cgrates/utils" func init() { c := &CmdRemoveStatQueue{ name: "statqueue_remove", - rpcMethod: utils.ApierV1RemoveStatQueueProfile, + rpcMethod: utils.APIerSv1RemoveStatQueueProfile, rpcParams: &utils.TenantIDWithCache{}, } commands[c.Name()] = c diff --git a/console/statqueue_set.go b/console/statqueue_set.go index 1cbf1e78d..2d7ed65b5 100644 --- a/console/statqueue_set.go +++ b/console/statqueue_set.go @@ -27,7 +27,7 @@ import ( func init() { c := &CmdSetStatQueue{ name: "statqueue_set", - rpcMethod: utils.ApierV1SetStatQueueProfile, + rpcMethod: utils.APIerSv1SetStatQueueProfile, rpcParams: &v1.StatQueueWithCache{}, } commands[c.Name()] = c diff --git a/console/stordb_versions.go b/console/stordb_versions.go index 5a90877d3..823677762 100644 --- a/console/stordb_versions.go +++ b/console/stordb_versions.go @@ -26,7 +26,7 @@ import ( func init() { c := &CmdGetStorDBVersions{ name: "stordb_versions", - rpcMethod: utils.ApierV1GetStorDBVersions, + rpcMethod: utils.APIerSv1GetStorDBVersions, } commands[c.Name()] = c c.CommandExecuter = &CommandExecuter{c} diff --git a/console/supplier_get.go b/console/supplier_get.go index 924853c24..3d96a584b 100644 --- a/console/supplier_get.go +++ b/console/supplier_get.go @@ -26,7 +26,7 @@ import ( func init() { c := &CmdGetSupplier{ name: "supplier_get", - rpcMethod: utils.ApierV1GetSupplierProfile, + rpcMethod: utils.APIerSv1GetSupplierProfile, rpcParams: &utils.TenantID{}, } commands[c.Name()] = c diff --git a/console/supplier_ids.go b/console/supplier_ids.go index b4cbce6c7..0ead78570 100644 --- a/console/supplier_ids.go +++ b/console/supplier_ids.go @@ -25,7 +25,7 @@ import ( func init() { c := &CmdSuppliersIDs{ name: "supplier_ids", - rpcMethod: utils.ApierV1GetSupplierProfileIDs, + rpcMethod: utils.APIerSv1GetSupplierProfileIDs, rpcParams: &utils.TenantArgWithPaginator{}, } commands[c.Name()] = c diff --git a/console/supplier_remove.go b/console/supplier_remove.go index 4ac2bd193..d0b43ed47 100644 --- a/console/supplier_remove.go +++ b/console/supplier_remove.go @@ -23,7 +23,7 @@ import "github.com/cgrates/cgrates/utils" func init() { c := &CmdRemoveSupplier{ name: "supplier_remove", - rpcMethod: utils.ApierV1RemoveSupplierProfile, + rpcMethod: utils.APIerSv1RemoveSupplierProfile, rpcParams: &utils.TenantIDWithCache{}, } commands[c.Name()] = c diff --git a/console/supplier_set.go b/console/supplier_set.go index 9d24c85e7..89ce56195 100644 --- a/console/supplier_set.go +++ b/console/supplier_set.go @@ -27,7 +27,7 @@ import ( func init() { c := &CmdSetSupplier{ name: "supplier_set", - rpcMethod: utils.ApierV1SetSupplierProfile, + rpcMethod: utils.APIerSv1SetSupplierProfile, rpcParams: &v1.SupplierWithCache{}, } commands[c.Name()] = c diff --git a/console/threshold_ids.go b/console/threshold_ids.go index 62b18c886..df7b1cc30 100644 --- a/console/threshold_ids.go +++ b/console/threshold_ids.go @@ -25,7 +25,7 @@ import ( func init() { c := &CmdGetThresholdIDs{ name: "threshold_ids", - rpcMethod: utils.ApierV1GetThresholdProfileIDs, + rpcMethod: utils.APIerSv1GetThresholdProfileIDs, rpcParams: &utils.TenantArgWithPaginator{}, } commands[c.Name()] = c diff --git a/console/threshold_profile.go b/console/threshold_profile.go index 5379ea291..63fcbbee3 100644 --- a/console/threshold_profile.go +++ b/console/threshold_profile.go @@ -26,7 +26,7 @@ import ( func init() { c := &CmdGetThresholdProfile{ name: "threshold_profile", - rpcMethod: utils.ApierV1GetThresholdProfile, + rpcMethod: utils.APIerSv1GetThresholdProfile, rpcParams: &utils.TenantIDWithArgDispatcher{}, } commands[c.Name()] = c diff --git a/console/threshold_remove.go b/console/threshold_remove.go index c1f878693..2da1e327a 100644 --- a/console/threshold_remove.go +++ b/console/threshold_remove.go @@ -23,7 +23,7 @@ import "github.com/cgrates/cgrates/utils" func init() { c := &CmdRemoveThreshold{ name: "threshold_remove", - rpcMethod: utils.ApierV1RemoveThresholdProfile, + rpcMethod: utils.APIerSv1RemoveThresholdProfile, rpcParams: &utils.TenantIDWithCache{}, } commands[c.Name()] = c diff --git a/console/threshold_set.go b/console/threshold_set.go index 532ec4d92..c92e38c1b 100644 --- a/console/threshold_set.go +++ b/console/threshold_set.go @@ -26,7 +26,7 @@ import ( func init() { c := &CmdSetThreshold{ name: "threshold_set", - rpcMethod: utils.ApierV1SetThresholdProfile, + rpcMethod: utils.APIerSv1SetThresholdProfile, rpcParams: &engine.ThresholdWithCache{}, } commands[c.Name()] = c diff --git a/console/trigger_remove.go b/console/trigger_remove.go index 181e9df8e..18a0f45c7 100644 --- a/console/trigger_remove.go +++ b/console/trigger_remove.go @@ -26,7 +26,7 @@ import ( func init() { c := &CmdRemoveTriggers{ name: "triggers_remove", - rpcMethod: utils.ApierV1RemoveActionTrigger, + rpcMethod: utils.APIerSv1RemoveActionTrigger, rpcParams: &v1.AttrRemoveActionTrigger{}, } commands[c.Name()] = c diff --git a/console/trigger_set.go b/console/trigger_set.go index c304a0f77..09255b731 100644 --- a/console/trigger_set.go +++ b/console/trigger_set.go @@ -26,7 +26,7 @@ import ( func init() { c := &CmdSetTriggers{ name: "triggers_set", - rpcMethod: utils.ApierV1SetActionTrigger, + rpcMethod: utils.APIerSv1SetActionTrigger, rpcParams: &v1.AttrSetActionTrigger{}, } commands[c.Name()] = c diff --git a/console/triggers.go b/console/triggers.go index 04e98f818..48927d414 100644 --- a/console/triggers.go +++ b/console/triggers.go @@ -27,7 +27,7 @@ import ( func init() { c := &CmdGetTriggers{ name: "triggers", - rpcMethod: utils.ApierV1GetActionTriggers, + rpcMethod: utils.APIerSv1GetActionTriggers, rpcParams: &v1.AttrGetActionTriggers{}, } commands[c.Name()] = c diff --git a/data/postman/Voiceland/CGRates.postman_collection_v2.1.json b/data/postman/Voiceland/CGRates.postman_collection_v2.1.json index e93b8e5a3..9af69571f 100644 --- a/data/postman/Voiceland/CGRates.postman_collection_v2.1.json +++ b/data/postman/Voiceland/CGRates.postman_collection_v2.1.json @@ -12,7 +12,7 @@ "name": "TP Timing", "item": [ { - "name": "ApierV1.SetTPTiming", + "name": "APIerSv1.SetTPTiming", "request": { "auth": { "type": "noauth" @@ -26,7 +26,7 @@ ], "body": { "mode": "raw", - "raw": "{\n\"id\": 3,\n\"method\": \"ApierV1.SetTPTiming\",\n\"params\": [\n{\n\t\"TPid\": \"TP_TIMING_TEST\",\n\t\"ID\":\"TP_TIMINGID\",\n\t\"TimingId\": \"TP_TIMING_ID\",\n\t\"MonthDays\": \"*any\",\n\t\"Months\": \"*any\",\n\t\"Time\": \"00:00:00\",\n\t\"WeekDays\": \"*any\",\n\t\"Years\": \"*any\"\n}\n]\n}" + "raw": "{\n\"id\": 3,\n\"method\": \"APIerSv1.SetTPTiming\",\n\"params\": [\n{\n\t\"TPid\": \"TP_TIMING_TEST\",\n\t\"ID\":\"TP_TIMINGID\",\n\t\"TimingId\": \"TP_TIMING_ID\",\n\t\"MonthDays\": \"*any\",\n\t\"Months\": \"*any\",\n\t\"Time\": \"00:00:00\",\n\t\"WeekDays\": \"*any\",\n\t\"Years\": \"*any\"\n}\n]\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -41,7 +41,7 @@ "response": [] }, { - "name": "ApierV1.GetTPTiming", + "name": "APIerSv1.GetTPTiming", "request": { "auth": { "type": "noauth" @@ -55,7 +55,7 @@ ], "body": { "mode": "raw", - "raw": "{\n\"id\": 5,\n\"method\": \"ApierV1.GetTPTiming\",\n\"params\": [\n{\n\t\"TPid\": \"TP_TIMING_TEST\",\n\t\"ID\":\"TP_TIMINGID\",\n\t\"TimingId\": \"TP_TIMING_ID\"\n}\n]\n}" + "raw": "{\n\"id\": 5,\n\"method\": \"APIerSv1.GetTPTiming\",\n\"params\": [\n{\n\t\"TPid\": \"TP_TIMING_TEST\",\n\t\"ID\":\"TP_TIMINGID\",\n\t\"TimingId\": \"TP_TIMING_ID\"\n}\n]\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -70,7 +70,7 @@ "response": [] }, { - "name": "ApierV1.GetTPTimingIds", + "name": "APIerSv1.GetTPTimingIds", "request": { "auth": { "type": "noauth" @@ -84,7 +84,7 @@ ], "body": { "mode": "raw", - "raw": "{\n\"id\": 1,\n\"method\": \"ApierV1.GetTPTimingIds\",\n\"params\": [\n{\n\"TPid\": \"Tim_always\"\n}\n]\n}" + "raw": "{\n\"id\": 1,\n\"method\": \"APIerSv1.GetTPTimingIds\",\n\"params\": [\n{\n\"TPid\": \"Tim_always\"\n}\n]\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -113,7 +113,7 @@ ], "body": { "mode": "raw", - "raw": "{\n\"id\": 1,\n\"method\": \"ApierV1.RemoveTPTiming\",\n\"params\": [\n{\n\"TPid\": \"TEST_SQL\"\n}\n]\n}" + "raw": "{\n\"id\": 1,\n\"method\": \"APIerSv1.RemoveTPTiming\",\n\"params\": [\n{\n\"TPid\": \"TEST_SQL\"\n}\n]\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -154,7 +154,7 @@ "_postman_isSubFolder": true }, { - "name": "ApierV1.GetTPIds", + "name": "APIerSv1.GetTPIds", "request": { "auth": { "type": "noauth" @@ -168,7 +168,7 @@ ], "body": { "mode": "raw", - "raw": "{\n\n\"method\": \"ApierV1.GetTPIds\",\n\"params\": []\n}" + "raw": "{\n\n\"method\": \"APIerSv1.GetTPIds\",\n\"params\": []\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -197,7 +197,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"id\": 6,\n \"method\": \"ApierV1.LoadTariffPlanFromStorDb\",\n \"params\": [\n {\n \t\"TPid\":\"CGR_API_TESTS\"\n \n }\n ]\n}" + "raw": "{\n \"id\": 6,\n \"method\": \"APIerSv1.LoadTariffPlanFromStorDb\",\n \"params\": [\n {\n \t\"TPid\":\"CGR_API_TESTS\"\n \n }\n ]\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -698,7 +698,7 @@ "_postman_isSubFolder": true }, { - "name": "ApierV1.SetAttributeProfile +30xxxxxxxxx", + "name": "APIerSv1.SetAttributeProfile +30xxxxxxxxx", "request": { "auth": { "type": "noauth" @@ -712,7 +712,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.SetAttributeProfile\",\n \"params\": [\n {\n \"Tenant\": \"cgrates.org\",\n \"ID\": \"+30xxxxxxxxx\",\n \"Contexts\": [\n \"*sessions\"\n ],\n \"FilterIDs\": [\n \"*string:~Account:+30xxxxxxxxx\"\n ],\n \"ActivationInterval\": null,\n \"Attributes\": [\n {\n \"FilterIDs\": null,\n \"FieldName\": \"SipUserName\",\n \"Type\": \"\",\n \"Value\": [\n {\n \"Rules\": \"+30xxxxxxxxx\",\n \"AllFiltersMatch\": true\n }\n ]\n },\n {\n \"FilterIDs\": null,\n \"FieldName\": \"SipPassword\",\n \"Type\": \"\",\n \"Value\": [\n {\n \"Rules\": \"xe3r3xJp@o1D*yeV\",\n \"AllFiltersMatch\": true\n }\n ]\n },\n {\n \"FilterIDs\": null,\n \"FieldName\": \"Region\",\n \"Type\": \"\",\n \"Value\": [\n {\n \"Rules\": \"Europe\",\n \"AllFiltersMatch\": true\n }\n ]\n },\n {\n \"FilterIDs\": null,\n \"FieldName\": \"Country\",\n \"Type\": \"\",\n \"Value\": [\n {\n \"Rules\": \"Greece\",\n \"AllFiltersMatch\": true\n }\n ]\n },\n {\n \"FilterIDs\": null,\n \"FieldName\": \"RequestType\",\n \"Type\": \"\",\n \"Value\": [\n {\n \"Rules\": \"*prepaid\",\n \"AllFiltersMatch\": true\n }\n ]\n },\n {\n \"FilterIDs\": null,\n \"FieldName\": \"MaxSessions\",\n \"Type\": \"\",\n \"Value\": [\n {\n \"Rules\": \"1\",\n \"AllFiltersMatch\": true\n }\n ]\n },\n {\n \"FilterIDs\": null,\n \"FieldName\": \"Max_Incoming_Sessions\",\n \"Type\": \"\",\n \"Value\": [\n {\n \"Rules\": \"1\",\n \"AllFiltersMatch\": true\n }\n ]\n },\n {\n \"FilterIDs\": null,\n \"FieldName\": \"Max_Outgoing_Sessions\",\n \"Type\": \"\",\n \"Value\": [\n {\n \"Rules\": \"1\",\n \"AllFiltersMatch\": true\n }\n ]\n },\n {\n \"FilterIDs\": null,\n \"FieldName\": \"MaxSessionTime\",\n \"Type\": \"\",\n \"Value\": [\n {\n \"Rules\": \"3600\",\n \"AllFiltersMatch\": true\n }\n ]\n },\n {\n \"FilterIDs\": null,\n \"FieldName\": \"MaxCallsPerSecond\",\n \"Type\": \"\",\n \"Value\": [\n {\n \"Rules\": \"1\",\n \"AllFiltersMatch\": true\n }\n ]\n },\n {\n \"FilterIDs\": null,\n \"FieldName\": \"Authorize_wrong_password_limit\",\n \"Type\": \"\",\n \"Value\": [\n {\n \"Rules\": \"20\",\n \"AllFiltersMatch\": true\n }\n ]\n },\n {\n \"FilterIDs\": null,\n \"FieldName\": \"Authorize_no_such_user_limit\",\n \"Type\": \"\",\n \"Value\": [\n {\n \"Rules\": \"20\",\n \"AllFiltersMatch\": true\n }\n ]\n },\n {\n \"FilterIDs\": null,\n \"FieldName\": \"Block_Incoming_Calls\",\n \"Type\": \"\",\n \"Value\": [\n {\n \"Rules\": \"0\",\n \"AllFiltersMatch\": true\n }\n ]\n },\n {\n \"FilterIDs\": null,\n \"FieldName\": \"Hide_CLI\",\n \"Type\": \"\",\n \"Value\": [\n {\n \"Rules\": \"0\",\n \"AllFiltersMatch\": true\n }\n ]\n },\n {\n \"FilterIDs\": null,\n \"FieldName\": \"Forwarding_Service\",\n \"Type\": \"\",\n \"Value\": [\n {\n \"Rules\": \"0\",\n \"AllFiltersMatch\": true\n }\n ]\n },\n {\n \"FilterIDs\": null,\n \"FieldName\": \"Voicemail_Service\",\n \"Type\": \"\",\n \"Value\": [\n {\n \"Rules\": \"0\",\n \"AllFiltersMatch\": true\n }\n ]\n },\n {\n \"FilterIDs\": null,\n \"FieldName\": \"ResourceAllocation\",\n \"Type\": \"*contant\",\n \"Value\": [\n {\n \"Rules\": \"ResGroup1\",\n \"AllFiltersMatch\": true\n }\n ]\n }\n ],\n \"Blocker\": false,\n \"Weight\": 10\n }\n ],\n \"id\": 2\n}" + "raw": "{\n \"method\": \"APIerSv1.SetAttributeProfile\",\n \"params\": [\n {\n \"Tenant\": \"cgrates.org\",\n \"ID\": \"+30xxxxxxxxx\",\n \"Contexts\": [\n \"*sessions\"\n ],\n \"FilterIDs\": [\n \"*string:~Account:+30xxxxxxxxx\"\n ],\n \"ActivationInterval\": null,\n \"Attributes\": [\n {\n \"FilterIDs\": null,\n \"FieldName\": \"SipUserName\",\n \"Type\": \"\",\n \"Value\": [\n {\n \"Rules\": \"+30xxxxxxxxx\",\n \"AllFiltersMatch\": true\n }\n ]\n },\n {\n \"FilterIDs\": null,\n \"FieldName\": \"SipPassword\",\n \"Type\": \"\",\n \"Value\": [\n {\n \"Rules\": \"xe3r3xJp@o1D*yeV\",\n \"AllFiltersMatch\": true\n }\n ]\n },\n {\n \"FilterIDs\": null,\n \"FieldName\": \"Region\",\n \"Type\": \"\",\n \"Value\": [\n {\n \"Rules\": \"Europe\",\n \"AllFiltersMatch\": true\n }\n ]\n },\n {\n \"FilterIDs\": null,\n \"FieldName\": \"Country\",\n \"Type\": \"\",\n \"Value\": [\n {\n \"Rules\": \"Greece\",\n \"AllFiltersMatch\": true\n }\n ]\n },\n {\n \"FilterIDs\": null,\n \"FieldName\": \"RequestType\",\n \"Type\": \"\",\n \"Value\": [\n {\n \"Rules\": \"*prepaid\",\n \"AllFiltersMatch\": true\n }\n ]\n },\n {\n \"FilterIDs\": null,\n \"FieldName\": \"MaxSessions\",\n \"Type\": \"\",\n \"Value\": [\n {\n \"Rules\": \"1\",\n \"AllFiltersMatch\": true\n }\n ]\n },\n {\n \"FilterIDs\": null,\n \"FieldName\": \"Max_Incoming_Sessions\",\n \"Type\": \"\",\n \"Value\": [\n {\n \"Rules\": \"1\",\n \"AllFiltersMatch\": true\n }\n ]\n },\n {\n \"FilterIDs\": null,\n \"FieldName\": \"Max_Outgoing_Sessions\",\n \"Type\": \"\",\n \"Value\": [\n {\n \"Rules\": \"1\",\n \"AllFiltersMatch\": true\n }\n ]\n },\n {\n \"FilterIDs\": null,\n \"FieldName\": \"MaxSessionTime\",\n \"Type\": \"\",\n \"Value\": [\n {\n \"Rules\": \"3600\",\n \"AllFiltersMatch\": true\n }\n ]\n },\n {\n \"FilterIDs\": null,\n \"FieldName\": \"MaxCallsPerSecond\",\n \"Type\": \"\",\n \"Value\": [\n {\n \"Rules\": \"1\",\n \"AllFiltersMatch\": true\n }\n ]\n },\n {\n \"FilterIDs\": null,\n \"FieldName\": \"Authorize_wrong_password_limit\",\n \"Type\": \"\",\n \"Value\": [\n {\n \"Rules\": \"20\",\n \"AllFiltersMatch\": true\n }\n ]\n },\n {\n \"FilterIDs\": null,\n \"FieldName\": \"Authorize_no_such_user_limit\",\n \"Type\": \"\",\n \"Value\": [\n {\n \"Rules\": \"20\",\n \"AllFiltersMatch\": true\n }\n ]\n },\n {\n \"FilterIDs\": null,\n \"FieldName\": \"Block_Incoming_Calls\",\n \"Type\": \"\",\n \"Value\": [\n {\n \"Rules\": \"0\",\n \"AllFiltersMatch\": true\n }\n ]\n },\n {\n \"FilterIDs\": null,\n \"FieldName\": \"Hide_CLI\",\n \"Type\": \"\",\n \"Value\": [\n {\n \"Rules\": \"0\",\n \"AllFiltersMatch\": true\n }\n ]\n },\n {\n \"FilterIDs\": null,\n \"FieldName\": \"Forwarding_Service\",\n \"Type\": \"\",\n \"Value\": [\n {\n \"Rules\": \"0\",\n \"AllFiltersMatch\": true\n }\n ]\n },\n {\n \"FilterIDs\": null,\n \"FieldName\": \"Voicemail_Service\",\n \"Type\": \"\",\n \"Value\": [\n {\n \"Rules\": \"0\",\n \"AllFiltersMatch\": true\n }\n ]\n },\n {\n \"FilterIDs\": null,\n \"FieldName\": \"ResourceAllocation\",\n \"Type\": \"*contant\",\n \"Value\": [\n {\n \"Rules\": \"ResGroup1\",\n \"AllFiltersMatch\": true\n }\n ]\n }\n ],\n \"Blocker\": false,\n \"Weight\": 10\n }\n ],\n \"id\": 2\n}" }, "url": { "raw": "http://cgrates1.cgrates.org:2080/jsonrpc", @@ -731,7 +731,7 @@ "response": [] }, { - "name": "ApierV1.GetAttributeProfile", + "name": "APIerSv1.GetAttributeProfile", "request": { "auth": { "type": "noauth" @@ -745,7 +745,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"id\":\"0\",\n \"method\":\"ApierV1.GetAttributeProfile\",\n \"params\":[\n {\n \"Tenant\":\"cgrates.org\",\n \"ID\":\"ATTR_SPL_TESTSUPPLIER1_Out\"\n }\n ]\n}" + "raw": "{\n \"id\":\"0\",\n \"method\":\"APIerSv1.GetAttributeProfile\",\n \"params\":[\n {\n \"Tenant\":\"cgrates.org\",\n \"ID\":\"ATTR_SPL_TESTSUPPLIER1_Out\"\n }\n ]\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -760,7 +760,7 @@ "response": [] }, { - "name": "ApierV1.RemoveAttributeProfile", + "name": "APIerSv1.RemoveAttributeProfile", "request": { "auth": { "type": "noauth" @@ -774,7 +774,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"id\":\"0\",\n \"method\":\"ApierV1.RemoveAttributeProfile\",\n \"params\":[\n {\n \"Tenant\":\"cgrates.org\",\n \"ID\":\"+30xxxxxxxxxx\"\n }\n ]\n}" + "raw": "{\n \"id\":\"0\",\n \"method\":\"APIerSv1.RemoveAttributeProfile\",\n \"params\":[\n {\n \"Tenant\":\"cgrates.org\",\n \"ID\":\"+30xxxxxxxxxx\"\n }\n ]\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -789,7 +789,7 @@ "response": [] }, { - "name": "ApierV1.GetAttributeProfileIDs", + "name": "APIerSv1.GetAttributeProfileIDs", "request": { "auth": { "type": "noauth" @@ -803,7 +803,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"id\":\"0\",\n \"method\":\"ApierV1.GetAttributeProfileIDs\",\n \"params\":[\n {\n \"Tenant\":\"cgrates.org\",\n \"ID\":[]\n }\n ]\n}\n " + "raw": "{\n \"id\":\"0\",\n \"method\":\"APIerSv1.GetAttributeProfileIDs\",\n \"params\":[\n {\n \"Tenant\":\"cgrates.org\",\n \"ID\":[]\n }\n ]\n}\n " }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -818,7 +818,7 @@ "response": [] }, { - "name": "ApierV1.SetAttributeProfile ATTR_SPL_TESTSUPPLIER1_In", + "name": "APIerSv1.SetAttributeProfile ATTR_SPL_TESTSUPPLIER1_In", "request": { "auth": { "type": "noauth" @@ -832,7 +832,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.SetAttributeProfile\",\n \"params\": [\n {\n \"Tenant\": \"cgrates.org\",\n \"ID\": \"ATTR_SPL_TESTSUPPLIER1_In\",\n \"Contexts\": [\n \"*chargers\"\n ],\n \"FilterIDs\": [\n \n ],\n \"ActivationInterval\": null,\n \"Attributes\": [\n {\n \"FilterIDs\": null,\n \"FieldName\": \"Subject\",\n \"Type\": \"*constant\",\n \"Value\": [\n {\n \"Rules\": \"TESTSUPPLIER1-IN\",\n \"AllFiltersMatch\": true\n }\n ]\n }\n \n ],\n \"Blocker\": false,\n \"Weight\": 10\n }\n ],\n \"id\": 2\n}" + "raw": "{\n \"method\": \"APIerSv1.SetAttributeProfile\",\n \"params\": [\n {\n \"Tenant\": \"cgrates.org\",\n \"ID\": \"ATTR_SPL_TESTSUPPLIER1_In\",\n \"Contexts\": [\n \"*chargers\"\n ],\n \"FilterIDs\": [\n \n ],\n \"ActivationInterval\": null,\n \"Attributes\": [\n {\n \"FilterIDs\": null,\n \"FieldName\": \"Subject\",\n \"Type\": \"*constant\",\n \"Value\": [\n {\n \"Rules\": \"TESTSUPPLIER1-IN\",\n \"AllFiltersMatch\": true\n }\n ]\n }\n \n ],\n \"Blocker\": false,\n \"Weight\": 10\n }\n ],\n \"id\": 2\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -847,7 +847,7 @@ "response": [] }, { - "name": "ApierV1.SetAttributeProfile ATTR_SPL_TESTSUPPLIER1_Out", + "name": "APIerSv1.SetAttributeProfile ATTR_SPL_TESTSUPPLIER1_Out", "request": { "auth": { "type": "noauth" @@ -861,7 +861,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.SetAttributeProfile\",\n \"params\": [\n {\n \"Tenant\": \"cgrates.org\",\n \"ID\": \"ATTR_SPL_TESTSUPPLIER1_Out\",\n \"Contexts\": [\n \"*chargers\"\n ],\n \"FilterIDs\": [\n \n ],\n \"ActivationInterval\": null,\n \"Attributes\": [\n {\n \"FilterIDs\": null,\n \"FieldName\": \"Subject\",\n \"Type\": \"*constant\",\n \"Value\": [\n {\n \"Rules\": \"TESTSUPPLIER1-OUT\",\n \"AllFiltersMatch\": true\n }\n ]\n }\n \n ],\n \"Blocker\": false,\n \"Weight\": 10\n }\n ],\n \"id\": 2\n}" + "raw": "{\n \"method\": \"APIerSv1.SetAttributeProfile\",\n \"params\": [\n {\n \"Tenant\": \"cgrates.org\",\n \"ID\": \"ATTR_SPL_TESTSUPPLIER1_Out\",\n \"Contexts\": [\n \"*chargers\"\n ],\n \"FilterIDs\": [\n \n ],\n \"ActivationInterval\": null,\n \"Attributes\": [\n {\n \"FilterIDs\": null,\n \"FieldName\": \"Subject\",\n \"Type\": \"*constant\",\n \"Value\": [\n {\n \"Rules\": \"TESTSUPPLIER1-OUT\",\n \"AllFiltersMatch\": true\n }\n ]\n }\n \n ],\n \"Blocker\": false,\n \"Weight\": 10\n }\n ],\n \"id\": 2\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -876,7 +876,7 @@ "response": [] }, { - "name": "ApierV1.SetAttributeProfile ATTR_CATEGORY_CALL_IN", + "name": "APIerSv1.SetAttributeProfile ATTR_CATEGORY_CALL_IN", "request": { "auth": { "type": "noauth" @@ -890,7 +890,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.SetAttributeProfile\",\n \"params\": [\n {\n \"Tenant\": \"cgrates.org\",\n \"ID\": \"ATTR_CATEGORY_CALL_IN\",\n \"Contexts\": [\n \"*chargers\"\n ],\n \"FilterIDs\": [\n \n ],\n \"ActivationInterval\": null,\n \"Attributes\": [\n {\n \"FilterIDs\": null,\n \"FieldName\": \"Category\",\n \"Type\": \"*constant\",\n \"Value\": [\n {\n \"Rules\": \"call-in\",\n \"AllFiltersMatch\": true\n }\n ]\n }\n \n ],\n \"Blocker\": false,\n \"Weight\": 10\n }\n ],\n \"id\": 2\n}" + "raw": "{\n \"method\": \"APIerSv1.SetAttributeProfile\",\n \"params\": [\n {\n \"Tenant\": \"cgrates.org\",\n \"ID\": \"ATTR_CATEGORY_CALL_IN\",\n \"Contexts\": [\n \"*chargers\"\n ],\n \"FilterIDs\": [\n \n ],\n \"ActivationInterval\": null,\n \"Attributes\": [\n {\n \"FilterIDs\": null,\n \"FieldName\": \"Category\",\n \"Type\": \"*constant\",\n \"Value\": [\n {\n \"Rules\": \"call-in\",\n \"AllFiltersMatch\": true\n }\n ]\n }\n \n ],\n \"Blocker\": false,\n \"Weight\": 10\n }\n ],\n \"id\": 2\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -905,7 +905,7 @@ "response": [] }, { - "name": "ApierV1.SetAttributeProfile ATTR_CATEGORY_CALL_OUT", + "name": "APIerSv1.SetAttributeProfile ATTR_CATEGORY_CALL_OUT", "request": { "auth": { "type": "noauth" @@ -919,7 +919,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.SetAttributeProfile\",\n \"params\": [\n {\n \"Tenant\": \"cgrates.org\",\n \"ID\": \"ATTR_CATEGORY_CALL_OUT\",\n \"Contexts\": [\n \"*chargers\"\n ],\n \"FilterIDs\": [\n \n ],\n \"ActivationInterval\": null,\n \"Attributes\": [\n {\n \"FilterIDs\": null,\n \"FieldName\": \"Category\",\n \"Type\": \"*constant\",\n \"Value\": [\n {\n \"Rules\": \"call-out\",\n \"AllFiltersMatch\": true\n }\n ]\n }\n \n ],\n \"Blocker\": false,\n \"Weight\": 10\n }\n ],\n \"id\": 2\n}" + "raw": "{\n \"method\": \"APIerSv1.SetAttributeProfile\",\n \"params\": [\n {\n \"Tenant\": \"cgrates.org\",\n \"ID\": \"ATTR_CATEGORY_CALL_OUT\",\n \"Contexts\": [\n \"*chargers\"\n ],\n \"FilterIDs\": [\n \n ],\n \"ActivationInterval\": null,\n \"Attributes\": [\n {\n \"FilterIDs\": null,\n \"FieldName\": \"Category\",\n \"Type\": \"*constant\",\n \"Value\": [\n {\n \"Rules\": \"call-out\",\n \"AllFiltersMatch\": true\n }\n ]\n }\n \n ],\n \"Blocker\": false,\n \"Weight\": 10\n }\n ],\n \"id\": 2\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -943,7 +943,7 @@ "name": "TpActionsPlans", "item": [ { - "name": "ApierV1. GetTPActionPlanIds", + "name": "APIerSv1. GetTPActionPlanIds", "request": { "auth": { "type": "noauth" @@ -957,7 +957,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.GetTPActionPlanIds\",\n \"params\": [\n {\n \"TPid\": \"CGR_API_TESTS\" \n \n }\n ]\n}" + "raw": "{\n \"method\": \"APIerSv1.GetTPActionPlanIds\",\n \"params\": [\n {\n \"TPid\": \"CGR_API_TESTS\" \n \n }\n ]\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -972,7 +972,7 @@ "response": [] }, { - "name": "ApierV1.SetTPActionPlan", + "name": "APIerSv1.SetTPActionPlan", "request": { "auth": { "type": "noauth" @@ -986,7 +986,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.SetTPActionPlan\",\n \"params\": [\n {\n \"TPid\": \"CGR_API_TESTS\" , \n \t\t\"ID\": \"always\" , \n\t\t\t\"ActionPlan\" : [\n\t\t \t{\n\t\t \t\t\"ActionsId\" : \"fafsafa\",\n \t\t\t\"TimingId\" : \"*any\",\n \t\t\t\"Weight\" : 10\t\n\t\t \t}\n\t\t \t]\n }\n ]\n}" + "raw": "{\n \"method\": \"APIerSv1.SetTPActionPlan\",\n \"params\": [\n {\n \"TPid\": \"CGR_API_TESTS\" , \n \t\t\"ID\": \"always\" , \n\t\t\t\"ActionPlan\" : [\n\t\t \t{\n\t\t \t\t\"ActionsId\" : \"fafsafa\",\n \t\t\t\"TimingId\" : \"*any\",\n \t\t\t\"Weight\" : 10\t\n\t\t \t}\n\t\t \t]\n }\n ]\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -1001,7 +1001,7 @@ "response": [] }, { - "name": "ApierV1. GetTPActionPlan", + "name": "APIerSv1. GetTPActionPlan", "request": { "auth": { "type": "noauth" @@ -1015,7 +1015,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.GetTPActionPlan\",\n \"params\": [\n {\n \"TPid\": \"CGR_API_TESTS\" , \n \t\t\"ID\": \"always\" \n }\n ]\n}" + "raw": "{\n \"method\": \"APIerSv1.GetTPActionPlan\",\n \"params\": [\n {\n \"TPid\": \"CGR_API_TESTS\" , \n \t\t\"ID\": \"always\" \n }\n ]\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -1030,7 +1030,7 @@ "response": [] }, { - "name": "ApierV1. RemoveTPActionPlan", + "name": "APIerSv1. RemoveTPActionPlan", "request": { "auth": { "type": "noauth" @@ -1044,7 +1044,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.RemoveTPActionPlan\",\n \"params\": [\n {\n \"TPid\":\"CGR_API_TESTS\",\n \"ID\":\"always\"\n \n }\n ]\n}" + "raw": "{\n \"method\": \"APIerSv1.RemoveTPActionPlan\",\n \"params\": [\n {\n \"TPid\":\"CGR_API_TESTS\",\n \"ID\":\"always\"\n \n }\n ]\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -1063,7 +1063,7 @@ "_postman_isSubFolder": true }, { - "name": "ApierV1.GetAccountActionPlan", + "name": "APIerSv1.GetAccountActionPlan", "request": { "auth": { "type": "noauth" @@ -1077,7 +1077,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.GetAccountActionPlan\",\n \"params\": [\n {\n \"Tenant\": \"cgrates.org\",\n \"Account\": \"+30xxxxxxxxxx\"\n \n }\n ]\n}" + "raw": "{\n \"method\": \"APIerSv1.GetAccountActionPlan\",\n \"params\": [\n {\n \"Tenant\": \"cgrates.org\",\n \"Account\": \"+30xxxxxxxxxx\"\n \n }\n ]\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -1092,7 +1092,7 @@ "response": [] }, { - "name": "ApierV1.GetActionPlan", + "name": "APIerSv1.GetActionPlan", "request": { "auth": { "type": "noauth" @@ -1106,7 +1106,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.GetActionPlan\",\n \"params\": [\n {\n \"Id\": \"AP_PACKAGE_10\"\n \n }\n ]\n}" + "raw": "{\n \"method\": \"APIerSv1.GetActionPlan\",\n \"params\": [\n {\n \"Id\": \"AP_PACKAGE_10\"\n \n }\n ]\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -1121,7 +1121,7 @@ "response": [] }, { - "name": "ApierV1.GetActionPlanIDs", + "name": "APIerSv1.GetActionPlanIDs", "request": { "auth": { "type": "noauth" @@ -1137,7 +1137,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.GetActionPlanIDs\",\n \"params\": [\n {\n \"Tenant\": \"cgrates.org\",\n \"Limit\": null,\n \"Offset\": null\n }\n ],\n \"id\": 10\n}", + "raw": "{\n \"method\": \"APIerSv1.GetActionPlanIDs\",\n \"params\": [\n {\n \"Tenant\": \"cgrates.org\",\n \"Limit\": null,\n \"Offset\": null\n }\n ],\n \"id\": 10\n}", "options": { "raw": { "language": "json" @@ -1157,7 +1157,7 @@ "response": [] }, { - "name": "ApierV1.RemoveActionTiming (Remove ActionPlan From Account)", + "name": "APIerSv1.RemoveActionTiming (Remove ActionPlan From Account)", "request": { "auth": { "type": "noauth" @@ -1171,7 +1171,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.RemoveActionTiming\",\n \"params\": [\n {\n \"ActionPlanId\": \"AP_VOICE_PACKAGE_200\",\n \"ActionTimingId\": \"\",\n \"Tenant\": \"sip.TEST_SUPPLIER_NAME.gr\",\n \"Account\": \"+30xxxxxxxxx\",\n \"ReloadScheduler\": true\n \n }\n ]\n}" + "raw": "{\n \"method\": \"APIerSv1.RemoveActionTiming\",\n \"params\": [\n {\n \"ActionPlanId\": \"AP_VOICE_PACKAGE_200\",\n \"ActionTimingId\": \"\",\n \"Tenant\": \"sip.TEST_SUPPLIER_NAME.gr\",\n \"Account\": \"+30xxxxxxxxx\",\n \"ReloadScheduler\": true\n \n }\n ]\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -1192,7 +1192,7 @@ "name": "Accounts", "item": [ { - "name": "ApierV2.GetAccounts", + "name": "APIerSv2.GetAccounts", "request": { "auth": { "type": "noauth" @@ -1206,7 +1206,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV2.GetAccounts\",\n \"params\": [\n {\n \"Tenant\": \"cgrates.org\"\n }\n ]\n}" + "raw": "{\n \"method\": \"APIerSv2.GetAccounts\",\n \"params\": [\n {\n \"Tenant\": \"cgrates.org\"\n }\n ]\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -1221,7 +1221,7 @@ "response": [] }, { - "name": "ApierV2.SetAccount", + "name": "APIerSv2.SetAccount", "request": { "auth": { "type": "noauth" @@ -1235,7 +1235,7 @@ ], "body": { "mode": "raw", - "raw": "{\"method\": \"ApierV2.SetAccount\",\n \"params\": [{\n \"Tenant\": \"cgrates.org\", \n \"Account\": \"+30xxxxxxxxx\", \n \"ActionPlanIDs\": [\"ACP_+30xxxxxxxxx_TOPUP_PKG_1000_GR\"], \n \"ActionPlansOverwrite\": true,\n \"AllowNegative\": false,\n \"Disabled\": false,\n \"ReloadScheduler\": true \n }]\n}" + "raw": "{\"method\": \"APIerSv2.SetAccount\",\n \"params\": [{\n \"Tenant\": \"cgrates.org\", \n \"Account\": \"+30xxxxxxxxx\", \n \"ActionPlanIDs\": [\"ACP_+30xxxxxxxxx_TOPUP_PKG_1000_GR\"], \n \"ActionPlansOverwrite\": true,\n \"AllowNegative\": false,\n \"Disabled\": false,\n \"ReloadScheduler\": true \n }]\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -1250,7 +1250,7 @@ "response": [] }, { - "name": "ApierV2.GetAccount", + "name": "APIerSv2.GetAccount", "request": { "auth": { "type": "noauth" @@ -1264,7 +1264,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV2.GetAccount\",\n \"params\": [\n {\n \"Tenant\": \"cgrates.org\",\n \"Account\": \"+30xxxxxxxxx\"\n }\n ]\n}" + "raw": "{\n \"method\": \"APIerSv2.GetAccount\",\n \"params\": [\n {\n \"Tenant\": \"cgrates.org\",\n \"Account\": \"+30xxxxxxxxx\"\n }\n ]\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -1279,7 +1279,7 @@ "response": [] }, { - "name": "ApierV1.RemoveAccount", + "name": "APIerSv1.RemoveAccount", "request": { "auth": { "type": "noauth" @@ -1293,7 +1293,7 @@ ], "body": { "mode": "raw", - "raw": "{\"method\": \"ApierV1.RemoveAccount\",\n \"params\": [{\n \"Tenant\": \"cgrates.org\", \n \"Account\": \"1003\", \n \"ReloadScheduler\": true\n }]\n}" + "raw": "{\"method\": \"APIerSv1.RemoveAccount\",\n \"params\": [{\n \"Tenant\": \"cgrates.org\", \n \"Account\": \"1003\", \n \"ReloadScheduler\": true\n }]\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -1308,7 +1308,7 @@ "response": [] }, { - "name": "ApierV1.SetAccount", + "name": "APIerSv1.SetAccount", "request": { "auth": { "type": "noauth" @@ -1322,7 +1322,7 @@ ], "body": { "mode": "raw", - "raw": "{\"method\": \"ApierV1.SetAccount\",\n \"params\": [{\n \"Tenant\": \"cgrates.org\", \n \"Account\": \"+30xxxxxxxxx\", \n \"ActionPlanId\": \"ACP_+30xxxxxxxxx_TOPUP_PKG_1000_GR\", \n \"AllowNegative\": false,\n \"Disabled\": false,\n \"ReloadScheduler\": true \n }]\n}" + "raw": "{\"method\": \"APIerSv1.SetAccount\",\n \"params\": [{\n \"Tenant\": \"cgrates.org\", \n \"Account\": \"+30xxxxxxxxx\", \n \"ActionPlanId\": \"ACP_+30xxxxxxxxx_TOPUP_PKG_1000_GR\", \n \"AllowNegative\": false,\n \"Disabled\": false,\n \"ReloadScheduler\": true \n }]\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -1337,7 +1337,7 @@ "response": [] }, { - "name": "ApierV1.GetAccount", + "name": "APIerSv1.GetAccount", "request": { "auth": { "type": "noauth" @@ -1351,7 +1351,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.GetAccount\",\n \"params\": [\n {\n \"Tenant\": \"cgrates.org\",\n \"Account\": \"+30xxxxxxxxx\"\n }\n ]\n}" + "raw": "{\n \"method\": \"APIerSv1.GetAccount\",\n \"params\": [\n {\n \"Tenant\": \"cgrates.org\",\n \"Account\": \"+30xxxxxxxxx\"\n }\n ]\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -1366,7 +1366,7 @@ "response": [] }, { - "name": "ApierV1.GetAccountActionPlan", + "name": "APIerSv1.GetAccountActionPlan", "request": { "auth": { "type": "noauth" @@ -1380,7 +1380,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.GetAccountActionPlan\",\n \"params\": [\n {\n \"Tenant\": \"cgrates.org\",\n \"Account\": \"+30xxxxxxxxxx\"\n \n }\n ]\n}" + "raw": "{\n \"method\": \"APIerSv1.GetAccountActionPlan\",\n \"params\": [\n {\n \"Tenant\": \"cgrates.org\",\n \"Account\": \"+30xxxxxxxxxx\"\n \n }\n ]\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -1524,7 +1524,7 @@ "_postman_isSubFolder": true }, { - "name": "ApierV2.GetAccount (Get Account Balances)", + "name": "APIerSv2.GetAccount (Get Account Balances)", "request": { "auth": { "type": "noauth" @@ -1538,7 +1538,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV2.GetAccount\",\n \"params\": [\n {\n \"Tenant\": \"cgrates.org\",\n \"Account\": \"+30xxxxxxxxx\"\n }\n ]\n}" + "raw": "{\n \"method\": \"APIerSv2.GetAccount\",\n \"params\": [\n {\n \"Tenant\": \"cgrates.org\",\n \"Account\": \"+30xxxxxxxxx\"\n }\n ]\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -1553,7 +1553,7 @@ "response": [] }, { - "name": "ApierV1.AddBalance *monetary", + "name": "APIerSv1.AddBalance *monetary", "request": { "auth": { "type": "noauth" @@ -1567,7 +1567,7 @@ ], "body": { "mode": "raw", - "raw": "{\r\n \"method\": \"ApierV1.AddBalance\",\r\n \"params\": [{\r\n \"Tenant\": \"cgrates.org\",\r\n \"Account\": \"test\",\r\n \"BalanceType\": \"*monetary\",\r\n \"BalanceUUID\": \"883a8cb2-659b-4353-a939-7d90565e3332\",\r\n \"BalanceID\": \"WALLET100\",\r\n \"Directions\": null,\r\n \"Value\": 100,\r\n \"ExpiryTime\": \"*unlimited\",\r\n \"RatingSubject\": null,\r\n \"Categories\": null,\r\n \"DestinationIds\": \"test;test1\",\r\n \"TimingIds\": \"*any\",\r\n \"Weight\": 10,\r\n \"SharedGroups\": null,\r\n \"Overwrite\": true,\r\n \"Blocker\": false,\r\n \"Disabled\": false,\r\n \"Cdrlog\" : true\r\n }\r\n \r\n ],\r\n \"id\": 6\r\n}" + "raw": "{\r\n \"method\": \"APIerSv1.AddBalance\",\r\n \"params\": [{\r\n \"Tenant\": \"cgrates.org\",\r\n \"Account\": \"test\",\r\n \"BalanceType\": \"*monetary\",\r\n \"BalanceUUID\": \"883a8cb2-659b-4353-a939-7d90565e3332\",\r\n \"BalanceID\": \"WALLET100\",\r\n \"Directions\": null,\r\n \"Value\": 100,\r\n \"ExpiryTime\": \"*unlimited\",\r\n \"RatingSubject\": null,\r\n \"Categories\": null,\r\n \"DestinationIds\": \"test;test1\",\r\n \"TimingIds\": \"*any\",\r\n \"Weight\": 10,\r\n \"SharedGroups\": null,\r\n \"Overwrite\": true,\r\n \"Blocker\": false,\r\n \"Disabled\": false,\r\n \"Cdrlog\" : true\r\n }\r\n \r\n ],\r\n \"id\": 6\r\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -1582,7 +1582,7 @@ "response": [] }, { - "name": "ApierV1.AddBalance *voice ONLY", + "name": "APIerSv1.AddBalance *voice ONLY", "request": { "auth": { "type": "noauth" @@ -1596,7 +1596,7 @@ ], "body": { "mode": "raw", - "raw": "{\r\n \"method\": \"ApierV1.AddBalance\",\r\n \"params\": [{\r\n \"Tenant\": \"cgrates.org\",\r\n \"Account\": \"+30xxxxxxxxx\",\r\n \"BalanceType\": \"*voice1\",\r\n \"BalanceUUID\": \"883a8cb2-659b-4353-a939-7d90565e3331\",\r\n \"BalanceID\": \"BalanceID1\",\r\n \"Directions\": null,\r\n \"Value\": 100,\r\n \"ExpiryTime\": \"*unlimited\",\r\n \"RatingSubject\": null,\r\n \"Categories\": null,\r\n \"DestinationIds\": \"*any\",\r\n \"TimingIds\": \"*any\",\r\n \"Weight\": 10,\r\n \"SharedGroups\": null,\r\n \"Overwrite\": true,\r\n \"Blocker\": false,\r\n \"Disabled\": false,\r\n \"Cdrlog\" : true\r\n }\r\n \r\n ],\r\n \"id\": 6\r\n}" + "raw": "{\r\n \"method\": \"APIerSv1.AddBalance\",\r\n \"params\": [{\r\n \"Tenant\": \"cgrates.org\",\r\n \"Account\": \"+30xxxxxxxxx\",\r\n \"BalanceType\": \"*voice1\",\r\n \"BalanceUUID\": \"883a8cb2-659b-4353-a939-7d90565e3331\",\r\n \"BalanceID\": \"BalanceID1\",\r\n \"Directions\": null,\r\n \"Value\": 100,\r\n \"ExpiryTime\": \"*unlimited\",\r\n \"RatingSubject\": null,\r\n \"Categories\": null,\r\n \"DestinationIds\": \"*any\",\r\n \"TimingIds\": \"*any\",\r\n \"Weight\": 10,\r\n \"SharedGroups\": null,\r\n \"Overwrite\": true,\r\n \"Blocker\": false,\r\n \"Disabled\": false,\r\n \"Cdrlog\" : true\r\n }\r\n \r\n ],\r\n \"id\": 6\r\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -1611,7 +1611,7 @@ "response": [] }, { - "name": "ApierV1.AddBalance both test Copy", + "name": "APIerSv1.AddBalance both test Copy", "request": { "auth": { "type": "noauth" @@ -1625,7 +1625,7 @@ ], "body": { "mode": "raw", - "raw": "{\r\n \"method\": \"ApierV1.AddBalance\",\r\n \"params\": [\r\n \t {\r\n \"Tenant\": \"cgrates.org\",\r\n \"Account\": \"+30xxxxxxxxx\",\r\n \"BalanceType\": \"*voice\",\r\n \"BalanceUUID\": \"e11ae605-9ca1-402d-930c-581893e54f33\",\r\n \"BalanceID\": null,\r\n \"Directions\": \"*out\",\r\n \"Value\": 30000000000000,\r\n \"ExpiryTime\": \"*unlimited\",\r\n \"RatingSubject\": null,\r\n \"Categories\": null,\r\n \"DestinationIds\": \"DST_+30xxxxxxxxxx\",\r\n \"TimingIds\": \"*any\",\r\n \"Weight\": 20,\r\n \"SharedGroups\": null,\r\n \"Overwrite\": true,\r\n \"Blocker\": false,\r\n \"Disabled\": false,\r\n \"Cdrlog\" : true\r\n }\r\n ],\r\n \"id\": 6\r\n}" + "raw": "{\r\n \"method\": \"APIerSv1.AddBalance\",\r\n \"params\": [\r\n \t {\r\n \"Tenant\": \"cgrates.org\",\r\n \"Account\": \"+30xxxxxxxxx\",\r\n \"BalanceType\": \"*voice\",\r\n \"BalanceUUID\": \"e11ae605-9ca1-402d-930c-581893e54f33\",\r\n \"BalanceID\": null,\r\n \"Directions\": \"*out\",\r\n \"Value\": 30000000000000,\r\n \"ExpiryTime\": \"*unlimited\",\r\n \"RatingSubject\": null,\r\n \"Categories\": null,\r\n \"DestinationIds\": \"DST_+30xxxxxxxxxx\",\r\n \"TimingIds\": \"*any\",\r\n \"Weight\": 20,\r\n \"SharedGroups\": null,\r\n \"Overwrite\": true,\r\n \"Blocker\": false,\r\n \"Disabled\": false,\r\n \"Cdrlog\" : true\r\n }\r\n ],\r\n \"id\": 6\r\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -1640,7 +1640,7 @@ "response": [] }, { - "name": "ApierV1.SetBalance *Monetary", + "name": "APIerSv1.SetBalance *Monetary", "request": { "auth": { "type": "noauth" @@ -1654,7 +1654,7 @@ ], "body": { "mode": "raw", - "raw": "{\r\n \"method\": \"ApierV1.SetBalance\",\r\n \"params\": [{\r\n \"Tenant\": \"cgrates.org\",\r\n \"Account\": \"+30xxxxxxxxx\",\r\n \"BalanceType\": \"*monetary\",\r\n \"BalanceUUID\": null,\r\n \"BalanceID\": \"balance1\",\r\n \"Directions\": null,\r\n \"Value\": 100,\r\n \"ExpiryTime\": null,\r\n \"RatingSubject\": null,\r\n \"Categories\": null,\r\n \"DestinationIds\": null,\r\n \"TimingIds\": null,\r\n \"Weight\": null,\r\n \"SharedGroups\": null,\r\n \"Blocker\": null,\r\n \"Disabled\": null\r\n }],\r\n \"id\": 6\r\n}" + "raw": "{\r\n \"method\": \"APIerSv1.SetBalance\",\r\n \"params\": [{\r\n \"Tenant\": \"cgrates.org\",\r\n \"Account\": \"+30xxxxxxxxx\",\r\n \"BalanceType\": \"*monetary\",\r\n \"BalanceUUID\": null,\r\n \"BalanceID\": \"balance1\",\r\n \"Directions\": null,\r\n \"Value\": 100,\r\n \"ExpiryTime\": null,\r\n \"RatingSubject\": null,\r\n \"Categories\": null,\r\n \"DestinationIds\": null,\r\n \"TimingIds\": null,\r\n \"Weight\": null,\r\n \"SharedGroups\": null,\r\n \"Blocker\": null,\r\n \"Disabled\": null\r\n }],\r\n \"id\": 6\r\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -1669,7 +1669,7 @@ "response": [] }, { - "name": "ApierV1.SetBalance *Voice", + "name": "APIerSv1.SetBalance *Voice", "request": { "auth": { "type": "noauth" @@ -1683,7 +1683,7 @@ ], "body": { "mode": "raw", - "raw": "{\r\n \"method\": \"ApierV1.SetBalance\",\r\n \"params\": [{\r\n \"Tenant\": \"cgrates.org\",\r\n \"Account\": \"+30xxxxxxxxx\",\r\n \"BalanceType\": \"*voice\",\r\n \"BalanceUUID\": \"5a2fb811-1694-46bf-8066-6065a849ecf8\",\r\n \"BalanceID\": \"\",\r\n \"Directions\": \"*out\",\r\n \"Value\": 1000000,\r\n \"ExpiryTime\": null,\r\n \"RatingSubject\": null,\r\n \"Categories\": null,\r\n \"DestinationIds\": \"DST_+30xxxxxxxxxx\",\r\n \"TimingIds\": null,\r\n \"Weight\": 10,\r\n \"SharedGroups\": null,\r\n \"Blocker\": null,\r\n \"Disabled\": null\r\n }],\r\n \"id\": 6\r\n}\r\n\r\n\r\n\r\n\r\n\r\n\r\n " + "raw": "{\r\n \"method\": \"APIerSv1.SetBalance\",\r\n \"params\": [{\r\n \"Tenant\": \"cgrates.org\",\r\n \"Account\": \"+30xxxxxxxxx\",\r\n \"BalanceType\": \"*voice\",\r\n \"BalanceUUID\": \"5a2fb811-1694-46bf-8066-6065a849ecf8\",\r\n \"BalanceID\": \"\",\r\n \"Directions\": \"*out\",\r\n \"Value\": 1000000,\r\n \"ExpiryTime\": null,\r\n \"RatingSubject\": null,\r\n \"Categories\": null,\r\n \"DestinationIds\": \"DST_+30xxxxxxxxxx\",\r\n \"TimingIds\": null,\r\n \"Weight\": 10,\r\n \"SharedGroups\": null,\r\n \"Blocker\": null,\r\n \"Disabled\": null\r\n }],\r\n \"id\": 6\r\n}\r\n\r\n\r\n\r\n\r\n\r\n\r\n " }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -1698,7 +1698,7 @@ "response": [] }, { - "name": "ApierV1.DebitBalance", + "name": "APIerSv1.DebitBalance", "request": { "auth": { "type": "noauth" @@ -1712,7 +1712,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.DebitBalance\",\n \"params\": [{\n \"Tenant\": \"cgrates.org\",\n \"Account\": \"+30xxxxxxxxx\",\n \"BalanceUuid\": \"e9c0a7f4-8904-481d-8b2d-a08d9a2b311c\",\n \"BalanceId\": \"23456\",\n \"BalanceType\": \"*monetary\",\n \"Directions\": null,\n \"Value\": 8,\n \"ExpiryTime\": null,\n \"RatingSubject\": null,\n \"Categories\": null,\n \"DestinationIds\": null,\n \"TimingIds\": null,\n \"Weight\": null,\n \"SharedGroups\": null,\n \"Overwrite\": false,\n \"Blocker\": null,\n \"Disabled\": null,\n \"Cdrlog\": null,\n \t\"ExtraData\": null\n \t\t\n }],\n \"id\": 5\n}" + "raw": "{\n \"method\": \"APIerSv1.DebitBalance\",\n \"params\": [{\n \"Tenant\": \"cgrates.org\",\n \"Account\": \"+30xxxxxxxxx\",\n \"BalanceUuid\": \"e9c0a7f4-8904-481d-8b2d-a08d9a2b311c\",\n \"BalanceId\": \"23456\",\n \"BalanceType\": \"*monetary\",\n \"Directions\": null,\n \"Value\": 8,\n \"ExpiryTime\": null,\n \"RatingSubject\": null,\n \"Categories\": null,\n \"DestinationIds\": null,\n \"TimingIds\": null,\n \"Weight\": null,\n \"SharedGroups\": null,\n \"Overwrite\": false,\n \"Blocker\": null,\n \"Disabled\": null,\n \"Cdrlog\": null,\n \t\"ExtraData\": null\n \t\t\n }],\n \"id\": 5\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -1727,7 +1727,7 @@ "response": [] }, { - "name": "ApierV1.SetBalance *Voice Incoming Calls", + "name": "APIerSv1.SetBalance *Voice Incoming Calls", "request": { "auth": { "type": "noauth" @@ -1741,7 +1741,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.SetBalance\",\n \"params\": [{\n \"Tenant\": \"cgrates.org\",\n \"Account\": \"+30xxxxxxxxxx\",\n \"BalanceType\": \"*voice\",\n \"BalanceUUID\": null,\n \"BalanceID\": \"9d867c57-31b4-407d-afc7-fb4dc359ae4\",\n \"Directions\": \"*out\",\n \"Value\": 600,\n \"ExpiryTime\": null,\n \"RatingSubject\": null,\n \"Categories\": null,\n \"DestinationIds\": null,\n \"TimingIds\": null,\n \"Weight\": null,\n \"SharedGroups\": null,\n \"Blocker\": null,\n \"Disabled\": null\n }],\n \"id\": 28\n}\n" + "raw": "{\n \"method\": \"APIerSv1.SetBalance\",\n \"params\": [{\n \"Tenant\": \"cgrates.org\",\n \"Account\": \"+30xxxxxxxxxx\",\n \"BalanceType\": \"*voice\",\n \"BalanceUUID\": null,\n \"BalanceID\": \"9d867c57-31b4-407d-afc7-fb4dc359ae4\",\n \"Directions\": \"*out\",\n \"Value\": 600,\n \"ExpiryTime\": null,\n \"RatingSubject\": null,\n \"Categories\": null,\n \"DestinationIds\": null,\n \"TimingIds\": null,\n \"Weight\": null,\n \"SharedGroups\": null,\n \"Blocker\": null,\n \"Disabled\": null\n }],\n \"id\": 28\n}\n" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -1756,7 +1756,7 @@ "response": [] }, { - "name": "ApierV1.RemoveBalances *monetary", + "name": "APIerSv1.RemoveBalances *monetary", "request": { "auth": { "type": "noauth" @@ -1770,7 +1770,7 @@ ], "body": { "mode": "raw", - "raw": "{\r\n \"method\": \"ApierV1.RemoveBalances\",\r\n \"params\": [{\r\n \"Tenant\": \"cgrates.org\",\r\n \"Account\": \"test\",\r\n \"BalanceType\": \"*monetary\",\r\n \"BalanceUUID\": \"914e1dc3-2e44-458d-9fb6-6365bdd9da3d\",\r\n \"BalanceID\": \"WALLET100\",\r\n \"Directions\": null,\r\n \"Value\": 100,\r\n \"ExpiryTime\": \"*unlimited\",\r\n \"RatingSubject\": null,\r\n \"Categories\": null,\r\n \"DestinationIds\": \"test;test1\",\r\n \"TimingIds\": \"*any\",\r\n \"Weight\": 10,\r\n \"SharedGroups\": null,\r\n \"Blocker\": false,\r\n \"Disabled\": false\r\n }],\r\n \"id\": 6\r\n}\r\n\r\n" + "raw": "{\r\n \"method\": \"APIerSv1.RemoveBalances\",\r\n \"params\": [{\r\n \"Tenant\": \"cgrates.org\",\r\n \"Account\": \"test\",\r\n \"BalanceType\": \"*monetary\",\r\n \"BalanceUUID\": \"914e1dc3-2e44-458d-9fb6-6365bdd9da3d\",\r\n \"BalanceID\": \"WALLET100\",\r\n \"Directions\": null,\r\n \"Value\": 100,\r\n \"ExpiryTime\": \"*unlimited\",\r\n \"RatingSubject\": null,\r\n \"Categories\": null,\r\n \"DestinationIds\": \"test;test1\",\r\n \"TimingIds\": \"*any\",\r\n \"Weight\": 10,\r\n \"SharedGroups\": null,\r\n \"Blocker\": false,\r\n \"Disabled\": false\r\n }],\r\n \"id\": 6\r\n}\r\n\r\n" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -1785,7 +1785,7 @@ "response": [] }, { - "name": "ApierV1.RemoveBalances *voice", + "name": "APIerSv1.RemoveBalances *voice", "request": { "auth": { "type": "noauth" @@ -1799,7 +1799,7 @@ ], "body": { "mode": "raw", - "raw": "{\r\n \"method\": \"ApierV1.RemoveBalances\",\r\n \"params\": [{\r\n \"Tenant\": \"cgrates.org\",\r\n \"Account\": \"+30xxxxxxxxx\",\r\n \"BalanceType\": \"*voice\",\r\n \"BalanceUUID\": null,\r\n \"BalanceID\": null,\r\n \"Directions\": null,\r\n \"Value\": null,\r\n \"ExpiryTime\": null,\r\n \"RatingSubject\": null,\r\n \"Categories\": null,\r\n \"DestinationIds\": null,\r\n \"TimingIds\": null,\r\n \"Weight\": null,\r\n \"SharedGroups\": null,\r\n \"Blocker\": null,\r\n \"Disabled\": null\r\n }],\r\n \"id\": 6\r\n}\r\n\r\n" + "raw": "{\r\n \"method\": \"APIerSv1.RemoveBalances\",\r\n \"params\": [{\r\n \"Tenant\": \"cgrates.org\",\r\n \"Account\": \"+30xxxxxxxxx\",\r\n \"BalanceType\": \"*voice\",\r\n \"BalanceUUID\": null,\r\n \"BalanceID\": null,\r\n \"Directions\": null,\r\n \"Value\": null,\r\n \"ExpiryTime\": null,\r\n \"RatingSubject\": null,\r\n \"Categories\": null,\r\n \"DestinationIds\": null,\r\n \"TimingIds\": null,\r\n \"Weight\": null,\r\n \"SharedGroups\": null,\r\n \"Blocker\": null,\r\n \"Disabled\": null\r\n }],\r\n \"id\": 6\r\n}\r\n\r\n" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -1820,7 +1820,7 @@ "name": "CDRs", "item": [ { - "name": "ApierV2.GetCdrs", + "name": "APIerSv2.GetCdrs", "request": { "auth": { "type": "noauth" @@ -1834,7 +1834,7 @@ ], "body": { "mode": "raw", - "raw": "{\r\n \"id\":\"11111\",\r\n \"method\":\"ApierV2.GetCDRs\",\r\n \"params\":[\r\n {\r\n\t\"RunIDs\":[\"CustomerCharges\"],\r\n\t\"Tenants\":[\"cgrates.org\"],\r\n \"Accounts\":[\"+30xxxxxxxxxx\"],\r\n \"Category\": [\"call-in\"]\r\n }\r\n ]\r\n}" + "raw": "{\r\n \"id\":\"11111\",\r\n \"method\":\"APIerSv2.GetCDRs\",\r\n \"params\":[\r\n {\r\n\t\"RunIDs\":[\"CustomerCharges\"],\r\n\t\"Tenants\":[\"cgrates.org\"],\r\n \"Accounts\":[\"+30xxxxxxxxxx\"],\r\n \"Category\": [\"call-in\"]\r\n }\r\n ]\r\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -1849,7 +1849,7 @@ "response": [] }, { - "name": "ApierV2.GetCdrs ALL From Tenant", + "name": "APIerSv2.GetCdrs ALL From Tenant", "request": { "auth": { "type": "noauth" @@ -1863,7 +1863,7 @@ ], "body": { "mode": "raw", - "raw": "{\r\n \"id\":\"11111\",\r\n \"method\":\"ApierV2.GetCDRs\",\r\n \"params\":[\r\n {\r\n\t\"Tenants\":[\"cgrates.org\"],\r\n\t\"Accounts\":[\"+30xxxxxxxxx\"]\r\n\r\n\r\n }\r\n ]\r\n}" + "raw": "{\r\n \"id\":\"11111\",\r\n \"method\":\"APIerSv2.GetCDRs\",\r\n \"params\":[\r\n {\r\n\t\"Tenants\":[\"cgrates.org\"],\r\n\t\"Accounts\":[\"+30xxxxxxxxx\"]\r\n\r\n\r\n }\r\n ]\r\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -1878,7 +1878,7 @@ "response": [] }, { - "name": "ApierV2.GetCdrs - SPL_TEST_SUPPLIER_NAME getALL", + "name": "APIerSv2.GetCdrs - SPL_TEST_SUPPLIER_NAME getALL", "request": { "auth": { "type": "noauth" @@ -1892,7 +1892,7 @@ ], "body": { "mode": "raw", - "raw": "{\r\n \"id\":\"11111\",\r\n \"method\":\"ApierV2.GetCDRs\",\r\n \"params\":[\r\n {\r\n\t\"RunIDs\":[\"SPL_TEST_SUPPLIER_NAME\"],\r\n\t\"Tenants\":[\"cgrates.org\"],\r\n \"Accounts\":[\"+30xxxxxxxxxx\"]\r\n\r\n }\r\n ]\r\n}" + "raw": "{\r\n \"id\":\"11111\",\r\n \"method\":\"APIerSv2.GetCDRs\",\r\n \"params\":[\r\n {\r\n\t\"RunIDs\":[\"SPL_TEST_SUPPLIER_NAME\"],\r\n\t\"Tenants\":[\"cgrates.org\"],\r\n \"Accounts\":[\"+30xxxxxxxxxx\"]\r\n\r\n }\r\n ]\r\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -1907,7 +1907,7 @@ "response": [] }, { - "name": "ApierV2.GetCdrs - CustomerCharges getALL", + "name": "APIerSv2.GetCdrs - CustomerCharges getALL", "request": { "auth": { "type": "noauth" @@ -1921,7 +1921,7 @@ ], "body": { "mode": "raw", - "raw": "{\r\n \"id\":\"11111\",\r\n \"method\":\"ApierV2.GetCDRs\",\r\n \"params\":[\r\n {\r\n\t\"RunIDs\":[\"CustomerCharges\"],\r\n\t\"Tenants\":[\"cgrates.org\"],\r\n \"Accounts\":[\"+30xxxxxxxxx\"]\r\n\r\n }\r\n ]\r\n}" + "raw": "{\r\n \"id\":\"11111\",\r\n \"method\":\"APIerSv2.GetCDRs\",\r\n \"params\":[\r\n {\r\n\t\"RunIDs\":[\"CustomerCharges\"],\r\n\t\"Tenants\":[\"cgrates.org\"],\r\n \"Accounts\":[\"+30xxxxxxxxx\"]\r\n\r\n }\r\n ]\r\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -1936,7 +1936,7 @@ "response": [] }, { - "name": "ApierV2.GetCdrs - CustomerCharges", + "name": "APIerSv2.GetCdrs - CustomerCharges", "request": { "auth": { "type": "noauth" @@ -1950,7 +1950,7 @@ ], "body": { "mode": "raw", - "raw": "{\r\n \"id\":\"11111\",\r\n \"method\":\"ApierV2.GetCDRs\",\r\n \"params\":[\r\n {\r\n\t\"RunIDs\":[\"CustomerCharges\"],\r\n\t\"Tenants\":[\"cgrates.org\"],\r\n \"Accounts\":[\"+30xxxxxxxxx\"],\r\n \"Categories\": [\"call-out\"]\r\n \r\n }\r\n ]\r\n}" + "raw": "{\r\n \"id\":\"11111\",\r\n \"method\":\"APIerSv2.GetCDRs\",\r\n \"params\":[\r\n {\r\n\t\"RunIDs\":[\"CustomerCharges\"],\r\n\t\"Tenants\":[\"cgrates.org\"],\r\n \"Accounts\":[\"+30xxxxxxxxx\"],\r\n \"Categories\": [\"call-out\"]\r\n \r\n }\r\n ]\r\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -1965,7 +1965,7 @@ "response": [] }, { - "name": "ApierV2.GetCdrs - CustomerCharges INBOUND - INTERNAL-IN", + "name": "APIerSv2.GetCdrs - CustomerCharges INBOUND - INTERNAL-IN", "request": { "auth": { "type": "noauth" @@ -1979,7 +1979,7 @@ ], "body": { "mode": "raw", - "raw": "{\r\n \"id\":\"11111\",\r\n \"method\":\"ApierV2.GetCDRs\",\r\n \"params\":[\r\n {\r\n\t\"RunIDs\":[\"CustomerCharges\"],\r\n\t\"Tenants\":[\"cgrates.org\"],\r\n \"Accounts\":[\"+30xxxxxxxxxx\"],\r\n \"Categories\": [\"call-in\"],\r\n \"Subjects\": [\"INTERNAL-IN\"]\r\n }\r\n ]\r\n}" + "raw": "{\r\n \"id\":\"11111\",\r\n \"method\":\"APIerSv2.GetCDRs\",\r\n \"params\":[\r\n {\r\n\t\"RunIDs\":[\"CustomerCharges\"],\r\n\t\"Tenants\":[\"cgrates.org\"],\r\n \"Accounts\":[\"+30xxxxxxxxxx\"],\r\n \"Categories\": [\"call-in\"],\r\n \"Subjects\": [\"INTERNAL-IN\"]\r\n }\r\n ]\r\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -1994,7 +1994,7 @@ "response": [] }, { - "name": "ApierV2.GetCdrs - SupplierCharges getALL", + "name": "APIerSv2.GetCdrs - SupplierCharges getALL", "request": { "auth": { "type": "noauth" @@ -2008,7 +2008,7 @@ ], "body": { "mode": "raw", - "raw": "{\r\n \"id\":\"11111\",\r\n \"method\":\"ApierV2.GetCDRs\",\r\n \"params\":[\r\n {\r\n\t\"RunIDs\":[\"SupplierCharges\"],\r\n\t\"Tenants\":[\"cgrates.org\"],\r\n \"Accounts\":[\"+30xxxxxxxxx\"]\r\n }\r\n ]\r\n}" + "raw": "{\r\n \"id\":\"11111\",\r\n \"method\":\"APIerSv2.GetCDRs\",\r\n \"params\":[\r\n {\r\n\t\"RunIDs\":[\"SupplierCharges\"],\r\n\t\"Tenants\":[\"cgrates.org\"],\r\n \"Accounts\":[\"+30xxxxxxxxx\"]\r\n }\r\n ]\r\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -2023,7 +2023,7 @@ "response": [] }, { - "name": "ApierV2.GetCdrs - SupplierCharges INBOUND - INTERNAL-IN", + "name": "APIerSv2.GetCdrs - SupplierCharges INBOUND - INTERNAL-IN", "request": { "auth": { "type": "noauth" @@ -2037,7 +2037,7 @@ ], "body": { "mode": "raw", - "raw": "{\r\n \"id\":\"11111\",\r\n \"method\":\"ApierV2.GetCDRs\",\r\n \"params\":[\r\n {\r\n\t\"RunIDs\":[\"SupplierCharges\"],\r\n\t\"Tenants\":[\"cgrates.org\"],\r\n \"Accounts\":[\"+30xxxxxxxxxx\"],\r\n \"Categories\": [\"call-in\"],\r\n \"Subjects\": [\"INTERNAL-IN\"]\r\n }\r\n ]\r\n}" + "raw": "{\r\n \"id\":\"11111\",\r\n \"method\":\"APIerSv2.GetCDRs\",\r\n \"params\":[\r\n {\r\n\t\"RunIDs\":[\"SupplierCharges\"],\r\n\t\"Tenants\":[\"cgrates.org\"],\r\n \"Accounts\":[\"+30xxxxxxxxxx\"],\r\n \"Categories\": [\"call-in\"],\r\n \"Subjects\": [\"INTERNAL-IN\"]\r\n }\r\n ]\r\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -2052,7 +2052,7 @@ "response": [] }, { - "name": "ApierV1.GetCdrs", + "name": "APIerSv1.GetCdrs", "request": { "auth": { "type": "noauth" @@ -2066,7 +2066,7 @@ ], "body": { "mode": "raw", - "raw": "{\r\n \"id\":\"11111\",\r\n \"method\":\"ApierV1.GetCDRs\",\r\n \"params\":[\r\n {\r\n\t\"RunIDs\":[\"CustomerCharges\"],\r\n\t\"Tenants\":[\"cgrates.org\"],\r\n \"Accounts\":[\"+30xxxxxxxxxx\"],\r\n \"Category\": [\"call-in\"]\r\n }\r\n ]\r\n}" + "raw": "{\r\n \"id\":\"11111\",\r\n \"method\":\"APIerSv1.GetCDRs\",\r\n \"params\":[\r\n {\r\n\t\"RunIDs\":[\"CustomerCharges\"],\r\n\t\"Tenants\":[\"cgrates.org\"],\r\n \"Accounts\":[\"+30xxxxxxxxxx\"],\r\n \"Category\": [\"call-in\"]\r\n }\r\n ]\r\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -2081,7 +2081,7 @@ "response": [] }, { - "name": "ApierV1.GetCdrs Copy", + "name": "APIerSv1.GetCdrs Copy", "request": { "auth": { "type": "noauth" @@ -2095,7 +2095,7 @@ ], "body": { "mode": "raw", - "raw": "{\r\n \"id\":\"11111\",\r\n \"method\":\"ApierV1.GetCDRs\",\r\n \"params\":[\r\n {\r\n\t\"RunIDs\":[\"*default\"],\r\n\t\"Tenants\":[\"cgrates.org\"],\r\n \"Accounts\":[\"+30xxxxxxxxxx\"],\r\n \"Category\": [\"call\"]\r\n }\r\n ]\r\n}" + "raw": "{\r\n \"id\":\"11111\",\r\n \"method\":\"APIerSv1.GetCDRs\",\r\n \"params\":[\r\n {\r\n\t\"RunIDs\":[\"*default\"],\r\n\t\"Tenants\":[\"cgrates.org\"],\r\n \"Accounts\":[\"+30xxxxxxxxxx\"],\r\n \"Category\": [\"call\"]\r\n }\r\n ]\r\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -2110,7 +2110,7 @@ "response": [] }, { - "name": "ApierV1.RemoveCDRs", + "name": "APIerSv1.RemoveCDRs", "request": { "auth": { "type": "noauth" @@ -2124,7 +2124,7 @@ ], "body": { "mode": "raw", - "raw": "{\r\n \"id\":\"11111\",\r\n \"method\":\"ApierV1.RemoveCDRs\",\r\n \"params\":[\r\n {\r\n\t\"RunIDs\":[\"*default\"],\r\n\t\"Tenants\":[\"cgrates.org\"],\r\n \"Accounts\":[\"+30xxxxxxxxxx\"],\r\n \"Category\": [\"call\"]\r\n }\r\n ]\r\n}" + "raw": "{\r\n \"id\":\"11111\",\r\n \"method\":\"APIerSv1.RemoveCDRs\",\r\n \"params\":[\r\n {\r\n\t\"RunIDs\":[\"*default\"],\r\n\t\"Tenants\":[\"cgrates.org\"],\r\n \"Accounts\":[\"+30xxxxxxxxxx\"],\r\n \"Category\": [\"call\"]\r\n }\r\n ]\r\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -2139,7 +2139,7 @@ "response": [] }, { - "name": "ApierV1.RemoveCDRs ALL From Tenant", + "name": "APIerSv1.RemoveCDRs ALL From Tenant", "request": { "auth": { "type": "noauth" @@ -2153,7 +2153,7 @@ ], "body": { "mode": "raw", - "raw": "{\r\n \"id\":\"11111\",\r\n \"method\":\"ApierV1.RemoveCDRs\",\r\n \"params\":[\r\n {\r\n\t\"Tenants\":[\"cgrates.org\"]\r\n }\r\n ]\r\n}" + "raw": "{\r\n \"id\":\"11111\",\r\n \"method\":\"APIerSv1.RemoveCDRs\",\r\n \"params\":[\r\n {\r\n\t\"Tenants\":[\"cgrates.org\"]\r\n }\r\n ]\r\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -2168,7 +2168,7 @@ "response": [] }, { - "name": "ApierV2.CountCDRs", + "name": "APIerSv2.CountCDRs", "request": { "auth": { "type": "noauth" @@ -2182,7 +2182,7 @@ ], "body": { "mode": "raw", - "raw": "{\r\n \"id\":\"11111\",\r\n \"method\":\"ApierV2.CountCDRs\",\r\n \"params\":[\r\n {\r\n\t\"RunIDs\":[\"*default\"],\r\n\t\"Tenants\":[\"cgrates.org\"],\r\n \"Accounts\":[\"+30xxxxxxxxxx\"],\r\n \"Category\": [\"call\"]\r\n }\r\n ]\r\n}" + "raw": "{\r\n \"id\":\"11111\",\r\n \"method\":\"APIerSv2.CountCDRs\",\r\n \"params\":[\r\n {\r\n\t\"RunIDs\":[\"*default\"],\r\n\t\"Tenants\":[\"cgrates.org\"],\r\n \"Accounts\":[\"+30xxxxxxxxxx\"],\r\n \"Category\": [\"call\"]\r\n }\r\n ]\r\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -2206,7 +2206,7 @@ "name": "TP Destination", "item": [ { - "name": "ApierV2.SetTPDestination", + "name": "APIerSv2.SetTPDestination", "request": { "auth": { "type": "noauth" @@ -2220,7 +2220,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"id\": 6,\n \"method\": \"ApierV2.SetTPDestination\",\n \"params\": [\n {\n \t\"TPid\": \"CGR_API_TESTS\",\n \t\"ID\":\"TP_DST_RETAIL_GR_LANDLINE_2019_01\",\n \"DestinationId\": \"TP_DST_RETAIL_GR_LANDLINE_2019_01\",\n \"Prefixes\": [\n \"302\"\n ]\n \n }\n ]\n}" + "raw": "{\n \"id\": 6,\n \"method\": \"APIerSv2.SetTPDestination\",\n \"params\": [\n {\n \t\"TPid\": \"CGR_API_TESTS\",\n \t\"ID\":\"TP_DST_RETAIL_GR_LANDLINE_2019_01\",\n \"DestinationId\": \"TP_DST_RETAIL_GR_LANDLINE_2019_01\",\n \"Prefixes\": [\n \"302\"\n ]\n \n }\n ]\n}" }, "url": { "raw": "http://cgrates1.cgrates.org:2080/jsonrpc", @@ -2239,7 +2239,7 @@ "response": [] }, { - "name": "ApierV1.SetTPDestination", + "name": "APIerSv1.SetTPDestination", "request": { "auth": { "type": "noauth" @@ -2253,7 +2253,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"id\": 6,\n \"method\": \"ApierV1.SetTPDestination\",\n \"params\": [\n {\n \t\"TPid\": \"CGR_API_TESTS1\",\n \t\"ID\":\"90\",\n \"DestinationId\": \"FS_USERS1\",\n \"Prefixes\": [\n \"10\",\"200\"\n ],\n \n }\n ]\n}" + "raw": "{\n \"id\": 6,\n \"method\": \"APIerSv1.SetTPDestination\",\n \"params\": [\n {\n \t\"TPid\": \"CGR_API_TESTS1\",\n \t\"ID\":\"90\",\n \"DestinationId\": \"FS_USERS1\",\n \"Prefixes\": [\n \"10\",\"200\"\n ],\n \n }\n ]\n}" }, "url": { "raw": "http://sip1.de.cgrates.org:2080/jsonrpc", @@ -2273,7 +2273,7 @@ "response": [] }, { - "name": "ApierV1.GetTPDestination", + "name": "APIerSv1.GetTPDestination", "request": { "auth": { "type": "noauth" @@ -2287,7 +2287,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"id\": 6,\n \"method\": \"ApierV1.GetTPDestination\",\n \"params\": [\n {\n \t\"TPid\":\"CGR_API_TESTS\",\n \"Id\": \"TP_DST_RETAIL_GR_LANDLINE_2019_01\"\n \n \n }\n ]\n}" + "raw": "{\n \"id\": 6,\n \"method\": \"APIerSv1.GetTPDestination\",\n \"params\": [\n {\n \t\"TPid\":\"CGR_API_TESTS\",\n \"Id\": \"TP_DST_RETAIL_GR_LANDLINE_2019_01\"\n \n \n }\n ]\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -2302,7 +2302,7 @@ "response": [] }, { - "name": "ApierV1.RemoveTPDestination", + "name": "APIerSv1.RemoveTPDestination", "request": { "auth": { "type": "noauth" @@ -2316,7 +2316,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"id\": 6,\n \"method\": \"ApierV1.RemoveTPDestination\",\n \"params\": [\n {\n \t\"TPid\":\"CGR_API_TESTS\",\n \"Id\": \"TP_DST_RETAIL_GR_LANDLINE_2019_01\"\n \n \n }\n ]\n}" + "raw": "{\n \"id\": 6,\n \"method\": \"APIerSv1.RemoveTPDestination\",\n \"params\": [\n {\n \t\"TPid\":\"CGR_API_TESTS\",\n \"Id\": \"TP_DST_RETAIL_GR_LANDLINE_2019_01\"\n \n \n }\n ]\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -2331,7 +2331,7 @@ "response": [] }, { - "name": "ApierV1.GetTPDestinationIDs", + "name": "APIerSv1.GetTPDestinationIDs", "request": { "auth": { "type": "noauth" @@ -2345,7 +2345,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"id\": 6,\n \"method\": \"ApierV1.GetTPDestinationIDs\",\n \"params\": [\n {\n \t\"TPid\": \"CGR_API_TESTS\"\n \n }\n ]\n}" + "raw": "{\n \"id\": 6,\n \"method\": \"APIerSv1.GetTPDestinationIDs\",\n \"params\": [\n {\n \t\"TPid\": \"CGR_API_TESTS\"\n \n }\n ]\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -2360,7 +2360,7 @@ "response": [] }, { - "name": "ApierV2.RemoveTPDestination", + "name": "APIerSv2.RemoveTPDestination", "request": { "auth": { "type": "noauth" @@ -2374,7 +2374,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"id\": 6,\n \"method\": \"ApierV2.SetTPDestination\",\n \"params\": [\n {\n \t\"TPid\": \"CGR_API_TESTS\",\n \t\"ID\":\"TP_DST_RETAIL_GR_LANDLINE_2019_01\",\n \"DestinationId\": \"TP_DST_RETAIL_GR_LANDLINE_2019_01\",\n \"Prefixes\": [\n \"302\"\n ]\n \n }\n ]\n}" + "raw": "{\n \"id\": 6,\n \"method\": \"APIerSv2.SetTPDestination\",\n \"params\": [\n {\n \t\"TPid\": \"CGR_API_TESTS\",\n \t\"ID\":\"TP_DST_RETAIL_GR_LANDLINE_2019_01\",\n \"DestinationId\": \"TP_DST_RETAIL_GR_LANDLINE_2019_01\",\n \"Prefixes\": [\n \"302\"\n ]\n \n }\n ]\n}" }, "url": { "raw": "http://cgrates1.cgrates.org:2080/jsonrpc", @@ -2400,7 +2400,7 @@ "name": "TP DestinationRates (NEW)", "item": [ { - "name": "ApierV1.SetTPDestinationRate with RateSlots", + "name": "APIerSv1.SetTPDestinationRate with RateSlots", "request": { "auth": { "type": "noauth" @@ -2414,7 +2414,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.SetTPDestinationRate\",\n \"params\": [{\n \"TPid\": \"CGR_API_TESTS\",\n \"ID\": \"TP_DST_RT_RETAIL_GR_LANDLINE_2019_01\",\n \"DestinationRates\": [{\n \"DestinationId\": \"TP_DST_RETAIL_GR_LANDLINE_2019_01\",\n \"RateId\": \"TP_RATEID_DST_RETAIL_GR_LANDLINE_2019_01\",\n \"Rate\": {\n \"TPid\": \"CGR_API_TESTS\",\n \"ID\": \"TP_RT_DST_RETAIL_GR_LANDLINE_2019_01\",\n \"RateSlots\": [{\n \"ConnectFee\": 0.0000,\n \"Rate\": 0.090,\n \"RateUnit\": \"60s\",\n \"RateIncrement\": \"1s\",\n \"GroupIntervalStart\": \"0\"\n },\n \t{\n \"ConnectFee\": 0.0000,\n \"Rate\": 0.090,\n \"RateUnit\": \"60s\",\n \"RateIncrement\": \"1s\",\n \"GroupIntervalStart\": \"60\"\n }\n ]\n },\n \"RoundingMethod\": \"*up\",\n \"RoundingDecimals\": 4,\n \"MaxCost\": 0,\n \"MaxCostStrategy\": \"\"\n }]\n }]\n}\n\n\n" + "raw": "{\n \"method\": \"APIerSv1.SetTPDestinationRate\",\n \"params\": [{\n \"TPid\": \"CGR_API_TESTS\",\n \"ID\": \"TP_DST_RT_RETAIL_GR_LANDLINE_2019_01\",\n \"DestinationRates\": [{\n \"DestinationId\": \"TP_DST_RETAIL_GR_LANDLINE_2019_01\",\n \"RateId\": \"TP_RATEID_DST_RETAIL_GR_LANDLINE_2019_01\",\n \"Rate\": {\n \"TPid\": \"CGR_API_TESTS\",\n \"ID\": \"TP_RT_DST_RETAIL_GR_LANDLINE_2019_01\",\n \"RateSlots\": [{\n \"ConnectFee\": 0.0000,\n \"Rate\": 0.090,\n \"RateUnit\": \"60s\",\n \"RateIncrement\": \"1s\",\n \"GroupIntervalStart\": \"0\"\n },\n \t{\n \"ConnectFee\": 0.0000,\n \"Rate\": 0.090,\n \"RateUnit\": \"60s\",\n \"RateIncrement\": \"1s\",\n \"GroupIntervalStart\": \"60\"\n }\n ]\n },\n \"RoundingMethod\": \"*up\",\n \"RoundingDecimals\": 4,\n \"MaxCost\": 0,\n \"MaxCostStrategy\": \"\"\n }]\n }]\n}\n\n\n" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -2429,7 +2429,7 @@ "response": [] }, { - "name": "ApierV1.SetTPDestinationRate with RateSlots Copy", + "name": "APIerSv1.SetTPDestinationRate with RateSlots Copy", "request": { "auth": { "type": "noauth" @@ -2443,7 +2443,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.SetTPDestinationRate\",\n \"params\": [{\n \"TPid\": \"CGR_API_TESTS\",\n \"ID\": \"TP_DST_RT_RETAIL_GR_LANDLINE_2019_01\",\n \"DestinationRates\": [{\n \"DestinationId\": \"TP_DST_RETAIL_GR_LANDLINE_2019_01\",\n \"RateId\": \"TP_RATEID_DST_RETAIL_GR_LANDLINE_2019_01\",\n \"Rate\": {\n \"TPid\": \"CGR_API_TESTS\",\n \"ID\": \"TP_RT_DST_RETAIL_GR_LANDLINE_2019_01\",\n \"RateSlots\": [{\n \"ConnectFee\": 0.0000,\n \"Rate\": 0.090,\n \"RateUnit\": \"60s\",\n \"RateIncrement\": \"1s\",\n \"GroupIntervalStart\": \"0\"\n },\n \t{\n \"ConnectFee\": 0.0000,\n \"Rate\": 0.090,\n \"RateUnit\": \"60s\",\n \"RateIncrement\": \"1s\",\n \"GroupIntervalStart\": \"60\"\n }\n ]\n },\n \"RoundingMethod\": \"*up\",\n \"RoundingDecimals\": 4,\n \"MaxCost\": 0,\n \"MaxCostStrategy\": \"\"\n }]\n }]\n}\n\n\n" + "raw": "{\n \"method\": \"APIerSv1.SetTPDestinationRate\",\n \"params\": [{\n \"TPid\": \"CGR_API_TESTS\",\n \"ID\": \"TP_DST_RT_RETAIL_GR_LANDLINE_2019_01\",\n \"DestinationRates\": [{\n \"DestinationId\": \"TP_DST_RETAIL_GR_LANDLINE_2019_01\",\n \"RateId\": \"TP_RATEID_DST_RETAIL_GR_LANDLINE_2019_01\",\n \"Rate\": {\n \"TPid\": \"CGR_API_TESTS\",\n \"ID\": \"TP_RT_DST_RETAIL_GR_LANDLINE_2019_01\",\n \"RateSlots\": [{\n \"ConnectFee\": 0.0000,\n \"Rate\": 0.090,\n \"RateUnit\": \"60s\",\n \"RateIncrement\": \"1s\",\n \"GroupIntervalStart\": \"0\"\n },\n \t{\n \"ConnectFee\": 0.0000,\n \"Rate\": 0.090,\n \"RateUnit\": \"60s\",\n \"RateIncrement\": \"1s\",\n \"GroupIntervalStart\": \"60\"\n }\n ]\n },\n \"RoundingMethod\": \"*up\",\n \"RoundingDecimals\": 4,\n \"MaxCost\": 0,\n \"MaxCostStrategy\": \"\"\n }]\n }]\n}\n\n\n" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -2458,7 +2458,7 @@ "response": [] }, { - "name": "ApierV1.SetTPDestinationRate", + "name": "APIerSv1.SetTPDestinationRate", "request": { "auth": { "type": "noauth" @@ -2472,7 +2472,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.SetTPDestinationRate\",\n \"params\": [{\n \"TPid\": \"CGR_API_TESTS\",\n \"ID\": \"TP_DST_RT_RETAIL_GR_LANDLINE_2019_01\",\n \"DestinationRates\": [{\n \"DestinationId\": \"TP_DST_RETAIL_GR_LANDLINE_2019_01\",\n \"RateId\": \"TP_RATEID_DST_RETAIL_GR_LANDLINE_2019_01\",\n \"RoundingMethod\": \"*up\",\n \"RoundingDecimals\": 4,\n \"MaxCost\": 0,\n \"MaxCostStrategy\": \"\"\n }]\n }]\n}\n\n\n" + "raw": "{\n \"method\": \"APIerSv1.SetTPDestinationRate\",\n \"params\": [{\n \"TPid\": \"CGR_API_TESTS\",\n \"ID\": \"TP_DST_RT_RETAIL_GR_LANDLINE_2019_01\",\n \"DestinationRates\": [{\n \"DestinationId\": \"TP_DST_RETAIL_GR_LANDLINE_2019_01\",\n \"RateId\": \"TP_RATEID_DST_RETAIL_GR_LANDLINE_2019_01\",\n \"RoundingMethod\": \"*up\",\n \"RoundingDecimals\": 4,\n \"MaxCost\": 0,\n \"MaxCostStrategy\": \"\"\n }]\n }]\n}\n\n\n" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -2487,7 +2487,7 @@ "response": [] }, { - "name": "ApierV1.RemoveTPDestinationRate", + "name": "APIerSv1.RemoveTPDestinationRate", "request": { "auth": { "type": "noauth" @@ -2501,7 +2501,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.RemoveTPDestinationRate\",\n \"params\": [{\n \"TPid\": \"CGR_API_TESTS\",\n \"ID\": \"DST_RETAIL_GR_LANDLINE_2019_01\"\n \n }]\n}\n\n" + "raw": "{\n \"method\": \"APIerSv1.RemoveTPDestinationRate\",\n \"params\": [{\n \"TPid\": \"CGR_API_TESTS\",\n \"ID\": \"DST_RETAIL_GR_LANDLINE_2019_01\"\n \n }]\n}\n\n" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -2516,7 +2516,7 @@ "response": [] }, { - "name": "ApierV1.GetTPDestinationRate", + "name": "APIerSv1.GetTPDestinationRate", "request": { "auth": { "type": "noauth" @@ -2530,7 +2530,7 @@ ], "body": { "mode": "raw", - "raw": "{\n\"id\": 1,\n\"method\": \"ApierV1.GetTPDestinationRate\",\n\"params\": [\n{\n\t\"TPid\": \"TPID_VL_INTERNAL_INBOUND_CALLS\",\n\t\"ID\": \"TP_DSTRATE_CLI_VL_INTERNAL_INBOUND_CALLS_GR_MOBILE\"\n}\n]\n}" + "raw": "{\n\"id\": 1,\n\"method\": \"APIerSv1.GetTPDestinationRate\",\n\"params\": [\n{\n\t\"TPid\": \"TPID_VL_INTERNAL_INBOUND_CALLS\",\n\t\"ID\": \"TP_DSTRATE_CLI_VL_INTERNAL_INBOUND_CALLS_GR_MOBILE\"\n}\n]\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -2545,7 +2545,7 @@ "response": [] }, { - "name": "ApierV1.GetTPDestinationRateIds", + "name": "APIerSv1.GetTPDestinationRateIds", "request": { "auth": { "type": "noauth" @@ -2559,7 +2559,7 @@ ], "body": { "mode": "raw", - "raw": "{\n\"id\": 1,\n\"method\": \"ApierV1.GetTPDestinationRateIds\",\n\"params\": [\n{\n\"TPid\": \"TP_VL_RP_2019_01_IN\"\n\n}\n]\n}" + "raw": "{\n\"id\": 1,\n\"method\": \"APIerSv1.GetTPDestinationRateIds\",\n\"params\": [\n{\n\"TPid\": \"TP_VL_RP_2019_01_IN\"\n\n}\n]\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -2603,7 +2603,7 @@ "name": "TP Rate (NEW)", "item": [ { - "name": "ApierV1.SetTPRate", + "name": "APIerSv1.SetTPRate", "request": { "method": "POST", "header": [ @@ -2616,7 +2616,7 @@ ], "body": { "mode": "raw", - "raw": "{\n\"id\": 3,\n\"method\": \"ApierV1.SetTPRate\",\n\"params\": [\n{\n\t\"TPid\": \"CGR_API_TESTS\",\n\t\"ID\":\"TP_RATE_DST_RETAIL_GR_LANDLINE_2019_01\",\n\t \"RateSlots\" : [\n \t{\n\t \"ConnectFee\" : 0.10, \n\t \"Rate\": 0.03 , \n\t \"RateUnit\":\"1s\",\n\t \"RateIncrement\":\"1s\",\n\t \"GroupIntervalStart\":\"\"\n\t}\n]\n}\n]\n}" + "raw": "{\n\"id\": 3,\n\"method\": \"APIerSv1.SetTPRate\",\n\"params\": [\n{\n\t\"TPid\": \"CGR_API_TESTS\",\n\t\"ID\":\"TP_RATE_DST_RETAIL_GR_LANDLINE_2019_01\",\n\t \"RateSlots\" : [\n \t{\n\t \"ConnectFee\" : 0.10, \n\t \"Rate\": 0.03 , \n\t \"RateUnit\":\"1s\",\n\t \"RateIncrement\":\"1s\",\n\t \"GroupIntervalStart\":\"\"\n\t}\n]\n}\n]\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -2631,7 +2631,7 @@ "response": [] }, { - "name": "ApierV1.GetTPRate", + "name": "APIerSv1.GetTPRate", "request": { "method": "POST", "header": [ @@ -2644,7 +2644,7 @@ ], "body": { "mode": "raw", - "raw": "{\n\"id\": 1,\n\"method\": \"ApierV1.GetTPRate\",\n\"params\": [\n{\n\"TPid\": \"CGR_API_TESTS\",\n\"ID\":\"SPL_TESTSUPPLIER1_DST_RATEID_GR_LANDLINE_2019_01\"\n}\n]\n}" + "raw": "{\n\"id\": 1,\n\"method\": \"APIerSv1.GetTPRate\",\n\"params\": [\n{\n\"TPid\": \"CGR_API_TESTS\",\n\"ID\":\"SPL_TESTSUPPLIER1_DST_RATEID_GR_LANDLINE_2019_01\"\n}\n]\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -2659,7 +2659,7 @@ "response": [] }, { - "name": "ApierV1.GetTPRateIds", + "name": "APIerSv1.GetTPRateIds", "request": { "method": "POST", "header": [ @@ -2672,7 +2672,7 @@ ], "body": { "mode": "raw", - "raw": "{\n\"id\": 1,\n\"method\": \"ApierV1.GetTPRateIds\",\n\"params\": [\n{\n\"TPid\": \"CGR_API_TESTS\"\n}\n]\n}" + "raw": "{\n\"id\": 1,\n\"method\": \"APIerSv1.GetTPRateIds\",\n\"params\": [\n{\n\"TPid\": \"CGR_API_TESTS\"\n}\n]\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -2687,7 +2687,7 @@ "response": [] }, { - "name": "ApierV1.RemoveTPRate", + "name": "APIerSv1.RemoveTPRate", "request": { "method": "POST", "header": [ @@ -2700,7 +2700,7 @@ ], "body": { "mode": "raw", - "raw": "{\n\n\"method\": \"ApierV1.RemoveTPRate\",\n\"params\": [\n{\n\"TPid\": \"CGR_API_TESTS\",\n\"ID\":\"SPL_TESTSUPPLIER1_DST_GR_LANDLINE_2019_01\"\n\n\t\n}\n]\n}" + "raw": "{\n\n\"method\": \"APIerSv1.RemoveTPRate\",\n\"params\": [\n{\n\"TPid\": \"CGR_API_TESTS\",\n\"ID\":\"SPL_TESTSUPPLIER1_DST_GR_LANDLINE_2019_01\"\n\n\t\n}\n]\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -2719,7 +2719,7 @@ "_postman_isSubFolder": true }, { - "name": "ApierV1.SetDestination", + "name": "APIerSv1.SetDestination", "request": { "auth": { "type": "noauth" @@ -2733,7 +2733,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"id\": 6,\n \"method\": \"ApierV1.SetDestination\",\n \"params\": [\n \t{\n \t\t\"Id\":\"test\",\n \"Prefixes\": [\"10\",\"50\"],\n \"Overwrite\":false\n \t\t\n \t}\n ]\n}" + "raw": "{\n \"id\": 6,\n \"method\": \"APIerSv1.SetDestination\",\n \"params\": [\n \t{\n \t\t\"Id\":\"test\",\n \"Prefixes\": [\"10\",\"50\"],\n \"Overwrite\":false\n \t\t\n \t}\n ]\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -2748,7 +2748,7 @@ "response": [] }, { - "name": "ApierV1.GetDestination", + "name": "APIerSv1.GetDestination", "request": { "auth": { "type": "noauth" @@ -2762,7 +2762,7 @@ ], "body": { "mode": "raw", - "raw": "{ \n \"id\": 6, \n \"method\": \"ApierV1.GetDestination\", \n \"params\": [ \n \"FS_USERS3\" \n ] \n } " + "raw": "{ \n \"id\": 6, \n \"method\": \"APIerSv1.GetDestination\", \n \"params\": [ \n \"FS_USERS3\" \n ] \n } " }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -2777,7 +2777,7 @@ "response": [] }, { - "name": "ApierV2.GetDestination V2", + "name": "APIerSv2.GetDestination V2", "request": { "auth": { "type": "noauth" @@ -2791,7 +2791,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"id\": 6,\n \"method\": \"ApierV2.GetDestination\",\n \"params\":{\n \n \"DestinationIDs\": \"GR_LANDLINE\"\n }\n \n}" + "raw": "{\n \"id\": 6,\n \"method\": \"APIerSv2.GetDestination\",\n \"params\":{\n \n \"DestinationIDs\": \"GR_LANDLINE\"\n }\n \n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -2806,7 +2806,7 @@ "response": [] }, { - "name": "ApierV2.GetDestinations (getALL)", + "name": "APIerSv2.GetDestinations (getALL)", "request": { "auth": { "type": "noauth" @@ -2820,7 +2820,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"id\": 6,\n \"method\": \"ApierV2.GetDestinations\",\n \"params\": [\n \t{\n \t\t\"DestinationIDs\":[]\n \t \t}\n \t]\n \n}" + "raw": "{\n \"id\": 6,\n \"method\": \"APIerSv2.GetDestinations\",\n \"params\": [\n \t{\n \t\t\"DestinationIDs\":[]\n \t \t}\n \t]\n \n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -2835,7 +2835,7 @@ "response": [] }, { - "name": "ApierV2.GetDestinations (certain destinations)", + "name": "APIerSv2.GetDestinations (certain destinations)", "request": { "auth": { "type": "noauth" @@ -2849,7 +2849,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"id\": 6,\n \"method\": \"ApierV2.GetDestinations\",\n \"params\": [\n \t{\n \t\t\"DestinationIDs\":[\"FS_USERS3\",\"test\"]\n \t \t}\n \t]\n \n}" + "raw": "{\n \"id\": 6,\n \"method\": \"APIerSv2.GetDestinations\",\n \"params\": [\n \t{\n \t\t\"DestinationIDs\":[\"FS_USERS3\",\"test\"]\n \t \t}\n \t]\n \n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -2864,7 +2864,7 @@ "response": [] }, { - "name": "ApierV1.RemoveDestination", + "name": "APIerSv1.RemoveDestination", "request": { "auth": { "type": "noauth" @@ -2878,7 +2878,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"id\": 6,\n \"method\": \"ApierV1.RemoveDestination\",\n \"params\": [\n {\n \"DestinationIDs\":[\"test\"]\n \n }\n ]\n}" + "raw": "{\n \"id\": 6,\n \"method\": \"APIerSv1.RemoveDestination\",\n \"params\": [\n {\n \"DestinationIDs\":[\"test\"]\n \n }\n ]\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -2893,7 +2893,7 @@ "response": [] }, { - "name": "ApierV1.GetReverseDestination", + "name": "APIerSv1.GetReverseDestination", "request": { "auth": { "type": "noauth" @@ -2907,7 +2907,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"id\": 6,\n \"method\": \"ApierV1.GetReverseDestination\",\n \"params\": [\n \"10\"\n ]\n}" + "raw": "{\n \"id\": 6,\n \"method\": \"APIerSv1.GetReverseDestination\",\n \"params\": [\n \"10\"\n ]\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -2922,7 +2922,7 @@ "response": [] }, { - "name": "ApierV2.SetAccount", + "name": "APIerSv2.SetAccount", "request": { "auth": { "type": "noauth" @@ -2936,7 +2936,7 @@ ], "body": { "mode": "raw", - "raw": "{\n\"params\": [{\n\"ActionPlanID**s**\": [\"PACKAGE_IL\"],\n\"ReloadScheduler\": true,\n\"Account\": \"972557XXXX\",\n\"AllowNegative\": false,\n\"Disabled\": false,\n\"ActionTriggerOverwrite\": true,\n\"ActionPlansOverwrite\": true,\n\"**T**enant\": \"num2.il\",\n\"ActionTriggerID**s**\": [\"STANDARD_TRIGGERS\"]\n}],\n\"id\": 1,\n\"method\": \"ApierV2.SetAccount\"\n}" + "raw": "{\n\"params\": [{\n\"ActionPlanID**s**\": [\"PACKAGE_IL\"],\n\"ReloadScheduler\": true,\n\"Account\": \"972557XXXX\",\n\"AllowNegative\": false,\n\"Disabled\": false,\n\"ActionTriggerOverwrite\": true,\n\"ActionPlansOverwrite\": true,\n\"**T**enant\": \"num2.il\",\n\"ActionTriggerID**s**\": [\"STANDARD_TRIGGERS\"]\n}],\n\"id\": 1,\n\"method\": \"APIerSv2.SetAccount\"\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -2960,7 +2960,7 @@ "name": "TP RatingPlan", "item": [ { - "name": "ApierV1.SetTPRatingPlan", + "name": "APIerSv1.SetTPRatingPlan", "request": { "method": "POST", "header": [ @@ -2973,7 +2973,7 @@ ], "body": { "mode": "raw", - "raw": "{\n\"id\": 3,\n\"method\": \"ApierV1.SetTPRatingPlan\",\n\"params\": [\n\t{\n\t\t\"TPid\": \"CGR_API_TESTS\",\n\t\t\"ID\":\"TP_RP_RETAIL_GR_LANDLINE_2019_01\",\n\t\t\"RatingPlanBindings\" : [{\n \t\t\"DestinationRatesId\":\"TP_DST_RT_RETAIL_GR_LANDLINE_2019_01\",\n \t\t\"TimingId\": \"*any\" , \n \t\t\"Weight\":10\n\t\t}]\n\t}\n]\n}" + "raw": "{\n\"id\": 3,\n\"method\": \"APIerSv1.SetTPRatingPlan\",\n\"params\": [\n\t{\n\t\t\"TPid\": \"CGR_API_TESTS\",\n\t\t\"ID\":\"TP_RP_RETAIL_GR_LANDLINE_2019_01\",\n\t\t\"RatingPlanBindings\" : [{\n \t\t\"DestinationRatesId\":\"TP_DST_RT_RETAIL_GR_LANDLINE_2019_01\",\n \t\t\"TimingId\": \"*any\" , \n \t\t\"Weight\":10\n\t\t}]\n\t}\n]\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -2988,7 +2988,7 @@ "response": [] }, { - "name": "ApierV1.GetTPRatingPlan", + "name": "APIerSv1.GetTPRatingPlan", "request": { "method": "POST", "header": [ @@ -3001,7 +3001,7 @@ ], "body": { "mode": "raw", - "raw": "{\n\"id\": 1,\n\"method\": \"ApierV1.GetTPRatingPlan\",\n\"params\": [\n{\n\t\"TPid\": \"TPID_VL_INTERNAL_INBOUND_CALLS\",\n\t\"ID\":\"RatingPlan_CLI_VL_INTERNAL_INBOUND_CALLS_GR_MOBILE\"\n}\n]\n}" + "raw": "{\n\"id\": 1,\n\"method\": \"APIerSv1.GetTPRatingPlan\",\n\"params\": [\n{\n\t\"TPid\": \"TPID_VL_INTERNAL_INBOUND_CALLS\",\n\t\"ID\":\"RatingPlan_CLI_VL_INTERNAL_INBOUND_CALLS_GR_MOBILE\"\n}\n]\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -3016,7 +3016,7 @@ "response": [] }, { - "name": "ApierV1.GetTPRatingPlanIds", + "name": "APIerSv1.GetTPRatingPlanIds", "request": { "method": "POST", "header": [ @@ -3029,7 +3029,7 @@ ], "body": { "mode": "raw", - "raw": "{\n\"id\": 3,\n\"method\": \"ApierV1.GetTPRatingPlanIds\",\n\"params\": [\n{\n\n\"TPid\": \"CGR_API_TESTS\"\n\n \n\n\n}\n]\n}" + "raw": "{\n\"id\": 3,\n\"method\": \"APIerSv1.GetTPRatingPlanIds\",\n\"params\": [\n{\n\n\"TPid\": \"CGR_API_TESTS\"\n\n \n\n\n}\n]\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -3044,7 +3044,7 @@ "response": [] }, { - "name": "ApierV1.RemoveTPRatingPlan", + "name": "APIerSv1.RemoveTPRatingPlan", "request": { "method": "POST", "header": [ @@ -3057,7 +3057,7 @@ ], "body": { "mode": "raw", - "raw": "{\n\n\"method\": \"ApierV1.RemoveTPRatingPlan\",\n\"params\": [\n{\n\n\"TPid\": \"TP_VL_RP_2019_01_IN\",\n\"ID\":\"RatingPlan_CLI_VL_RP_2019_01_INBOUND_CALLS_GR_MOBILE\"\n\t\n}\n]\n}" + "raw": "{\n\n\"method\": \"APIerSv1.RemoveTPRatingPlan\",\n\"params\": [\n{\n\n\"TPid\": \"TP_VL_RP_2019_01_IN\",\n\"ID\":\"RatingPlan_CLI_VL_RP_2019_01_INBOUND_CALLS_GR_MOBILE\"\n\t\n}\n]\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -3076,7 +3076,7 @@ "_postman_isSubFolder": true }, { - "name": "ApierV1.LoadRatingPlan", + "name": "APIerSv1.LoadRatingPlan", "request": { "auth": { "type": "noauth" @@ -3090,7 +3090,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"id\": 6,\n \"method\": \"ApierV1.LoadRatingPlan\",\n \"params\": [\n {\n \t\"TPid\":\"CGR_API_TESTS\",\n \t\"RatingPlanId\": \"TP_RP_RETAIL_GR_LANDLINE_2019_01\"\n \n }\n ]\n}\n\n" + "raw": "{\n \"id\": 6,\n \"method\": \"APIerSv1.LoadRatingPlan\",\n \"params\": [\n {\n \t\"TPid\":\"CGR_API_TESTS\",\n \t\"RatingPlanId\": \"TP_RP_RETAIL_GR_LANDLINE_2019_01\"\n \n }\n ]\n}\n\n" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -3105,7 +3105,7 @@ "response": [] }, { - "name": "ApierV1.GetRatingPlan", + "name": "APIerSv1.GetRatingPlan", "request": { "auth": { "type": "noauth" @@ -3119,7 +3119,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"id\":\"0\",\n \"method\":\"ApierV1.GetRatingPlan\",\n \"params\":[\n \"RatingPlan_CLI_VL_INTERNAL_INBOUND_CALLS_GR_MOBILE\"\n ]\n}\n\n" + "raw": "{\n \"id\":\"0\",\n \"method\":\"APIerSv1.GetRatingPlan\",\n \"params\":[\n \"RatingPlan_CLI_VL_INTERNAL_INBOUND_CALLS_GR_MOBILE\"\n ]\n}\n\n" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -3143,7 +3143,7 @@ "name": "TP Rating Profile", "item": [ { - "name": "ApierV1.SetTPRatingProfile", + "name": "APIerSv1.SetTPRatingProfile", "request": { "method": "POST", "header": [ @@ -3156,7 +3156,7 @@ ], "body": { "mode": "raw", - "raw": "{\n\"id\": 3,\n\"method\": \"ApierV1.SetTPRatingProfile\",\n\"params\": [\n{\n\"TPid\":\"TP_RPR_teffsdfsd\",\n\"LoadId\": \"test\",\n\"Tenant\": \"test\",\n\"Category\": \"test\",\n\"Subject\": \"test\",\n \"RatingPlanActivations\" : [\n \t{\n \"ActivationTime\" : \"test\", \n \"RatingPlanId\": \"test\" , \n \"FallbackSubjects\": \"test\"\n}\n]\n}\n]\n}" + "raw": "{\n\"id\": 3,\n\"method\": \"APIerSv1.SetTPRatingProfile\",\n\"params\": [\n{\n\"TPid\":\"TP_RPR_teffsdfsd\",\n\"LoadId\": \"test\",\n\"Tenant\": \"test\",\n\"Category\": \"test\",\n\"Subject\": \"test\",\n \"RatingPlanActivations\" : [\n \t{\n \"ActivationTime\" : \"test\", \n \"RatingPlanId\": \"test\" , \n \"FallbackSubjects\": \"test\"\n}\n]\n}\n]\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -3171,7 +3171,7 @@ "response": [] }, { - "name": "ApierV1.GetTPRatingProfile", + "name": "APIerSv1.GetTPRatingProfile", "request": { "method": "POST", "header": [ @@ -3184,7 +3184,7 @@ ], "body": { "mode": "raw", - "raw": "{\n\"id\": 1,\n\"method\": \"ApierV1.GetTPRatingProfile\",\n\"params\": [\n{\n\"TPid\": \"test\",\n\"RatingProfileId\":\"test\"\n\n}\n]\n}" + "raw": "{\n\"id\": 1,\n\"method\": \"APIerSv1.GetTPRatingProfile\",\n\"params\": [\n{\n\"TPid\": \"test\",\n\"RatingProfileId\":\"test\"\n\n}\n]\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -3199,7 +3199,7 @@ "response": [] }, { - "name": "ApierV1.GetTPRatingProfileIds", + "name": "APIerSv1.GetTPRatingProfileIds", "request": { "method": "POST", "header": [ @@ -3212,7 +3212,7 @@ ], "body": { "mode": "raw", - "raw": "{\n\"id\": 1,\n\"method\": \"ApierV1.GetTPRatingProfileIds\",\n\"params\": [\n{\n\"TPid\": \"CGR_API_TESTS\"\n\n}\n]\n}" + "raw": "{\n\"id\": 1,\n\"method\": \"APIerSv1.GetTPRatingProfileIds\",\n\"params\": [\n{\n\"TPid\": \"CGR_API_TESTS\"\n\n}\n]\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -3227,7 +3227,7 @@ "response": [] }, { - "name": "ApierV1.GetTPRatingProfileLoadIds", + "name": "APIerSv1.GetTPRatingProfileLoadIds", "request": { "method": "POST", "header": [ @@ -3240,7 +3240,7 @@ ], "body": { "mode": "raw", - "raw": "{\n\"id\": 1,\n\"method\": \"ApierV1.GetTPRatingProfileLoadIds\",\n\"params\": [\n{\n\"TPid\": \"test\",\n\"Tenant\": \"test\",\n\"Category\": \"test\",\n\"Subject\":\"test\" \n}\n]\n}" + "raw": "{\n\"id\": 1,\n\"method\": \"APIerSv1.GetTPRatingProfileLoadIds\",\n\"params\": [\n{\n\"TPid\": \"test\",\n\"Tenant\": \"test\",\n\"Category\": \"test\",\n\"Subject\":\"test\" \n}\n]\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -3255,7 +3255,7 @@ "response": [] }, { - "name": "ApierV1.GetTPRatingProfilesByLoadId", + "name": "APIerSv1.GetTPRatingProfilesByLoadId", "request": { "method": "POST", "header": [ @@ -3268,7 +3268,7 @@ ], "body": { "mode": "raw", - "raw": "{\n\"id\": 3,\n\"method\": \"ApierV1.GetTPRatingProfilesByLoadId\",\n\"params\": [\n{\n\n\"TPid\": \"test\",\n\"LoadId\": \"test\"\n\n \n\n\n}\n]\n}" + "raw": "{\n\"id\": 3,\n\"method\": \"APIerSv1.GetTPRatingProfilesByLoadId\",\n\"params\": [\n{\n\n\"TPid\": \"test\",\n\"LoadId\": \"test\"\n\n \n\n\n}\n]\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -3283,7 +3283,7 @@ "response": [] }, { - "name": "ApierV1.RemoveTPRatingProfile", + "name": "APIerSv1.RemoveTPRatingProfile", "request": { "method": "POST", "header": [ @@ -3296,7 +3296,7 @@ ], "body": { "mode": "raw", - "raw": "{\n\n\"method\": \"ApierV1.RemoveTPRatingProfile\",\n\"params\": [\n{\n\"RatingProfileId\":\"test\",\n\"TPid\": \"test\"\n\t\n}\n]\n}" + "raw": "{\n\n\"method\": \"APIerSv1.RemoveTPRatingProfile\",\n\"params\": [\n{\n\"RatingProfileId\":\"test\",\n\"TPid\": \"test\"\n\t\n}\n]\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -3315,7 +3315,7 @@ "_postman_isSubFolder": true }, { - "name": "ApierV1.GetRatingProfile", + "name": "APIerSv1.GetRatingProfile", "request": { "auth": { "type": "noauth" @@ -3329,7 +3329,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.GetRatingProfile\",\n \"params\": [\n {\n \"Tenant\": \"cgrates.org\",\n \"Category\": \"call-out\",\n \"Subject\": \"*any\"\n }\n ]\n}" + "raw": "{\n \"method\": \"APIerSv1.GetRatingProfile\",\n \"params\": [\n {\n \"Tenant\": \"cgrates.org\",\n \"Category\": \"call-out\",\n \"Subject\": \"*any\"\n }\n ]\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -3344,7 +3344,7 @@ "response": [] }, { - "name": "ApierV1.GetRatingProfileIDs", + "name": "APIerSv1.GetRatingProfileIDs", "request": { "auth": { "type": "noauth" @@ -3358,7 +3358,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.GetRatingProfileIDs\",\n \"params\": [\n {\n \"Tenant\": \"cgrates.org\"\n \n }\n ]\n}" + "raw": "{\n \"method\": \"APIerSv1.GetRatingProfileIDs\",\n \"params\": [\n {\n \"Tenant\": \"cgrates.org\"\n \n }\n ]\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -3373,7 +3373,7 @@ "response": [] }, { - "name": "ApierV1.RemoveRatingProfile", + "name": "APIerSv1.RemoveRatingProfile", "request": { "auth": { "type": "noauth" @@ -3387,7 +3387,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.RemoveRatingProfile\",\n \"params\": [\n {\n \"Tenant\": \"cgrates.org\",\n \"Category\": \"call-out\",\n \"Subject\": \"+30xxxxxxxxxx\"\n \n }\n ]\n}\n\n" + "raw": "{\n \"method\": \"APIerSv1.RemoveRatingProfile\",\n \"params\": [\n {\n \"Tenant\": \"cgrates.org\",\n \"Category\": \"call-out\",\n \"Subject\": \"+30xxxxxxxxxx\"\n \n }\n ]\n}\n\n" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -3402,7 +3402,7 @@ "response": [] }, { - "name": "ApierV1.SetRatingProfile", + "name": "APIerSv1.SetRatingProfile", "request": { "auth": { "type": "noauth" @@ -3416,7 +3416,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.SetRatingProfile\",\n \"params\": [\n {\n \"Tenant\": \"cgrates.org\",\n \"Category\": \"call\",\n \"Subject\": \"+30xxxxxxxxx\",\n \"Overwrite\": true,\n \"RatingPlanActivations\": [{\n \t \"ActivationTime\": \"2014-01-14T00:00:00Z\",\n \t \"RatingPlanId\": \"TP_RP_SPL_TESTSUPPLIER1_DST_ID_RT_GR_LANDLINE_2019_01\",\n \t \"FallbackKeys\": \"\"\n }]\n }\n ]\n}\n\n\n" + "raw": "{\n \"method\": \"APIerSv1.SetRatingProfile\",\n \"params\": [\n {\n \"Tenant\": \"cgrates.org\",\n \"Category\": \"call\",\n \"Subject\": \"+30xxxxxxxxx\",\n \"Overwrite\": true,\n \"RatingPlanActivations\": [{\n \t \"ActivationTime\": \"2014-01-14T00:00:00Z\",\n \t \"RatingPlanId\": \"TP_RP_SPL_TESTSUPPLIER1_DST_ID_RT_GR_LANDLINE_2019_01\",\n \t \"FallbackKeys\": \"\"\n }]\n }\n ]\n}\n\n\n" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -3431,7 +3431,7 @@ "response": [] }, { - "name": "ApierV1.GetRatingProfile - +30xxxxxxxxx", + "name": "APIerSv1.GetRatingProfile - +30xxxxxxxxx", "request": { "auth": { "type": "noauth" @@ -3445,7 +3445,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.GetRatingProfile\",\n \"params\": [\n {\n \"Tenant\": \"cgrates.org\",\n \"Category\": \"call-out\",\n \"Subject\": \"+30xxxxxxxxx\"\n }\n ]\n}" + "raw": "{\n \"method\": \"APIerSv1.GetRatingProfile\",\n \"params\": [\n {\n \"Tenant\": \"cgrates.org\",\n \"Category\": \"call-out\",\n \"Subject\": \"+30xxxxxxxxx\"\n }\n ]\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -3460,7 +3460,7 @@ "response": [] }, { - "name": "ApierV1.SetRatingProfile - +30xxxxxxxxx", + "name": "APIerSv1.SetRatingProfile - +30xxxxxxxxx", "request": { "auth": { "type": "noauth" @@ -3476,7 +3476,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.SetRatingProfile\",\n \"params\": [\n {\n \"Tenant\": \"cgrates.org\",\n \"Category\": \"call-out\",\n \"Subject\": \"+30xxxxxxxxx\",\n \"Overwrite\": true,\n \"RatingPlanActivations\": [{\n \t \"ActivationTime\": \"2014-01-14T00:00:00Z\",\n \t \"RatingPlanId\": \"TP_RP_SPL_TESTSUPPLIER1_DST_ID_RT_GR_LANDLINE_2019_01\",\n \t \"FallbackKeys\": \"\"\n }]\n }\n ]\n}\n\n\n", + "raw": "{\n \"method\": \"APIerSv1.SetRatingProfile\",\n \"params\": [\n {\n \"Tenant\": \"cgrates.org\",\n \"Category\": \"call-out\",\n \"Subject\": \"+30xxxxxxxxx\",\n \"Overwrite\": true,\n \"RatingPlanActivations\": [{\n \t \"ActivationTime\": \"2014-01-14T00:00:00Z\",\n \t \"RatingPlanId\": \"TP_RP_SPL_TESTSUPPLIER1_DST_ID_RT_GR_LANDLINE_2019_01\",\n \t \"FallbackKeys\": \"\"\n }]\n }\n ]\n}\n\n\n", "options": { "raw": { "language": "json" @@ -3496,7 +3496,7 @@ "response": [] }, { - "name": "ApierV1.LoadRatingProfile from TP", + "name": "APIerSv1.LoadRatingProfile from TP", "request": { "auth": { "type": "noauth" @@ -3510,7 +3510,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"id\": 6,\n \"method\": \"ApierV1.LoadRatingProfile\",\n \"params\": [\n {\n \t\"TPid\":\"CGR_API_TESTS\",\n \t\"LoadId\": \"\",\n \t\"Tenant\": \"\",\n \t\"Category\": \"\",\n \t\"Subject\": \"\",\n \t\"RatingPlanActivations\": {\n \"ActivationTime\": \"2014-07-14T14:25:00Z\",\n \"RatingPlanId\": \"\",\n \t\"FallbackSubjects\": \"\"\n \t }\n }\n ]\n}" + "raw": "{\n \"id\": 6,\n \"method\": \"APIerSv1.LoadRatingProfile\",\n \"params\": [\n {\n \t\"TPid\":\"CGR_API_TESTS\",\n \t\"LoadId\": \"\",\n \t\"Tenant\": \"\",\n \t\"Category\": \"\",\n \t\"Subject\": \"\",\n \t\"RatingPlanActivations\": {\n \"ActivationTime\": \"2014-07-14T14:25:00Z\",\n \"RatingPlanId\": \"\",\n \t\"FallbackSubjects\": \"\"\n \t }\n }\n ]\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -3531,7 +3531,7 @@ "name": "Filters", "item": [ { - "name": "ApierV1.SetFilter", + "name": "APIerSv1.SetFilter", "request": { "auth": { "type": "noauth" @@ -3545,7 +3545,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.SetFilter\",\n \"params\": [\n {\n \"Tenant\":\"cgrates.org\",\n \"ID\" : \"FLTR_RES\",\n \"Rules\" : [\n \t{\n \"Type\": \"*string\",\n \"FieldName\": \"~Account\",\n \"Values\": [\n \"+30xxxxxxxxxx\"\n ]\n },\n {\n \"Type\": \"*string\",\n \"FieldName\": \"~Destination\",\n \"Values\": [\n \"+30xxxxxxxxxx\"\n ]\n }\n \t],\n \"ActivationInterval\": {\n \n }\n \n }\n ],\n \"id\": 12\n}\n\n\n" + "raw": "{\n \"method\": \"APIerSv1.SetFilter\",\n \"params\": [\n {\n \"Tenant\":\"cgrates.org\",\n \"ID\" : \"FLTR_RES\",\n \"Rules\" : [\n \t{\n \"Type\": \"*string\",\n \"FieldName\": \"~Account\",\n \"Values\": [\n \"+30xxxxxxxxxx\"\n ]\n },\n {\n \"Type\": \"*string\",\n \"FieldName\": \"~Destination\",\n \"Values\": [\n \"+30xxxxxxxxxx\"\n ]\n }\n \t],\n \"ActivationInterval\": {\n \n }\n \n }\n ],\n \"id\": 12\n}\n\n\n" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -3560,7 +3560,7 @@ "response": [] }, { - "name": "ApierV1.SetFilter 1", + "name": "APIerSv1.SetFilter 1", "request": { "auth": { "type": "noauth" @@ -3574,7 +3574,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.SetFilter\",\n \"params\": [\n {\n \"Tenant\":\"cgrates.org\",\n \"ID\" : \"FLTR_ACNT_+30xxxxxxxxx_+30xxxxxxxxxx\",\n \"Rules\" : [\n {\n \"Type\": \"*string\",\n \"FieldName\": \"~Account\",\n \"Values\": [\n \"+30xxxxxxxxx\"\n \n ]\n },\n {\n \"Type\": \"*string\",\n \"FieldName\": \"~RunID\",\n \"Values\": [\n \"CustomerCharges\"\n ]\n },\n {\n \"Type\": \"*string\",\n \"FieldName\": \"~Destination\",\n \"Values\": [\n \"+30xxxxxxxxxx\"\n \n ]\n }\n \n \t],\n \"ActivationInterval\": {\n \"ActivationTime\": \"2014-07-14T14:25:00Z\",\n \"ExpiryTime\": \"0001-01-01T00:00:00Z\"\n }\n \n }\n ],\n \"id\": 12\n}\n" + "raw": "{\n \"method\": \"APIerSv1.SetFilter\",\n \"params\": [\n {\n \"Tenant\":\"cgrates.org\",\n \"ID\" : \"FLTR_ACNT_+30xxxxxxxxx_+30xxxxxxxxxx\",\n \"Rules\" : [\n {\n \"Type\": \"*string\",\n \"FieldName\": \"~Account\",\n \"Values\": [\n \"+30xxxxxxxxx\"\n \n ]\n },\n {\n \"Type\": \"*string\",\n \"FieldName\": \"~RunID\",\n \"Values\": [\n \"CustomerCharges\"\n ]\n },\n {\n \"Type\": \"*string\",\n \"FieldName\": \"~Destination\",\n \"Values\": [\n \"+30xxxxxxxxxx\"\n \n ]\n }\n \n \t],\n \"ActivationInterval\": {\n \"ActivationTime\": \"2014-07-14T14:25:00Z\",\n \"ExpiryTime\": \"0001-01-01T00:00:00Z\"\n }\n \n }\n ],\n \"id\": 12\n}\n" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -3589,7 +3589,7 @@ "response": [] }, { - "name": "ApierV1.SetFilter *destinations", + "name": "APIerSv1.SetFilter *destinations", "request": { "auth": { "type": "noauth" @@ -3603,7 +3603,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.SetFilter\",\n \"params\": [\n {\n \"Tenant\":\"cgrates.org\",\n \"ID\" : \"FLTR_DST_GR_LANDLINE\",\n \"Rules\" : [\n \t{\n \t\"Type\":\"*destinations\",\n \t\"FieldName\":\"~Destination\",\n \t\"Values\":[\n \t\t \"+30xxxxxxxxx\",\n \"+30xxxxxxxxxx\"\n \t\t]\n \t}\n \t],\n \"ActivationInterval\": {\n \n }\n \n }\n ],\n \"id\": 12\n}\n" + "raw": "{\n \"method\": \"APIerSv1.SetFilter\",\n \"params\": [\n {\n \"Tenant\":\"cgrates.org\",\n \"ID\" : \"FLTR_DST_GR_LANDLINE\",\n \"Rules\" : [\n \t{\n \t\"Type\":\"*destinations\",\n \t\"FieldName\":\"~Destination\",\n \t\"Values\":[\n \t\t \"+30xxxxxxxxx\",\n \"+30xxxxxxxxxx\"\n \t\t]\n \t}\n \t],\n \"ActivationInterval\": {\n \n }\n \n }\n ],\n \"id\": 12\n}\n" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -3618,7 +3618,7 @@ "response": [] }, { - "name": "ApierV1.SetFilter Example 1 - Filter Destinations", + "name": "APIerSv1.SetFilter Example 1 - Filter Destinations", "request": { "auth": { "type": "noauth" @@ -3632,7 +3632,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.SetFilter\",\n \"params\": [\n {\n \"Tenant\":\"cgrates.org\",\n \"ID\" : \"FLTR_DST_GR_LANDLINE\",\n \"Rules\" : [\n \t{\n \t\"Type\":\"*destinations\",\n \t\"FieldName\":\"~Destination\",\n \t\"Values\":[\n \t\t \"DST_+30xxxxxxxxx\",\n \"DST_+30xxxxxxxxxx\"\n \t\t]\n \t}\n \t],\n \"ActivationInterval\": {\n \n }\n \n }\n ],\n \"id\": 12\n}\n" + "raw": "{\n \"method\": \"APIerSv1.SetFilter\",\n \"params\": [\n {\n \"Tenant\":\"cgrates.org\",\n \"ID\" : \"FLTR_DST_GR_LANDLINE\",\n \"Rules\" : [\n \t{\n \t\"Type\":\"*destinations\",\n \t\"FieldName\":\"~Destination\",\n \t\"Values\":[\n \t\t \"DST_+30xxxxxxxxx\",\n \"DST_+30xxxxxxxxxx\"\n \t\t]\n \t}\n \t],\n \"ActivationInterval\": {\n \n }\n \n }\n ],\n \"id\": 12\n}\n" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -3647,7 +3647,7 @@ "response": [] }, { - "name": "ApierV1.SetFilter Example 2 - Filter Account", + "name": "APIerSv1.SetFilter Example 2 - Filter Account", "request": { "auth": { "type": "noauth" @@ -3661,7 +3661,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.SetFilter\",\n \"params\": [\n {\n \"Tenant\":\"cgrates.org\",\n \"ID\" : \"FLTR_ACCOUNT_1001\",\n \"Rules\" : [\n \t{\n \t\"Type\":\"*string\",\n \t\"FieldName\":\"~Account\",\n \t\"Values\":[\n \t\t \"+30xxxxxxxxx\",\n \"+30xxxxxxxxxx\"\n \t\t]\n \t}\n \t],\n \"ActivationInterval\": {\n \n }\n \n }\n ],\n \"id\": 12\n}\n" + "raw": "{\n \"method\": \"APIerSv1.SetFilter\",\n \"params\": [\n {\n \"Tenant\":\"cgrates.org\",\n \"ID\" : \"FLTR_ACCOUNT_1001\",\n \"Rules\" : [\n \t{\n \t\"Type\":\"*string\",\n \t\"FieldName\":\"~Account\",\n \t\"Values\":[\n \t\t \"+30xxxxxxxxx\",\n \"+30xxxxxxxxxx\"\n \t\t]\n \t}\n \t],\n \"ActivationInterval\": {\n \n }\n \n }\n ],\n \"id\": 12\n}\n" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -3676,7 +3676,7 @@ "response": [] }, { - "name": "ApierV1.SetFilter Example 3 - BalanceUpdate > 10", + "name": "APIerSv1.SetFilter Example 3 - BalanceUpdate > 10", "request": { "auth": { "type": "noauth" @@ -3690,7 +3690,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.SetFilter\",\n \"params\": [\n {\n \t\"Tenant\": \"cgrates.org\",\n \"ID\": \"FLTR_+30xxxxxxxxx_BALANCEUPDATE_GREATER_OR_EQUAL\",\n \"Rules\": [\n {\n \"Type\": \"*string\",\n \"FieldName\": \"~Account\",\n \"Values\": [\n \"+30xxxxxxxxx\"\n ]\n },\n {\n \"Type\": \"*string\",\n \"FieldName\": \"~EventType\",\n \"Values\": [\n \"BalanceUpdate\"\n ]\n },\n {\n \"Type\": \"*gte\",\n \"FieldName\": \"~Units\",\n \"Values\": [\n \"10\"\n ]\n }\n ],\n \"ActivationInterval\": {\n \"ActivationTime\": \"0001-01-01T00:00:00Z\",\n \"ExpiryTime\": \"0001-01-01T00:00:00Z\"\n }\n \n }\n ],\n \"id\": 12\n}\n" + "raw": "{\n \"method\": \"APIerSv1.SetFilter\",\n \"params\": [\n {\n \t\"Tenant\": \"cgrates.org\",\n \"ID\": \"FLTR_+30xxxxxxxxx_BALANCEUPDATE_GREATER_OR_EQUAL\",\n \"Rules\": [\n {\n \"Type\": \"*string\",\n \"FieldName\": \"~Account\",\n \"Values\": [\n \"+30xxxxxxxxx\"\n ]\n },\n {\n \"Type\": \"*string\",\n \"FieldName\": \"~EventType\",\n \"Values\": [\n \"BalanceUpdate\"\n ]\n },\n {\n \"Type\": \"*gte\",\n \"FieldName\": \"~Units\",\n \"Values\": [\n \"10\"\n ]\n }\n ],\n \"ActivationInterval\": {\n \"ActivationTime\": \"0001-01-01T00:00:00Z\",\n \"ExpiryTime\": \"0001-01-01T00:00:00Z\"\n }\n \n }\n ],\n \"id\": 12\n}\n" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -3705,7 +3705,7 @@ "response": [] }, { - "name": "ApierV1.SetFilter Example 4 - FLTR_INTERNAL", + "name": "APIerSv1.SetFilter Example 4 - FLTR_INTERNAL", "request": { "auth": { "type": "noauth" @@ -3719,7 +3719,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.SetFilter\",\n \"params\": [\n {\n \t\"Tenant\": \"cgrates.org\",\n \"ID\": \"CHARGER_FLTR_INTERNAL_CALLS_ONLY\",\n \"Rules\": [\n {\n \"Type\": \"*string\",\n \"FieldName\": \"~Subject\",\n \"Values\": [\n \"INTERNAL-IN\",\n \"INTERNAL-OUT\"\n ]\n }\n ],\n \"ActivationInterval\": {\n \"ActivationTime\": \"0001-01-01T00:00:00Z\",\n \"ExpiryTime\": \"0001-01-01T00:00:00Z\"\n }\n \n }\n ],\n \"id\": 12\n}\n" + "raw": "{\n \"method\": \"APIerSv1.SetFilter\",\n \"params\": [\n {\n \t\"Tenant\": \"cgrates.org\",\n \"ID\": \"CHARGER_FLTR_INTERNAL_CALLS_ONLY\",\n \"Rules\": [\n {\n \"Type\": \"*string\",\n \"FieldName\": \"~Subject\",\n \"Values\": [\n \"INTERNAL-IN\",\n \"INTERNAL-OUT\"\n ]\n }\n ],\n \"ActivationInterval\": {\n \"ActivationTime\": \"0001-01-01T00:00:00Z\",\n \"ExpiryTime\": \"0001-01-01T00:00:00Z\"\n }\n \n }\n ],\n \"id\": 12\n}\n" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -3734,7 +3734,7 @@ "response": [] }, { - "name": "ApierV1.SetFilter CHARGER_FLTR_INTERNAL_CALLS_ONLY", + "name": "APIerSv1.SetFilter CHARGER_FLTR_INTERNAL_CALLS_ONLY", "request": { "auth": { "type": "noauth" @@ -3748,7 +3748,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.SetFilter\",\n \"params\": [\n {\n \t\"Tenant\": \"cgrates.org\",\n \"ID\": \"CHARGER_FLTR_INTERNAL_CALLS_ONLY\",\n \"Rules\": [\n {\n \"Type\": \"*string\",\n \"FieldName\": \"~Subject\",\n \"Values\": [\n \"INTERNAL-IN\",\n \"INTERNAL-OUT\"\n ]\n }\n ],\n \"ActivationInterval\": {\n \"ActivationTime\": \"0001-01-01T00:00:00Z\",\n \"ExpiryTime\": \"0001-01-01T00:00:00Z\"\n }\n \n }\n ],\n \"id\": 12\n}\n" + "raw": "{\n \"method\": \"APIerSv1.SetFilter\",\n \"params\": [\n {\n \t\"Tenant\": \"cgrates.org\",\n \"ID\": \"CHARGER_FLTR_INTERNAL_CALLS_ONLY\",\n \"Rules\": [\n {\n \"Type\": \"*string\",\n \"FieldName\": \"~Subject\",\n \"Values\": [\n \"INTERNAL-IN\",\n \"INTERNAL-OUT\"\n ]\n }\n ],\n \"ActivationInterval\": {\n \"ActivationTime\": \"0001-01-01T00:00:00Z\",\n \"ExpiryTime\": \"0001-01-01T00:00:00Z\"\n }\n \n }\n ],\n \"id\": 12\n}\n" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -3763,7 +3763,7 @@ "response": [] }, { - "name": "ApierV1.SetFilter FLTR_SPL_VL_INTERNAL_IN", + "name": "APIerSv1.SetFilter FLTR_SPL_VL_INTERNAL_IN", "request": { "auth": { "type": "noauth" @@ -3777,7 +3777,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.SetFilter\",\n \"params\": [\n {\n \t\"Tenant\": \"cgrates.org\",\n \"ID\": \"FLTR_SPL_VL_INTERNAL_IN\",\n \"Rules\": [\n {\n \"Type\": \"*string\",\n \"FieldName\": \"~Subject\",\n \"Values\": [\n \"INTERNAL-IN\"\n ]\n },\n {\n \"Type\": \"*string\",\n \"FieldName\": \"~Category\",\n \"Values\": [\n \"call-in\"\n ]\n }\n ],\n \"ActivationInterval\": {\n \"ActivationTime\": \"0001-01-01T00:00:00Z\",\n \"ExpiryTime\": \"0001-01-01T00:00:00Z\"\n }\n \n }\n ],\n \"id\": 12\n}\n" + "raw": "{\n \"method\": \"APIerSv1.SetFilter\",\n \"params\": [\n {\n \t\"Tenant\": \"cgrates.org\",\n \"ID\": \"FLTR_SPL_VL_INTERNAL_IN\",\n \"Rules\": [\n {\n \"Type\": \"*string\",\n \"FieldName\": \"~Subject\",\n \"Values\": [\n \"INTERNAL-IN\"\n ]\n },\n {\n \"Type\": \"*string\",\n \"FieldName\": \"~Category\",\n \"Values\": [\n \"call-in\"\n ]\n }\n ],\n \"ActivationInterval\": {\n \"ActivationTime\": \"0001-01-01T00:00:00Z\",\n \"ExpiryTime\": \"0001-01-01T00:00:00Z\"\n }\n \n }\n ],\n \"id\": 12\n}\n" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -3792,7 +3792,7 @@ "response": [] }, { - "name": "ApierV1.SetFilter FLTR_SPL_VL_INTERNAL_OUT", + "name": "APIerSv1.SetFilter FLTR_SPL_VL_INTERNAL_OUT", "request": { "auth": { "type": "noauth" @@ -3806,7 +3806,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.SetFilter\",\n \"params\": [\n {\n \t\"Tenant\": \"cgrates.org\",\n \"ID\": \"FLTR_SPL_VL_INTERNAL_OUT\",\n \"Rules\": [\n {\n \"Type\": \"*string\",\n \"FieldName\": \"~Subject\",\n \"Values\": [\n \"INTERNAL-OUT\"\n ]\n },\n {\n \"Type\": \"*string\",\n \"FieldName\": \"~Category\",\n \"Values\": [\n \"call-out\"\n ]\n }\n ],\n \"ActivationInterval\": {\n \"ActivationTime\": \"0001-01-01T00:00:00Z\",\n \"ExpiryTime\": \"0001-01-01T00:00:00Z\"\n }\n \n }\n ],\n \"id\": 12\n}\n" + "raw": "{\n \"method\": \"APIerSv1.SetFilter\",\n \"params\": [\n {\n \t\"Tenant\": \"cgrates.org\",\n \"ID\": \"FLTR_SPL_VL_INTERNAL_OUT\",\n \"Rules\": [\n {\n \"Type\": \"*string\",\n \"FieldName\": \"~Subject\",\n \"Values\": [\n \"INTERNAL-OUT\"\n ]\n },\n {\n \"Type\": \"*string\",\n \"FieldName\": \"~Category\",\n \"Values\": [\n \"call-out\"\n ]\n }\n ],\n \"ActivationInterval\": {\n \"ActivationTime\": \"0001-01-01T00:00:00Z\",\n \"ExpiryTime\": \"0001-01-01T00:00:00Z\"\n }\n \n }\n ],\n \"id\": 12\n}\n" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -3821,7 +3821,7 @@ "response": [] }, { - "name": "ApierV1.SetFilter with ActivationInterval (Account)", + "name": "APIerSv1.SetFilter with ActivationInterval (Account)", "request": { "auth": { "type": "noauth" @@ -3835,7 +3835,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.SetFilter\",\n \"params\": [\n {\n \"Tenant\":\"Tenant_test\",\n \"ID\" : \"FLTR_+30xxxxxxxxxx\",\n \"Rules\" : [\n \t{\n \t\"Type\":\"*string\",\n \t\"FieldName\":\"Account\",\n \t\"Values\":[\"+30xxxxxxxxxx\"]\n \t}\n \t],\n \"ActivationInterval\": {\n \"ActivationTime\": \"2014-07-14T14:25:00Z\",\n \"ExpiryTime\": \"0001-01-01T00:00:00Z\"\n }\n \n }\n ],\n \"id\": 12\n}\n\n\n" + "raw": "{\n \"method\": \"APIerSv1.SetFilter\",\n \"params\": [\n {\n \"Tenant\":\"Tenant_test\",\n \"ID\" : \"FLTR_+30xxxxxxxxxx\",\n \"Rules\" : [\n \t{\n \t\"Type\":\"*string\",\n \t\"FieldName\":\"Account\",\n \t\"Values\":[\"+30xxxxxxxxxx\"]\n \t}\n \t],\n \"ActivationInterval\": {\n \"ActivationTime\": \"2014-07-14T14:25:00Z\",\n \"ExpiryTime\": \"0001-01-01T00:00:00Z\"\n }\n \n }\n ],\n \"id\": 12\n}\n\n\n" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -3850,7 +3850,7 @@ "response": [] }, { - "name": "ApierV1.SetFilter without ActivationInterval", + "name": "APIerSv1.SetFilter without ActivationInterval", "request": { "auth": { "type": "noauth" @@ -3864,7 +3864,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.SetFilter\",\n \"params\": [\n {\n \"Tenant\":\"Tenant_test\",\n \"ID\" : \"ID_Test\",\n \"Rules\" : [\n \t{\n \t\"Type\":\"*string\",\n \t\"FieldName\":\"teest2\",\n \t\"Values\":[\"123\"]\n \t}\n \t]\n }\n ],\n \"id\": 12\n}\n\n\n" + "raw": "{\n \"method\": \"APIerSv1.SetFilter\",\n \"params\": [\n {\n \"Tenant\":\"Tenant_test\",\n \"ID\" : \"ID_Test\",\n \"Rules\" : [\n \t{\n \t\"Type\":\"*string\",\n \t\"FieldName\":\"teest2\",\n \t\"Values\":[\"123\"]\n \t}\n \t]\n }\n ],\n \"id\": 12\n}\n\n\n" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -3879,7 +3879,7 @@ "response": [] }, { - "name": "ApierV1.GetFilter", + "name": "APIerSv1.GetFilter", "request": { "auth": { "type": "noauth" @@ -3893,7 +3893,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.GetFilter\",\n \"params\": [\n {\n \"Tenant\": \"cgrates.org\",\n \"ID\": \"FLTR_ACNT_+30xxxxxxxxx\"\n }\n ],\n \"id\": 12\n}" + "raw": "{\n \"method\": \"APIerSv1.GetFilter\",\n \"params\": [\n {\n \"Tenant\": \"cgrates.org\",\n \"ID\": \"FLTR_ACNT_+30xxxxxxxxx\"\n }\n ],\n \"id\": 12\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -3908,7 +3908,7 @@ "response": [] }, { - "name": "ApierV1.RemoveFilter", + "name": "APIerSv1.RemoveFilter", "request": { "auth": { "type": "noauth" @@ -3922,7 +3922,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.RemoveFilter\",\n \"params\": [\n {\n \"Tenant\": \"cgrates.org\",\n \"ID\": \"FLTR_ACNT_1003\"\n }\n ],\n \"id\": 12\n}" + "raw": "{\n \"method\": \"APIerSv1.RemoveFilter\",\n \"params\": [\n {\n \"Tenant\": \"cgrates.org\",\n \"ID\": \"FLTR_ACNT_1003\"\n }\n ],\n \"id\": 12\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -3937,7 +3937,7 @@ "response": [] }, { - "name": "ApierV1.GetFilterIDs", + "name": "APIerSv1.GetFilterIDs", "request": { "auth": { "type": "noauth" @@ -3951,7 +3951,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.GetFilterIDs\",\n \"params\": [\n {\n \"Tenant\": \"cgrates.org\"\n \n }\n ],\n \"id\": 12\n}" + "raw": "{\n \"method\": \"APIerSv1.GetFilterIDs\",\n \"params\": [\n {\n \"Tenant\": \"cgrates.org\"\n \n }\n ],\n \"id\": 12\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -3972,7 +3972,7 @@ "name": "ResourceProfile", "item": [ { - "name": "ApierV1.SetResourceProfile", + "name": "APIerSv1.SetResourceProfile", "request": { "auth": { "type": "noauth" @@ -3986,7 +3986,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.SetResourceProfile\",\n \"params\": [\n {\n \"Tenant\": \"cgrates.org\",\n \"ID\": \"+30xxxxxxxxxx_RSP\",\n \n \"ActivationInterval\": {\n \"ActivationTime\": \"2014-07-14T14:25:00Z\",\n \"ExpiryTime\": \"0001-01-01T00:00:00Z\"\n },\n \"UsageTTL\": -1,\n \"Limit\": 10,\n \"AllocationMessage\": \"\",\n \"Blocker\": false,\n \"Stored\": false,\n \"Weight\": 10,\n \"ThresholdIDs\": []\n }\n ]\n}\n" + "raw": "{\n \"method\": \"APIerSv1.SetResourceProfile\",\n \"params\": [\n {\n \"Tenant\": \"cgrates.org\",\n \"ID\": \"+30xxxxxxxxxx_RSP\",\n \n \"ActivationInterval\": {\n \"ActivationTime\": \"2014-07-14T14:25:00Z\",\n \"ExpiryTime\": \"0001-01-01T00:00:00Z\"\n },\n \"UsageTTL\": -1,\n \"Limit\": 10,\n \"AllocationMessage\": \"\",\n \"Blocker\": false,\n \"Stored\": false,\n \"Weight\": 10,\n \"ThresholdIDs\": []\n }\n ]\n}\n" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -4001,7 +4001,7 @@ "response": [] }, { - "name": "ApierV1.SetResourceProfile without ActivationInterval", + "name": "APIerSv1.SetResourceProfile without ActivationInterval", "request": { "auth": { "type": "noauth" @@ -4015,7 +4015,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.SetResourceProfile\",\n \"params\": [\n {\n \"Tenant\": \"cgrates.org\",\n \"ID\": \"+30xxxxxxxxxx_RSP\",\n \n \"ActivationInterval\": {\n \n },\n \"UsageTTL\": -1,\n \"Limit\": 10,\n \"AllocationMessage\": \"\",\n \"Blocker\": false,\n \"Stored\": false,\n \"Weight\": 10,\n \"ThresholdIDs\": []\n }\n ]\n}\n\n\n" + "raw": "{\n \"method\": \"APIerSv1.SetResourceProfile\",\n \"params\": [\n {\n \"Tenant\": \"cgrates.org\",\n \"ID\": \"+30xxxxxxxxxx_RSP\",\n \n \"ActivationInterval\": {\n \n },\n \"UsageTTL\": -1,\n \"Limit\": 10,\n \"AllocationMessage\": \"\",\n \"Blocker\": false,\n \"Stored\": false,\n \"Weight\": 10,\n \"ThresholdIDs\": []\n }\n ]\n}\n\n\n" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -4030,7 +4030,7 @@ "response": [] }, { - "name": "ApierV1.GetResourceProfile", + "name": "APIerSv1.GetResourceProfile", "request": { "auth": { "type": "noauth" @@ -4044,7 +4044,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.GetResourceProfile\",\n \"params\": [\n {\n \"Tenant\": \"cgrates.org\",\n \"ID\": \"ResGroup1\"\n\n }\n ]\n}\n\n\n" + "raw": "{\n \"method\": \"APIerSv1.GetResourceProfile\",\n \"params\": [\n {\n \"Tenant\": \"cgrates.org\",\n \"ID\": \"ResGroup1\"\n\n }\n ]\n}\n\n\n" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -4059,7 +4059,7 @@ "response": [] }, { - "name": "ApierV1.RemoveResourceProfile", + "name": "APIerSv1.RemoveResourceProfile", "request": { "auth": { "type": "noauth" @@ -4073,7 +4073,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.GetResourceProfile\",\n \"params\": [\n {\n \"Tenant\": \"cgrates.org\",\n \"ID\": \"ResGroup1\"\n\n }\n ]\n}\n\n\n" + "raw": "{\n \"method\": \"APIerSv1.GetResourceProfile\",\n \"params\": [\n {\n \"Tenant\": \"cgrates.org\",\n \"ID\": \"ResGroup1\"\n\n }\n ]\n}\n\n\n" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -4088,7 +4088,7 @@ "response": [] }, { - "name": "ApierV1.GetResourceProfileIDs", + "name": "APIerSv1.GetResourceProfileIDs", "request": { "auth": { "type": "noauth" @@ -4104,7 +4104,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.GetResourceProfileIDs\",\n \"params\": [\n {\n \"Tenant\": \"cgrates.org\"\n \n }\n ]\n}\n\n\n", + "raw": "{\n \"method\": \"APIerSv1.GetResourceProfileIDs\",\n \"params\": [\n {\n \"Tenant\": \"cgrates.org\"\n \n }\n ]\n}\n\n\n", "options": { "raw": { "language": "json" @@ -4224,7 +4224,7 @@ "_postman_isSubFolder": true }, { - "name": "ApierV1.SetResourceProfile", + "name": "APIerSv1.SetResourceProfile", "request": { "auth": { "type": "noauth" @@ -4238,7 +4238,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.SetResourceProfile\",\n \"params\": [\n {\n \"Tenant\": \"cgrates.org\",\n \"ID\": \"ResGroup1\",\n \"FilterIDs\": [\n \n ],\n \"ActivationInterval\": {\n \"ActivationTime\": \"2014-07-14T14:25:00Z\",\n \"ExpiryTime\": \"0001-01-01T00:00:00Z\"\n },\n \"UsageTTL\": -1,\n \"Limit\": 10,\n \"AllocationMessage\": \"\",\n \"Blocker\": false,\n \"Stored\": false,\n \"Weight\": 10,\n \"ThresholdIDs\": [\n \t\"*none\"\n \t]\n }\n ]\n}\n" + "raw": "{\n \"method\": \"APIerSv1.SetResourceProfile\",\n \"params\": [\n {\n \"Tenant\": \"cgrates.org\",\n \"ID\": \"ResGroup1\",\n \"FilterIDs\": [\n \n ],\n \"ActivationInterval\": {\n \"ActivationTime\": \"2014-07-14T14:25:00Z\",\n \"ExpiryTime\": \"0001-01-01T00:00:00Z\"\n },\n \"UsageTTL\": -1,\n \"Limit\": 10,\n \"AllocationMessage\": \"\",\n \"Blocker\": false,\n \"Stored\": false,\n \"Weight\": 10,\n \"ThresholdIDs\": [\n \t\"*none\"\n \t]\n }\n ]\n}\n" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -4253,7 +4253,7 @@ "response": [] }, { - "name": "ApierV1.SetResourceProfile 1", + "name": "APIerSv1.SetResourceProfile 1", "request": { "auth": { "type": "noauth" @@ -4267,7 +4267,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.SetResourceProfile\",\n \"params\": [\n {\n \"Tenant\": \"cgrates.org\",\n \"ID\": \"ResGroup1\",\n \"FilterIDs\": [\n \"FLTR_ACNT_+30xxxxxxxxx\",\n \"FLTR_ACNT_+30xxxxxxxxxx\"\n ],\n \"ActivationInterval\": {\n \"ActivationTime\": \"2014-07-14T14:25:00Z\",\n \"ExpiryTime\": \"0001-01-01T00:00:00Z\"\n },\n \"UsageTTL\": -1,\n \"Limit\": 10,\n \"AllocationMessage\": \"\",\n \"Blocker\": false,\n \"Stored\": false,\n \"Weight\": 10,\n \"ThresholdIDs\": [\n \t\"*none\"\n \t]\n }\n ]\n}\n" + "raw": "{\n \"method\": \"APIerSv1.SetResourceProfile\",\n \"params\": [\n {\n \"Tenant\": \"cgrates.org\",\n \"ID\": \"ResGroup1\",\n \"FilterIDs\": [\n \"FLTR_ACNT_+30xxxxxxxxx\",\n \"FLTR_ACNT_+30xxxxxxxxxx\"\n ],\n \"ActivationInterval\": {\n \"ActivationTime\": \"2014-07-14T14:25:00Z\",\n \"ExpiryTime\": \"0001-01-01T00:00:00Z\"\n },\n \"UsageTTL\": -1,\n \"Limit\": 10,\n \"AllocationMessage\": \"\",\n \"Blocker\": false,\n \"Stored\": false,\n \"Weight\": 10,\n \"ThresholdIDs\": [\n \t\"*none\"\n \t]\n }\n ]\n}\n" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -4282,7 +4282,7 @@ "response": [] }, { - "name": "ApierV1.GetResourceProfileIDs", + "name": "APIerSv1.GetResourceProfileIDs", "request": { "auth": { "type": "noauth" @@ -4296,7 +4296,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.GetResourceProfileIDs\",\n \"params\": [\n {\n \"Tenant\": \"cgrates.org\"\n\n }\n ]\n}\n\n\n" + "raw": "{\n \"method\": \"APIerSv1.GetResourceProfileIDs\",\n \"params\": [\n {\n \"Tenant\": \"cgrates.org\"\n\n }\n ]\n}\n\n\n" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -4311,7 +4311,7 @@ "response": [] }, { - "name": "ApierV1.GetResourceProfile", + "name": "APIerSv1.GetResourceProfile", "request": { "auth": { "type": "noauth" @@ -4325,7 +4325,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.GetResourceProfile\",\n \"params\": [\n {\n \"Tenant\": \"cgrates.org\",\n \"ID\": \"ResGroup1\"\n\n }\n ]\n}\n\n\n" + "raw": "{\n \"method\": \"APIerSv1.GetResourceProfile\",\n \"params\": [\n {\n \"Tenant\": \"cgrates.org\",\n \"ID\": \"ResGroup1\"\n\n }\n ]\n}\n\n\n" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -4340,7 +4340,7 @@ "response": [] }, { - "name": "ApierV1.RemoveResourceProfile", + "name": "APIerSv1.RemoveResourceProfile", "request": { "auth": { "type": "noauth" @@ -4354,7 +4354,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.RemoveResourceProfile\",\n \"params\": [\n {\n \"Tenant\": \"cgrates.org\",\n \"ID\": \"ResGroup2\"\n\n }\n ]\n}\n\n\n" + "raw": "{\n \"method\": \"APIerSv1.RemoveResourceProfile\",\n \"params\": [\n {\n \"Tenant\": \"cgrates.org\",\n \"ID\": \"ResGroup2\"\n\n }\n ]\n}\n\n\n" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -4375,7 +4375,7 @@ "name": "Stats", "item": [ { - "name": "ApierV1.SetStatQueueProfile", + "name": "APIerSv1.SetStatQueueProfile", "request": { "auth": { "type": "noauth" @@ -4389,7 +4389,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.SetStatQueueProfile\",\n \"params\": [\n {\n \"Tenant\": \"cgrates.org\",\n \"ID\": \"STATS_+30xxxxxxxxxx\",\n \"FilterIDs\": [\n \t\"FLTR_ACNT_+30xxxxxxxxx\"\n \t\t],\n \"ActivationInterval\": {\n \t\"ActivationTime\": \"2014-07-29T15:00:00Z\",\n \t\"ExpiryTime\": \"0001-01-01T00:00:00Z\"\n \t},\n \"QueueLength\": 10,\n \"TTL\": -1,\n \"MinItems\": 0,\n \"Metrics\": [\n {\n \"FilterIDs\": [\"FLTR_ACNT_+30xxxxxxxxx\"],\n \"MetricID\": \"*tcd\"\n },\n {\n \"FilterIDs\": [\"FLTR_ACNT_+30xxxxxxxxxx\"],\n \"MetricID\": \"*tcd\"\n },\n {\n \"FilterIDs\": null,\n \"MetricID\": \"*tcc\"\n },\n {\n \"FilterIDs\": null,\n \"MetricID\": \"*asr\"\n },\n {\n \"FilterIDs\": null,\n \"MetricID\": \"*acd\"\n },\n {\n \"FilterIDs\": null,\n \"MetricID\": \"*acc\"\n }\n \t],\n \"Stored\": false,\n \"Blocker\": true,\n \"Weight\": 10,\n \t\"ThresholdIDs\": [\n \"*none\"\n ]\n \n }\n ]\n}\n\n" + "raw": "{\n \"method\": \"APIerSv1.SetStatQueueProfile\",\n \"params\": [\n {\n \"Tenant\": \"cgrates.org\",\n \"ID\": \"STATS_+30xxxxxxxxxx\",\n \"FilterIDs\": [\n \t\"FLTR_ACNT_+30xxxxxxxxx\"\n \t\t],\n \"ActivationInterval\": {\n \t\"ActivationTime\": \"2014-07-29T15:00:00Z\",\n \t\"ExpiryTime\": \"0001-01-01T00:00:00Z\"\n \t},\n \"QueueLength\": 10,\n \"TTL\": -1,\n \"MinItems\": 0,\n \"Metrics\": [\n {\n \"FilterIDs\": [\"FLTR_ACNT_+30xxxxxxxxx\"],\n \"MetricID\": \"*tcd\"\n },\n {\n \"FilterIDs\": [\"FLTR_ACNT_+30xxxxxxxxxx\"],\n \"MetricID\": \"*tcd\"\n },\n {\n \"FilterIDs\": null,\n \"MetricID\": \"*tcc\"\n },\n {\n \"FilterIDs\": null,\n \"MetricID\": \"*asr\"\n },\n {\n \"FilterIDs\": null,\n \"MetricID\": \"*acd\"\n },\n {\n \"FilterIDs\": null,\n \"MetricID\": \"*acc\"\n }\n \t],\n \"Stored\": false,\n \"Blocker\": true,\n \"Weight\": 10,\n \t\"ThresholdIDs\": [\n \"*none\"\n ]\n \n }\n ]\n}\n\n" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -4404,7 +4404,7 @@ "response": [] }, { - "name": "ApierV1.SetStatQueueProfile Stats3", + "name": "APIerSv1.SetStatQueueProfile Stats3", "request": { "auth": { "type": "noauth" @@ -4418,7 +4418,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.SetStatQueueProfile\",\n \"params\": [\n {\n\t\t\"Tenant\": \"cgrates.org\",\n \"ID\": \"Stats3\",\n \"FilterIDs\": [\n \"FLTR_ACNT_+30xxxxxxxxx\"\n \n ],\n \"ActivationInterval\": {\n \"ActivationTime\": \"2014-07-29T15:00:00Z\",\n \"ExpiryTime\": \"0001-01-01T00:00:00Z\"\n },\n \"QueueLength\": 100,\n \"TTL\": -1,\n \"MinItems\": 0,\n \"Metrics\": [\n {\n \"FilterIDs\": null,\n \"MetricID\": \"*tcc\"\n },\n {\n \"FilterIDs\": null,\n \"MetricID\": \"*tcd\"\n }\n ],\n \"Stored\": false,\n \"Blocker\": true,\n \"Weight\": 30,\n \"ThresholdIDs\": [\n \"*none\"\n ]\n \n }\n ]\n}\n\n" + "raw": "{\n \"method\": \"APIerSv1.SetStatQueueProfile\",\n \"params\": [\n {\n\t\t\"Tenant\": \"cgrates.org\",\n \"ID\": \"Stats3\",\n \"FilterIDs\": [\n \"FLTR_ACNT_+30xxxxxxxxx\"\n \n ],\n \"ActivationInterval\": {\n \"ActivationTime\": \"2014-07-29T15:00:00Z\",\n \"ExpiryTime\": \"0001-01-01T00:00:00Z\"\n },\n \"QueueLength\": 100,\n \"TTL\": -1,\n \"MinItems\": 0,\n \"Metrics\": [\n {\n \"FilterIDs\": null,\n \"MetricID\": \"*tcc\"\n },\n {\n \"FilterIDs\": null,\n \"MetricID\": \"*tcd\"\n }\n ],\n \"Stored\": false,\n \"Blocker\": true,\n \"Weight\": 30,\n \"ThresholdIDs\": [\n \"*none\"\n ]\n \n }\n ]\n}\n\n" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -4433,7 +4433,7 @@ "response": [] }, { - "name": "ApierV1.SetStatQueueProfile Stats3 1", + "name": "APIerSv1.SetStatQueueProfile Stats3 1", "request": { "auth": { "type": "noauth" @@ -4447,7 +4447,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.SetStatQueueProfile\",\n \"params\": [\n {\n\t\t\"Tenant\": \"cgrates.org\",\n \"ID\": \"Stats3\",\n \"FilterIDs\": [\n \"FLTR_ACNT_+30xxxxxxxxx\"\n \n ],\n \"ActivationInterval\": {\n \"ActivationTime\": \"2014-07-29T15:00:00Z\",\n \"ExpiryTime\": \"0001-01-01T00:00:00Z\"\n },\n \"QueueLength\": 100,\n \"TTL\": -1,\n \"MinItems\": 0,\n \"Metrics\": [\n {\n \"FilterIDs\": null,\n \"MetricID\": \"*tcc\"\n },\n {\n \"FilterIDs\": null,\n \"MetricID\": \"*tcd\"\n }\n ],\n \"Stored\": false,\n \"Blocker\": true,\n \"Weight\": 30,\n \"ThresholdIDs\": [\n \"*none\"\n ]\n \n }\n ]\n}\n\n" + "raw": "{\n \"method\": \"APIerSv1.SetStatQueueProfile\",\n \"params\": [\n {\n\t\t\"Tenant\": \"cgrates.org\",\n \"ID\": \"Stats3\",\n \"FilterIDs\": [\n \"FLTR_ACNT_+30xxxxxxxxx\"\n \n ],\n \"ActivationInterval\": {\n \"ActivationTime\": \"2014-07-29T15:00:00Z\",\n \"ExpiryTime\": \"0001-01-01T00:00:00Z\"\n },\n \"QueueLength\": 100,\n \"TTL\": -1,\n \"MinItems\": 0,\n \"Metrics\": [\n {\n \"FilterIDs\": null,\n \"MetricID\": \"*tcc\"\n },\n {\n \"FilterIDs\": null,\n \"MetricID\": \"*tcd\"\n }\n ],\n \"Stored\": false,\n \"Blocker\": true,\n \"Weight\": 30,\n \"ThresholdIDs\": [\n \"*none\"\n ]\n \n }\n ]\n}\n\n" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -4462,7 +4462,7 @@ "response": [] }, { - "name": "ApierV1.GetStatQueueProfile", + "name": "APIerSv1.GetStatQueueProfile", "request": { "auth": { "type": "noauth" @@ -4476,7 +4476,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.GetStatQueueProfile\",\n \"params\": [\n {\n \"Tenant\": \"cgrates.org\",\n \"id\": \"Stats3\"\n \n }\n ]\n}" + "raw": "{\n \"method\": \"APIerSv1.GetStatQueueProfile\",\n \"params\": [\n {\n \"Tenant\": \"cgrates.org\",\n \"id\": \"Stats3\"\n \n }\n ]\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -4549,7 +4549,7 @@ "response": [] }, { - "name": "ApierV1.RemoveStatQueueProfile", + "name": "APIerSv1.RemoveStatQueueProfile", "request": { "auth": { "type": "noauth" @@ -4563,7 +4563,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.RemoveStatQueueProfile\",\n \"params\": [\n {\n \"Tenant\": \"cgrates.org\",\n \"id\": \"Stats3\"\n \n }\n ]\n}" + "raw": "{\n \"method\": \"APIerSv1.RemoveStatQueueProfile\",\n \"params\": [\n {\n \"Tenant\": \"cgrates.org\",\n \"id\": \"Stats3\"\n \n }\n ]\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -4578,7 +4578,7 @@ "response": [] }, { - "name": "ApierV1.GetStatQueueProfileIDs", + "name": "APIerSv1.GetStatQueueProfileIDs", "request": { "auth": { "type": "noauth" @@ -4592,7 +4592,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.GetStatQueueProfileIDs\",\n \"params\": [\n {\n \"Tenant\": \"cgrates.org\"\n\n }\n ]\n}" + "raw": "{\n \"method\": \"APIerSv1.GetStatQueueProfileIDs\",\n \"params\": [\n {\n \"Tenant\": \"cgrates.org\"\n\n }\n ]\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -4645,7 +4645,7 @@ "name": "TP Suppliers", "item": [ { - "name": "ApierV1.SetTPSupplierProfile", + "name": "APIerSv1.SetTPSupplierProfile", "request": { "auth": { "type": "noauth" @@ -4659,7 +4659,7 @@ ], "body": { "mode": "raw", - "raw": "{\n\t\"method\": \"ApierV1.SetTPSupplierProfile\",\n\t\"params\": [{\n\t\t\"TPid\":\"TP_SPL_OTE_2\",\n\t\t\"Tenant\": \"cgrates.org\",\n\t\t\"ID\": \"SPL_OTE_2\",\n\t\t\"FilterIDs\": [],\n\t\t\"ActivationInterval\": {\n\t\t\t\"ActivationTime\": \"2014-07-14T14:25:00Z\",\n\t\t\t\"ExpiryTime\": \"0001-01-01T00:00:00Z\"\n\t\t},\n\t\t\"Sorting\": \"*weight\",\n\t\t\"SortingParameters\": [\"\"],\n\t\t\"Suppliers\": [{\n\t\t\t\"ID\": \"SUPPLIER_ID_TEST1\",\n\t\t\t\"FilterIDs\": [],\n\t\t\t\"AccountIDs\": [\"+30xxxxxxxxxx\",\"+30xxxxxxxxx\"],\n\t\t\t\"RatingPlanIDs\": [\"RP_TWT\"],\n\t\t\t\"ResourceIDs\": [\"RSPROF_+30xxxxxxxxxx\"],\n\t\t\t\"StatIDs\": [\"\"],\n\t\t\t\"Weight\": 10,\n\t\t\t\"Blocker\": false,\n\t\t\t\"SupplierParameters\": \"\"\n\t\t}],\n\t\t\"Weight\": 10\n\t}]\n}" + "raw": "{\n\t\"method\": \"APIerSv1.SetTPSupplierProfile\",\n\t\"params\": [{\n\t\t\"TPid\":\"TP_SPL_OTE_2\",\n\t\t\"Tenant\": \"cgrates.org\",\n\t\t\"ID\": \"SPL_OTE_2\",\n\t\t\"FilterIDs\": [],\n\t\t\"ActivationInterval\": {\n\t\t\t\"ActivationTime\": \"2014-07-14T14:25:00Z\",\n\t\t\t\"ExpiryTime\": \"0001-01-01T00:00:00Z\"\n\t\t},\n\t\t\"Sorting\": \"*weight\",\n\t\t\"SortingParameters\": [\"\"],\n\t\t\"Suppliers\": [{\n\t\t\t\"ID\": \"SUPPLIER_ID_TEST1\",\n\t\t\t\"FilterIDs\": [],\n\t\t\t\"AccountIDs\": [\"+30xxxxxxxxxx\",\"+30xxxxxxxxx\"],\n\t\t\t\"RatingPlanIDs\": [\"RP_TWT\"],\n\t\t\t\"ResourceIDs\": [\"RSPROF_+30xxxxxxxxxx\"],\n\t\t\t\"StatIDs\": [\"\"],\n\t\t\t\"Weight\": 10,\n\t\t\t\"Blocker\": false,\n\t\t\t\"SupplierParameters\": \"\"\n\t\t}],\n\t\t\"Weight\": 10\n\t}]\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -4674,7 +4674,7 @@ "response": [] }, { - "name": "ApierV1.GetTPSupplierProfile", + "name": "APIerSv1.GetTPSupplierProfile", "request": { "auth": { "type": "noauth" @@ -4688,7 +4688,7 @@ ], "body": { "mode": "raw", - "raw": "{\n\t\"method\": \"ApierV1.GetTPSupplierProfile\",\n\t\"params\": [{\n\t\t\"TPid\":\"TP_SPL_OTE_2\",\n\t\t\"Tenant\": \"cgrates.org\",\n\t\t\"ID\": \"SPL_OTE_2\"\n\t\t\n\t\t}],\n\t\t\"Weight\": 10\n\t}]\n}" + "raw": "{\n\t\"method\": \"APIerSv1.GetTPSupplierProfile\",\n\t\"params\": [{\n\t\t\"TPid\":\"TP_SPL_OTE_2\",\n\t\t\"Tenant\": \"cgrates.org\",\n\t\t\"ID\": \"SPL_OTE_2\"\n\t\t\n\t\t}],\n\t\t\"Weight\": 10\n\t}]\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -4703,7 +4703,7 @@ "response": [] }, { - "name": "ApierV1.GetTPSupplierProfileIDs", + "name": "APIerSv1.GetTPSupplierProfileIDs", "request": { "auth": { "type": "noauth" @@ -4717,7 +4717,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.GetTPSupplierProfileIDs\",\n \"params\": [\n {\n \"Tenant\": \"cgrates.org\",\n \"TPid\":\"TP_SPL_OTE_2\"\n }\n ],\n \"id\": 12\n}" + "raw": "{\n \"method\": \"APIerSv1.GetTPSupplierProfileIDs\",\n \"params\": [\n {\n \"Tenant\": \"cgrates.org\",\n \"TPid\":\"TP_SPL_OTE_2\"\n }\n ],\n \"id\": 12\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -4732,7 +4732,7 @@ "response": [] }, { - "name": "ApierV1.RemoveTPSupplierProfile", + "name": "APIerSv1.RemoveTPSupplierProfile", "request": { "auth": { "type": "noauth" @@ -4746,7 +4746,7 @@ ], "body": { "mode": "raw", - "raw": "{\n\t\"method\": \"ApierV1.RemoveTPSupplierProfile\",\n\t\"params\": [{\n\t\t\"TPid\":\"TP_SPL_OTE_2\",\n\t\t\"Tenant\": \"cgrates.org\",\n\t\t\"ID\": \"SPL_OTE_2\"\n\t\t\n\t\t}],\n\t\t\"Weight\": 10\n\t}]\n}" + "raw": "{\n\t\"method\": \"APIerSv1.RemoveTPSupplierProfile\",\n\t\"params\": [{\n\t\t\"TPid\":\"TP_SPL_OTE_2\",\n\t\t\"Tenant\": \"cgrates.org\",\n\t\t\"ID\": \"SPL_OTE_2\"\n\t\t\n\t\t}],\n\t\t\"Weight\": 10\n\t}]\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -4765,7 +4765,7 @@ "_postman_isSubFolder": true }, { - "name": "ApierV1.SetSupplierProfile *weight", + "name": "APIerSv1.SetSupplierProfile *weight", "request": { "auth": { "type": "noauth" @@ -4779,7 +4779,7 @@ ], "body": { "mode": "raw", - "raw": "{\n\t\"method\": \"ApierV1.SetSupplierProfile\",\n\t\"params\": [{\n\t\t\"Tenant\": \"cgrates.org\",\n\t\t\"ID\": \"SPL_TEST_1_WEIGHT\",\n\t\t\"FilterIDs\": null,\n\t\t\"ActivationInterval\": {\n\t\t\t\"ActivationTime\": \"2014-07-14T14:25:00Z\",\n\t\t\t\"ExpiryTime\": \"0001-01-01T00:00:00Z\"\n\t\t},\n\t\t\"Sorting\": \"*weight\",\n\t\t\"SortingParameters\": [\"\"],\n\t\t\"Suppliers\": [{\n\t\t\t\"ID\": \"SUPPLIER_ID_TEST1\",\n\t\t\t\"FilterIDs\": [],\n\t\t\t\"AccountIDs\": [\"+30xxxxxxxxxx\",\"+30xxxxxxxxx\"],\n\t\t\t\"RatingPlanIDs\": [\"RP_TWT\"],\n\t\t\t\"ResourceIDs\": [\"RSPROF_+30xxxxxxxxxx\"],\n\t\t\t\"StatIDs\": [\"STATS_+30xxxxxxxxxx\"],\n\t\t\t\"Weight\": 10,\n\t\t\t\"Blocker\": false,\n\t\t\t\"SupplierParameters\": \"SUPPLIER_PARAM_1\"\n\t\t}],\n\t\t\"Weight\": 10\n\t}]\n}" + "raw": "{\n\t\"method\": \"APIerSv1.SetSupplierProfile\",\n\t\"params\": [{\n\t\t\"Tenant\": \"cgrates.org\",\n\t\t\"ID\": \"SPL_TEST_1_WEIGHT\",\n\t\t\"FilterIDs\": null,\n\t\t\"ActivationInterval\": {\n\t\t\t\"ActivationTime\": \"2014-07-14T14:25:00Z\",\n\t\t\t\"ExpiryTime\": \"0001-01-01T00:00:00Z\"\n\t\t},\n\t\t\"Sorting\": \"*weight\",\n\t\t\"SortingParameters\": [\"\"],\n\t\t\"Suppliers\": [{\n\t\t\t\"ID\": \"SUPPLIER_ID_TEST1\",\n\t\t\t\"FilterIDs\": [],\n\t\t\t\"AccountIDs\": [\"+30xxxxxxxxxx\",\"+30xxxxxxxxx\"],\n\t\t\t\"RatingPlanIDs\": [\"RP_TWT\"],\n\t\t\t\"ResourceIDs\": [\"RSPROF_+30xxxxxxxxxx\"],\n\t\t\t\"StatIDs\": [\"STATS_+30xxxxxxxxxx\"],\n\t\t\t\"Weight\": 10,\n\t\t\t\"Blocker\": false,\n\t\t\t\"SupplierParameters\": \"SUPPLIER_PARAM_1\"\n\t\t}],\n\t\t\"Weight\": 10\n\t}]\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -4794,7 +4794,7 @@ "response": [] }, { - "name": "ApierV1.SetSupplierProfile least cost", + "name": "APIerSv1.SetSupplierProfile least cost", "request": { "auth": { "type": "noauth" @@ -4808,7 +4808,7 @@ ], "body": { "mode": "raw", - "raw": "{\n\t\"method\": \"ApierV1.SetSupplierProfile\",\n\t\"params\": [{\n\t\t\"Tenant\": \"cgrates.org\",\n\t\t\"ID\": \"SPL_TEST_1_LEAST_COST\",\n\t\t\"FilterIDs\": null,\n\t\t\"ActivationInterval\": {\n\t\t\t\"ActivationTime\": \"2014-07-14T14:25:00Z\",\n\t\t\t\"ExpiryTime\": \"0001-01-01T00:00:00Z\"\n\t\t},\n\t\t\"Sorting\": \"*lc\",\n\t\t\"SortingParameters\": [\"\"],\n\t\t\"Suppliers\": [{\n\t\t\t\"ID\": \"SUPPLIER_ID_TEST1\",\n\t\t\t\"FilterIDs\": [],\n\t\t\t\"AccountIDs\": [\"+30xxxxxxxxxx\",\"+30xxxxxxxxx\"],\n\t\t\t\"RatingPlanIDs\": [\"RP_1002_LOW\"],\n\t\t\t\"ResourceIDs\": [\"RSPROF_+30xxxxxxxxxx\"],\n\t\t\t\"StatIDs\": [\"STATS_+30xxxxxxxxxx\"],\n\t\t\t\"Weight\": 10,\n\t\t\t\"Blocker\": false,\n\t\t\t\"SupplierParameters\": \"SUPPLIER_PARAM_1\"\n\t\t}],\n\t\t\"Weight\": 10\n\t}]\n}" + "raw": "{\n\t\"method\": \"APIerSv1.SetSupplierProfile\",\n\t\"params\": [{\n\t\t\"Tenant\": \"cgrates.org\",\n\t\t\"ID\": \"SPL_TEST_1_LEAST_COST\",\n\t\t\"FilterIDs\": null,\n\t\t\"ActivationInterval\": {\n\t\t\t\"ActivationTime\": \"2014-07-14T14:25:00Z\",\n\t\t\t\"ExpiryTime\": \"0001-01-01T00:00:00Z\"\n\t\t},\n\t\t\"Sorting\": \"*lc\",\n\t\t\"SortingParameters\": [\"\"],\n\t\t\"Suppliers\": [{\n\t\t\t\"ID\": \"SUPPLIER_ID_TEST1\",\n\t\t\t\"FilterIDs\": [],\n\t\t\t\"AccountIDs\": [\"+30xxxxxxxxxx\",\"+30xxxxxxxxx\"],\n\t\t\t\"RatingPlanIDs\": [\"RP_1002_LOW\"],\n\t\t\t\"ResourceIDs\": [\"RSPROF_+30xxxxxxxxxx\"],\n\t\t\t\"StatIDs\": [\"STATS_+30xxxxxxxxxx\"],\n\t\t\t\"Weight\": 10,\n\t\t\t\"Blocker\": false,\n\t\t\t\"SupplierParameters\": \"SUPPLIER_PARAM_1\"\n\t\t}],\n\t\t\"Weight\": 10\n\t}]\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -4823,7 +4823,7 @@ "response": [] }, { - "name": "ApierV1.SetSupplierProfile high cost", + "name": "APIerSv1.SetSupplierProfile high cost", "request": { "auth": { "type": "noauth" @@ -4837,7 +4837,7 @@ ], "body": { "mode": "raw", - "raw": "{\n\t\"method\": \"ApierV1.SetSupplierProfile\",\n\t\"params\": [{\n\t\t\"Tenant\": \"cgrates.org\",\n\t\t\"ID\": \"SPL_TEST_1_HIGH_COST\",\n\t\t\"FilterIDs\": null,\n\t\t\"ActivationInterval\": {\n\t\t\t\"ActivationTime\": \"2014-07-14T14:25:00Z\",\n\t\t\t\"ExpiryTime\": \"0001-01-01T00:00:00Z\"\n\t\t},\n\t\t\"Sorting\": \"*hc\",\n\t\t\"SortingParameters\": [\"\"],\n\t\t\"Suppliers\": [{\n\t\t\t\"ID\": \"SUPPLIER_ID_TEST1\",\n\t\t\t\"FilterIDs\": [],\n\t\t\t\"AccountIDs\": [\"+30xxxxxxxxxx\",\"+30xxxxxxxxx\"],\n\t\t\t\"RatingPlanIDs\": [\"RP_1002_LOW\"],\n\t\t\t\"ResourceIDs\": [\"RSPROF_+30xxxxxxxxxx\"],\n\t\t\t\"StatIDs\": [\"STATS_+30xxxxxxxxxx\"],\n\t\t\t\"Weight\": 10,\n\t\t\t\"Blocker\": false,\n\t\t\t\"SupplierParameters\": \"SUPPLIER_PARAM_1\"\n\t\t}],\n\t\t\"Weight\": 10\n\t}]\n}" + "raw": "{\n\t\"method\": \"APIerSv1.SetSupplierProfile\",\n\t\"params\": [{\n\t\t\"Tenant\": \"cgrates.org\",\n\t\t\"ID\": \"SPL_TEST_1_HIGH_COST\",\n\t\t\"FilterIDs\": null,\n\t\t\"ActivationInterval\": {\n\t\t\t\"ActivationTime\": \"2014-07-14T14:25:00Z\",\n\t\t\t\"ExpiryTime\": \"0001-01-01T00:00:00Z\"\n\t\t},\n\t\t\"Sorting\": \"*hc\",\n\t\t\"SortingParameters\": [\"\"],\n\t\t\"Suppliers\": [{\n\t\t\t\"ID\": \"SUPPLIER_ID_TEST1\",\n\t\t\t\"FilterIDs\": [],\n\t\t\t\"AccountIDs\": [\"+30xxxxxxxxxx\",\"+30xxxxxxxxx\"],\n\t\t\t\"RatingPlanIDs\": [\"RP_1002_LOW\"],\n\t\t\t\"ResourceIDs\": [\"RSPROF_+30xxxxxxxxxx\"],\n\t\t\t\"StatIDs\": [\"STATS_+30xxxxxxxxxx\"],\n\t\t\t\"Weight\": 10,\n\t\t\t\"Blocker\": false,\n\t\t\t\"SupplierParameters\": \"SUPPLIER_PARAM_1\"\n\t\t}],\n\t\t\"Weight\": 10\n\t}]\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -4852,7 +4852,7 @@ "response": [] }, { - "name": "ApierV1.SetSupplierProfile *weight SPL_GR_WEIGHT_1", + "name": "APIerSv1.SetSupplierProfile *weight SPL_GR_WEIGHT_1", "request": { "auth": { "type": "noauth" @@ -4866,7 +4866,7 @@ ], "body": { "mode": "raw", - "raw": "{\n\t\"method\": \"ApierV1.SetSupplierProfile\",\n\t\"params\": [{\n\t\t\"Tenant\": \"cgrates.org\",\n\t\t\"ID\": \"SPL_GR_WEIGHT_1\",\n\t\t\"FilterIDs\": [\"FLTR_NOT_INTERNAL\"],\n\t\t\"ActivationInterval\": {\n\t\t\t\"ActivationTime\": \"2014-07-14T14:25:00Z\",\n\t\t\t\"ExpiryTime\": \"0001-01-01T00:00:00Z\"\n\t\t},\n\t\t\"Sorting\": \"*weight\",\n\t\t\"SortingParameters\": [\"\"],\n\t\t\"Suppliers\": [{\n\t\t\t\"ID\": \"SPL_ID_01\",\n\t\t\t\"FilterIDs\": [],\n\t\t\t\"AccountIDs\": null,\n\t\t\t\"RatingPlanIDs\": [\"TP_RP_SPL_TESTSUPPLIER1_DST_ID_RT_GR_LANDLINE_2019_01\"],\n\t\t\t\"ResourceIDs\": null,\n\t\t\t\"StatIDs\": null,\n\t\t\t\"Weight\": 10,\n\t\t\t\"Blocker\": false,\n\t\t\t\"SupplierParameters\": \"SPL_PARAM_X\"\n\t\t},\n\t\t{\n\t\t\t\"ID\": \"SPL_ID_02\",\n\t\t\t\"FilterIDs\": [],\n\t\t\t\"AccountIDs\": null,\n\t\t\t\"RatingPlanIDs\": [],\n\t\t\t\"ResourceIDs\": null,\n\t\t\t\"StatIDs\": null,\n\t\t\t\"Weight\": 20,\n\t\t\t\"Blocker\": false,\n\t\t\t\"SupplierParameters\": \"SPL_PARAM_X\"\n\t\t}\n\t\t],\n\t\t\"Weight\": 10\n\t}]\n}\n\n\n" + "raw": "{\n\t\"method\": \"APIerSv1.SetSupplierProfile\",\n\t\"params\": [{\n\t\t\"Tenant\": \"cgrates.org\",\n\t\t\"ID\": \"SPL_GR_WEIGHT_1\",\n\t\t\"FilterIDs\": [\"FLTR_NOT_INTERNAL\"],\n\t\t\"ActivationInterval\": {\n\t\t\t\"ActivationTime\": \"2014-07-14T14:25:00Z\",\n\t\t\t\"ExpiryTime\": \"0001-01-01T00:00:00Z\"\n\t\t},\n\t\t\"Sorting\": \"*weight\",\n\t\t\"SortingParameters\": [\"\"],\n\t\t\"Suppliers\": [{\n\t\t\t\"ID\": \"SPL_ID_01\",\n\t\t\t\"FilterIDs\": [],\n\t\t\t\"AccountIDs\": null,\n\t\t\t\"RatingPlanIDs\": [\"TP_RP_SPL_TESTSUPPLIER1_DST_ID_RT_GR_LANDLINE_2019_01\"],\n\t\t\t\"ResourceIDs\": null,\n\t\t\t\"StatIDs\": null,\n\t\t\t\"Weight\": 10,\n\t\t\t\"Blocker\": false,\n\t\t\t\"SupplierParameters\": \"SPL_PARAM_X\"\n\t\t},\n\t\t{\n\t\t\t\"ID\": \"SPL_ID_02\",\n\t\t\t\"FilterIDs\": [],\n\t\t\t\"AccountIDs\": null,\n\t\t\t\"RatingPlanIDs\": [],\n\t\t\t\"ResourceIDs\": null,\n\t\t\t\"StatIDs\": null,\n\t\t\t\"Weight\": 20,\n\t\t\t\"Blocker\": false,\n\t\t\t\"SupplierParameters\": \"SPL_PARAM_X\"\n\t\t}\n\t\t],\n\t\t\"Weight\": 10\n\t}]\n}\n\n\n" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -4881,7 +4881,7 @@ "response": [] }, { - "name": "ApierV1.SetSupplierProfile SPL_TESTSUPPLIER1_GR", + "name": "APIerSv1.SetSupplierProfile SPL_TESTSUPPLIER1_GR", "request": { "auth": { "type": "noauth" @@ -4895,7 +4895,7 @@ ], "body": { "mode": "raw", - "raw": "{\n\t\"method\": \"ApierV1.SetSupplierProfile\",\n\t\"params\": [{\n\t\t\"Tenant\": \"cgrates.org\",\n\t\t\"ID\": \"SPL_GR_WEIGHT_1\",\n\t\t\"FilterIDs\": [\"FLTR_NOT_INTERNAL\"],\n\t\t\"ActivationInterval\": {\n\t\t\t\"ActivationTime\": \"2014-07-14T14:25:00Z\",\n\t\t\t\"ExpiryTime\": \"0001-01-01T00:00:00Z\"\n\t\t},\n\t\t\"Sorting\": \"*qos\"\n\t\t\"SortingParameters\": [\"*tcd\"],\n\t\t\"Suppliers\": [{\n\t\t\t\"ID\": \"SPL_ID_01\",\n\t\t\t\"FilterIDs\": [],\n\t\t\t\"AccountIDs\": null,\n\t\t\t\"RatingPlanIDs\": [\"TP_RP_SPL_TESTSUPPLIER1_DST_ID_RT_GR_LANDLINE_2019_01\"],\n\t\t\t\"ResourceIDs\": null,\n\t\t\t\"StatIDs\": null,\n\t\t\t\"Weight\": 10,\n\t\t\t\"Blocker\": false,\n\t\t\t\"SupplierParameters\": \"SPL_PARAM_X\"\n\t\t},\n\t\t{\n\t\t\t\"ID\": \"SPL_ID_02\",\n\t\t\t\"FilterIDs\": [],\n\t\t\t\"AccountIDs\": null,\n\t\t\t\"RatingPlanIDs\": [\"TP_RP_SPL_TESTSUPPLIER1_DST_ID_RT_GR_LANDLINE_2019_01\"],\n\t\t\t\"ResourceIDs\": null,\n\t\t\t\"StatIDs\": null,\n\t\t\t\"Weight\": 10\n\t\t\t\"Blocker\": false,\n\t\t\t\"SupplierParameters\": \"SPL_PARAM_X\"\n\t\t}\n\t\t],\n\t\t\"Weight\": 10\n\t}]\n}\n\n\n" + "raw": "{\n\t\"method\": \"APIerSv1.SetSupplierProfile\",\n\t\"params\": [{\n\t\t\"Tenant\": \"cgrates.org\",\n\t\t\"ID\": \"SPL_GR_WEIGHT_1\",\n\t\t\"FilterIDs\": [\"FLTR_NOT_INTERNAL\"],\n\t\t\"ActivationInterval\": {\n\t\t\t\"ActivationTime\": \"2014-07-14T14:25:00Z\",\n\t\t\t\"ExpiryTime\": \"0001-01-01T00:00:00Z\"\n\t\t},\n\t\t\"Sorting\": \"*qos\"\n\t\t\"SortingParameters\": [\"*tcd\"],\n\t\t\"Suppliers\": [{\n\t\t\t\"ID\": \"SPL_ID_01\",\n\t\t\t\"FilterIDs\": [],\n\t\t\t\"AccountIDs\": null,\n\t\t\t\"RatingPlanIDs\": [\"TP_RP_SPL_TESTSUPPLIER1_DST_ID_RT_GR_LANDLINE_2019_01\"],\n\t\t\t\"ResourceIDs\": null,\n\t\t\t\"StatIDs\": null,\n\t\t\t\"Weight\": 10,\n\t\t\t\"Blocker\": false,\n\t\t\t\"SupplierParameters\": \"SPL_PARAM_X\"\n\t\t},\n\t\t{\n\t\t\t\"ID\": \"SPL_ID_02\",\n\t\t\t\"FilterIDs\": [],\n\t\t\t\"AccountIDs\": null,\n\t\t\t\"RatingPlanIDs\": [\"TP_RP_SPL_TESTSUPPLIER1_DST_ID_RT_GR_LANDLINE_2019_01\"],\n\t\t\t\"ResourceIDs\": null,\n\t\t\t\"StatIDs\": null,\n\t\t\t\"Weight\": 10\n\t\t\t\"Blocker\": false,\n\t\t\t\"SupplierParameters\": \"SPL_PARAM_X\"\n\t\t}\n\t\t],\n\t\t\"Weight\": 10\n\t}]\n}\n\n\n" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -4910,7 +4910,7 @@ "response": [] }, { - "name": "ApierV1.SetSupplierProfile *weight SPL_VL_INTERNAL", + "name": "APIerSv1.SetSupplierProfile *weight SPL_VL_INTERNAL", "request": { "auth": { "type": "noauth" @@ -4924,7 +4924,7 @@ ], "body": { "mode": "raw", - "raw": "{\n\t\"method\": \"ApierV1.SetSupplierProfile\",\n\t\"params\": [{\n\t\t\"Tenant\": \"cgrates.org\",\n\t\t\"ID\": \"SPL_VL_INTERNAL\",\n\t\t\"FilterIDs\": null,\n\t\t\"ActivationInterval\": {\n\t\t\t\"ActivationTime\": \"2014-07-14T14:25:00Z\",\n\t\t\t\"ExpiryTime\": \"0001-01-01T00:00:00Z\"\n\t\t},\n\t\t\"Sorting\": \"*weight\",\n\t\t\"SortingParameters\": [\"\"],\n\t\t\"Suppliers\": [\n\t\t\t{\n\t\t\t\"ID\": \"SPL_VL_INTERNAL_IN\",\n\t\t\t\"FilterIDs\": [\"*string:~*req.Subject:INTERNAL-IN\",\"*string:~*req.Category:call-in\"],\n\t\t\t\"AccountIDs\": [\"\"],\n\t\t\t\"RatingPlanIDs\": [\"TP_RP_SPL_TEST_SUPPLIER_NAME_INTERNAL_DST_ID_RT_GR_LANDLINE_2019_01\"],\n\t\t\t\"ResourceIDs\": null,\n\t\t\t\"StatIDs\": null,\n\t\t\t\"Weight\": 10,\n\t\t\t\"Blocker\": false,\n\t\t\t\"SupplierParameters\": \"999\"\n\t\t\t},\n\t\t\t{\n\t\t\t\"ID\": \"SPL_VL_INTERNAL_OUT\",\n\t\t\t\"FilterIDs\": [\"*string:~*req.Subject:INTERNAL-OUT\",\"*string:~*req.Category:call-out\"],\n\t\t\t\"AccountIDs\": null,\n\t\t\t\"RatingPlanIDs\": [\"TP_RP_SPL_TEST_SUPPLIER_NAME_INTERNAL_DST_ID_RT_GR_LANDLINE_2019_01\"],\n\t\t\t\"ResourceIDs\": null,\n\t\t\t\"StatIDs\": null,\n\t\t\t\"Weight\": 10,\n\t\t\t\"Blocker\": false,\n\t\t\t\"SupplierParameters\": \"999\"\n\t\t\t}\n\t\t\n\t\t],\n\t\t\"Weight\": 10\n\t}]\n}\n\n\n" + "raw": "{\n\t\"method\": \"APIerSv1.SetSupplierProfile\",\n\t\"params\": [{\n\t\t\"Tenant\": \"cgrates.org\",\n\t\t\"ID\": \"SPL_VL_INTERNAL\",\n\t\t\"FilterIDs\": null,\n\t\t\"ActivationInterval\": {\n\t\t\t\"ActivationTime\": \"2014-07-14T14:25:00Z\",\n\t\t\t\"ExpiryTime\": \"0001-01-01T00:00:00Z\"\n\t\t},\n\t\t\"Sorting\": \"*weight\",\n\t\t\"SortingParameters\": [\"\"],\n\t\t\"Suppliers\": [\n\t\t\t{\n\t\t\t\"ID\": \"SPL_VL_INTERNAL_IN\",\n\t\t\t\"FilterIDs\": [\"*string:~*req.Subject:INTERNAL-IN\",\"*string:~*req.Category:call-in\"],\n\t\t\t\"AccountIDs\": [\"\"],\n\t\t\t\"RatingPlanIDs\": [\"TP_RP_SPL_TEST_SUPPLIER_NAME_INTERNAL_DST_ID_RT_GR_LANDLINE_2019_01\"],\n\t\t\t\"ResourceIDs\": null,\n\t\t\t\"StatIDs\": null,\n\t\t\t\"Weight\": 10,\n\t\t\t\"Blocker\": false,\n\t\t\t\"SupplierParameters\": \"999\"\n\t\t\t},\n\t\t\t{\n\t\t\t\"ID\": \"SPL_VL_INTERNAL_OUT\",\n\t\t\t\"FilterIDs\": [\"*string:~*req.Subject:INTERNAL-OUT\",\"*string:~*req.Category:call-out\"],\n\t\t\t\"AccountIDs\": null,\n\t\t\t\"RatingPlanIDs\": [\"TP_RP_SPL_TEST_SUPPLIER_NAME_INTERNAL_DST_ID_RT_GR_LANDLINE_2019_01\"],\n\t\t\t\"ResourceIDs\": null,\n\t\t\t\"StatIDs\": null,\n\t\t\t\"Weight\": 10,\n\t\t\t\"Blocker\": false,\n\t\t\t\"SupplierParameters\": \"999\"\n\t\t\t}\n\t\t\n\t\t],\n\t\t\"Weight\": 10\n\t}]\n}\n\n\n" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -4939,7 +4939,7 @@ "response": [] }, { - "name": "ApierV1.SetSupplierProfile *qos", + "name": "APIerSv1.SetSupplierProfile *qos", "request": { "auth": { "type": "noauth" @@ -4953,7 +4953,7 @@ ], "body": { "mode": "raw", - "raw": "{\n\t\"method\": \"ApierV1.SetSupplierProfile\",\n\t\"params\": [{\n\t\t\"Tenant\": \"cgrates.org\",\n\t\t\"ID\": \"SPL_OTE_1_QOS\",\n\t\t\"FilterIDs\": null,\n\t\t\"ActivationInterval\": {\n\t\t\t\"ActivationTime\": \"2014-07-14T14:25:00Z\",\n\t\t\t\"ExpiryTime\": \"0001-01-01T00:00:00Z\"\n\t\t},\n\t\t\"Sorting\": \"*qos\",\n\t\t\"SortingParameters\": [\"*tcc\",\"*tcd\",\"*asr\",\"*acc\"],\n\t\t\"Suppliers\": [{\n\t\t\t\"ID\": \"SUPPLIER_ID_TEST1\",\n\t\t\t\"FilterIDs\": [],\n\t\t\t\"AccountIDs\": [\"+30xxxxxxxxxx\",\"+30xxxxxxxxx\"],\n\t\t\t\"RatingPlanIDs\": [\"RP_TWT\"],\n\t\t\t\"ResourceIDs\": [\"RSPROF_+30xxxxxxxxxx\"],\n\t\t\t\"StatIDs\": [\"STATS_+30xxxxxxxxxx\"],\n\t\t\t\"Weight\": 10,\n\t\t\t\"Blocker\": false,\n\t\t\t\"SupplierParameters\": \"SUPPLIER_PARAM_1\"\n\t\t}],\n\t\t\"Weight\": 10\n\t}]\n}" + "raw": "{\n\t\"method\": \"APIerSv1.SetSupplierProfile\",\n\t\"params\": [{\n\t\t\"Tenant\": \"cgrates.org\",\n\t\t\"ID\": \"SPL_OTE_1_QOS\",\n\t\t\"FilterIDs\": null,\n\t\t\"ActivationInterval\": {\n\t\t\t\"ActivationTime\": \"2014-07-14T14:25:00Z\",\n\t\t\t\"ExpiryTime\": \"0001-01-01T00:00:00Z\"\n\t\t},\n\t\t\"Sorting\": \"*qos\",\n\t\t\"SortingParameters\": [\"*tcc\",\"*tcd\",\"*asr\",\"*acc\"],\n\t\t\"Suppliers\": [{\n\t\t\t\"ID\": \"SUPPLIER_ID_TEST1\",\n\t\t\t\"FilterIDs\": [],\n\t\t\t\"AccountIDs\": [\"+30xxxxxxxxxx\",\"+30xxxxxxxxx\"],\n\t\t\t\"RatingPlanIDs\": [\"RP_TWT\"],\n\t\t\t\"ResourceIDs\": [\"RSPROF_+30xxxxxxxxxx\"],\n\t\t\t\"StatIDs\": [\"STATS_+30xxxxxxxxxx\"],\n\t\t\t\"Weight\": 10,\n\t\t\t\"Blocker\": false,\n\t\t\t\"SupplierParameters\": \"SUPPLIER_PARAM_1\"\n\t\t}],\n\t\t\"Weight\": 10\n\t}]\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -4968,7 +4968,7 @@ "response": [] }, { - "name": "ApierV1.GetSupplierProfile", + "name": "APIerSv1.GetSupplierProfile", "request": { "auth": { "type": "noauth" @@ -4982,7 +4982,7 @@ ], "body": { "mode": "raw", - "raw": "{\n\t\"method\": \"ApierV1.GetSupplierProfile\",\n\t\"params\": [{\n\t\t\"Tenant\": \"cgrates.org\",\n\t\t\"ID\": \"SPL_GR_WEIGHT_1\"\n\t\t\n\t\t}],\n\t\t\"Weight\": 10\n\t}]\n}" + "raw": "{\n\t\"method\": \"APIerSv1.GetSupplierProfile\",\n\t\"params\": [{\n\t\t\"Tenant\": \"cgrates.org\",\n\t\t\"ID\": \"SPL_GR_WEIGHT_1\"\n\t\t\n\t\t}],\n\t\t\"Weight\": 10\n\t}]\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -4997,7 +4997,7 @@ "response": [] }, { - "name": "ApierV1.GetSupplierProfile SPL_VL_INTERNAL", + "name": "APIerSv1.GetSupplierProfile SPL_VL_INTERNAL", "request": { "auth": { "type": "noauth" @@ -5011,7 +5011,7 @@ ], "body": { "mode": "raw", - "raw": "{\n\t\"method\": \"ApierV1.GetSupplierProfile\",\n\t\"params\": [{\n\t\t\"Tenant\": \"cgrates.org\",\n\t\t\"ID\": \"SPL_VL_INTERNAL\"\n\t\t\n\t\t}],\n\t\t\"Weight\": 10\n\t}]\n}" + "raw": "{\n\t\"method\": \"APIerSv1.GetSupplierProfile\",\n\t\"params\": [{\n\t\t\"Tenant\": \"cgrates.org\",\n\t\t\"ID\": \"SPL_VL_INTERNAL\"\n\t\t\n\t\t}],\n\t\t\"Weight\": 10\n\t}]\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -5026,7 +5026,7 @@ "response": [] }, { - "name": "ApierV1.RemoveSupplierProfile", + "name": "APIerSv1.RemoveSupplierProfile", "request": { "auth": { "type": "noauth" @@ -5040,7 +5040,7 @@ ], "body": { "mode": "raw", - "raw": "{\n\t\"method\": \"ApierV1.RemoveSupplierProfile\",\n\t\"params\": [{\n\t\t\"Tenant\": \"cgrates.org\",\n\t\t\"ID\": \"SPL_VL_INTERNAL\"\n\t\t\n\t\t}],\n\t\t\"Weight\": 10\n\t}]\n}" + "raw": "{\n\t\"method\": \"APIerSv1.RemoveSupplierProfile\",\n\t\"params\": [{\n\t\t\"Tenant\": \"cgrates.org\",\n\t\t\"ID\": \"SPL_VL_INTERNAL\"\n\t\t\n\t\t}],\n\t\t\"Weight\": 10\n\t}]\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -5055,7 +5055,7 @@ "response": [] }, { - "name": "ApierV1.GetSupplierProfileIDs", + "name": "APIerSv1.GetSupplierProfileIDs", "request": { "auth": { "type": "noauth" @@ -5069,7 +5069,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.GetSupplierProfileIDs\",\n \"params\": [\n {\n \"Tenant\": \"cgrates.org\"\n }\n ],\n \"id\": 12\n}" + "raw": "{\n \"method\": \"APIerSv1.GetSupplierProfileIDs\",\n \"params\": [\n {\n \"Tenant\": \"cgrates.org\"\n }\n ],\n \"id\": 12\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -5155,7 +5155,7 @@ "name": "Actions", "item": [ { - "name": "ApierV2.GetActions", + "name": "APIerSv2.GetActions", "request": { "auth": { "type": "noauth" @@ -5169,7 +5169,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV2.GetActions\",\n \"params\": [\n {\n \"ActionIDs\": [\"ACT_TOPUP_RST_10\"]\n }\n ]\n}" + "raw": "{\n \"method\": \"APIerSv2.GetActions\",\n \"params\": [\n {\n \"ActionIDs\": [\"ACT_TOPUP_RST_10\"]\n }\n ]\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -5184,7 +5184,7 @@ "response": [] }, { - "name": "ApierV2.GetActions All", + "name": "APIerSv2.GetActions All", "request": { "auth": { "type": "noauth" @@ -5200,7 +5200,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV2.GetActions\",\n \"params\": [\n {\n \"Offset\":0,\n \"Limit\":0\n }\n ]\n}", + "raw": "{\n \"method\": \"APIerSv2.GetActions\",\n \"params\": [\n {\n \"Offset\":0,\n \"Limit\":0\n }\n ]\n}", "options": { "raw": { "language": "json" @@ -5220,7 +5220,7 @@ "response": [] }, { - "name": "ApierV1.RemoveActions", + "name": "APIerSv1.RemoveActions", "request": { "auth": { "type": "noauth" @@ -5234,7 +5234,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.RemoveActions\",\n \"params\": [\n {\n \"ActionIDs\": [\n \"ACT_10050\",\"ACT_100500\"\n ]\n }\n ]\n}" + "raw": "{\n \"method\": \"APIerSv1.RemoveActions\",\n \"params\": [\n {\n \"ActionIDs\": [\n \"ACT_10050\",\"ACT_100500\"\n ]\n }\n ]\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -5249,7 +5249,7 @@ "response": [] }, { - "name": "ApierV1.SetActions", + "name": "APIerSv1.SetActions", "request": { "auth": { "type": "noauth" @@ -5263,7 +5263,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.SetActions\",\n \"params\": [\n {\n \"Actions\": [\n {\n \"Filter\": \"\",\n \"ExtraParameters\": \"\",\n \"BalanceWeight\": 10,\n \"BalanceType\": \"*monetary\",\n \"SharedGroups\": \"\",\n \"Categories\": \"\",\n \"Directions\": \"*out\",\n \"BalanceBlocker\": \"false\",\n \"BalanceId\": \"balance1\",\n \"ExpiryTime\": \"*unlimited\",\n \"RatingSubject\": \"\",\n \"Identifier\": \"*topup_reset\",\n \"DestinationIds\": \"*any\",\n \"Weight\": 10,\n \"BalanceDisabled\": \"false\",\n \"Units\": 100,\n \"TimingTags\": \"\",\n \"BalanceUuid\": \"e0669a66-86c2-42ea-bcb9-ae072e447d97\"\n }\n ],\n \"Overwrite\": true,\n \"ActionsId\": \"ACT_TOPUP_RST_10\"\n }\n ]\n}" + "raw": "{\n \"method\": \"APIerSv1.SetActions\",\n \"params\": [\n {\n \"Actions\": [\n {\n \"Filter\": \"\",\n \"ExtraParameters\": \"\",\n \"BalanceWeight\": 10,\n \"BalanceType\": \"*monetary\",\n \"SharedGroups\": \"\",\n \"Categories\": \"\",\n \"Directions\": \"*out\",\n \"BalanceBlocker\": \"false\",\n \"BalanceId\": \"balance1\",\n \"ExpiryTime\": \"*unlimited\",\n \"RatingSubject\": \"\",\n \"Identifier\": \"*topup_reset\",\n \"DestinationIds\": \"*any\",\n \"Weight\": 10,\n \"BalanceDisabled\": \"false\",\n \"Units\": 100,\n \"TimingTags\": \"\",\n \"BalanceUuid\": \"e0669a66-86c2-42ea-bcb9-ae072e447d97\"\n }\n ],\n \"Overwrite\": true,\n \"ActionsId\": \"ACT_TOPUP_RST_10\"\n }\n ]\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -5278,7 +5278,7 @@ "response": [] }, { - "name": "ApierV1.SetActions", + "name": "APIerSv1.SetActions", "request": { "auth": { "type": "noauth" @@ -5292,7 +5292,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.SetActions\",\n \"params\": [\n {\n \"Actions\": [\n {\n \"Filter\": null,\n \"ExtraParameters\": null,\n \"BalanceWeight\": null,\n \"BalanceType\": null,\n \"SharedGroups\": null,\n \"Categories\": null,\n \"Directions\": null,\n \"BalanceBlocker\": \"false\",\n \"BalanceId\": null,\n \"ExpiryTime\": null,\n \"RatingSubject\": null,\n \"Identifier\": \"*log\",\n \"DestinationIds\": null,\n \"Weight\": 10,\n \"BalanceDisabled\": \"false\",\n \"Units\": null,\n \"TimingTags\": \"\",\n \"BalanceUuid\": \"\"\n }\n ],\n \"Overwrite\": true,\n \"ActionsId\": \"test1\"\n }\n ]\n}" + "raw": "{\n \"method\": \"APIerSv1.SetActions\",\n \"params\": [\n {\n \"Actions\": [\n {\n \"Filter\": null,\n \"ExtraParameters\": null,\n \"BalanceWeight\": null,\n \"BalanceType\": null,\n \"SharedGroups\": null,\n \"Categories\": null,\n \"Directions\": null,\n \"BalanceBlocker\": \"false\",\n \"BalanceId\": null,\n \"ExpiryTime\": null,\n \"RatingSubject\": null,\n \"Identifier\": \"*log\",\n \"DestinationIds\": null,\n \"Weight\": 10,\n \"BalanceDisabled\": \"false\",\n \"Units\": null,\n \"TimingTags\": \"\",\n \"BalanceUuid\": \"\"\n }\n ],\n \"Overwrite\": true,\n \"ActionsId\": \"test1\"\n }\n ]\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -5313,7 +5313,7 @@ "name": "ActionPlans", "item": [ { - "name": "ApierV1.SetActionPlan", + "name": "APIerSv1.SetActionPlan", "request": { "auth": { "type": "noauth" @@ -5327,7 +5327,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.SetActionPlan\",\n \"params\": [\n {\n \"Id\": \"ACP_10050\",\n \"ReloadScheduler\": true,\n \"ActionPlan\": [\n {\n \"MonthDays\": \"*any\",\n \"Years\": \"*any\",\n \"WeekDays\": \"*any\",\n \"Time\": \"*asap\",\n \"ActionsId\": \"ACT_10050\",\n \"Weight\": 10,\n \"Months\": \"*any\"\n }\n ],\n \"Overwrite\": true,\n \"ReloadScheduler\": true\n }\n ]\n}" + "raw": "{\n \"method\": \"APIerSv1.SetActionPlan\",\n \"params\": [\n {\n \"Id\": \"ACP_10050\",\n \"ReloadScheduler\": true,\n \"ActionPlan\": [\n {\n \"MonthDays\": \"*any\",\n \"Years\": \"*any\",\n \"WeekDays\": \"*any\",\n \"Time\": \"*asap\",\n \"ActionsId\": \"ACT_10050\",\n \"Weight\": 10,\n \"Months\": \"*any\"\n }\n ],\n \"Overwrite\": true,\n \"ReloadScheduler\": true\n }\n ]\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -5342,7 +5342,7 @@ "response": [] }, { - "name": "ApierV1.RemoveActionPlan", + "name": "APIerSv1.RemoveActionPlan", "request": { "auth": { "type": "noauth" @@ -5356,7 +5356,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.RemoveActionPlan\",\n \"params\": [\n {\n \"ID\": \"ACP_10050\"\n \n }\n ]\n}" + "raw": "{\n \"method\": \"APIerSv1.RemoveActionPlan\",\n \"params\": [\n {\n \"ID\": \"ACP_10050\"\n \n }\n ]\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -5371,7 +5371,7 @@ "response": [] }, { - "name": "ApierV1.GetActionPlanIDs", + "name": "APIerSv1.GetActionPlanIDs", "request": { "method": "POST", "header": [ @@ -5384,7 +5384,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.GetActionPlanIDs\",\n \"params\": [\n {\n \"Tenant\": \"cgrates.org\",\n \"Limit\": null,\n \"Offset\": null\n }\n ],\n \"id\": 10\n}", + "raw": "{\n \"method\": \"APIerSv1.GetActionPlanIDs\",\n \"params\": [\n {\n \"Tenant\": \"cgrates.org\",\n \"Limit\": null,\n \"Offset\": null\n }\n ],\n \"id\": 10\n}", "options": { "raw": { "language": "json" @@ -5410,7 +5410,7 @@ "name": "Thresholds", "item": [ { - "name": "ApierV1.SetThresholdProfile", + "name": "APIerSv1.SetThresholdProfile", "request": { "auth": { "type": "noauth" @@ -5424,7 +5424,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.SetThresholdProfile\",\n \"params\": [\n {\n \"Tenant\": \"cgrates.org\",\n \"ID\":\"THD_ACNT_+30xxxxxxxxx\",\n \"FilterIDs\": [\n \t\"FLTR_ACNT_+30xxxxxxxxx\"\n \t],\n \"ActivationInterval\": {\n \t\"ActivationTime\": \"2014-07-29T15:00:00Z\",\n \t\"ExpiryTime\": \"0001-01-01T00:00:00Z\"\n \t},\n \"MaxHits\": -1,\n \"MinHits\": 1,\n \"MinSleep\": 1000000000,\n \"Blocker\": false,\n \"Weight\": 10,\n \"ActionIDs\": [\n \"ACT_LOG_WARNING\"\n ],\n \"Async\": false\n\n }\n ]\n}" + "raw": "{\n \"method\": \"APIerSv1.SetThresholdProfile\",\n \"params\": [\n {\n \"Tenant\": \"cgrates.org\",\n \"ID\":\"THD_ACNT_+30xxxxxxxxx\",\n \"FilterIDs\": [\n \t\"FLTR_ACNT_+30xxxxxxxxx\"\n \t],\n \"ActivationInterval\": {\n \t\"ActivationTime\": \"2014-07-29T15:00:00Z\",\n \t\"ExpiryTime\": \"0001-01-01T00:00:00Z\"\n \t},\n \"MaxHits\": -1,\n \"MinHits\": 1,\n \"MinSleep\": 1000000000,\n \"Blocker\": false,\n \"Weight\": 10,\n \"ActionIDs\": [\n \"ACT_LOG_WARNING\"\n ],\n \"Async\": false\n\n }\n ]\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -5439,7 +5439,7 @@ "response": [] }, { - "name": "ApierV1.SetThresholdProfile Example 1 - BalanceUpdate", + "name": "APIerSv1.SetThresholdProfile Example 1 - BalanceUpdate", "request": { "auth": { "type": "noauth" @@ -5453,7 +5453,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.SetThresholdProfile\",\n \"params\": [\n {\n \"Tenant\": \"cgrates.org\",\n \"ID\":\"THD_+30xxxxxxxxx_BALANCEUPDATE_GREATER_OR_EQUAL\",\n \"FilterIDs\": [\n \t\"FLTR_+30xxxxxxxxx_BALANCEUPDATE_GREATER_OR_EQUAL\"\n \t],\n \"ActivationInterval\": {\n \t\"ActivationTime\": \"2014-07-29T15:00:00Z\",\n \t\"ExpiryTime\": \"0001-01-01T00:00:00Z\"\n \t},\n \"MaxHits\": -1,\n \"MinHits\": 1,\n \"MinSleep\": 1000000000,\n \"Blocker\": false,\n \"Weight\": 10,\n \"ActionIDs\": [\n \"ACT_LOG_WARNING\"\n ],\n \"Async\": false\n\n }\n ]\n}" + "raw": "{\n \"method\": \"APIerSv1.SetThresholdProfile\",\n \"params\": [\n {\n \"Tenant\": \"cgrates.org\",\n \"ID\":\"THD_+30xxxxxxxxx_BALANCEUPDATE_GREATER_OR_EQUAL\",\n \"FilterIDs\": [\n \t\"FLTR_+30xxxxxxxxx_BALANCEUPDATE_GREATER_OR_EQUAL\"\n \t],\n \"ActivationInterval\": {\n \t\"ActivationTime\": \"2014-07-29T15:00:00Z\",\n \t\"ExpiryTime\": \"0001-01-01T00:00:00Z\"\n \t},\n \"MaxHits\": -1,\n \"MinHits\": 1,\n \"MinSleep\": 1000000000,\n \"Blocker\": false,\n \"Weight\": 10,\n \"ActionIDs\": [\n \"ACT_LOG_WARNING\"\n ],\n \"Async\": false\n\n }\n ]\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -5468,7 +5468,7 @@ "response": [] }, { - "name": "ApierV1.GetThresholdProfile", + "name": "APIerSv1.GetThresholdProfile", "request": { "auth": { "type": "noauth" @@ -5482,7 +5482,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.GetThresholdProfile\",\n \"params\": [\n {\n \"Tenant\": \"cgrates.org\",\n \"ID\":\"THD_ACNT_+30xxxxxxxxxx\"\n\n }\n ]\n}\n\n" + "raw": "{\n \"method\": \"APIerSv1.GetThresholdProfile\",\n \"params\": [\n {\n \"Tenant\": \"cgrates.org\",\n \"ID\":\"THD_ACNT_+30xxxxxxxxxx\"\n\n }\n ]\n}\n\n" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -5622,7 +5622,7 @@ "name": "TP Chargers", "item": [ { - "name": "ApierV1.GetTPChargers TODO", + "name": "APIerSv1.GetTPChargers TODO", "request": { "auth": { "type": "noauth" @@ -5636,7 +5636,7 @@ ], "body": { "mode": "raw", - "raw": "{\r\n \"id\":\"11111\",\r\n \"method\":\"ApierV1.GetTPChargers\",\r\n \"params\":[\r\n {\r\n\t\"tpid\":[\"*default\"],\r\n\t\"tenant\":[\"cgrates.org\"],\r\n ..........\r\n ......\r\n \r\n }\r\n ]\r\n}" + "raw": "{\r\n \"id\":\"11111\",\r\n \"method\":\"APIerSv1.GetTPChargers\",\r\n \"params\":[\r\n {\r\n\t\"tpid\":[\"*default\"],\r\n\t\"tenant\":[\"cgrates.org\"],\r\n ..........\r\n ......\r\n \r\n }\r\n ]\r\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -5655,7 +5655,7 @@ "_postman_isSubFolder": true }, { - "name": "ApierV1.GetChargerProfile", + "name": "APIerSv1.GetChargerProfile", "request": { "auth": { "type": "noauth" @@ -5669,7 +5669,7 @@ ], "body": { "mode": "raw", - "raw": "{\r\n \"method\": \"ApierV1.GetChargerProfile\",\r\n \"params\": [\r\n {\r\n \"Tenant\": \"cgrates.org\",\r\n \"ID\": \"SPL_TEST_SUPPLIER_NAME_In\"\r\n \r\n\r\n }\r\n ]\r\n}\r\n" + "raw": "{\r\n \"method\": \"APIerSv1.GetChargerProfile\",\r\n \"params\": [\r\n {\r\n \"Tenant\": \"cgrates.org\",\r\n \"ID\": \"SPL_TEST_SUPPLIER_NAME_In\"\r\n \r\n\r\n }\r\n ]\r\n}\r\n" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -5684,7 +5684,7 @@ "response": [] }, { - "name": "ApierV1.SetChargerProfile", + "name": "APIerSv1.SetChargerProfile", "request": { "auth": { "type": "noauth" @@ -5698,7 +5698,7 @@ ], "body": { "mode": "raw", - "raw": "{\r\n \"method\": \"ApierV1.SetChargerProfile\",\r\n \"params\": [\r\n {\r\n \"Tenant\": \"cgrates.org\",\r\n \"ID\": \"SupplierCharges\",\r\n \"FilterIDs\": [],\r\n \"ActivationInterval\": null,\r\n \"RunID\": \"SupplierCharges\",\r\n \"AttributeIDs\": [\r\n \"ATTR_SUPPLIER1\"\r\n ],\r\n \"Weight\": 0\r\n \r\n }\r\n ]\r\n}\r\n\r\n\r\n\r\n" + "raw": "{\r\n \"method\": \"APIerSv1.SetChargerProfile\",\r\n \"params\": [\r\n {\r\n \"Tenant\": \"cgrates.org\",\r\n \"ID\": \"SupplierCharges\",\r\n \"FilterIDs\": [],\r\n \"ActivationInterval\": null,\r\n \"RunID\": \"SupplierCharges\",\r\n \"AttributeIDs\": [\r\n \"ATTR_SUPPLIER1\"\r\n ],\r\n \"Weight\": 0\r\n \r\n }\r\n ]\r\n}\r\n\r\n\r\n\r\n" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -5713,7 +5713,7 @@ "response": [] }, { - "name": "ApierV1.SetChargerProfile Set CustomerCharges", + "name": "APIerSv1.SetChargerProfile Set CustomerCharges", "request": { "auth": { "type": "noauth" @@ -5727,7 +5727,7 @@ ], "body": { "mode": "raw", - "raw": "{\r\n \"method\": \"ApierV1.SetChargerProfile\",\r\n \"params\": [\r\n {\r\n \"Tenant\": \"cgrates.org\",\r\n \"ID\": \"CustomerCharges\",\r\n \"FilterIDs\": null,\r\n \"ActivationInterval\": null,\r\n \"RunID\": \"CustomerCharges\",\r\n \"AttributeIDs\": [\"*none\"],\r\n \"Weight\": 0\r\n \r\n }\r\n ]\r\n}\r\n" + "raw": "{\r\n \"method\": \"APIerSv1.SetChargerProfile\",\r\n \"params\": [\r\n {\r\n \"Tenant\": \"cgrates.org\",\r\n \"ID\": \"CustomerCharges\",\r\n \"FilterIDs\": null,\r\n \"ActivationInterval\": null,\r\n \"RunID\": \"CustomerCharges\",\r\n \"AttributeIDs\": [\"*none\"],\r\n \"Weight\": 0\r\n \r\n }\r\n ]\r\n}\r\n" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -5742,7 +5742,7 @@ "response": [] }, { - "name": "ApierV1.SetChargerProfile Set SPL_TESTSUPPLIER1_In", + "name": "APIerSv1.SetChargerProfile Set SPL_TESTSUPPLIER1_In", "request": { "auth": { "type": "noauth" @@ -5756,7 +5756,7 @@ ], "body": { "mode": "raw", - "raw": "{\r\n \"method\": \"ApierV1.SetChargerProfile\",\r\n \"params\": [\r\n {\r\n \"Tenant\": \"cgrates.org\",\r\n \"ID\": \"SPL_TESTSUPPLIER1_In\",\r\n \"FilterIDs\": [],\r\n \"ActivationInterval\": null,\r\n \"RunID\": \"SPL_TESTSUPPLIER1_In\",\r\n \"AttributeIDs\": [\"ATTR_SPL_TESTSUPPLIER1_In\"],\r\n \"Weight\": 0\r\n \r\n }\r\n ]\r\n}\r\n" + "raw": "{\r\n \"method\": \"APIerSv1.SetChargerProfile\",\r\n \"params\": [\r\n {\r\n \"Tenant\": \"cgrates.org\",\r\n \"ID\": \"SPL_TESTSUPPLIER1_In\",\r\n \"FilterIDs\": [],\r\n \"ActivationInterval\": null,\r\n \"RunID\": \"SPL_TESTSUPPLIER1_In\",\r\n \"AttributeIDs\": [\"ATTR_SPL_TESTSUPPLIER1_In\"],\r\n \"Weight\": 0\r\n \r\n }\r\n ]\r\n}\r\n" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -5771,7 +5771,7 @@ "response": [] }, { - "name": "ApierV1.SetChargerProfile Set SPL_TESTSUPPLIER1_Out", + "name": "APIerSv1.SetChargerProfile Set SPL_TESTSUPPLIER1_Out", "request": { "auth": { "type": "noauth" @@ -5787,7 +5787,7 @@ ], "body": { "mode": "raw", - "raw": "{\r\n \"method\": \"ApierV1.SetChargerProfile\",\r\n \"params\": [\r\n {\r\n \"Tenant\": \"cgrates.org\",\r\n \"ID\": \"SPL_TESTSUPPLIER1_Out\",\r\n \"FilterIDs\": [\"FLTR_NOT_INTERNAL\"],\r\n \"ActivationInterval\": null,\r\n \"RunID\": \"SPL_TESTSUPPLIER1_Out\",\r\n \"AttributeIDs\": [\"ATTR_SPL_TESTSUPPLIER1_Out\"],\r\n \"Weight\": 0\r\n \r\n }\r\n ]\r\n}\r\n", + "raw": "{\r\n \"method\": \"APIerSv1.SetChargerProfile\",\r\n \"params\": [\r\n {\r\n \"Tenant\": \"cgrates.org\",\r\n \"ID\": \"SPL_TESTSUPPLIER1_Out\",\r\n \"FilterIDs\": [\"FLTR_NOT_INTERNAL\"],\r\n \"ActivationInterval\": null,\r\n \"RunID\": \"SPL_TESTSUPPLIER1_Out\",\r\n \"AttributeIDs\": [\"ATTR_SPL_TESTSUPPLIER1_Out\"],\r\n \"Weight\": 0\r\n \r\n }\r\n ]\r\n}\r\n", "options": { "raw": { "language": "json" @@ -5807,7 +5807,7 @@ "response": [] }, { - "name": "ApierV1.RemoveChargerProfile", + "name": "APIerSv1.RemoveChargerProfile", "request": { "auth": { "type": "noauth" @@ -5821,7 +5821,7 @@ ], "body": { "mode": "raw", - "raw": "{\r\n \"method\": \"ApierV1.RemoveChargerProfile\",\r\n \"params\": [\r\n {\r\n \"Tenant\": \"cgrates.org\",\r\n \"ID\": \"CustomerCharges\"\r\n \r\n\r\n }\r\n ]\r\n}\r\n" + "raw": "{\r\n \"method\": \"APIerSv1.RemoveChargerProfile\",\r\n \"params\": [\r\n {\r\n \"Tenant\": \"cgrates.org\",\r\n \"ID\": \"CustomerCharges\"\r\n \r\n\r\n }\r\n ]\r\n}\r\n" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -5836,7 +5836,7 @@ "response": [] }, { - "name": "ApierV1.GetChargerProfileIDs", + "name": "APIerSv1.GetChargerProfileIDs", "request": { "auth": { "type": "noauth" @@ -5850,7 +5850,7 @@ ], "body": { "mode": "raw", - "raw": "{\r\n \"method\": \"ApierV1.GetChargerProfileIDs\",\r\n \"params\": [\r\n {\r\n \"Tenant\": \"cgrates.org\"\r\n \r\n\r\n }\r\n ]\r\n}\r\n" + "raw": "{\r\n \"method\": \"APIerSv1.GetChargerProfileIDs\",\r\n \"params\": [\r\n {\r\n \"Tenant\": \"cgrates.org\"\r\n \r\n\r\n }\r\n ]\r\n}\r\n" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -6167,7 +6167,7 @@ "name": "GetCost", "item": [ { - "name": "ApierV1.GetCost - SUPPLIER1", + "name": "APIerSv1.GetCost - SUPPLIER1", "request": { "auth": { "type": "noauth" @@ -6181,7 +6181,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\":\"ApierV1.GetCost\",\n \"params\":[\n {\n \"Direction\":\"*out\",\n \"Category\": \"call-in\",\n \"Tenant\": \"cgrates.org\",\n \"Subject\": \"INTERNAL-IN\",\n \"Destination\": \"+30xxxxxxxxxx\",\n \"AnswerTime\": \"2017-09-12T15:12:23.190554134+02:00\",\n \"Usage\":\"60s\"\n }\n],\n\"id\":0\n}" + "raw": "{\n \"method\":\"APIerSv1.GetCost\",\n \"params\":[\n {\n \"Direction\":\"*out\",\n \"Category\": \"call-in\",\n \"Tenant\": \"cgrates.org\",\n \"Subject\": \"INTERNAL-IN\",\n \"Destination\": \"+30xxxxxxxxxx\",\n \"AnswerTime\": \"2017-09-12T15:12:23.190554134+02:00\",\n \"Usage\":\"60s\"\n }\n],\n\"id\":0\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -6196,7 +6196,7 @@ "response": [] }, { - "name": "ApierV1.GetCost", + "name": "APIerSv1.GetCost", "request": { "auth": { "type": "noauth" @@ -6210,7 +6210,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\":\"ApierV1.GetCost\",\n \"params\":[\n {\n \"Tenant\": \"cgrates.org\",\n \"Category\": \"call-out\",\n \"Subject\": \"INTERNAL-OUT\",\n \"Destination\": \"+30xxxxxxxxxx\",\n \"AnswerTime\": \"2018-09-12T15:12:23.190554134+02:00\",\n \"Usage\":\"60s\"\n }\n],\n\"id\":0\n}" + "raw": "{\n \"method\":\"APIerSv1.GetCost\",\n \"params\":[\n {\n \"Tenant\": \"cgrates.org\",\n \"Category\": \"call-out\",\n \"Subject\": \"INTERNAL-OUT\",\n \"Destination\": \"+30xxxxxxxxxx\",\n \"AnswerTime\": \"2018-09-12T15:12:23.190554134+02:00\",\n \"Usage\":\"60s\"\n }\n],\n\"id\":0\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -6240,7 +6240,7 @@ "name": "Add 500 Minutes GR_LANDLINE to Account - No Expiration", "item": [ { - "name": "1. ApierV1.SetDestination GR_LANDLINE", + "name": "1. APIerSv1.SetDestination GR_LANDLINE", "request": { "auth": { "type": "noauth" @@ -6256,7 +6256,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"id\": 6,\n \"method\": \"ApierV1.SetDestination\",\n \"params\": [\n \t{\n \t\t\"Id\":\"GR_LANDLINE\",\n \"Prefixes\": [\"+302\"],\n \"Overwrite\":true\n \t\t\n \t}\n ]\n}", + "raw": "{\n \"id\": 6,\n \"method\": \"APIerSv1.SetDestination\",\n \"params\": [\n \t{\n \t\t\"Id\":\"GR_LANDLINE\",\n \"Prefixes\": [\"+302\"],\n \"Overwrite\":true\n \t\t\n \t}\n ]\n}", "options": { "raw": { "language": "json" @@ -6276,7 +6276,7 @@ "response": [] }, { - "name": "2. ApierV1.SetAction *voice ONLY", + "name": "2. APIerSv1.SetAction *voice ONLY", "request": { "auth": { "type": "noauth" @@ -6292,7 +6292,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.SetActions\",\n \"params\": [\n {\n \"Actions\": [\n {\n \"Identifier\": \"*topup_reset\",\n \"BalanceId\": \"500MINUTES\",\n\t\t\t\t\t\"BalanceUuid\": \"71e73e45-a471-4059-b738-7f66adc72\",\n\t \"BalanceType\": \"*voice\",\n \"Directions\": null,\n \"Units\": 30000000000000,\n \"ExpiryTime\": \"*unlimited\",\n \"Filter\": null,\n \"TimingTags\": \"*any\",\n \"DestinationIds\": \"GR_LANDLINE\",\n \"RatingSubject\": null,\n \"Categories\": null,\n \"SharedGroups\": null,\n \"BalanceWeight\": 30,\n \"ExtraParameters\": null,\n \"BalanceBlocker\": \"false\",\n \"BalanceDisabled\": \"false\",\n \"Weight\": 10\n \n }\n ],\n \"Overwrite\": true,\n \"ActionsId\": \"TOPUP_PKG_500_GR\"\n }\n ]\n}\n", + "raw": "{\n \"method\": \"APIerSv1.SetActions\",\n \"params\": [\n {\n \"Actions\": [\n {\n \"Identifier\": \"*topup_reset\",\n \"BalanceId\": \"500MINUTES\",\n\t\t\t\t\t\"BalanceUuid\": \"71e73e45-a471-4059-b738-7f66adc72\",\n\t \"BalanceType\": \"*voice\",\n \"Directions\": null,\n \"Units\": 30000000000000,\n \"ExpiryTime\": \"*unlimited\",\n \"Filter\": null,\n \"TimingTags\": \"*any\",\n \"DestinationIds\": \"GR_LANDLINE\",\n \"RatingSubject\": null,\n \"Categories\": null,\n \"SharedGroups\": null,\n \"BalanceWeight\": 30,\n \"ExtraParameters\": null,\n \"BalanceBlocker\": \"false\",\n \"BalanceDisabled\": \"false\",\n \"Weight\": 10\n \n }\n ],\n \"Overwrite\": true,\n \"ActionsId\": \"TOPUP_PKG_500_GR\"\n }\n ]\n}\n", "options": { "raw": { "language": "json" @@ -6312,7 +6312,7 @@ "response": [] }, { - "name": "2. ApierV1.SetActionPlan", + "name": "2. APIerSv1.SetActionPlan", "request": { "auth": { "type": "noauth" @@ -6328,7 +6328,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.SetActionPlan\",\n \"params\": [\n {\n \"Id\": \"ACP_+30xxxxxxxxx_TOPUP_PKG_500_GR\",\n \"ReloadScheduler\": true,\n \"Overwrite\": true,\n\n \"ActionPlan\": [\n {\n \t \"ActionsId\": \"TOPUP_PKG_500_GR\",\n \"MonthDays\": \"*any\",\n \"Years\": \"*any\",\n \"WeekDays\": \"*any\",\n \"Months\": \"*any\",\n \"Time\": \"*asap\",\n \"Weight\": 10\n\n }\n ]\n }\n ]\n}", + "raw": "{\n \"method\": \"APIerSv1.SetActionPlan\",\n \"params\": [\n {\n \"Id\": \"ACP_+30xxxxxxxxx_TOPUP_PKG_500_GR\",\n \"ReloadScheduler\": true,\n \"Overwrite\": true,\n\n \"ActionPlan\": [\n {\n \t \"ActionsId\": \"TOPUP_PKG_500_GR\",\n \"MonthDays\": \"*any\",\n \"Years\": \"*any\",\n \"WeekDays\": \"*any\",\n \"Months\": \"*any\",\n \"Time\": \"*asap\",\n \"Weight\": 10\n\n }\n ]\n }\n ]\n}", "options": { "raw": { "language": "json" @@ -6348,7 +6348,7 @@ "response": [] }, { - "name": "3. ApierV2.SetAccount", + "name": "3. APIerSv2.SetAccount", "request": { "auth": { "type": "noauth" @@ -6364,7 +6364,7 @@ ], "body": { "mode": "raw", - "raw": "{\"method\": \"ApierV2.SetAccount\",\n \"params\": [{\n \"Tenant\": \"cgrates.org\", \n \"Account\": \"+30xxxxxxxxx\", \n \"ActionPlanIDs\": [\"ACP_+30xxxxxxxxx_TOPUP_PKG_500_GR\"], \n \"ActionPlansOverwrite\": true,\n \"AllowNegative\": false,\n \"Disabled\": false,\n \"ReloadScheduler\": true \n }]\n}\n\n\n", + "raw": "{\"method\": \"APIerSv2.SetAccount\",\n \"params\": [{\n \"Tenant\": \"cgrates.org\", \n \"Account\": \"+30xxxxxxxxx\", \n \"ActionPlanIDs\": [\"ACP_+30xxxxxxxxx_TOPUP_PKG_500_GR\"], \n \"ActionPlansOverwrite\": true,\n \"AllowNegative\": false,\n \"Disabled\": false,\n \"ReloadScheduler\": true \n }]\n}\n\n\n", "options": { "raw": { "language": "json" @@ -6391,7 +6391,7 @@ "name": "Add 500 FREE Minutes GR_LANDLINE - No Expiry - Per Minute", "item": [ { - "name": "1. ApierV1.SetAction *voice ONLY", + "name": "1. APIerSv1.SetAction *voice ONLY", "request": { "auth": { "type": "noauth" @@ -6405,7 +6405,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.SetActions\",\n \"params\": [\n {\n \"Actions\": [\n {\n \"Identifier\": \"*topup_reset\",\n \"BalanceId\": \"500MINUTES\",\n\t\t\t\t\t\"BalanceUuid\": \"71e73e45-a471-4059-b738-7f66adc72\",\n\t \"BalanceType\": \"*voice\",\n \"Directions\": null,\n \"Units\": 30000000000000,\n \"ExpiryTime\": \"*unlimited\",\n \"Filter\": null,\n \"TimingTags\": \"*any\",\n \"DestinationIds\": \"GR_LANDLINE\",\n \"RatingSubject\": \"*zero1m\",\n \"Categories\": null,\n \"SharedGroups\": null,\n \"BalanceWeight\": 30,\n \"ExtraParameters\": null,\n \"BalanceBlocker\": \"false\",\n \"BalanceDisabled\": \"false\",\n \"Weight\": 10\n \n }\n ],\n \"Overwrite\": true,\n \"ActionsId\": \"TOPUP_PKG_500M_GR_LANDLINE_FREE_UNLIMITED\"\n }\n ]\n}\n" + "raw": "{\n \"method\": \"APIerSv1.SetActions\",\n \"params\": [\n {\n \"Actions\": [\n {\n \"Identifier\": \"*topup_reset\",\n \"BalanceId\": \"500MINUTES\",\n\t\t\t\t\t\"BalanceUuid\": \"71e73e45-a471-4059-b738-7f66adc72\",\n\t \"BalanceType\": \"*voice\",\n \"Directions\": null,\n \"Units\": 30000000000000,\n \"ExpiryTime\": \"*unlimited\",\n \"Filter\": null,\n \"TimingTags\": \"*any\",\n \"DestinationIds\": \"GR_LANDLINE\",\n \"RatingSubject\": \"*zero1m\",\n \"Categories\": null,\n \"SharedGroups\": null,\n \"BalanceWeight\": 30,\n \"ExtraParameters\": null,\n \"BalanceBlocker\": \"false\",\n \"BalanceDisabled\": \"false\",\n \"Weight\": 10\n \n }\n ],\n \"Overwrite\": true,\n \"ActionsId\": \"TOPUP_PKG_500M_GR_LANDLINE_FREE_UNLIMITED\"\n }\n ]\n}\n" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -6420,7 +6420,7 @@ "response": [] }, { - "name": "2. ApierV1.SetActionPlan", + "name": "2. APIerSv1.SetActionPlan", "request": { "auth": { "type": "noauth" @@ -6434,7 +6434,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.SetActionPlan\",\n \"params\": [\n {\n \"Id\": \"ACP_TOPUP_PKG_500M_GR_LANDLINE_FREE_UNLIMITED\",\n \"ReloadScheduler\": true,\n \"Overwrite\": true,\n\n \"ActionPlan\": [\n {\n \t \"ActionsId\": \"TOPUP_PKG_500M_GR_LANDLINE_FREE_UNLIMITED\",\n \"MonthDays\": \"*any\",\n \"Years\": \"*any\",\n \"WeekDays\": \"*any\",\n \"Months\": \"*any\",\n \"Time\": \"*asap\",\n \"Weight\": 10\n\n }\n ]\n }\n ]\n}" + "raw": "{\n \"method\": \"APIerSv1.SetActionPlan\",\n \"params\": [\n {\n \"Id\": \"ACP_TOPUP_PKG_500M_GR_LANDLINE_FREE_UNLIMITED\",\n \"ReloadScheduler\": true,\n \"Overwrite\": true,\n\n \"ActionPlan\": [\n {\n \t \"ActionsId\": \"TOPUP_PKG_500M_GR_LANDLINE_FREE_UNLIMITED\",\n \"MonthDays\": \"*any\",\n \"Years\": \"*any\",\n \"WeekDays\": \"*any\",\n \"Months\": \"*any\",\n \"Time\": \"*asap\",\n \"Weight\": 10\n\n }\n ]\n }\n ]\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -6449,7 +6449,7 @@ "response": [] }, { - "name": "3. ApierV2.SetAccount", + "name": "3. APIerSv2.SetAccount", "request": { "auth": { "type": "noauth" @@ -6463,7 +6463,7 @@ ], "body": { "mode": "raw", - "raw": "{\"method\": \"ApierV2.SetAccount\",\n \"params\": [{\n \"Tenant\": \"cgrates.org\", \n \"Account\": \"+30xxxxxxxxx\", \n \"ActionPlanIDs\": [\"ACP_TOPUP_PKG_500M_GR_LANDLINE_FREE_UNLIMITED\"], \n \"ActionPlansOverwrite\": true,\n \"AllowNegative\": false,\n \"Disabled\": false,\n \"ReloadScheduler\": true \n }]\n}\n\n\n" + "raw": "{\"method\": \"APIerSv2.SetAccount\",\n \"params\": [{\n \"Tenant\": \"cgrates.org\", \n \"Account\": \"+30xxxxxxxxx\", \n \"ActionPlanIDs\": [\"ACP_TOPUP_PKG_500M_GR_LANDLINE_FREE_UNLIMITED\"], \n \"ActionPlansOverwrite\": true,\n \"AllowNegative\": false,\n \"Disabled\": false,\n \"ReloadScheduler\": true \n }]\n}\n\n\n" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -6485,7 +6485,7 @@ "name": "Add 500 FREE Minutes GR_LANDLINE - for X Days", "item": [ { - "name": "1. ApierV1.SetAction *voice ONLY", + "name": "1. APIerSv1.SetAction *voice ONLY", "request": { "auth": { "type": "noauth" @@ -6499,7 +6499,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.SetActions\",\n \"params\": [\n {\n \"Actions\": [\n {\n \"Identifier\": \"*topup_reset\",\n \"BalanceId\": \"PKG_500M_GR_LANDLINE_FREE_30D\",\n\t\t\t\t\t\"BalanceUuid\": \"71e73e45-a471-4059-b738-7f66adc72\",\n\t \"BalanceType\": \"*voice\",\n \"Directions\": null,\n \"Units\": 30000000000000,\n \"ExpiryTime\": \"2019-07-23T13:03:38Z\",\n \"Filter\": null,\n \"TimingTags\": \"*any\",\n \"DestinationIds\": \"GR_LANDLINE\",\n \"RatingSubject\": null,\n \"Categories\": null,\n \"SharedGroups\": null,\n \"BalanceWeight\": 30,\n \"ExtraParameters\": null,\n \"BalanceBlocker\": \"false\",\n \"BalanceDisabled\": \"false\",\n \"Weight\": 10\n \n }\n ],\n \"Overwrite\": true,\n \"ActionsId\": \"TOPUP_PKG_500M_GR_LANDLINE_FREE_30D\"\n }\n ]\n}\n\n" + "raw": "{\n \"method\": \"APIerSv1.SetActions\",\n \"params\": [\n {\n \"Actions\": [\n {\n \"Identifier\": \"*topup_reset\",\n \"BalanceId\": \"PKG_500M_GR_LANDLINE_FREE_30D\",\n\t\t\t\t\t\"BalanceUuid\": \"71e73e45-a471-4059-b738-7f66adc72\",\n\t \"BalanceType\": \"*voice\",\n \"Directions\": null,\n \"Units\": 30000000000000,\n \"ExpiryTime\": \"2019-07-23T13:03:38Z\",\n \"Filter\": null,\n \"TimingTags\": \"*any\",\n \"DestinationIds\": \"GR_LANDLINE\",\n \"RatingSubject\": null,\n \"Categories\": null,\n \"SharedGroups\": null,\n \"BalanceWeight\": 30,\n \"ExtraParameters\": null,\n \"BalanceBlocker\": \"false\",\n \"BalanceDisabled\": \"false\",\n \"Weight\": 10\n \n }\n ],\n \"Overwrite\": true,\n \"ActionsId\": \"TOPUP_PKG_500M_GR_LANDLINE_FREE_30D\"\n }\n ]\n}\n\n" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -6514,7 +6514,7 @@ "response": [] }, { - "name": "2. ApierV1.SetActionPlan", + "name": "2. APIerSv1.SetActionPlan", "request": { "auth": { "type": "noauth" @@ -6528,7 +6528,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.SetActionPlan\",\n \"params\": [\n {\n \"Id\": \"ACP_TOPUP_PKG_500M_GR_LANDLINE_FREE_30D\",\n \"ReloadScheduler\": true,\n \"Overwrite\": true,\n\n \"ActionPlan\": [\n {\n \t \"ActionsId\": \"TOPUP_PKG_500M_GR_LANDLINE_FREE_30D\",\n \"MonthDays\": \"*any\",\n \"Years\": \"*any\",\n \"WeekDays\": \"*any\",\n \"Months\": \"*any\",\n \"Time\": \"*asap\",\n \"Weight\": 10\n\n }\n ]\n }\n ]\n}" + "raw": "{\n \"method\": \"APIerSv1.SetActionPlan\",\n \"params\": [\n {\n \"Id\": \"ACP_TOPUP_PKG_500M_GR_LANDLINE_FREE_30D\",\n \"ReloadScheduler\": true,\n \"Overwrite\": true,\n\n \"ActionPlan\": [\n {\n \t \"ActionsId\": \"TOPUP_PKG_500M_GR_LANDLINE_FREE_30D\",\n \"MonthDays\": \"*any\",\n \"Years\": \"*any\",\n \"WeekDays\": \"*any\",\n \"Months\": \"*any\",\n \"Time\": \"*asap\",\n \"Weight\": 10\n\n }\n ]\n }\n ]\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -6543,7 +6543,7 @@ "response": [] }, { - "name": "3. ApierV2.SetAccount", + "name": "3. APIerSv2.SetAccount", "request": { "auth": { "type": "noauth" @@ -6557,7 +6557,7 @@ ], "body": { "mode": "raw", - "raw": "{\"method\": \"ApierV2.SetAccount\",\n \"params\": [{\n \"Tenant\": \"cgrates.org\", \n \"Account\": \"+30xxxxxxxxx\", \n \"ActionPlanIDs\": [\"ACP_TOPUP_PKG_500M_GR_LANDLINE_FREE_30D\"], \n \"ActionPlansOverwrite\": true,\n \"AllowNegative\": false,\n \"Disabled\": false,\n \"ReloadScheduler\": true \n }]\n}\n\n\n" + "raw": "{\"method\": \"APIerSv2.SetAccount\",\n \"params\": [{\n \"Tenant\": \"cgrates.org\", \n \"Account\": \"+30xxxxxxxxx\", \n \"ActionPlanIDs\": [\"ACP_TOPUP_PKG_500M_GR_LANDLINE_FREE_30D\"], \n \"ActionPlansOverwrite\": true,\n \"AllowNegative\": false,\n \"Disabled\": false,\n \"ReloadScheduler\": true \n }]\n}\n\n\n" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -6579,7 +6579,7 @@ "name": "Add 500 Minutes GR ALL to Account - No Expiration", "item": [ { - "name": "1. ApierV1.SetDestination GR_LANDLINE + GR_MOBILE", + "name": "1. APIerSv1.SetDestination GR_LANDLINE + GR_MOBILE", "request": { "auth": { "type": "noauth" @@ -6593,7 +6593,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"id\": 6,\n \"method\": \"ApierV1.SetDestination\",\n \"params\": [\n \t{\n \t\t\"Id\":\"GR_LANDLINE\",\n \"Prefixes\": [\"+302\"],\n \"Overwrite\":true\n \t\t\n \t},\n \t{\n \t\t\"Id\":\"GR_MOBILE\",\n \"Prefixes\": [\"+3069\"],\n \"Overwrite\":true\n \t\t\n \t}\n ]\n}" + "raw": "{\n \"id\": 6,\n \"method\": \"APIerSv1.SetDestination\",\n \"params\": [\n \t{\n \t\t\"Id\":\"GR_LANDLINE\",\n \"Prefixes\": [\"+302\"],\n \"Overwrite\":true\n \t\t\n \t},\n \t{\n \t\t\"Id\":\"GR_MOBILE\",\n \"Prefixes\": [\"+3069\"],\n \"Overwrite\":true\n \t\t\n \t}\n ]\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -6608,7 +6608,7 @@ "response": [] }, { - "name": "2. ApierV1.SetAction *voice ONLY", + "name": "2. APIerSv1.SetAction *voice ONLY", "request": { "auth": { "type": "noauth" @@ -6622,7 +6622,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.SetActions\",\n \"params\": [\n {\n \"Actions\": [\n \n {\n \"Identifier\": \"*topup_reset\",\n \"BalanceId\": \"PKG_500M_GR_UNLIMITED\",\n\t\t\t\t\t\"BalanceUuid\": \"71e73e45-a471-4059-b738-7f66adc72\",\n\t \"BalanceType\": \"*voice\",\n \"Directions\": null,\n \"Units\": 30000000000000,\n \"ExpiryTime\": \"*unlimited\",\n \"Filter\": null,\n \"TimingTags\": \"*any\",\n \"DestinationIds\": \"GR_MOBILE;GR_LANDLINE\",\n \"RatingSubject\": null,\n \"Categories\": null,\n \"SharedGroups\": null,\n \"BalanceWeight\": 30,\n \"ExtraParameters\": null,\n \"BalanceBlocker\": \"false\",\n \"BalanceDisabled\": \"false\",\n \"Weight\": 10\n \n }\n ],\n \"Overwrite\": true,\n \"ActionsId\": \"TOPUP_PKG_500M_GR_UNLIMITED\"\n }\n ]\n}\n" + "raw": "{\n \"method\": \"APIerSv1.SetActions\",\n \"params\": [\n {\n \"Actions\": [\n \n {\n \"Identifier\": \"*topup_reset\",\n \"BalanceId\": \"PKG_500M_GR_UNLIMITED\",\n\t\t\t\t\t\"BalanceUuid\": \"71e73e45-a471-4059-b738-7f66adc72\",\n\t \"BalanceType\": \"*voice\",\n \"Directions\": null,\n \"Units\": 30000000000000,\n \"ExpiryTime\": \"*unlimited\",\n \"Filter\": null,\n \"TimingTags\": \"*any\",\n \"DestinationIds\": \"GR_MOBILE;GR_LANDLINE\",\n \"RatingSubject\": null,\n \"Categories\": null,\n \"SharedGroups\": null,\n \"BalanceWeight\": 30,\n \"ExtraParameters\": null,\n \"BalanceBlocker\": \"false\",\n \"BalanceDisabled\": \"false\",\n \"Weight\": 10\n \n }\n ],\n \"Overwrite\": true,\n \"ActionsId\": \"TOPUP_PKG_500M_GR_UNLIMITED\"\n }\n ]\n}\n" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -6637,7 +6637,7 @@ "response": [] }, { - "name": "3. ApierV1.SetActionPlan", + "name": "3. APIerSv1.SetActionPlan", "request": { "auth": { "type": "noauth" @@ -6651,7 +6651,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.SetActionPlan\",\n \"params\": [\n {\n \"Id\": \"ACP_TOPUP_PKG_500M_GR_UNLIMITED\",\n \"ReloadScheduler\": true,\n \"Overwrite\": true,\n\n \"ActionPlan\": [\n {\n \t \"ActionsId\": \"TOPUP_PKG_500M_GR_UNLIMITED\",\n \"MonthDays\": \"*any\",\n \"Years\": \"*any\",\n \"WeekDays\": \"*any\",\n \"Months\": \"*any\",\n \"Time\": \"*asap\",\n \"Weight\": 10\n\n }\n ]\n }\n ]\n}" + "raw": "{\n \"method\": \"APIerSv1.SetActionPlan\",\n \"params\": [\n {\n \"Id\": \"ACP_TOPUP_PKG_500M_GR_UNLIMITED\",\n \"ReloadScheduler\": true,\n \"Overwrite\": true,\n\n \"ActionPlan\": [\n {\n \t \"ActionsId\": \"TOPUP_PKG_500M_GR_UNLIMITED\",\n \"MonthDays\": \"*any\",\n \"Years\": \"*any\",\n \"WeekDays\": \"*any\",\n \"Months\": \"*any\",\n \"Time\": \"*asap\",\n \"Weight\": 10\n\n }\n ]\n }\n ]\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -6666,7 +6666,7 @@ "response": [] }, { - "name": "3. ApierV2.SetAccount", + "name": "3. APIerSv2.SetAccount", "request": { "auth": { "type": "noauth" @@ -6682,7 +6682,7 @@ ], "body": { "mode": "raw", - "raw": "{\"method\": \"ApierV2.SetAccount\",\n \"params\": [{\n \"Tenant\": \"cgrates.org\", \n \"Account\": \"+30xxxxxxxxx\", \n \"ActionPlanIDs\": [\"ACP_TOPUP_PKG_500M_GR_UNLIMITED\"], \n \"ActionPlansOverwrite\": true,\n \"AllowNegative\": false,\n \"Disabled\": false,\n \"ReloadScheduler\": true \n }]\n}\n\n\n", + "raw": "{\"method\": \"APIerSv2.SetAccount\",\n \"params\": [{\n \"Tenant\": \"cgrates.org\", \n \"Account\": \"+30xxxxxxxxx\", \n \"ActionPlanIDs\": [\"ACP_TOPUP_PKG_500M_GR_UNLIMITED\"], \n \"ActionPlansOverwrite\": true,\n \"AllowNegative\": false,\n \"Disabled\": false,\n \"ReloadScheduler\": true \n }]\n}\n\n\n", "options": { "raw": { "language": "json" @@ -6713,7 +6713,7 @@ "name": "Add X Voice minutes - template", "item": [ { - "name": "1. ApierV1.SetAction *voice ONLY", + "name": "1. APIerSv1.SetAction *voice ONLY", "request": { "auth": { "type": "noauth" @@ -6727,7 +6727,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.SetActions\",\n \"params\": [\n {\n \"Actions\": [\n \n {\n \"Identifier\": \"*topup_reset\",\n \"BalanceId\": \"500MINUTES\",\n\t\t\t\t\t\"BalanceUuid\": \"71e73e45-a471-4059-b738-7f66adc72\",\n\t \"BalanceType\": \"*voice\",\n \"Directions\": null,\n \"Units\": 30000000000000,\n \"ExpiryTime\": \"*unlimited\",\n \"Filter\": null,\n \"TimingTags\": \"*any\",\n \"DestinationIds\": \"DST_+30xxxxxxxxxx\",\n \"RatingSubject\": \"*zero1m\",\n \"Categories\": null,\n \"SharedGroups\": null,\n \"BalanceWeight\": 30,\n \"ExtraParameters\": null,\n \"BalanceBlocker\": \"false\",\n \"BalanceDisabled\": \"false\",\n \"Weight\": 10\n \n }\n ],\n \"Overwrite\": true,\n \"ActionsId\": \"TOPUP_PKG_1000_GR\"\n }\n ]\n}\n" + "raw": "{\n \"method\": \"APIerSv1.SetActions\",\n \"params\": [\n {\n \"Actions\": [\n \n {\n \"Identifier\": \"*topup_reset\",\n \"BalanceId\": \"500MINUTES\",\n\t\t\t\t\t\"BalanceUuid\": \"71e73e45-a471-4059-b738-7f66adc72\",\n\t \"BalanceType\": \"*voice\",\n \"Directions\": null,\n \"Units\": 30000000000000,\n \"ExpiryTime\": \"*unlimited\",\n \"Filter\": null,\n \"TimingTags\": \"*any\",\n \"DestinationIds\": \"DST_+30xxxxxxxxxx\",\n \"RatingSubject\": \"*zero1m\",\n \"Categories\": null,\n \"SharedGroups\": null,\n \"BalanceWeight\": 30,\n \"ExtraParameters\": null,\n \"BalanceBlocker\": \"false\",\n \"BalanceDisabled\": \"false\",\n \"Weight\": 10\n \n }\n ],\n \"Overwrite\": true,\n \"ActionsId\": \"TOPUP_PKG_1000_GR\"\n }\n ]\n}\n" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -6742,7 +6742,7 @@ "response": [] }, { - "name": "1. ApierV1.SetAction both *monetary + *voice test", + "name": "1. APIerSv1.SetAction both *monetary + *voice test", "request": { "auth": { "type": "noauth" @@ -6756,7 +6756,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.SetActions\",\n \"params\": [\n {\n \"Actions\": [\n {\n \"Identifier\": \"*topup_reset\",\n \"BalanceId\": \"100EURO\",\n\t\t\t\t\t\"BalanceUuid\": \"71e73e45-a471-4059-b738-7f66adc71\",\n\t \"BalanceType\": \"*monetary\",\n \"Directions\": null,\n \"Units\": 100,\n \"ExpiryTime\": \"*unlimited\",\n \"Filter\": null,\n \"TimingTags\": \"*any\",\n \"DestinationIds\": \"*any\",\n \"RatingSubject\": null,\n \"Categories\": null,\n \"SharedGroups\": null,\n \"BalanceWeight\": 20,\n \"ExtraParameters\": null,\n \"BalanceBlocker\": \"false\",\n \"BalanceDisabled\": \"false\",\n \"Weight\": 10\n \n },\n {\n \"Identifier\": \"*topup_reset\",\n \"BalanceId\": \"500MINUTES\",\n\t\t\t\t\t\"BalanceUuid\": \"71e73e45-a471-4059-b738-7f66adc72\",\n\t \"BalanceType\": \"*voice\",\n \"Directions\": null,\n \"Units\": 30000000000000,\n \"ExpiryTime\": \"*unlimited\",\n \"Filter\": null,\n \"TimingTags\": \"*any\",\n \"DestinationIds\": \"DST_+30xxxxxxxxxx\",\n \"RatingSubject\": null,\n \"Categories\": null,\n \"SharedGroups\": null,\n \"BalanceWeight\": 30,\n \"ExtraParameters\": null,\n \"BalanceBlocker\": \"false\",\n \"BalanceDisabled\": \"false\",\n \"Weight\": 10\n \n }\n ],\n \"Overwrite\": true,\n \"ActionsId\": \"TOPUP_PKG_1000_GR\"\n }\n ]\n}\n" + "raw": "{\n \"method\": \"APIerSv1.SetActions\",\n \"params\": [\n {\n \"Actions\": [\n {\n \"Identifier\": \"*topup_reset\",\n \"BalanceId\": \"100EURO\",\n\t\t\t\t\t\"BalanceUuid\": \"71e73e45-a471-4059-b738-7f66adc71\",\n\t \"BalanceType\": \"*monetary\",\n \"Directions\": null,\n \"Units\": 100,\n \"ExpiryTime\": \"*unlimited\",\n \"Filter\": null,\n \"TimingTags\": \"*any\",\n \"DestinationIds\": \"*any\",\n \"RatingSubject\": null,\n \"Categories\": null,\n \"SharedGroups\": null,\n \"BalanceWeight\": 20,\n \"ExtraParameters\": null,\n \"BalanceBlocker\": \"false\",\n \"BalanceDisabled\": \"false\",\n \"Weight\": 10\n \n },\n {\n \"Identifier\": \"*topup_reset\",\n \"BalanceId\": \"500MINUTES\",\n\t\t\t\t\t\"BalanceUuid\": \"71e73e45-a471-4059-b738-7f66adc72\",\n\t \"BalanceType\": \"*voice\",\n \"Directions\": null,\n \"Units\": 30000000000000,\n \"ExpiryTime\": \"*unlimited\",\n \"Filter\": null,\n \"TimingTags\": \"*any\",\n \"DestinationIds\": \"DST_+30xxxxxxxxxx\",\n \"RatingSubject\": null,\n \"Categories\": null,\n \"SharedGroups\": null,\n \"BalanceWeight\": 30,\n \"ExtraParameters\": null,\n \"BalanceBlocker\": \"false\",\n \"BalanceDisabled\": \"false\",\n \"Weight\": 10\n \n }\n ],\n \"Overwrite\": true,\n \"ActionsId\": \"TOPUP_PKG_1000_GR\"\n }\n ]\n}\n" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -6771,7 +6771,7 @@ "response": [] }, { - "name": "2. ApierV1.SetActionPlan", + "name": "2. APIerSv1.SetActionPlan", "request": { "auth": { "type": "noauth" @@ -6785,7 +6785,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.SetActionPlan\",\n \"params\": [\n {\n \"Id\": \"ACP_+30xxxxxxxxx_TOPUP_PKG_1000_GR\",\n \"ReloadScheduler\": true,\n \"Overwrite\": true,\n\n \"ActionPlan\": [\n {\n \t \"ActionsId\": \"TOPUP_PKG_1000_GR\",\n \"MonthDays\": \"*any\",\n \"Years\": \"*any\",\n \"WeekDays\": \"*any\",\n \"Months\": \"*any\",\n \"Time\": \"*asap\",\n \"Weight\": 10\n\n }\n ]\n }\n ]\n}" + "raw": "{\n \"method\": \"APIerSv1.SetActionPlan\",\n \"params\": [\n {\n \"Id\": \"ACP_+30xxxxxxxxx_TOPUP_PKG_1000_GR\",\n \"ReloadScheduler\": true,\n \"Overwrite\": true,\n\n \"ActionPlan\": [\n {\n \t \"ActionsId\": \"TOPUP_PKG_1000_GR\",\n \"MonthDays\": \"*any\",\n \"Years\": \"*any\",\n \"WeekDays\": \"*any\",\n \"Months\": \"*any\",\n \"Time\": \"*asap\",\n \"Weight\": 10\n\n }\n ]\n }\n ]\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -6800,7 +6800,7 @@ "response": [] }, { - "name": "3. ApierV2.SetAccount", + "name": "3. APIerSv2.SetAccount", "request": { "auth": { "type": "noauth" @@ -6814,7 +6814,7 @@ ], "body": { "mode": "raw", - "raw": "{\"method\": \"ApierV2.SetAccount\",\n \"params\": [{\n \"Tenant\": \"cgrates.org\", \n \"Account\": \"+30xxxxxxxxx\", \n \"ActionPlanIDs\": [\"ACP_+30xxxxxxxxx_TOPUP_PKG_1000_GR\"], \n \"ActionPlansOverwrite\": true,\n \"AllowNegative\": false,\n \"Disabled\": false,\n \"ReloadScheduler\": true \n }]\n}\n\n\n" + "raw": "{\"method\": \"APIerSv2.SetAccount\",\n \"params\": [{\n \"Tenant\": \"cgrates.org\", \n \"Account\": \"+30xxxxxxxxx\", \n \"ActionPlanIDs\": [\"ACP_+30xxxxxxxxx_TOPUP_PKG_1000_GR\"], \n \"ActionPlansOverwrite\": true,\n \"AllowNegative\": false,\n \"Disabled\": false,\n \"ReloadScheduler\": true \n }]\n}\n\n\n" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -6843,7 +6843,7 @@ "name": "SPL_TESTSUPPLIER1_GR", "item": [ { - "name": "1. ApierV2.SetTPDestination", + "name": "1. APIerSv2.SetTPDestination", "request": { "auth": { "type": "noauth" @@ -6857,7 +6857,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"id\": 6,\n \"method\": \"ApierV2.SetTPDestination\",\n \"params\": [\n {\n \t\"TPid\":\"CGR_SPL_TESTSUPPLIER1_2019_01\",\n \t\"ID\":\"TP_SPL_DST_TESTSUPPLIER1_2019_01\",\n \"DestinationId\": \"SPL_DST_TESTSUPPLIER1_2019_01\",\n \"Prefixes\": [\n \"+30xxxxxxxxx\",\n \"+30xxxxxxxxxx\"\n ]\n \n }\n ]\n}" + "raw": "{\n \"id\": 6,\n \"method\": \"APIerSv2.SetTPDestination\",\n \"params\": [\n {\n \t\"TPid\":\"CGR_SPL_TESTSUPPLIER1_2019_01\",\n \t\"ID\":\"TP_SPL_DST_TESTSUPPLIER1_2019_01\",\n \"DestinationId\": \"SPL_DST_TESTSUPPLIER1_2019_01\",\n \"Prefixes\": [\n \"+30xxxxxxxxx\",\n \"+30xxxxxxxxxx\"\n ]\n \n }\n ]\n}" }, "url": { "raw": "http://cgrates1.cgrates.org:2080/jsonrpc", @@ -6876,7 +6876,7 @@ "response": [] }, { - "name": "2. ApierV1.SetTPRate", + "name": "2. APIerSv1.SetTPRate", "request": { "method": "POST", "header": [ @@ -6889,7 +6889,7 @@ ], "body": { "mode": "raw", - "raw": "{\n\"id\": 3,\n\"method\": \"ApierV1.SetTPRate\",\n\"params\": [\n{\n\t\"TPid\": \"CGR_SPL_TESTSUPPLIER1_2019_01\",\n\t\"ID\":\"SPL_TESTSUPPLIER1_DST_RATEID_GR_LANDLINE_2019_01\",\n\t \"RateSlots\" : [\n \t{\n\t \"ConnectFee\" : 0, \n\t \"Rate\": 0.0042 , \n\t \"RateUnit\":\"1s\",\n\t \"RateIncrement\":\"1s\",\n\t \"GroupIntervalStart\":\"0\"\n\t},\n\t{\n\t \"ConnectFee\" : 0, \n\t \"Rate\": 0.0042 , \n\t \"RateUnit\":\"1s\",\n\t \"RateIncrement\":\"1s\",\n\t \"GroupIntervalStart\":\"60\"\n\t}\n]\n}\n]\n}\n\n\n" + "raw": "{\n\"id\": 3,\n\"method\": \"APIerSv1.SetTPRate\",\n\"params\": [\n{\n\t\"TPid\": \"CGR_SPL_TESTSUPPLIER1_2019_01\",\n\t\"ID\":\"SPL_TESTSUPPLIER1_DST_RATEID_GR_LANDLINE_2019_01\",\n\t \"RateSlots\" : [\n \t{\n\t \"ConnectFee\" : 0, \n\t \"Rate\": 0.0042 , \n\t \"RateUnit\":\"1s\",\n\t \"RateIncrement\":\"1s\",\n\t \"GroupIntervalStart\":\"0\"\n\t},\n\t{\n\t \"ConnectFee\" : 0, \n\t \"Rate\": 0.0042 , \n\t \"RateUnit\":\"1s\",\n\t \"RateIncrement\":\"1s\",\n\t \"GroupIntervalStart\":\"60\"\n\t}\n]\n}\n]\n}\n\n\n" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -6904,7 +6904,7 @@ "response": [] }, { - "name": "3. ApierV1.SetTPDestinationRate NEW", + "name": "3. APIerSv1.SetTPDestinationRate NEW", "request": { "auth": { "type": "noauth" @@ -6918,7 +6918,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.SetTPDestinationRate\",\n \"params\": [{\n \"TPid\": \"CGR_SPL_TESTSUPPLIER1_2019_01\",\n \"ID\": \"SPL_TESTSUPPLIER1_DST_RT_GR_LANDLINE_2019_01\",\n \"DestinationRates\": [{\n \"DestinationId\": \"TP_SPL_DST_TESTSUPPLIER1_2019_01\",\n \"RateId\": \"SPL_TESTSUPPLIER1_DST_RATEID_GR_LANDLINE_2019_01\",\n \"RoundingMethod\": \"*up\",\n \"RoundingDecimals\": 4,\n \"MaxCost\": 0,\n \"MaxCostStrategy\": \"\"\n }]\n }]\n}\n\n" + "raw": "{\n \"method\": \"APIerSv1.SetTPDestinationRate\",\n \"params\": [{\n \"TPid\": \"CGR_SPL_TESTSUPPLIER1_2019_01\",\n \"ID\": \"SPL_TESTSUPPLIER1_DST_RT_GR_LANDLINE_2019_01\",\n \"DestinationRates\": [{\n \"DestinationId\": \"TP_SPL_DST_TESTSUPPLIER1_2019_01\",\n \"RateId\": \"SPL_TESTSUPPLIER1_DST_RATEID_GR_LANDLINE_2019_01\",\n \"RoundingMethod\": \"*up\",\n \"RoundingDecimals\": 4,\n \"MaxCost\": 0,\n \"MaxCostStrategy\": \"\"\n }]\n }]\n}\n\n" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -6933,7 +6933,7 @@ "response": [] }, { - "name": "4. ApierV1.SetTPRatingPlan", + "name": "4. APIerSv1.SetTPRatingPlan", "request": { "method": "POST", "header": [ @@ -6946,7 +6946,7 @@ ], "body": { "mode": "raw", - "raw": "{\n\"id\": 3,\n\"method\": \"ApierV1.SetTPRatingPlan\",\n\"params\": [\n\t{\n\t\t\"TPid\": \"CGR_SPL_TESTSUPPLIER1_2019_01\",\n\t\t\"ID\":\"TP_RP_SPL_TESTSUPPLIER1_DST_ID_RT_GR_LANDLINE_2019_01\",\n\t\t\"RatingPlanBindings\" : [{\n \t\"DestinationRatesId\":\"SPL_TESTSUPPLIER1_DST_RT_GR_LANDLINE_2019_01\",\n \t\"TimingId\": \"*any\" , \n \t\"Weight\":10\n\t\t}]\n\t}\n]\n}" + "raw": "{\n\"id\": 3,\n\"method\": \"APIerSv1.SetTPRatingPlan\",\n\"params\": [\n\t{\n\t\t\"TPid\": \"CGR_SPL_TESTSUPPLIER1_2019_01\",\n\t\t\"ID\":\"TP_RP_SPL_TESTSUPPLIER1_DST_ID_RT_GR_LANDLINE_2019_01\",\n\t\t\"RatingPlanBindings\" : [{\n \t\"DestinationRatesId\":\"SPL_TESTSUPPLIER1_DST_RT_GR_LANDLINE_2019_01\",\n \t\"TimingId\": \"*any\" , \n \t\"Weight\":10\n\t\t}]\n\t}\n]\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -6961,7 +6961,7 @@ "response": [] }, { - "name": "5. ApierV1.LoadRatingPlan", + "name": "5. APIerSv1.LoadRatingPlan", "request": { "auth": { "type": "noauth" @@ -6975,7 +6975,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"id\": 6,\n \"method\": \"ApierV1.LoadRatingPlan\",\n \"params\": [\n {\n \t\"TPid\":\"CGR_SPL_TESTSUPPLIER1_2019_01\",\n \t\"RatingPlanId\": \"TP_RP_SPL_TESTSUPPLIER1_DST_ID_RT_GR_LANDLINE_2019_01\"\n \n }\n ]\n}\n\n" + "raw": "{\n \"id\": 6,\n \"method\": \"APIerSv1.LoadRatingPlan\",\n \"params\": [\n {\n \t\"TPid\":\"CGR_SPL_TESTSUPPLIER1_2019_01\",\n \t\"RatingPlanId\": \"TP_RP_SPL_TESTSUPPLIER1_DST_ID_RT_GR_LANDLINE_2019_01\"\n \n }\n ]\n}\n\n" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -7004,7 +7004,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"id\": 6,\n \"method\": \"ApierV1.LoadTariffPlanFromStorDb\",\n \"params\": [\n {\n \t\"TPid\":\"CGR_SPL_TESTSUPPLIER1_2019_01\"\n \n }\n ]\n}" + "raw": "{\n \"id\": 6,\n \"method\": \"APIerSv1.LoadTariffPlanFromStorDb\",\n \"params\": [\n {\n \t\"TPid\":\"CGR_SPL_TESTSUPPLIER1_2019_01\"\n \n }\n ]\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -7026,7 +7026,7 @@ "name": "Inbound Call Billing example", "item": [ { - "name": "1. ApierV2.SetTPDestination - #1 mobile prefix +3069", + "name": "1. APIerSv2.SetTPDestination - #1 mobile prefix +3069", "request": { "auth": { "type": "noauth" @@ -7040,7 +7040,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"id\": 6,\n \"method\": \"ApierV2.SetTPDestination\",\n \"params\": [\n {\n \t\"TPid\":\"TPID_VL_INTERNAL_INBOUND_CALLS\",\n \t\"ID\":\"DST_CLI_VL_INTERNAL_INBOUND_CALLS_GR_MOBILE\",\n \"DestinationId\": \"DST_CLI_VL_INTERNAL_INBOUND_CALLS_GR_MOBILE\",\n \"Prefixes\": [\n \"+3069\"\n\n ]\n \n }\n ]\n}" + "raw": "{\n \"id\": 6,\n \"method\": \"APIerSv2.SetTPDestination\",\n \"params\": [\n {\n \t\"TPid\":\"TPID_VL_INTERNAL_INBOUND_CALLS\",\n \t\"ID\":\"DST_CLI_VL_INTERNAL_INBOUND_CALLS_GR_MOBILE\",\n \"DestinationId\": \"DST_CLI_VL_INTERNAL_INBOUND_CALLS_GR_MOBILE\",\n \"Prefixes\": [\n \"+3069\"\n\n ]\n \n }\n ]\n}" }, "url": { "raw": "http://cgrates1.cgrates.org:2080/jsonrpc", @@ -7059,7 +7059,7 @@ "response": [] }, { - "name": "2. ApierV1.SetTPRate - FREE for *any", + "name": "2. APIerSv1.SetTPRate - FREE for *any", "request": { "method": "POST", "header": [ @@ -7072,7 +7072,7 @@ ], "body": { "mode": "raw", - "raw": "{\n\"id\": 3,\n\"method\": \"ApierV1.SetTPRate\",\n\"params\": [\n{\n\t\"TPid\": \"TPID_VL_INTERNAL_INBOUND_CALLS\",\n\t\"ID\":\"RT_VL_INTERNAL_INBOUND_CALLS_ΑΝΥ\",\n\t \"RateSlots\" : [\n \t{\n\t \"ConnectFee\" : 0, \n\t \"Rate\": 0, \n\t \"RateUnit\":\"1s\",\n\t \"RateIncrement\":\"1s\",\n\t \"GroupIntervalStart\":\"0\"\n\t}\n]\n}\n]\n}\n\n\n\n\n" + "raw": "{\n\"id\": 3,\n\"method\": \"APIerSv1.SetTPRate\",\n\"params\": [\n{\n\t\"TPid\": \"TPID_VL_INTERNAL_INBOUND_CALLS\",\n\t\"ID\":\"RT_VL_INTERNAL_INBOUND_CALLS_ΑΝΥ\",\n\t \"RateSlots\" : [\n \t{\n\t \"ConnectFee\" : 0, \n\t \"Rate\": 0, \n\t \"RateUnit\":\"1s\",\n\t \"RateIncrement\":\"1s\",\n\t \"GroupIntervalStart\":\"0\"\n\t}\n]\n}\n]\n}\n\n\n\n\n" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -7087,7 +7087,7 @@ "response": [] }, { - "name": "2.1 ApierV1.SetTPRate #1 - COST for Mobile", + "name": "2.1 APIerSv1.SetTPRate #1 - COST for Mobile", "request": { "method": "POST", "header": [ @@ -7100,7 +7100,7 @@ ], "body": { "mode": "raw", - "raw": "{\n\"id\": 3,\n\"method\": \"ApierV1.SetTPRate\",\n\"params\": [\n{\n\t\"TPid\": \"TPID_VL_INTERNAL_INBOUND_CALLS\",\n\t\"ID\":\"RT_CLI_VL_INTERNAL_INBOUND_CALLS_GR_MOBILE\",\n\t \"RateSlots\" : [\n \t{\n\t \"ConnectFee\" : 5, \n\t \"Rate\": 1.5, \n\t \"RateUnit\":\"1s\",\n\t \"RateIncrement\":\"1s\",\n\t \"GroupIntervalStart\":\"0\"\n\t}\n]\n}\n]\n}\n\n\n\n\n" + "raw": "{\n\"id\": 3,\n\"method\": \"APIerSv1.SetTPRate\",\n\"params\": [\n{\n\t\"TPid\": \"TPID_VL_INTERNAL_INBOUND_CALLS\",\n\t\"ID\":\"RT_CLI_VL_INTERNAL_INBOUND_CALLS_GR_MOBILE\",\n\t \"RateSlots\" : [\n \t{\n\t \"ConnectFee\" : 5, \n\t \"Rate\": 1.5, \n\t \"RateUnit\":\"1s\",\n\t \"RateIncrement\":\"1s\",\n\t \"GroupIntervalStart\":\"0\"\n\t}\n]\n}\n]\n}\n\n\n\n\n" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -7115,7 +7115,7 @@ "response": [] }, { - "name": "3. ApierV1.SetTPDestinationRate *any", + "name": "3. APIerSv1.SetTPDestinationRate *any", "request": { "auth": { "type": "noauth" @@ -7129,7 +7129,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.SetTPDestinationRate\",\n \"params\": [{\n \"TPid\": \"TPID_VL_INTERNAL_INBOUND_CALLS\",\n \"ID\": \"DSTRATE_VL_INTERNAL_INBOUND_CALLS_ΑΝΥ\",\n \"DestinationRates\": [{\n \"DestinationId\": \"*any\",\n \"RateId\": \"RT_VL_INTERNAL_INBOUND_CALLS_ΑΝΥ\",\n \"RoundingMethod\": \"*up\",\n \"RoundingDecimals\": 4,\n \"MaxCost\": 0,\n \"MaxCostStrategy\": \"\"\n }]\n }]\n}\n\n\n\n\n\n" + "raw": "{\n \"method\": \"APIerSv1.SetTPDestinationRate\",\n \"params\": [{\n \"TPid\": \"TPID_VL_INTERNAL_INBOUND_CALLS\",\n \"ID\": \"DSTRATE_VL_INTERNAL_INBOUND_CALLS_ΑΝΥ\",\n \"DestinationRates\": [{\n \"DestinationId\": \"*any\",\n \"RateId\": \"RT_VL_INTERNAL_INBOUND_CALLS_ΑΝΥ\",\n \"RoundingMethod\": \"*up\",\n \"RoundingDecimals\": 4,\n \"MaxCost\": 0,\n \"MaxCostStrategy\": \"\"\n }]\n }]\n}\n\n\n\n\n\n" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -7144,7 +7144,7 @@ "response": [] }, { - "name": "3.1 ApierV1.SetTPDestinationRate #1 (mobile prefixes)", + "name": "3.1 APIerSv1.SetTPDestinationRate #1 (mobile prefixes)", "request": { "auth": { "type": "noauth" @@ -7158,7 +7158,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.SetTPDestinationRate\",\n \"params\": [{\n \"TPid\": \"TPID_VL_INTERNAL_INBOUND_CALLS\",\n \"ID\": \"TP_DSTRATE_CLI_VL_INTERNAL_INBOUND_CALLS_GR_MOBILE\",\n \"DestinationRates\": [{\n \"DestinationId\": \"DST_CLI_VL_INTERNAL_INBOUND_CALLS_GR_MOBILE\",\n \"RateId\": \"RT_CLI_VL_INTERNAL_INBOUND_CALLS_GR_MOBILE\",\n \"RoundingMethod\": \"*up\",\n \"RoundingDecimals\": 4,\n \"MaxCost\": 0,\n \"MaxCostStrategy\": \"\"\n }]\n }]\n}\n\n\n\n\n\n" + "raw": "{\n \"method\": \"APIerSv1.SetTPDestinationRate\",\n \"params\": [{\n \"TPid\": \"TPID_VL_INTERNAL_INBOUND_CALLS\",\n \"ID\": \"TP_DSTRATE_CLI_VL_INTERNAL_INBOUND_CALLS_GR_MOBILE\",\n \"DestinationRates\": [{\n \"DestinationId\": \"DST_CLI_VL_INTERNAL_INBOUND_CALLS_GR_MOBILE\",\n \"RateId\": \"RT_CLI_VL_INTERNAL_INBOUND_CALLS_GR_MOBILE\",\n \"RoundingMethod\": \"*up\",\n \"RoundingDecimals\": 4,\n \"MaxCost\": 0,\n \"MaxCostStrategy\": \"\"\n }]\n }]\n}\n\n\n\n\n\n" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -7173,7 +7173,7 @@ "response": [] }, { - "name": "4.1 ApierV1.SetTPRatingPlan #1 both (*any & Mobile)", + "name": "4.1 APIerSv1.SetTPRatingPlan #1 both (*any & Mobile)", "request": { "method": "POST", "header": [ @@ -7186,7 +7186,7 @@ ], "body": { "mode": "raw", - "raw": "{\n\"id\": 3,\n\"method\": \"ApierV1.SetTPRatingPlan\",\n\"params\": [\n\t{\n\t\"TPid\": \"TPID_VL_INTERNAL_INBOUND_CALLS\",\n\t\"ID\":\"RatingPlan_CLI_VL_INTERNAL_INBOUND_CALLS_GR_MOBILE\",\n\t\"RatingPlanBindings\" : [{\n\t\t\"DestinationRatesId\":\"TP_DSTRATE_CLI_VL_INTERNAL_INBOUND_CALLS_GR_MOBILE\",\n\t\t\"TimingId\": \"*any\" , \n\t\t\"Weight\":10\n\t\t},\n\t\t{\n\t\t\"DestinationRatesId\":\"DSTRATE_VL_INTERNAL_INBOUND_CALLS_ΑΝΥ\",\n\t\t\"TimingId\": \"*any\" , \n\t\t\"Weight\":10\n\t\t}\n\t\t]\n\t}\n]\n}" + "raw": "{\n\"id\": 3,\n\"method\": \"APIerSv1.SetTPRatingPlan\",\n\"params\": [\n\t{\n\t\"TPid\": \"TPID_VL_INTERNAL_INBOUND_CALLS\",\n\t\"ID\":\"RatingPlan_CLI_VL_INTERNAL_INBOUND_CALLS_GR_MOBILE\",\n\t\"RatingPlanBindings\" : [{\n\t\t\"DestinationRatesId\":\"TP_DSTRATE_CLI_VL_INTERNAL_INBOUND_CALLS_GR_MOBILE\",\n\t\t\"TimingId\": \"*any\" , \n\t\t\"Weight\":10\n\t\t},\n\t\t{\n\t\t\"DestinationRatesId\":\"DSTRATE_VL_INTERNAL_INBOUND_CALLS_ΑΝΥ\",\n\t\t\"TimingId\": \"*any\" , \n\t\t\"Weight\":10\n\t\t}\n\t\t]\n\t}\n]\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -7201,7 +7201,7 @@ "response": [] }, { - "name": "5. ApierV1.LoadRatingPlan", + "name": "5. APIerSv1.LoadRatingPlan", "request": { "auth": { "type": "noauth" @@ -7215,7 +7215,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"id\": 6,\n \"method\": \"ApierV1.LoadRatingPlan\",\n \"params\": [\n {\n \t\"TPid\":\"TPID_VL_INTERNAL_INBOUND_CALLS\",\n \t\"RatingPlanId\": \"RatingPlan_CLI_VL_INTERNAL_INBOUND_CALLS_GR_MOBILE\"\n \n }\n ]\n}\n\n" + "raw": "{\n \"id\": 6,\n \"method\": \"APIerSv1.LoadRatingPlan\",\n \"params\": [\n {\n \t\"TPid\":\"TPID_VL_INTERNAL_INBOUND_CALLS\",\n \t\"RatingPlanId\": \"RatingPlan_CLI_VL_INTERNAL_INBOUND_CALLS_GR_MOBILE\"\n \n }\n ]\n}\n\n" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -7244,7 +7244,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"id\": 6,\n \"method\": \"ApierV1.LoadTariffPlanFromStorDb\",\n \"params\": [\n {\n \t\"TPid\":\"TPID_VL_INTERNAL_INBOUND_CALLS\"\n \n }\n ]\n}" + "raw": "{\n \"id\": 6,\n \"method\": \"APIerSv1.LoadTariffPlanFromStorDb\",\n \"params\": [\n {\n \t\"TPid\":\"TPID_VL_INTERNAL_INBOUND_CALLS\"\n \n }\n ]\n}" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -7284,7 +7284,7 @@ ], "body": { "mode": "raw", - "raw": "{\r\n \"method\": \"ApierV1.SetChargerProfile\",\r\n \"params\": [\r\n {\r\n \"Tenant\": \"cgrates.org\",\r\n \"ID\": \"CustomerCharges\",\r\n \"FilterIDs\": null,\r\n \"ActivationInterval\": null,\r\n \"RunID\": \"CustomerCharges\",\r\n \"AttributeIDs\": [\"*none\"],\r\n \"Weight\": 0\r\n \r\n }\r\n ]\r\n}\r\n" + "raw": "{\r\n \"method\": \"APIerSv1.SetChargerProfile\",\r\n \"params\": [\r\n {\r\n \"Tenant\": \"cgrates.org\",\r\n \"ID\": \"CustomerCharges\",\r\n \"FilterIDs\": null,\r\n \"ActivationInterval\": null,\r\n \"RunID\": \"CustomerCharges\",\r\n \"AttributeIDs\": [\"*none\"],\r\n \"Weight\": 0\r\n \r\n }\r\n ]\r\n}\r\n" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -7313,7 +7313,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.SetFilter\",\n \"params\": [\n {\n \t\"Tenant\": \"cgrates.org\",\n \"ID\": \"CHARGER_FLTR_INTERNAL_CALLS_ONLY\",\n \"Rules\": [\n {\n \"Type\": \"*string\",\n \"FieldName\": \"~Subject\",\n \"Values\": [\n \"INTERNAL-IN\",\n \"INTERNAL-OUT\"\n ]\n }\n ],\n \"ActivationInterval\": {\n \"ActivationTime\": \"0001-01-01T00:00:00Z\",\n \"ExpiryTime\": \"0001-01-01T00:00:00Z\"\n }\n \n }\n ],\n \"id\": 12\n}\n" + "raw": "{\n \"method\": \"APIerSv1.SetFilter\",\n \"params\": [\n {\n \t\"Tenant\": \"cgrates.org\",\n \"ID\": \"CHARGER_FLTR_INTERNAL_CALLS_ONLY\",\n \"Rules\": [\n {\n \"Type\": \"*string\",\n \"FieldName\": \"~Subject\",\n \"Values\": [\n \"INTERNAL-IN\",\n \"INTERNAL-OUT\"\n ]\n }\n ],\n \"ActivationInterval\": {\n \"ActivationTime\": \"0001-01-01T00:00:00Z\",\n \"ExpiryTime\": \"0001-01-01T00:00:00Z\"\n }\n \n }\n ],\n \"id\": 12\n}\n" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -7342,7 +7342,7 @@ ], "body": { "mode": "raw", - "raw": "{\r\n \"method\": \"ApierV1.SetChargerProfile\",\r\n \"params\": [\r\n {\r\n \"Tenant\": \"cgrates.org\",\r\n \"ID\": \"SPL_TEST_SUPPLIER_NAME\",\r\n \"FilterIDs\": [\"CHARGER_FLTR_INTERNAL_CALLS_ONLY\"],\r\n \"ActivationInterval\": null,\r\n \"RunID\": \"SPL_TEST_SUPPLIER_NAME\",\r\n \"AttributeIDs\": [\"*none\"],\r\n \"Weight\": 0\r\n \r\n }\r\n ]\r\n}\r\n" + "raw": "{\r\n \"method\": \"APIerSv1.SetChargerProfile\",\r\n \"params\": [\r\n {\r\n \"Tenant\": \"cgrates.org\",\r\n \"ID\": \"SPL_TEST_SUPPLIER_NAME\",\r\n \"FilterIDs\": [\"CHARGER_FLTR_INTERNAL_CALLS_ONLY\"],\r\n \"ActivationInterval\": null,\r\n \"RunID\": \"SPL_TEST_SUPPLIER_NAME\",\r\n \"AttributeIDs\": [\"*none\"],\r\n \"Weight\": 0\r\n \r\n }\r\n ]\r\n}\r\n" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -7378,7 +7378,7 @@ ], "body": { "mode": "raw", - "raw": "{\n\t\"method\": \"ApierV1.SetSupplierProfile\",\n\t\"params\": [{\n\t\t\"Tenant\": \"cgrates.org\",\n\t\t\"ID\": \"SPL_VL_INTERNAL\",\n\t\t\"FilterIDs\": null,\n\t\t\"ActivationInterval\": {\n\t\t\t\"ActivationTime\": \"2014-07-14T14:25:00Z\",\n\t\t\t\"ExpiryTime\": \"0001-01-01T00:00:00Z\"\n\t\t},\n\t\t\"Sorting\": \"*weight\",\n\t\t\"SortingParameters\": [\"\"],\n\t\t\"Suppliers\": [\n\t\t\t{\n\t\t\t\"ID\": \"SPL_VL_INTERNAL_IN\",\n\t\t\t\"FilterIDs\": [\"*string:~*req.Subject:INTERNAL-IN\",\"*string:~*req.Category:call-in\"],\n\t\t\t\"AccountIDs\": [\"\"],\n\t\t\t\"RatingPlanIDs\": [\"TP_RP_SPL_TEST_SUPPLIER_NAME_INTERNAL_DST_ID_RT_GR_LANDLINE_2019_01\"],\n\t\t\t\"ResourceIDs\": null,\n\t\t\t\"StatIDs\": null,\n\t\t\t\"Weight\": 10,\n\t\t\t\"Blocker\": false,\n\t\t\t\"SupplierParameters\": \"TP_RP_SPL_TEST_SUPPLIER_NAME_INTERNAL_DST_ID_RT_GR_LANDLINE_2019_01\"\n\t\t\t},\n\t\t\t{\n\t\t\t\"ID\": \"SPL_VL_INTERNAL_OUT\",\n\t\t\t\"FilterIDs\": [\"*string:~*req.Subject:INTERNAL-OUT\",\"*string:~*req.Category:call-out\"],\n\t\t\t\"AccountIDs\": null,\n\t\t\t\"RatingPlanIDs\": [\"TP_RP_SPL_TEST_SUPPLIER_NAME_INTERNAL_DST_ID_RT_GR_LANDLINE_2019_01\"],\n\t\t\t\"ResourceIDs\": null,\n\t\t\t\"StatIDs\": null,\n\t\t\t\"Weight\": 10,\n\t\t\t\"Blocker\": false,\n\t\t\t\"SupplierParameters\": \"TP_RP_SPL_TEST_SUPPLIER_NAME_INTERNAL_DST_ID_RT_GR_LANDLINE_2019_01\"\n\t\t\t}\n\t\t\n\t\t],\n\t\t\"Weight\": 10\n\t}]\n}\n\n\n" + "raw": "{\n\t\"method\": \"APIerSv1.SetSupplierProfile\",\n\t\"params\": [{\n\t\t\"Tenant\": \"cgrates.org\",\n\t\t\"ID\": \"SPL_VL_INTERNAL\",\n\t\t\"FilterIDs\": null,\n\t\t\"ActivationInterval\": {\n\t\t\t\"ActivationTime\": \"2014-07-14T14:25:00Z\",\n\t\t\t\"ExpiryTime\": \"0001-01-01T00:00:00Z\"\n\t\t},\n\t\t\"Sorting\": \"*weight\",\n\t\t\"SortingParameters\": [\"\"],\n\t\t\"Suppliers\": [\n\t\t\t{\n\t\t\t\"ID\": \"SPL_VL_INTERNAL_IN\",\n\t\t\t\"FilterIDs\": [\"*string:~*req.Subject:INTERNAL-IN\",\"*string:~*req.Category:call-in\"],\n\t\t\t\"AccountIDs\": [\"\"],\n\t\t\t\"RatingPlanIDs\": [\"TP_RP_SPL_TEST_SUPPLIER_NAME_INTERNAL_DST_ID_RT_GR_LANDLINE_2019_01\"],\n\t\t\t\"ResourceIDs\": null,\n\t\t\t\"StatIDs\": null,\n\t\t\t\"Weight\": 10,\n\t\t\t\"Blocker\": false,\n\t\t\t\"SupplierParameters\": \"TP_RP_SPL_TEST_SUPPLIER_NAME_INTERNAL_DST_ID_RT_GR_LANDLINE_2019_01\"\n\t\t\t},\n\t\t\t{\n\t\t\t\"ID\": \"SPL_VL_INTERNAL_OUT\",\n\t\t\t\"FilterIDs\": [\"*string:~*req.Subject:INTERNAL-OUT\",\"*string:~*req.Category:call-out\"],\n\t\t\t\"AccountIDs\": null,\n\t\t\t\"RatingPlanIDs\": [\"TP_RP_SPL_TEST_SUPPLIER_NAME_INTERNAL_DST_ID_RT_GR_LANDLINE_2019_01\"],\n\t\t\t\"ResourceIDs\": null,\n\t\t\t\"StatIDs\": null,\n\t\t\t\"Weight\": 10,\n\t\t\t\"Blocker\": false,\n\t\t\t\"SupplierParameters\": \"TP_RP_SPL_TEST_SUPPLIER_NAME_INTERNAL_DST_ID_RT_GR_LANDLINE_2019_01\"\n\t\t\t}\n\t\t\n\t\t],\n\t\t\"Weight\": 10\n\t}]\n}\n\n\n" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -7407,7 +7407,7 @@ ], "body": { "mode": "raw", - "raw": "{\n\t\"method\": \"ApierV1.SetSupplierProfile\",\n\t\"params\": [{\n\t\t\"Tenant\": \"cgrates.org\",\n\t\t\"ID\": \"SPL_TESTSUPPLIER1_GR\",\n\t\t\"FilterIDs\": null,\n\t\t\"ActivationInterval\": {\n\t\t\t\"ActivationTime\": \"2014-07-14T14:25:00Z\",\n\t\t\t\"ExpiryTime\": \"0001-01-01T00:00:00Z\"\n\t\t},\n\t\t\"Sorting\": \"*weight\",\n\t\t\"SortingParameters\": [\"\"],\n\t\t\"Suppliers\": [\n\t\t\t{\n\t\t\t\"ID\": \"SPL_TESTSUPPLIER1_GR_IN\",\n\t\t\t\"FilterIDs\": [\"*notstring:~*req.Subject:INTERNAL-IN\",\"*string:~*req.Category:call-in\"],\n\t\t\t\"AccountIDs\": [\"\"],\n\t\t\t\"RatingPlanIDs\": [\"TP_RP_SPL_TESTSUPPLIER1_DST_ID_RT_GR_LANDLINE_2019_01\"],\n\t\t\t\"ResourceIDs\": null,\n\t\t\t\"StatIDs\": null,\n\t\t\t\"Weight\": 10,\n\t\t\t\"Blocker\": false,\n\t\t\t\"SupplierParameters\": \"TP_RP_SPL_TESTSUPPLIER1_DST_ID_RT_GR_LANDLINE_2019_01\"\n\t\t\t},\n\t\t\t{\n\t\t\t\"ID\": \"SPL_TESTSUPPLIER1_GR_OUT\",\n\t\t\t\"FilterIDs\": [\"*notstring:~*req.Subject:INTERNAL-OUT\",\"*string:~*req.Category:call-out\"],\n\t\t\t\"AccountIDs\": null,\n\t\t\t\"RatingPlanIDs\": [\"TP_RP_SPL_TESTSUPPLIER1_DST_ID_RT_GR_LANDLINE_2019_01\"],\n\t\t\t\"ResourceIDs\": null,\n\t\t\t\"StatIDs\": null,\n\t\t\t\"Weight\": 10,\n\t\t\t\"Blocker\": false,\n\t\t\t\"SupplierParameters\": \"TP_RP_SPL_TESTSUPPLIER1_DST_ID_RT_GR_LANDLINE_2019_01\"\n\t\t\t}\n\t\t\n\t\t],\n\t\t\"Weight\": 10\n\t}]\n}\n\n\n" + "raw": "{\n\t\"method\": \"APIerSv1.SetSupplierProfile\",\n\t\"params\": [{\n\t\t\"Tenant\": \"cgrates.org\",\n\t\t\"ID\": \"SPL_TESTSUPPLIER1_GR\",\n\t\t\"FilterIDs\": null,\n\t\t\"ActivationInterval\": {\n\t\t\t\"ActivationTime\": \"2014-07-14T14:25:00Z\",\n\t\t\t\"ExpiryTime\": \"0001-01-01T00:00:00Z\"\n\t\t},\n\t\t\"Sorting\": \"*weight\",\n\t\t\"SortingParameters\": [\"\"],\n\t\t\"Suppliers\": [\n\t\t\t{\n\t\t\t\"ID\": \"SPL_TESTSUPPLIER1_GR_IN\",\n\t\t\t\"FilterIDs\": [\"*notstring:~*req.Subject:INTERNAL-IN\",\"*string:~*req.Category:call-in\"],\n\t\t\t\"AccountIDs\": [\"\"],\n\t\t\t\"RatingPlanIDs\": [\"TP_RP_SPL_TESTSUPPLIER1_DST_ID_RT_GR_LANDLINE_2019_01\"],\n\t\t\t\"ResourceIDs\": null,\n\t\t\t\"StatIDs\": null,\n\t\t\t\"Weight\": 10,\n\t\t\t\"Blocker\": false,\n\t\t\t\"SupplierParameters\": \"TP_RP_SPL_TESTSUPPLIER1_DST_ID_RT_GR_LANDLINE_2019_01\"\n\t\t\t},\n\t\t\t{\n\t\t\t\"ID\": \"SPL_TESTSUPPLIER1_GR_OUT\",\n\t\t\t\"FilterIDs\": [\"*notstring:~*req.Subject:INTERNAL-OUT\",\"*string:~*req.Category:call-out\"],\n\t\t\t\"AccountIDs\": null,\n\t\t\t\"RatingPlanIDs\": [\"TP_RP_SPL_TESTSUPPLIER1_DST_ID_RT_GR_LANDLINE_2019_01\"],\n\t\t\t\"ResourceIDs\": null,\n\t\t\t\"StatIDs\": null,\n\t\t\t\"Weight\": 10,\n\t\t\t\"Blocker\": false,\n\t\t\t\"SupplierParameters\": \"TP_RP_SPL_TESTSUPPLIER1_DST_ID_RT_GR_LANDLINE_2019_01\"\n\t\t\t}\n\t\t\n\t\t],\n\t\t\"Weight\": 10\n\t}]\n}\n\n\n" }, "url": { "raw": "{{base_url}}/jsonrpc", @@ -7465,7 +7465,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"ApierV1.SetActions\",\n \"params\": [\n {\n \"Actions\": [\n {\n \"Identifier\": \"*log\",\n \"BalanceId\": null,\n\t\t\t\t\t\"BalanceUuid\": null,\n\t \"BalanceType\": null,\n \"Directions\": null,\n \"Units\": null,\n \"ExpiryTime\": null,\n \"Filter\": null,\n \"TimingTags\": null,\n \"DestinationIds\": null,\n \"RatingSubject\": null,\n \"Categories\": null,\n \"SharedGroups\": null,\n \"BalanceWeight\": null,\n \"ExtraParameters\": null,\n \"BalanceBlocker\": \"false\",\n \"BalanceDisabled\": \"false\",\n \"Weight\": 10\n \n }\n ],\n \"Overwrite\": true,\n \"ActionsId\": \"ACT_LOG_WARNING\"\n }\n ]\n}\n\n" + "raw": "{\n \"method\": \"APIerSv1.SetActions\",\n \"params\": [\n {\n \"Actions\": [\n {\n \"Identifier\": \"*log\",\n \"BalanceId\": null,\n\t\t\t\t\t\"BalanceUuid\": null,\n\t \"BalanceType\": null,\n \"Directions\": null,\n \"Units\": null,\n \"ExpiryTime\": null,\n \"Filter\": null,\n \"TimingTags\": null,\n \"DestinationIds\": null,\n \"RatingSubject\": null,\n \"Categories\": null,\n \"SharedGroups\": null,\n \"BalanceWeight\": null,\n \"ExtraParameters\": null,\n \"BalanceBlocker\": \"false\",\n \"BalanceDisabled\": \"false\",\n \"Weight\": 10\n \n }\n ],\n \"Overwrite\": true,\n \"ActionsId\": \"ACT_LOG_WARNING\"\n }\n ]\n}\n\n" }, "url": { "raw": "{{base_url}}/jsonrpc", diff --git a/data/tariffplans/dispatchers/Attributes.csv b/data/tariffplans/dispatchers/Attributes.csv index defe079eb..dfd14fb5e 100644 --- a/data/tariffplans/dispatchers/Attributes.csv +++ b/data/tariffplans/dispatchers/Attributes.csv @@ -18,5 +18,5 @@ cgrates.org,ATTR_API_CDRS_AUTH,*auth,*string:~*req.APIKey:cdrs12345,,,*req.APIMe cgrates.org,ATTR_API_DSP_AUTH,*auth,*string:~*req.APIKey:dsp12345,,,*req.APIMethods,*constant,DispatcherSv1.Ping&DispatcherSv1.GetProfileForEvent,false,20 cgrates.org,ATTR_API_PSE_AUTH,*auth,*string:~*req.APIKey:pse12345,,,*req.APIMethods,*constant,SessionSv1.Ping&SessionSv1.AuthorizeEvent&SessionSv1.AuthorizeEventWithDigest&SessionSv1.InitiateSession&SessionSv1.InitiateSessionWithDigest&SessionSv1.UpdateSession&SessionSv1.SyncSessions&SessionSv1.TerminateSession&SessionSv1.ProcessCDR&SessionSv1.ProcessMessage&SessionSv1.GetActiveSessions&SessionSv1.GetActiveSessionsCount&SessionSv1.ForceDisconnect&SessionSv1.GetPassiveSessions&SessionSv1.GetPassiveSessionsCount&SessionSv1.ReplicateSessions&SessionSv1.SetPassiveSession&AttributeSv1.ProcessEvent&Responder.Debit&ResourceSv1.AllocateResources&ChargerSv1.ProcessEvent&Responder.MaxDebit,false,20 cgrates.org,ATTR_API_CFG_AUTH,*auth,*string:~*req.APIKey:cfg12345,,,*req.APIMethods,*constant,ConfigSv1.GetJSONSection&ConfigSv1.ReloadConfig,false,20 -cgrates.org,ATTR_API_APIER_AUTH,*auth,*string:~*req.APIKey:apier12345,,,*req.APIMethods,*constant,ApierV1.GetAttributeProfile&ApierV1.SetAttributeProfile,false,20 +cgrates.org,ATTR_API_APIER_AUTH,*auth,*string:~*req.APIKey:apier12345,,,*req.APIMethods,*constant,APIerSv1.GetAttributeProfile&APIerSv1.SetAttributeProfile,false,20 cgrates.org,ATTR_API_RALS_AUTH,*auth,*string:~*req.APIKey:rals12345,,,*req.APIMethods,*constant,RALsV1.Ping&RALsV1.GetRatingPlansCost,false,20 diff --git a/data/tariffplans/dispatchers_gob/Attributes.csv b/data/tariffplans/dispatchers_gob/Attributes.csv index 610f17c9d..9d1a47e62 100644 --- a/data/tariffplans/dispatchers_gob/Attributes.csv +++ b/data/tariffplans/dispatchers_gob/Attributes.csv @@ -18,5 +18,5 @@ cgrates.org,ATTR_API_CDRS_AUTH,*auth,*string:~*req.APIKey:cdrs12345,,,*req.APIMe cgrates.org,ATTR_API_DSP_AUTH,*auth,*string:~*req.APIKey:dsp12345,,,*req.APIMethods,*constant,DispatcherSv1.Ping&DispatcherSv1.GetProfileForEvent,false,20 cgrates.org,ATTR_API_PSE_AUTH,*auth,*string:~*req.APIKey:pse12345,,,*req.APIMethods,*constant,SessionSv1.Ping&SessionSv1.AuthorizeEvent&SessionSv1.AuthorizeEventWithDigest&SessionSv1.InitiateSession&SessionSv1.InitiateSessionWithDigest&SessionSv1.UpdateSession&SessionSv1.SyncSessions&SessionSv1.TerminateSession&SessionSv1.ProcessCDR&SessionSv1.ProcessMessage&SessionSv1.GetActiveSessions&SessionSv1.GetActiveSessionsCount&SessionSv1.ForceDisconnect&SessionSv1.GetPassiveSessions&SessionSv1.GetPassiveSessionsCount&SessionSv1.ReplicateSessions&SessionSv1.SetPassiveSession&AttributeSv1.ProcessEvent&Responder.Debit&ResourceSv1.AllocateResources&ChargerSv1.ProcessEvent&Responder.MaxDebit,false,20 cgrates.org,ATTR_API_CFG_AUTH,*auth,*string:~*req.APIKey:cfg12345,,,*req.APIMethods,*constant,ConfigSv1.GetJSONSection&ConfigSv1.ReloadConfig,false,20 -cgrates.org,ATTR_API_APIER_AUTH,*auth,*string:~*req.APIKey:apier12345,,,*req.APIMethods,*constant,ApierV1.GetAttributeProfile&ApierV1.SetAttributeProfile,false,20 +cgrates.org,ATTR_API_APIER_AUTH,*auth,*string:~*req.APIKey:apier12345,,,*req.APIMethods,*constant,APIerSv1.GetAttributeProfile&APIerSv1.SetAttributeProfile,false,20 cgrates.org,ATTR_API_RALS_AUTH,*auth,*string:~*req.APIKey:rals12345,,,*req.APIMethods,*constant,RALsV1.Ping&RALsV1.GetRatingPlansCost,false,20 diff --git a/data/tariffplans/testtp/Actions.csv b/data/tariffplans/testtp/Actions.csv index 870a81cd0..e081eb7e0 100644 --- a/data/tariffplans/testtp/Actions.csv +++ b/data/tariffplans/testtp/Actions.csv @@ -9,8 +9,8 @@ TOPUP_DATA_r,*topup,,,,*monetary,,DATA_DEST,,,*unlimited,,5000000,10,false,false TOPUP_DATA_r,*topup,,,,*data,,DATA_DEST,datar,,*unlimited,,50000000000,10,false,false,10 TOPUP_VOICE,*topup,,,,*voice,,GERMANY_MOBILE,,,*unlimited,,50000,10,false,false,10 TOPUP_NEG,*topup,,,,*voice,,GERMANY;!GERMANY_MOBILE,*zero1m,,*unlimited,,100,10,false,false,10 -RPC,*cgr_rpc,"{""Address"": ""localhost:2013"",""Transport"":""*gob"",""Method"":""ApierV2.SetAccount"",""Attempts"":1,""Async"" :false,""Params"":{""Account"":""rpc"",""Tenant"":""cgrates.org""}}",,,,,,,,,,,,,, +RPC,*cgr_rpc,"{""Address"": ""localhost:2013"",""Transport"":""*gob"",""Method"":""APIerSv2.SetAccount"",""Attempts"":1,""Async"" :false,""Params"":{""Account"":""rpc"",""Tenant"":""cgrates.org""}}",,,,,,,,,,,,,, DID,*debit,,,,*monetary,,*any,,,*unlimited,*any,"{""Method"":""*incremental"",""Params"":{""Units"":1, ""Interval"":""month"",""Increment"":""day""}}",10.0,,,10.0 DID,*cdrlog,"{""action"":""^DID"",""prev_balance"":""BalanceValue""}",,,*monetary,,*any,,,*unlimited,,,10.0,,,10.0 -RPC_DEST,*cgr_rpc,"{""Address"": ""localhost:2013"",""Transport"":""*gob"",""Method"":""ApierV2.SetDestination"",""Attempts"":1,""Async"" :false,""Params"":{""Id"":""<<.Account.GetID>>"",""Prefixes"":[""1"",""2"",""3""]}}",,,,,,,,,,,,,, +RPC_DEST,*cgr_rpc,"{""Address"": ""localhost:2013"",""Transport"":""*gob"",""Method"":""APIerSv2.SetDestination"",""Attempts"":1,""Async"" :false,""Params"":{""Id"":""<<.Account.GetID>>"",""Prefixes"":[""1"",""2"",""3""]}}",,,,,,,,,,,,,, RPC_CDRSTATS,*cgr_rpc,"{""Address"": ""localhost:2013"",""Transport"":""*gob"",""Method"":""CDRStatsV1.AddQueue"",""Attempts"":1,""Async"" :false,""Params"":{""Id"":""qtest""}}",,,,,,,,,,,,,, diff --git a/dispatchers/caches_it_test.go b/dispatchers/caches_it_test.go index d9f31b319..f06ebdd01 100644 --- a/dispatchers/caches_it_test.go +++ b/dispatchers/caches_it_test.go @@ -225,7 +225,7 @@ func testDspChcGetItemIDs(t *testing.T) { }, } if err := dispEngine.RPC.Call(utils.CacheSv1GetItemIDs, argsAPI, &rcvKeys); err != nil { - t.Fatalf("Got error on ApierV1.GetCacheStats: %s ", err.Error()) + t.Fatalf("Got error on APIerSv1.GetCacheStats: %s ", err.Error()) } sort.Strings(rcvKeys) if !reflect.DeepEqual(expKeys, rcvKeys) { diff --git a/dispatchers/dispatchers_it_test.go b/dispatchers/dispatchers_it_test.go index a5c3327ec..9b3a1debc 100644 --- a/dispatchers/dispatchers_it_test.go +++ b/dispatchers/dispatchers_it_test.go @@ -48,7 +48,7 @@ func TestDspApierITMongo(t *testing.T) { testDsp(t, sTestsDspApier, "TestDspApier", "all", "all2", "dispatchers_mongo", "tutorial", "oldtutorial", "dispatchers") } -//because we import dispatchers in apierV1 we will send information as map[string]interface{} +//because we import dispatchers in APIerSv1 we will send information as map[string]interface{} func testDspApierSetAttributes(t *testing.T) { ev := &map[string]interface{}{ utils.Tenant: "cgrates.org", @@ -74,7 +74,7 @@ func testDspApierSetAttributes(t *testing.T) { utils.APIKey: utils.StringPointer("apier12345"), } var result string - if err := dispEngine.RPC.Call(utils.ApierV1SetAttributeProfile, ev, &result); err != nil { + if err := dispEngine.RPC.Call(utils.APIerSv1SetAttributeProfile, ev, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -107,7 +107,7 @@ func testDspApierGetAttributes(t *testing.T) { Weight: 10, } alsPrf.Compile() - if err := dispEngine.RPC.Call(utils.ApierV1GetAttributeProfile, + if err := dispEngine.RPC.Call(utils.APIerSv1GetAttributeProfile, utils.TenantIDWithArgDispatcher{ TenantID: &utils.TenantID{Tenant: "cgrates.org", ID: "ATTR_Dispatcher"}, ArgDispatcher: &utils.ArgDispatcher{APIKey: utils.StringPointer("apier12345")}, @@ -123,7 +123,7 @@ func testDspApierGetAttributes(t *testing.T) { func testDspApierUnkownAPiKey(t *testing.T) { var reply *engine.AttributeProfile - if err := dispEngine.RPC.Call(utils.ApierV1GetAttributeProfile, + if err := dispEngine.RPC.Call(utils.APIerSv1GetAttributeProfile, utils.TenantIDWithArgDispatcher{ TenantID: &utils.TenantID{Tenant: "cgrates.org", ID: "ATTR_Dispatcher"}, ArgDispatcher: &utils.ArgDispatcher{APIKey: utils.StringPointer("RandomApiKey")}, diff --git a/dispatchers/lib_test.go b/dispatchers/lib_test.go index 450dabe16..72785fa78 100644 --- a/dispatchers/lib_test.go +++ b/dispatchers/lib_test.go @@ -121,7 +121,7 @@ func (d *testDispatcher) resetStorDb(t *testing.T) { func (d *testDispatcher) loadData(t *testing.T, path string) { var reply string attrs := &utils.AttrLoadTpFromFolder{FolderPath: path} - if err := d.RPC.Call(utils.ApierV1LoadTariffPlanFromFolder, attrs, &reply); err != nil { + if err := d.RPC.Call(utils.APIerSv1LoadTariffPlanFromFolder, attrs, &reply); err != nil { t.Errorf("<%s>Error at loading data from folder :%v", d.CfgParh, err) } } diff --git a/dispatchers/sessions_it_test.go b/dispatchers/sessions_it_test.go index 01f4d5fff..7de006d3a 100755 --- a/dispatchers/sessions_it_test.go +++ b/dispatchers/sessions_it_test.go @@ -97,7 +97,7 @@ func testDspSessionAddBalacne(t *testing.T) { }, } var reply string - if err := allEngine.RPC.Call(utils.ApierV2SetBalance, attrSetBalance, &reply); err != nil { + if err := allEngine.RPC.Call(utils.APIerSv2SetBalance, attrSetBalance, &reply); err != nil { t.Error(err) } else if reply != utils.OK { t.Errorf("Received: %s", reply) @@ -108,18 +108,18 @@ func testDspSessionAddBalacne(t *testing.T) { Account: attrSetBalance.Account, } eAcntVal := float64(initUsage) - if err := allEngine.RPC.Call(utils.ApierV2GetAccount, attrs, &acnt); err != nil { + if err := allEngine.RPC.Call(utils.APIerSv2GetAccount, attrs, &acnt); err != nil { t.Error(err) } else if acnt.BalanceMap[utils.VOICE].GetTotalValue() != eAcntVal { t.Errorf("Expecting: %v, received: %v", time.Duration(eAcntVal), time.Duration(acnt.BalanceMap[utils.VOICE].GetTotalValue())) } - if err := allEngine2.RPC.Call(utils.ApierV2SetBalance, attrSetBalance, &reply); err != nil { + if err := allEngine2.RPC.Call(utils.APIerSv2SetBalance, attrSetBalance, &reply); err != nil { t.Error(err) } else if reply != utils.OK { t.Errorf("Received: %s", reply) } - if err := allEngine2.RPC.Call(utils.ApierV2GetAccount, attrs, &acnt); err != nil { + if err := allEngine2.RPC.Call(utils.APIerSv2GetAccount, attrs, &acnt); err != nil { t.Error(err) } else if acnt.BalanceMap[utils.VOICE].GetTotalValue() != eAcntVal { t.Errorf("Expecting: %v, received: %v", diff --git a/docs/cdrexporter.rst b/docs/cdrexporter.rst index 6c62aefaf..bdc944543 100644 --- a/docs/cdrexporter.rst +++ b/docs/cdrexporter.rst @@ -72,7 +72,7 @@ Principles behind exports: :: - rpc.call("ApierV1.ExportCsvCdrs",{"TimeStart":"1383823746","TimeEnd":"1383833746"} ) + rpc.call("APIerSv1.ExportCsvCdrs",{"TimeStart":"1383823746","TimeEnd":"1383833746"} ) - On each export call there will be a .csv format file generated using configured separator. Location of the export folder is definable inside *cgrates.cfg*. - File name of the export will appear like: *cdrs_$(timestamp).csv* where $(timestamp) will be replaced by unix timestamp of the server running the export process or requested via API call. diff --git a/docs/readthedocs/accountLifeCycle.rst b/docs/readthedocs/accountLifeCycle.rst index 9ff35319e..a87d9cd59 100644 --- a/docs/readthedocs/accountLifeCycle.rst +++ b/docs/readthedocs/accountLifeCycle.rst @@ -17,7 +17,7 @@ Following steps will cover use-case "User Life cycle" :: { - "method": "ApierV2.SetAccount", + "method": "APIerSv2.SetAccount", "params": [{ "Tenant": "cgrates.org", "Account": "1003", @@ -49,7 +49,7 @@ Following steps will cover use-case "User Life cycle" :: { - "method": "ApierV2.GetAccounts", + "method": "APIerSv2.GetAccounts", "params": [{ "Tenant": "cgrates.org", "AccountIds": ["1003"], @@ -308,7 +308,7 @@ Following steps will cover use-case "User Life cycle" :: { - "method": "ApierV1.RemoveAccount", + "method": "APIerSv1.RemoveAccount", "params": [{ "Tenant": "cgrates.org", "Account": "1003", @@ -468,7 +468,7 @@ Returns a list of all ActionPlans defined on user accounts: :: { - "method": "ApierV1.GetActionPlan", + "method": "APIerSv1.GetActionPlan", "params": [{ "ID": "" }], @@ -657,7 +657,7 @@ Returns a list of accounts where ActionPlan for "PACKAGE_10" is allocated: :: { - "method": "ApierV1.GetActionPlan", + "method": "APIerSv1.GetActionPlan", "params": [{ "ID": "PACKAGE_10" }], diff --git a/docs/readthedocs/balanceManagement.rst b/docs/readthedocs/balanceManagement.rst index 863deb25e..9718bc4aa 100644 --- a/docs/readthedocs/balanceManagement.rst +++ b/docs/readthedocs/balanceManagement.rst @@ -14,7 +14,7 @@ :: { - "method": "ApierV1.SetBalance", + "method": "APIerSv1.SetBalance", "params": [{ "Tenant": "cgrates.org", "Account": "1003", @@ -56,7 +56,7 @@ :: { - "method": "ApierV1.AddBalance", + "method": "APIerSv1.AddBalance", "params": [{ "Tenant": "cgrates.org", "Account": "1003", @@ -99,7 +99,7 @@ :: { - "method": "ApierV1.DebitBalance", + "method": "APIerSv1.DebitBalance", "params": [{ "Tenant": "cgrates.org", "Account": "1003", @@ -132,7 +132,7 @@ 3.4 Get Remaining Balance ------------------------- -Sum of BalanceMap.Value resulted from ApierV2.GetAccounts request +Sum of BalanceMap.Value resulted from APIerSv2.GetAccounts request 3.5 Debit Air Time (TBV) @@ -247,7 +247,7 @@ Sum of BalanceMap.Value resulted from ApierV2.GetAccounts request :: { - "method": "ApierV1.SetBalance", + "method": "APIerSv1.SetBalance", "params": [{ "Tenant": "cgrates.org", "Account": "1001", @@ -291,7 +291,7 @@ Sum of BalanceMap.Value resulted from ApierV2.GetAccounts request :: { - "method": "ApierV1.SetBalance", + "method": "APIerSv1.SetBalance", "params": [{ "Tenant": "cgrates.org", "Account": "1001", diff --git a/docs/readthedocs/cdrManagement.rst b/docs/readthedocs/cdrManagement.rst index 615f3bb32..d1e2728b4 100644 --- a/docs/readthedocs/cdrManagement.rst +++ b/docs/readthedocs/cdrManagement.rst @@ -12,7 +12,7 @@ :: { - "method": "ApierV1.ExportCDRs", + "method": "APIerSv1.ExportCDRs", "params": [{ "ExportTemplate": null, "ExportFormat": null, diff --git a/docs/readthedocs/introduction.rst b/docs/readthedocs/introduction.rst index be2fa1842..09e229452 100644 --- a/docs/readthedocs/introduction.rst +++ b/docs/readthedocs/introduction.rst @@ -18,5 +18,5 @@ URL: http://your_server_ip:2080/jsonrpc :: - {"method":"ApierV2.GetAccounts","params":[{"Tenant":"cgrates.org","AccountIds":["1001"],"Offset":0,"Limit":0}],"id":3} + {"method":"APIerSv2.GetAccounts","params":[{"Tenant":"cgrates.org","AccountIds":["1001"],"Offset":0,"Limit":0}],"id":3} Content-Type: application/json diff --git a/docs/readthedocs/misc.rst b/docs/readthedocs/misc.rst index 07fb0f705..ed06e981b 100644 --- a/docs/readthedocs/misc.rst +++ b/docs/readthedocs/misc.rst @@ -12,7 +12,7 @@ GetCacheStats returns datadb cache status. Empty params return all stats: :: { - "method": "ApierV1.GetCacheStats", + "method": "APIerSv1.GetCacheStats", "params": [{}], "id": 0 } diff --git a/docs/readthedocs/suppliersManagement.rst b/docs/readthedocs/suppliersManagement.rst index c32ecc23a..b0343aa77 100644 --- a/docs/readthedocs/suppliersManagement.rst +++ b/docs/readthedocs/suppliersManagement.rst @@ -12,7 +12,7 @@ :: { - "method": "ApierV1.GetSupplierProfile", + "method": "APIerSv1.GetSupplierProfile", "params": [{ "Tenant": "cgrates.org", "ID": "SPP_1" diff --git a/docs/readthedocs/tariffPlanManagement.rst b/docs/readthedocs/tariffPlanManagement.rst index 3bd605bd7..301d2f143 100644 --- a/docs/readthedocs/tariffPlanManagement.rst +++ b/docs/readthedocs/tariffPlanManagement.rst @@ -20,7 +20,7 @@ :: { - "method": "ApierV1.GetCost", + "method": "APIerSv1.GetCost", "params": [{ "Tenant": "cgrates.org", "Category": "call", diff --git a/engine/actions2_it_test.go b/engine/actions2_it_test.go index c63494262..ea6465799 100644 --- a/engine/actions2_it_test.go +++ b/engine/actions2_it_test.go @@ -187,16 +187,16 @@ func testActionsExecuteRemoveSMCos1(t *testing.T) { }, }, } - if err := actsRPC.Call(utils.ApierV2SetActions, attrsAA, &reply); err != nil && err.Error() != utils.ErrExists.Error() { - t.Error("Got error on ApierV2.SetActions: ", err.Error()) + if err := actsRPC.Call(utils.APIerSv2SetActions, attrsAA, &reply); err != nil && err.Error() != utils.ErrExists.Error() { + t.Error("Got error on APIerSv2.SetActions: ", err.Error()) } else if reply != utils.OK { - t.Errorf("Calling ApierV2.SetActions received: %s", reply) + t.Errorf("Calling APIerSv2.SetActions received: %s", reply) } attrsEA := &utils.AttrExecuteAction{Tenant: "cgrates.org", ActionsId: attrsAA.ActionsId} - if err := actsRPC.Call(utils.ApierV1ExecuteAction, attrsEA, &reply); err != nil { - t.Error("Got error on ApierV1.ExecuteAction: ", err.Error()) + if err := actsRPC.Call(utils.APIerSv1ExecuteAction, attrsEA, &reply); err != nil { + t.Error("Got error on APIerSv1.ExecuteAction: ", err.Error()) } else if reply != utils.OK { - t.Errorf("Calling ApierV1.ExecuteAction received: %s", reply) + t.Errorf("Calling APIerSv1.ExecuteAction received: %s", reply) } // READ @@ -220,16 +220,16 @@ func testActionsExecuteRemoveSMCos2(t *testing.T) { }, }, } - if err := actsRPC.Call(utils.ApierV2SetActions, attrsAA, &reply); err != nil && err.Error() != utils.ErrExists.Error() { - t.Error("Got error on ApierV2.SetActions: ", err.Error()) + if err := actsRPC.Call(utils.APIerSv2SetActions, attrsAA, &reply); err != nil && err.Error() != utils.ErrExists.Error() { + t.Error("Got error on APIerSv2.SetActions: ", err.Error()) } else if reply != utils.OK { - t.Errorf("Calling ApierV2.SetActions received: %s", reply) + t.Errorf("Calling APIerSv2.SetActions received: %s", reply) } attrsEA := &utils.AttrExecuteAction{Tenant: "cgrates.org", ActionsId: attrsAA.ActionsId} - if err := actsRPC.Call(utils.ApierV1ExecuteAction, attrsEA, &reply); err != nil { - t.Error("Got error on ApierV1.ExecuteAction: ", err.Error()) + if err := actsRPC.Call(utils.APIerSv1ExecuteAction, attrsEA, &reply); err != nil { + t.Error("Got error on APIerSv1.ExecuteAction: ", err.Error()) } else if reply != utils.OK { - t.Errorf("Calling ApierV1.ExecuteAction received: %s", reply) + t.Errorf("Calling APIerSv1.ExecuteAction received: %s", reply) } // READ @@ -241,44 +241,44 @@ func testActionsExecuteRemoveSMCos2(t *testing.T) { func testActionsUpdateBalance(t *testing.T) { var reply string attrsSetAccount := &utils.AttrSetAccount{Tenant: "cgrates.org", Account: "testAcc"} - if err := actsRPC.Call(utils.ApierV1SetAccount, attrsSetAccount, &reply); err != nil { - t.Error("Got error on ApierV1.SetAccount: ", err.Error()) + if err := actsRPC.Call(utils.APIerSv1SetAccount, attrsSetAccount, &reply); err != nil { + t.Error("Got error on APIerSv1.SetAccount: ", err.Error()) } else if reply != utils.OK { - t.Errorf("Calling ApierV1.SetAccount received: %s", reply) + t.Errorf("Calling APIerSv1.SetAccount received: %s", reply) } topupAction := &utils.AttrSetActions{ActionsId: "ACT_TOPUP_RST", Actions: []*utils.TPAction{ {Identifier: utils.TOPUP, BalanceId: "test", BalanceType: utils.MONETARY, Units: "5", ExpiryTime: utils.UNLIMITED, Weight: 20.0}, }} - if err := actsRPC.Call(utils.ApierV2SetActions, topupAction, &reply); err != nil && err.Error() != utils.ErrExists.Error() { - t.Error("Got error on ApierV2.SetActions: ", err.Error()) + if err := actsRPC.Call(utils.APIerSv2SetActions, topupAction, &reply); err != nil && err.Error() != utils.ErrExists.Error() { + t.Error("Got error on APIerSv2.SetActions: ", err.Error()) } else if reply != utils.OK { - t.Errorf("Calling ApierV2.SetActions received: %s", reply) + t.Errorf("Calling APIerSv2.SetActions received: %s", reply) } changeBlockerAction := &utils.AttrSetActions{ActionsId: "ACT_BAL_UPDT", Actions: []*utils.TPAction{ {Identifier: utils.SET_BALANCE, BalanceId: "test", BalanceBlocker: "true"}, }} - if err := actsRPC.Call(utils.ApierV2SetActions, changeBlockerAction, &reply); err != nil && err.Error() != utils.ErrExists.Error() { - t.Error("Got error on ApierV2.SetActions: ", err.Error()) + if err := actsRPC.Call(utils.APIerSv2SetActions, changeBlockerAction, &reply); err != nil && err.Error() != utils.ErrExists.Error() { + t.Error("Got error on APIerSv2.SetActions: ", err.Error()) } else if reply != utils.OK { - t.Errorf("Calling ApierV2.SetActions received: %s", reply) + t.Errorf("Calling APIerSv2.SetActions received: %s", reply) } attrsEA := &utils.AttrExecuteAction{Tenant: attrsSetAccount.Tenant, Account: attrsSetAccount.Account, ActionsId: topupAction.ActionsId} - if err := actsRPC.Call(utils.ApierV1ExecuteAction, attrsEA, &reply); err != nil { - t.Error("Got error on ApierV1.ExecuteAction: ", err.Error()) + if err := actsRPC.Call(utils.APIerSv1ExecuteAction, attrsEA, &reply); err != nil { + t.Error("Got error on APIerSv1.ExecuteAction: ", err.Error()) } else if reply != utils.OK { - t.Errorf("Calling ApierV1.ExecuteAction received: %s", reply) + t.Errorf("Calling APIerSv1.ExecuteAction received: %s", reply) } time.Sleep(1) attrsEA2 := &utils.AttrExecuteAction{Tenant: attrsSetAccount.Tenant, Account: attrsSetAccount.Account, ActionsId: changeBlockerAction.ActionsId} - if err := actsRPC.Call(utils.ApierV1ExecuteAction, attrsEA2, &reply); err != nil { - t.Error("Got error on ApierV1.ExecuteAction: ", err.Error()) + if err := actsRPC.Call(utils.APIerSv1ExecuteAction, attrsEA2, &reply); err != nil { + t.Error("Got error on APIerSv1.ExecuteAction: ", err.Error()) } else if reply != utils.OK { - t.Errorf("Calling ApierV1.ExecuteAction received: %s", reply) + t.Errorf("Calling APIerSv1.ExecuteAction received: %s", reply) } var acc Account attrs2 := &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "testAcc"} - if err := actsRPC.Call(utils.ApierV2GetAccount, attrs2, &acc); err != nil { - t.Error("Got error on ApierV1.GetAccount: ", err.Error()) + if err := actsRPC.Call(utils.APIerSv2GetAccount, attrs2, &acc); err != nil { + t.Error("Got error on APIerSv1.GetAccount: ", err.Error()) } else if acc.BalanceMap[utils.MONETARY][0].ID != "test" { t.Errorf("Expected test result received %v ", acc.BalanceMap[utils.MONETARY][0].ID) } else if acc.BalanceMap[utils.MONETARY][0].Blocker != true { diff --git a/engine/actions_it_test.go b/engine/actions_it_test.go index 54da24ce7..2433f4c4b 100644 --- a/engine/actions_it_test.go +++ b/engine/actions_it_test.go @@ -117,28 +117,28 @@ func testActionsitRpcConn(t *testing.T) { func testActionsitSetCdrlogDebit(t *testing.T) { var reply string attrsSetAccount := &utils.AttrSetAccount{Tenant: "cgrates.org", Account: "dan2904"} - if err := actsLclRpc.Call(utils.ApierV1SetAccount, attrsSetAccount, &reply); err != nil { - t.Error("Got error on ApierV1.SetAccount: ", err.Error()) + if err := actsLclRpc.Call(utils.APIerSv1SetAccount, attrsSetAccount, &reply); err != nil { + t.Error("Got error on APIerSv1.SetAccount: ", err.Error()) } else if reply != utils.OK { - t.Errorf("Calling ApierV1.SetAccount received: %s", reply) + t.Errorf("Calling APIerSv1.SetAccount received: %s", reply) } attrsAA := &utils.AttrSetActions{ActionsId: "ACTS_1", Actions: []*utils.TPAction{ {Identifier: utils.DEBIT, BalanceType: utils.MONETARY, Units: "5", ExpiryTime: utils.UNLIMITED, Weight: 20.0}, {Identifier: utils.CDRLOG}, }} - if err := actsLclRpc.Call(utils.ApierV2SetActions, attrsAA, &reply); err != nil && err.Error() != utils.ErrExists.Error() { - t.Error("Got error on ApierV2.SetActions: ", err.Error()) + if err := actsLclRpc.Call(utils.APIerSv2SetActions, attrsAA, &reply); err != nil && err.Error() != utils.ErrExists.Error() { + t.Error("Got error on APIerSv2.SetActions: ", err.Error()) } else if reply != utils.OK { - t.Errorf("Calling ApierV2.SetActions received: %s", reply) + t.Errorf("Calling APIerSv2.SetActions received: %s", reply) } attrsEA := &utils.AttrExecuteAction{Tenant: attrsSetAccount.Tenant, Account: attrsSetAccount.Account, ActionsId: attrsAA.ActionsId} - if err := actsLclRpc.Call(utils.ApierV1ExecuteAction, attrsEA, &reply); err != nil { - t.Error("Got error on ApierV1.ExecuteAction: ", err.Error()) + if err := actsLclRpc.Call(utils.APIerSv1ExecuteAction, attrsEA, &reply); err != nil { + t.Error("Got error on APIerSv1.ExecuteAction: ", err.Error()) } else if reply != utils.OK { - t.Errorf("Calling ApierV1.ExecuteAction received: %s", reply) + t.Errorf("Calling APIerSv1.ExecuteAction received: %s", reply) } var rcvedCdrs []*ExternalCDR - if err := actsLclRpc.Call(utils.ApierV2GetCDRs, utils.RPCCDRsFilter{Sources: []string{utils.CDRLOG}, + if err := actsLclRpc.Call(utils.APIerSv2GetCDRs, utils.RPCCDRsFilter{Sources: []string{utils.CDRLOG}, Accounts: []string{attrsSetAccount.Account}}, &rcvedCdrs); err != nil { t.Error("Unexpected error: ", err.Error()) } else if len(rcvedCdrs) != 1 { @@ -160,28 +160,28 @@ func testActionsitSetCdrlogDebit(t *testing.T) { func testActionsitSetCdrlogTopup(t *testing.T) { var reply string attrsSetAccount := &utils.AttrSetAccount{Tenant: "cgrates.org", Account: "dan2905"} - if err := actsLclRpc.Call(utils.ApierV1SetAccount, attrsSetAccount, &reply); err != nil { - t.Error("Got error on ApierV1.SetAccount: ", err.Error()) + if err := actsLclRpc.Call(utils.APIerSv1SetAccount, attrsSetAccount, &reply); err != nil { + t.Error("Got error on APIerSv1.SetAccount: ", err.Error()) } else if reply != utils.OK { - t.Errorf("Calling ApierV1.SetAccount received: %s", reply) + t.Errorf("Calling APIerSv1.SetAccount received: %s", reply) } attrsAA := &utils.AttrSetActions{ActionsId: "ACTS_2", Actions: []*utils.TPAction{ {Identifier: utils.TOPUP, BalanceType: utils.MONETARY, Units: "5", ExpiryTime: utils.UNLIMITED, Weight: 20.0}, {Identifier: utils.CDRLOG}, }} - if err := actsLclRpc.Call(utils.ApierV2SetActions, attrsAA, &reply); err != nil && err.Error() != utils.ErrExists.Error() { - t.Error("Got error on ApierV2.SetActions: ", err.Error()) + if err := actsLclRpc.Call(utils.APIerSv2SetActions, attrsAA, &reply); err != nil && err.Error() != utils.ErrExists.Error() { + t.Error("Got error on APIerSv2.SetActions: ", err.Error()) } else if reply != utils.OK { - t.Errorf("Calling ApierV2.SetActions received: %s", reply) + t.Errorf("Calling APIerSv2.SetActions received: %s", reply) } attrsEA := &utils.AttrExecuteAction{Tenant: attrsSetAccount.Tenant, Account: attrsSetAccount.Account, ActionsId: attrsAA.ActionsId} - if err := actsLclRpc.Call(utils.ApierV1ExecuteAction, attrsEA, &reply); err != nil { - t.Error("Got error on ApierV1.ExecuteAction: ", err.Error()) + if err := actsLclRpc.Call(utils.APIerSv1ExecuteAction, attrsEA, &reply); err != nil { + t.Error("Got error on APIerSv1.ExecuteAction: ", err.Error()) } else if reply != utils.OK { - t.Errorf("Calling ApierV1.ExecuteAction received: %s", reply) + t.Errorf("Calling APIerSv1.ExecuteAction received: %s", reply) } var rcvedCdrs []*ExternalCDR - if err := actsLclRpc.Call(utils.ApierV2GetCDRs, utils.RPCCDRsFilter{Sources: []string{utils.CDRLOG}, + if err := actsLclRpc.Call(utils.APIerSv2GetCDRs, utils.RPCCDRsFilter{Sources: []string{utils.CDRLOG}, Accounts: []string{attrsSetAccount.Account}}, &rcvedCdrs); err != nil { t.Error("Unexpected error: ", err.Error()) } else if len(rcvedCdrs) != 1 { @@ -208,19 +208,19 @@ func testActionsitCdrlogEmpty(t *testing.T) { Units: "5", ExpiryTime: utils.UNLIMITED, Weight: 20.0}, {Identifier: utils.CDRLOG}, }} - if err := actsLclRpc.Call(utils.ApierV2SetActions, attrsAA, &reply); err != nil && err.Error() != utils.ErrExists.Error() { - t.Error("Got error on ApierV2.SetActions: ", err.Error()) + if err := actsLclRpc.Call(utils.APIerSv2SetActions, attrsAA, &reply); err != nil && err.Error() != utils.ErrExists.Error() { + t.Error("Got error on APIerSv2.SetActions: ", err.Error()) } else if reply != utils.OK { - t.Errorf("Calling ApierV2.SetActions received: %s", reply) + t.Errorf("Calling APIerSv2.SetActions received: %s", reply) } attrsEA := &utils.AttrExecuteAction{Tenant: attrsSetAccount.Tenant, Account: attrsSetAccount.Account, ActionsId: attrsAA.ActionsId} - if err := actsLclRpc.Call(utils.ApierV1ExecuteAction, attrsEA, &reply); err != nil { - t.Error("Got error on ApierV1.ExecuteAction: ", err.Error()) + if err := actsLclRpc.Call(utils.APIerSv1ExecuteAction, attrsEA, &reply); err != nil { + t.Error("Got error on APIerSv1.ExecuteAction: ", err.Error()) } else if reply != utils.OK { - t.Errorf("Calling ApierV1.ExecuteAction received: %s", reply) + t.Errorf("Calling APIerSv1.ExecuteAction received: %s", reply) } var rcvedCdrs []*ExternalCDR - if err := actsLclRpc.Call(utils.ApierV2GetCDRs, utils.RPCCDRsFilter{Sources: []string{utils.CDRLOG}, + if err := actsLclRpc.Call(utils.APIerSv2GetCDRs, utils.RPCCDRsFilter{Sources: []string{utils.CDRLOG}, Accounts: []string{attrsSetAccount.Account}, RunIDs: []string{utils.DEBIT}}, &rcvedCdrs); err != nil { t.Error("Unexpected error: ", err.Error()) } else if len(rcvedCdrs) != 2 { @@ -247,25 +247,25 @@ func testActionsitCdrlogWithParams(t *testing.T) { DestinationIds: "RET", Units: "25", ExpiryTime: utils.UNLIMITED, Weight: 20.0}, }, } - if err := actsLclRpc.Call(utils.ApierV2SetActions, attrsAA, &reply); err != nil && err.Error() != utils.ErrExists.Error() { - t.Error("Got error on ApierV2.SetActions: ", err.Error()) + if err := actsLclRpc.Call(utils.APIerSv2SetActions, attrsAA, &reply); err != nil && err.Error() != utils.ErrExists.Error() { + t.Error("Got error on APIerSv2.SetActions: ", err.Error()) } else if reply != utils.OK { - t.Errorf("Calling ApierV2.SetActions received: %s", reply) + t.Errorf("Calling APIerSv2.SetActions received: %s", reply) } attrsEA := &utils.AttrExecuteAction{Tenant: attrsSetAccount.Tenant, Account: attrsSetAccount.Account, ActionsId: attrsAA.ActionsId} - if err := actsLclRpc.Call(utils.ApierV1ExecuteAction, attrsEA, &reply); err != nil { - t.Error("Got error on ApierV1.ExecuteAction: ", err.Error()) + if err := actsLclRpc.Call(utils.APIerSv1ExecuteAction, attrsEA, &reply); err != nil { + t.Error("Got error on APIerSv1.ExecuteAction: ", err.Error()) } else if reply != utils.OK { - t.Errorf("Calling ApierV1.ExecuteAction received: %s", reply) + t.Errorf("Calling APIerSv1.ExecuteAction received: %s", reply) } var rcvedCdrs []*ExternalCDR - if err := actsLclRpc.Call(utils.ApierV2GetCDRs, utils.RPCCDRsFilter{Sources: []string{utils.CDRLOG}, + if err := actsLclRpc.Call(utils.APIerSv2GetCDRs, utils.RPCCDRsFilter{Sources: []string{utils.CDRLOG}, Accounts: []string{attrsSetAccount.Account}, RunIDs: []string{utils.DEBIT}, RequestTypes: []string{"*pseudoprepaid"}}, &rcvedCdrs); err != nil { t.Error("Unexpected error: ", err.Error()) } else if len(rcvedCdrs) != 1 { t.Error("Unexpected number of CDRs returned: ", len(rcvedCdrs)) } - if err := actsLclRpc.Call(utils.ApierV2GetCDRs, utils.RPCCDRsFilter{Sources: []string{utils.CDRLOG}, + if err := actsLclRpc.Call(utils.APIerSv2GetCDRs, utils.RPCCDRsFilter{Sources: []string{utils.CDRLOG}, Accounts: []string{attrsSetAccount.Account}, RunIDs: []string{utils.DEBIT_RESET}, RequestTypes: []string{"*pseudoprepaid"}}, &rcvedCdrs); err != nil { t.Error("Unexpected error: ", err.Error()) } else if len(rcvedCdrs) != 1 { @@ -279,22 +279,22 @@ func testActionsitThresholdCDrLog(t *testing.T) { var reply string attrsSetAccount := &utils.AttrSetAccount{Tenant: "cgrates.org", Account: "th_acc"} - if err := actsLclRpc.Call(utils.ApierV1SetAccount, attrsSetAccount, &reply); err != nil { - t.Error("Got error on ApierV1.SetAccount: ", err.Error()) + if err := actsLclRpc.Call(utils.APIerSv1SetAccount, attrsSetAccount, &reply); err != nil { + t.Error("Got error on APIerSv1.SetAccount: ", err.Error()) } else if reply != utils.OK { - t.Errorf("Calling ApierV1.SetAccount received: %s", reply) + t.Errorf("Calling APIerSv1.SetAccount received: %s", reply) } attrsAA := &utils.AttrSetActions{ActionsId: "ACT_TH_CDRLOG", Actions: []*utils.TPAction{ {Identifier: utils.TOPUP, BalanceType: utils.MONETARY, Units: "5", ExpiryTime: utils.UNLIMITED, Weight: 20.0}, {Identifier: utils.CDRLOG}, }} - if err := actsLclRpc.Call(utils.ApierV2SetActions, attrsAA, &reply); err != nil && err.Error() != utils.ErrExists.Error() { - t.Error("Got error on ApierV2.SetActions: ", err.Error()) + if err := actsLclRpc.Call(utils.APIerSv2SetActions, attrsAA, &reply); err != nil && err.Error() != utils.ErrExists.Error() { + t.Error("Got error on APIerSv2.SetActions: ", err.Error()) } else if reply != utils.OK { - t.Errorf("Calling ApierV2.SetActions received: %s", reply) + t.Errorf("Calling APIerSv2.SetActions received: %s", reply) } //make sure that the threshold don't exit - if err := actsLclRpc.Call(utils.ApierV1GetThresholdProfile, + if err := actsLclRpc.Call(utils.APIerSv1GetThresholdProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "THD_Test"}, &thReply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) @@ -316,12 +316,12 @@ func testActionsitThresholdCDrLog(t *testing.T) { Async: false, }, } - if err := actsLclRpc.Call(utils.ApierV1SetThresholdProfile, tPrfl, &result); err != nil { + if err := actsLclRpc.Call(utils.APIerSv1SetThresholdProfile, tPrfl, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } - if err := actsLclRpc.Call(utils.ApierV1GetThresholdProfile, + if err := actsLclRpc.Call(utils.APIerSv1GetThresholdProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "THD_Test"}, &thReply); err != nil { t.Error(err) } else if !reflect.DeepEqual(tPrfl.ThresholdProfile, thReply) { @@ -365,7 +365,7 @@ func testActionsitThresholdCDrLog(t *testing.T) { t.Errorf("Expecting ids: %s, received: %s", eIDs, ids) } var rcvedCdrs []*ExternalCDR - if err := actsLclRpc.Call(utils.ApierV2GetCDRs, utils.RPCCDRsFilter{Sources: []string{utils.CDRLOG}, + if err := actsLclRpc.Call(utils.APIerSv2GetCDRs, utils.RPCCDRsFilter{Sources: []string{utils.CDRLOG}, Accounts: []string{attrsSetAccount.Account}}, &rcvedCdrs); err != nil { t.Error("Unexpected error: ", err.Error()) } else if len(rcvedCdrs) != 1 { @@ -408,10 +408,10 @@ func testActionsitCDRAccount(t *testing.T) { }, Overwrite: true, } - if err := actsLclRpc.Call(utils.ApierV1AddBalance, attrs, &reply); err != nil { - t.Error("Got error on ApierV1.AddBalance: ", err.Error()) + if err := actsLclRpc.Call(utils.APIerSv1AddBalance, attrs, &reply); err != nil { + t.Error("Got error on APIerSv1.AddBalance: ", err.Error()) } else if reply != utils.OK { - t.Errorf("Calling ApierV1.AddBalance received: %s", reply) + t.Errorf("Calling APIerSv1.AddBalance received: %s", reply) } attrsAA := &utils.AttrSetActions{ @@ -420,17 +420,17 @@ func testActionsitCDRAccount(t *testing.T) { {Identifier: utils.MetaCDRAccount, ExpiryTime: utils.UNLIMITED, Weight: 20.0}, }, } - if err := actsLclRpc.Call(utils.ApierV2SetActions, attrsAA, &reply); err != nil && err.Error() != utils.ErrExists.Error() { - t.Error("Got error on ApierV2.SetActions: ", err.Error()) + if err := actsLclRpc.Call(utils.APIerSv2SetActions, attrsAA, &reply); err != nil && err.Error() != utils.ErrExists.Error() { + t.Error("Got error on APIerSv2.SetActions: ", err.Error()) } else if reply != utils.OK { - t.Errorf("Calling ApierV2.SetActions received: %s", reply) + t.Errorf("Calling APIerSv2.SetActions received: %s", reply) } var acc Account attrs2 := &utils.AttrGetAccount{Tenant: "cgrates.org", Account: acnt} var uuid string - if err := actsLclRpc.Call(utils.ApierV2GetAccount, attrs2, &acc); err != nil { - t.Error("Got error on ApierV1.GetAccount: ", err.Error()) + if err := actsLclRpc.Call(utils.APIerSv2GetAccount, attrs2, &acc); err != nil { + t.Error("Got error on APIerSv1.GetAccount: ", err.Error()) } else { voice := acc.BalanceMap[utils.VOICE] for _, u := range voice { @@ -479,16 +479,16 @@ func testActionsitCDRAccount(t *testing.T) { time.Sleep(100 * time.Millisecond) attrsEA := &utils.AttrExecuteAction{Tenant: "cgrates.org", Account: acnt, ActionsId: attrsAA.ActionsId} - if err := actsLclRpc.Call(utils.ApierV1ExecuteAction, attrsEA, &reply); err != nil { - t.Error("Got error on ApierV1.ExecuteAction: ", err.Error()) + if err := actsLclRpc.Call(utils.APIerSv1ExecuteAction, attrsEA, &reply); err != nil { + t.Error("Got error on APIerSv1.ExecuteAction: ", err.Error()) } else if reply != utils.OK { - t.Errorf("Calling ApierV1.ExecuteAction received: %s", reply) + t.Errorf("Calling APIerSv1.ExecuteAction received: %s", reply) } - if err := actsLclRpc.Call(utils.ApierV2GetAccount, attrs2, &acc); err != nil { - t.Error("Got error on ApierV1.GetAccount: ", err.Error()) + if err := actsLclRpc.Call(utils.APIerSv2GetAccount, attrs2, &acc); err != nil { + t.Error("Got error on APIerSv1.GetAccount: ", err.Error()) } else if tv := acc.BalanceMap[utils.VOICE].GetTotalValue(); tv != float64(10*time.Second) { - t.Errorf("Calling ApierV1.GetBalance expected: %f, received: %f", float64(10*time.Second), tv) + t.Errorf("Calling APIerSv1.GetBalance expected: %f, received: %f", float64(10*time.Second), tv) } } @@ -504,13 +504,13 @@ func testActionsitThresholdCgrRpcAction(t *testing.T) { "Attempts":1, "Async" :false, "Params": {}}`}}} - if err := actsLclRpc.Call(utils.ApierV2SetActions, attrsAA, &reply); err != nil && err.Error() != utils.ErrExists.Error() { - t.Error("Got error on ApierV2.SetActions: ", err.Error()) + if err := actsLclRpc.Call(utils.APIerSv2SetActions, attrsAA, &reply); err != nil && err.Error() != utils.ErrExists.Error() { + t.Error("Got error on APIerSv2.SetActions: ", err.Error()) } else if reply != utils.OK { - t.Errorf("Calling ApierV2.SetActions received: %s", reply) + t.Errorf("Calling APIerSv2.SetActions received: %s", reply) } //make sure that the threshold don't exit - if err := actsLclRpc.Call(utils.ApierV1GetThresholdProfile, + if err := actsLclRpc.Call(utils.APIerSv1GetThresholdProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "TH_CGRRPC"}, &thReply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) @@ -531,12 +531,12 @@ func testActionsitThresholdCgrRpcAction(t *testing.T) { Async: false, }, } - if err := actsLclRpc.Call(utils.ApierV1SetThresholdProfile, tPrfl, &result); err != nil { + if err := actsLclRpc.Call(utils.APIerSv1SetThresholdProfile, tPrfl, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } - if err := actsLclRpc.Call(utils.ApierV1GetThresholdProfile, + if err := actsLclRpc.Call(utils.APIerSv1GetThresholdProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "TH_CGRRPC"}, &thReply); err != nil { t.Error(err) } else if !reflect.DeepEqual(tPrfl.ThresholdProfile, thReply) { @@ -568,13 +568,13 @@ func testActionsitThresholdPostEvent(t *testing.T) { attrsAA := &utils.AttrSetActions{ActionsId: "ACT_TH_POSTEVENT", Actions: []*utils.TPAction{ &utils.TPAction{Identifier: utils.MetaPostEvent, ExtraParameters: "http://127.0.0.1:12080/invalid_json"}, }} - if err := actsLclRpc.Call(utils.ApierV2SetActions, attrsAA, &reply); err != nil && err.Error() != utils.ErrExists.Error() { - t.Error("Got error on ApierV2.SetActions: ", err.Error()) + if err := actsLclRpc.Call(utils.APIerSv2SetActions, attrsAA, &reply); err != nil && err.Error() != utils.ErrExists.Error() { + t.Error("Got error on APIerSv2.SetActions: ", err.Error()) } else if reply != utils.OK { - t.Errorf("Calling ApierV2.SetActions received: %s", reply) + t.Errorf("Calling APIerSv2.SetActions received: %s", reply) } //make sure that the threshold don't exit - if err := actsLclRpc.Call(utils.ApierV1GetThresholdProfile, + if err := actsLclRpc.Call(utils.APIerSv1GetThresholdProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "THD_PostEvent"}, &thReply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) @@ -595,12 +595,12 @@ func testActionsitThresholdPostEvent(t *testing.T) { Async: false, }, } - if err := actsLclRpc.Call(utils.ApierV1SetThresholdProfile, tPrfl, &result); err != nil { + if err := actsLclRpc.Call(utils.APIerSv1SetThresholdProfile, tPrfl, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } - if err := actsLclRpc.Call(utils.ApierV1GetThresholdProfile, + if err := actsLclRpc.Call(utils.APIerSv1GetThresholdProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "THD_PostEvent"}, &thReply); err != nil { t.Error(err) } else if !reflect.DeepEqual(tPrfl.ThresholdProfile, thReply) { diff --git a/engine/cdr.go b/engine/cdr.go index d11a2e691..34e1c9f74 100644 --- a/engine/cdr.go +++ b/engine/cdr.go @@ -616,7 +616,7 @@ type ExternalCDR struct { PreRated bool // Mark the CDR as rated so we do not process it during mediation } -// UsageRecord is used when authorizing requests from outside, eg ApierV1.GetMaxUsage +// UsageRecord is used when authorizing requests from outside, eg APIerSv1.GetMaxUsage type UsageRecord struct { ToR string RequestType string diff --git a/engine/filters.go b/engine/filters.go index ff2fd760b..efc25db6f 100644 --- a/engine/filters.go +++ b/engine/filters.go @@ -442,7 +442,7 @@ func (fS *FilterS) getFieldNameDataProvider(initialDP config.DataProvider, return nil, fmt.Errorf("invalid fieldname <%s>", fieldName) } var account *Account - if err = fS.connMgr.Call(fS.cfg.FilterSCfg().RALsConns, nil, utils.ApierV2GetAccount, + if err = fS.connMgr.Call(fS.cfg.FilterSCfg().RALsConns, nil, utils.APIerSv2GetAccount, &utils.AttrGetAccount{Tenant: tenant, Account: splitFldName[1]}, &account); err != nil { return } @@ -517,7 +517,7 @@ func (fS *FilterS) getFieldValueDataProvider(initialDP config.DataProvider, return nil, fmt.Errorf("invalid fieldname <%s>", fieldValue) } var account *Account - if err = fS.connMgr.Call(fS.cfg.FilterSCfg().RALsConns, nil, utils.ApierV2GetAccount, + if err = fS.connMgr.Call(fS.cfg.FilterSCfg().RALsConns, nil, utils.APIerSv2GetAccount, &utils.AttrGetAccount{Tenant: tenant, Account: splitFldName[1]}, &account); err != nil { return } diff --git a/engine/storage_internal_stordb.go b/engine/storage_internal_stordb.go index dee707dc6..cfcda0746 100644 --- a/engine/storage_internal_stordb.go +++ b/engine/storage_internal_stordb.go @@ -1541,7 +1541,7 @@ func (iDB *InternalDB) GetCDRs(filter *utils.CDRsFilter, remove bool) (cdrs []*C continue } } - if filter.AnswerTimeStart != nil && !filter.AnswerTimeStart.IsZero() { // With IsZero we keep backwards compatible with ApierV1 + if filter.AnswerTimeStart != nil && !filter.AnswerTimeStart.IsZero() { // With IsZero we keep backwards compatible with APIerSv1 if cdr.AnswerTime.Before(*filter.AnswerTimeStart) { continue } diff --git a/engine/storage_sql.go b/engine/storage_sql.go index 992533dfa..c5c8cb4a0 100644 --- a/engine/storage_sql.go +++ b/engine/storage_sql.go @@ -936,7 +936,7 @@ func (self *SQLStorage) GetCDRs(qryFltr *utils.CDRsFilter, remove bool) ([]*CDR, if len(qryFltr.NotOriginHosts) != 0 { q = q.Where("origin_host not in (?)", qryFltr.NotOriginHosts) } - if qryFltr.AnswerTimeStart != nil && !qryFltr.AnswerTimeStart.IsZero() { // With IsZero we keep backwards compatible with ApierV1 + if qryFltr.AnswerTimeStart != nil && !qryFltr.AnswerTimeStart.IsZero() { // With IsZero we keep backwards compatible with APIerSv1 q = q.Where("answer_time >= ?", qryFltr.AnswerTimeStart) } if qryFltr.AnswerTimeEnd != nil && !qryFltr.AnswerTimeEnd.IsZero() { @@ -1052,13 +1052,13 @@ func (self *SQLStorage) GetCDRs(qryFltr *utils.CDRsFilter, remove bool) ([]*CDR, if qryFltr.SetupTimeEnd != nil { q = q.Where("setup_time < ?", qryFltr.SetupTimeEnd) } - if qryFltr.CreatedAtStart != nil && !qryFltr.CreatedAtStart.IsZero() { // With IsZero we keep backwards compatible with ApierV1 + if qryFltr.CreatedAtStart != nil && !qryFltr.CreatedAtStart.IsZero() { // With IsZero we keep backwards compatible with APIerSv1 q = q.Where("created_at >= ?", qryFltr.CreatedAtStart) } if qryFltr.CreatedAtEnd != nil && !qryFltr.CreatedAtEnd.IsZero() { q = q.Where("created_at < ?", qryFltr.CreatedAtEnd) } - if qryFltr.UpdatedAtStart != nil && !qryFltr.UpdatedAtStart.IsZero() { // With IsZero we keep backwards compatible with ApierV1 + if qryFltr.UpdatedAtStart != nil && !qryFltr.UpdatedAtStart.IsZero() { // With IsZero we keep backwards compatible with APIerSv1 q = q.Where("updated_at >= ?", qryFltr.UpdatedAtStart) } if qryFltr.UpdatedAtEnd != nil && !qryFltr.UpdatedAtEnd.IsZero() { diff --git a/ers/filecsv_it_test.go b/ers/filecsv_it_test.go index daad4b9ee..ad66c7d89 100644 --- a/ers/filecsv_it_test.go +++ b/ers/filecsv_it_test.go @@ -156,7 +156,7 @@ func testCsvITLoadTPFromFolder(t *testing.T) { attrs := &utils.AttrLoadTpFromFolder{ FolderPath: path.Join(*dataDir, "tariffplans", "testit")} var loadInst utils.LoadInstance - if err := csvRPC.Call(utils.ApierV2LoadTariffPlanFromFolder, + if err := csvRPC.Call(utils.APIerSv2LoadTariffPlanFromFolder, attrs, &loadInst); err != nil { t.Error(err) } @@ -192,7 +192,7 @@ func testCsvITHandleSessionFile(t *testing.T) { var acnt *engine.Account attrs := &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "1001"} eAcntVal := 10.0 - if err := csvRPC.Call(utils.ApierV2GetAccount, attrs, &acnt); err != nil { + if err := csvRPC.Call(utils.APIerSv2GetAccount, attrs, &acnt); err != nil { t.Error(err) } else if acnt.BalanceMap[utils.MONETARY].GetTotalValue() != eAcntVal { t.Errorf("Expected: %f, received: %f", eAcntVal, acnt.BalanceMap[utils.MONETARY].GetTotalValue()) @@ -284,7 +284,7 @@ func testCsvITAnalyseCDRs(t *testing.T) { var acnt *engine.Account attrs := &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "1001"} eAcntVal := 9.85 - if err := csvRPC.Call(utils.ApierV2GetAccount, attrs, &acnt); err != nil { + if err := csvRPC.Call(utils.APIerSv2GetAccount, attrs, &acnt); err != nil { t.Error(err) } else if acnt.BalanceMap[utils.MONETARY].GetTotalValue() != eAcntVal { t.Errorf("Expected: %f, received: %f", eAcntVal, acnt.BalanceMap[utils.MONETARY].GetTotalValue()) diff --git a/ers/filefwv_it_test.go b/ers/filefwv_it_test.go index fa7899f2e..53ffce00d 100644 --- a/ers/filefwv_it_test.go +++ b/ers/filefwv_it_test.go @@ -140,7 +140,7 @@ func testFWVITLoadTPFromFolder(t *testing.T) { }, } var result string - if err := fwvRPC.Call(utils.ApierV1SetChargerProfile, chargerProfile, &result); err != nil { + if err := fwvRPC.Call(utils.APIerSv1SetChargerProfile, chargerProfile, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -199,12 +199,12 @@ func testFWVITHandleCdr1File(t *testing.T) { func testFWVITAnalyseCDRs(t *testing.T) { time.Sleep(500 * time.Millisecond) var reply []*engine.ExternalCDR - if err := fwvRPC.Call(utils.ApierV2GetCDRs, utils.RPCCDRsFilter{}, &reply); err != nil { + if err := fwvRPC.Call(utils.APIerSv2GetCDRs, utils.RPCCDRsFilter{}, &reply); err != nil { t.Error("Unexpected error: ", err.Error()) } else if len(reply) != 34 { t.Error("Unexpected number of CDRs returned: ", len(reply)) } - if err := fwvRPC.Call(utils.ApierV2GetCDRs, utils.RPCCDRsFilter{OriginIDs: []string{"CDR0000010"}}, &reply); err != nil { + if err := fwvRPC.Call(utils.APIerSv2GetCDRs, utils.RPCCDRsFilter{OriginIDs: []string{"CDR0000010"}}, &reply); err != nil { t.Error("Unexpected error: ", err.Error()) } else if len(reply) != 1 { t.Error("Unexpected number of CDRs returned: ", len(reply)) diff --git a/ers/filexml_it_test.go b/ers/filexml_it_test.go index af1d0f013..37d53acf5 100644 --- a/ers/filexml_it_test.go +++ b/ers/filexml_it_test.go @@ -130,7 +130,7 @@ func testXMLITLoadTPFromFolder(t *testing.T) { attrs := &utils.AttrLoadTpFromFolder{ FolderPath: path.Join(*dataDir, "tariffplans", "testit")} var loadInst utils.LoadInstance - if err := xmlRPC.Call(utils.ApierV2LoadTariffPlanFromFolder, + if err := xmlRPC.Call(utils.APIerSv2LoadTariffPlanFromFolder, attrs, &loadInst); err != nil { t.Error(err) } @@ -285,12 +285,12 @@ func testXMLITHandleCdr1File(t *testing.T) { func testXmlITAnalyseCDRs(t *testing.T) { var reply []*engine.ExternalCDR - if err := xmlRPC.Call(utils.ApierV2GetCDRs, utils.RPCCDRsFilter{}, &reply); err != nil { + if err := xmlRPC.Call(utils.APIerSv2GetCDRs, utils.RPCCDRsFilter{}, &reply); err != nil { t.Error("Unexpected error: ", err.Error()) } else if len(reply) != 6 { t.Error("Unexpected number of CDRs returned: ", len(reply)) } - if err := xmlRPC.Call(utils.ApierV2GetCDRs, utils.RPCCDRsFilter{DestinationPrefixes: []string{"+4915117174963"}}, &reply); err != nil { + if err := xmlRPC.Call(utils.APIerSv2GetCDRs, utils.RPCCDRsFilter{DestinationPrefixes: []string{"+4915117174963"}}, &reply); err != nil { t.Error("Unexpected error: ", err.Error()) } else if len(reply) != 3 { t.Error("Unexpected number of CDRs returned: ", len(reply)) diff --git a/ers/flatstore_it_test.go b/ers/flatstore_it_test.go index c6a4fdbf3..37754c7d7 100644 --- a/ers/flatstore_it_test.go +++ b/ers/flatstore_it_test.go @@ -158,7 +158,7 @@ func testFlatstoreITLoadTPFromFolder(t *testing.T) { }, } var result string - if err := flatstoreRPC.Call(utils.ApierV1SetChargerProfile, chargerProfile, &result); err != nil { + if err := flatstoreRPC.Call(utils.APIerSv1SetChargerProfile, chargerProfile, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -205,12 +205,12 @@ func testFlatstoreITHandleCdr1File(t *testing.T) { func testFlatstoreITAnalyseCDRs(t *testing.T) { var reply []*engine.ExternalCDR - if err := flatstoreRPC.Call(utils.ApierV2GetCDRs, utils.RPCCDRsFilter{}, &reply); err != nil { + if err := flatstoreRPC.Call(utils.APIerSv2GetCDRs, utils.RPCCDRsFilter{}, &reply); err != nil { t.Error("Unexpected error: ", err.Error()) } else if len(reply) != 8 { t.Error("Unexpected number of CDRs returned: ", len(reply)) } - if err := flatstoreRPC.Call(utils.ApierV2GetCDRs, utils.RPCCDRsFilter{MinUsage: "1"}, &reply); err != nil { + if err := flatstoreRPC.Call(utils.APIerSv2GetCDRs, utils.RPCCDRsFilter{MinUsage: "1"}, &reply); err != nil { t.Error("Unexpected error: ", err.Error()) } else if len(reply) != 5 { t.Error("Unexpected number of CDRs returned: ", len(reply)) diff --git a/ers/partial_csv_it_test.go b/ers/partial_csv_it_test.go index 6685e148b..1c08f785c 100644 --- a/ers/partial_csv_it_test.go +++ b/ers/partial_csv_it_test.go @@ -157,7 +157,7 @@ func testPartITLoadTPFromFolder(t *testing.T) { }, } var result string - if err := partRPC.Call(utils.ApierV1SetChargerProfile, chargerProfile, &result); err != nil { + if err := partRPC.Call(utils.APIerSv1SetChargerProfile, chargerProfile, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -222,17 +222,17 @@ func testPartITVerifyFiles(t *testing.T) { func testPartITAnalyseCDRs(t *testing.T) { var reply []*engine.ExternalCDR - if err := partRPC.Call(utils.ApierV2GetCDRs, utils.RPCCDRsFilter{}, &reply); err != nil { + if err := partRPC.Call(utils.APIerSv2GetCDRs, utils.RPCCDRsFilter{}, &reply); err != nil { t.Error("Unexpected error: ", err.Error()) } else if len(reply) != 2 { t.Error("Unexpected number of CDRs returned: ", len(reply)) } - if err := partRPC.Call(utils.ApierV2GetCDRs, utils.RPCCDRsFilter{DestinationPrefixes: []string{"+4986517174963"}}, &reply); err != nil { + if err := partRPC.Call(utils.APIerSv2GetCDRs, utils.RPCCDRsFilter{DestinationPrefixes: []string{"+4986517174963"}}, &reply); err != nil { t.Error("Unexpected error: ", err.Error()) } else if len(reply) != 1 { t.Error("Unexpected number of CDRs returned: ", len(reply)) } - if err := partRPC.Call(utils.ApierV2GetCDRs, utils.RPCCDRsFilter{DestinationPrefixes: []string{"+4986517174960"}}, &reply); err != nil { + if err := partRPC.Call(utils.APIerSv2GetCDRs, utils.RPCCDRsFilter{DestinationPrefixes: []string{"+4986517174960"}}, &reply); err != nil { t.Error("Unexpected error: ", err.Error()) } else if len(reply) != 1 { t.Error("Unexpected number of CDRs returned: ", len(reply)) diff --git a/general_tests/a1_it_test.go b/general_tests/a1_it_test.go index 95b482e7a..5e1092151 100644 --- a/general_tests/a1_it_test.go +++ b/general_tests/a1_it_test.go @@ -111,7 +111,7 @@ func testA1itRPCConn(t *testing.T) { func testA1itLoadTPFromFolder(t *testing.T) { var reply string attrs := &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "test", "a1")} - if err := a1rpc.Call(utils.ApierV1LoadTariffPlanFromFolder, attrs, &reply); err != nil { + if err := a1rpc.Call(utils.APIerSv1LoadTariffPlanFromFolder, attrs, &reply); err != nil { t.Error(err) } else if reply != utils.OK { t.Error(reply) @@ -147,7 +147,7 @@ func testA1itLoadTPFromFolder(t *testing.T) { }, } var result string - if err := a1rpc.Call(utils.ApierV1SetChargerProfile, chargerProfile, &result); err != nil { + if err := a1rpc.Call(utils.APIerSv1SetChargerProfile, chargerProfile, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -165,14 +165,14 @@ func testA1itAddBalance1(t *testing.T) { utils.ID: "rpdata1_test", }, } - if err := a1rpc.Call(utils.ApierV1AddBalance, argAdd, &reply); err != nil { + if err := a1rpc.Call(utils.APIerSv1AddBalance, argAdd, &reply); err != nil { t.Error(err) } else if reply != utils.OK { t.Errorf(reply) } argGet := &utils.AttrGetAccount{Tenant: argAdd.Tenant, Account: argAdd.Account} var acnt *engine.Account - if err := a1rpc.Call(utils.ApierV2GetAccount, argGet, &acnt); err != nil { + if err := a1rpc.Call(utils.APIerSv2GetAccount, argGet, &acnt); err != nil { t.Error(err) } else { if acnt.BalanceMap[utils.DATA].GetTotalValue() != argAdd.Value { // We expect 11.5 since we have added in the previous test 1.5 @@ -292,7 +292,7 @@ func testA1itDataSession1(t *testing.T) { var cdrs []*engine.ExternalCDR req := utils.RPCCDRsFilter{RunIDs: []string{utils.MetaDefault}} - if err := a1rpc.Call(utils.ApierV2GetCDRs, req, &cdrs); err != nil { + if err := a1rpc.Call(utils.APIerSv2GetCDRs, req, &cdrs); err != nil { t.Error("Unexpected error: ", err.Error()) } else if len(cdrs) != 1 { t.Error("Unexpected number of CDRs returned: ", len(cdrs)) @@ -315,7 +315,7 @@ func testA1itDataSession1(t *testing.T) { } expBalance := float64(10000000000 - 2202800) // initial - total usage var acnt *engine.Account - if err := a1rpc.Call(utils.ApierV2GetAccount, + if err := a1rpc.Call(utils.APIerSv2GetAccount, &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "rpdata1"}, &acnt); err != nil { t.Error(err) } else if acnt.BalanceMap[utils.DATA].GetTotalValue() != expBalance { // We expect 11.5 since we have added in the previous test 1.5 @@ -339,7 +339,7 @@ func testA1itConcurrentAPs(t *testing.T) { ActionPlanIDs: []string{"PACKAGE_1"}, } var reply string - if err := a1rpc.Call(utils.ApierV2SetAccount, attrSetAcnt, &reply); err != nil { + if err := a1rpc.Call(utils.APIerSv2SetAccount, attrSetAcnt, &reply); err != nil { t.Error(err) } wg.Done() @@ -348,7 +348,7 @@ func testA1itConcurrentAPs(t *testing.T) { wg.Wait() // Make sure action plan was properly set var aps []*engine.ActionPlan - if err := a1rpc.Call(utils.ApierV1GetActionPlan, v1.AttrGetActionPlan{ID: "PACKAGE_1"}, &aps); err != nil { + if err := a1rpc.Call(utils.APIerSv1GetActionPlan, v1.AttrGetActionPlan{ID: "PACKAGE_1"}, &aps); err != nil { t.Error(err) } else if len(aps[0].AccountIDs.Slice()) != len(acnts) { t.Errorf("Received: %+v", aps[0]) @@ -358,7 +358,7 @@ func testA1itConcurrentAPs(t *testing.T) { wg.Add(3) go func(acnt string) { var atms []*v1.AccountActionTiming - if err := a1rpc.Call(utils.ApierV1GetAccountActionPlan, + if err := a1rpc.Call(utils.APIerSv1GetAccountActionPlan, utils.TenantAccount{Tenant: "cgrates.org", Account: acnt}, &atms); err != nil { t.Error(err) //} else if len(atms) != 2 || atms[0].ActionPlanId != "PACKAGE_1" { @@ -368,7 +368,7 @@ func testA1itConcurrentAPs(t *testing.T) { }(acnt) go func(acnt string) { var reply string - if err := a1rpc.Call(utils.ApierV1RemoveActionTiming, + if err := a1rpc.Call(utils.APIerSv1RemoveActionTiming, v1.AttrRemoveActionTiming{Tenant: "cgrates.org", Account: acnt, ActionPlanId: "PACKAGE_1"}, &reply); err != nil { t.Error(err) } @@ -381,7 +381,7 @@ func testA1itConcurrentAPs(t *testing.T) { ActionPlanIDs: []string{"PACKAGE_2"}, } var reply string - if err := a1rpc.Call(utils.ApierV2SetAccount, attrSetAcnt, &reply); err != nil { + if err := a1rpc.Call(utils.APIerSv2SetAccount, attrSetAcnt, &reply); err != nil { t.Error(err) } wg.Done() @@ -390,13 +390,13 @@ func testA1itConcurrentAPs(t *testing.T) { wg.Wait() // Make sure action plan was properly rem/set aps = []*engine.ActionPlan{} - if err := a1rpc.Call(utils.ApierV1GetActionPlan, v1.AttrGetActionPlan{ID: "PACKAGE_1"}, &aps); err != nil { + if err := a1rpc.Call(utils.APIerSv1GetActionPlan, v1.AttrGetActionPlan{ID: "PACKAGE_1"}, &aps); err != nil { t.Error(err) } else if len(aps[0].AccountIDs.Slice()) != 0 { t.Errorf("Received: %+v", aps[0]) } aps = []*engine.ActionPlan{} - if err := a1rpc.Call(utils.ApierV1GetActionPlan, v1.AttrGetActionPlan{ID: "PACKAGE_2"}, &aps); err != nil { + if err := a1rpc.Call(utils.APIerSv1GetActionPlan, v1.AttrGetActionPlan{ID: "PACKAGE_2"}, &aps); err != nil { t.Error(err) } else if len(aps[0].AccountIDs.Slice()) != len(acnts) { t.Errorf("Received: %+v", aps[0]) diff --git a/general_tests/accounts_it_test.go b/general_tests/accounts_it_test.go index 3b4d79ce8..8138070b2 100644 --- a/general_tests/accounts_it_test.go +++ b/general_tests/accounts_it_test.go @@ -117,7 +117,7 @@ func testV1AccRpcConn(t *testing.T) { func testV1AccGetAccountBeforeSet(t *testing.T) { var reply *engine.Account - if err := accRpc.Call(utils.ApierV2GetAccount, + if err := accRpc.Call(utils.APIerSv2GetAccount, &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "1001"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) @@ -127,7 +127,7 @@ func testV1AccGetAccountBeforeSet(t *testing.T) { func testV1AccLoadTarrifPlans(t *testing.T) { var reply string attrs := &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "testit")} - if err := accRpc.Call(utils.ApierV1LoadTariffPlanFromFolder, attrs, &reply); err != nil { + if err := accRpc.Call(utils.APIerSv1LoadTariffPlanFromFolder, attrs, &reply); err != nil { t.Error(err) } else if reply != utils.OK { t.Error("Unexpected reply returned", reply) @@ -137,7 +137,7 @@ func testV1AccLoadTarrifPlans(t *testing.T) { func testV1AccGetAccountAfterLoad(t *testing.T) { var reply *engine.Account - if err := accRpc.Call(utils.ApierV2GetAccount, + if err := accRpc.Call(utils.APIerSv2GetAccount, &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "1001"}, &reply); err != nil { t.Error(err) @@ -146,7 +146,7 @@ func testV1AccGetAccountAfterLoad(t *testing.T) { func testV1AccRemAccount(t *testing.T) { var reply string - if err := accRpc.Call(utils.ApierV1RemoveAccount, + if err := accRpc.Call(utils.APIerSv1RemoveAccount, &utils.AttrRemoveAccount{Tenant: "cgrates.org", Account: "1001"}, &reply); err != nil { t.Error(err) @@ -157,7 +157,7 @@ func testV1AccRemAccount(t *testing.T) { func testV1AccGetAccountAfterDelete(t *testing.T) { var reply *engine.Account - if err := accRpc.Call(utils.ApierV2GetAccount, + if err := accRpc.Call(utils.APIerSv2GetAccount, &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "1001"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) @@ -166,7 +166,7 @@ func testV1AccGetAccountAfterDelete(t *testing.T) { func testV1AccSetAccount(t *testing.T) { var reply string - if err := accRpc.Call(utils.ApierV2SetAccount, + if err := accRpc.Call(utils.APIerSv2SetAccount, &utils.AttrSetAccount{Tenant: "cgrates.org", Account: "testacc"}, &reply); err != nil { t.Error(err) } else if reply != utils.OK { @@ -176,7 +176,7 @@ func testV1AccSetAccount(t *testing.T) { func testV1AccGetAccountAfterSet(t *testing.T) { var reply *engine.Account - if err := accRpc.Call(utils.ApierV2GetAccount, + if err := accRpc.Call(utils.APIerSv2GetAccount, &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "testacc"}, &reply); err != nil { t.Error(err) } @@ -184,7 +184,7 @@ func testV1AccGetAccountAfterSet(t *testing.T) { func testV1AccRemAccountSet(t *testing.T) { var reply string - if err := accRpc.Call(utils.ApierV1RemoveAccount, + if err := accRpc.Call(utils.APIerSv1RemoveAccount, &utils.AttrRemoveAccount{Tenant: "cgrates.org", Account: "testacc"}, &reply); err != nil { t.Error(err) @@ -195,7 +195,7 @@ func testV1AccRemAccountSet(t *testing.T) { func testV1AccGetAccountSetAfterDelete(t *testing.T) { var reply *engine.Account - if err := accRpc.Call(utils.ApierV2GetAccount, + if err := accRpc.Call(utils.APIerSv2GetAccount, &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "testacc"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) @@ -206,7 +206,7 @@ func testV1AccGetAccountSetAfterDelete(t *testing.T) { Need to investigate for redis why didn't return not found func testV1AccRemAccountAfterDelete(t *testing.T) { var reply string - if err := accRpc.Call(utils.ApierV1RemoveAccount, + if err := accRpc.Call(utils.APIerSv1RemoveAccount, &utils.AttrRemoveAccount{Tenant: "cgrates.org", Account: "testacc"}, &reply); err == nil || err.Error() != utils.NewErrServerError(utils.ErrNotFound).Error() { t.Error(err) @@ -219,7 +219,7 @@ func testV1AccMonthly(t *testing.T) { timeAfter := time.Now().Add(10*time.Second).AddDate(0, 1, 0) timeBefore := time.Now().Add(-10*time.Second).AddDate(0, 1, 0) var reply *engine.Account - if err := accRpc.Call(utils.ApierV2GetAccount, + if err := accRpc.Call(utils.APIerSv2GetAccount, &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "1002"}, &reply); err != nil { t.Error(err) @@ -243,10 +243,10 @@ func testV1AccSendToThreshold(t *testing.T) { {Identifier: utils.DISABLE_ACCOUNT}, {Identifier: utils.LOG}, }} - if err := accRpc.Call(utils.ApierV2SetActions, attrsAA, &reply); err != nil && err.Error() != utils.ErrExists.Error() { - t.Error("Got error on ApierV2.SetActions: ", err.Error()) + if err := accRpc.Call(utils.APIerSv2SetActions, attrsAA, &reply); err != nil && err.Error() != utils.ErrExists.Error() { + t.Error("Got error on APIerSv2.SetActions: ", err.Error()) } else if reply != utils.OK { - t.Errorf("Calling ApierV2.SetActions received: %s", reply) + t.Errorf("Calling APIerSv2.SetActions received: %s", reply) } time.Sleep(10 * time.Millisecond) @@ -263,7 +263,7 @@ func testV1AccSendToThreshold(t *testing.T) { }, } - if err := accRpc.Call(utils.ApierV1SetThresholdProfile, tPrfl, &reply); err != nil { + if err := accRpc.Call(utils.APIerSv1SetThresholdProfile, tPrfl, &reply); err != nil { t.Error(err) } else if reply != utils.OK { t.Error("Unexpected reply returned", reply) @@ -278,10 +278,10 @@ func testV1AccSendToThreshold(t *testing.T) { utils.ID: "testAccSetBalance", }, } - if err := accRpc.Call(utils.ApierV1SetBalance, attrs, &reply); err != nil { - t.Error("Got error on ApierV1.SetBalance: ", err.Error()) + if err := accRpc.Call(utils.APIerSv1SetBalance, attrs, &reply); err != nil { + t.Error("Got error on APIerSv1.SetBalance: ", err.Error()) } else if reply != utils.OK { - t.Errorf("Calling ApierV1.SetBalance received: %s", reply) + t.Errorf("Calling APIerSv1.SetBalance received: %s", reply) } // give time to threshold to made the change @@ -292,7 +292,7 @@ func testV1AccSendToThreshold(t *testing.T) { Tenant: "cgrates.org", Account: "testAccThreshold", } - if err := accRpc.Call(utils.ApierV2GetAccount, attrAcc, &acnt); err != nil { + if err := accRpc.Call(utils.APIerSv2GetAccount, attrAcc, &acnt); err != nil { t.Error(err) } else if acnt.Disabled != true { t.Errorf("Expecting: true, received: %v", acnt.Disabled) diff --git a/general_tests/broadcast_client_it_test.go b/general_tests/broadcast_client_it_test.go index 15cf9bc68..3e9110a33 100644 --- a/general_tests/broadcast_client_it_test.go +++ b/general_tests/broadcast_client_it_test.go @@ -123,10 +123,10 @@ func testbrodcastItRPCConn(t *testing.T) { func testbrodcastItLoadFromFolder(t *testing.T) { var reply string attrs := &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "tutorial")} - if err := brodcastRPC.Call(utils.ApierV1LoadTariffPlanFromFolder, attrs, &reply); err != nil { + if err := brodcastRPC.Call(utils.APIerSv1LoadTariffPlanFromFolder, attrs, &reply); err != nil { t.Error(err) } - if err := brodcastInternalRPC.Call(utils.ApierV1LoadTariffPlanFromFolder, attrs, &reply); err != nil { + if err := brodcastInternalRPC.Call(utils.APIerSv1LoadTariffPlanFromFolder, attrs, &reply); err != nil { t.Error(err) } time.Sleep(500 * time.Millisecond) diff --git a/general_tests/cdre_it_test.go b/general_tests/cdre_it_test.go index 254843836..19b3d3931 100644 --- a/general_tests/cdre_it_test.go +++ b/general_tests/cdre_it_test.go @@ -110,7 +110,7 @@ func testCDRERpcConn(t *testing.T) { func testCDREGetCdrs(t *testing.T) { var reply []*engine.ExternalCDR req := utils.RPCCDRsFilter{} - if err := cdreRPC.Call(utils.ApierV1GetCDRs, req, &reply); err.Error() != utils.ErrNotFound.Error() { + if err := cdreRPC.Call(utils.APIerSv1GetCDRs, req, &reply); err.Error() != utils.ErrNotFound.Error() { t.Error("Unexpected error: ", err.Error()) } } @@ -125,7 +125,7 @@ func testCDREExportNotFound(t *testing.T) { }, RPCCDRsFilter: utils.RPCCDRsFilter{}, } - if err := cdreRPC.Call(utils.ApierV1ExportCDRs, exportArgs, + if err := cdreRPC.Call(utils.APIerSv1ExportCDRs, exportArgs, &replyExport); err.Error() != utils.ErrNotFound.Error() { t.Error(err) } @@ -172,7 +172,7 @@ func testCDREExport(t *testing.T) { }, RPCCDRsFilter: utils.RPCCDRsFilter{}, } - if err := cdreRPC.Call(utils.ApierV1ExportCDRs, exportArgs, &replyExport); err != nil { + if err := cdreRPC.Call(utils.APIerSv1ExportCDRs, exportArgs, &replyExport); err != nil { t.Error(err) } else if replyExport.TotalRecords != 1 { t.Errorf("Unexpected total records: %+v", replyExport.TotalRecords) diff --git a/general_tests/cdrs_internal_it_test.go b/general_tests/cdrs_internal_it_test.go index 979fb9bec..64bb00872 100644 --- a/general_tests/cdrs_internal_it_test.go +++ b/general_tests/cdrs_internal_it_test.go @@ -118,13 +118,13 @@ func testCdrsIntTestTTL(t *testing.T) { t.Error("Unexpected reply received: ", reply) } var cdrs []*engine.ExternalCDR - if err := cdrsIntRPC.Call(utils.ApierV2GetCDRs, &utils.RPCCDRsFilter{}, &cdrs); err != nil { + if err := cdrsIntRPC.Call(utils.APIerSv2GetCDRs, &utils.RPCCDRsFilter{}, &cdrs); err != nil { t.Fatal("Unexpected error: ", err.Error()) } else if len(cdrs) != 1 { t.Errorf("Expected 1 result received %v ", len(cdrs)) } time.Sleep(3 * time.Second) - if err := cdrsIntRPC.Call(utils.ApierV2GetCDRs, &utils.RPCCDRsFilter{}, &cdrs); err == nil || + if err := cdrsIntRPC.Call(utils.APIerSv2GetCDRs, &utils.RPCCDRsFilter{}, &cdrs); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Fatal("Unexpected error: ", err.Error()) } diff --git a/general_tests/cdrs_it_test.go b/general_tests/cdrs_it_test.go index e4472543a..2bfa5525e 100644 --- a/general_tests/cdrs_it_test.go +++ b/general_tests/cdrs_it_test.go @@ -138,21 +138,21 @@ func testV2CDRsRpcConn(t *testing.T) { func testV2CDRsLoadTariffPlanFromFolder(t *testing.T) { var loadInst utils.LoadInstance - if err := cdrsRpc.Call(utils.ApierV2LoadTariffPlanFromFolder, + if err := cdrsRpc.Call(utils.APIerSv2LoadTariffPlanFromFolder, &utils.AttrLoadTpFromFolder{FolderPath: path.Join( *dataDir, "tariffplans", "testit")}, &loadInst); err != nil { t.Error(err) } time.Sleep(time.Duration(*waitRater) * time.Millisecond) // Give time for scheduler to execute topups var resp string - if err := cdrsRpc.Call(utils.ApierV1RemoveChargerProfile, + if err := cdrsRpc.Call(utils.APIerSv1RemoveChargerProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "SupplierCharges"}, &resp); err != nil { t.Error(err) } else if resp != utils.OK { t.Error("Unexpected reply returned", resp) } var reply *engine.ChargerProfile - if err := cdrsRpc.Call(utils.ApierV1GetChargerProfile, + if err := cdrsRpc.Call(utils.APIerSv1GetChargerProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "SupplierCharges"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) @@ -193,14 +193,14 @@ func testV2CDRsProcessCDR(t *testing.T) { func testV2CDRsGetCdrs(t *testing.T) { var cdrCnt int64 req := utils.AttrGetCdrs{} - if err := cdrsRpc.Call(utils.ApierV2CountCDRs, req, &cdrCnt); err != nil { + if err := cdrsRpc.Call(utils.APIerSv2CountCDRs, req, &cdrCnt); err != nil { t.Error("Unexpected error: ", err.Error()) } else if cdrCnt != 2 { t.Error("Unexpected number of CDRs returned: ", cdrCnt) } var cdrs []*engine.ExternalCDR args := utils.RPCCDRsFilter{RunIDs: []string{utils.MetaRaw}} - if err := cdrsRpc.Call(utils.ApierV2GetCDRs, args, &cdrs); err != nil { + if err := cdrsRpc.Call(utils.APIerSv2GetCDRs, args, &cdrs); err != nil { t.Error("Unexpected error: ", err.Error()) } else if len(cdrs) != 1 { t.Error("Unexpected number of CDRs returned: ", len(cdrs)) @@ -214,7 +214,7 @@ func testV2CDRsGetCdrs(t *testing.T) { } } args = utils.RPCCDRsFilter{RunIDs: []string{"CustomerCharges"}} - if err := cdrsRpc.Call(utils.ApierV2GetCDRs, args, &cdrs); err != nil { + if err := cdrsRpc.Call(utils.APIerSv2GetCDRs, args, &cdrs); err != nil { t.Error("Unexpected error: ", err.Error()) } else if len(cdrs) != 1 { t.Error("Unexpected number of CDRs returned: ", len(cdrs)) @@ -264,14 +264,14 @@ func testV2CDRsProcessCDR2(t *testing.T) { func testV2CDRsGetCdrs2(t *testing.T) { var cdrCnt int64 req := utils.AttrGetCdrs{Accounts: []string{"testV2CDRsProcessCDR2"}} - if err := cdrsRpc.Call(utils.ApierV2CountCDRs, req, &cdrCnt); err != nil { + if err := cdrsRpc.Call(utils.APIerSv2CountCDRs, req, &cdrCnt); err != nil { t.Error("Unexpected error: ", err.Error()) } else if cdrCnt != 2 { t.Error("Unexpected number of CDRs returned: ", cdrCnt) } var cdrs []*engine.ExternalCDR args := utils.RPCCDRsFilter{RunIDs: []string{utils.MetaRaw}, OriginIDs: []string{"testV2CDRsProcessCDR2"}} - if err := cdrsRpc.Call(utils.ApierV2GetCDRs, args, &cdrs); err != nil { + if err := cdrsRpc.Call(utils.APIerSv2GetCDRs, args, &cdrs); err != nil { t.Error("Unexpected error: ", err.Error()) } else if len(cdrs) != 1 { t.Error("Unexpected number of CDRs returned: ", len(cdrs)) @@ -286,7 +286,7 @@ func testV2CDRsGetCdrs2(t *testing.T) { } } args = utils.RPCCDRsFilter{RunIDs: []string{"CustomerCharges"}, OriginIDs: []string{"testV2CDRsProcessCDR2"}} - if err := cdrsRpc.Call(utils.ApierV2GetCDRs, args, &cdrs); err != nil { + if err := cdrsRpc.Call(utils.APIerSv2GetCDRs, args, &cdrs); err != nil { t.Error("Unexpected error: ", err.Error()) } else if len(cdrs) != 1 { t.Error("Unexpected number of CDRs returned: ", len(cdrs)) @@ -337,14 +337,14 @@ func testV2CDRsProcessCDR3(t *testing.T) { func testV2CDRsGetCdrs3(t *testing.T) { var cdrCnt int64 req := utils.AttrGetCdrs{Accounts: []string{"testV2CDRsProcessCDR3"}} - if err := cdrsRpc.Call(utils.ApierV2CountCDRs, req, &cdrCnt); err != nil { + if err := cdrsRpc.Call(utils.APIerSv2CountCDRs, req, &cdrCnt); err != nil { t.Error("Unexpected error: ", err.Error()) } else if cdrCnt != 1 { t.Error("Unexpected number of CDRs returned: ", cdrCnt) } var cdrs []*engine.ExternalCDR args := utils.RPCCDRsFilter{RunIDs: []string{utils.MetaDefault}, OriginIDs: []string{"testV2CDRsProcessCDR3"}} - if err := cdrsRpc.Call(utils.ApierV2GetCDRs, args, &cdrs); err != nil { + if err := cdrsRpc.Call(utils.APIerSv2GetCDRs, args, &cdrs); err != nil { t.Error("Unexpected error: ", err.Error()) } else if len(cdrs) != 1 { t.Error("Unexpected number of CDRs returned: ", len(cdrs)) @@ -359,7 +359,7 @@ func testV2CDRsGetCdrs3(t *testing.T) { } } args = utils.RPCCDRsFilter{RunIDs: []string{"CustomerCharges"}, OriginIDs: []string{"testV2CDRsProcessCDR3"}} - if err := cdrsRpc.Call(utils.ApierV2GetCDRs, args, &cdrs); err == nil || err.Error() != utils.ErrNotFound.Error() { + if err := cdrsRpc.Call(utils.APIerSv2GetCDRs, args, &cdrs); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error("Unexpected error: ", err.Error()) } } @@ -399,7 +399,7 @@ func testV2CDRsProcessCDR4(t *testing.T) { func testV2CDRsGetCdrs4(t *testing.T) { var cdrCnt int64 req := utils.AttrGetCdrs{Accounts: []string{"testV2CDRsProcessCDR4"}} - if err := cdrsRpc.Call(utils.ApierV2CountCDRs, req, &cdrCnt); err != nil { + if err := cdrsRpc.Call(utils.APIerSv2CountCDRs, req, &cdrCnt); err != nil { t.Error("Unexpected error: ", err.Error()) } else if cdrCnt != 2 { t.Error("Unexpected number of CDRs returned: ", cdrCnt) @@ -409,7 +409,7 @@ func testV2CDRsGetCdrs4(t *testing.T) { RunIDs: []string{utils.MetaRaw}, OriginIDs: []string{"testV2CDRsProcessCDR4"}, } - if err := cdrsRpc.Call(utils.ApierV2GetCDRs, args, &cdrs); err != nil { + if err := cdrsRpc.Call(utils.APIerSv2GetCDRs, args, &cdrs); err != nil { t.Fatal("Unexpected error: ", err.Error()) } if len(cdrs) != 1 { @@ -426,7 +426,7 @@ func testV2CDRsGetCdrs4(t *testing.T) { RunIDs: []string{"CustomerCharges"}, OriginIDs: []string{"testV2CDRsProcessCDR4"}, } - if err := cdrsRpc.Call(utils.ApierV2GetCDRs, args, &cdrs); err != nil { + if err := cdrsRpc.Call(utils.APIerSv2GetCDRs, args, &cdrs); err != nil { t.Fatal("Unexpected error: ", err.Error()) } if len(cdrs) != 1 { @@ -444,7 +444,7 @@ func testV2CDRsGetCdrs4(t *testing.T) { func testV2CDRsGetCdrs5(t *testing.T) { var cdrCnt int64 req := utils.RPCCDRsFilter{Accounts: []string{"testV2CDRsProcessCDR5"}} - if err := cdrsRpc.Call(utils.ApierV2CountCDRs, req, &cdrCnt); err != nil { + if err := cdrsRpc.Call(utils.APIerSv2CountCDRs, req, &cdrCnt); err != nil { t.Error("Unexpected error: ", err.Error()) } else if cdrCnt != 0 { t.Error("Unexpected number of CDRs returned: ", cdrCnt) @@ -454,21 +454,21 @@ func testV2CDRsGetCdrs5(t *testing.T) { RunIDs: []string{utils.MetaRaw}, OriginIDs: []string{"testV2CDRsProcessCDR5"}, } - if err := cdrsRpc.Call(utils.ApierV2GetCDRs, args, &cdrs); err == nil || err.Error() != utils.ErrNotFound.Error() { + if err := cdrsRpc.Call(utils.APIerSv2GetCDRs, args, &cdrs); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Fatal("Unexpected error: ", err.Error()) } args = utils.RPCCDRsFilter{ RunIDs: []string{"CustomerCharges"}, OriginIDs: []string{"testV2CDRsProcessCDR5"}, } - if err := cdrsRpc.Call(utils.ApierV2GetCDRs, args, &cdrs); err == nil || err.Error() != utils.ErrNotFound.Error() { + if err := cdrsRpc.Call(utils.APIerSv2GetCDRs, args, &cdrs); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Fatal("Unexpected error: ", err.Error()) } } func testV2CDRsSetStats(t *testing.T) { var reply *engine.StatQueueProfile - if err := cdrsRpc.Call(utils.ApierV1GetStatQueueProfile, + if err := cdrsRpc.Call(utils.APIerSv1GetStatQueueProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "STS_PoccessCDR"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) @@ -492,12 +492,12 @@ func testV2CDRsSetStats(t *testing.T) { }, } var result string - if err := cdrsRpc.Call(utils.ApierV1SetStatQueueProfile, statConfig, &result); err != nil { + if err := cdrsRpc.Call(utils.APIerSv1SetStatQueueProfile, statConfig, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } - if err := cdrsRpc.Call(utils.ApierV1GetStatQueueProfile, + if err := cdrsRpc.Call(utils.APIerSv1GetStatQueueProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "STS_PoccessCDR"}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(statConfig.StatQueueProfile, reply) { @@ -510,24 +510,24 @@ func testV2CDRsSetThresholdProfile(t *testing.T) { // Set Action attrsAA := &utils.AttrSetActions{ActionsId: "ACT_THD_PoccessCDR", Actions: []*utils.TPAction{{Identifier: utils.LOG}}} - if err := cdrsRpc.Call(utils.ApierV2SetActions, attrsAA, &actreply); err != nil && err.Error() != utils.ErrExists.Error() { - t.Error("Got error on ApierV2.SetActions: ", err.Error()) + if err := cdrsRpc.Call(utils.APIerSv2SetActions, attrsAA, &actreply); err != nil && err.Error() != utils.ErrExists.Error() { + t.Error("Got error on APIerSv2.SetActions: ", err.Error()) } else if actreply != utils.OK { - t.Errorf("Calling ApierV2.SetActions received: %s", actreply) + t.Errorf("Calling APIerSv2.SetActions received: %s", actreply) } // Set Account attrsSetAccount := &utils.AttrSetAccount{Tenant: "cgrates.org", Account: "testV2CDRsProcessCDR5"} - if err := cdrsRpc.Call(utils.ApierV1SetAccount, attrsSetAccount, &actreply); err != nil { - t.Error("Got error on ApierV1.SetAccount: ", err.Error()) + if err := cdrsRpc.Call(utils.APIerSv1SetAccount, attrsSetAccount, &actreply); err != nil { + t.Error("Got error on APIerSv1.SetAccount: ", err.Error()) } else if actreply != utils.OK { - t.Errorf("Calling ApierV1.SetAccount received: %s", actreply) + t.Errorf("Calling APIerSv1.SetAccount received: %s", actreply) } // Set Threshold var reply *engine.ThresholdProfile var result string - if err := cdrsRpc.Call(utils.ApierV1GetThresholdProfile, + if err := cdrsRpc.Call(utils.APIerSv1GetThresholdProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "THD_PoccessCDR"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) @@ -544,12 +544,12 @@ func testV2CDRsSetThresholdProfile(t *testing.T) { Async: false, }, } - if err := cdrsRpc.Call(utils.ApierV1SetThresholdProfile, tPrfl, &result); err != nil { + if err := cdrsRpc.Call(utils.APIerSv1SetThresholdProfile, tPrfl, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } - if err := cdrsRpc.Call(utils.ApierV1GetThresholdProfile, + if err := cdrsRpc.Call(utils.APIerSv1GetThresholdProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "THD_PoccessCDR"}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(tPrfl.ThresholdProfile, reply) { @@ -607,7 +607,7 @@ func testV2CDRsGetStats1(t *testing.T) { func testV2CDRsGetThreshold1(t *testing.T) { expected := []string{"THD_ACNT_1001", "THD_PoccessCDR"} var result []string - if err := cdrsRpc.Call(utils.ApierV1GetThresholdProfileIDs, + if err := cdrsRpc.Call(utils.APIerSv1GetThresholdProfileIDs, utils.TenantArgWithPaginator{TenantArg: utils.TenantArg{"cgrates.org"}}, &result); err != nil { t.Error(err) } else if len(expected) != len(result) { @@ -717,7 +717,7 @@ func testV2CDRsProcessCDR7(t *testing.T) { func testV2CDRsGetCdrs7(t *testing.T) { var cdrCnt int64 req := utils.AttrGetCdrs{Accounts: []string{"testV2CDRsProcessCDR7"}} - if err := cdrsRpc.Call(utils.ApierV2CountCDRs, req, &cdrCnt); err != nil { + if err := cdrsRpc.Call(utils.APIerSv2CountCDRs, req, &cdrCnt); err != nil { t.Error("Unexpected error: ", err.Error()) } else if cdrCnt != 2 { t.Error("Unexpected number of CDRs returned: ", cdrCnt) @@ -727,7 +727,7 @@ func testV2CDRsGetCdrs7(t *testing.T) { RunIDs: []string{utils.MetaRaw}, OriginIDs: []string{"testV2CDRsProcessCDR7"}, } - if err := cdrsRpc.Call(utils.ApierV2GetCDRs, args, &cdrs); err != nil { + if err := cdrsRpc.Call(utils.APIerSv2GetCDRs, args, &cdrs); err != nil { t.Fatal("Unexpected error: ", err.Error()) } if len(cdrs) != 1 { @@ -744,7 +744,7 @@ func testV2CDRsGetCdrs7(t *testing.T) { RunIDs: []string{"CustomerCharges"}, OriginIDs: []string{"testV2CDRsProcessCDR7"}, } - if err := cdrsRpc.Call(utils.ApierV2GetCDRs, args, &cdrs); err != nil { + if err := cdrsRpc.Call(utils.APIerSv2GetCDRs, args, &cdrs); err != nil { t.Fatal("Unexpected error: ", err.Error()) } if len(cdrs) != 1 { diff --git a/general_tests/cdrs_onlexp_it_test.go b/general_tests/cdrs_onlexp_it_test.go index a57754f2a..e6cd4f813 100644 --- a/general_tests/cdrs_onlexp_it_test.go +++ b/general_tests/cdrs_onlexp_it_test.go @@ -182,7 +182,7 @@ func testCDRsOnExpLoadDefaultCharger(t *testing.T) { Weight: 20, } var result string - if err := cdrsMasterRpc.Call(utils.ApierV1SetChargerProfile, chargerProfile, &result); err != nil { + if err := cdrsMasterRpc.Call(utils.APIerSv1SetChargerProfile, chargerProfile, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -274,7 +274,7 @@ func testCDRsOnExpHttpCdrReplication(t *testing.T) { // ToDo: Fix cdr_http to be compatible with rest of processCdr methods time.Sleep(200 * time.Millisecond) var rcvedCdrs []*engine.ExternalCDR - if err := cdrsSlaveRpc.Call(utils.ApierV2GetCDRs, + if err := cdrsSlaveRpc.Call(utils.APIerSv2GetCDRs, utils.RPCCDRsFilter{CGRIDs: []string{testCdr1.CGRID}, RunIDs: []string{utils.MetaDefault}}, &rcvedCdrs); err != nil { t.Error("Unexpected error: ", err.Error()) } else if len(rcvedCdrs) != 1 { diff --git a/general_tests/cdrs_post_failover_it_test.go b/general_tests/cdrs_post_failover_it_test.go index 3568beeb8..39928bee7 100644 --- a/general_tests/cdrs_post_failover_it_test.go +++ b/general_tests/cdrs_post_failover_it_test.go @@ -109,21 +109,21 @@ func testCDRsPostFailoverRpcConn(t *testing.T) { func testCDRsPostFailoverLoadTariffPlanFromFolder(t *testing.T) { var loadInst utils.LoadInstance - if err := cdrsPostFailRpc.Call(utils.ApierV2LoadTariffPlanFromFolder, + if err := cdrsPostFailRpc.Call(utils.APIerSv2LoadTariffPlanFromFolder, &utils.AttrLoadTpFromFolder{FolderPath: path.Join( *dataDir, "tariffplans", "testit")}, &loadInst); err != nil { t.Error(err) } time.Sleep(time.Duration(*waitRater) * time.Millisecond) // Give time for scheduler to execute topups var resp string - if err := cdrsPostFailRpc.Call(utils.ApierV1RemoveChargerProfile, + if err := cdrsPostFailRpc.Call(utils.APIerSv1RemoveChargerProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "SupplierCharges"}, &resp); err != nil { t.Error(err) } else if resp != utils.OK { t.Error("Unexpected reply returned", resp) } var reply *engine.ChargerProfile - if err := cdrsPostFailRpc.Call(utils.ApierV1GetChargerProfile, + if err := cdrsPostFailRpc.Call(utils.APIerSv1GetChargerProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "SupplierCharges"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) diff --git a/general_tests/cdrs_processevent_it_test.go b/general_tests/cdrs_processevent_it_test.go index 5ac24409f..0c4ed05fd 100644 --- a/general_tests/cdrs_processevent_it_test.go +++ b/general_tests/cdrs_processevent_it_test.go @@ -116,7 +116,7 @@ func testV1CDRsRpcConn(t *testing.T) { func testV1CDRsLoadTariffPlanFromFolder(t *testing.T) { var loadInst string - if err := pecdrsRpc.Call(utils.ApierV1LoadTariffPlanFromFolder, + if err := pecdrsRpc.Call(utils.APIerSv1LoadTariffPlanFromFolder, &utils.AttrLoadTpFromFolder{FolderPath: path.Join( *dataDir, "tariffplans", "testit")}, &loadInst); err != nil { t.Error(err) @@ -140,13 +140,13 @@ func testV1CDRsProcessEventAttrS(t *testing.T) { }, } var reply string - if err := pecdrsRpc.Call(utils.ApierV1SetBalance, attrSetBalance, &reply); err != nil { + if err := pecdrsRpc.Call(utils.APIerSv1SetBalance, attrSetBalance, &reply); err != nil { t.Error(err) } else if reply != utils.OK { t.Errorf("received: %s", reply) } expectedVoice := 120000000000.0 - if err := pecdrsRpc.Call(utils.ApierV2GetAccount, acntAttrs, &acnt); err != nil { + if err := pecdrsRpc.Call(utils.APIerSv2GetAccount, acntAttrs, &acnt); err != nil { t.Error(err) } else if rply := acnt.BalanceMap[utils.VOICE].GetTotalValue(); rply != expectedVoice { t.Errorf("Expecting: %v, received: %v", expectedVoice, rply) @@ -186,13 +186,13 @@ func testV1CDRsProcessEventAttrS(t *testing.T) { } alsPrf.Compile() var result string - if err := pecdrsRpc.Call(utils.ApierV1SetAttributeProfile, alsPrf, &result); err != nil { + if err := pecdrsRpc.Call(utils.APIerSv1SetAttributeProfile, alsPrf, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } var replyAt *engine.AttributeProfile - if err := pecdrsRpc.Call(utils.ApierV1GetAttributeProfile, &utils.TenantIDWithArgDispatcher{ + if err := pecdrsRpc.Call(utils.APIerSv1GetAttributeProfile, &utils.TenantIDWithArgDispatcher{ TenantID: &utils.TenantID{Tenant: "cgrates.org", ID: "ApierTest"}}, &replyAt); err != nil { t.Fatal(err) } @@ -434,7 +434,7 @@ func testV1CDRsProcessEventStore(t *testing.T) { func testV1CDRsProcessEventThreshold(t *testing.T) { var reply string - if err := pecdrsRpc.Call(utils.ApierV2SetActions, &utils.AttrSetActions{ + if err := pecdrsRpc.Call(utils.APIerSv2SetActions, &utils.AttrSetActions{ ActionsId: "ACT_LOG", Actions: []*utils.TPAction{ &utils.TPAction{ @@ -447,7 +447,7 @@ func testV1CDRsProcessEventThreshold(t *testing.T) { }, &reply); err != nil && err.Error() != utils.ErrExists.Error() { t.Error(err) } else if reply != utils.OK { - t.Errorf("Calling ApierV2.SetActions received: %s", reply) + t.Errorf("Calling APIerSv2.SetActions received: %s", reply) } tPrfl := engine.ThresholdWithCache{ ThresholdProfile: &engine.ThresholdProfile{ @@ -463,7 +463,7 @@ func testV1CDRsProcessEventThreshold(t *testing.T) { Async: true, }, } - if err := pecdrsRpc.Call(utils.ApierV1SetThresholdProfile, tPrfl, &reply); err != nil { + if err := pecdrsRpc.Call(utils.APIerSv1SetThresholdProfile, tPrfl, &reply); err != nil { t.Error(err) } else if reply != utils.OK { t.Error("Unexpected reply returned", reply) @@ -475,7 +475,7 @@ func testV1CDRsProcessEventThreshold(t *testing.T) { utils.AllowNegative: true, }, } - if err := pecdrsRpc.Call(utils.ApierV2SetAccount, attrSetAcnt, &reply); err != nil { + if err := pecdrsRpc.Call(utils.APIerSv2SetAccount, attrSetAcnt, &reply); err != nil { t.Fatal(err) } attrs := &utils.AttrSetBalance{ @@ -488,7 +488,7 @@ func testV1CDRsProcessEventThreshold(t *testing.T) { utils.Weight: 10.0, }, } - if err := pecdrsRpc.Call(utils.ApierV2SetBalance, attrs, &reply); err != nil { + if err := pecdrsRpc.Call(utils.APIerSv2SetBalance, attrs, &reply); err != nil { t.Fatal(err) } args := &engine.ArgV1ProcessEvent{ @@ -537,7 +537,7 @@ func testV1CDRsProcessEventThreshold(t *testing.T) { Account: "1005"} time.Sleep(50 * time.Millisecond) expectedVoice := 10.0 - if err := pecdrsRpc.Call(utils.ApierV2GetAccount, acntAttrs, &acnt); err != nil { + if err := pecdrsRpc.Call(utils.APIerSv2GetAccount, acntAttrs, &acnt); err != nil { t.Error(err) } else if rply := acnt.BalanceMap[utils.VOICE].GetTotalValue(); rply != expectedVoice { t.Errorf("Expecting: %v, received: %v", expectedVoice, rply) diff --git a/general_tests/data_it_test.go b/general_tests/data_it_test.go index 3c917f725..23743c297 100644 --- a/general_tests/data_it_test.go +++ b/general_tests/data_it_test.go @@ -115,7 +115,7 @@ func testV1DataRpcConn(t *testing.T) { func testV1DataGetAccountBeforeSet(t *testing.T) { var reply *engine.Account - if err := dataRpc.Call(utils.ApierV2GetAccount, + if err := dataRpc.Call(utils.APIerSv2GetAccount, &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "1001"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) @@ -125,7 +125,7 @@ func testV1DataGetAccountBeforeSet(t *testing.T) { func testV1DataLoadTarrifPlans(t *testing.T) { var reply string attrs := &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "testData")} - if err := dataRpc.Call(utils.ApierV1LoadTariffPlanFromFolder, attrs, &reply); err != nil { + if err := dataRpc.Call(utils.APIerSv1LoadTariffPlanFromFolder, attrs, &reply); err != nil { t.Error(err) } else if reply != utils.OK { t.Error("Unexpected reply returned", reply) @@ -146,7 +146,7 @@ func testV1DataDataDebitUsageWith10Kilo(t *testing.T) { }, } var reply string - if err := dataRpc.Call(utils.ApierV2SetBalance, attrSetBalance, &reply); err != nil { + if err := dataRpc.Call(utils.APIerSv2SetBalance, attrSetBalance, &reply); err != nil { t.Error(err) } else if reply != utils.OK { t.Errorf("Received: %s", reply) @@ -154,7 +154,7 @@ func testV1DataDataDebitUsageWith10Kilo(t *testing.T) { expected := 356000000.0 var acc *engine.Account - if err := dataRpc.Call(utils.ApierV2GetAccount, + if err := dataRpc.Call(utils.APIerSv2GetAccount, &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "testV1DataDataCost"}, &acc); err != nil { t.Error(err) @@ -176,7 +176,7 @@ func testV1DataDataDebitUsageWith10Kilo(t *testing.T) { AnswerTime: time.Date(2013, 11, 7, 7, 42, 20, 0, time.UTC).String(), } tStart := time.Now() - if err := dataRpc.Call(utils.ApierV1DebitUsage, + if err := dataRpc.Call(utils.APIerSv1DebitUsage, engine.UsageRecordWithArgDispatcher{UsageRecord: usageRecord}, &reply); err != nil { t.Error(err) } @@ -185,7 +185,7 @@ func testV1DataDataDebitUsageWith10Kilo(t *testing.T) { } expected = 100000000.0 - if err := dataRpc.Call(utils.ApierV2GetAccount, + if err := dataRpc.Call(utils.APIerSv2GetAccount, &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "testV1DataDataCost"}, &acc); err != nil { t.Error(err) @@ -202,7 +202,7 @@ func testV1DataGetCostWith10Kilo(t *testing.T) { Subject: "10kilo", AnswerTime: "*now", Usage: 256000000} var rply *engine.DataCost tStart := time.Now() - if err := dataRpc.Call(utils.ApierV1GetDataCost, attrs, &rply); err != nil { + if err := dataRpc.Call(utils.APIerSv1GetDataCost, attrs, &rply); err != nil { t.Error("Unexpected nil error received: ", err.Error()) } else if rply.Cost != 25600.000000 { t.Errorf("Unexpected cost received: %f", rply.Cost) @@ -225,7 +225,7 @@ func testV1DataDebitBalanceWith10Kilo(t *testing.T) { }, } var reply string - if err := dataRpc.Call(utils.ApierV2SetBalance, attrSetBalance, &reply); err != nil { + if err := dataRpc.Call(utils.APIerSv2SetBalance, attrSetBalance, &reply); err != nil { t.Error(err) } else if reply != utils.OK { t.Errorf("Received: %s", reply) @@ -233,7 +233,7 @@ func testV1DataDebitBalanceWith10Kilo(t *testing.T) { expected := 356000000.0 var acc *engine.Account - if err := dataRpc.Call(utils.ApierV2GetAccount, + if err := dataRpc.Call(utils.APIerSv2GetAccount, &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "testV1DataDebitBalance"}, &acc); err != nil { t.Error(err) @@ -244,7 +244,7 @@ func testV1DataDebitBalanceWith10Kilo(t *testing.T) { expected, rply) } tStart := time.Now() - if err := dataRpc.Call(utils.ApierV1DebitBalance, &v1.AttrAddBalance{ + if err := dataRpc.Call(utils.APIerSv1DebitBalance, &v1.AttrAddBalance{ Tenant: "cgrates.org", Account: "testV1DataDebitBalance", BalanceType: utils.DATA, @@ -259,7 +259,7 @@ func testV1DataDebitBalanceWith10Kilo(t *testing.T) { } expected = 100000000.0 - if err := dataRpc.Call(utils.ApierV2GetAccount, + if err := dataRpc.Call(utils.APIerSv2GetAccount, &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "testV1DataDebitBalance"}, &acc); err != nil { t.Error(err) @@ -284,7 +284,7 @@ func testV1DataDataDebitUsage1G0(t *testing.T) { }, } var reply string - if err := dataRpc.Call(utils.ApierV2SetBalance, attrSetBalance, &reply); err != nil { + if err := dataRpc.Call(utils.APIerSv2SetBalance, attrSetBalance, &reply); err != nil { t.Error(err) } else if reply != utils.OK { t.Errorf("Received: %s", reply) @@ -292,7 +292,7 @@ func testV1DataDataDebitUsage1G0(t *testing.T) { expected := 1100000000.0 var acc *engine.Account - if err := dataRpc.Call(utils.ApierV2GetAccount, + if err := dataRpc.Call(utils.APIerSv2GetAccount, &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "testV1DataDataDebitUsage1G0"}, &acc); err != nil { t.Error(err) @@ -314,7 +314,7 @@ func testV1DataDataDebitUsage1G0(t *testing.T) { AnswerTime: time.Date(2013, 11, 7, 7, 42, 20, 0, time.UTC).String(), } tStart := time.Now() - if err := dataRpc.Call(utils.ApierV1DebitUsage, + if err := dataRpc.Call(utils.APIerSv1DebitUsage, engine.UsageRecordWithArgDispatcher{UsageRecord: usageRecord}, &reply); err != nil { t.Error(err) } @@ -323,7 +323,7 @@ func testV1DataDataDebitUsage1G0(t *testing.T) { } expected = 100000000.0 - if err := dataRpc.Call(utils.ApierV2GetAccount, + if err := dataRpc.Call(utils.APIerSv2GetAccount, &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "testV1DataDataDebitUsage1G0"}, &acc); err != nil { t.Error(err) @@ -340,7 +340,7 @@ func testV1DataGetCost1G0(t *testing.T) { Subject: "10kilo", AnswerTime: "*now", Usage: 1000000000} var rply *engine.DataCost tStart := time.Now() - if err := dataRpc.Call(utils.ApierV1GetDataCost, attrs, &rply); err != nil { + if err := dataRpc.Call(utils.APIerSv1GetDataCost, attrs, &rply); err != nil { t.Error("Unexpected nil error received: ", err.Error()) } else if rply.Cost != 100000.000000 { t.Errorf("Unexpected cost received: %f", rply.Cost) @@ -363,7 +363,7 @@ func testV1DataDebitBalance1G0(t *testing.T) { }, } var reply string - if err := dataRpc.Call(utils.ApierV2SetBalance, attrSetBalance, &reply); err != nil { + if err := dataRpc.Call(utils.APIerSv2SetBalance, attrSetBalance, &reply); err != nil { t.Error(err) } else if reply != utils.OK { t.Errorf("Received: %s", reply) @@ -371,7 +371,7 @@ func testV1DataDebitBalance1G0(t *testing.T) { expected := 1100000000.0 var acc *engine.Account - if err := dataRpc.Call(utils.ApierV2GetAccount, + if err := dataRpc.Call(utils.APIerSv2GetAccount, &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "testV1DataDebitBalance1G0"}, &acc); err != nil { t.Error(err) @@ -382,7 +382,7 @@ func testV1DataDebitBalance1G0(t *testing.T) { expected, rply) } tStart := time.Now() - if err := dataRpc.Call(utils.ApierV1DebitBalance, &v1.AttrAddBalance{ + if err := dataRpc.Call(utils.APIerSv1DebitBalance, &v1.AttrAddBalance{ Tenant: "cgrates.org", Account: "testV1DataDebitBalance1G0", BalanceType: utils.DATA, @@ -397,7 +397,7 @@ func testV1DataDebitBalance1G0(t *testing.T) { } expected = 100000000.0 - if err := dataRpc.Call(utils.ApierV2GetAccount, + if err := dataRpc.Call(utils.APIerSv2GetAccount, &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "testV1DataDebitBalance1G0"}, &acc); err != nil { t.Error(err) @@ -422,7 +422,7 @@ func testV1DataInitSession(t *testing.T) { }, } var reply string - if err := dataRpc.Call(utils.ApierV2SetBalance, attrSetBalance, &reply); err != nil { + if err := dataRpc.Call(utils.APIerSv2SetBalance, attrSetBalance, &reply); err != nil { t.Error(err) } else if reply != utils.OK { t.Errorf("Received: %s", reply) @@ -430,7 +430,7 @@ func testV1DataInitSession(t *testing.T) { expected := 1100000000.0 var acc *engine.Account - if err := dataRpc.Call(utils.ApierV2GetAccount, + if err := dataRpc.Call(utils.APIerSv2GetAccount, &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "testV1DataInitSession"}, &acc); err != nil { t.Error(err) diff --git a/general_tests/dest_management_it_test.go b/general_tests/dest_management_it_test.go index bdff73488..74d99acd1 100644 --- a/general_tests/dest_management_it_test.go +++ b/general_tests/dest_management_it_test.go @@ -111,7 +111,7 @@ func testDestManagRpcConn(t *testing.T) { func testDestManagLoadTariffPlanFromFolderAll(t *testing.T) { attrs := &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "test", "destinations", "alldests")} var destLoadInst utils.LoadInstance - if err := destRPC.Call(utils.ApierV2LoadTariffPlanFromFolder, attrs, &destLoadInst); err != nil { + if err := destRPC.Call(utils.APIerSv2LoadTariffPlanFromFolder, attrs, &destLoadInst); err != nil { t.Error(err) } time.Sleep(time.Duration(*waitRater) * time.Millisecond) // Give time for scheduler to execute topups @@ -120,17 +120,17 @@ func testDestManagLoadTariffPlanFromFolderAll(t *testing.T) { func testDestManagAllDestinationLoaded(t *testing.T) { dests := make([]*engine.Destination, 0) - if err := destRPC.Call(utils.ApierV2GetDestinations, v2.AttrGetDestinations{DestinationIDs: []string{}}, &dests); err != nil { - t.Error("Got error on ApierV2.GetDestinations: ", err.Error()) + if err := destRPC.Call(utils.APIerSv2GetDestinations, v2.AttrGetDestinations{DestinationIDs: []string{}}, &dests); err != nil { + t.Error("Got error on APIerSv2.GetDestinations: ", err.Error()) } else if len(dests) != 6 { - t.Errorf("Calling ApierV2.GetDestinations got reply: %v", utils.ToIJSON(dests)) + t.Errorf("Calling APIerSv2.GetDestinations got reply: %v", utils.ToIJSON(dests)) } var rcvStats utils.CacheStats - if err := destRPC.Call(utils.ApierV1GetCacheStats, utils.AttrCacheStats{}, &rcvStats); err != nil { - t.Error("Got error on ApierV1.GetCacheStats: ", err.Error()) + if err := destRPC.Call(utils.APIerSv1GetCacheStats, utils.AttrCacheStats{}, &rcvStats); err != nil { + t.Error("Got error on APIerSv1.GetCacheStats: ", err.Error()) } else if rcvStats.Destinations != 9 { - t.Errorf("Calling ApierV1.GetCacheStats received: %+v", rcvStats) + t.Errorf("Calling APIerSv1.GetCacheStats received: %+v", rcvStats) } } @@ -138,7 +138,7 @@ func testDestManagAllDestinationLoaded(t *testing.T) { func testDestManagLoadTariffPlanFromFolderRemoveSome(t *testing.T) { attrs := &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "test", "destinations", "removesome")} var destLoadInst utils.LoadInstance - if err := destRPC.Call(utils.ApierV2LoadTariffPlanFromFolder, attrs, &destLoadInst); err != nil { + if err := destRPC.Call(utils.APIerSv2LoadTariffPlanFromFolder, attrs, &destLoadInst); err != nil { t.Error(err) } time.Sleep(time.Duration(*waitRater) * time.Millisecond) // Give time for scheduler to execute topups @@ -146,24 +146,24 @@ func testDestManagLoadTariffPlanFromFolderRemoveSome(t *testing.T) { func testDestManagRemoveSomeDestinationLoaded(t *testing.T) { dests := make([]*engine.Destination, 0) - if err := destRPC.Call(utils.ApierV2GetDestinations, v2.AttrGetDestinations{DestinationIDs: []string{}}, &dests); err != nil { - t.Error("Got error on ApierV2.GetDestinations: ", err.Error()) + if err := destRPC.Call(utils.APIerSv2GetDestinations, v2.AttrGetDestinations{DestinationIDs: []string{}}, &dests); err != nil { + t.Error("Got error on APIerSv2.GetDestinations: ", err.Error()) } else if len(dests) != 6 { - t.Errorf("Calling ApierV2.GetDestinations got reply: %v", utils.ToIJSON(dests)) + t.Errorf("Calling APIerSv2.GetDestinations got reply: %v", utils.ToIJSON(dests)) } var rcvStats utils.CacheStats - if err := destRPC.Call(utils.ApierV1GetCacheStats, utils.AttrCacheStats{}, &rcvStats); err != nil { - t.Error("Got error on ApierV1.GetCacheStats: ", err.Error()) + if err := destRPC.Call(utils.APIerSv1GetCacheStats, utils.AttrCacheStats{}, &rcvStats); err != nil { + t.Error("Got error on APIerSv1.GetCacheStats: ", err.Error()) } else if rcvStats.Destinations != 9 { - t.Errorf("Calling ApierV1.GetCacheStats received: %+v", rcvStats) + t.Errorf("Calling APIerSv1.GetCacheStats received: %+v", rcvStats) } } func testDestManagLoadTariffPlanFromFolderRemoveSomeFlush(t *testing.T) { attrs := &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "test", "destinations", "removesome"), FlushDb: true} var destLoadInst utils.LoadInstance - if err := destRPC.Call(utils.ApierV2LoadTariffPlanFromFolder, attrs, &destLoadInst); err != nil { + if err := destRPC.Call(utils.APIerSv2LoadTariffPlanFromFolder, attrs, &destLoadInst); err != nil { t.Error(err) } time.Sleep(time.Duration(*waitRater) * time.Millisecond) // Give time for scheduler to execute topups @@ -171,24 +171,24 @@ func testDestManagLoadTariffPlanFromFolderRemoveSomeFlush(t *testing.T) { func testDestManagRemoveSomeFlushDestinationLoaded(t *testing.T) { dests := make([]*engine.Destination, 0) - if err := destRPC.Call(utils.ApierV2GetDestinations, v2.AttrGetDestinations{DestinationIDs: []string{}}, &dests); err != nil { - t.Error("Got error on ApierV2.GetDestinations: ", err.Error()) + if err := destRPC.Call(utils.APIerSv2GetDestinations, v2.AttrGetDestinations{DestinationIDs: []string{}}, &dests); err != nil { + t.Error("Got error on APIerSv2.GetDestinations: ", err.Error()) } else if len(dests) != 4 { - t.Errorf("Calling ApierV2.GetDestinations got reply: %v", utils.ToIJSON(dests)) + t.Errorf("Calling APIerSv2.GetDestinations got reply: %v", utils.ToIJSON(dests)) } var rcvStats utils.CacheStats - if err := destRPC.Call(utils.ApierV1GetCacheStats, utils.AttrCacheStats{}, &rcvStats); err != nil { - t.Error("Got error on ApierV1.GetCacheStats: ", err.Error()) + if err := destRPC.Call(utils.APIerSv1GetCacheStats, utils.AttrCacheStats{}, &rcvStats); err != nil { + t.Error("Got error on APIerSv1.GetCacheStats: ", err.Error()) } else if rcvStats.Destinations != 5 { - t.Errorf("Calling ApierV1.GetCacheStats received: %+v", rcvStats) + t.Errorf("Calling APIerSv1.GetCacheStats received: %+v", rcvStats) } } func testDestManagLoadTariffPlanFromFolderAddBack(t *testing.T) { attrs := &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "test", "destinations", "addback")} var destLoadInst utils.LoadInstance - if err := destRPC.Call(utils.ApierV2LoadTariffPlanFromFolder, attrs, &destLoadInst); err != nil { + if err := destRPC.Call(utils.APIerSv2LoadTariffPlanFromFolder, attrs, &destLoadInst); err != nil { t.Error(err) } time.Sleep(time.Duration(*waitRater) * time.Millisecond) // Give time for scheduler to execute topups @@ -196,24 +196,24 @@ func testDestManagLoadTariffPlanFromFolderAddBack(t *testing.T) { func testDestManagAddBackDestinationLoaded(t *testing.T) { dests := make([]*engine.Destination, 0) - if err := destRPC.Call(utils.ApierV2GetDestinations, v2.AttrGetDestinations{DestinationIDs: []string{}}, &dests); err != nil { - t.Error("Got error on ApierV2.GetDestinations: ", err.Error()) + if err := destRPC.Call(utils.APIerSv2GetDestinations, v2.AttrGetDestinations{DestinationIDs: []string{}}, &dests); err != nil { + t.Error("Got error on APIerSv2.GetDestinations: ", err.Error()) } else if len(dests) != 6 { - t.Errorf("Calling ApierV2.GetDestinations got reply: %v", utils.ToIJSON(dests)) + t.Errorf("Calling APIerSv2.GetDestinations got reply: %v", utils.ToIJSON(dests)) } var rcvStats utils.CacheStats - if err := destRPC.Call(utils.ApierV1GetCacheStats, utils.AttrCacheStats{}, &rcvStats); err != nil { - t.Error("Got error on ApierV1.GetCacheStats: ", err.Error()) + if err := destRPC.Call(utils.APIerSv1GetCacheStats, utils.AttrCacheStats{}, &rcvStats); err != nil { + t.Error("Got error on APIerSv1.GetCacheStats: ", err.Error()) } else if rcvStats.Destinations != 9 { - t.Errorf("Calling ApierV1.GetCacheStats received: %+v", rcvStats) + t.Errorf("Calling APIerSv1.GetCacheStats received: %+v", rcvStats) } } func testDestManagLoadTariffPlanFromFolderAddOne(t *testing.T) { attrs := &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "test", "destinations", "addone")} var destLoadInst utils.LoadInstance - if err := destRPC.Call(utils.ApierV2LoadTariffPlanFromFolder, attrs, &destLoadInst); err != nil { + if err := destRPC.Call(utils.APIerSv2LoadTariffPlanFromFolder, attrs, &destLoadInst); err != nil { t.Error(err) } time.Sleep(time.Duration(*waitRater) * time.Millisecond) // Give time for scheduler to execute topups @@ -221,17 +221,17 @@ func testDestManagLoadTariffPlanFromFolderAddOne(t *testing.T) { func testDestManagAddOneDestinationLoaded(t *testing.T) { dests := make([]*engine.Destination, 0) - if err := destRPC.Call(utils.ApierV2GetDestinations, v2.AttrGetDestinations{DestinationIDs: []string{}}, &dests); err != nil { - t.Error("Got error on ApierV2.GetDestinations: ", err.Error()) + if err := destRPC.Call(utils.APIerSv2GetDestinations, v2.AttrGetDestinations{DestinationIDs: []string{}}, &dests); err != nil { + t.Error("Got error on APIerSv2.GetDestinations: ", err.Error()) } else if len(dests) != 7 { - t.Errorf("Calling ApierV2.GetDestinations got reply: %v", utils.ToIJSON(dests)) + t.Errorf("Calling APIerSv2.GetDestinations got reply: %v", utils.ToIJSON(dests)) } var rcvStats utils.CacheStats - if err := destRPC.Call(utils.ApierV1GetCacheStats, utils.AttrCacheStats{}, &rcvStats); err != nil { - t.Error("Got error on ApierV1.GetCacheStats: ", err.Error()) + if err := destRPC.Call(utils.APIerSv1GetCacheStats, utils.AttrCacheStats{}, &rcvStats); err != nil { + t.Error("Got error on APIerSv1.GetCacheStats: ", err.Error()) } else if rcvStats.Destinations != 10 { - t.Errorf("Calling ApierV1.GetCacheStats received: %+v", rcvStats) + t.Errorf("Calling APIerSv1.GetCacheStats received: %+v", rcvStats) } } @@ -240,49 +240,49 @@ func testDestManagCacheWithGetCache(t *testing.T) { t.Fatal(err) } var reply string - if err := destRPC.Call(utils.ApierV1ReloadCache, utils.AttrReloadCache{}, &reply); err != nil { - t.Error("Got error on ApierV1.ReloadCache: ", err.Error()) + if err := destRPC.Call(utils.APIerSv1ReloadCache, utils.AttrReloadCache{}, &reply); err != nil { + t.Error("Got error on APIerSv1.ReloadCache: ", err.Error()) } else if reply != utils.OK { - t.Errorf("Calling ApierV1.ReloadCache received: %+v", reply) + t.Errorf("Calling APIerSv1.ReloadCache received: %+v", reply) } attrs := &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "test", "destinations", "cacheall"), FlushDb: true} var destLoadInst utils.LoadInstance - if err := destRPC.Call(utils.ApierV2LoadTariffPlanFromFolder, attrs, &destLoadInst); err != nil { + if err := destRPC.Call(utils.APIerSv2LoadTariffPlanFromFolder, attrs, &destLoadInst); err != nil { t.Error(err) } time.Sleep(time.Duration(*waitRater) * time.Millisecond) // Give time for scheduler to execute topups dests := make([]*engine.Destination, 0) - if err := destRPC.Call(utils.ApierV2GetDestinations, v2.AttrGetDestinations{DestinationIDs: []string{}}, &dests); err != nil { - t.Error("Got error on ApierV2.GetDestinations: ", err.Error()) + if err := destRPC.Call(utils.APIerSv2GetDestinations, v2.AttrGetDestinations{DestinationIDs: []string{}}, &dests); err != nil { + t.Error("Got error on APIerSv2.GetDestinations: ", err.Error()) } else if len(dests) != 1 { - t.Errorf("Calling ApierV2.GetDestinations got reply: %v", utils.ToIJSON(dests)) + t.Errorf("Calling APIerSv2.GetDestinations got reply: %v", utils.ToIJSON(dests)) } var rcvStats utils.CacheStats - if err := destRPC.Call(utils.ApierV1GetCacheStats, utils.AttrCacheStats{}, &rcvStats); err != nil { - t.Error("Got error on ApierV1.GetCacheStats: ", err.Error()) + if err := destRPC.Call(utils.APIerSv1GetCacheStats, utils.AttrCacheStats{}, &rcvStats); err != nil { + t.Error("Got error on APIerSv1.GetCacheStats: ", err.Error()) } else if rcvStats.Destinations != 2 { - t.Errorf("Calling ApierV1.GetCacheStats received: %+v", rcvStats) + t.Errorf("Calling APIerSv1.GetCacheStats received: %+v", rcvStats) } attrs = &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "test", "destinations", "cacheone"), FlushDb: true} - if err := destRPC.Call(utils.ApierV2LoadTariffPlanFromFolder, attrs, &destLoadInst); err != nil { + if err := destRPC.Call(utils.APIerSv2LoadTariffPlanFromFolder, attrs, &destLoadInst); err != nil { t.Error(err) } time.Sleep(time.Duration(*waitRater) * time.Millisecond) // Give time for scheduler to execute topups dests = make([]*engine.Destination, 0) - if err := destRPC.Call(utils.ApierV2GetDestinations, v2.AttrGetDestinations{DestinationIDs: []string{}}, &dests); err != nil { - t.Error("Got error on ApierV2.GetDestinations: ", err.Error()) + if err := destRPC.Call(utils.APIerSv2GetDestinations, v2.AttrGetDestinations{DestinationIDs: []string{}}, &dests); err != nil { + t.Error("Got error on APIerSv2.GetDestinations: ", err.Error()) } else if len(dests) != 1 { - t.Errorf("Calling ApierV2.GetDestinations got reply: %v", utils.ToIJSON(dests)) + t.Errorf("Calling APIerSv2.GetDestinations got reply: %v", utils.ToIJSON(dests)) } - if err := destRPC.Call(utils.ApierV1GetCacheStats, utils.AttrCacheStats{}, &rcvStats); err != nil { - t.Error("Got error on ApierV1.GetCacheStats: ", err.Error()) + if err := destRPC.Call(utils.APIerSv1GetCacheStats, utils.AttrCacheStats{}, &rcvStats); err != nil { + t.Error("Got error on APIerSv1.GetCacheStats: ", err.Error()) } else if rcvStats.Destinations != 1 { - t.Errorf("Calling ApierV1.GetCacheStats received: %+v", rcvStats) + t.Errorf("Calling APIerSv1.GetCacheStats received: %+v", rcvStats) } } @@ -291,23 +291,23 @@ func testDestManagCacheWithGetCost(t *testing.T) { t.Fatal(err) } var reply string - if err := destRPC.Call(utils.ApierV1ReloadCache, utils.AttrReloadCache{}, &reply); err != nil { - t.Error("Got error on ApierV1.ReloadCache: ", err.Error()) + if err := destRPC.Call(utils.APIerSv1ReloadCache, utils.AttrReloadCache{}, &reply); err != nil { + t.Error("Got error on APIerSv1.ReloadCache: ", err.Error()) } else if reply != utils.OK { - t.Errorf("Calling ApierV1.ReloadCache received: %+v", reply) + t.Errorf("Calling APIerSv1.ReloadCache received: %+v", reply) } attrs := &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "test", "destinations", "cacheall"), FlushDb: true} var destLoadInst utils.LoadInstance - if err := destRPC.Call(utils.ApierV2LoadTariffPlanFromFolder, attrs, &destLoadInst); err != nil { + if err := destRPC.Call(utils.APIerSv2LoadTariffPlanFromFolder, attrs, &destLoadInst); err != nil { t.Error(err) } time.Sleep(time.Duration(*waitRater) * time.Millisecond) // Give time for scheduler to execute topups dests := make([]*engine.Destination, 0) - if err := destRPC.Call(utils.ApierV2GetDestinations, v2.AttrGetDestinations{DestinationIDs: []string{}}, &dests); err != nil { - t.Error("Got error on ApierV2.GetDestinations: ", err.Error()) + if err := destRPC.Call(utils.APIerSv2GetDestinations, v2.AttrGetDestinations{DestinationIDs: []string{}}, &dests); err != nil { + t.Error("Got error on APIerSv2.GetDestinations: ", err.Error()) } else if len(dests) != 1 { - t.Errorf("Calling ApierV2.GetDestinations got reply: %v", utils.ToIJSON(dests)) + t.Errorf("Calling APIerSv2.GetDestinations got reply: %v", utils.ToIJSON(dests)) } var cc engine.CallCost @@ -326,16 +326,16 @@ func testDestManagCacheWithGetCost(t *testing.T) { } attrs = &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "test", "destinations", "cacheone"), FlushDb: true} - if err := destRPC.Call(utils.ApierV2LoadTariffPlanFromFolder, attrs, &destLoadInst); err != nil { + if err := destRPC.Call(utils.APIerSv2LoadTariffPlanFromFolder, attrs, &destLoadInst); err != nil { t.Error(err) } time.Sleep(time.Duration(*waitRater) * time.Millisecond) // Give time for scheduler to execute topups dests = make([]*engine.Destination, 0) - if err := destRPC.Call(utils.ApierV2GetDestinations, v2.AttrGetDestinations{DestinationIDs: []string{}}, &dests); err != nil { - t.Error("Got error on ApierV2.GetDestinations: ", err.Error()) + if err := destRPC.Call(utils.APIerSv2GetDestinations, v2.AttrGetDestinations{DestinationIDs: []string{}}, &dests); err != nil { + t.Error("Got error on APIerSv2.GetDestinations: ", err.Error()) } else if len(dests) != 1 { - t.Errorf("Calling ApierV2.GetDestinations got reply: %v", utils.ToIJSON(dests)) + t.Errorf("Calling APIerSv2.GetDestinations got reply: %v", utils.ToIJSON(dests)) } if err := destRPC.Call(utils.ResponderGetCost, cd, &cc); err.Error() != utils.ErrUnauthorizedDestination.Error() { diff --git a/general_tests/destination_combined_it_test.go b/general_tests/destination_combined_it_test.go index 375123c86..5e387ff72 100644 --- a/general_tests/destination_combined_it_test.go +++ b/general_tests/destination_combined_it_test.go @@ -100,7 +100,7 @@ func testDestinationRpcConn(t *testing.T) { func testDestinationFromFolder(t *testing.T) { var reply string attrs := &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "tp_destination_with_any")} - if err := tutorialRpc.Call(utils.ApierV1LoadTariffPlanFromFolder, attrs, &reply); err != nil { + if err := tutorialRpc.Call(utils.APIerSv1LoadTariffPlanFromFolder, attrs, &reply); err != nil { t.Error(err) } time.Sleep(500 * time.Millisecond) @@ -116,7 +116,7 @@ func testDestinationGetCostFor1002(t *testing.T) { Usage: "1m", } var rply *engine.EventCost - if err := tutorialRpc.Call(utils.ApierV1GetCost, attrs, &rply); err != nil { + if err := tutorialRpc.Call(utils.APIerSv1GetCost, attrs, &rply); err != nil { t.Error("Unexpected nil error received: ", err.Error()) } else if *rply.Cost != 0.01 { t.Errorf("Unexpected cost received: %f", *rply.Cost) @@ -133,7 +133,7 @@ func testDestinationGetCostFor1003(t *testing.T) { Usage: "1m", } var rply *engine.EventCost - if err := tutorialRpc.Call(utils.ApierV1GetCost, attrs, &rply); err != nil { + if err := tutorialRpc.Call(utils.APIerSv1GetCost, attrs, &rply); err != nil { t.Error("Unexpected nil error received: ", err.Error()) } else if *rply.Cost != 0.3 { t.Errorf("Unexpected cost received: %f", *rply.Cost) diff --git a/general_tests/filters_it_test.go b/general_tests/filters_it_test.go index cc0332e59..50ed4105d 100644 --- a/general_tests/filters_it_test.go +++ b/general_tests/filters_it_test.go @@ -118,7 +118,7 @@ func testV1FltrRpcConn(t *testing.T) { func testV1FltrLoadTarrifPlans(t *testing.T) { var reply string attrs := &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "testit")} - if err := fltrRpc.Call(utils.ApierV1LoadTariffPlanFromFolder, attrs, &reply); err != nil { + if err := fltrRpc.Call(utils.APIerSv1LoadTariffPlanFromFolder, attrs, &reply); err != nil { t.Error(err) } else if reply != utils.OK { t.Error("Unexpected reply returned", reply) @@ -270,7 +270,7 @@ func testV1FltrPupulateThreshold(t *testing.T) { } var result string - if err := fltrRpc.Call(utils.ApierV1SetFilter, filter, &result); err != nil { + if err := fltrRpc.Call(utils.APIerSv1SetFilter, filter, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -280,10 +280,10 @@ func testV1FltrPupulateThreshold(t *testing.T) { attrsAA := &utils.AttrSetActions{ActionsId: "LOG", Actions: []*utils.TPAction{ {Identifier: utils.LOG}, }} - if err := fltrRpc.Call(utils.ApierV2SetActions, attrsAA, &result); err != nil && err.Error() != utils.ErrExists.Error() { - t.Error("Got error on ApierV2.SetActions: ", err.Error()) + if err := fltrRpc.Call(utils.APIerSv2SetActions, attrsAA, &result); err != nil && err.Error() != utils.ErrExists.Error() { + t.Error("Got error on APIerSv2.SetActions: ", err.Error()) } else if result != utils.OK { - t.Errorf("Calling ApierV2.SetActions received: %s", result) + t.Errorf("Calling APIerSv2.SetActions received: %s", result) } time.Sleep(10 * time.Millisecond) @@ -304,13 +304,13 @@ func testV1FltrPupulateThreshold(t *testing.T) { Async: true, }, } - if err := fltrRpc.Call(utils.ApierV1SetThresholdProfile, tPrfl, &result); err != nil { + if err := fltrRpc.Call(utils.APIerSv1SetThresholdProfile, tPrfl, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } var rcvTh *engine.ThresholdProfile - if err := fltrRpc.Call(utils.ApierV1GetThresholdProfile, + if err := fltrRpc.Call(utils.APIerSv1GetThresholdProfile, &utils.TenantID{Tenant: tPrfl.Tenant, ID: tPrfl.ID}, &rcvTh); err != nil { t.Error(err) } else if !reflect.DeepEqual(tPrfl.ThresholdProfile, rcvTh) { @@ -355,7 +355,7 @@ func testV1FltrGetThresholdForEvent2(t *testing.T) { } var result string - if err := fltrRpc.Call(utils.ApierV1SetFilter, filter, &result); err != nil { + if err := fltrRpc.Call(utils.APIerSv1SetFilter, filter, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -377,7 +377,7 @@ func testV1FltrGetThresholdForEvent2(t *testing.T) { ActionIDs: []string{"LOG"}, }, } - if err := fltrRpc.Call(utils.ApierV1SetThresholdProfile, tPrfl, &result); err != nil { + if err := fltrRpc.Call(utils.APIerSv1SetThresholdProfile, tPrfl, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -412,14 +412,14 @@ func testV1FltrPopulateResources(t *testing.T) { } var result string - if err := fltrRpc.Call(utils.ApierV1SetResourceProfile, &v1.ResourceWithCache{ResourceProfile: rlsConfig}, &result); err != nil { + if err := fltrRpc.Call(utils.APIerSv1SetResourceProfile, &v1.ResourceWithCache{ResourceProfile: rlsConfig}, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } var reply *engine.ResourceProfile - if err := fltrRpc.Call(utils.ApierV1GetResourceProfile, + if err := fltrRpc.Call(utils.APIerSv1GetResourceProfile, &utils.TenantID{Tenant: "cgrates.org", ID: rlsConfig.ID}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(reply, rlsConfig) { @@ -459,7 +459,7 @@ func testV1FltrPopulateResources(t *testing.T) { }, } - if err := fltrRpc.Call(utils.ApierV1SetFilter, filter, &result); err != nil { + if err := fltrRpc.Call(utils.APIerSv1SetFilter, filter, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -477,13 +477,13 @@ func testV1FltrPopulateResources(t *testing.T) { Async: true, }, } - if err := fltrRpc.Call(utils.ApierV1SetThresholdProfile, tPrfl, &result); err != nil { + if err := fltrRpc.Call(utils.APIerSv1SetThresholdProfile, tPrfl, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } var rcvTh *engine.ThresholdProfile - if err := fltrRpc.Call(utils.ApierV1GetThresholdProfile, + if err := fltrRpc.Call(utils.APIerSv1GetThresholdProfile, &utils.TenantID{Tenant: tPrfl.Tenant, ID: tPrfl.ID}, &rcvTh); err != nil { t.Error(err) } else if !reflect.DeepEqual(tPrfl.ThresholdProfile, rcvTh) { @@ -522,14 +522,14 @@ func testV1FltrPopulateResources(t *testing.T) { }, } - if err := fltrRpc.Call(utils.ApierV1SetFilter, filter, &result); err != nil { + if err := fltrRpc.Call(utils.APIerSv1SetFilter, filter, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } //Overwrite the threshold - if err := fltrRpc.Call(utils.ApierV1SetThresholdProfile, tPrfl, &result); err != nil { + if err := fltrRpc.Call(utils.APIerSv1SetThresholdProfile, tPrfl, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -544,7 +544,7 @@ func testV1FltrPopulateResources(t *testing.T) { func testV1FltrAccounts(t *testing.T) { var resp string - if err := fltrRpc.Call(utils.ApierV1RemoveThresholdProfile, + if err := fltrRpc.Call(utils.APIerSv1RemoveThresholdProfile, &utils.TenantIDWithCache{Tenant: "cgrates.org", ID: "THD_ACNT_1001"}, &resp); err != nil { t.Error(err) } else if resp != utils.OK { @@ -568,7 +568,7 @@ func testV1FltrAccounts(t *testing.T) { } var result string - if err := fltrRpc.Call(utils.ApierV1SetFilter, filter, &result); err != nil { + if err := fltrRpc.Call(utils.APIerSv1SetFilter, filter, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -577,10 +577,10 @@ func testV1FltrAccounts(t *testing.T) { attrsAA := &utils.AttrSetActions{ActionsId: "LOG", Actions: []*utils.TPAction{ {Identifier: utils.LOG}, }} - if err := fltrRpc.Call(utils.ApierV2SetActions, attrsAA, &result); err != nil && err.Error() != utils.ErrExists.Error() { - t.Error("Got error on ApierV2.SetActions: ", err.Error()) + if err := fltrRpc.Call(utils.APIerSv2SetActions, attrsAA, &result); err != nil && err.Error() != utils.ErrExists.Error() { + t.Error("Got error on APIerSv2.SetActions: ", err.Error()) } else if result != utils.OK { - t.Errorf("Calling ApierV2.SetActions received: %s", result) + t.Errorf("Calling APIerSv2.SetActions received: %s", result) } time.Sleep(10 * time.Millisecond) //Add a threshold with filter from above and an inline filter for Account 1010 @@ -596,13 +596,13 @@ func testV1FltrAccounts(t *testing.T) { Async: true, }, } - if err := fltrRpc.Call(utils.ApierV1SetThresholdProfile, tPrfl, &result); err != nil { + if err := fltrRpc.Call(utils.APIerSv1SetThresholdProfile, tPrfl, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } var rcvTh *engine.ThresholdProfile - if err := fltrRpc.Call(utils.ApierV1GetThresholdProfile, + if err := fltrRpc.Call(utils.APIerSv1GetThresholdProfile, &utils.TenantID{Tenant: tPrfl.Tenant, ID: tPrfl.ID}, &rcvTh); err != nil { t.Error(err) } else if !reflect.DeepEqual(tPrfl.ThresholdProfile, rcvTh) { @@ -640,7 +640,7 @@ func testV1FltrAccounts(t *testing.T) { }, } - if err := fltrRpc.Call(utils.ApierV1SetFilter, filter, &result); err != nil { + if err := fltrRpc.Call(utils.APIerSv1SetFilter, filter, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) diff --git a/general_tests/gocs_it_test.go b/general_tests/gocs_it_test.go index a1df663f2..f79dd823b 100644 --- a/general_tests/gocs_it_test.go +++ b/general_tests/gocs_it_test.go @@ -148,24 +148,24 @@ func testGOCSLoadData(t *testing.T) { }, } var result string - if err := usRPC.Call(utils.ApierV1SetChargerProfile, chargerProfile, &result); err != nil { + if err := usRPC.Call(utils.APIerSv1SetChargerProfile, chargerProfile, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } var rpl *engine.ChargerProfile - if err := usRPC.Call(utils.ApierV1GetChargerProfile, + if err := usRPC.Call(utils.APIerSv1GetChargerProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "DEFAULT"}, &rpl); err != nil { t.Error(err) } else if !reflect.DeepEqual(chargerProfile.ChargerProfile, rpl) { t.Errorf("Expecting : %+v, received: %+v", chargerProfile.ChargerProfile, rpl) } - if err := usRPC.Call(utils.ApierV1SetChargerProfile, chargerProfile, &result); err != nil { + if err := usRPC.Call(utils.APIerSv1SetChargerProfile, chargerProfile, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } - if err := usRPC.Call(utils.ApierV1GetChargerProfile, + if err := usRPC.Call(utils.APIerSv1GetChargerProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "DEFAULT"}, &rpl); err != nil { t.Error(err) } else if !reflect.DeepEqual(chargerProfile.ChargerProfile, rpl) { @@ -207,13 +207,13 @@ func testGOCSLoadData(t *testing.T) { } // add a voice balance of 59 minutes var reply string - if err := usRPC.Call(utils.ApierV1SetBalance, attrSetBalance, &reply); err != nil { + if err := usRPC.Call(utils.APIerSv1SetBalance, attrSetBalance, &reply); err != nil { t.Error(err) } else if reply != utils.OK { t.Errorf("received: %s", reply) } expectedVoice := 3540000000000.0 - if err := usRPC.Call(utils.ApierV2GetAccount, acntAttrs, &acnt); err != nil { + if err := usRPC.Call(utils.APIerSv2GetAccount, acntAttrs, &acnt); err != nil { t.Error(err) } else if rply := acnt.BalanceMap[utils.VOICE].GetTotalValue(); rply != expectedVoice { t.Errorf("Expecting: %v, received: %v", expectedVoice, rply) @@ -313,13 +313,13 @@ func testGOCSInitSession(t *testing.T) { } // 59 mins - 5 mins = 54 mins - if err := auRPC.Call(utils.ApierV2GetAccount, attrAcc, &acnt); err != nil { + if err := auRPC.Call(utils.APIerSv2GetAccount, attrAcc, &acnt); err != nil { t.Error(err) } else if acnt.BalanceMap[utils.VOICE].GetTotalValue() != 3240000000000.0 { t.Errorf("Expecting : %+v, received: %+v", 3240000000000.0, acnt.BalanceMap[utils.VOICE].GetTotalValue()) } - if err := usRPC.Call(utils.ApierV2GetAccount, attrAcc, &acnt); err != nil { + if err := usRPC.Call(utils.APIerSv2GetAccount, attrAcc, &acnt); err != nil { t.Error(err) } else if acnt.BalanceMap[utils.VOICE].GetTotalValue() != 3240000000000.0 { t.Errorf("Expecting : %+v, received: %+v", 3240000000000.0, acnt.BalanceMap[utils.VOICE].GetTotalValue()) @@ -376,7 +376,7 @@ func testGOCSUpdateSession(t *testing.T) { // balanced changed in AU_SITE // 54 min - 5 mins = 49 min - if err := auRPC.Call(utils.ApierV2GetAccount, attrAcc, &acnt); err != nil { + if err := auRPC.Call(utils.APIerSv2GetAccount, attrAcc, &acnt); err != nil { t.Error(err) } else if acnt.BalanceMap[utils.VOICE].GetTotalValue() != 2940000000000.0 { t.Errorf("Expecting : %+v, received: %+v", 2940000000000.0, acnt.BalanceMap[utils.VOICE].GetTotalValue()) @@ -391,13 +391,13 @@ func testGOCSVerifyAccountsAfterStart(t *testing.T) { Account: "1001", } // because US_SITE was down we should notice a difference between balance from accounts from US_SITE and AU_SITE - if err := auRPC.Call(utils.ApierV2GetAccount, attrAcc, &acnt); err != nil { + if err := auRPC.Call(utils.APIerSv2GetAccount, attrAcc, &acnt); err != nil { t.Error(err) } else if acnt.BalanceMap[utils.VOICE].GetTotalValue() != 2940000000000.0 { t.Errorf("Expecting : %+v, received: %+v", 2940000000000.0, acnt.BalanceMap[utils.VOICE].GetTotalValue()) } - if err := usRPC.Call(utils.ApierV2GetAccount, attrAcc, &acnt); err != nil { + if err := usRPC.Call(utils.APIerSv2GetAccount, attrAcc, &acnt); err != nil { t.Error(err) } else if acnt.BalanceMap[utils.VOICE].GetTotalValue() != 3240000000000.0 { t.Errorf("Expecting : %+v, received: %+v", 3240000000000.0, acnt.BalanceMap[utils.VOICE].GetTotalValue()) @@ -463,13 +463,13 @@ func testGOCSUpdateSession2(t *testing.T) { Account: "1001", } - if err := auRPC.Call(utils.ApierV2GetAccount, attrAcc, &acnt); err != nil { + if err := auRPC.Call(utils.APIerSv2GetAccount, attrAcc, &acnt); err != nil { t.Error(err) } else if acnt.BalanceMap[utils.VOICE].GetTotalValue() != 2940000000000.0 { t.Errorf("Expecting : %+v, received: %+v", 2940000000000.0, acnt.BalanceMap[utils.VOICE].GetTotalValue()) } - if err := usRPC.Call(utils.ApierV2GetAccount, attrAcc, &acnt); err != nil { + if err := usRPC.Call(utils.APIerSv2GetAccount, attrAcc, &acnt); err != nil { t.Error(err) } else if acnt.BalanceMap[utils.VOICE].GetTotalValue() != 2940000000000.0 { t.Errorf("Expecting : %+v, received: %+v", 2940000000000.0, acnt.BalanceMap[utils.VOICE].GetTotalValue()) @@ -523,13 +523,13 @@ func testGOCSTerminateSession(t *testing.T) { Account: "1001", } - if err := auRPC.Call(utils.ApierV2GetAccount, attrAcc, &acnt); err != nil { + if err := auRPC.Call(utils.APIerSv2GetAccount, attrAcc, &acnt); err != nil { t.Error(err) } else if acnt.BalanceMap[utils.VOICE].GetTotalValue() != 2640000000000.0 { t.Errorf("Expecting : %+v, received: %+v", 2640000000000.0, acnt.BalanceMap[utils.VOICE].GetTotalValue()) } - if err := usRPC.Call(utils.ApierV2GetAccount, attrAcc, &acnt); err != nil { + if err := usRPC.Call(utils.APIerSv2GetAccount, attrAcc, &acnt); err != nil { t.Error(err) } else if acnt.BalanceMap[utils.VOICE].GetTotalValue() != 2640000000000.0 { t.Errorf("Expecting : %+v, received: %+v", 2640000000000.0, acnt.BalanceMap[utils.VOICE].GetTotalValue()) @@ -573,13 +573,13 @@ func testGOCSProcessCDR(t *testing.T) { Account: "1001", } - if err := auRPC.Call(utils.ApierV2GetAccount, attrAcc, &acnt); err != nil { + if err := auRPC.Call(utils.APIerSv2GetAccount, attrAcc, &acnt); err != nil { t.Error(err) } else if acnt.BalanceMap[utils.VOICE].GetTotalValue() != 2640000000000.0 { t.Errorf("Expecting : %+v, received: %+v", 2640000000000.0, acnt.BalanceMap[utils.VOICE].GetTotalValue()) } - if err := usRPC.Call(utils.ApierV2GetAccount, attrAcc, &acnt); err != nil { + if err := usRPC.Call(utils.APIerSv2GetAccount, attrAcc, &acnt); err != nil { t.Error(err) } else if acnt.BalanceMap[utils.VOICE].GetTotalValue() != 2640000000000.0 { t.Errorf("Expecting : %+v, received: %+v", 2640000000000.0, acnt.BalanceMap[utils.VOICE].GetTotalValue()) diff --git a/general_tests/oldtutorial_it_test.go b/general_tests/oldtutorial_it_test.go index 99051c26d..e3ee5c130 100644 --- a/general_tests/oldtutorial_it_test.go +++ b/general_tests/oldtutorial_it_test.go @@ -87,7 +87,7 @@ package general_tests // // Load the tariff plan, creating accounts and their balances // func TestTutITLoadTariffPlanFromFolder(t *testing.T) { // attrs := &utils.AttrLoadTpFromFolder{FolderPath: path.Join(**dataDir, "tariffplans", "oldtutorial")} -// if err := tutLocalRpc.Call(utils.ApierV2LoadTariffPlanFromFolder, attrs, &loadInst); err != nil { +// if err := tutLocalRpc.Call(utils.APIerSv2LoadTariffPlanFromFolder, attrs, &loadInst); err != nil { // t.Error(err) // } // time.Sleep(100*time.Millisecond + time.Duration(**waitRater)*time.Millisecond) // Give time for scheduler to execute topups @@ -96,7 +96,7 @@ package general_tests // // Check loaded stats // func TestTutITCacheStats(t *testing.T) { // var reply string -// if err := tutLocalRpc.Call("ApierV1.LoadCache", utils.AttrReloadCache{}, &reply); err != nil { +// if err := tutLocalRpc.Call("APIerSv1.LoadCache", utils.AttrReloadCache{}, &reply); err != nil { // t.Error(err) // } else if reply != utils.OK { // t.Error(reply) @@ -108,10 +108,10 @@ package general_tests // ThresholdProfiles: 7, Filters: 16, SupplierProfiles: 3, AttributeProfiles: 1, // CdrStats: 0, Users: 0} // CdrStats and Users are 0 because deprecated. To be removed // var args utils.AttrCacheStats -// if err := tutLocalRpc.Call(utils.ApierV1GetCacheStats, args, &rcvStats); err != nil { -// t.Error("Got error on ApierV1.GetCacheStats: ", err.Error()) +// if err := tutLocalRpc.Call(utils.APIerSv1GetCacheStats, args, &rcvStats); err != nil { +// t.Error("Got error on APIerSv1.GetCacheStats: ", err.Error()) // } else if !reflect.DeepEqual(expectedStats, rcvStats) { -// t.Errorf("Calling ApierV1.GetCacheStats expected: %+v, received: %+v", utils.ToJSON(expectedStats), utils.ToJSON(rcvStats)) +// t.Errorf("Calling APIerSv1.GetCacheStats expected: %+v, received: %+v", utils.ToJSON(expectedStats), utils.ToJSON(rcvStats)) // } // expKeys := utils.ArgsCache{ // DestinationIDs: &[]string{"DST_1003", "DST_1002", "DST_DE_MOBILE", "DST_1007", "DST_FS"}, @@ -120,8 +120,8 @@ package general_tests // var rcvKeys utils.ArgsCache // argsAPI := utils.ArgsCacheKeys{ArgsCache: utils.ArgsCache{ // DestinationIDs: &[]string{}, RatingPlanIDs: &[]string{"RP_RETAIL1", "RP_GENERIC", "NONEXISTENT"}}} -// if err := tutLocalRpc.Call(utils.ApierV1GetCacheKeys, argsAPI, &rcvKeys); err != nil { -// t.Error("Got error on ApierV1.GetCacheStats: ", err.Error()) +// if err := tutLocalRpc.Call(utils.APIerSv1GetCacheKeys, argsAPI, &rcvKeys); err != nil { +// t.Error("Got error on APIerSv1.GetCacheStats: ", err.Error()) // } else { // if rcvKeys.DestinationIDs == nil { // t.Errorf("Expecting rcvKeys.DestinationIDs to not be nil") @@ -145,10 +145,10 @@ package general_tests // if err != nil { // t.Fatal(err) // } -// if err := tutLocalRpc.Call(utils.ApierV1GetCacheStats, args, &rcvStats); err != nil { -// t.Error("Got error on ApierV1.GetCacheStats: ", err.Error()) +// if err := tutLocalRpc.Call(utils.APIerSv1GetCacheStats, args, &rcvStats); err != nil { +// t.Error("Got error on APIerSv1.GetCacheStats: ", err.Error()) // } else if !reflect.DeepEqual(expectedStats, rcvStats) { -// t.Errorf("Calling ApierV1.GetCacheStats expected: %+v, received: %+v", expectedStats, rcvStats) +// t.Errorf("Calling APIerSv1.GetCacheStats expected: %+v, received: %+v", expectedStats, rcvStats) // } // } @@ -514,19 +514,19 @@ package general_tests // SetupTime: "2014-08-04T13:00:00Z", Usage: "1s", // } // var maxTime float64 -// if err := tutLocalRpc.Call("ApierV2.GetMaxUsage", setupReq, &maxTime); err != nil { +// if err := tutLocalRpc.Call("APIerSv2.GetMaxUsage", setupReq, &maxTime); err != nil { // t.Error(err) // } else if maxTime != 1 { -// t.Errorf("Calling ApierV2.MaxUsage got maxTime: %f", maxTime) +// t.Errorf("Calling APIerSv2.MaxUsage got maxTime: %f", maxTime) // } // setupReq = &engine.UsageRecord{ToR: utils.VOICE, RequestType: utils.META_RATED, Tenant: "cgrates.org", Category: "call", // Account: "test_max_usage", Destination: "1001", // SetupTime: "2014-08-04T13:00:00Z", // } -// if err := tutLocalRpc.Call("ApierV2.GetMaxUsage", setupReq, &maxTime); err != nil { +// if err := tutLocalRpc.Call("APIerSv2.GetMaxUsage", setupReq, &maxTime); err != nil { // t.Error(err) // } else if maxTime != -1 { -// t.Errorf("Calling ApierV2.MaxUsage got maxTime: %f", maxTime) +// t.Errorf("Calling APIerSv2.MaxUsage got maxTime: %f", maxTime) // } // } @@ -537,10 +537,10 @@ package general_tests // AnswerTime: "2014-08-04T13:00:00Z", Usage: "1", // } // var reply string -// if err := tutLocalRpc.Call("ApierV2.DebitUsage", setupReq, &reply); err != nil { +// if err := tutLocalRpc.Call("APIerSv2.DebitUsage", setupReq, &reply); err != nil { // t.Error(err) // } else if reply != utils.OK { -// t.Error("Calling ApierV2.DebitUsage reply: ", reply) +// t.Error("Calling APIerSv2.DebitUsage reply: ", reply) // } // } @@ -586,7 +586,7 @@ package general_tests // var cdrs []*engine.ExternalCDR // req := utils.RPCCDRsFilter{RunIDs: []string{utils.MetaDefault}, // Accounts: []string{"1004"}, DestinationPrefixes: []string{"1001"}} -// if err := tutLocalRpc.Call(utils.ApierV2GetCDRs, req, &cdrs); err != nil { +// if err := tutLocalRpc.Call(utils.APIerSv2GetCDRs, req, &cdrs); err != nil { // t.Error("Unexpected error: ", err.Error()) // } else if len(cdrs) != 1 { // t.Error("Unexpected number of CDRs returned: ", len(cdrs)) @@ -646,7 +646,7 @@ package general_tests // time.Sleep(time.Duration(**waitRater) * time.Millisecond) // var cdrs []*engine.ExternalCDR // req := utils.RPCCDRsFilter{RunIDs: []string{utils.MetaDefault}, Accounts: []string{cdr.Account}, DestinationPrefixes: []string{cdr.Destination}} -// if err := tutLocalRpc.Call(utils.ApierV2GetCDRs, req, &cdrs); err != nil { +// if err := tutLocalRpc.Call(utils.APIerSv2GetCDRs, req, &cdrs); err != nil { // t.Error("Unexpected error: ", err.Error()) // } else if len(cdrs) != 1 { // t.Error("Unexpected number of CDRs returned: ", len(cdrs)) @@ -671,7 +671,7 @@ package general_tests // } // time.Sleep(time.Duration(**waitRater) * time.Millisecond) // Give time for CDR to be processed // req = utils.RPCCDRsFilter{RunIDs: []string{utils.MetaDefault}, Accounts: []string{cdr2.Account}, DestinationPrefixes: []string{cdr2.Destination}} -// if err := tutLocalRpc.Call(utils.ApierV2GetCDRs, req, &cdrs); err != nil { +// if err := tutLocalRpc.Call(utils.APIerSv2GetCDRs, req, &cdrs); err != nil { // t.Error("Unexpected error: ", err.Error()) // } else if len(cdrs) != 1 { // t.Error("Unexpected number of CDRs returned: ", len(cdrs)) @@ -696,7 +696,7 @@ package general_tests // } // time.Sleep(time.Duration(**waitRater) * time.Millisecond) // Give time for CDR to be processed // req = utils.RPCCDRsFilter{RunIDs: []string{utils.MetaDefault}, Accounts: []string{cdr3.Account}, DestinationPrefixes: []string{cdr3.Destination}} -// if err := tutLocalRpc.Call(utils.ApierV2GetCDRs, req, &cdrs); err != nil { +// if err := tutLocalRpc.Call(utils.APIerSv2GetCDRs, req, &cdrs); err != nil { // t.Error("Unexpected error: ", err.Error()) // } else if len(cdrs) != 1 { // t.Error("Unexpected number of CDRs returned: ", len(cdrs)) @@ -1158,10 +1158,10 @@ package general_tests // func TestTutITSetAccount(t *testing.T) { // var reply string // attrs := &v2.AttrSetAccount{Tenant: "cgrates.org", Account: "tutacnt1", ActionPlanIDs: &[]string{"PACKAGE_10"}, ActionTriggerIDs: &[]string{"STANDARD_TRIGGERS"}, ReloadScheduler: true} -// if err := tutLocalRpc.Call(utils.ApierV2SetAccount, attrs, &reply); err != nil { -// t.Error("Got error on ApierV2.SetAccount: ", err.Error()) +// if err := tutLocalRpc.Call(utils.APIerSv2SetAccount, attrs, &reply); err != nil { +// t.Error("Got error on APIerSv2.SetAccount: ", err.Error()) // } else if reply != utils.OK { -// t.Errorf("Calling ApierV2.SetAccount received: %s", reply) +// t.Errorf("Calling APIerSv2.SetAccount received: %s", reply) // } // type AttrGetAccounts struct { // Tenant string @@ -1171,7 +1171,7 @@ package general_tests // } // time.Sleep(time.Duration(**waitRater) * time.Millisecond) // Give time for scheduler to execute topups // var acnts []*engine.Account -// if err := tutLocalRpc.Call("ApierV2.GetAccounts", utils.AttrGetAccounts{Tenant: attrs.Tenant, AccountIds: []string{attrs.Account}}, &acnts); err != nil { +// if err := tutLocalRpc.Call("APIerSv2.GetAccounts", utils.AttrGetAccounts{Tenant: attrs.Tenant, AccountIds: []string{attrs.Account}}, &acnts); err != nil { // t.Error(err) // } else if len(acnts) != 1 { // t.Errorf("Accounts received: %+v", acnts) @@ -1196,12 +1196,12 @@ package general_tests // } // attrs = &v2.AttrSetAccount{Tenant: "cgrates.org", Account: "tutacnt1", ActionPlanIDs: &[]string{"PACKAGE_10"}, ActionTriggerIDs: &[]string{"STANDARD_TRIGGERS"}, AllowNegative: utils.BoolPointer(true), Disabled: utils.BoolPointer(true), ReloadScheduler: true} -// if err := tutLocalRpc.Call(utils.ApierV2SetAccount, attrs, &reply); err != nil { -// t.Error("Got error on ApierV2.SetAccount: ", err.Error()) +// if err := tutLocalRpc.Call(utils.APIerSv2SetAccount, attrs, &reply); err != nil { +// t.Error("Got error on APIerSv2.SetAccount: ", err.Error()) // } else if reply != utils.OK { -// t.Errorf("Calling ApierV2.SetAccount received: %s", reply) +// t.Errorf("Calling APIerSv2.SetAccount received: %s", reply) // } -// if err := tutLocalRpc.Call("ApierV2.GetAccounts", utils.AttrGetAccounts{Tenant: attrs.Tenant, AccountIds: []string{attrs.Account}}, &acnts); err != nil { +// if err := tutLocalRpc.Call("APIerSv2.GetAccounts", utils.AttrGetAccounts{Tenant: attrs.Tenant, AccountIds: []string{attrs.Account}}, &acnts); err != nil { // t.Error(err) // } else if len(acnts) != 1 { // t.Errorf("Accounts received: %+v", acnts) @@ -1226,13 +1226,13 @@ package general_tests // } // attrs = &v2.AttrSetAccount{Tenant: "cgrates.org", Account: "tutacnt1", ActionPlanIDs: &[]string{"PACKAGE_1001"}, ActionTriggerIDs: &[]string{"CDRST1_WARN"}, AllowNegative: utils.BoolPointer(true), Disabled: utils.BoolPointer(true), ReloadScheduler: true} -// if err := tutLocalRpc.Call(utils.ApierV2SetAccount, attrs, &reply); err != nil { -// t.Error("Got error on ApierV2.SetAccount: ", err.Error()) +// if err := tutLocalRpc.Call(utils.APIerSv2SetAccount, attrs, &reply); err != nil { +// t.Error("Got error on APIerSv2.SetAccount: ", err.Error()) // } else if reply != utils.OK { -// t.Errorf("Calling ApierV2.SetAccount received: %s", reply) +// t.Errorf("Calling APIerSv2.SetAccount received: %s", reply) // } // time.Sleep(100*time.Millisecond + time.Duration(**waitRater)*time.Millisecond) // Give time for scheduler to execute topups -// if err := tutLocalRpc.Call("ApierV2.GetAccounts", utils.AttrGetAccounts{Tenant: attrs.Tenant, AccountIds: []string{attrs.Account}}, &acnts); err != nil { +// if err := tutLocalRpc.Call("APIerSv2.GetAccounts", utils.AttrGetAccounts{Tenant: attrs.Tenant, AccountIds: []string{attrs.Account}}, &acnts); err != nil { // t.Error(err) // } else if len(acnts) != 1 { // t.Errorf("Accounts received: %+v", acnts) @@ -1357,7 +1357,7 @@ package general_tests // time.Sleep(time.Duration(**waitRater) * time.Millisecond) // Give time for CDR to be processed // var cdrs []*engine.ExternalCDR // req := utils.RPCCDRsFilter{RunIDs: []string{utils.MetaDefault}, CGRIDs: []string{cdr.CGRID}} -// if err := tutLocalRpc.Call(utils.ApierV2GetCDRs, req, &cdrs); err != nil { +// if err := tutLocalRpc.Call(utils.APIerSv2GetCDRs, req, &cdrs); err != nil { // t.Error("Unexpected error: ", err.Error()) // } else if len(cdrs) != 1 { // t.Error("Unexpected number of CDRs returned: ", len(cdrs)) @@ -1389,7 +1389,7 @@ package general_tests // time.Sleep(time.Duration(7000) * time.Millisecond) // Give time for CDR to be processed // var cdrs []*engine.ExternalCDR // req := utils.RPCCDRsFilter{RunIDs: []string{utils.MetaDefault}, CGRIDs: []string{cdr.CGRID}} -// if err := tutLocalRpc.Call(utils.ApierV2GetCDRs, req, &cdrs); err != nil { +// if err := tutLocalRpc.Call(utils.APIerSv2GetCDRs, req, &cdrs); err != nil { // t.Error("Unexpected error: ", err.Error()) // } else if len(cdrs) != 1 { // t.Error("Unexpected number of CDRs returned: ", len(cdrs)) @@ -1420,7 +1420,7 @@ package general_tests // time.Sleep(time.Duration(50) * time.Millisecond) // Give time for CDR to be processed // var cdrs []*engine.ExternalCDR // req := utils.RPCCDRsFilter{RunIDs: []string{utils.MetaDefault}, CGRIDs: []string{cdr.CGRID}} -// if err := tutLocalRpc.Call(utils.ApierV2GetCDRs, req, &cdrs); err != nil { +// if err := tutLocalRpc.Call(utils.APIerSv2GetCDRs, req, &cdrs); err != nil { // t.Error("Unexpected error: ", err.Error()) // } else if len(cdrs) != 1 { // t.Error("Unexpected number of CDRs returned: ", len(cdrs)) @@ -1438,7 +1438,7 @@ package general_tests // ExportFileName: utils.StringPointer("TestTutITExportCDR.csv"), // ExportTemplate: utils.StringPointer("TestTutITExportCDR"), // RPCCDRsFilter: utils.RPCCDRsFilter{CGRIDs: []string{cdr.CGRID}, NotRunIDs: []string{utils.MetaRaw}}} -// if err := tutLocalRpc.Call(utils.ApierV1ExportCDRs, exportArgs, &replyExport); err != nil { +// if err := tutLocalRpc.Call(utils.APIerSv1ExportCDRs, exportArgs, &replyExport); err != nil { // t.Error(err) // } // eExportContent := `f0a92222a7d21b4d9f72744aabe82daef52e20d8,*default,testexportcdr1,*rated,cgrates.org,call,1001,1003,2016-11-30T18:06:04+01:00,98,1.33340,RETA diff --git a/general_tests/resourcesv1_it_test.go b/general_tests/resourcesv1_it_test.go index 9573d2dbd..b154aebd3 100644 --- a/general_tests/resourcesv1_it_test.go +++ b/general_tests/resourcesv1_it_test.go @@ -122,7 +122,7 @@ func testV1RsSetProfile(t *testing.T) { }, } var result string - if err := rlsV1Rpc.Call(utils.ApierV1SetResourceProfile, rls, &result); err != nil { + if err := rlsV1Rpc.Call(utils.APIerSv1SetResourceProfile, rls, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) diff --git a/general_tests/rpccaching_it_test.go b/general_tests/rpccaching_it_test.go index 678d3f493..595480324 100644 --- a/general_tests/rpccaching_it_test.go +++ b/general_tests/rpccaching_it_test.go @@ -126,7 +126,7 @@ func testRPCMethodsRpcConn(t *testing.T) { func testRPCMethodsFromFolder(t *testing.T) { var reply string attrs := &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "testit")} - if err := rpcRpc.Call(utils.ApierV1LoadTariffPlanFromFolder, attrs, &reply); err != nil { + if err := rpcRpc.Call(utils.APIerSv1LoadTariffPlanFromFolder, attrs, &reply); err != nil { t.Error(err) } time.Sleep(100 * time.Millisecond) @@ -134,7 +134,7 @@ func testRPCMethodsFromFolder(t *testing.T) { func testRPCMethodsAddData(t *testing.T) { var resp string - if err := rpcRpc.Call(utils.ApierV1RemoveThresholdProfile, + if err := rpcRpc.Call(utils.APIerSv1RemoveThresholdProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "THD_ACNT_1001"}, &resp); err != nil { t.Error(err) } else if resp != utils.OK { @@ -146,20 +146,20 @@ func testRPCMethodsAddData(t *testing.T) { {Identifier: utils.DISABLE_ACCOUNT}, {Identifier: utils.LOG}, }} - if err := rpcRpc.Call(utils.ApierV2SetActions, attrsAA, &reply); err != nil && err.Error() != utils.ErrExists.Error() { - t.Error("Got error on ApierV2.SetActions: ", err.Error()) + if err := rpcRpc.Call(utils.APIerSv2SetActions, attrsAA, &reply); err != nil && err.Error() != utils.ErrExists.Error() { + t.Error("Got error on APIerSv2.SetActions: ", err.Error()) } else if reply != utils.OK { - t.Errorf("Calling ApierV2.SetActions received: %s", reply) + t.Errorf("Calling APIerSv2.SetActions received: %s", reply) } // Add an enable and log action attrsAA2 := &utils.AttrSetActions{ActionsId: "ENABLE_LOG", Actions: []*utils.TPAction{ {Identifier: utils.ENABLE_ACCOUNT}, {Identifier: utils.LOG}, }} - if err := rpcRpc.Call(utils.ApierV2SetActions, attrsAA2, &reply); err != nil && err.Error() != utils.ErrExists.Error() { - t.Error("Got error on ApierV2.SetActions: ", err.Error()) + if err := rpcRpc.Call(utils.APIerSv2SetActions, attrsAA2, &reply); err != nil && err.Error() != utils.ErrExists.Error() { + t.Error("Got error on APIerSv2.SetActions: ", err.Error()) } else if reply != utils.OK { - t.Errorf("Calling ApierV2.SetActions received: %s", reply) + t.Errorf("Calling APIerSv2.SetActions received: %s", reply) } time.Sleep(10 * time.Millisecond) @@ -175,7 +175,7 @@ func testRPCMethodsAddData(t *testing.T) { ActionIDs: []string{"DISABLE_LOG"}, }, } - if err := rpcRpc.Call(utils.ApierV1SetThresholdProfile, tPrfl, &reply); err != nil { + if err := rpcRpc.Call(utils.APIerSv1SetThresholdProfile, tPrfl, &reply); err != nil { t.Error(err) } else if reply != utils.OK { t.Error("Unexpected reply returned", reply) @@ -192,7 +192,7 @@ func testRPCMethodsAddData(t *testing.T) { ActionIDs: []string{"ENABLE_LOG"}, }, } - if err := rpcRpc.Call(utils.ApierV1SetThresholdProfile, tPrfl2, &reply); err != nil { + if err := rpcRpc.Call(utils.APIerSv1SetThresholdProfile, tPrfl2, &reply); err != nil { t.Error(err) } else if reply != utils.OK { t.Error("Unexpected reply returned", reply) @@ -253,7 +253,7 @@ func testRPCMethodsAuthorizeSession(t *testing.T) { Tenant: "cgrates.org", Account: "1001", } - if err := rpcRpc.Call(utils.ApierV2GetAccount, attrAcc, &acnt); err != nil { + if err := rpcRpc.Call(utils.APIerSv2GetAccount, attrAcc, &acnt); err != nil { t.Error(err) } else if acnt.Disabled != true { t.Errorf("Expecting: true, received: %v", acnt.Disabled) @@ -348,7 +348,7 @@ func testRPCMethodsInitSession(t *testing.T) { Tenant: "cgrates.org", Account: "1001", } - if err := rpcRpc.Call(utils.ApierV2GetAccount, attrAcc, &acnt); err != nil { + if err := rpcRpc.Call(utils.APIerSv2GetAccount, attrAcc, &acnt); err != nil { t.Error(err) } else if acnt.Disabled != true { t.Errorf("Expecting: true, received: %v", acnt.Disabled) @@ -443,7 +443,7 @@ func testRPCMethodsUpdateSession(t *testing.T) { Tenant: "cgrates.org", Account: "1001", } - if err := rpcRpc.Call(utils.ApierV2GetAccount, attrAcc, &acnt); err != nil { + if err := rpcRpc.Call(utils.APIerSv2GetAccount, attrAcc, &acnt); err != nil { t.Error(err) } else if acnt.Disabled != true { t.Errorf("Expecting: true, received: %v", acnt.Disabled) @@ -657,7 +657,7 @@ func testRPCMethodsProcessEvent(t *testing.T) { Tenant: "cgrates.org", Account: "1001", } - if err := rpcRpc.Call(utils.ApierV2GetAccount, attrAcc, &acnt); err != nil { + if err := rpcRpc.Call(utils.APIerSv2GetAccount, attrAcc, &acnt); err != nil { t.Error(err) } else if acnt.Disabled != true { t.Errorf("Expecting: true, received: %v", acnt.Disabled) @@ -819,7 +819,7 @@ func testRPCMethodsCdrsStoreSessionCost(t *testing.T) { // Load the tariff plan, creating accounts and their balances func testRPCMethodsLoadData(t *testing.T) { attrs := &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "testtp")} - if err := rpcRpc.Call(utils.ApierV2LoadTariffPlanFromFolder, attrs, &tpLoadInst); err != nil { + if err := rpcRpc.Call(utils.APIerSv2LoadTariffPlanFromFolder, attrs, &tpLoadInst); err != nil { t.Error(err) } time.Sleep(time.Duration(*waitRater) * time.Millisecond) // Give time for scheduler to execute topups diff --git a/general_tests/rpcclient_it_test.go b/general_tests/rpcclient_it_test.go index af25cf1c1..0d2c5e173 100644 --- a/general_tests/rpcclient_it_test.go +++ b/general_tests/rpcclient_it_test.go @@ -313,30 +313,30 @@ func testRPCITLclStatusBcastRALs1Up(t *testing.T) { /* func TestRPCITStatusBcastCmd(t *testing.T) { var stats utils.CacheStats - if err := rpcRAL1.Call(utils.ApierV2GetCacheStats, utils.AttrCacheStats{}, &stats); err != nil { + if err := rpcRAL1.Call(utils.APIerSv2GetCacheStats, utils.AttrCacheStats{}, &stats); err != nil { t.Error(err) } else if stats.LastRatingLoadID != utils.NOT_AVAILABLE || stats.LastAccountingLoadID != utils.NOT_AVAILABLE { t.Errorf("Received unexpected stats: %+v", stats) } var loadInst utils.LoadInstance attrs := &utils.AttrLoadTpFromFolder{FolderPath: path.Join(**dataDir, "tariffplans", "oldtutorial")} - if err := rpcRAL1.Call(utils.ApierV2LoadTariffPlanFromFolder, attrs, &loadInst); err != nil { + if err := rpcRAL1.Call(utils.APIerSv2LoadTariffPlanFromFolder, attrs, &loadInst); err != nil { t.Error(err) } else if loadInst.RatingLoadID == "" || loadInst.AccountingLoadID == "" { t.Errorf("Empty loadId received, loadInstance: %+v", loadInst) } var reply string - if err := rpcPoolBroadcast.Call(utils.ApierV1ReloadCache, utils.AttrReloadCache{}, &reply); err != nil { - t.Error("Got error on ApierV1.ReloadCache: ", err.Error()) + if err := rpcPoolBroadcast.Call(utils.APIerSv1ReloadCache, utils.AttrReloadCache{}, &reply); err != nil { + t.Error("Got error on APIerSv1.ReloadCache: ", err.Error()) } else if reply != utils.OK { - t.Error("Calling ApierV1.ReloadCache got reply: ", reply) + t.Error("Calling APIerSv1.ReloadCache got reply: ", reply) } - if err := rpcRAL1.Call(utils.ApierV2GetCacheStats, utils.AttrCacheStats{}, &stats); err != nil { + if err := rpcRAL1.Call(utils.APIerSv2GetCacheStats, utils.AttrCacheStats{}, &stats); err != nil { t.Error(err) } else if stats.LastRatingLoadID != loadInst.RatingLoadID { t.Errorf("Received unexpected stats: %+v vs %+v", stats, loadInst) } - if err := rpcRAL2.Call(utils.ApierV2GetCacheStats, utils.AttrCacheStats{}, &stats); err != nil { + if err := rpcRAL2.Call(utils.APIerSv2GetCacheStats, utils.AttrCacheStats{}, &stats); err != nil { t.Error(err) } else if stats.LastRatingLoadID != loadInst.RatingLoadID { t.Errorf("Received unexpected stats: %+v vs %+v", stats, loadInst) diff --git a/general_tests/sentinel_it_test.go b/general_tests/sentinel_it_test.go index c6f70bf07..6e58df6c2 100755 --- a/general_tests/sentinel_it_test.go +++ b/general_tests/sentinel_it_test.go @@ -148,13 +148,13 @@ func testRedisSentinelSetGetAttribute(t *testing.T) { } alsPrf.Compile() var result string - if err := sentinelRPC.Call(utils.ApierV1SetAttributeProfile, alsPrf, &result); err != nil { + if err := sentinelRPC.Call(utils.APIerSv1SetAttributeProfile, alsPrf, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } var reply *engine.AttributeProfile - if err := sentinelRPC.Call(utils.ApierV1GetAttributeProfile, + if err := sentinelRPC.Call(utils.APIerSv1GetAttributeProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "ApierTest"}, &reply); err != nil { t.Error(err) } @@ -186,7 +186,7 @@ func testRedisSentinelInsertion(t *testing.T) { var result string addFunc := func(t *testing.T, nrFail *int) { alsPrf.ID = id - if err := sentinelRPC.Call(utils.ApierV1SetAttributeProfile, alsPrf, &result); err != nil { + if err := sentinelRPC.Call(utils.APIerSv1SetAttributeProfile, alsPrf, &result); err != nil { if err.Error() == "SERVER_ERROR: No sentinels active" { *nrFail = *nrFail + 1 } else { @@ -266,7 +266,7 @@ func testRedisSentinelGetAttrAfterFailover(t *testing.T) { } alsPrf.Compile() var reply *engine.AttributeProfile - if err := sentinelRPC.Call(utils.ApierV1GetAttributeProfile, + if err := sentinelRPC.Call(utils.APIerSv1GetAttributeProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "ApierTest"}, &reply); err != nil { t.Error(err) } diff --git a/general_tests/session2_it_test.go b/general_tests/session2_it_test.go index 8cc7ad839..21ff8fdea 100644 --- a/general_tests/session2_it_test.go +++ b/general_tests/session2_it_test.go @@ -105,7 +105,7 @@ func testSes2ItRPCConn(t *testing.T) { func testSes2ItLoadFromFolder(t *testing.T) { var reply string attrs := &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "tutorial")} - if err := ses2RPC.Call(utils.ApierV1LoadTariffPlanFromFolder, attrs, &reply); err != nil { + if err := ses2RPC.Call(utils.APIerSv1LoadTariffPlanFromFolder, attrs, &reply); err != nil { t.Error(err) } time.Sleep(500 * time.Millisecond) @@ -123,7 +123,7 @@ func testSes2ItInitSession(t *testing.T) { }, } var reply string - if err := ses2RPC.Call(utils.ApierV2SetBalance, + if err := ses2RPC.Call(utils.APIerSv2SetBalance, attrSetBalance, &reply); err != nil { t.Fatal(err) } diff --git a/general_tests/session3_it_test.go b/general_tests/session3_it_test.go index db3bea75f..1941d466c 100644 --- a/general_tests/session3_it_test.go +++ b/general_tests/session3_it_test.go @@ -116,7 +116,7 @@ func testSes3ItRPCConn(t *testing.T) { func testSes3ItLoadFromFolder(t *testing.T) { var reply string attrs := &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "testit")} - if err := ses3RPC.Call(utils.ApierV1LoadTariffPlanFromFolder, attrs, &reply); err != nil { + if err := ses3RPC.Call(utils.APIerSv1LoadTariffPlanFromFolder, attrs, &reply); err != nil { t.Error(err) } time.Sleep(500 * time.Millisecond) @@ -271,7 +271,7 @@ func testSes3ItAddVoiceBalance(t *testing.T) { }, } var reply string - if err := ses3RPC.Call(utils.ApierV2SetBalance, attrSetBalance, &reply); err != nil { + if err := ses3RPC.Call(utils.APIerSv2SetBalance, attrSetBalance, &reply); err != nil { t.Error(err) } else if reply != utils.OK { t.Errorf("Received: %s", reply) @@ -281,7 +281,7 @@ func testSes3ItAddVoiceBalance(t *testing.T) { Tenant: "cgrates.org", Account: "1002", } - if err := ses3RPC.Call(utils.ApierV2GetAccount, attrs, &acnt); err != nil { + if err := ses3RPC.Call(utils.APIerSv2GetAccount, attrs, &acnt); err != nil { t.Error(err) } else if rply := acnt.BalanceMap[utils.VOICE].GetTotalValue(); rply != float64(5*time.Second) { t.Errorf("Expecting: %v, received: %v", @@ -368,7 +368,7 @@ func testSes3ItBalance(t *testing.T) { Tenant: "cgrates.org", Account: "1002", } - if err := ses3RPC.Call(utils.ApierV2GetAccount, attrs, &acnt); err != nil { + if err := ses3RPC.Call(utils.APIerSv2GetAccount, attrs, &acnt); err != nil { t.Error(err) } else if rply := acnt.BalanceMap[utils.VOICE].GetTotalValue(); rply != float64(3*time.Second) { t.Errorf("Expecting: %v, received: %v", @@ -405,7 +405,7 @@ func testSes3ItCDRs(t *testing.T) { var cdrs []*engine.ExternalCDR req := utils.RPCCDRsFilter{RunIDs: []string{"CustomerCharges"}, Accounts: []string{"1002"}} - if err := ses3RPC.Call(utils.ApierV2GetCDRs, req, &cdrs); err != nil { + if err := ses3RPC.Call(utils.APIerSv2GetCDRs, req, &cdrs); err != nil { t.Error("Unexpected error: ", err.Error()) } else if len(cdrs) != 1 { t.Error("Unexpected number of CDRs returned: ", len(cdrs)) diff --git a/general_tests/session_it_test.go b/general_tests/session_it_test.go index 25aca1944..10ea1bfec 100644 --- a/general_tests/session_it_test.go +++ b/general_tests/session_it_test.go @@ -108,7 +108,7 @@ func testSesItRPCConn(t *testing.T) { func testSesItLoadFromFolder(t *testing.T) { var reply string attrs := &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "testit")} - if err := sesRPC.Call(utils.ApierV1LoadTariffPlanFromFolder, attrs, &reply); err != nil { + if err := sesRPC.Call(utils.APIerSv1LoadTariffPlanFromFolder, attrs, &reply); err != nil { t.Error(err) } time.Sleep(500 * time.Millisecond) @@ -120,7 +120,7 @@ func testAccountBalance2(t *testing.T, sracc, srten, balType string, expected fl Tenant: srten, Account: sracc, } - if err := sesRPC.Call(utils.ApierV2GetAccount, attrs, &acnt); err != nil { + if err := sesRPC.Call(utils.APIerSv2GetAccount, attrs, &acnt); err != nil { t.Error(err) } else if rply := acnt.BalanceMap[balType].GetTotalValue(); rply != expected { t.Errorf("Expecting: %v, received: %v", @@ -140,7 +140,7 @@ func testSesItAddVoiceBalance(t *testing.T) { }, } var reply string - if err := sesRPC.Call(utils.ApierV2SetBalance, attrSetBalance, &reply); err != nil { + if err := sesRPC.Call(utils.APIerSv2SetBalance, attrSetBalance, &reply); err != nil { t.Error(err) } else if reply != utils.OK { t.Errorf("Received: %s", reply) diff --git a/general_tests/session_replications_automaticdebit_it_test.go b/general_tests/session_replications_automaticdebit_it_test.go index 61d36aa5f..030bafb89 100644 --- a/general_tests/session_replications_automaticdebit_it_test.go +++ b/general_tests/session_replications_automaticdebit_it_test.go @@ -88,7 +88,7 @@ func testSessionSRplAddVoiceBalance(t *testing.T) { }, } var reply string - if err := smgRplcMstrRPC.Call(utils.ApierV2SetBalance, attrSetBalance, &reply); err != nil { + if err := smgRplcMstrRPC.Call(utils.APIerSv2SetBalance, attrSetBalance, &reply); err != nil { t.Error(err) } else if reply != utils.OK { t.Errorf("Received: %s", reply) @@ -99,7 +99,7 @@ func testSessionSRplAddVoiceBalance(t *testing.T) { Account: "1005", } //get balance - if err := smgRplcMstrRPC.Call(utils.ApierV2GetAccount, attrs, &acnt); err != nil { + if err := smgRplcMstrRPC.Call(utils.APIerSv2GetAccount, attrs, &acnt); err != nil { t.Error(err) } else if rply := acnt.BalanceMap[utils.VOICE].GetTotalValue(); rply != float64(5*time.Second) { t.Errorf("Expecting: %v, received: %v", @@ -156,7 +156,7 @@ func testSessionSRplApierRpcConn(t *testing.T) { func testSessionSRplTPFromFolder(t *testing.T) { attrs := &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "oldtutorial")} var loadInst utils.LoadInstance - if err := smgRplcMstrRPC.Call(utils.ApierV2LoadTariffPlanFromFolder, attrs, &loadInst); err != nil { + if err := smgRplcMstrRPC.Call(utils.APIerSv2LoadTariffPlanFromFolder, attrs, &loadInst); err != nil { t.Error(err) } time.Sleep(time.Duration(*waitRater) * time.Millisecond) // Give time for scheduler to execute topups @@ -281,7 +281,7 @@ func testSessionSRplInitiate(t *testing.T) { Tenant: "cgrates.org", Account: "1005", } - if err := smgRplcMstrRPC.Call(utils.ApierV2GetAccount, attrs, &acnt); err != nil { + if err := smgRplcMstrRPC.Call(utils.APIerSv2GetAccount, attrs, &acnt); err != nil { t.Error(err) // a tolerance of +/- 5ms is acceptable } else if rply := acnt.BalanceMap[utils.VOICE].GetTotalValue(); rply < float64(5*time.Second-25*time.Millisecond) || rply > float64(5*time.Second-15*time.Millisecond) { @@ -354,7 +354,7 @@ func testSessionSRplCheckAccount(t *testing.T) { Account: "1005", } - if err := smgRplcSlvRPC.Call(utils.ApierV2GetAccount, attrs, &acnt); err != nil { + if err := smgRplcSlvRPC.Call(utils.APIerSv2GetAccount, attrs, &acnt); err != nil { t.Error(err) // a tolerance of +/- 5ms is acceptable } else if rply := acnt.BalanceMap[utils.VOICE].GetTotalValue(); rply < float64(5*time.Second-45*time.Millisecond) || rply > float64(5*time.Second-30*time.Millisecond) { @@ -409,7 +409,7 @@ func testSessionSRplTerminate(t *testing.T) { Account: "1005", } - if err := smgRplcSlvRPC.Call(utils.ApierV2GetAccount, attrs, &acnt); err != nil { + if err := smgRplcSlvRPC.Call(utils.APIerSv2GetAccount, attrs, &acnt); err != nil { t.Error(err) // a tolerance of +/- 5ms is acceptable } else if rply := acnt.BalanceMap[utils.VOICE].GetTotalValue(); rply != float64(3*time.Second) { diff --git a/general_tests/sessionrefund_it_test.go b/general_tests/sessionrefund_it_test.go index 8e6511e82..b77dae265 100644 --- a/general_tests/sessionrefund_it_test.go +++ b/general_tests/sessionrefund_it_test.go @@ -110,7 +110,7 @@ func testSrItRPCConn(t *testing.T) { func testSrItLoadFromFolder(t *testing.T) { var reply string attrs := &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "oldtutorial")} - if err := srrpc.Call(utils.ApierV1LoadTariffPlanFromFolder, attrs, &reply); err != nil { + if err := srrpc.Call(utils.APIerSv1LoadTariffPlanFromFolder, attrs, &reply); err != nil { t.Error(err) } time.Sleep(500 * time.Millisecond) @@ -122,7 +122,7 @@ func testAccountBalance(t *testing.T, sracc, srten, balType string, expected flo Tenant: srten, Account: sracc, } - if err := srrpc.Call(utils.ApierV2GetAccount, attrs, &acnt); err != nil { + if err := srrpc.Call(utils.APIerSv2GetAccount, attrs, &acnt); err != nil { t.Error(err) } else if rply := acnt.BalanceMap[balType].GetTotalValue(); rply != expected { t.Errorf("Expecting: %v, received: %v", @@ -142,7 +142,7 @@ func testSrItAddVoiceBalance(t *testing.T) { }, } var reply string - if err := srrpc.Call(utils.ApierV2SetBalance, attrSetBalance, &reply); err != nil { + if err := srrpc.Call(utils.APIerSv2SetBalance, attrSetBalance, &reply); err != nil { t.Error(err) } else if reply != utils.OK { t.Errorf("Received: %s", reply) @@ -231,7 +231,7 @@ func testSrItAddMonetaryBalance(t *testing.T) { }, } var reply string - if err := srrpc.Call(utils.ApierV2SetBalance, attrs, &reply); err != nil { + if err := srrpc.Call(utils.APIerSv2SetBalance, attrs, &reply); err != nil { t.Error(err) } else if reply != utils.OK { t.Errorf("Received: %s", reply) diff --git a/general_tests/sessions_concur_test.go b/general_tests/sessions_concur_test.go index 5462cf55b..d77add68b 100644 --- a/general_tests/sessions_concur_test.go +++ b/general_tests/sessions_concur_test.go @@ -120,7 +120,7 @@ func testSCncrKillEngine(t *testing.T) { func testSCncrLoadTP(t *testing.T) { var loadInst string - if err := sCncrRPC.Call(utils.ApierV1LoadTariffPlanFromFolder, + if err := sCncrRPC.Call(utils.APIerSv1LoadTariffPlanFromFolder, &utils.AttrLoadTpFromFolder{FolderPath: path.Join( *dataDir, "tariffplans", "tp1cnt")}, &loadInst); err != nil { t.Error(err) @@ -140,7 +140,7 @@ func testSCncrLoadTP(t *testing.T) { }, } var resAttrSet string - if err := sCncrRPC.Call(utils.ApierV2SetAttributeProfile, attrPrfl, &resAttrSet); err != nil { + if err := sCncrRPC.Call(utils.APIerSv2SetAttributeProfile, attrPrfl, &resAttrSet); err != nil { t.Error(err) } else if resAttrSet != utils.OK { t.Errorf("unexpected reply returned: <%s>", resAttrSet) @@ -164,7 +164,7 @@ func testSCncrRunSessions(t *testing.T) { }, } var addBlcRply string - if err = sCncrRPC.Call(utils.ApierV1AddBalance, argsAddBalance, &addBlcRply); err != nil { + if err = sCncrRPC.Call(utils.APIerSv1AddBalance, argsAddBalance, &addBlcRply); err != nil { t.Error(err) } else if addBlcRply != utils.OK { t.Errorf("received: <%s>", addBlcRply) @@ -182,7 +182,7 @@ func testSCncrRunSessions(t *testing.T) { acntAttrs := &utils.AttrGetAccount{ Tenant: "cgrates.org", Account: acntID} - if err = sCncrRPC.Call(utils.ApierV2GetAccount, acntAttrs, &acnt); err != nil { + if err = sCncrRPC.Call(utils.APIerSv2GetAccount, acntAttrs, &acnt); err != nil { return } else if vcBlnc := acnt.BalanceMap[utils.VOICE].GetTotalValue(); float64(bufferTopup.Nanoseconds())-vcBlnc > 1000000.0 { // eliminate rounding errors t.Errorf("unexpected voice balance received: %+v", utils.ToIJSON(acnt)) @@ -215,10 +215,10 @@ func testRunSession(t *testing.T) { utils.Weight: 10, }, } - if err = sCncrRPC.Call(utils.ApierV1AddBalance, argsAddBalance, &addBlcRply); err != nil { + if err = sCncrRPC.Call(utils.APIerSv1AddBalance, argsAddBalance, &addBlcRply); err != nil { t.Error(err) } else if addBlcRply != utils.OK { - t.Errorf("received: <%s> to ApierV1.AddBalance", addBlcRply) + t.Errorf("received: <%s> to APIerSv1.AddBalance", addBlcRply) } time.Sleep(time.Duration( utils.RandomInteger(0, 100)) * time.Millisecond) // randomize between tests @@ -345,7 +345,7 @@ func testRunSession(t *testing.T) { time.Sleep(time.Duration(20) * time.Millisecond) var cdrs []*engine.ExternalCDR argCDRs := utils.RPCCDRsFilter{OriginIDs: []string{originID}} - if err := sCncrRPC.Call(utils.ApierV2GetCDRs, argCDRs, &cdrs); err != nil { + if err := sCncrRPC.Call(utils.APIerSv2GetCDRs, argCDRs, &cdrs); err != nil { t.Error(err) } else if len(cdrs) != 1 { t.Errorf("unexpected number of CDRs returned: %d", len(cdrs)) diff --git a/general_tests/supplier_it_test.go b/general_tests/supplier_it_test.go index fe95b39b3..95cf8bbfa 100644 --- a/general_tests/supplier_it_test.go +++ b/general_tests/supplier_it_test.go @@ -117,7 +117,7 @@ func testV1SplSRpcConn(t *testing.T) { func testV1SplSFromFolder(t *testing.T) { var reply string attrs := &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "testit")} - if err := splSv1Rpc.Call(utils.ApierV1LoadTariffPlanFromFolder, attrs, &reply); err != nil { + if err := splSv1Rpc.Call(utils.APIerSv1LoadTariffPlanFromFolder, attrs, &reply); err != nil { t.Error(err) } time.Sleep(100 * time.Millisecond) @@ -125,7 +125,7 @@ func testV1SplSFromFolder(t *testing.T) { func testV1SplSSetSupplierProfilesWithoutRatingPlanIDs(t *testing.T) { var reply *engine.SupplierProfile - if err := splSv1Rpc.Call(utils.ApierV1GetSupplierProfile, + if err := splSv1Rpc.Call(utils.APIerSv1GetSupplierProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "TEST_PROFILE2"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) @@ -148,12 +148,12 @@ func testV1SplSSetSupplierProfilesWithoutRatingPlanIDs(t *testing.T) { }, } var result string - if err := splSv1Rpc.Call(utils.ApierV1SetSupplierProfile, splPrf, &result); err != nil { + if err := splSv1Rpc.Call(utils.APIerSv1SetSupplierProfile, splPrf, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } - if err := splSv1Rpc.Call(utils.ApierV1GetSupplierProfile, + if err := splSv1Rpc.Call(utils.APIerSv1GetSupplierProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "TEST_PROFILE2"}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(splPrf.SupplierProfile, reply) { @@ -177,7 +177,7 @@ func testV1SplSSetSupplierProfilesWithoutRatingPlanIDs(t *testing.T) { ev, &suplsReply); err.Error() != utils.NewErrServerError(utils.NewErrMandatoryIeMissing("RatingPlanIDs")).Error() { t.Errorf("Expected error MANDATORY_IE_MISSING: [RatingPlanIDs] recieved:%v\n", err) } - if err := splSv1Rpc.Call(utils.ApierV1RemoveSupplierProfile, utils.TenantID{ + if err := splSv1Rpc.Call(utils.APIerSv1RemoveSupplierProfile, utils.TenantID{ Tenant: splPrf.Tenant, ID: splPrf.ID, }, &result); err != nil { @@ -189,7 +189,7 @@ func testV1SplSSetSupplierProfilesWithoutRatingPlanIDs(t *testing.T) { func testV1SplSAddNewSplPrf(t *testing.T) { var reply *engine.SupplierProfile - if err := splSv1Rpc.Call(utils.ApierV1GetSupplierProfile, + if err := splSv1Rpc.Call(utils.APIerSv1GetSupplierProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "SPL_ResourceTest"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) @@ -227,12 +227,12 @@ func testV1SplSAddNewSplPrf(t *testing.T) { }, } var result string - if err := splSv1Rpc.Call(utils.ApierV1SetSupplierProfile, splPrf, &result); err != nil { + if err := splSv1Rpc.Call(utils.APIerSv1SetSupplierProfile, splPrf, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } - if err := splSv1Rpc.Call(utils.ApierV1GetSupplierProfile, + if err := splSv1Rpc.Call(utils.APIerSv1GetSupplierProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "SPL_ResourceTest"}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(splPrf.SupplierProfile, reply) { @@ -260,7 +260,7 @@ func testV1SplSAddNewResPrf(t *testing.T) { }, } - if err := splSv1Rpc.Call(utils.ApierV1SetResourceProfile, rPrf, &result); err != nil { + if err := splSv1Rpc.Call(utils.APIerSv1SetResourceProfile, rPrf, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -283,7 +283,7 @@ func testV1SplSAddNewResPrf(t *testing.T) { }, } - if err := splSv1Rpc.Call(utils.ApierV1SetResourceProfile, rPrf2, &result); err != nil { + if err := splSv1Rpc.Call(utils.APIerSv1SetResourceProfile, rPrf2, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -306,7 +306,7 @@ func testV1SplSAddNewResPrf(t *testing.T) { }, } - if err := splSv1Rpc.Call(utils.ApierV1SetResourceProfile, rPrf3, &result); err != nil { + if err := splSv1Rpc.Call(utils.APIerSv1SetResourceProfile, rPrf3, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -329,7 +329,7 @@ func testV1SplSAddNewResPrf(t *testing.T) { }, } - if err := splSv1Rpc.Call(utils.ApierV1SetResourceProfile, rPrf4, &result); err != nil { + if err := splSv1Rpc.Call(utils.APIerSv1SetResourceProfile, rPrf4, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -462,7 +462,7 @@ func testV1SplSGetSortedSuppliers(t *testing.T) { func testV1SplSAddNewSplPrf2(t *testing.T) { var reply *engine.SupplierProfile - if err := splSv1Rpc.Call(utils.ApierV1GetSupplierProfile, + if err := splSv1Rpc.Call(utils.APIerSv1GetSupplierProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "SPL_ResourceDescendent"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) @@ -500,12 +500,12 @@ func testV1SplSAddNewSplPrf2(t *testing.T) { }, } var result string - if err := splSv1Rpc.Call(utils.ApierV1SetSupplierProfile, splPrf, &result); err != nil { + if err := splSv1Rpc.Call(utils.APIerSv1SetSupplierProfile, splPrf, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } - if err := splSv1Rpc.Call(utils.ApierV1GetSupplierProfile, + if err := splSv1Rpc.Call(utils.APIerSv1GetSupplierProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "SPL_ResourceDescendent"}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(splPrf.SupplierProfile, reply) { diff --git a/general_tests/suretax_it_test.go b/general_tests/suretax_it_test.go index d457b9200..5925d6e36 100644 --- a/general_tests/suretax_it_test.go +++ b/general_tests/suretax_it_test.go @@ -108,7 +108,7 @@ func testSTIRpcConn(t *testing.T) { // Load the tariff plan, creating accounts and their balances func testSTILoadTariffPlanFromFolder(t *testing.T) { attrs := &utils.AttrLoadTpFromFolder{FolderPath: *tpDir} - if err := stiRpc.Call(utils.ApierV2LoadTariffPlanFromFolder, attrs, &stiLoadInst); err != nil { + if err := stiRpc.Call(utils.APIerSv2LoadTariffPlanFromFolder, attrs, &stiLoadInst); err != nil { t.Error(err) } else if stiLoadInst.RatingLoadID == "" || stiLoadInst.AccountingLoadID == "" { t.Error("Empty loadId received, loadInstance: ", stiLoadInst) @@ -121,10 +121,10 @@ func testSTICacheStats(t *testing.T) { var rcvStats *utils.CacheStats expectedStats := &utils.CacheStats{Destinations: 1, RatingPlans: 1, RatingProfiles: 1} var args utils.AttrCacheStats - if err := stiRpc.Call(utils.ApierV2GetCacheStats, args, &rcvStats); err != nil { - t.Error("Got error on ApierV2.GetCacheStats: ", err.Error()) + if err := stiRpc.Call(utils.APIerSv2GetCacheStats, args, &rcvStats); err != nil { + t.Error("Got error on APIerSv2.GetCacheStats: ", err.Error()) } else if !reflect.DeepEqual(expectedStats, rcvStats) { - t.Errorf("Calling ApierV2.GetCacheStats expected: %+v, received: %+v", expectedStats, rcvStats) + t.Errorf("Calling APIerSv2.GetCacheStats expected: %+v, received: %+v", expectedStats, rcvStats) } } @@ -148,7 +148,7 @@ func testSTIProcessExternalCdr(t *testing.T) { func testSTIGetCdrs(t *testing.T) { var cdrs []*engine.ExternalCDR req := utils.RPCCDRsFilter{RunIDs: []string{utils.MetaDefault}, Accounts: []string{"1001"}} - if err := stiRpc.Call(utils.ApierV2GetCDRs, req, &cdrs); err != nil { + if err := stiRpc.Call(utils.APIerSv2GetCDRs, req, &cdrs); err != nil { t.Error("Unexpected error: ", err.Error()) } else if len(cdrs) != 1 { t.Error("Unexpected number of CDRs returned: ", len(cdrs)) @@ -158,7 +158,7 @@ func testSTIGetCdrs(t *testing.T) { } } req = utils.RPCCDRsFilter{RunIDs: []string{utils.META_SURETAX}, Accounts: []string{"1001"}} - if err := stiRpc.Call(utils.ApierV2GetCDRs, req, &cdrs); err != nil { + if err := stiRpc.Call(utils.APIerSv2GetCDRs, req, &cdrs); err != nil { t.Error("Unexpected error: ", err.Error()) } else if len(cdrs) != 1 { t.Error("Unexpected number of CDRs returned: ", len(cdrs)) diff --git a/general_tests/tp_it_test.go b/general_tests/tp_it_test.go index 124dc0151..da02e8984 100644 --- a/general_tests/tp_it_test.go +++ b/general_tests/tp_it_test.go @@ -124,7 +124,7 @@ func testTpRpcConn(t *testing.T) { // Load the tariff plan, creating accounts and their balances func testTpLoadTariffPlanFromFolder(t *testing.T) { attrs := &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "testtp")} - if err := tpRPC.Call(utils.ApierV2LoadTariffPlanFromFolder, attrs, &tpLoadInst); err != nil { + if err := tpRPC.Call(utils.APIerSv2LoadTariffPlanFromFolder, attrs, &tpLoadInst); err != nil { t.Error(err) } time.Sleep(time.Duration(*waitRater) * time.Millisecond) // Give time for scheduler to execute topups @@ -151,22 +151,22 @@ func testTpBalanceCounter(t *testing.T) { } var acnt *engine.Account attrs := &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "1001"} - if err := tpRPC.Call(utils.ApierV2GetAccount, attrs, &acnt); err != nil { - t.Error("Got error on ApierV2.GetAccount: ", err.Error()) + if err := tpRPC.Call(utils.APIerSv2GetAccount, attrs, &acnt); err != nil { + t.Error("Got error on APIerSv2.GetAccount: ", err.Error()) } else if acnt.UnitCounters[utils.MONETARY][1].Counters[0].Value != 20.0 { - t.Errorf("Calling ApierV2.GetBalance received: %s", utils.ToIJSON(acnt)) + t.Errorf("Calling APIerSv2.GetBalance received: %s", utils.ToIJSON(acnt)) } } func testTpActionTriggers(t *testing.T) { var atrs engine.ActionTriggers - if err := tpRPC.Call(utils.ApierV1GetActionTriggers, v1.AttrGetActionTriggers{GroupIDs: []string{}}, &atrs); err != nil { - t.Error("Got error on ApierV1.GetActionTriggers: ", err.Error()) + if err := tpRPC.Call(utils.APIerSv1GetActionTriggers, v1.AttrGetActionTriggers{GroupIDs: []string{}}, &atrs); err != nil { + t.Error("Got error on APIerSv1.GetActionTriggers: ", err.Error()) } else if len(atrs) != 4 { t.Errorf("Calling v1.GetActionTriggers got: %v", atrs) } var reply string - if err := tpRPC.Call(utils.ApierV1SetActionTrigger, v1.AttrSetActionTrigger{ + if err := tpRPC.Call(utils.APIerSv1SetActionTrigger, v1.AttrSetActionTrigger{ GroupID: "TestATR", UniqueID: "Unique atr id", ActionTrigger: map[string]interface{}{ @@ -177,13 +177,13 @@ func testTpActionTriggers(t *testing.T) { } else if reply != utils.OK { t.Errorf("Calling v1.SetActionTrigger got: %v", reply) } - if err := tpRPC.Call(utils.ApierV1GetActionTriggers, v1.AttrGetActionTriggers{GroupIDs: []string{}}, &atrs); err != nil { + if err := tpRPC.Call(utils.APIerSv1GetActionTriggers, v1.AttrGetActionTriggers{GroupIDs: []string{}}, &atrs); err != nil { t.Error(err) } else if len(atrs) != 5 { t.Errorf("Calling v1.GetActionTriggers got: %v", atrs) } - if err := tpRPC.Call(utils.ApierV1GetActionTriggers, v1.AttrGetActionTriggers{GroupIDs: []string{"TestATR"}}, &atrs); err != nil { - t.Error("Got error on ApierV1.GetActionTriggers: ", err.Error()) + if err := tpRPC.Call(utils.APIerSv1GetActionTriggers, v1.AttrGetActionTriggers{GroupIDs: []string{"TestATR"}}, &atrs); err != nil { + t.Error("Got error on APIerSv1.GetActionTriggers: ", err.Error()) } else if len(atrs) != 1 { t.Errorf("Calling v1.GetActionTriggers got: %v", atrs) } @@ -204,8 +204,8 @@ func testTpActionTriggers(t *testing.T) { func testTpZeroCost(t *testing.T) { var acnt *engine.Account attrs := &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "1012"} - if err := tpRPC.Call(utils.ApierV2GetAccount, attrs, &acnt); err != nil { - t.Error("Got error on ApierV2.GetAccount: ", err.Error()) + if err := tpRPC.Call(utils.APIerSv2GetAccount, attrs, &acnt); err != nil { + t.Error("Got error on APIerSv2.GetAccount: ", err.Error()) } if acnt == nil { t.Errorf("Expecting acnt to not be nil") @@ -234,10 +234,10 @@ func testTpZeroCost(t *testing.T) { } else if cc.GetDuration() != 20*time.Second { t.Errorf("Calling Responder.MaxDebit got callcost: %v", utils.ToIJSON(cc)) } - if err := tpRPC.Call(utils.ApierV2GetAccount, attrs, &acnt); err != nil { - t.Error("Got error on ApierV2.GetAccount: ", err.Error()) + if err := tpRPC.Call(utils.APIerSv2GetAccount, attrs, &acnt); err != nil { + t.Error("Got error on APIerSv2.GetAccount: ", err.Error()) } else if acnt.BalanceMap[utils.MONETARY][0].Value != balanceValueBefore { - t.Errorf("Calling ApierV2.GetAccount received: %s", utils.ToIJSON(acnt)) + t.Errorf("Calling APIerSv2.GetAccount received: %s", utils.ToIJSON(acnt)) } } @@ -263,52 +263,52 @@ func testTpZeroNegativeCost(t *testing.T) { } var acnt engine.Account attrs := &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "1013"} - if err := tpRPC.Call(utils.ApierV2GetAccount, attrs, &acnt); err != nil { - t.Error("Got error on ApierV2.GetAccount: ", err.Error()) + if err := tpRPC.Call(utils.APIerSv2GetAccount, attrs, &acnt); err != nil { + t.Error("Got error on APIerSv2.GetAccount: ", err.Error()) } else if acnt.BalanceMap[utils.VOICE][0].Value != 100.0 { - t.Errorf("Calling ApierV2.GetAccount received: %s", utils.ToIJSON(acnt)) + t.Errorf("Calling APIerSv2.GetAccount received: %s", utils.ToIJSON(acnt)) } } func testTpExecuteActionCgrRpc(t *testing.T) { var reply string - if err := tpRPC.Call(utils.ApierV2ExecuteAction, utils.AttrExecuteAction{ActionsId: "RPC"}, &reply); err != nil { - t.Error("Got error on ApierV2.ExecuteAction: ", err.Error()) + if err := tpRPC.Call(utils.APIerSv2ExecuteAction, utils.AttrExecuteAction{ActionsId: "RPC"}, &reply); err != nil { + t.Error("Got error on APIerSv2.ExecuteAction: ", err.Error()) } else if reply != utils.OK { t.Errorf("Calling ExecuteAction got reply: %s", reply) } var acnt engine.Account attrs := &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "1013"} - if err := tpRPC.Call(utils.ApierV2GetAccount, attrs, &acnt); err != nil { - t.Error("Got error on ApierV2.GetAccount: ", err.Error()) + if err := tpRPC.Call(utils.APIerSv2GetAccount, attrs, &acnt); err != nil { + t.Error("Got error on APIerSv2.GetAccount: ", err.Error()) } } func testTpExecuteActionCgrRpcAcc(t *testing.T) { var reply string - if err := tpRPC.Call(utils.ApierV2ExecuteAction, utils.AttrExecuteAction{ + if err := tpRPC.Call(utils.APIerSv2ExecuteAction, utils.AttrExecuteAction{ Tenant: "cgrates.org", Account: "1016", ActionsId: "RPC_DEST", }, &reply); err != nil { - t.Error("Got error on ApierV2.ExecuteAction: ", err.Error()) + t.Error("Got error on APIerSv2.ExecuteAction: ", err.Error()) } else if reply != utils.OK { t.Errorf("Calling ExecuteAction got reply: %s", reply) } var dests []*engine.Destination attrs := &v2.AttrGetDestinations{DestinationIDs: []string{}} - if err := tpRPC.Call(utils.ApierV2GetDestinations, attrs, &dests); err != nil { - t.Error("Got error on ApierV2.GetDestinations: ", err.Error()) + if err := tpRPC.Call(utils.APIerSv2GetDestinations, attrs, &dests); err != nil { + t.Error("Got error on APIerSv2.GetDestinations: ", err.Error()) } } // Deprecated // func //(t *testing.T) { // var reply string -// if err := tpRPC.Call(utils.ApierV2ExecuteAction, utils.AttrExecuteAction{ +// if err := tpRPC.Call(utils.APIerSv2ExecuteAction, utils.AttrExecuteAction{ // ActionsId: "RPC_CDRSTATS", // }, &reply); err != nil { -// t.Error("Got error on ApierV2.ExecuteAction: ", err.Error()) +// t.Error("Got error on APIerSv2.ExecuteAction: ", err.Error()) // } else if reply != utils.OK { // t.Errorf("Calling ExecuteAction got reply: %s", reply) // } @@ -321,7 +321,7 @@ func testTpExecuteActionCgrRpcAcc(t *testing.T) { func testTpCreateExecuteActionMatch(t *testing.T) { var reply string - if err := tpRPC.Call(utils.ApierV2SetActions, utils.AttrSetActions{ + if err := tpRPC.Call(utils.APIerSv2SetActions, utils.AttrSetActions{ ActionsId: "PAYMENT_2056bd2fe137082970f97102b64e42fd", Actions: []*utils.TPAction{ { @@ -333,32 +333,32 @@ func testTpCreateExecuteActionMatch(t *testing.T) { }, }, }, &reply); err != nil { - t.Error("Got error on ApierV2.SetActions: ", err.Error()) + t.Error("Got error on APIerSv2.SetActions: ", err.Error()) } else if reply != utils.OK { - t.Errorf("Calling ApierV2.SetActions got reply: %s", reply) + t.Errorf("Calling APIerSv2.SetActions got reply: %s", reply) } - if err := tpRPC.Call(utils.ApierV2ExecuteAction, utils.AttrExecuteAction{ + if err := tpRPC.Call(utils.APIerSv2ExecuteAction, utils.AttrExecuteAction{ Tenant: "cgrates.org", Account: "1015", ActionsId: "PAYMENT_2056bd2fe137082970f97102b64e42fd", }, &reply); err != nil { - t.Error("Got error on ApierV2.ExecuteAction: ", err.Error()) + t.Error("Got error on APIerSv2.ExecuteAction: ", err.Error()) } else if reply != utils.OK { t.Errorf("Calling ExecuteAction got reply: %s", reply) } - if err := tpRPC.Call(utils.ApierV2ExecuteAction, utils.AttrExecuteAction{ + if err := tpRPC.Call(utils.APIerSv2ExecuteAction, utils.AttrExecuteAction{ Tenant: "cgrates.org", Account: "1015", ActionsId: "PAYMENT_2056bd2fe137082970f97102b64e42fd", }, &reply); err != nil { - t.Error("Got error on ApierV2.ExecuteAction: ", err.Error()) + t.Error("Got error on APIerSv2.ExecuteAction: ", err.Error()) } else if reply != utils.OK { t.Errorf("Calling ExecuteAction got reply: %s", reply) } var acnt engine.Account attrs := &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "1015"} - if err := tpRPC.Call(utils.ApierV2GetAccount, attrs, &acnt); err != nil { - t.Error("Got error on ApierV2.GetAccount: ", err.Error()) + if err := tpRPC.Call(utils.APIerSv2GetAccount, attrs, &acnt); err != nil { + t.Error("Got error on APIerSv2.GetAccount: ", err.Error()) } if len(acnt.BalanceMap) != 1 || len(acnt.BalanceMap[utils.MONETARY]) != 1 || @@ -369,7 +369,7 @@ func testTpCreateExecuteActionMatch(t *testing.T) { func testTpSetRemoveActions(t *testing.T) { var reply string - if err := tpRPC.Call(utils.ApierV2SetActions, utils.AttrSetActions{ + if err := tpRPC.Call(utils.APIerSv2SetActions, utils.AttrSetActions{ ActionsId: "TO_BE_DELETED", Actions: []*utils.TPAction{ { @@ -381,54 +381,54 @@ func testTpSetRemoveActions(t *testing.T) { }, }, }, &reply); err != nil { - t.Error("Got error on ApierV2.SetActions: ", err.Error()) + t.Error("Got error on APIerSv2.SetActions: ", err.Error()) } else if reply != utils.OK { - t.Errorf("Calling ApierV2.SetActions got reply: %s", reply) + t.Errorf("Calling APIerSv2.SetActions got reply: %s", reply) } actionsMap := make(map[string]engine.Actions) - if err := tpRPC.Call(utils.ApierV2GetActions, v2.AttrGetActions{ + if err := tpRPC.Call(utils.APIerSv2GetActions, v2.AttrGetActions{ ActionIDs: []string{"PAYMENT_2056bd2fe137082970f97102b64e42fd"}, }, &actionsMap); err != nil { - t.Error("Got error on ApierV2.GetActions: ", err.Error()) + t.Error("Got error on APIerSv2.GetActions: ", err.Error()) } else if len(actionsMap) != 1 { - t.Errorf("Calling ApierV2.GetActions got reply: %s", utils.ToIJSON(actionsMap)) + t.Errorf("Calling APIerSv2.GetActions got reply: %s", utils.ToIJSON(actionsMap)) } - if err := tpRPC.Call(utils.ApierV2RemoveActions, v1.AttrRemoveActions{ + if err := tpRPC.Call(utils.APIerSv2RemoveActions, v1.AttrRemoveActions{ ActionIDs: []string{"PAYMENT_2056bd2fe137082970f97102b64e42fd"}, }, &reply); err != nil { - t.Error("Got error on ApierV2.RemoveActions: ", err.Error()) + t.Error("Got error on APIerSv2.RemoveActions: ", err.Error()) } else if reply != utils.OK { - t.Errorf("Calling ApierV2.RemoveActions got reply: %s", reply) + t.Errorf("Calling APIerSv2.RemoveActions got reply: %s", reply) } - if err := tpRPC.Call(utils.ApierV2GetActions, v2.AttrGetActions{ + if err := tpRPC.Call(utils.APIerSv2GetActions, v2.AttrGetActions{ ActionIDs: []string{"PAYMENT_2056bd2fe137082970f97102b64e42fd"}, }, &actionsMap); err == nil { - t.Error("no error on ApierV2.GetActions: ", err) + t.Error("no error on APIerSv2.GetActions: ", err) } } func testTpRemoveActionsRefenced(t *testing.T) { actionsMap := make(map[string]engine.Actions) - if err := tpRPC.Call(utils.ApierV2GetActions, v2.AttrGetActions{ + if err := tpRPC.Call(utils.APIerSv2GetActions, v2.AttrGetActions{ ActionIDs: []string{"TOPUP_VOICE"}, }, &actionsMap); err != nil { - t.Error("Got error on ApierV2.GetActions: ", err.Error()) + t.Error("Got error on APIerSv2.GetActions: ", err.Error()) } else if len(actionsMap) != 1 { - t.Errorf("Calling ApierV2.GetActions got reply: %s", utils.ToIJSON(actionsMap)) + t.Errorf("Calling APIerSv2.GetActions got reply: %s", utils.ToIJSON(actionsMap)) } var reply string - if err := tpRPC.Call(utils.ApierV2RemoveActions, v1.AttrRemoveActions{ + if err := tpRPC.Call(utils.APIerSv2RemoveActions, v1.AttrRemoveActions{ ActionIDs: []string{"TOPUP_VOICE"}, }, &reply); err != nil { - t.Error("Error on ApierV2.RemoveActions: ", err.Error()) + t.Error("Error on APIerSv2.RemoveActions: ", err.Error()) } else if reply != utils.OK { - t.Errorf("Calling ApierV2.RemoveActions got reply: %s", reply) + t.Errorf("Calling APIerSv2.RemoveActions got reply: %s", reply) } /* - if err := tpRPC.Call(utils.ApierV2GetActions, v2.AttrGetActions{ + if err := tpRPC.Call(utils.APIerSv2GetActions, v2.AttrGetActions{ ActionIDs: []string{"PAYMENT_2056bd2fe137082970f97102b64e42fd"}, }, &actionsMap); err == nil { - t.Error("no error on ApierV2.GetActions: ", err) + t.Error("no error on APIerSv2.GetActions: ", err) } */ } @@ -436,23 +436,23 @@ func testTpRemoveActionsRefenced(t *testing.T) { func testTpApierResetAccountActionTriggers(t *testing.T) { var acnt engine.Account attrs := &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "1005"} - if err := tpRPC.Call(utils.ApierV2GetAccount, attrs, &acnt); err != nil { + if err := tpRPC.Call(utils.APIerSv2GetAccount, attrs, &acnt); err != nil { t.Error(err) } else if acnt.ActionTriggers[0].Executed != true { t.Skip("Skipping test since Executed is not yet true") } var reply string - if err := tpRPC.Call(utils.ApierV2ResetAccountActionTriggers, v1.AttrResetAccountActionTriggers{ + if err := tpRPC.Call(utils.APIerSv2ResetAccountActionTriggers, v1.AttrResetAccountActionTriggers{ Tenant: "cgrates.org", Account: "1005", GroupID: "STANDARD_TRIGGERS", Executed: true, }, &reply); err != nil { - t.Error("Error on ApierV2.ResetAccountActionTriggers: ", err.Error()) + t.Error("Error on APIerSv2.ResetAccountActionTriggers: ", err.Error()) } else if reply != utils.OK { - t.Errorf("Calling ApierV2.ResetAccountActionTriggers got reply: %s", reply) + t.Errorf("Calling APIerSv2.ResetAccountActionTriggers got reply: %s", reply) } - if err := tpRPC.Call(utils.ApierV2GetAccount, attrs, &acnt); err != nil { + if err := tpRPC.Call(utils.APIerSv2GetAccount, attrs, &acnt); err != nil { t.Error(err) } else if acnt.ActionTriggers[0].Executed == false { t.Errorf("wrong action trigger executed flag: %s", utils.ToIJSON(acnt.ActionTriggers)) diff --git a/general_tests/tut_smgeneric_it_test.go b/general_tests/tut_smgeneric_it_test.go index eb69eabe2..ae2394b2b 100644 --- a/general_tests/tut_smgeneric_it_test.go +++ b/general_tests/tut_smgeneric_it_test.go @@ -116,7 +116,7 @@ func testTutSMGRpcConn(t *testing.T) { // Load the tariff plan, creating accounts and their balances func testTutSMGLoadTariffPlanFromFolder(t *testing.T) { attrs := &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "oldtutorial")} - if err := tutSMGRpc.Call(utils.ApierV2LoadTariffPlanFromFolder, attrs, &smgLoadInst); err != nil { + if err := tutSMGRpc.Call(utils.APIerSv2LoadTariffPlanFromFolder, attrs, &smgLoadInst); err != nil { t.Error(err) } time.Sleep(time.Duration(*waitRater) * time.Millisecond) // Give time for scheduler to execute topups @@ -161,7 +161,7 @@ func testTutSMGCacheStats(t *testing.T) { if err := tutSMGRpc.Call(utils.CacheSv1GetCacheStats, new(utils.AttrCacheIDsWithArgDispatcher), &rcvStats); err != nil { t.Error("Got error on CacheSv1.GetCacheStats: ", err.Error()) } else if !reflect.DeepEqual(expectedStats, rcvStats) { - t.Errorf("Calling ApierV2.CacheSv1 expected: %+v,\n received: %+v", utils.ToJSON(expectedStats), utils.ToJSON(rcvStats)) + t.Errorf("Calling APIerSv2.CacheSv1 expected: %+v,\n received: %+v", utils.ToJSON(expectedStats), utils.ToJSON(rcvStats)) } } diff --git a/general_tests/tutorial2_it_test.go b/general_tests/tutorial2_it_test.go index e7750e857..4c31428d2 100644 --- a/general_tests/tutorial2_it_test.go +++ b/general_tests/tutorial2_it_test.go @@ -116,7 +116,7 @@ func testTutFromFolder(t *testing.T) { var reply string attrs := &utils.AttrLoadTpFromFolder{ FolderPath: path.Join(*dataDir, "tariffplans", "tutorial2")} - if err := tutRpc.Call(utils.ApierV1LoadTariffPlanFromFolder, + if err := tutRpc.Call(utils.APIerSv1LoadTariffPlanFromFolder, attrs, &reply); err != nil { t.Error(err) } @@ -132,7 +132,7 @@ func testTutGetCost(t *testing.T) { Usage: "45s", } var rply *engine.EventCost - if err := tutRpc.Call(utils.ApierV1GetCost, attrs, &rply); err != nil { + if err := tutRpc.Call(utils.APIerSv1GetCost, attrs, &rply); err != nil { t.Error("Unexpected nil error received: ", err.Error()) } else if *rply.Cost != 0.550000 { t.Errorf("Unexpected cost received: %f", *rply.Cost) @@ -144,7 +144,7 @@ func testTutGetCost(t *testing.T) { AnswerTime: "2019-03-11T09:00:00Z", Usage: "45s", } - if err := tutRpc.Call(utils.ApierV1GetCost, attrs, &rply); err != nil { + if err := tutRpc.Call(utils.APIerSv1GetCost, attrs, &rply); err != nil { t.Error("Unexpected nil error received: ", err.Error()) } else if *rply.Cost != 1.4 { t.Errorf("Unexpected cost received: %f", *rply.Cost) @@ -163,7 +163,7 @@ func testTutGetCost(t *testing.T) { AnswerTime: "*now", Usage: "45s", } - if err := tutRpc.Call(utils.ApierV1GetCost, attrs, &rply); err != nil { + if err := tutRpc.Call(utils.APIerSv1GetCost, attrs, &rply); err != nil { t.Error("Unexpected nil error received: ", err.Error()) } else if *rply.Cost != 1.4 { t.Errorf("Unexpected cost received: %f", *rply.Cost) @@ -175,7 +175,7 @@ func testTutGetCost(t *testing.T) { AnswerTime: "2020-01-01T21:00:00Z", Usage: "45s", } - if err := tutRpc.Call(utils.ApierV1GetCost, attrs, &rply); err != nil { + if err := tutRpc.Call(utils.APIerSv1GetCost, attrs, &rply); err != nil { t.Error("Unexpected nil error received: ", err.Error()) } else if *rply.Cost != 0.55 { t.Errorf("Unexpected cost received: %f", *rply.Cost) @@ -187,7 +187,7 @@ func testTutGetCost(t *testing.T) { AnswerTime: "2019-03-11T21:00:00Z", Usage: "45s", } - if err := tutRpc.Call(utils.ApierV1GetCost, attrs, &rply); err != nil { + if err := tutRpc.Call(utils.APIerSv1GetCost, attrs, &rply); err != nil { t.Error("Unexpected nil error received: ", err.Error()) } else if *rply.Cost != 0.55 { t.Errorf("Unexpected cost received: %f", *rply.Cost) @@ -199,7 +199,7 @@ func testTutGetCost(t *testing.T) { AnswerTime: "2019-03-11T09:00:00Z", Usage: "1m", } - if err := tutRpc.Call(utils.ApierV1GetCost, attrs, &rply); err == nil || + if err := tutRpc.Call(utils.APIerSv1GetCost, attrs, &rply); err == nil || err.Error() != "SERVER_ERROR: UNAUTHORIZED_DESTINATION" { t.Error("Unexpected nil error received: ", err) } @@ -210,7 +210,7 @@ func testTutGetCost(t *testing.T) { AnswerTime: "*now", Usage: "2048", } - if err := tutRpc.Call(utils.ApierV1GetCost, attrs, &rply); err != nil { + if err := tutRpc.Call(utils.APIerSv1GetCost, attrs, &rply); err != nil { t.Error("Unexpected nil error received: ", err.Error()) } else if *rply.Cost != 2.0 { // FixMe: missing ConnectFee out of Cost t.Errorf("Unexpected cost received: %f", *rply.Cost) @@ -223,7 +223,7 @@ func testTutGetCost(t *testing.T) { AnswerTime: "*now", Usage: "1", } - if err := tutRpc.Call(utils.ApierV1GetCost, attrs, &rply); err != nil { + if err := tutRpc.Call(utils.APIerSv1GetCost, attrs, &rply); err != nil { t.Error("Unexpected nil error received: ", err.Error()) } else if *rply.Cost != 0.1 { t.Errorf("Unexpected cost received: %f", *rply.Cost) @@ -236,7 +236,7 @@ func testTutGetCost(t *testing.T) { AnswerTime: "*now", Usage: "1", } - if err := tutRpc.Call(utils.ApierV1GetCost, attrs, &rply); err != nil { + if err := tutRpc.Call(utils.APIerSv1GetCost, attrs, &rply); err != nil { t.Error("Unexpected nil error received: ", err.Error()) } else if *rply.Cost != 0.2 { t.Errorf("Unexpected cost received: %f", *rply.Cost) @@ -249,7 +249,7 @@ func testTutGetCost(t *testing.T) { AnswerTime: "*now", Usage: "1", } - if err := tutRpc.Call(utils.ApierV1GetCost, attrs, &rply); err == nil || + if err := tutRpc.Call(utils.APIerSv1GetCost, attrs, &rply); err == nil || err.Error() != "SERVER_ERROR: UNAUTHORIZED_DESTINATION" { t.Error("Unexpected nil error received: ", err) } @@ -261,7 +261,7 @@ func testTutGetCost(t *testing.T) { AnswerTime: "*now", Usage: "5m", } - if err := tutRpc.Call(utils.ApierV1GetCost, attrs, &rply); err != nil { + if err := tutRpc.Call(utils.APIerSv1GetCost, attrs, &rply); err != nil { t.Error("Unexpected nil error received: ", err.Error()) } else if *rply.Cost != 0.1 { t.Errorf("Unexpected cost received: %f", *rply.Cost) @@ -271,7 +271,7 @@ func testTutGetCost(t *testing.T) { func testTutAccounts(t *testing.T) { // make sure Account was created var acnt *engine.Account - if err := tutRpc.Call(utils.ApierV2GetAccount, + if err := tutRpc.Call(utils.APIerSv2GetAccount, &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "1001"}, &acnt); err != nil { t.Fatal(err) @@ -300,10 +300,10 @@ func testTutAccounts(t *testing.T) { }, } var rplySetBlc string - if err := tutRpc.Call(utils.ApierV1SetBalance, attrBlc, &rplySetBlc); err != nil { - t.Error("Got error on ApierV1.SetBalance: ", err.Error()) + if err := tutRpc.Call(utils.APIerSv1SetBalance, attrBlc, &rplySetBlc); err != nil { + t.Error("Got error on APIerSv1.SetBalance: ", err.Error()) } - if err := tutRpc.Call(utils.ApierV2GetAccount, + if err := tutRpc.Call(utils.APIerSv2GetAccount, &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "1001"}, &acnt); err != nil { t.Error(err) @@ -320,10 +320,10 @@ func testTutAccounts(t *testing.T) { utils.ID: utils.MetaDefault, }, } - if err := tutRpc.Call(utils.ApierV1SetBalance, attrBlc, &rplySetBlc); err != nil { - t.Error("Got error on ApierV1.SetBalance: ", err.Error()) + if err := tutRpc.Call(utils.APIerSv1SetBalance, attrBlc, &rplySetBlc); err != nil { + t.Error("Got error on APIerSv1.SetBalance: ", err.Error()) } - if err := tutRpc.Call(utils.ApierV2GetAccount, + if err := tutRpc.Call(utils.APIerSv2GetAccount, &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "1001"}, &acnt); err != nil { t.Error(err) @@ -332,7 +332,7 @@ func testTutAccounts(t *testing.T) { } // enable the account again var rplySetAcnt string - if err := tutRpc.Call(utils.ApierV2SetAccount, + if err := tutRpc.Call(utils.APIerSv2SetAccount, v2.AttrSetAccount{ Tenant: "cgrates.org", Account: "1001", @@ -343,7 +343,7 @@ func testTutAccounts(t *testing.T) { t.Error(err) } acnt = new(engine.Account) - if err := tutRpc.Call(utils.ApierV2GetAccount, + if err := tutRpc.Call(utils.APIerSv2GetAccount, &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "1001"}, &acnt); err != nil { t.Error(err) diff --git a/general_tests/tutorial_calls_test.go b/general_tests/tutorial_calls_test.go index 5ccfead0a..f5577a8b9 100755 --- a/general_tests/tutorial_calls_test.go +++ b/general_tests/tutorial_calls_test.go @@ -251,7 +251,7 @@ func testCallRpcConn(t *testing.T) { func testCallLoadTariffPlanFromFolder(t *testing.T) { var reply string attrs := &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "tutorial")} - if err := tutorialCallsRpc.Call(utils.ApierV1LoadTariffPlanFromFolder, attrs, &reply); err != nil { + if err := tutorialCallsRpc.Call(utils.APIerSv1LoadTariffPlanFromFolder, attrs, &reply); err != nil { t.Error(err) } time.Sleep(time.Duration(*waitRater) * time.Millisecond) // Give time for scheduler to execute topups @@ -261,24 +261,24 @@ func testCallLoadTariffPlanFromFolder(t *testing.T) { func testCallAccountsBefore(t *testing.T) { var reply *engine.Account attrs := &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "1001"} - if err := tutorialCallsRpc.Call(utils.ApierV2GetAccount, attrs, &reply); err != nil { - t.Error("Got error on ApierV2.GetAccount: ", err.Error()) + if err := tutorialCallsRpc.Call(utils.APIerSv2GetAccount, attrs, &reply); err != nil { + t.Error("Got error on APIerSv2.GetAccount: ", err.Error()) } else if reply.BalanceMap[utils.MONETARY].GetTotalValue() != 10.0 { - t.Errorf("Calling ApierV1.GetBalance received: %f", reply.BalanceMap[utils.MONETARY].GetTotalValue()) + t.Errorf("Calling APIerSv1.GetBalance received: %f", reply.BalanceMap[utils.MONETARY].GetTotalValue()) } var reply2 *engine.Account attrs2 := &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "1002"} - if err := tutorialCallsRpc.Call(utils.ApierV2GetAccount, attrs2, &reply2); err != nil { - t.Error("Got error on ApierV2.GetAccount: ", err.Error()) + if err := tutorialCallsRpc.Call(utils.APIerSv2GetAccount, attrs2, &reply2); err != nil { + t.Error("Got error on APIerSv2.GetAccount: ", err.Error()) } else if reply2.BalanceMap[utils.MONETARY].GetTotalValue() != 10.0 { - t.Errorf("Calling ApierV1.GetBalance received: %f", reply2.BalanceMap[utils.MONETARY].GetTotalValue()) + t.Errorf("Calling APIerSv1.GetBalance received: %f", reply2.BalanceMap[utils.MONETARY].GetTotalValue()) } var reply3 *engine.Account attrs3 := &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "1003"} - if err := tutorialCallsRpc.Call(utils.ApierV2GetAccount, attrs3, &reply3); err != nil { - t.Error("Got error on ApierV2.GetAccount: ", err.Error()) + if err := tutorialCallsRpc.Call(utils.APIerSv2GetAccount, attrs3, &reply3); err != nil { + t.Error("Got error on APIerSv2.GetAccount: ", err.Error()) } else if reply3.BalanceMap[utils.MONETARY].GetTotalValue() != 10.0 { - t.Errorf("Calling ApierV1.GetBalance received: %f", reply3.BalanceMap[utils.MONETARY].GetTotalValue()) + t.Errorf("Calling APIerSv1.GetBalance received: %f", reply3.BalanceMap[utils.MONETARY].GetTotalValue()) } } @@ -476,7 +476,7 @@ func testCallCheckResourceAllocation(t *testing.T) { func testCallAccount1001(t *testing.T) { var reply *engine.Account attrs := &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "1001"} - if err := tutorialCallsRpc.Call(utils.ApierV2GetAccount, attrs, &reply); err != nil { + if err := tutorialCallsRpc.Call(utils.APIerSv2GetAccount, attrs, &reply); err != nil { t.Error(err.Error()) } else if reply.BalanceMap[utils.MONETARY].GetTotalValue() == 10.0 { // Make sure we debitted t.Errorf("Expected: 10, received: %+v", reply.BalanceMap[utils.MONETARY].GetTotalValue()) @@ -489,7 +489,7 @@ func testCallAccount1001(t *testing.T) { func testCall1001Cdrs(t *testing.T) { var reply []*engine.ExternalCDR req := utils.RPCCDRsFilter{RunIDs: []string{utils.MetaDefault}, Accounts: []string{"1001"}} - if err := tutorialCallsRpc.Call(utils.ApierV2GetCDRs, req, &reply); err != nil { + if err := tutorialCallsRpc.Call(utils.APIerSv2GetCDRs, req, &reply); err != nil { t.Error("Unexpected error: ", err.Error()) } else if len(reply) != 2 { t.Error("Unexpected number of CDRs returned: ", len(reply)) @@ -530,7 +530,7 @@ func testCall1002Cdrs(t *testing.T) { var reply []*engine.ExternalCDR req := utils.RPCCDRsFilter{RunIDs: []string{utils.MetaDefault}, Accounts: []string{"1002"}, DestinationPrefixes: []string{"1001"}} - if err := tutorialCallsRpc.Call(utils.ApierV2GetCDRs, req, &reply); err != nil { + if err := tutorialCallsRpc.Call(utils.APIerSv2GetCDRs, req, &reply); err != nil { t.Error("Unexpected error: ", err.Error()) } else if len(reply) != 1 { t.Error("Unexpected number of CDRs returned: ", len(reply)) @@ -556,7 +556,7 @@ func testCall1003Cdrs(t *testing.T) { var reply []*engine.ExternalCDR req := utils.RPCCDRsFilter{RunIDs: []string{utils.MetaDefault}, Accounts: []string{"1003"}, DestinationPrefixes: []string{"1001"}} - if err := tutorialCallsRpc.Call(utils.ApierV2GetCDRs, req, &reply); err != nil { + if err := tutorialCallsRpc.Call(utils.APIerSv2GetCDRs, req, &reply); err != nil { t.Error("Unexpected error: ", err.Error()) } else if len(reply) != 2 { t.Error("Unexpected number of CDRs returned: ", len(reply)) @@ -779,7 +779,7 @@ func testCallSyncSessions(t *testing.T) { RunIDs: []string{utils.MetaDefault}, Accounts: []string{"1001"}, } - if err := tutorialCallsRpc.Call(utils.ApierV2GetCDRs, req, &rplCdrs); err != nil { + if err := tutorialCallsRpc.Call(utils.APIerSv2GetCDRs, req, &rplCdrs); err != nil { t.Error("Unexpected error: ", err.Error()) } else if len(rplCdrs) != numberOfCDR { // cdr from sync session + cdr from before t.Fatal("Unexpected number of CDRs returned: ", len(rplCdrs), utils.ToJSON(rplCdrs)) diff --git a/general_tests/tutorial_it_test.go b/general_tests/tutorial_it_test.go index 731aa950d..97def8a3a 100644 --- a/general_tests/tutorial_it_test.go +++ b/general_tests/tutorial_it_test.go @@ -121,7 +121,7 @@ func testTutorialRpcConn(t *testing.T) { func testTutorialFromFolder(t *testing.T) { var reply string attrs := &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "tutorial")} - if err := tutorialRpc.Call(utils.ApierV1LoadTariffPlanFromFolder, attrs, &reply); err != nil { + if err := tutorialRpc.Call(utils.APIerSv1LoadTariffPlanFromFolder, attrs, &reply); err != nil { t.Error(err) } time.Sleep(500 * time.Millisecond) @@ -137,7 +137,7 @@ func testTutorialGetCost(t *testing.T) { Usage: "2m10s", } var rply *engine.EventCost - if err := tutorialRpc.Call(utils.ApierV1GetCost, attrs, &rply); err != nil { + if err := tutorialRpc.Call(utils.APIerSv1GetCost, attrs, &rply); err != nil { t.Error("Unexpected nil error received: ", err.Error()) } else if *rply.Cost != 0.716900 { t.Errorf("Unexpected cost received: %f", *rply.Cost) diff --git a/loaders/loader_it_test.go b/loaders/loader_it_test.go index b28d0bf38..6f5e5343f 100644 --- a/loaders/loader_it_test.go +++ b/loaders/loader_it_test.go @@ -180,7 +180,7 @@ func testLoaderCheckAttributes(t *testing.T) { eAttrPrf.Attributes[1].FilterIDs = nil } var reply *engine.AttributeProfile - if err := loaderRPC.Call(utils.ApierV1GetAttributeProfile, + if err := loaderRPC.Call(utils.APIerSv1GetAttributeProfile, &utils.TenantIDWithArgDispatcher{ TenantID: &utils.TenantID{Tenant: "cgrates.org", ID: "ALS1"}, }, &reply); err != nil { diff --git a/services/apierv1.go b/services/apierv1.go index 23d57087b..ad377c839 100644 --- a/services/apierv1.go +++ b/services/apierv1.go @@ -30,16 +30,16 @@ import ( "github.com/cgrates/rpcclient" ) -// NewApierV1Service returns the ApierV1 Service -func NewApierV1Service(cfg *config.CGRConfig, dm *DataDBService, +// NewAPIerSv1Service returns the APIerSv1 Service +func NewAPIerSv1Service(cfg *config.CGRConfig, dm *DataDBService, storDB *StorDBService, filterSChan chan *engine.FilterS, server *utils.Server, schedService *SchedulerService, responderService *ResponderService, - internalAPIerV1Chan chan rpcclient.ClientConnector, - connMgr *engine.ConnManager) *ApierV1Service { - return &ApierV1Service{ - connChan: internalAPIerV1Chan, + internalAPIerSv1Chan chan rpcclient.ClientConnector, + connMgr *engine.ConnManager) *APIerSv1Service { + return &APIerSv1Service{ + connChan: internalAPIerSv1Chan, cfg: cfg, dm: dm, storDB: storDB, @@ -48,12 +48,12 @@ func NewApierV1Service(cfg *config.CGRConfig, dm *DataDBService, schedService: schedService, responderService: responderService, connMgr: connMgr, - apierV1Chan: make(chan *v1.ApierV1, 1), + APIerSv1Chan: make(chan *v1.APIerSv1, 1), } } -// ApierV1Service implements Service interface -type ApierV1Service struct { +// APIerSv1Service implements Service interface +type APIerSv1Service struct { sync.RWMutex cfg *config.CGRConfig dm *DataDBService @@ -64,17 +64,17 @@ type ApierV1Service struct { responderService *ResponderService connMgr *engine.ConnManager - api *v1.ApierV1 + api *v1.APIerSv1 connChan chan rpcclient.ClientConnector syncStop chan struct{} - apierV1Chan chan *v1.ApierV1 + APIerSv1Chan chan *v1.APIerSv1 } // Start should handle the sercive start // For this service the start should be called from RAL Service -func (apiService *ApierV1Service) Start() (err error) { +func (apiService *APIerSv1Service) Start() (err error) { if apiService.IsRunning() { return fmt.Errorf("service aleady running") } @@ -93,7 +93,7 @@ func (apiService *ApierV1Service) Start() (err error) { apiService.storDB.RegisterSyncChan(storDBChan) stordb := <-storDBChan - apiService.api = &v1.ApierV1{ + apiService.api = &v1.APIerSv1{ DataManager: datadb, CdrDb: stordb, StorDb: stordb, @@ -105,7 +105,7 @@ func (apiService *ApierV1Service) Start() (err error) { StorDBChan: storDBChan, } - go func(api *v1.ApierV1, stopChan chan struct{}) { + go func(api *v1.APIerSv1, stopChan chan struct{}) { if err := api.ListenAndServe(stopChan); err != nil { utils.Logger.Err(fmt.Sprintf("<%s> error: <%s>", utils.CDRServer, err.Error())) // erS.exitChan <- true @@ -121,25 +121,27 @@ func (apiService *ApierV1Service) Start() (err error) { utils.RegisterRpcParams("", &v1.CDRsV1{}) utils.RegisterRpcParams("", &v1.SMGenericV1{}) utils.RegisterRpcParams("", apiService.api) + utils.RegisterRpcParams("ApierV1", apiService.api) + //backwards compatible apiService.connChan <- apiService.api - apiService.apierV1Chan <- apiService.api + apiService.APIerSv1Chan <- apiService.api return } // GetIntenternalChan returns the internal connection chanel -func (apiService *ApierV1Service) GetIntenternalChan() (conn chan rpcclient.ClientConnector) { +func (apiService *APIerSv1Service) GetIntenternalChan() (conn chan rpcclient.ClientConnector) { return apiService.connChan } // Reload handles the change of config -func (apiService *ApierV1Service) Reload() (err error) { +func (apiService *APIerSv1Service) Reload() (err error) { return } // Shutdown stops the service -func (apiService *ApierV1Service) Shutdown() (err error) { +func (apiService *APIerSv1Service) Shutdown() (err error) { apiService.Lock() close(apiService.syncStop) apiService.api = nil @@ -149,32 +151,32 @@ func (apiService *ApierV1Service) Shutdown() (err error) { } // IsRunning returns if the service is running -func (apiService *ApierV1Service) IsRunning() bool { +func (apiService *APIerSv1Service) IsRunning() bool { apiService.RLock() defer apiService.RUnlock() return apiService != nil && apiService.api != nil } // ServiceName returns the service name -func (apiService *ApierV1Service) ServiceName() string { - return utils.ApierV1 +func (apiService *APIerSv1Service) ServiceName() string { + return utils.APIerSv1 } -// GetApierV1 returns the apierV1 -func (apiService *ApierV1Service) GetApierV1() *v1.ApierV1 { +// GetAPIerSv1 returns the APIerSv1 +func (apiService *APIerSv1Service) GetAPIerSv1() *v1.APIerSv1 { apiService.RLock() defer apiService.RUnlock() return apiService.api } // ShouldRun returns if the service should be running -func (apiService *ApierV1Service) ShouldRun() bool { +func (apiService *APIerSv1Service) ShouldRun() bool { return apiService.cfg.RalsCfg().Enabled } // GetDMChan returns the DataManager chanel -func (apiService *ApierV1Service) GetApierV1Chan() chan *v1.ApierV1 { +func (apiService *APIerSv1Service) GetAPIerSv1Chan() chan *v1.APIerSv1 { apiService.RLock() defer apiService.RUnlock() - return apiService.apierV1Chan + return apiService.APIerSv1Chan } diff --git a/services/apierv2.go b/services/apierv2.go index c7e141073..089c20b9f 100644 --- a/services/apierv2.go +++ b/services/apierv2.go @@ -28,45 +28,45 @@ import ( "github.com/cgrates/rpcclient" ) -// NewApierV2Service returns the ApierV2 Service -func NewApierV2Service(apiv1 *ApierV1Service, cfg *config.CGRConfig, +// NewAPIerSv2Service returns the APIerSv2 Service +func NewAPIerSv2Service(apiv1 *APIerSv1Service, cfg *config.CGRConfig, server *utils.Server, - internalAPIerV2Chan chan rpcclient.ClientConnector) *ApierV2Service { - return &ApierV2Service{ + internalAPIerSv2Chan chan rpcclient.ClientConnector) *APIerSv2Service { + return &APIerSv2Service{ apiv1: apiv1, - connChan: internalAPIerV2Chan, + connChan: internalAPIerSv2Chan, cfg: cfg, server: server, } } -// ApierV2Service implements Service interface -type ApierV2Service struct { +// APIerSv2Service implements Service interface +type APIerSv2Service struct { sync.RWMutex cfg *config.CGRConfig server *utils.Server - apiv1 *ApierV1Service - api *v2.ApierV2 + apiv1 *APIerSv1Service + api *v2.APIerSv2 connChan chan rpcclient.ClientConnector } // Start should handle the sercive start // For this service the start should be called from RAL Service -func (api *ApierV2Service) Start() (err error) { +func (api *APIerSv2Service) Start() (err error) { if api.IsRunning() { return fmt.Errorf("service aleady running") } - apiV1Chan := api.apiv1.GetApierV1Chan() + apiV1Chan := api.apiv1.GetAPIerSv1Chan() apiV1 := <-apiV1Chan apiV1Chan <- apiV1 api.Lock() defer api.Unlock() - api.api = &v2.ApierV2{ - ApierV1: *apiV1, + api.api = &v2.APIerSv2{ + APIerSv1: *apiV1, } if !api.cfg.DispatcherSCfg().Enabled { @@ -75,23 +75,24 @@ func (api *ApierV2Service) Start() (err error) { utils.RegisterRpcParams("", &v2.CDRsV2{}) utils.RegisterRpcParams("", api.api) + utils.RegisterRpcParams("ApierV2", api.api) api.connChan <- api.api return } // GetIntenternalChan returns the internal connection chanel -func (api *ApierV2Service) GetIntenternalChan() (conn chan rpcclient.ClientConnector) { +func (api *APIerSv2Service) GetIntenternalChan() (conn chan rpcclient.ClientConnector) { return api.connChan } // Reload handles the change of config -func (api *ApierV2Service) Reload() (err error) { +func (api *APIerSv2Service) Reload() (err error) { return } // Shutdown stops the service -func (api *ApierV2Service) Shutdown() (err error) { +func (api *APIerSv2Service) Shutdown() (err error) { api.Lock() defer api.Unlock() api.api = nil @@ -100,18 +101,18 @@ func (api *ApierV2Service) Shutdown() (err error) { } // IsRunning returns if the service is running -func (api *ApierV2Service) IsRunning() bool { +func (api *APIerSv2Service) IsRunning() bool { api.RLock() defer api.RUnlock() return api != nil && api.api != nil } // ServiceName returns the service name -func (api *ApierV2Service) ServiceName() string { - return utils.ApierV2 +func (api *APIerSv2Service) ServiceName() string { + return utils.APIerSv2 } // ShouldRun returns if the service should be running -func (api *ApierV2Service) ShouldRun() bool { +func (api *APIerSv2Service) ShouldRun() bool { return api.cfg.RalsCfg().Enabled } diff --git a/servmanager/servmanager.go b/servmanager/servmanager.go index b00279673..da4e4dc2e 100644 --- a/servmanager/servmanager.go +++ b/servmanager/servmanager.go @@ -147,8 +147,8 @@ func (srvMngr *ServiceManager) GetConfig() *config.CGRConfig { func (srvMngr *ServiceManager) StartServices() (err error) { go srvMngr.handleReload() for serviceName, shouldRun := range map[string]bool{ - utils.ApierV1: srvMngr.GetConfig().ApierCfg().Enabled, - utils.ApierV2: srvMngr.GetConfig().ApierCfg().Enabled, + utils.APIerSv1: srvMngr.GetConfig().ApierCfg().Enabled, + utils.APIerSv2: srvMngr.GetConfig().ApierCfg().Enabled, utils.StorDB: srvMngr.GetConfig().RalsCfg().Enabled || srvMngr.GetConfig().CdrsCfg().Enabled, utils.AttributeS: srvMngr.GetConfig().AttributeSCfg().Enabled, utils.ChargerS: srvMngr.GetConfig().ChargerSCfg().Enabled, @@ -241,10 +241,10 @@ func (srvMngr *ServiceManager) handleReload() { return } case <-srvMngr.GetConfig().GetReloadChan(config.ApierS): - if err = srvMngr.reloadService(utils.ApierV1); err != nil { + if err = srvMngr.reloadService(utils.APIerSv1); err != nil { return } - if err = srvMngr.reloadService(utils.ApierV2); err != nil { + if err = srvMngr.reloadService(utils.APIerSv2); err != nil { return } case <-srvMngr.GetConfig().GetReloadChan(config.CDRS_JSN): diff --git a/sessions/sessions_bench_test.go b/sessions/sessions_bench_test.go index fda75c907..9e3843df3 100644 --- a/sessions/sessions_bench_test.go +++ b/sessions/sessions_bench_test.go @@ -66,7 +66,7 @@ func loadTP() { attrs := &utils.AttrLoadTpFromFolder{ FolderPath: path.Join(config.CgrConfig().DataFolderPath, "tariffplans", "tutorial")} var tpLoadInst utils.LoadInstance - if err := sBenchRPC.Call(utils.ApierV2LoadTariffPlanFromFolder, + if err := sBenchRPC.Call(utils.APIerSv2LoadTariffPlanFromFolder, attrs, &tpLoadInst); err != nil { log.Fatal(err) } @@ -84,7 +84,7 @@ func addBalance(sBenchRPC *rpc.Client, sraccount string) { }, } var reply string - if err := sBenchRPC.Call(utils.ApierV2SetBalance, + if err := sBenchRPC.Call(utils.APIerSv2SetBalance, attrSetBalance, &reply); err != nil { log.Fatal(err) } diff --git a/sessions/sessions_birpc_it_test.go b/sessions/sessions_birpc_it_test.go index 84e7aea50..6c24d5b55 100644 --- a/sessions/sessions_birpc_it_test.go +++ b/sessions/sessions_birpc_it_test.go @@ -131,7 +131,7 @@ func testSessionsBiRPCApierRpcConn(t *testing.T) { func testSessionsBiRPCTPFromFolder(t *testing.T) { attrs := &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "oldtutorial")} var loadInst utils.LoadInstance - if err := sessionsRPC.Call(utils.ApierV2LoadTariffPlanFromFolder, attrs, &loadInst); err != nil { + if err := sessionsRPC.Call(utils.APIerSv2LoadTariffPlanFromFolder, attrs, &loadInst); err != nil { t.Error(err) } time.Sleep(time.Duration(*waitRater) * time.Millisecond) // Give time for scheduler to execute topups @@ -149,7 +149,7 @@ func testSessionsBiRPCSessionAutomaticDisconnects(t *testing.T) { }, } var reply string - if err := sessionsRPC.Call(utils.ApierV2SetBalance, attrSetBalance, &reply); err != nil { + if err := sessionsRPC.Call(utils.APIerSv2SetBalance, attrSetBalance, &reply); err != nil { t.Error(err) } else if reply != utils.OK { t.Errorf("Received: %s", reply) @@ -160,7 +160,7 @@ func testSessionsBiRPCSessionAutomaticDisconnects(t *testing.T) { Account: attrSetBalance.Account, } eAcntVal := 0.01 * float64(time.Second) - if err := sessionsRPC.Call(utils.ApierV2GetAccount, attrGetAcnt, &acnt); err != nil { + if err := sessionsRPC.Call(utils.APIerSv2GetAccount, attrGetAcnt, &acnt); err != nil { t.Error(err) } else if acnt.BalanceMap[utils.VOICE].GetTotalValue() != eAcntVal { t.Errorf("Expecting: %f, received: %f", eAcntVal, @@ -236,7 +236,7 @@ func testSessionsBiRPCSessionAutomaticDisconnects(t *testing.T) { t.Error(err) } time.Sleep(time.Duration(100 * time.Millisecond)) // Give time for debits to occur - if err := sessionsRPC.Call(utils.ApierV2GetAccount, attrGetAcnt, &acnt); err != nil { + if err := sessionsRPC.Call(utils.APIerSv2GetAccount, attrGetAcnt, &acnt); err != nil { t.Error(err) } else if acnt.BalanceMap[utils.VOICE].GetTotalValue() != 0 { t.Errorf("Balance should be empty, have: %f", acnt.BalanceMap[utils.VOICE].GetTotalValue()) @@ -250,7 +250,7 @@ func testSessionsBiRPCSessionAutomaticDisconnects(t *testing.T) { var cdrs []*engine.ExternalCDR req := utils.RPCCDRsFilter{RunIDs: []string{utils.MetaDefault}, DestinationPrefixes: []string{"1004"}} - if err := sessionsRPC.Call(utils.ApierV2GetCDRs, req, &cdrs); err != nil { + if err := sessionsRPC.Call(utils.APIerSv2GetCDRs, req, &cdrs); err != nil { t.Error("Unexpected error: ", err.Error()) } else if len(cdrs) != 1 { t.Error("Unexpected number of CDRs returned: ", len(cdrs)) @@ -275,7 +275,7 @@ func testSessionsBiRPCSessionOriginatorTerminate(t *testing.T) { }, } var reply string - if err := sessionsRPC.Call(utils.ApierV2SetBalance, attrSetBalance, &reply); err != nil { + if err := sessionsRPC.Call(utils.APIerSv2SetBalance, attrSetBalance, &reply); err != nil { t.Error(err) } else if reply != utils.OK { t.Errorf("Received: %s", reply) @@ -283,7 +283,7 @@ func testSessionsBiRPCSessionOriginatorTerminate(t *testing.T) { var acnt *engine.Account attrGetAcnt := &utils.AttrGetAccount{Tenant: attrSetBalance.Tenant, Account: attrSetBalance.Account} eAcntVal := 1.0 * float64(time.Second) - if err := sessionsRPC.Call(utils.ApierV2GetAccount, attrGetAcnt, &acnt); err != nil { + if err := sessionsRPC.Call(utils.APIerSv2GetAccount, attrGetAcnt, &acnt); err != nil { t.Error(err) } else if acnt.BalanceMap[utils.VOICE].GetTotalValue() != eAcntVal { t.Errorf("Expecting: %f, received: %f", eAcntVal, acnt.BalanceMap[utils.VOICE].GetTotalValue()) @@ -352,7 +352,7 @@ func testSessionsBiRPCSessionOriginatorTerminate(t *testing.T) { } time.Sleep(time.Duration(50 * time.Millisecond)) // Give time for debits to occur - if err := sessionsRPC.Call(utils.ApierV2GetAccount, attrGetAcnt, &acnt); err != nil { + if err := sessionsRPC.Call(utils.APIerSv2GetAccount, attrGetAcnt, &acnt); err != nil { t.Error(err) } else if acnt.BalanceMap[utils.VOICE].GetTotalValue() > 0.995*float64(time.Second) { // FixMe: should be not 0.93? t.Errorf("Balance value: %f", acnt.BalanceMap[utils.VOICE].GetTotalValue()) @@ -368,7 +368,7 @@ func testSessionsBiRPCSessionOriginatorTerminate(t *testing.T) { var cdrs []*engine.ExternalCDR req := utils.RPCCDRsFilter{RunIDs: []string{utils.MetaDefault}, DestinationPrefixes: []string{"1005"}} - if err := sessionsRPC.Call(utils.ApierV2GetCDRs, req, &cdrs); err != nil { + if err := sessionsRPC.Call(utils.APIerSv2GetCDRs, req, &cdrs); err != nil { t.Error("Unexpected error: ", err.Error()) } else if len(cdrs) != 1 { t.Error("Unexpected number of CDRs returned: ", len(cdrs)) diff --git a/sessions/sessions_data_it_test.go b/sessions/sessions_data_it_test.go index 4c97f07a9..c5e0dc243 100644 --- a/sessions/sessions_data_it_test.go +++ b/sessions/sessions_data_it_test.go @@ -121,7 +121,7 @@ func testSessionsDataApierRpcConn(t *testing.T) { func testSessionsDataTPFromFolder(t *testing.T) { attrs := &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "oldtutorial")} var loadInst utils.LoadInstance - if err := sDataRPC.Call(utils.ApierV2LoadTariffPlanFromFolder, attrs, &loadInst); err != nil { + if err := sDataRPC.Call(utils.APIerSv2LoadTariffPlanFromFolder, attrs, &loadInst); err != nil { t.Error(err) } time.Sleep(time.Duration(*waitRater) * time.Millisecond) // Give time for scheduler to execute topups @@ -131,7 +131,7 @@ func testSessionsDataLastUsedData(t *testing.T) { var acnt *engine.Account attrs := &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "1001"} eAcntVal := 102400.0 - if err := sDataRPC.Call(utils.ApierV2GetAccount, attrs, &acnt); err != nil { + if err := sDataRPC.Call(utils.APIerSv2GetAccount, attrs, &acnt); err != nil { t.Error(err) } else if acnt.BalanceMap[utils.DATA].GetTotalValue() != eAcntVal { t.Errorf("Expected: %f, received: %f", @@ -188,7 +188,7 @@ func testSessionsDataLastUsedData(t *testing.T) { } eAcntVal = 97280.0 // 100 -5 - if err := sDataRPC.Call(utils.ApierV2GetAccount, attrs, &acnt); err != nil { + if err := sDataRPC.Call(utils.APIerSv2GetAccount, attrs, &acnt); err != nil { t.Error(err) } else if acnt.BalanceMap[utils.DATA].GetTotalValue() != eAcntVal { t.Errorf("Expected: %f, received: %f", @@ -227,7 +227,7 @@ func testSessionsDataLastUsedData(t *testing.T) { } eAcntVal = 93184.0 // 100-9 - if err := sDataRPC.Call(utils.ApierV2GetAccount, attrs, &acnt); err != nil { + if err := sDataRPC.Call(utils.APIerSv2GetAccount, attrs, &acnt); err != nil { t.Error(err) } else if acnt.BalanceMap[utils.DATA].GetTotalValue() != eAcntVal { t.Errorf("Expected: %f, received: %f", eAcntVal, acnt.BalanceMap[utils.DATA].GetTotalValue()) @@ -260,7 +260,7 @@ func testSessionsDataLastUsedData(t *testing.T) { t.Error(err) } eAcntVal = 98304.0 //100-4 - if err := sDataRPC.Call(utils.ApierV2GetAccount, attrs, &acnt); err != nil { + if err := sDataRPC.Call(utils.APIerSv2GetAccount, attrs, &acnt); err != nil { t.Error(err) } else if acnt.BalanceMap[utils.DATA].GetTotalValue() != eAcntVal { t.Errorf("Expected: %f, received: %f", @@ -282,12 +282,12 @@ func testSessionsDataLastUsedMultipleUpdates(t *testing.T) { }, } var reply string - if err := sDataRPC.Call(utils.ApierV2SetBalance, attrSetBalance, &reply); err != nil { + if err := sDataRPC.Call(utils.APIerSv2SetBalance, attrSetBalance, &reply); err != nil { t.Error(err) } else if reply != utils.OK { t.Errorf("Received: %s", reply) } - if err := sDataRPC.Call(utils.ApierV2GetAccount, acntAttrs, &acnt); err != nil { + if err := sDataRPC.Call(utils.APIerSv2GetAccount, acntAttrs, &acnt); err != nil { t.Error(err) } else if totalVal := acnt.BalanceMap[utils.DATA].GetTotalValue(); totalVal != eAcntVal { t.Errorf("Expected: %f, received: %f", eAcntVal, totalVal) @@ -326,7 +326,7 @@ func testSessionsDataLastUsedMultipleUpdates(t *testing.T) { } eAcntVal = 96256 // 100-6 - if err := sDataRPC.Call(utils.ApierV2GetAccount, acntAttrs, &acnt); err != nil { + if err := sDataRPC.Call(utils.APIerSv2GetAccount, acntAttrs, &acnt); err != nil { t.Error(err) } else if totalVal := acnt.BalanceMap[utils.DATA].GetTotalValue(); totalVal != eAcntVal { t.Errorf("Expected: %f, received: %f", eAcntVal, totalVal) @@ -373,7 +373,7 @@ func testSessionsDataLastUsedMultipleUpdates(t *testing.T) { } eAcntVal = 87040.000000 // 15MB used - if err := sDataRPC.Call(utils.ApierV2GetAccount, acntAttrs, &acnt); err != nil { + if err := sDataRPC.Call(utils.APIerSv2GetAccount, acntAttrs, &acnt); err != nil { t.Error(err) } else if totalVal := acnt.BalanceMap[utils.DATA].GetTotalValue(); totalVal != eAcntVal { t.Errorf("Expected: %f, received: %f", eAcntVal, totalVal) @@ -421,7 +421,7 @@ func testSessionsDataLastUsedMultipleUpdates(t *testing.T) { } eAcntVal = 87040.000000 // the amount is not modified and there will be 1024 extra left in SMG - if err := sDataRPC.Call(utils.ApierV2GetAccount, acntAttrs, &acnt); err != nil { + if err := sDataRPC.Call(utils.APIerSv2GetAccount, acntAttrs, &acnt); err != nil { t.Error(err) } else if totalVal := acnt.BalanceMap[utils.DATA].GetTotalValue(); totalVal != eAcntVal { t.Errorf("Expected: %f, received: %f", eAcntVal, totalVal) @@ -468,7 +468,7 @@ func testSessionsDataLastUsedMultipleUpdates(t *testing.T) { } eAcntVal = 87040.000000 - if err := sDataRPC.Call(utils.ApierV2GetAccount, acntAttrs, &acnt); err != nil { + if err := sDataRPC.Call(utils.APIerSv2GetAccount, acntAttrs, &acnt); err != nil { t.Error(err) } else if totalVal := acnt.BalanceMap[utils.DATA].GetTotalValue(); totalVal != eAcntVal { t.Errorf("Expected: %f, received: %f", eAcntVal, totalVal) @@ -509,7 +509,7 @@ func testSessionsDataLastUsedMultipleUpdates(t *testing.T) { } eAcntVal = 89088.000000 - if err := sDataRPC.Call(utils.ApierV2GetAccount, acntAttrs, &acnt); err != nil { + if err := sDataRPC.Call(utils.APIerSv2GetAccount, acntAttrs, &acnt); err != nil { t.Error(err) } else if totalVal := acnt.BalanceMap[utils.DATA].GetTotalValue(); totalVal != eAcntVal { t.Errorf("Expected: %f, received: %f", eAcntVal, totalVal) @@ -529,7 +529,7 @@ func testSessionsDataLastUsedMultipleUpdates(t *testing.T) { var cdrs []*engine.ExternalCDR req := utils.RPCCDRsFilter{RunIDs: []string{utils.MetaDefault}, Accounts: []string{acntAttrs.Account}} - if err := sDataRPC.Call(utils.ApierV2GetCDRs, req, &cdrs); err != nil { + if err := sDataRPC.Call(utils.APIerSv2GetCDRs, req, &cdrs); err != nil { t.Error("Unexpected error: ", err.Error()) } else if len(cdrs) != 1 { t.Error("Unexpected number of CDRs returned: ", len(cdrs)) @@ -557,12 +557,12 @@ func testSessionsDataTTLExpired(t *testing.T) { }, } var reply string - if err := sDataRPC.Call(utils.ApierV2SetBalance, attrSetBalance, &reply); err != nil { + if err := sDataRPC.Call(utils.APIerSv2SetBalance, attrSetBalance, &reply); err != nil { t.Error(err) } else if reply != utils.OK { t.Errorf("Received: %s", reply) } - if err := sDataRPC.Call(utils.ApierV2GetAccount, acntAttrs, &acnt); err != nil { + if err := sDataRPC.Call(utils.APIerSv2GetAccount, acntAttrs, &acnt); err != nil { t.Error(err) } else if totalVal := acnt.BalanceMap[utils.DATA].GetTotalValue(); totalVal != eAcntVal { t.Errorf("Expected: %f, received: %f", eAcntVal, totalVal) @@ -602,7 +602,7 @@ func testSessionsDataTTLExpired(t *testing.T) { } eAcntVal = 101376.000000 - if err := sDataRPC.Call(utils.ApierV2GetAccount, acntAttrs, &acnt); err != nil { + if err := sDataRPC.Call(utils.APIerSv2GetAccount, acntAttrs, &acnt); err != nil { t.Error(err) } else if dataVal := acnt.BalanceMap[utils.DATA].GetTotalValue(); dataVal != eAcntVal { t.Errorf("Expected: %f, received: %f", eAcntVal, dataVal) @@ -610,7 +610,7 @@ func testSessionsDataTTLExpired(t *testing.T) { time.Sleep(70 * time.Millisecond) eAcntVal = 99328.000000 - if err := sDataRPC.Call(utils.ApierV2GetAccount, acntAttrs, &acnt); err != nil { + if err := sDataRPC.Call(utils.APIerSv2GetAccount, acntAttrs, &acnt); err != nil { t.Error(err) } else if dataVal := acnt.BalanceMap[utils.DATA].GetTotalValue(); dataVal != eAcntVal { t.Errorf("Expected: %f, received: %f", eAcntVal, dataVal) @@ -634,12 +634,12 @@ func testSessionsDataTTLExpMultiUpdates(t *testing.T) { }, } var reply string - if err := sDataRPC.Call(utils.ApierV2SetBalance, attrSetBalance, &reply); err != nil { + if err := sDataRPC.Call(utils.APIerSv2SetBalance, attrSetBalance, &reply); err != nil { t.Error(err) } else if reply != utils.OK { t.Errorf("Received: %s", reply) } - if err := sDataRPC.Call(utils.ApierV2GetAccount, acntAttrs, &acnt); err != nil { + if err := sDataRPC.Call(utils.APIerSv2GetAccount, acntAttrs, &acnt); err != nil { t.Error(err) } else if totalVal := acnt.BalanceMap[utils.DATA].GetTotalValue(); totalVal != eAcntVal { t.Errorf("Expected: %f, received: %f", eAcntVal, totalVal) @@ -679,7 +679,7 @@ func testSessionsDataTTLExpMultiUpdates(t *testing.T) { } eAcntVal = 98304.000000 //96MB - if err := sDataRPC.Call(utils.ApierV2GetAccount, acntAttrs, &acnt); err != nil { + if err := sDataRPC.Call(utils.APIerSv2GetAccount, acntAttrs, &acnt); err != nil { t.Error(err) } else if dataVal := acnt.BalanceMap[utils.DATA].GetTotalValue(); dataVal != eAcntVal { t.Errorf("Expected: %f, received: %f", eAcntVal, dataVal) @@ -727,7 +727,7 @@ func testSessionsDataTTLExpMultiUpdates(t *testing.T) { } eAcntVal = 97280.000000 // 20480 - if err := sDataRPC.Call(utils.ApierV2GetAccount, acntAttrs, &acnt); err != nil { + if err := sDataRPC.Call(utils.APIerSv2GetAccount, acntAttrs, &acnt); err != nil { t.Error(err) } else if acnt.BalanceMap[utils.DATA].GetTotalValue() != eAcntVal { t.Errorf("Expected: %f, received: %f", eAcntVal, acnt.BalanceMap[utils.DATA].GetTotalValue()) @@ -735,7 +735,7 @@ func testSessionsDataTTLExpMultiUpdates(t *testing.T) { time.Sleep(60 * time.Millisecond) // TTL will kick in eAcntVal = 98304.000000 // 1MB is returned - if err := sDataRPC.Call(utils.ApierV2GetAccount, acntAttrs, &acnt); err != nil { + if err := sDataRPC.Call(utils.APIerSv2GetAccount, acntAttrs, &acnt); err != nil { t.Error(err) } else if dataVal := acnt.BalanceMap[utils.DATA].GetTotalValue(); dataVal != eAcntVal { t.Errorf("Expected: %f, received: %f", eAcntVal, dataVal) @@ -760,12 +760,12 @@ func testSessionsDataMultipleDataNoUsage(t *testing.T) { }, } var reply string - if err := sDataRPC.Call(utils.ApierV2SetBalance, attrSetBalance, &reply); err != nil { + if err := sDataRPC.Call(utils.APIerSv2SetBalance, attrSetBalance, &reply); err != nil { t.Error(err) } else if reply != utils.OK { t.Errorf("Received: %s", reply) } - if err := sDataRPC.Call(utils.ApierV2GetAccount, acntAttrs, &acnt); err != nil { + if err := sDataRPC.Call(utils.APIerSv2GetAccount, acntAttrs, &acnt); err != nil { t.Error(err) } else if totalVal := acnt.BalanceMap[utils.DATA].GetTotalValue(); totalVal != eAcntVal { t.Errorf("Expected: %f, received: %f", eAcntVal, totalVal) @@ -804,7 +804,7 @@ func testSessionsDataMultipleDataNoUsage(t *testing.T) { } eAcntVal = 100352.000000 // 1054720 - if err := sDataRPC.Call(utils.ApierV2GetAccount, acntAttrs, &acnt); err != nil { + if err := sDataRPC.Call(utils.APIerSv2GetAccount, acntAttrs, &acnt); err != nil { t.Error(err) } else if dataVal := acnt.BalanceMap[utils.DATA].GetTotalValue(); dataVal != eAcntVal { t.Errorf("Expected: %f, received: %f", eAcntVal, dataVal) @@ -851,7 +851,7 @@ func testSessionsDataMultipleDataNoUsage(t *testing.T) { } eAcntVal = 100352.000000 - if err := sDataRPC.Call(utils.ApierV2GetAccount, acntAttrs, &acnt); err != nil { + if err := sDataRPC.Call(utils.APIerSv2GetAccount, acntAttrs, &acnt); err != nil { t.Error(err) } else if dataVal := acnt.BalanceMap[utils.DATA].GetTotalValue(); dataVal != eAcntVal { t.Errorf("Expected: %f, received: %f", eAcntVal, dataVal) @@ -898,7 +898,7 @@ func testSessionsDataMultipleDataNoUsage(t *testing.T) { } eAcntVal = 100352.000000 - if err := sDataRPC.Call(utils.ApierV2GetAccount, acntAttrs, &acnt); err != nil { + if err := sDataRPC.Call(utils.APIerSv2GetAccount, acntAttrs, &acnt); err != nil { t.Error(err) } else if dataVal := acnt.BalanceMap[utils.DATA].GetTotalValue(); dataVal != eAcntVal { t.Errorf("Expected: %f, received: %f", eAcntVal, dataVal) @@ -939,7 +939,7 @@ func testSessionsDataMultipleDataNoUsage(t *testing.T) { } eAcntVal = 101376.000000 // refunded last 1MB reserved and unused - if err := sDataRPC.Call(utils.ApierV2GetAccount, acntAttrs, &acnt); err != nil { + if err := sDataRPC.Call(utils.APIerSv2GetAccount, acntAttrs, &acnt); err != nil { t.Error(err) } else if acnt.BalanceMap[utils.DATA].GetTotalValue() != eAcntVal { t.Errorf("Expected: %f, received: %f", @@ -968,12 +968,12 @@ func testSessionsDataTTLUsageProtection(t *testing.T) { }, } var reply string - if err := sDataRPC.Call(utils.ApierV2SetBalance, attrSetBalance, &reply); err != nil { + if err := sDataRPC.Call(utils.APIerSv2SetBalance, attrSetBalance, &reply); err != nil { t.Error(err) } else if reply != utils.OK { t.Errorf("Received: %s", reply) } - if err := sDataRPC.Call(utils.ApierV2GetAccount, acntAttrs, &acnt); err != nil { + if err := sDataRPC.Call(utils.APIerSv2GetAccount, acntAttrs, &acnt); err != nil { t.Error(err) } else if totalVal := acnt.BalanceMap[utils.DATA].GetTotalValue(); totalVal != eAcntVal { t.Errorf("Expected: %f, received: %f", eAcntVal, totalVal) @@ -1012,7 +1012,7 @@ func testSessionsDataTTLUsageProtection(t *testing.T) { } eAcntVal = 100352.000000 // 1054720 - if err := sDataRPC.Call(utils.ApierV2GetAccount, acntAttrs, &acnt); err != nil { + if err := sDataRPC.Call(utils.APIerSv2GetAccount, acntAttrs, &acnt); err != nil { t.Error(err) } else if dataVal := acnt.BalanceMap[utils.DATA].GetTotalValue(); dataVal != eAcntVal { t.Errorf("Expected: %f, received: %f", eAcntVal, dataVal) diff --git a/sessions/sessions_it_test.go b/sessions/sessions_it_test.go index 03e9a9b2f..d7998e630 100644 --- a/sessions/sessions_it_test.go +++ b/sessions/sessions_it_test.go @@ -119,7 +119,7 @@ func testSessionsItApierRpcConn(t *testing.T) { func testSessionsItTPFromFolder(t *testing.T) { attrs := &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "tutorial")} var loadInst utils.LoadInstance - if err := sItRPC.Call(utils.ApierV2LoadTariffPlanFromFolder, attrs, &loadInst); err != nil { + if err := sItRPC.Call(utils.APIerSv2LoadTariffPlanFromFolder, attrs, &loadInst); err != nil { t.Error(err) } time.Sleep(time.Duration(*waitRater) * time.Millisecond) // Give time for scheduler to execute topups @@ -129,7 +129,7 @@ func testSessionsItTerminatUnexist(t *testing.T) { var acnt *engine.Account attrs := &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "1001"} eAcntVal := 10.0 - if err := sItRPC.Call(utils.ApierV2GetAccount, attrs, &acnt); err != nil { + if err := sItRPC.Call(utils.APIerSv2GetAccount, attrs, &acnt); err != nil { t.Error(err) } else if acnt.BalanceMap[utils.MONETARY].GetTotalValue() != eAcntVal { t.Errorf("Expected: %f, received: %f", eAcntVal, acnt.BalanceMap[utils.MONETARY].GetTotalValue()) @@ -166,7 +166,7 @@ func testSessionsItTerminatUnexist(t *testing.T) { time.Sleep(100 * time.Millisecond) eAcntVal = 9.299800 - if err := sItRPC.Call(utils.ApierV2GetAccount, attrs, &acnt); err != nil { + if err := sItRPC.Call(utils.APIerSv2GetAccount, attrs, &acnt); err != nil { t.Error(err) } else if acnt.BalanceMap[utils.MONETARY].GetTotalValue() != eAcntVal { t.Errorf("Expected: %f, received: %f", eAcntVal, acnt.BalanceMap[utils.MONETARY].GetTotalValue()) @@ -183,7 +183,7 @@ func testSessionsItTerminatUnexist(t *testing.T) { DestinationPrefixes: []string{"1002"}, RunIDs: []string{utils.MetaDefault}, } - if err := sItRPC.Call(utils.ApierV2GetCDRs, req, &cdrs); err != nil { + if err := sItRPC.Call(utils.APIerSv2GetCDRs, req, &cdrs); err != nil { t.Error("Unexpected error: ", err.Error()) } else if len(cdrs) != 1 { t.Errorf("Unexpected number of CDRs returned: %v \n cdrs=%s", len(cdrs), utils.ToJSON(cdrs)) @@ -202,7 +202,7 @@ func testSessionsItUpdateUnexist(t *testing.T) { var acnt *engine.Account attrs := &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "1001"} eAcntVal := 9.299800 - if err := sItRPC.Call(utils.ApierV2GetAccount, attrs, &acnt); err != nil { + if err := sItRPC.Call(utils.APIerSv2GetAccount, attrs, &acnt); err != nil { t.Error(err) } else if acnt.BalanceMap[utils.MONETARY].GetTotalValue() != eAcntVal { t.Errorf("Expected: %f, received: %f", eAcntVal, acnt.BalanceMap[utils.MONETARY].GetTotalValue()) @@ -243,7 +243,7 @@ func testSessionsItUpdateUnexist(t *testing.T) { time.Sleep(10 * time.Millisecond) eAcntVal = 8.582900 - if err := sItRPC.Call(utils.ApierV2GetAccount, attrs, &acnt); err != nil { + if err := sItRPC.Call(utils.APIerSv2GetAccount, attrs, &acnt); err != nil { t.Error(err) } else if acnt.BalanceMap[utils.MONETARY].GetTotalValue() != eAcntVal { t.Errorf("Expected: %f, received: %f", eAcntVal, acnt.BalanceMap[utils.MONETARY].GetTotalValue()) @@ -382,7 +382,7 @@ func testSessionsItEventCostCompressing(t *testing.T) { }, } var reply string - if err := sItRPC.Call(utils.ApierV2SetBalance, attrSetBalance, &reply); err != nil { + if err := sItRPC.Call(utils.APIerSv2SetBalance, attrSetBalance, &reply); err != nil { t.Error(err) } else if reply != utils.OK { t.Errorf("Received: %s", reply) @@ -463,7 +463,7 @@ func testSessionsItEventCostCompressing(t *testing.T) { time.Sleep(20 * time.Millisecond) cgrID := utils.Sha1("TestSessionsItEventCostCompressing", "") var ec *engine.EventCost - if err := sItRPC.Call(utils.ApierV1GetEventCost, + if err := sItRPC.Call(utils.APIerSv1GetEventCost, utils.AttrGetCallCost{CgrId: cgrID, RunId: utils.MetaDefault}, &ec); err != nil { t.Fatal(err) diff --git a/sessions/sessions_rpl_it_test.go b/sessions/sessions_rpl_it_test.go index 886f42167..32226d75c 100644 --- a/sessions/sessions_rpl_it_test.go +++ b/sessions/sessions_rpl_it_test.go @@ -123,7 +123,7 @@ func testSessionSRplApierRpcConn(t *testing.T) { func testSessionSRplTPFromFolder(t *testing.T) { attrs := &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "oldtutorial")} var loadInst utils.LoadInstance - if err := smgRplcMstrRPC.Call(utils.ApierV2LoadTariffPlanFromFolder, attrs, &loadInst); err != nil { + if err := smgRplcMstrRPC.Call(utils.APIerSv2LoadTariffPlanFromFolder, attrs, &loadInst); err != nil { t.Error(err) } time.Sleep(time.Duration(*waitRater) * time.Millisecond) // Give time for scheduler to execute topups diff --git a/sessions/sessions_voice_it_test.go b/sessions/sessions_voice_it_test.go index cd8bd249a..9b8e36915 100644 --- a/sessions/sessions_voice_it_test.go +++ b/sessions/sessions_voice_it_test.go @@ -124,7 +124,7 @@ func testSessionsVoiceApierRpcConn(t *testing.T) { func testSessionsVoiceTPFromFolder(t *testing.T) { attrs := &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "oldtutorial")} var loadInst utils.LoadInstance - if err := sessionsRPC.Call(utils.ApierV2LoadTariffPlanFromFolder, attrs, &loadInst); err != nil { + if err := sessionsRPC.Call(utils.APIerSv2LoadTariffPlanFromFolder, attrs, &loadInst); err != nil { t.Error(err) } time.Sleep(time.Duration(*waitRater) * time.Millisecond) // Give time for scheduler to execute topups @@ -165,7 +165,7 @@ func testSessionsVoiceMonetaryRefund(t *testing.T) { var acnt *engine.Account attrs := &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "1001"} eAcntVal := 8.700010 - if err := sessionsRPC.Call(utils.ApierV2GetAccount, attrs, &acnt); err != nil { + if err := sessionsRPC.Call(utils.APIerSv2GetAccount, attrs, &acnt); err != nil { t.Error(err) } else if acnt.BalanceMap[utils.MONETARY].GetTotalValue() != eAcntVal { t.Errorf("Expected: %f, received: %f", eAcntVal, acnt.BalanceMap[utils.MONETARY].GetTotalValue()) @@ -200,7 +200,7 @@ func testSessionsVoiceMonetaryRefund(t *testing.T) { } eAcntVal = 8.8 - if err := sessionsRPC.Call(utils.ApierV2GetAccount, attrs, &acnt); err != nil { + if err := sessionsRPC.Call(utils.APIerSv2GetAccount, attrs, &acnt); err != nil { t.Error(err) } else if acnt.BalanceMap[utils.MONETARY].GetTotalValue() != eAcntVal { t.Errorf("Expected: %f, received: %f", eAcntVal, acnt.BalanceMap[utils.MONETARY].GetTotalValue()) @@ -243,7 +243,7 @@ func testSessionsVoiceVoiceRefund(t *testing.T) { var acnt *engine.Account attrs := &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "1001"} eAcntVal := 120.0 * float64(time.Second) - if err := sessionsRPC.Call(utils.ApierV2GetAccount, attrs, &acnt); err != nil { + if err := sessionsRPC.Call(utils.APIerSv2GetAccount, attrs, &acnt); err != nil { t.Error(err) } else if acnt.BalanceMap[utils.VOICE].GetTotalValue() != eAcntVal { t.Errorf("Expected: %f, received: %f", @@ -279,7 +279,7 @@ func testSessionsVoiceVoiceRefund(t *testing.T) { } eAcntVal = 150.0 * float64(time.Second) - if err := sessionsRPC.Call(utils.ApierV2GetAccount, attrs, &acnt); err != nil { + if err := sessionsRPC.Call(utils.APIerSv2GetAccount, attrs, &acnt); err != nil { t.Error(err) } else if acnt.BalanceMap[utils.VOICE].GetTotalValue() != eAcntVal { t.Errorf("Expected: %f, received: %f", eAcntVal, acnt.BalanceMap[utils.VOICE].GetTotalValue()) @@ -289,7 +289,7 @@ func testSessionsVoiceVoiceRefund(t *testing.T) { func testSessionsVoiceMixedRefund(t *testing.T) { var acnt *engine.Account attrs := &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "1001"} - if err := sessionsRPC.Call(utils.ApierV2GetAccount, attrs, &acnt); err != nil { + if err := sessionsRPC.Call(utils.APIerSv2GetAccount, attrs, &acnt); err != nil { t.Error(err) } @@ -329,7 +329,7 @@ func testSessionsVoiceMixedRefund(t *testing.T) { //attrs := &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "1001"} eVoiceVal := 90.0 * float64(time.Second) eMoneyVal := 8.7399 - if err := sessionsRPC.Call(utils.ApierV2GetAccount, attrs, &acnt); err != nil { + if err := sessionsRPC.Call(utils.APIerSv2GetAccount, attrs, &acnt); err != nil { t.Error(err) } else if acnt.BalanceMap[utils.VOICE].GetTotalValue() != eVoiceVal || acnt.BalanceMap[utils.MONETARY].GetTotalValue() != eMoneyVal { @@ -368,7 +368,7 @@ func testSessionsVoiceMixedRefund(t *testing.T) { eVoiceVal = 90.0 * float64(time.Second) eMoneyVal = 8.79 - if err := sessionsRPC.Call(utils.ApierV2GetAccount, attrs, &acnt); err != nil { + if err := sessionsRPC.Call(utils.APIerSv2GetAccount, attrs, &acnt); err != nil { t.Error(err) } else if acnt.BalanceMap[utils.VOICE].GetTotalValue() != eVoiceVal || acnt.BalanceMap[utils.MONETARY].GetTotalValue() != eMoneyVal { @@ -384,7 +384,7 @@ func testSessionsVoiceLastUsed(t *testing.T) { var acnt *engine.Account attrs := &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "1001"} eAcntVal := 8.790000 - if err := sessionsRPC.Call(utils.ApierV2GetAccount, attrs, &acnt); err != nil { + if err := sessionsRPC.Call(utils.APIerSv2GetAccount, attrs, &acnt); err != nil { t.Error(err) } else if acnt.BalanceMap[utils.MONETARY].GetTotalValue() != eAcntVal { t.Errorf("Expected: %f, received: %f", eAcntVal, acnt.BalanceMap[utils.MONETARY].GetTotalValue()) @@ -423,7 +423,7 @@ func testSessionsVoiceLastUsed(t *testing.T) { } eAcntVal = 7.39002 - if err := sessionsRPC.Call(utils.ApierV2GetAccount, attrs, &acnt); err != nil { + if err := sessionsRPC.Call(utils.APIerSv2GetAccount, attrs, &acnt); err != nil { t.Error(err) } else if acnt.BalanceMap[utils.MONETARY].GetTotalValue() != eAcntVal { t.Errorf("Expected: %f, received: %f", eAcntVal, acnt.BalanceMap[utils.MONETARY].GetTotalValue()) @@ -460,7 +460,7 @@ func testSessionsVoiceLastUsed(t *testing.T) { } eAcntVal = 7.09005 - if err := sessionsRPC.Call(utils.ApierV2GetAccount, attrs, &acnt); err != nil { + if err := sessionsRPC.Call(utils.APIerSv2GetAccount, attrs, &acnt); err != nil { t.Error(err) } else if acnt.BalanceMap[utils.MONETARY].GetTotalValue() != eAcntVal { t.Errorf("Expected: %f, received: %f", eAcntVal, acnt.BalanceMap[utils.MONETARY].GetTotalValue()) @@ -498,7 +498,7 @@ func testSessionsVoiceLastUsed(t *testing.T) { } eAcntVal = 6.590100 - if err := sessionsRPC.Call(utils.ApierV2GetAccount, attrs, &acnt); err != nil { + if err := sessionsRPC.Call(utils.APIerSv2GetAccount, attrs, &acnt); err != nil { t.Error(err) } else if acnt.BalanceMap[utils.MONETARY].GetTotalValue() != eAcntVal { t.Errorf("Expected: %f, received: %f", eAcntVal, acnt.BalanceMap[utils.MONETARY].GetTotalValue()) @@ -533,7 +533,7 @@ func testSessionsVoiceLastUsed(t *testing.T) { } eAcntVal = 7.59 - if err := sessionsRPC.Call(utils.ApierV2GetAccount, attrs, &acnt); err != nil { + if err := sessionsRPC.Call(utils.APIerSv2GetAccount, attrs, &acnt); err != nil { t.Error(err) } else if acnt.BalanceMap[utils.MONETARY].GetTotalValue() != eAcntVal { t.Errorf("Expected: %f, received: %f", @@ -545,7 +545,7 @@ func testSessionsVoiceLastUsedEnd(t *testing.T) { var acnt *engine.Account attrs := &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "1001"} eAcntVal := 7.59000 - if err := sessionsRPC.Call(utils.ApierV2GetAccount, attrs, &acnt); err != nil { + if err := sessionsRPC.Call(utils.APIerSv2GetAccount, attrs, &acnt); err != nil { t.Error(err) } else if acnt.BalanceMap[utils.MONETARY].GetTotalValue() != eAcntVal { t.Errorf("Expected: %f, received: %f", eAcntVal, acnt.BalanceMap[utils.MONETARY].GetTotalValue()) @@ -584,7 +584,7 @@ func testSessionsVoiceLastUsedEnd(t *testing.T) { } eAcntVal = 6.190020 - if err := sessionsRPC.Call(utils.ApierV2GetAccount, attrs, &acnt); err != nil { + if err := sessionsRPC.Call(utils.APIerSv2GetAccount, attrs, &acnt); err != nil { t.Error(err) } else if acnt.BalanceMap[utils.MONETARY].GetTotalValue() != eAcntVal { t.Errorf("Expected: %f, received: %f", eAcntVal, acnt.BalanceMap[utils.MONETARY].GetTotalValue()) @@ -622,7 +622,7 @@ func testSessionsVoiceLastUsedEnd(t *testing.T) { } eAcntVal = 6.090030 - if err := sessionsRPC.Call(utils.ApierV2GetAccount, attrs, &acnt); err != nil { + if err := sessionsRPC.Call(utils.APIerSv2GetAccount, attrs, &acnt); err != nil { t.Error(err) } else if acnt.BalanceMap[utils.MONETARY].GetTotalValue() != eAcntVal { t.Errorf("Expected: %f, received: %f", @@ -655,7 +655,7 @@ func testSessionsVoiceLastUsedEnd(t *testing.T) { } eAcntVal = 6.590000 - if err := sessionsRPC.Call(utils.ApierV2GetAccount, attrs, &acnt); err != nil { + if err := sessionsRPC.Call(utils.APIerSv2GetAccount, attrs, &acnt); err != nil { t.Error(err) } else if acnt.BalanceMap[utils.MONETARY].GetTotalValue() != eAcntVal { t.Errorf("Expected: %f, received: %f", @@ -667,7 +667,7 @@ func testSessionsVoiceLastUsedNotFixed(t *testing.T) { var acnt *engine.Account attrs := &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "1001"} eAcntVal := 6.59000 - if err := sessionsRPC.Call(utils.ApierV2GetAccount, attrs, &acnt); err != nil { + if err := sessionsRPC.Call(utils.APIerSv2GetAccount, attrs, &acnt); err != nil { t.Error(err) } else if acnt.BalanceMap[utils.MONETARY].GetTotalValue() != eAcntVal { t.Errorf("Expected: %f, received: %f", eAcntVal, acnt.BalanceMap[utils.MONETARY].GetTotalValue()) @@ -706,7 +706,7 @@ func testSessionsVoiceLastUsedNotFixed(t *testing.T) { } eAcntVal = 5.190020 - if err := sessionsRPC.Call(utils.ApierV2GetAccount, attrs, &acnt); err != nil { + if err := sessionsRPC.Call(utils.APIerSv2GetAccount, attrs, &acnt); err != nil { t.Error(err) } else if acnt.BalanceMap[utils.MONETARY].GetTotalValue() != eAcntVal { t.Errorf("Expected: %f, received: %f", eAcntVal, acnt.BalanceMap[utils.MONETARY].GetTotalValue()) @@ -744,7 +744,7 @@ func testSessionsVoiceLastUsedNotFixed(t *testing.T) { } eAcntVal = 5.123360 - if err := sessionsRPC.Call(utils.ApierV2GetAccount, attrs, &acnt); err != nil { + if err := sessionsRPC.Call(utils.APIerSv2GetAccount, attrs, &acnt); err != nil { t.Error(err) } else if acnt.BalanceMap[utils.MONETARY].GetTotalValue() != eAcntVal { t.Errorf("Expected: %f, received: %f", @@ -777,7 +777,7 @@ func testSessionsVoiceLastUsedNotFixed(t *testing.T) { } eAcntVal = 5.590000 - if err := sessionsRPC.Call(utils.ApierV2GetAccount, attrs, &acnt); err != nil { + if err := sessionsRPC.Call(utils.APIerSv2GetAccount, attrs, &acnt); err != nil { t.Error(err) } else if acnt.BalanceMap[utils.MONETARY].GetTotalValue() != eAcntVal { t.Errorf("Expected: %f, received: %f", @@ -789,7 +789,7 @@ func testSessionsVoiceSessionTTL(t *testing.T) { var acnt *engine.Account attrs := &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "1001"} eAcntVal := 5.590000 - if err := sessionsRPC.Call(utils.ApierV2GetAccount, attrs, &acnt); err != nil { + if err := sessionsRPC.Call(utils.APIerSv2GetAccount, attrs, &acnt); err != nil { t.Error(err) } else if acnt.BalanceMap[utils.MONETARY].GetTotalValue() != eAcntVal { t.Errorf("Expected: %f, received: %f", @@ -857,7 +857,7 @@ func testSessionsVoiceSessionTTL(t *testing.T) { } eAcntVal = 4.190020 - if err := sessionsRPC.Call(utils.ApierV2GetAccount, attrs, &acnt); err != nil { + if err := sessionsRPC.Call(utils.APIerSv2GetAccount, attrs, &acnt); err != nil { t.Error(err) } else if acnt.BalanceMap[utils.MONETARY].GetTotalValue() != eAcntVal { t.Errorf("Expected: %f, received: %f", eAcntVal, acnt.BalanceMap[utils.MONETARY].GetTotalValue()) @@ -910,14 +910,14 @@ func testSessionsVoiceSessionTTL(t *testing.T) { } eAcntVal = 4.090030 - if err := sessionsRPC.Call(utils.ApierV2GetAccount, attrs, &acnt); err != nil { + if err := sessionsRPC.Call(utils.APIerSv2GetAccount, attrs, &acnt); err != nil { t.Error(err) } else if acnt.BalanceMap[utils.MONETARY].GetTotalValue() != eAcntVal { t.Errorf("Expected: %f, received: %f", eAcntVal, acnt.BalanceMap[utils.MONETARY].GetTotalValue()) } time.Sleep(200 * time.Millisecond) eAcntVal = 4.0567 // rounding issue; old values : 4.0565 , 4.0566 - if err := sessionsRPC.Call(utils.ApierV2GetAccount, attrs, &acnt); err != nil { + if err := sessionsRPC.Call(utils.APIerSv2GetAccount, attrs, &acnt); err != nil { t.Error(err) } else if acnt.BalanceMap[utils.MONETARY].GetTotalValue() != eAcntVal { t.Errorf("Expected: %f, received: %f", eAcntVal, acnt.BalanceMap[utils.MONETARY].GetTotalValue()) @@ -925,7 +925,7 @@ func testSessionsVoiceSessionTTL(t *testing.T) { var cdrs []*engine.ExternalCDR req := utils.RPCCDRsFilter{RunIDs: []string{utils.MetaDefault}, DestinationPrefixes: []string{"1008"}} - if err := sessionsRPC.Call(utils.ApierV2GetCDRs, req, &cdrs); err != nil { + if err := sessionsRPC.Call(utils.APIerSv2GetCDRs, req, &cdrs); err != nil { t.Error("Unexpected error: ", err.Error()) } else if len(cdrs) != 1 { t.Error("Unexpected number of CDRs returned: ", len(cdrs)) @@ -951,7 +951,7 @@ func testSessionsVoiceSessionTTLWithRelocate(t *testing.T) { }, } var reply string - if err := sessionsRPC.Call(utils.ApierV2SetBalance, attrSetBalance, &reply); err != nil { + if err := sessionsRPC.Call(utils.APIerSv2SetBalance, attrSetBalance, &reply); err != nil { t.Error(err) } else if reply != utils.OK { t.Errorf("Received: %s", reply) @@ -962,7 +962,7 @@ func testSessionsVoiceSessionTTLWithRelocate(t *testing.T) { Account: attrSetBalance.Account, } eAcntVal := 300.0 * float64(time.Second) - if err := sessionsRPC.Call(utils.ApierV2GetAccount, attrs, &acnt); err != nil { + if err := sessionsRPC.Call(utils.APIerSv2GetAccount, attrs, &acnt); err != nil { t.Error(err) } else if acnt.BalanceMap[utils.VOICE].GetTotalValue() != eAcntVal { t.Errorf("Expecting: %f, received: %f", @@ -1017,7 +1017,7 @@ func testSessionsVoiceSessionTTLWithRelocate(t *testing.T) { t.Errorf("Expecting 2m, received usage: %v", aSessions[0].Usage) } eAcntVal = 180.0 * float64(time.Second) - if err := sessionsRPC.Call(utils.ApierV2GetAccount, attrs, &acnt); err != nil { + if err := sessionsRPC.Call(utils.APIerSv2GetAccount, attrs, &acnt); err != nil { t.Error(err) } else if acnt.BalanceMap[utils.VOICE].GetTotalValue() != eAcntVal { t.Errorf("Expecting: %f, received: %f", @@ -1074,7 +1074,7 @@ func testSessionsVoiceSessionTTLWithRelocate(t *testing.T) { t.Errorf("Expecting 2m30s, received usage: %v", aSessions[0].Usage) } eAcntVal = 150.0 * float64(time.Second) - if err := sessionsRPC.Call(utils.ApierV2GetAccount, attrs, &acnt); err != nil { + if err := sessionsRPC.Call(utils.APIerSv2GetAccount, attrs, &acnt); err != nil { t.Error(err) } else if acnt.BalanceMap[utils.VOICE].GetTotalValue() != eAcntVal { t.Errorf("Expecting: %f, received: %f", @@ -1083,7 +1083,7 @@ func testSessionsVoiceSessionTTLWithRelocate(t *testing.T) { time.Sleep(200 * time.Millisecond) // should trigger the TTL from config eAcntVal = 149.95 * float64(time.Second) - if err := sessionsRPC.Call(utils.ApierV2GetAccount, attrs, &acnt); err != nil { + if err := sessionsRPC.Call(utils.APIerSv2GetAccount, attrs, &acnt); err != nil { t.Error(err) } else if acnt.BalanceMap[utils.VOICE].GetTotalValue() != eAcntVal { t.Errorf("Expecting: %f, received: %f", @@ -1101,7 +1101,7 @@ func testSessionsVoiceSessionTTLWithRelocate(t *testing.T) { time.Sleep(500 * time.Millisecond) var cdrs []*engine.ExternalCDR req := utils.RPCCDRsFilter{RunIDs: []string{utils.MetaDefault}, DestinationPrefixes: []string{"1009"}} - if err := sessionsRPC.Call(utils.ApierV2GetCDRs, req, &cdrs); err != nil { + if err := sessionsRPC.Call(utils.APIerSv2GetCDRs, req, &cdrs); err != nil { t.Error("Unexpected error: ", err.Error()) } else if len(cdrs) != 1 { t.Error("Unexpected number of CDRs returned: ", len(cdrs)) @@ -1124,7 +1124,7 @@ func testSessionsVoiceRelocateWithOriginIDPrefix(t *testing.T) { }, } var reply string - if err := sessionsRPC.Call(utils.ApierV2SetBalance, attrSetBalance, &reply); err != nil { + if err := sessionsRPC.Call(utils.APIerSv2SetBalance, attrSetBalance, &reply); err != nil { t.Error(err) } else if reply != utils.OK { t.Errorf("Received: %s", reply) @@ -1135,7 +1135,7 @@ func testSessionsVoiceRelocateWithOriginIDPrefix(t *testing.T) { Account: attrSetBalance.Account, } eAcntVal := 300.0 * float64(time.Second) - if err := sessionsRPC.Call(utils.ApierV2GetAccount, attrs, &acnt); err != nil { + if err := sessionsRPC.Call(utils.APIerSv2GetAccount, attrs, &acnt); err != nil { t.Error(err) } else if acnt.BalanceMap[utils.VOICE].GetTotalValue() != eAcntVal { t.Errorf("Expecting: %f, received: %f", eAcntVal, @@ -1190,7 +1190,7 @@ func testSessionsVoiceRelocateWithOriginIDPrefix(t *testing.T) { t.Errorf("Expecting 2m, received usage: %v", aSessions[0].Usage) } eAcntVal = 180.0 * float64(time.Second) - if err := sessionsRPC.Call(utils.ApierV2GetAccount, attrs, &acnt); err != nil { + if err := sessionsRPC.Call(utils.APIerSv2GetAccount, attrs, &acnt); err != nil { t.Error(err) } else if acnt.BalanceMap[utils.VOICE].GetTotalValue() != eAcntVal { t.Errorf("Expecting: %f, received: %f", eAcntVal, @@ -1247,7 +1247,7 @@ func testSessionsVoiceRelocateWithOriginIDPrefix(t *testing.T) { t.Errorf("Expecting 2m30s, received usage: %v", aSessions[0].Usage) } eAcntVal = 150.0 * float64(time.Second) - if err := sessionsRPC.Call(utils.ApierV2GetAccount, attrs, &acnt); err != nil { + if err := sessionsRPC.Call(utils.APIerSv2GetAccount, attrs, &acnt); err != nil { t.Error(err) } else if acnt.BalanceMap[utils.VOICE].GetTotalValue() != eAcntVal { t.Errorf("Expecting: %f, received: %f", @@ -1294,7 +1294,7 @@ func testSessionsVoiceRelocateWithOriginIDPrefix(t *testing.T) { t.Error(err, aSessions) } eAcntVal = 240 * float64(time.Second) - if err := sessionsRPC.Call(utils.ApierV2GetAccount, + if err := sessionsRPC.Call(utils.APIerSv2GetAccount, attrs, &acnt); err != nil { t.Error(err) } else if acnt.BalanceMap[utils.VOICE].GetTotalValue() != eAcntVal { @@ -1311,7 +1311,7 @@ func testSessionsVoiceRelocateWithOriginIDPrefix(t *testing.T) { var cdrs []*engine.ExternalCDR req := utils.RPCCDRsFilter{RunIDs: []string{utils.MetaDefault}, DestinationPrefixes: []string{"12371"}} - if err := sessionsRPC.Call(utils.ApierV2GetCDRs, req, &cdrs); err != nil { + if err := sessionsRPC.Call(utils.APIerSv2GetCDRs, req, &cdrs); err != nil { t.Error("Unexpected error: ", err.Error()) } else if len(cdrs) != 1 { t.Error("Unexpected number of CDRs returned: ", len(cdrs)) @@ -1328,7 +1328,7 @@ func TestSMGDataDerivedChargingNoCredit(t *testing.T) { var acnt *engine.Account attrs := &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "1011"} eAcntVal := 50000.0 - if err := sessionsRPC.Call(utils.ApierV2GetAccount, attrs, &acnt); err != nil { + if err := sessionsRPC.Call(utils.APIerSv2GetAccount, attrs, &acnt); err != nil { t.Error(err) } else if acnt.BalanceMap[utils.VOICE].GetTotalValue() != eAcntVal { t.Errorf("Expected: %f, received: %f", eAcntVal, acnt.BalanceMap[utils.VOICE].GetTotalValue()) @@ -1357,7 +1357,7 @@ func TestSMGDataDerivedChargingNoCredit(t *testing.T) { t.Error("Bad max usage: ", maxUsage) } eAcntVal = 50000.0 - if err := sessionsRPC.Call(utils.ApierV2GetAccount, attrs, &acnt); err != nil { + if err := sessionsRPC.Call(utils.APIerSv2GetAccount, attrs, &acnt); err != nil { t.Error(err) } else if acnt.BalanceMap[utils.VOICE].GetTotalValue() != eAcntVal { t.Errorf("Expected: %f, received: %f", eAcntVal, acnt.BalanceMap[utils.VOICE].GetTotalValue()) diff --git a/utils/birpcint_client_test.go b/utils/birpcint_client_test.go index cb9348da6..da76669fd 100644 --- a/utils/birpcint_client_test.go +++ b/utils/birpcint_client_test.go @@ -81,12 +81,12 @@ func TestNewBiRPCInternalClient(t *testing.T) { t.Error("Client Connection must be not nil") } - err := rcv.Call(ApierV1ComputeActionPlanIndexes, "arg1", "reply") + err := rcv.Call(APIerSv1ComputeActionPlanIndexes, "arg1", "reply") if err != nil { t.Error(err) } testrpc := &testBiRPCServer{ - metod: ApierV1ComputeActionPlanIndexes, + metod: APIerSv1ComputeActionPlanIndexes, args: "arg1", reply: "reply", } diff --git a/utils/consts.go b/utils/consts.go index 357a877c5..e54110134 100755 --- a/utils/consts.go +++ b/utils/consts.go @@ -933,206 +933,206 @@ const ( ReplicatorSv1RemoveDispatcherHost = "ReplicatorSv1.RemoveDispatcherHost" ) -// ApierV1 APIs +// APIerSv1 APIs const ( - ApierV1 = "ApierV1" - ApierV1ComputeFilterIndexes = "ApierV1.ComputeFilterIndexes" - ApierV1ComputeFilterIndexIDs = "ApierV1.ComputeFilterIndexIDs" - ApierV1Ping = "ApierV1.Ping" - ApierV1SetDispatcherProfile = "ApierV1.SetDispatcherProfile" - ApierV1GetDispatcherProfile = "ApierV1.GetDispatcherProfile" - ApierV1GetDispatcherProfileIDs = "ApierV1.GetDispatcherProfileIDs" - ApierV1RemoveDispatcherProfile = "ApierV1.RemoveDispatcherProfile" - ApierV1SetDispatcherHost = "ApierV1.SetDispatcherHost" - ApierV1GetDispatcherHost = "ApierV1.GetDispatcherHost" - ApierV1GetDispatcherHostIDs = "ApierV1.GetDispatcherHostIDs" - ApierV1RemoveDispatcherHost = "ApierV1.RemoveDispatcherHost" - ApierV1GetEventCost = "ApierV1.GetEventCost" - ApierV1LoadTariffPlanFromFolder = "ApierV1.LoadTariffPlanFromFolder" - ApierV1GetCost = "ApierV1.GetCost" - ApierV1SetBalance = "ApierV1.SetBalance" - ApierV1GetFilter = "ApierV1.GetFilter" - ApierV1GetFilterIndexes = "ApierV1.GetFilterIndexes" - ApierV1RemoveFilterIndexes = "ApierV1.RemoveFilterIndexes" - ApierV1RemoveFilter = "ApierV1.RemoveFilter" - ApierV1SetFilter = "ApierV1.SetFilter" - ApierV1GetFilterIDs = "ApierV1.GetFilterIDs" - ApierV1GetRatingProfile = "ApierV1.GetRatingProfile" - ApierV1RemoveRatingProfile = "ApierV1.RemoveRatingProfile" - ApierV1SetRatingProfile = "ApierV1.SetRatingProfile" - ApierV1GetRatingProfileIDs = "ApierV1.GetRatingProfileIDs" - ApierV1SetDataDBVersions = "ApierV1.SetDataDBVersions" - ApierV1SetStorDBVersions = "ApierV1.SetStorDBVersions" - ApierV1GetAccountActionPlan = "ApierV1.GetAccountActionPlan" - ApierV1ComputeActionPlanIndexes = "ApierV1.ComputeActionPlanIndexes" - ApierV1GetActions = "ApierV1.GetActions" - ApierV1GetActionPlan = "ApierV1.GetActionPlan" - ApierV1GetActionPlanIDs = "ApierV1.GetActionPlanIDs" - ApierV1GetRatingPlanIDs = "ApierV1.GetRatingPlanIDs" - ApierV1GetRatingPlan = "ApierV1.GetRatingPlan" - ApierV1RemoveRatingPlan = "ApierV1.RemoveRatingPlan" - ApierV1GetDestination = "ApierV1.GetDestination" - ApierV1GetReverseDestination = "ApierV1.GetReverseDestination" - ApierV1AddBalance = "ApierV1.AddBalance" - ApierV1DebitBalance = "ApierV1.DebitBalance" - ApierV1SetAccount = "ApierV1.SetAccount" - ApierV1GetAccountsCount = "ApierV1.GetAccountsCount" - ApierV1GetDataDBVersions = "ApierV1.GetDataDBVersions" - ApierV1GetStorDBVersions = "ApierV1.GetStorDBVersions" - ApierV1GetCDRs = "ApierV1.GetCDRs" - ApierV1GetTPAccountActions = "ApierV1.GetTPAccountActions" - ApierV1SetTPAccountActions = "ApierV1.SetTPAccountActions" - ApierV1GetTPAccountActionsByLoadId = "ApierV1.GetTPAccountActionsByLoadId" - ApierV1GetTPAccountActionLoadIds = "ApierV1.GetTPAccountActionLoadIds" - ApierV1GetTPAccountActionIds = "ApierV1.GetTPAccountActionIds" - ApierV1RemoveTPAccountActions = "ApierV1.RemoveTPAccountActions" - ApierV1GetTPActionPlan = "ApierV1.GetTPActionPlan" - ApierV1SetTPActionPlan = "ApierV1.SetTPActionPlan" - ApierV1GetTPActionPlanIds = "ApierV1.GetTPActionPlanIds" - ApierV1SetTPActionTriggers = "ApierV1.SetTPActionTriggers" - ApierV1GetTPActionTriggers = "ApierV1.GetTPActionTriggers" - ApierV1RemoveTPActionTriggers = "ApierV1.RemoveTPActionTriggers" - ApierV1GetTPActionTriggerIds = "ApierV1.GetTPActionTriggerIds" - ApierV1GetTPActions = "ApierV1.GetTPActions" - ApierV1RemoveTPActionPlan = "ApierV1.RemoveTPActionPlan" - ApierV1GetTPAttributeProfile = "ApierV1.GetTPAttributeProfile" - ApierV1SetTPAttributeProfile = "ApierV1.SetTPAttributeProfile" - ApierV1GetTPAttributeProfileIds = "ApierV1.GetTPAttributeProfileIds" - ApierV1RemoveTPAttributeProfile = "ApierV1.RemoveTPAttributeProfile" - ApierV1GetTPCharger = "ApierV1.GetTPCharger" - ApierV1SetTPCharger = "ApierV1.SetTPCharger" - ApierV1RemoveTPCharger = "ApierV1.RemoveTPCharger" - ApierV1GetTPChargerIDs = "ApierV1.GetTPChargerIDs" - ApierV1SetTPFilterProfile = "ApierV1.SetTPFilterProfile" - ApierV1GetTPFilterProfile = "ApierV1.GetTPFilterProfile" - ApierV1GetTPFilterProfileIds = "ApierV1.GetTPFilterProfileIds" - ApierV1RemoveTPFilterProfile = "ApierV1.RemoveTPFilterProfile" - ApierV1GetTPDestination = "ApierV1.GetTPDestination" - ApierV1SetTPDestination = "ApierV1.SetTPDestination" - ApierV1GetTPDestinationIDs = "ApierV1.GetTPDestinationIDs" - ApierV1RemoveTPDestination = "ApierV1.RemoveTPDestination" - ApierV1GetTPResource = "ApierV1.GetTPResource" - ApierV1SetTPResource = "ApierV1.SetTPResource" - ApierV1RemoveTPResource = "ApierV1.RemoveTPResource" - ApierV1SetTPRate = "ApierV1.SetTPRate" - ApierV1GetTPRate = "ApierV1.GetTPRate" - ApierV1RemoveTPRate = "ApierV1.RemoveTPRate" - ApierV1GetTPRateIds = "ApierV1.GetTPRateIds" - ApierV1SetTPThreshold = "ApierV1.SetTPThreshold" - ApierV1GetTPThreshold = "ApierV1.GetTPThreshold" - ApierV1GetTPThresholdIDs = "ApierV1.GetTPThresholdIDs" - ApierV1RemoveTPThreshold = "ApierV1.RemoveTPThreshold" - ApierV1SetTPStat = "ApierV1.SetTPStat" - ApierV1GetTPStat = "ApierV1.GetTPStat" - ApierV1RemoveTPStat = "ApierV1.RemoveTPStat" - ApierV1GetTPDestinationRate = "ApierV1.GetTPDestinationRate" - ApierV1SetTPSupplierProfile = "ApierV1.SetTPSupplierProfile" - ApierV1GetTPSupplierProfile = "ApierV1.GetTPSupplierProfile" - ApierV1GetTPSupplierProfileIDs = "ApierV1.GetTPSupplierProfileIDs" - ApierV1RemoveTPSupplierProfile = "ApierV1.RemoveTPSupplierProfile" - ApierV1GetTPDispatcherProfile = "ApierV1.GetTPDispatcherProfile" - ApierV1SetTPDispatcherProfile = "ApierV1.SetTPDispatcherProfile" - ApierV1RemoveTPDispatcherProfile = "ApierV1.RemoveTPDispatcherProfile" - ApierV1GetTPDispatcherProfileIDs = "ApierV1.GetTPDispatcherProfileIDs" - ApierV1GetTPSharedGroups = "ApierV1.GetTPSharedGroups" - ApierV1SetTPSharedGroups = "ApierV1.SetTPSharedGroups" - ApierV1GetTPSharedGroupIds = "ApierV1.GetTPSharedGroupIds" - ApierV1RemoveTPSharedGroups = "ApierV1.RemoveTPSharedGroups" - ApierV1ExportCDRs = "ApierV1.ExportCDRs" - ApierV1GetTPRatingPlan = "ApierV1.GetTPRatingPlan" - ApierV1SetTPRatingPlan = "ApierV1.SetTPRatingPlan" - ApierV1GetTPRatingPlanIds = "ApierV1.GetTPRatingPlanIds" - ApierV1RemoveTPRatingPlan = "ApierV1.RemoveTPRatingPlan" - ApierV1SetTPActions = "ApierV1.SetTPActions" - ApierV1GetTPActionIds = "ApierV1.GetTPActionIds" - ApierV1RemoveTPActions = "ApierV1.RemoveTPActions" - ApierV1SetActionPlan = "ApierV1.SetActionPlan" - ApierV1ExecuteAction = "ApierV1.ExecuteAction" - ApierV1SetTPRatingProfile = "ApierV1.SetTPRatingProfile" - ApierV1GetTPRatingProfile = "ApierV1.GetTPRatingProfile" - ApierV1RemoveTPRatingProfile = "ApierV1.RemoveTPRatingProfile" - ApierV1SetTPDestinationRate = "ApierV1.SetTPDestinationRate" - ApierV1GetTPRatingProfileLoadIds = "ApierV1.GetTPRatingProfileLoadIds" - ApierV1GetTPRatingProfilesByLoadID = "ApierV1.GetTPRatingProfilesByLoadID" - ApierV1GetTPRatingProfileIds = "ApierV1.GetTPRatingProfileIds" - ApierV1GetTPDestinationRateIds = "ApierV1.GetTPDestinationRateIds" - ApierV1RemoveTPDestinationRate = "ApierV1.RemoveTPDestinationRate" - ApierV1ImportTariffPlanFromFolder = "ApierV1.ImportTariffPlanFromFolder" - ApierV1ExportTPToFolder = "ApierV1.ExportTPToFolder" - ApierV1LoadRatingPlan = "ApierV1.LoadRatingPlan" - ApierV1LoadRatingProfile = "ApierV1.LoadRatingProfile" - ApierV1LoadAccountActions = "ApierV1.LoadAccountActions" - ApierV1SetActions = "ApierV1.SetActions" - ApierV1AddTriggeredAction = "ApierV1.AddTriggeredAction" - ApierV1GetAccountActionTriggers = "ApierV1.GetAccountActionTriggers" - ApierV1AddAccountActionTriggers = "ApierV1.AddAccountActionTriggers" - ApierV1ResetAccountActionTriggers = "ApierV1.ResetAccountActionTriggers" - ApierV1SetAccountActionTriggers = "ApierV1.SetAccountActionTriggers" - ApierV1RemoveAccountActionTriggers = "ApierV1.RemoveAccountActionTriggers" - ApierV1GetScheduledActions = "ApierV1.GetScheduledActions" - ApierV1RemoveActionTiming = "ApierV1.RemoveActionTiming" - ApierV1ComputeReverseDestinations = "ApierV1.ComputeReverseDestinations" - ApierV1ComputeAccountActionPlans = "ApierV1.ComputeAccountActionPlans" - ApierV1SetDestination = "ApierV1.SetDestination" - ApierV1GetDataCost = "ApierV1.GetDataCost" - ApierV1ReplayFailedPosts = "ApierV1.ReplayFailedPosts" - ApierV1RemoveAccount = "ApierV1.RemoveAccount" - ApierV1DebitUsage = "ApierV1.DebitUsage" - ApierV1GetCacheStats = "ApierV1.GetCacheStats" - ApierV1ReloadCache = "ApierV1.ReloadCache" - ApierV1GetActionTriggers = "ApierV1.GetActionTriggers" - ApierV1SetActionTrigger = "ApierV1.SetActionTrigger" - ApierV1RemoveActionPlan = "ApierV1.RemoveActionPlan" - ApierV1RemoveActions = "ApierV1.RemoveActions" - ApierV1RemoveBalances = "ApierV1.RemoveBalances" - ApierV1ReloadCdrcConfig = "ApierV1.ReloadCdrcConfig" - ApierV1ReloadCdreConfig = "ApierV1.ReloadCdreConfig" - ApierV1GetLoadHistory = "ApierV1.GetLoadHistory" - ApierV1GetLoadIDs = "ApierV1.GetLoadIDs" - ApierV1GetLoadTimes = "ApierV1.GetLoadTimes" - ApierV1ExecuteScheduledActions = "ApierV1.ExecuteScheduledActions" - ApierV1GetSharedGroup = "ApierV1.GetSharedGroup" - ApierV1RemoveActionTrigger = "ApierV1.RemoveActionTrigger" - ApierV1GetAccount = "ApierV1.GetAccount" + APIerSv1 = "APIerSv1" + APIerSv1ComputeFilterIndexes = "APIerSv1.ComputeFilterIndexes" + APIerSv1ComputeFilterIndexIDs = "APIerSv1.ComputeFilterIndexIDs" + APIerSv1Ping = "APIerSv1.Ping" + APIerSv1SetDispatcherProfile = "APIerSv1.SetDispatcherProfile" + APIerSv1GetDispatcherProfile = "APIerSv1.GetDispatcherProfile" + APIerSv1GetDispatcherProfileIDs = "APIerSv1.GetDispatcherProfileIDs" + APIerSv1RemoveDispatcherProfile = "APIerSv1.RemoveDispatcherProfile" + APIerSv1SetDispatcherHost = "APIerSv1.SetDispatcherHost" + APIerSv1GetDispatcherHost = "APIerSv1.GetDispatcherHost" + APIerSv1GetDispatcherHostIDs = "APIerSv1.GetDispatcherHostIDs" + APIerSv1RemoveDispatcherHost = "APIerSv1.RemoveDispatcherHost" + APIerSv1GetEventCost = "APIerSv1.GetEventCost" + APIerSv1LoadTariffPlanFromFolder = "APIerSv1.LoadTariffPlanFromFolder" + APIerSv1GetCost = "APIerSv1.GetCost" + APIerSv1SetBalance = "APIerSv1.SetBalance" + APIerSv1GetFilter = "APIerSv1.GetFilter" + APIerSv1GetFilterIndexes = "APIerSv1.GetFilterIndexes" + APIerSv1RemoveFilterIndexes = "APIerSv1.RemoveFilterIndexes" + APIerSv1RemoveFilter = "APIerSv1.RemoveFilter" + APIerSv1SetFilter = "APIerSv1.SetFilter" + APIerSv1GetFilterIDs = "APIerSv1.GetFilterIDs" + APIerSv1GetRatingProfile = "APIerSv1.GetRatingProfile" + APIerSv1RemoveRatingProfile = "APIerSv1.RemoveRatingProfile" + APIerSv1SetRatingProfile = "APIerSv1.SetRatingProfile" + APIerSv1GetRatingProfileIDs = "APIerSv1.GetRatingProfileIDs" + APIerSv1SetDataDBVersions = "APIerSv1.SetDataDBVersions" + APIerSv1SetStorDBVersions = "APIerSv1.SetStorDBVersions" + APIerSv1GetAccountActionPlan = "APIerSv1.GetAccountActionPlan" + APIerSv1ComputeActionPlanIndexes = "APIerSv1.ComputeActionPlanIndexes" + APIerSv1GetActions = "APIerSv1.GetActions" + APIerSv1GetActionPlan = "APIerSv1.GetActionPlan" + APIerSv1GetActionPlanIDs = "APIerSv1.GetActionPlanIDs" + APIerSv1GetRatingPlanIDs = "APIerSv1.GetRatingPlanIDs" + APIerSv1GetRatingPlan = "APIerSv1.GetRatingPlan" + APIerSv1RemoveRatingPlan = "APIerSv1.RemoveRatingPlan" + APIerSv1GetDestination = "APIerSv1.GetDestination" + APIerSv1GetReverseDestination = "APIerSv1.GetReverseDestination" + APIerSv1AddBalance = "APIerSv1.AddBalance" + APIerSv1DebitBalance = "APIerSv1.DebitBalance" + APIerSv1SetAccount = "APIerSv1.SetAccount" + APIerSv1GetAccountsCount = "APIerSv1.GetAccountsCount" + APIerSv1GetDataDBVersions = "APIerSv1.GetDataDBVersions" + APIerSv1GetStorDBVersions = "APIerSv1.GetStorDBVersions" + APIerSv1GetCDRs = "APIerSv1.GetCDRs" + APIerSv1GetTPAccountActions = "APIerSv1.GetTPAccountActions" + APIerSv1SetTPAccountActions = "APIerSv1.SetTPAccountActions" + APIerSv1GetTPAccountActionsByLoadId = "APIerSv1.GetTPAccountActionsByLoadId" + APIerSv1GetTPAccountActionLoadIds = "APIerSv1.GetTPAccountActionLoadIds" + APIerSv1GetTPAccountActionIds = "APIerSv1.GetTPAccountActionIds" + APIerSv1RemoveTPAccountActions = "APIerSv1.RemoveTPAccountActions" + APIerSv1GetTPActionPlan = "APIerSv1.GetTPActionPlan" + APIerSv1SetTPActionPlan = "APIerSv1.SetTPActionPlan" + APIerSv1GetTPActionPlanIds = "APIerSv1.GetTPActionPlanIds" + APIerSv1SetTPActionTriggers = "APIerSv1.SetTPActionTriggers" + APIerSv1GetTPActionTriggers = "APIerSv1.GetTPActionTriggers" + APIerSv1RemoveTPActionTriggers = "APIerSv1.RemoveTPActionTriggers" + APIerSv1GetTPActionTriggerIds = "APIerSv1.GetTPActionTriggerIds" + APIerSv1GetTPActions = "APIerSv1.GetTPActions" + APIerSv1RemoveTPActionPlan = "APIerSv1.RemoveTPActionPlan" + APIerSv1GetTPAttributeProfile = "APIerSv1.GetTPAttributeProfile" + APIerSv1SetTPAttributeProfile = "APIerSv1.SetTPAttributeProfile" + APIerSv1GetTPAttributeProfileIds = "APIerSv1.GetTPAttributeProfileIds" + APIerSv1RemoveTPAttributeProfile = "APIerSv1.RemoveTPAttributeProfile" + APIerSv1GetTPCharger = "APIerSv1.GetTPCharger" + APIerSv1SetTPCharger = "APIerSv1.SetTPCharger" + APIerSv1RemoveTPCharger = "APIerSv1.RemoveTPCharger" + APIerSv1GetTPChargerIDs = "APIerSv1.GetTPChargerIDs" + APIerSv1SetTPFilterProfile = "APIerSv1.SetTPFilterProfile" + APIerSv1GetTPFilterProfile = "APIerSv1.GetTPFilterProfile" + APIerSv1GetTPFilterProfileIds = "APIerSv1.GetTPFilterProfileIds" + APIerSv1RemoveTPFilterProfile = "APIerSv1.RemoveTPFilterProfile" + APIerSv1GetTPDestination = "APIerSv1.GetTPDestination" + APIerSv1SetTPDestination = "APIerSv1.SetTPDestination" + APIerSv1GetTPDestinationIDs = "APIerSv1.GetTPDestinationIDs" + APIerSv1RemoveTPDestination = "APIerSv1.RemoveTPDestination" + APIerSv1GetTPResource = "APIerSv1.GetTPResource" + APIerSv1SetTPResource = "APIerSv1.SetTPResource" + APIerSv1RemoveTPResource = "APIerSv1.RemoveTPResource" + APIerSv1SetTPRate = "APIerSv1.SetTPRate" + APIerSv1GetTPRate = "APIerSv1.GetTPRate" + APIerSv1RemoveTPRate = "APIerSv1.RemoveTPRate" + APIerSv1GetTPRateIds = "APIerSv1.GetTPRateIds" + APIerSv1SetTPThreshold = "APIerSv1.SetTPThreshold" + APIerSv1GetTPThreshold = "APIerSv1.GetTPThreshold" + APIerSv1GetTPThresholdIDs = "APIerSv1.GetTPThresholdIDs" + APIerSv1RemoveTPThreshold = "APIerSv1.RemoveTPThreshold" + APIerSv1SetTPStat = "APIerSv1.SetTPStat" + APIerSv1GetTPStat = "APIerSv1.GetTPStat" + APIerSv1RemoveTPStat = "APIerSv1.RemoveTPStat" + APIerSv1GetTPDestinationRate = "APIerSv1.GetTPDestinationRate" + APIerSv1SetTPSupplierProfile = "APIerSv1.SetTPSupplierProfile" + APIerSv1GetTPSupplierProfile = "APIerSv1.GetTPSupplierProfile" + APIerSv1GetTPSupplierProfileIDs = "APIerSv1.GetTPSupplierProfileIDs" + APIerSv1RemoveTPSupplierProfile = "APIerSv1.RemoveTPSupplierProfile" + APIerSv1GetTPDispatcherProfile = "APIerSv1.GetTPDispatcherProfile" + APIerSv1SetTPDispatcherProfile = "APIerSv1.SetTPDispatcherProfile" + APIerSv1RemoveTPDispatcherProfile = "APIerSv1.RemoveTPDispatcherProfile" + APIerSv1GetTPDispatcherProfileIDs = "APIerSv1.GetTPDispatcherProfileIDs" + APIerSv1GetTPSharedGroups = "APIerSv1.GetTPSharedGroups" + APIerSv1SetTPSharedGroups = "APIerSv1.SetTPSharedGroups" + APIerSv1GetTPSharedGroupIds = "APIerSv1.GetTPSharedGroupIds" + APIerSv1RemoveTPSharedGroups = "APIerSv1.RemoveTPSharedGroups" + APIerSv1ExportCDRs = "APIerSv1.ExportCDRs" + APIerSv1GetTPRatingPlan = "APIerSv1.GetTPRatingPlan" + APIerSv1SetTPRatingPlan = "APIerSv1.SetTPRatingPlan" + APIerSv1GetTPRatingPlanIds = "APIerSv1.GetTPRatingPlanIds" + APIerSv1RemoveTPRatingPlan = "APIerSv1.RemoveTPRatingPlan" + APIerSv1SetTPActions = "APIerSv1.SetTPActions" + APIerSv1GetTPActionIds = "APIerSv1.GetTPActionIds" + APIerSv1RemoveTPActions = "APIerSv1.RemoveTPActions" + APIerSv1SetActionPlan = "APIerSv1.SetActionPlan" + APIerSv1ExecuteAction = "APIerSv1.ExecuteAction" + APIerSv1SetTPRatingProfile = "APIerSv1.SetTPRatingProfile" + APIerSv1GetTPRatingProfile = "APIerSv1.GetTPRatingProfile" + APIerSv1RemoveTPRatingProfile = "APIerSv1.RemoveTPRatingProfile" + APIerSv1SetTPDestinationRate = "APIerSv1.SetTPDestinationRate" + APIerSv1GetTPRatingProfileLoadIds = "APIerSv1.GetTPRatingProfileLoadIds" + APIerSv1GetTPRatingProfilesByLoadID = "APIerSv1.GetTPRatingProfilesByLoadID" + APIerSv1GetTPRatingProfileIds = "APIerSv1.GetTPRatingProfileIds" + APIerSv1GetTPDestinationRateIds = "APIerSv1.GetTPDestinationRateIds" + APIerSv1RemoveTPDestinationRate = "APIerSv1.RemoveTPDestinationRate" + APIerSv1ImportTariffPlanFromFolder = "APIerSv1.ImportTariffPlanFromFolder" + APIerSv1ExportTPToFolder = "APIerSv1.ExportTPToFolder" + APIerSv1LoadRatingPlan = "APIerSv1.LoadRatingPlan" + APIerSv1LoadRatingProfile = "APIerSv1.LoadRatingProfile" + APIerSv1LoadAccountActions = "APIerSv1.LoadAccountActions" + APIerSv1SetActions = "APIerSv1.SetActions" + APIerSv1AddTriggeredAction = "APIerSv1.AddTriggeredAction" + APIerSv1GetAccountActionTriggers = "APIerSv1.GetAccountActionTriggers" + APIerSv1AddAccountActionTriggers = "APIerSv1.AddAccountActionTriggers" + APIerSv1ResetAccountActionTriggers = "APIerSv1.ResetAccountActionTriggers" + APIerSv1SetAccountActionTriggers = "APIerSv1.SetAccountActionTriggers" + APIerSv1RemoveAccountActionTriggers = "APIerSv1.RemoveAccountActionTriggers" + APIerSv1GetScheduledActions = "APIerSv1.GetScheduledActions" + APIerSv1RemoveActionTiming = "APIerSv1.RemoveActionTiming" + APIerSv1ComputeReverseDestinations = "APIerSv1.ComputeReverseDestinations" + APIerSv1ComputeAccountActionPlans = "APIerSv1.ComputeAccountActionPlans" + APIerSv1SetDestination = "APIerSv1.SetDestination" + APIerSv1GetDataCost = "APIerSv1.GetDataCost" + APIerSv1ReplayFailedPosts = "APIerSv1.ReplayFailedPosts" + APIerSv1RemoveAccount = "APIerSv1.RemoveAccount" + APIerSv1DebitUsage = "APIerSv1.DebitUsage" + APIerSv1GetCacheStats = "APIerSv1.GetCacheStats" + APIerSv1ReloadCache = "APIerSv1.ReloadCache" + APIerSv1GetActionTriggers = "APIerSv1.GetActionTriggers" + APIerSv1SetActionTrigger = "APIerSv1.SetActionTrigger" + APIerSv1RemoveActionPlan = "APIerSv1.RemoveActionPlan" + APIerSv1RemoveActions = "APIerSv1.RemoveActions" + APIerSv1RemoveBalances = "APIerSv1.RemoveBalances" + APIerSv1ReloadCdrcConfig = "APIerSv1.ReloadCdrcConfig" + APIerSv1ReloadCdreConfig = "APIerSv1.ReloadCdreConfig" + APIerSv1GetLoadHistory = "APIerSv1.GetLoadHistory" + APIerSv1GetLoadIDs = "APIerSv1.GetLoadIDs" + APIerSv1GetLoadTimes = "APIerSv1.GetLoadTimes" + APIerSv1ExecuteScheduledActions = "APIerSv1.ExecuteScheduledActions" + APIerSv1GetSharedGroup = "APIerSv1.GetSharedGroup" + APIerSv1RemoveActionTrigger = "APIerSv1.RemoveActionTrigger" + APIerSv1GetAccount = "APIerSv1.GetAccount" ) -// ApierV1 TP APIs +// APIerSv1 TP APIs const ( - ApierV1SetTPTiming = "ApierV1.SetTPTiming" - ApierV1GetTPTiming = "ApierV1.GetTPTiming" - ApierV1RemoveTPTiming = "ApierV1.RemoveTPTiming" - ApierV1GetTPTimingIds = "ApierV1.GetTPTimingIds" - ApierV1LoadTariffPlanFromStorDb = "ApierV1.LoadTariffPlanFromStorDb" - ApierV1RemoveTPFromFolder = "ApierV1.RemoveTPFromFolder" + APIerSv1SetTPTiming = "APIerSv1.SetTPTiming" + APIerSv1GetTPTiming = "APIerSv1.GetTPTiming" + APIerSv1RemoveTPTiming = "APIerSv1.RemoveTPTiming" + APIerSv1GetTPTimingIds = "APIerSv1.GetTPTimingIds" + APIerSv1LoadTariffPlanFromStorDb = "APIerSv1.LoadTariffPlanFromStorDb" + APIerSv1RemoveTPFromFolder = "APIerSv1.RemoveTPFromFolder" ) -// ApierV2 APIs +// APIerSv2 APIs const ( - ApierV2 = "ApierV2" - ApierV2LoadTariffPlanFromFolder = "ApierV2.LoadTariffPlanFromFolder" - ApierV2GetCDRs = "ApierV2.GetCDRs" - ApierV2GetAccount = "ApierV2.GetAccount" - ApierV2GetAccounts = "ApierV2.GetAccounts" - ApierV2SetAccount = "ApierV2.SetAccount" - ApierV2CountCDRs = "ApierV2.CountCDRs" - ApierV2SetBalance = "ApierV2.SetBalance" - ApierV2SetActions = "ApierV2.SetActions" - ApierV2RemoveTPTiming = "ApierV2.RemoveTPTiming" - ApierV2GetTPDestination = "ApierV2.GetTPDestination" - ApierV2SetTPDestination = "ApierV2.SetTPDestination" - ApierV2RemoveTPDestination = "ApierV2.RemoveTPDestination" - ApierV2GetTPDestinationIDs = "ApierV2.GetTPDestinationIDs" - ApierV2GetTPTiming = "ApierV2.GetTPTiming" - ApierV2SetTPTiming = "ApierV2.SetTPTiming" - ApierV2SetAccountActionTriggers = "ApierV2.SetAccountActionTriggers" - ApierV2GetAccountActionTriggers = "ApierV2.GetAccountActionTriggers" - ApierV2SetActionPlan = "ApierV2.SetActionPlan" - ApierV2GetActions = "ApierV2.GetActions" - ApierV2GetDestinations = "ApierV2.GetDestinations" - ApierV2GetCacheStats = "ApierV2.GetCacheStats" - ApierV2ExecuteAction = "ApierV2.ExecuteAction" - ApierV2ResetAccountActionTriggers = "ApierV2.ResetAccountActionTriggers" - ApierV2RemoveActions = "ApierV2.RemoveActions" + APIerSv2 = "APIerSv2" + APIerSv2LoadTariffPlanFromFolder = "APIerSv2.LoadTariffPlanFromFolder" + APIerSv2GetCDRs = "APIerSv2.GetCDRs" + APIerSv2GetAccount = "APIerSv2.GetAccount" + APIerSv2GetAccounts = "APIerSv2.GetAccounts" + APIerSv2SetAccount = "APIerSv2.SetAccount" + APIerSv2CountCDRs = "APIerSv2.CountCDRs" + APIerSv2SetBalance = "APIerSv2.SetBalance" + APIerSv2SetActions = "APIerSv2.SetActions" + APIerSv2RemoveTPTiming = "APIerSv2.RemoveTPTiming" + APIerSv2GetTPDestination = "APIerSv2.GetTPDestination" + APIerSv2SetTPDestination = "APIerSv2.SetTPDestination" + APIerSv2RemoveTPDestination = "APIerSv2.RemoveTPDestination" + APIerSv2GetTPDestinationIDs = "APIerSv2.GetTPDestinationIDs" + APIerSv2GetTPTiming = "APIerSv2.GetTPTiming" + APIerSv2SetTPTiming = "APIerSv2.SetTPTiming" + APIerSv2SetAccountActionTriggers = "APIerSv2.SetAccountActionTriggers" + APIerSv2GetAccountActionTriggers = "APIerSv2.GetAccountActionTriggers" + APIerSv2SetActionPlan = "APIerSv2.SetActionPlan" + APIerSv2GetActions = "APIerSv2.GetActions" + APIerSv2GetDestinations = "APIerSv2.GetDestinations" + APIerSv2GetCacheStats = "APIerSv2.GetCacheStats" + APIerSv2ExecuteAction = "APIerSv2.ExecuteAction" + APIerSv2ResetAccountActionTriggers = "APIerSv2.ResetAccountActionTriggers" + APIerSv2RemoveActions = "APIerSv2.RemoveActions" ) const ( @@ -1168,19 +1168,19 @@ const ( SupplierSv1GetSuppliers = "SupplierSv1.GetSuppliers" SupplierSv1GetSupplierProfilesForEvent = "SupplierSv1.GetSupplierProfilesForEvent" SupplierSv1Ping = "SupplierSv1.Ping" - ApierV1GetSupplierProfile = "ApierV1.GetSupplierProfile" - ApierV1GetSupplierProfileIDs = "ApierV1.GetSupplierProfileIDs" - ApierV1RemoveSupplierProfile = "ApierV1.RemoveSupplierProfile" - ApierV1SetSupplierProfile = "ApierV1.SetSupplierProfile" + APIerSv1GetSupplierProfile = "APIerSv1.GetSupplierProfile" + APIerSv1GetSupplierProfileIDs = "APIerSv1.GetSupplierProfileIDs" + APIerSv1RemoveSupplierProfile = "APIerSv1.RemoveSupplierProfile" + APIerSv1SetSupplierProfile = "APIerSv1.SetSupplierProfile" ) // AttributeS APIs const ( - ApierV1SetAttributeProfile = "ApierV1.SetAttributeProfile" - ApierV1GetAttributeProfile = "ApierV1.GetAttributeProfile" - ApierV1GetAttributeProfileIDs = "ApierV1.GetAttributeProfileIDs" - ApierV1RemoveAttributeProfile = "ApierV1.RemoveAttributeProfile" - ApierV2SetAttributeProfile = "ApierV2.SetAttributeProfile" + APIerSv1SetAttributeProfile = "APIerSv1.SetAttributeProfile" + APIerSv1GetAttributeProfile = "APIerSv1.GetAttributeProfile" + APIerSv1GetAttributeProfileIDs = "APIerSv1.GetAttributeProfileIDs" + APIerSv1RemoveAttributeProfile = "APIerSv1.RemoveAttributeProfile" + APIerSv2SetAttributeProfile = "APIerSv2.SetAttributeProfile" AttributeSv1GetAttributeForEvent = "AttributeSv1.GetAttributeForEvent" AttributeSv1ProcessEvent = "AttributeSv1.ProcessEvent" AttributeSv1Ping = "AttributeSv1.Ping" @@ -1191,10 +1191,10 @@ const ( ChargerSv1Ping = "ChargerSv1.Ping" ChargerSv1GetChargersForEvent = "ChargerSv1.GetChargersForEvent" ChargerSv1ProcessEvent = "ChargerSv1.ProcessEvent" - ApierV1GetChargerProfile = "ApierV1.GetChargerProfile" - ApierV1RemoveChargerProfile = "ApierV1.RemoveChargerProfile" - ApierV1SetChargerProfile = "ApierV1.SetChargerProfile" - ApierV1GetChargerProfileIDs = "ApierV1.GetChargerProfileIDs" + APIerSv1GetChargerProfile = "APIerSv1.GetChargerProfile" + APIerSv1RemoveChargerProfile = "APIerSv1.RemoveChargerProfile" + APIerSv1SetChargerProfile = "APIerSv1.SetChargerProfile" + APIerSv1GetChargerProfileIDs = "APIerSv1.GetChargerProfileIDs" ) // ThresholdS APIs @@ -1204,24 +1204,24 @@ const ( ThresholdSv1GetThresholdIDs = "ThresholdSv1.GetThresholdIDs" ThresholdSv1Ping = "ThresholdSv1.Ping" ThresholdSv1GetThresholdsForEvent = "ThresholdSv1.GetThresholdsForEvent" - ApierV1GetThresholdProfileIDs = "ApierV1.GetThresholdProfileIDs" - ApierV1GetThresholdProfile = "ApierV1.GetThresholdProfile" - ApierV1RemoveThresholdProfile = "ApierV1.RemoveThresholdProfile" - ApierV1SetThresholdProfile = "ApierV1.SetThresholdProfile" + APIerSv1GetThresholdProfileIDs = "APIerSv1.GetThresholdProfileIDs" + APIerSv1GetThresholdProfile = "APIerSv1.GetThresholdProfile" + APIerSv1RemoveThresholdProfile = "APIerSv1.RemoveThresholdProfile" + APIerSv1SetThresholdProfile = "APIerSv1.SetThresholdProfile" ) // StatS APIs const ( - StatSv1ProcessEvent = "StatSv1.ProcessEvent" - StatSv1GetQueueIDs = "StatSv1.GetQueueIDs" - StatSv1GetQueueStringMetrics = "StatSv1.GetQueueStringMetrics" - StatSv1GetQueueFloatMetrics = "StatSv1.GetQueueFloatMetrics" - StatSv1Ping = "StatSv1.Ping" - StatSv1GetStatQueuesForEvent = "StatSv1.GetStatQueuesForEvent" - ApierV1GetStatQueueProfile = "ApierV1.GetStatQueueProfile" - ApierV1RemoveStatQueueProfile = "ApierV1.RemoveStatQueueProfile" - ApierV1SetStatQueueProfile = "ApierV1.SetStatQueueProfile" - ApierV1GetStatQueueProfileIDs = "ApierV1.GetStatQueueProfileIDs" + StatSv1ProcessEvent = "StatSv1.ProcessEvent" + StatSv1GetQueueIDs = "StatSv1.GetQueueIDs" + StatSv1GetQueueStringMetrics = "StatSv1.GetQueueStringMetrics" + StatSv1GetQueueFloatMetrics = "StatSv1.GetQueueFloatMetrics" + StatSv1Ping = "StatSv1.Ping" + StatSv1GetStatQueuesForEvent = "StatSv1.GetStatQueuesForEvent" + APIerSv1GetStatQueueProfile = "APIerSv1.GetStatQueueProfile" + APIerSv1RemoveStatQueueProfile = "APIerSv1.RemoveStatQueueProfile" + APIerSv1SetStatQueueProfile = "APIerSv1.SetStatQueueProfile" + APIerSv1GetStatQueueProfileIDs = "APIerSv1.GetStatQueueProfileIDs" ) // ResourceS APIs @@ -1232,10 +1232,10 @@ const ( ResourceSv1ReleaseResources = "ResourceSv1.ReleaseResources" ResourceSv1Ping = "ResourceSv1.Ping" ResourceSv1GetResource = "ResourceSv1.GetResource" - ApierV1SetResourceProfile = "ApierV1.SetResourceProfile" - ApierV1RemoveResourceProfile = "ApierV1.RemoveResourceProfile" - ApierV1GetResourceProfile = "ApierV1.GetResourceProfile" - ApierV1GetResourceProfileIDs = "ApierV1.GetResourceProfileIDs" + APIerSv1SetResourceProfile = "APIerSv1.SetResourceProfile" + APIerSv1RemoveResourceProfile = "APIerSv1.RemoveResourceProfile" + APIerSv1GetResourceProfile = "APIerSv1.GetResourceProfile" + APIerSv1GetResourceProfileIDs = "APIerSv1.GetResourceProfileIDs" ) // SessionS APIs diff --git a/utils/json_codec.go b/utils/json_codec.go index db4219835..07c9f11fc 100644 --- a/utils/json_codec.go +++ b/utils/json_codec.go @@ -87,7 +87,7 @@ func (c *jsonServerCodec) ReadRequestHeader(r *rpc.Request) error { if err := c.dec.Decode(&c.req); err != nil { return err } - // in case we get a request with ApierV1 or ApierV2 we redirect + // in case we get a request with APIerSv1 or APIerSv2 we redirect // to Dispatcher to send it according to ArgDispatcher if c.req.isApier = strings.HasPrefix(c.req.Method, ApierV); c.req.isApier { r.ServiceMethod = DispatcherSv1Apier @@ -115,8 +115,8 @@ func (c *jsonServerCodec) ReadRequestBody(x interface{}) error { if c.req.Params == nil { return errMissingParams } - // following example from ReadRequestHeader in case we get ApierV1 - // or ApierV2 we compose the parameters + // following example from ReadRequestHeader in case we get APIerSv1 + // or APIerSv2 we compose the parameters if c.req.isApier { cx := x.(*MethodParameters) cx.Method = c.req.Method