diff --git a/apier/v1/config_it_test.go b/apier/v1/config_it_test.go index 68ea3624b..49cb69359 100644 --- a/apier/v1/config_it_test.go +++ b/apier/v1/config_it_test.go @@ -128,26 +128,16 @@ func testConfigSReloadConfigFromJSONSessionS(t *testing.T) { t.Errorf("Expected OK received: %s", reply) } exp := map[string]interface{}{ - "Enabled": true, - "ListenBijson": "127.0.0.1:2014", - "ChargerSConns": []interface{}{utils.ConcatenatedKey(utils.MetaInternal, utils.MetaChargers)}, - "RALsConns": []interface{}{utils.ConcatenatedKey(utils.MetaInternal, utils.MetaResponder)}, - "ResSConns": []interface{}{utils.MetaLocalHost}, - "ThreshSConns": []interface{}{}, - "StatSConns": []interface{}{}, - "RouteSConns": []interface{}{utils.MetaLocalHost}, - "AttrSConns": []interface{}{utils.MetaLocalHost}, - "CDRsConns": []interface{}{utils.ConcatenatedKey(utils.MetaInternal, utils.MetaCDRs)}, - "SchedulerConns": []interface{}{}, - - "STIRCfg": map[string]interface{}{ - "AllowedAttest": map[string]interface{}{}, - "DefaultAttest": "A", - "PayloadMaxduration": -1., - "PrivateKeyPath": "", - "PublicKeyPath": "", - }, - + "Enabled": true, + "ListenBijson": "127.0.0.1:2014", + "ChargerSConns": []interface{}{utils.ConcatenatedKey(utils.MetaInternal, utils.MetaChargers)}, + "RALsConns": []interface{}{utils.ConcatenatedKey(utils.MetaInternal, utils.MetaResponder)}, + "ResSConns": []interface{}{utils.MetaLocalHost}, + "ThreshSConns": []interface{}{}, + "StatSConns": []interface{}{}, + "RouteSConns": []interface{}{utils.MetaLocalHost}, + "AttrSConns": []interface{}{utils.MetaLocalHost}, + "CDRsConns": []interface{}{utils.ConcatenatedKey(utils.MetaInternal, utils.MetaCDRs)}, "ReplicationConns": []interface{}{}, "MaxCallDuration": float64(3 * time.Hour), "MinDurLowBalance": 0., diff --git a/apier/v1/precache_it_test.go b/apier/v1/precache_it_test.go index 9adbb81ac..8b75db365 100644 --- a/apier/v1/precache_it_test.go +++ b/apier/v1/precache_it_test.go @@ -326,10 +326,6 @@ func testPrecacheGetCacheStatsAfterRestart(t *testing.T) { Items: 0, Groups: 0, }, - utils.CacheSTIR: { - Items: 0, - Groups: 0, - }, } if err := precacheRPC.Call(utils.CacheSv1GetCacheStats, args, &reply); err != nil { t.Error(err.Error()) diff --git a/apier/v1/tpsuppliers_it_test.go b/apier/v1/tproutes_it_test.go similarity index 70% rename from apier/v1/tpsuppliers_it_test.go rename to apier/v1/tproutes_it_test.go index 9662355d0..187e6bb46 100644 --- a/apier/v1/tpsuppliers_it_test.go +++ b/apier/v1/tproutes_it_test.go @@ -39,7 +39,7 @@ var ( tpSplPrfCfg *config.CGRConfig tpSplPrfRPC *rpc.Client tpSplPrfDataDire = "/usr/share/cgrates" - tpSplPr *utils.TPSupplierProfile + tpSplPr *utils.TPRouteProfile tpSplPrfDelay int tpSplPrfConfigDIR string //run tests for specific configuration ) @@ -116,8 +116,8 @@ func testTPSplPrfRPCConn(t *testing.T) { } func testTPSplPrfGetTPSplPrfBeforeSet(t *testing.T) { - var reply *utils.TPSupplier - if err := tpSplPrfRPC.Call(utils.APIerSv1GetTPSupplierProfile, + var reply *utils.TPRoute + if err := tpSplPrfRPC.Call(utils.APIerSv1GetTPRouteProfile, &utils.TPTntID{TPid: "TP1", Tenant: "cgrates.org", ID: "SUPL_1"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) @@ -125,7 +125,7 @@ func testTPSplPrfGetTPSplPrfBeforeSet(t *testing.T) { } func testTPSplPrfSetTPSplPrf(t *testing.T) { - tpSplPr = &utils.TPSupplierProfile{ + tpSplPr = &utils.TPRouteProfile{ TPid: "TP1", Tenant: "cgrates.org", ID: "SUPL_1", @@ -136,24 +136,24 @@ func testTPSplPrfSetTPSplPrf(t *testing.T) { }, Sorting: "*lowest_cost", SortingParameters: []string{}, - Suppliers: []*utils.TPSupplier{ - &utils.TPSupplier{ - ID: "supplier1", - FilterIDs: []string{"FLTR_1"}, - AccountIDs: []string{"Acc1", "Acc2"}, - RatingPlanIDs: []string{"RPL_1"}, - ResourceIDs: []string{"ResGroup1"}, - StatIDs: []string{"Stat1"}, - Weight: 10, - Blocker: false, - SupplierParameters: "SortingParam1", + Routes: []*utils.TPRoute{ + &utils.TPRoute{ + ID: "supplier1", + FilterIDs: []string{"FLTR_1"}, + AccountIDs: []string{"Acc1", "Acc2"}, + RatingPlanIDs: []string{"RPL_1"}, + ResourceIDs: []string{"ResGroup1"}, + StatIDs: []string{"Stat1"}, + Weight: 10, + Blocker: false, + RouteParameters: "SortingParam1", }, }, Weight: 20, } sort.Strings(tpSplPr.FilterIDs) var result string - if err := tpSplPrfRPC.Call(utils.APIerSv1SetTPSupplierProfile, + if err := tpSplPrfRPC.Call(utils.APIerSv1SetTPRouteProfile, tpSplPr, &result); err != nil { t.Error(err) } else if result != utils.OK { @@ -162,8 +162,8 @@ func testTPSplPrfSetTPSplPrf(t *testing.T) { } func testTPSplPrfGetTPSplPrfAfterSet(t *testing.T) { - var reply *utils.TPSupplierProfile - if err := tpSplPrfRPC.Call(utils.APIerSv1GetTPSupplierProfile, + var reply *utils.TPRouteProfile + if err := tpSplPrfRPC.Call(utils.APIerSv1GetTPRouteProfile, &utils.TPTntID{TPid: "TP1", Tenant: "cgrates.org", ID: "SUPL_1"}, &reply); err != nil { t.Fatal(err) } @@ -176,8 +176,8 @@ func testTPSplPrfGetTPSplPrfAfterSet(t *testing.T) { func testTPSplPrfGetTPSplPrfIDs(t *testing.T) { var result []string expectedTPID := []string{"cgrates.org:SUPL_1"} - if err := tpSplPrfRPC.Call(utils.APIerSv1GetTPSupplierProfileIDs, - &AttrGetTPSupplierProfileIDs{TPid: "TP1"}, &result); err != nil { + if err := tpSplPrfRPC.Call(utils.APIerSv1GetTPRouteProfileIDs, + &AttrGetTPRouteProfileIDs{TPid: "TP1"}, &result); err != nil { t.Error(err) } else if !reflect.DeepEqual(expectedTPID, result) { t.Errorf("Expecting: %+v, received: %+v", expectedTPID, result) @@ -186,60 +186,60 @@ func testTPSplPrfGetTPSplPrfIDs(t *testing.T) { } func testTPSplPrfUpdateTPSplPrf(t *testing.T) { - tpSplPr.Suppliers = []*utils.TPSupplier{ - &utils.TPSupplier{ - ID: "supplier1", - FilterIDs: []string{"FLTR_1"}, - AccountIDs: []string{"Acc1", "Acc2"}, - RatingPlanIDs: []string{"RPL_1"}, - ResourceIDs: []string{"ResGroup1"}, - StatIDs: []string{"Stat1"}, - Weight: 10, - Blocker: true, - SupplierParameters: "SortingParam1", + tpSplPr.Routes = []*utils.TPRoute{ + &utils.TPRoute{ + ID: "supplier1", + FilterIDs: []string{"FLTR_1"}, + AccountIDs: []string{"Acc1", "Acc2"}, + RatingPlanIDs: []string{"RPL_1"}, + ResourceIDs: []string{"ResGroup1"}, + StatIDs: []string{"Stat1"}, + Weight: 10, + Blocker: true, + RouteParameters: "SortingParam1", }, - &utils.TPSupplier{ - ID: "supplier2", - FilterIDs: []string{"FLTR_1"}, - AccountIDs: []string{"Acc3"}, - RatingPlanIDs: []string{"RPL_1"}, - ResourceIDs: []string{"ResGroup1"}, - StatIDs: []string{"Stat1"}, - Weight: 20, - Blocker: false, - SupplierParameters: "SortingParam2", + &utils.TPRoute{ + ID: "supplier2", + FilterIDs: []string{"FLTR_1"}, + AccountIDs: []string{"Acc3"}, + RatingPlanIDs: []string{"RPL_1"}, + ResourceIDs: []string{"ResGroup1"}, + StatIDs: []string{"Stat1"}, + Weight: 20, + Blocker: false, + RouteParameters: "SortingParam2", }, } var result string - if err := tpSplPrfRPC.Call(utils.APIerSv1SetTPSupplierProfile, + if err := tpSplPrfRPC.Call(utils.APIerSv1SetTPRouteProfile, tpSplPr, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } - sort.Slice(tpSplPr.Suppliers, func(i, j int) bool { - return strings.Compare(tpSplPr.Suppliers[i].ID, tpSplPr.Suppliers[j].ID) == -1 + sort.Slice(tpSplPr.Routes, func(i, j int) bool { + return strings.Compare(tpSplPr.Routes[i].ID, tpSplPr.Routes[j].ID) == -1 }) } func testTPSplPrfGetTPSplPrfAfterUpdate(t *testing.T) { - var reply *utils.TPSupplierProfile - if err := tpSplPrfRPC.Call(utils.APIerSv1GetTPSupplierProfile, + var reply *utils.TPRouteProfile + if err := tpSplPrfRPC.Call(utils.APIerSv1GetTPRouteProfile, &utils.TPTntID{TPid: "TP1", Tenant: "cgrates.org", ID: "SUPL_1"}, &reply); err != nil { t.Fatal(err) } sort.Strings(reply.FilterIDs) - sort.Slice(reply.Suppliers, func(i, j int) bool { - return strings.Compare(reply.Suppliers[i].ID, reply.Suppliers[j].ID) == -1 + sort.Slice(reply.Routes, func(i, j int) bool { + return strings.Compare(reply.Routes[i].ID, reply.Routes[j].ID) == -1 }) - if !reflect.DeepEqual(tpSplPr.Suppliers, reply.Suppliers) { + if !reflect.DeepEqual(tpSplPr.Routes, reply.Routes) { t.Errorf("Expecting: %+v,\n received: %+v", utils.ToJSON(tpSplPr), utils.ToJSON(reply)) } } func testTPSplPrfRemTPSplPrf(t *testing.T) { var resp string - if err := tpSplPrfRPC.Call(utils.APIerSv1RemoveTPSupplierProfile, + if err := tpSplPrfRPC.Call(utils.APIerSv1RemoveTPRouteProfile, &utils.TPTntID{TPid: "TP1", Tenant: "cgrates.org", ID: "SUPL_1"}, &resp); err != nil { t.Error(err) @@ -249,8 +249,8 @@ func testTPSplPrfRemTPSplPrf(t *testing.T) { } func testTPSplPrfGetTPSplPrfAfterRemove(t *testing.T) { - var reply *utils.TPSupplierProfile - if err := tpSplPrfRPC.Call(utils.APIerSv1GetTPSupplierProfile, + var reply *utils.TPRouteProfile + if err := tpSplPrfRPC.Call(utils.APIerSv1GetTPRouteProfile, &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/versions_it_test.go b/apier/v1/versions_it_test.go index fb964b8d3..c60e6416b 100644 --- a/apier/v1/versions_it_test.go +++ b/apier/v1/versions_it_test.go @@ -124,7 +124,7 @@ func testVrsDataDB(t *testing.T) { "Actions": 2, "RQF": 4, "ReverseDestinations": 1, "Attributes": 5, "RatingPlan": 1, "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} + "Subscribers": 1, "Routes": 1, "Thresholds": 3, "Timing": 1} if err := vrsRPC.Call(utils.APIerSv1GetDataDBVersions, "", &result); err != nil { t.Error(err) } else if expectedVrs.Compare(result, vrsStorageType, true) != "" { @@ -136,7 +136,7 @@ func testVrsStorDB(t *testing.T) { var result engine.Versions expectedVrs := engine.Versions{"TpDestinations": 1, "TpResource": 1, "TpThresholds": 1, "TpActions": 1, "TpDestinationRates": 1, "TpFilters": 1, "TpRates": 1, "CDRs": 2, "TpActionTriggers": 1, "TpRatingPlans": 1, - "TpSharedGroups": 1, "TpSuppliers": 1, "SessionSCosts": 3, "TpRatingProfiles": 1, "TpStats": 1, "TpTiming": 1, + "TpSharedGroups": 1, "TpRoutes": 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.APIerSv1GetStorDBVersions, "", &result); err != nil { @@ -164,7 +164,7 @@ func testVrsSetDataDBVrs(t *testing.T) { "Actions": 2, "RQF": 4, "ReverseDestinations": 1, "Attributes": 3, "RatingPlan": 1, "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} + "Subscribers": 1, "Routes": 1, "Thresholds": 3, "Timing": 1} if err := vrsRPC.Call(utils.APIerSv1GetDataDBVersions, "", &result); err != nil { t.Error(err) } else if expectedVrs.Compare(result, vrsStorageType, true) != "" { @@ -197,7 +197,7 @@ func testVrsSetStorDBVrs(t *testing.T) { var result engine.Versions expectedVrs := engine.Versions{"TpDestinations": 1, "TpResource": 1, "TpThresholds": 1, "TpActions": 1, "TpDestinationRates": 1, "TpFilters": 1, "TpRates": 1, "CDRs": 2, "TpActionTriggers": 1, "TpRatingPlans": 1, - "TpSharedGroups": 1, "TpSuppliers": 1, "SessionSCosts": 3, "TpRatingProfiles": 1, "TpStats": 1, "TpTiming": 1, + "TpSharedGroups": 1, "TpRoutes": 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.APIerSv1GetStorDBVersions, "", &result); err != nil { diff --git a/config/config.go b/config/config.go index b82c0470b..6d5f9e111 100755 --- a/config/config.go +++ b/config/config.go @@ -1482,7 +1482,7 @@ func (cfg *CGRConfig) AsMapInterface(separator string) map[string]interface{} { utils.StatsCfg: cfg.statsCfg.AsMapInterface(), utils.ThresholdSCfg: cfg.thresholdSCfg.AsMapInterface(), utils.RouteSCfg: cfg.routeSCfg.AsMapInterface(), - utils.SureTaxCfg: cfg.sureTaxCfg.AsMapInterface(), + utils.SureTaxCfg: cfg.sureTaxCfg.AsMapInterface(separator), utils.DispatcherSCfg: cfg.dispatcherSCfg.AsMapInterface(), utils.LoaderCgrCfg: cfg.loaderCgrCfg.AsMapInterface(), utils.MigratorCgrCfg: cfg.migratorCgrCfg.AsMapInterface(), diff --git a/config/routescfg.go b/config/routescfg.go index 5e64d897e..df678582a 100644 --- a/config/routescfg.go +++ b/config/routescfg.go @@ -117,15 +117,67 @@ func (rts *RouteSCfg) loadFromJsonCfg(jsnCfg *RouteSJsonCfg) (err error) { func (rts *RouteSCfg) AsMapInterface() map[string]interface{} { + stringIndexedFields := []string{} + if rts.StringIndexedFields != nil { + stringIndexedFields = make([]string, len(*rts.StringIndexedFields)) + for i, item := range *rts.StringIndexedFields { + stringIndexedFields[i] = item + } + } + prefixIndexedFields := []string{} + if rts.PrefixIndexedFields != nil { + prefixIndexedFields = make([]string, len(*rts.PrefixIndexedFields)) + for i, item := range *rts.PrefixIndexedFields { + prefixIndexedFields[i] = item + } + } + attributeSConns := make([]string, len(rts.AttributeSConns)) + for i, item := range rts.AttributeSConns { + buf := utils.ConcatenatedKey(utils.MetaInternal, utils.MetaAttributes) + if item == buf { + attributeSConns[i] = strings.ReplaceAll(item, utils.CONCATENATED_KEY_SEP+utils.MetaAttributes, utils.EmptyString) + } else { + attributeSConns[i] = item + } + } + responderSConns := make([]string, len(rts.ResponderSConns)) + for i, item := range rts.ResponderSConns { + buf := utils.ConcatenatedKey(utils.MetaInternal, utils.MetaResponder) + + if item == buf { + responderSConns[i] = strings.ReplaceAll(item, utils.CONCATENATED_KEY_SEP+utils.MetaResponder, utils.EmptyString) + } else { + responderSConns[i] = item + } + } + resourceSConns := make([]string, len(rts.ResourceSConns)) + for i, item := range rts.ResourceSConns { + buf := utils.ConcatenatedKey(utils.MetaInternal, utils.MetaResources) + if item == buf { + resourceSConns[i] = strings.ReplaceAll(item, utils.CONCATENATED_KEY_SEP+utils.MetaResources, utils.EmptyString) + } else { + resourceSConns[i] = item + } + } + statSConns := make([]string, len(rts.StatSConns)) + for i, item := range rts.StatSConns { + buf := utils.ConcatenatedKey(utils.MetaInternal, utils.MetaStatS) + if item == buf { + statSConns[i] = strings.ReplaceAll(item, utils.CONCATENATED_KEY_SEP+utils.MetaStatS, utils.EmptyString) + } else { + statSConns[i] = item + } + } + return map[string]interface{}{ utils.EnabledCfg: rts.Enabled, utils.IndexedSelectsCfg: rts.IndexedSelects, - utils.StringIndexedFieldsCfg: rts.StringIndexedFields, - utils.PrefixIndexedFieldsCfg: rts.PrefixIndexedFields, - utils.AttributeSConnsCfg: rts.AttributeSConns, - utils.ResourceSConnsCfg: rts.ResourceSConns, - utils.StatSConnsCfg: rts.StatSConns, - utils.RALsConnsCfg: rts.ResponderSConns, + utils.StringIndexedFieldsCfg: stringIndexedFields, + utils.PrefixIndexedFieldsCfg: prefixIndexedFields, + utils.AttributeSConnsCfg: attributeSConns, + utils.ResourceSConnsCfg: resourceSConns, + utils.StatSConnsCfg: statSConns, + utils.RALsConnsCfg: responderSConns, utils.DefaultRatioCfg: rts.DefaultRatio, utils.NestedFieldsCfg: rts.NestedFields, } diff --git a/config/routescfg_test.go b/config/routescfg_test.go index 9ee006a3d..a3539c381 100644 --- a/config/routescfg_test.go +++ b/config/routescfg_test.go @@ -24,7 +24,7 @@ import ( "github.com/cgrates/cgrates/utils" ) -func TestSupplierSCfgloadFromJsonCfg(t *testing.T) { +func TestRouteSCfgloadFromJsonCfg(t *testing.T) { var supscfg, expected RouteSCfg if err := supscfg.loadFromJsonCfg(nil); err != nil { t.Error(err) @@ -65,10 +65,10 @@ func TestSupplierSCfgloadFromJsonCfg(t *testing.T) { } } -func TestSupplierSCfgAsMapInterface(t *testing.T) { - var supscfg SupplierSCfg +func TestRouteSCfgAsMapInterface(t *testing.T) { + var supscfg RouteSCfg cfgJSONStr := `{ - "suppliers": { + "routes": { "enabled": false, "indexed_selects":true, "prefix_indexed_fields": [], @@ -94,7 +94,7 @@ func TestSupplierSCfgAsMapInterface(t *testing.T) { } if jsnCfg, err := NewCgrJsonCfgFromBytes([]byte(cfgJSONStr)); err != nil { t.Error(err) - } else if jsnSupSCfg, err := jsnCfg.SupplierSJsonCfg(); err != nil { + } else if jsnSupSCfg, err := jsnCfg.RouteSJsonCfg(); err != nil { t.Error(err) } else if err = supscfg.loadFromJsonCfg(jsnSupSCfg); err != nil { t.Error(err) @@ -103,7 +103,7 @@ func TestSupplierSCfgAsMapInterface(t *testing.T) { } cfgJSONStr = `{ - "suppliers": { + "routes": { "enabled": false, "indexed_selects":true, "prefix_indexed_fields": ["prefix","indexed","fields"], @@ -129,7 +129,7 @@ func TestSupplierSCfgAsMapInterface(t *testing.T) { } if jsnCfg, err := NewCgrJsonCfgFromBytes([]byte(cfgJSONStr)); err != nil { t.Error(err) - } else if jsnSupSCfg, err := jsnCfg.SupplierSJsonCfg(); err != nil { + } else if jsnSupSCfg, err := jsnCfg.RouteSJsonCfg(); err != nil { t.Error(err) } else if err = supscfg.loadFromJsonCfg(jsnSupSCfg); err != nil { t.Error(err) diff --git a/config/sessionscfg.go b/config/sessionscfg.go index b0e2cf29e..ea4fc69f6 100644 --- a/config/sessionscfg.go +++ b/config/sessionscfg.go @@ -375,13 +375,13 @@ func (scfg *SessionSCfg) AsMapInterface() map[string]interface{} { statSConns[i] = item } } - supplSConns := make([]string, len(scfg.SupplSConns)) - for i, item := range scfg.SupplSConns { - buf := utils.ConcatenatedKey(utils.MetaInternal, utils.MetaSuppliers) + routesConns := make([]string, len(scfg.RouteSConns)) + for i, item := range scfg.RouteSConns { + buf := utils.ConcatenatedKey(utils.MetaInternal, utils.MetaRoutes) if item == buf { - supplSConns[i] = strings.ReplaceAll(item, utils.CONCATENATED_KEY_SEP+utils.MetaSuppliers, utils.EmptyString) + routesConns[i] = strings.ReplaceAll(item, utils.CONCATENATED_KEY_SEP+utils.MetaRoutes, utils.EmptyString) } else { - supplSConns[i] = item + routesConns[i] = item } } attrSConns := make([]string, len(scfg.AttrSConns)) @@ -414,14 +414,14 @@ func (scfg *SessionSCfg) AsMapInterface() map[string]interface{} { return map[string]interface{}{ utils.EnabledCfg: scfg.Enabled, utils.ListenBijsonCfg: scfg.ListenBijson, - utils.ChargerSConnsCfg: scfg.ChargerSConns, - utils.RALsConnsCfg: scfg.RALsConns, - utils.ResSConnsCfg: scfg.ResSConns, - utils.ThreshSConnsCfg: scfg.ThreshSConns, - utils.StatSConnsCfg: scfg.StatSConns, - utils.RouteSConnsCfg: scfg.RouteSConns, - utils.AttrSConnsCfg: scfg.AttrSConns, - utils.CDRsConnsCfg: scfg.CDRsConns, + utils.ChargerSConnsCfg: chargerSConns, + utils.RALsConnsCfg: RALsConns, + utils.ResSConnsCfg: resSConns, + utils.ThreshSConnsCfg: threshSConns, + utils.StatSConnsCfg: statSConns, + utils.RouteSConnsCfg: routesConns, + utils.AttrSConnsCfg: attrSConns, + utils.CDRsConnsCfg: CDRsConns, utils.ReplicationConnsCfg: scfg.ReplicationConns, utils.DebitIntervalCfg: debitInterval, utils.StoreSCostsCfg: scfg.StoreSCosts, diff --git a/config/sessionscfg_test.go b/config/sessionscfg_test.go index a820e08c3..072a12851 100644 --- a/config/sessionscfg_test.go +++ b/config/sessionscfg_test.go @@ -168,7 +168,7 @@ func TestSessionSCfgAsMapInterface(t *testing.T) { "resources_conns": []string{}, "thresholds_conns": []string{}, "stats_conns": []string{}, - "suppliers_conns": []string{}, + "routes_conns": []string{}, "attributes_conns": []string{}, "replication_conns": []string{}, "debit_interval": "0", @@ -213,7 +213,7 @@ func TestSessionSCfgAsMapInterface(t *testing.T) { "resources_conns": ["*internal"], "thresholds_conns": ["*internal"], "stats_conns": ["*internal"], - "suppliers_conns": ["*internal"], + "routes_conns": ["*internal"], "attributes_conns": ["*internal"], "replication_conns": ["*localhost"], "debit_interval": "0s", @@ -245,7 +245,7 @@ func TestSessionSCfgAsMapInterface(t *testing.T) { "resources_conns": []string{"*internal"}, "thresholds_conns": []string{"*internal"}, "stats_conns": []string{"*internal"}, - "suppliers_conns": []string{"*internal"}, + "routes_conns": []string{"*internal"}, "attributes_conns": []string{"*internal"}, "replication_conns": []string{"*localhost"}, "debit_interval": "0", @@ -278,7 +278,7 @@ func TestSessionSCfgAsMapInterface(t *testing.T) { } else if err = sescfg.loadFromJsonCfg(jsnSesCfg); err != nil { t.Error(err) } else if rcv := sescfg.AsMapInterface(); !reflect.DeepEqual(eMap, rcv) { - t.Errorf("\nExpected: %+v\nRecived: %+v", utils.ToJSON(eMap), utils.ToJSON(rcv)) + t.Errorf("\nExpected: %+v\nRecived: %+v", eMap, rcv) } } diff --git a/data/conf/samples/dnsagent_internal/suppliers.json b/data/conf/samples/dnsagent_internal/suppliers.json index a845df6ef..6290fc820 100644 --- a/data/conf/samples/dnsagent_internal/suppliers.json +++ b/data/conf/samples/dnsagent_internal/suppliers.json @@ -3,10 +3,10 @@ "dns_agent": { "request_processors": [ { - "id": "NAPTRSuppliersQuery", + "id": "NAPTRRoutesQuery", "filters": ["*string:~*vars.QueryType:NAPTR", "*string:~*vars.E164Address:4986517174965"], - "flags": ["*message", "*suppliers","*continue"], + "flags": ["*message", "*routes","*continue"], "request_fields":[ {"tag": "ToR", "path": "*cgreq.Account", "type": "*constant", "value": "1001"}, // so we can match the supplier profile ], @@ -19,7 +19,7 @@ "id": "NAPTRSuppliersOneSupplier", "filters": ["*string:~*vars.QueryType:NAPTR", "*string:~*vars.E164Address:4986517174965", - "*gte:~*cgrep.Suppliers.Count:1"], + "*gte:~*cgrep.Routes.Count:1"], "flags": ["*none","*continue"], // do not send request to CGRateS "reply_fields":[ {"tag": "NAPTROrder", "path": "*rep.Order", @@ -31,7 +31,7 @@ {"tag": "NAPTRService", "path": "*rep.Service", "type": "*group", "value": "E2U+SIP"}, {"tag": "NAPTRRegexp", "path": "*rep.Regexp", "type": "*group", - "value": "~*cgrep.Suppliers.SortedSuppliers[0].SupplierParameters"}, + "value": "~*cgrep.Routes.SortedRoutes[0].RouteParameters"}, {"tag": "NAPTRReplacement", "path": "*rep.Replacement", "type": "*group", "value": "."}, ], @@ -40,7 +40,7 @@ "id": "NAPTRSuppliersTwoSuppliers", "filters": ["*string:~*vars.QueryType:NAPTR", "*string:~*vars.E164Address:4986517174965", - "*gte:~*cgrep.Suppliers.Count:2"], + "*gte:~*cgrep.Routes.Count:2"], "flags": ["*none","*continue"], "reply_fields":[ {"tag": "NAPTROrder", "type": "*group", "new_branch": true, @@ -52,7 +52,7 @@ {"tag": "NAPTRService", "path": "*rep.Service", "type": "*group", "value": "E2U+SIP"}, {"tag": "NAPTRRegexp", "path": "*rep.Regexp", "type": "*group", - "value": "~*cgrep.Suppliers.SortedSuppliers[1].SupplierParameters"}, + "value": "~*cgrep.Routes.SortedRoutes[1].RouteParameters"}, {"tag": "NAPTRReplacement", "path": "*rep.Replacement", "type": "*group", "value": "."}, ], diff --git a/data/conf/samples/dnsagent_mongo/suppliers.json b/data/conf/samples/dnsagent_mongo/suppliers.json index 3427261f8..7078bac4c 100644 --- a/data/conf/samples/dnsagent_mongo/suppliers.json +++ b/data/conf/samples/dnsagent_mongo/suppliers.json @@ -3,10 +3,10 @@ "dns_agent": { "request_processors": [ { - "id": "NAPTRSuppliersQuery", + "id": "NAPTRRoutesQuery", "filters": ["*string:~*vars.QueryType:NAPTR", "*string:~*vars.E164Address:4986517174965"], - "flags": ["*message", "*suppliers","*continue"], + "flags": ["*message", "*routes","*continue"], "request_fields":[ {"tag": "ToR", "path": "*cgreq.Account", "type": "*constant", "value": "1001"}, // so we can match the supplier profile ], @@ -19,7 +19,7 @@ "id": "NAPTRSuppliersOneSupplier", "filters": ["*string:~*vars.QueryType:NAPTR", "*string:~*vars.E164Address:4986517174965", - "*gte:~*cgrep.Suppliers.Count:1"], + "*gte:~*cgrep.Routes.Count:1"], "flags": ["*none","*continue"], // do not send request to CGRateS "reply_fields":[ {"tag": "NAPTROrder", "path": "*rep.Order", @@ -31,7 +31,7 @@ {"tag": "NAPTRService", "path": "*rep.Service", "type": "*group", "value": "E2U+SIP"}, {"tag": "NAPTRRegexp", "path": "*rep.Regexp", "type": "*group", - "value": "~*cgrep.Suppliers.SortedSuppliers[0].SupplierParameters"}, + "value": "~*cgrep.Routes.SortedRoutes[0].RouteParameters"}, {"tag": "NAPTRReplacement", "path": "*rep.Replacement", "type": "*group", "value": "."}, ], @@ -40,7 +40,7 @@ "id": "NAPTRSuppliersTwoSuppliers", "filters": ["*string:~*vars.QueryType:NAPTR", "*string:~*vars.E164Address:4986517174965", - "*gte:~*cgrep.Suppliers.Count:2"], + "*gte:~*cgrep.Routes.Count:2"], "flags": ["*none","*continue"], "reply_fields":[ {"tag": "NAPTROrder", "type": "*group", "new_branch": true, @@ -52,7 +52,7 @@ {"tag": "NAPTRService", "path": "*rep.Service", "type": "*group", "value": "E2U+SIP"}, {"tag": "NAPTRRegexp", "path": "*rep.Regexp", "type": "*group", - "value": "~*cgrep.Suppliers.SortedSuppliers[1].SupplierParameters"}, + "value": "~*cgrep.Routes.SortedRoutes[1].RouteParameters"}, {"tag": "NAPTRReplacement", "path": "*rep.Replacement", "type": "*group", "value": "."}, ], diff --git a/data/conf/samples/dnsagent_mysql/suppliers.json b/data/conf/samples/dnsagent_mysql/suppliers.json index 3427261f8..7078bac4c 100644 --- a/data/conf/samples/dnsagent_mysql/suppliers.json +++ b/data/conf/samples/dnsagent_mysql/suppliers.json @@ -3,10 +3,10 @@ "dns_agent": { "request_processors": [ { - "id": "NAPTRSuppliersQuery", + "id": "NAPTRRoutesQuery", "filters": ["*string:~*vars.QueryType:NAPTR", "*string:~*vars.E164Address:4986517174965"], - "flags": ["*message", "*suppliers","*continue"], + "flags": ["*message", "*routes","*continue"], "request_fields":[ {"tag": "ToR", "path": "*cgreq.Account", "type": "*constant", "value": "1001"}, // so we can match the supplier profile ], @@ -19,7 +19,7 @@ "id": "NAPTRSuppliersOneSupplier", "filters": ["*string:~*vars.QueryType:NAPTR", "*string:~*vars.E164Address:4986517174965", - "*gte:~*cgrep.Suppliers.Count:1"], + "*gte:~*cgrep.Routes.Count:1"], "flags": ["*none","*continue"], // do not send request to CGRateS "reply_fields":[ {"tag": "NAPTROrder", "path": "*rep.Order", @@ -31,7 +31,7 @@ {"tag": "NAPTRService", "path": "*rep.Service", "type": "*group", "value": "E2U+SIP"}, {"tag": "NAPTRRegexp", "path": "*rep.Regexp", "type": "*group", - "value": "~*cgrep.Suppliers.SortedSuppliers[0].SupplierParameters"}, + "value": "~*cgrep.Routes.SortedRoutes[0].RouteParameters"}, {"tag": "NAPTRReplacement", "path": "*rep.Replacement", "type": "*group", "value": "."}, ], @@ -40,7 +40,7 @@ "id": "NAPTRSuppliersTwoSuppliers", "filters": ["*string:~*vars.QueryType:NAPTR", "*string:~*vars.E164Address:4986517174965", - "*gte:~*cgrep.Suppliers.Count:2"], + "*gte:~*cgrep.Routes.Count:2"], "flags": ["*none","*continue"], "reply_fields":[ {"tag": "NAPTROrder", "type": "*group", "new_branch": true, @@ -52,7 +52,7 @@ {"tag": "NAPTRService", "path": "*rep.Service", "type": "*group", "value": "E2U+SIP"}, {"tag": "NAPTRRegexp", "path": "*rep.Regexp", "type": "*group", - "value": "~*cgrep.Suppliers.SortedSuppliers[1].SupplierParameters"}, + "value": "~*cgrep.Routes.SortedRoutes[1].RouteParameters"}, {"tag": "NAPTRReplacement", "path": "*rep.Replacement", "type": "*group", "value": "."}, ], diff --git a/data/tariffplans/dispatchers/Attributes.csv b/data/tariffplans/dispatchers/Attributes.csv index 371f32d75..9ff0705bc 100644 --- a/data/tariffplans/dispatchers/Attributes.csv +++ b/data/tariffplans/dispatchers/Attributes.csv @@ -6,7 +6,7 @@ cgrates.org,ATTR_API_ATTR_FAKE_AUTH,*auth,*string:~*req.APIKey:12345,,,*req.APIM cgrates.org,ATTR_API_ATTR_AUTH,*auth,*string:~*req.APIKey:attr12345,,,*req.APIMethods,*constant,AttributeSv1.Ping&AttributeSv1.GetAttributeForEvent&AttributeSv1.ProcessEvent,false,20 cgrates.org,ATTR_API_CHRG_AUTH,*auth,*string:~*req.APIKey:chrg12345,,,*req.APIMethods,*constant,ChargerSv1.Ping&ChargerSv1.GetChargersForEvent&ChargerSv1.ProcessEvent,false,20 cgrates.org,ATTR_API_THR_AUTH,*auth,*string:~*req.APIKey:thr12345,,,*req.APIMethods,*constant,ThresholdSv1.Ping&ThresholdSv1.GetThresholdsForEvent&ThresholdSv1.ProcessEvent&ThresholdSv1.GetThreshold&ThresholdSv1.GetThresholdIDs,false,20 -cgrates.org,ATTR_API_SUP_AUTH,*auth,*string:~*req.APIKey:sup12345,,,*req.APIMethods,*constant,SupplierSv1.Ping&SupplierSv1.GetSuppliers&SupplierSv1.GetSupplierProfilesForEvent,false,20 +cgrates.org,ATTR_API_SUP_AUTH,*auth,*string:~*req.APIKey:sup12345,,,*req.APIMethods,*constant,RouteSv1.Ping&RouteSv1.GetRoutes&RouteSv1.GetRouteProfilesForEvent,false,20 cgrates.org,ATTR_API_STAT_AUTH,*auth,*string:~*req.APIKey:stat12345,,,*req.APIMethods,*constant,StatSv1.Ping&StatSv1.GetStatQueuesForEvent&StatSv1.GetQueueStringMetrics&StatSv1.ProcessEvent&StatSv1.GetQueueIDs&StatSv1.GetQueueFloatMetrics,false,20 cgrates.org,ATTR_API_RES_AUTH,*auth,*string:~*req.APIKey:res12345,,,*req.APIMethods,*constant,ResourceSv1.Ping&ResourceSv1.GetResourcesForEvent&ResourceSv1.AuthorizeResources&ResourceSv1.AllocateResources&ResourceSv1.ReleaseResources&ResourceSv1.GetResource,false,20 cgrates.org,ATTR_API_SES_AUTH,*auth,*string:~*req.APIKey:ses12345,,,*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&SessionSv1.ProcessEvent&SessionSv1.GetCost&SessionSv1.STIRAuthenticate&SessionSv1.STIRIdentity,false,20 @@ -20,5 +20,5 @@ cgrates.org,ATTR_API_PSE_AUTH,*auth,*string:~*req.APIKey:pse12345,,,*req.APIMeth 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,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 -cgrates.org,ATTR_API_REPLICATOR_AUTH,*auth,*string:~*req.APIKey:repl12345,,,*req.APIMethods,*constant,ReplicatorSv1.Ping&ReplicatorSv1.GetAccount&ReplicatorSv1.SetAccount&ReplicatorSv1.RemoveAccount&ReplicatorSv1.GetSupplierProfile&ReplicatorSv1.SetSupplierProfile&ReplicatorSv1.RemoveSupplierProfile&ReplicatorSv1.GetAttributeProfile&ReplicatorSv1.SetAttributeProfile&ReplicatorSv1.RemoveAttributeProfile&ReplicatorSv1.SetChargerProfile&ReplicatorSv1.GetChargerProfile&ReplicatorSv1.RemoveChargerProfile&ReplicatorSv1.GetDispatcherProfile&ReplicatorSv1.SetDispatcherProfile&ReplicatorSv1.RemoveDispatcherProfile&ReplicatorSv1.GetDispatcherHost&ReplicatorSv1.SetDispatcherHost&ReplicatorSv1.RemoveDispatcherHost&ReplicatorSv1.GetFilter&ReplicatorSv1.SetFilter&ReplicatorSv1.RemoveFilter&ReplicatorSv1.GetThreshold&ReplicatorSv1.SetThreshold&ReplicatorSv1.RemoveThreshold&ReplicatorSv1.GetStatQueue&ReplicatorSv1.SetStatQueue&ReplicatorSv1.RemoveStatQueue&ReplicatorSv1.GetResource&ReplicatorSv1.SetResource&ReplicatorSv1.RemoveResource&ReplicatorSv1.GetResourceProfile&ReplicatorSv1.SetResourceProfile&ReplicatorSv1.RemoveResourceProfile&ReplicatorSv1.GetStatQueueProfile&ReplicatorSv1.SetStatQueueProfile&ReplicatorSv1.RemoveStatQueueProfile&ReplicatorSv1.GetThresholdProfile&ReplicatorSv1.SetThresholdProfile&ReplicatorSv1.RemoveThresholdProfile&ReplicatorSv1.GetTiming&ReplicatorSv1.SetTiming&ReplicatorSv1.RemoveTiming&ReplicatorSv1.GetActionTriggers&ReplicatorSv1.SetActionTriggers&ReplicatorSv1.RemoveActionTriggers&ReplicatorSv1.SetSharedGroup&ReplicatorSv1.GetSharedGroup&ReplicatorSv1.RemoveSharedGroup&ReplicatorSv1.SetActions&ReplicatorSv1.GetActions&ReplicatorSv1.RemoveActions&ReplicatorSv1.SetActionPlan&ReplicatorSv1.GetActionPlan&ReplicatorSv1.RemoveActionPlan&ReplicatorSv1.SetAccountActionPlans&ReplicatorSv1.GetAccountActionPlans&ReplicatorSv1.RemAccountActionPlans&ReplicatorSv1.SetRatingPlan&ReplicatorSv1.GetRatingPlan&ReplicatorSv1.RemoveRatingPlan&ReplicatorSv1.SetRatingProfile&ReplicatorSv1.GetRatingProfile&ReplicatorSv1.RemoveRatingProfile&ReplicatorSv1.SetDestination&ReplicatorSv1.GetDestination&ReplicatorSv1.RemoveDestination&ReplicatorSv1.SetLoadIDs&ReplicatorSv1.GetItemLoadIDs,false,20 +cgrates.org,ATTR_API_REPLICATOR_AUTH,*auth,*string:~*req.APIKey:repl12345,,,*req.APIMethods,*constant,ReplicatorSv1.Ping&ReplicatorSv1.GetAccount&ReplicatorSv1.SetAccount&ReplicatorSv1.RemoveAccount&ReplicatorSv1.GetRouteProfile&ReplicatorSv1.SetRouteProfile&ReplicatorSv1.RemoveRouteProfile&ReplicatorSv1.GetAttributeProfile&ReplicatorSv1.SetAttributeProfile&ReplicatorSv1.RemoveAttributeProfile&ReplicatorSv1.SetChargerProfile&ReplicatorSv1.GetChargerProfile&ReplicatorSv1.RemoveChargerProfile&ReplicatorSv1.GetDispatcherProfile&ReplicatorSv1.SetDispatcherProfile&ReplicatorSv1.RemoveDispatcherProfile&ReplicatorSv1.GetDispatcherHost&ReplicatorSv1.SetDispatcherHost&ReplicatorSv1.RemoveDispatcherHost&ReplicatorSv1.GetFilter&ReplicatorSv1.SetFilter&ReplicatorSv1.RemoveFilter&ReplicatorSv1.GetThreshold&ReplicatorSv1.SetThreshold&ReplicatorSv1.RemoveThreshold&ReplicatorSv1.GetStatQueue&ReplicatorSv1.SetStatQueue&ReplicatorSv1.RemoveStatQueue&ReplicatorSv1.GetResource&ReplicatorSv1.SetResource&ReplicatorSv1.RemoveResource&ReplicatorSv1.GetResourceProfile&ReplicatorSv1.SetResourceProfile&ReplicatorSv1.RemoveResourceProfile&ReplicatorSv1.GetStatQueueProfile&ReplicatorSv1.SetStatQueueProfile&ReplicatorSv1.RemoveStatQueueProfile&ReplicatorSv1.GetThresholdProfile&ReplicatorSv1.SetThresholdProfile&ReplicatorSv1.RemoveThresholdProfile&ReplicatorSv1.GetTiming&ReplicatorSv1.SetTiming&ReplicatorSv1.RemoveTiming&ReplicatorSv1.GetActionTriggers&ReplicatorSv1.SetActionTriggers&ReplicatorSv1.RemoveActionTriggers&ReplicatorSv1.SetSharedGroup&ReplicatorSv1.GetSharedGroup&ReplicatorSv1.RemoveSharedGroup&ReplicatorSv1.SetActions&ReplicatorSv1.GetActions&ReplicatorSv1.RemoveActions&ReplicatorSv1.SetActionPlan&ReplicatorSv1.GetActionPlan&ReplicatorSv1.RemoveActionPlan&ReplicatorSv1.SetAccountActionPlans&ReplicatorSv1.GetAccountActionPlans&ReplicatorSv1.RemAccountActionPlans&ReplicatorSv1.SetRatingPlan&ReplicatorSv1.GetRatingPlan&ReplicatorSv1.RemoveRatingPlan&ReplicatorSv1.SetRatingProfile&ReplicatorSv1.GetRatingProfile&ReplicatorSv1.RemoveRatingProfile&ReplicatorSv1.SetDestination&ReplicatorSv1.GetDestination&ReplicatorSv1.RemoveDestination&ReplicatorSv1.SetLoadIDs&ReplicatorSv1.GetItemLoadIDs,false,20 cgrates.org,ATTR_API_CDRSV2,*auth,*string:~*req.APIKey:cdrsv212345,,,*req.APIMethods,*constant,CDRsV2.ProcessEvent&CDRsV2.StoreSessionCost,false,20 diff --git a/dispatchers/replicator_it_test.go b/dispatchers/replicator_it_test.go index 8131bf306..fa16926de 100644 --- a/dispatchers/replicator_it_test.go +++ b/dispatchers/replicator_it_test.go @@ -190,10 +190,10 @@ func testDspRplAccount(t *testing.T) { } func testDspRplSupplierProfile(t *testing.T) { - // Set SupplierProfile + // Set RouteProfile var replyStr string - argSetSupplierProfile := &engine.SupplierProfileWithArgDispatcher{ - SupplierProfile: &engine.SupplierProfile{ + argSetSupplierProfile := &engine.RouteProfileWithArgDispatcher{ + RouteProfile: &engine.RouteProfile{ Tenant: "cgrates.org", ID: "ID", }, @@ -201,15 +201,15 @@ func testDspRplSupplierProfile(t *testing.T) { APIKey: utils.StringPointer("repl12345")}, } - if err := dispEngine.RPC.Call(utils.ReplicatorSv1SetSupplierProfile, argSetSupplierProfile, &replyStr); err != nil { + if err := dispEngine.RPC.Call(utils.ReplicatorSv1SetRouteProfile, argSetSupplierProfile, &replyStr); err != nil { t.Error("Unexpected error when calling ReplicatorSv1.SetSupplierProfile: ", err) } else if replyStr != utils.OK { t.Error("Unexpected reply returned", replyStr) } - // Get SupplierProfile - var reply *engine.SupplierProfile - argSupplierProfile := &utils.TenantIDWithArgDispatcher{ + // Get RouteProfile + var reply *engine.RouteProfile + argRouteProfile := &utils.TenantIDWithArgDispatcher{ TenantID: &utils.TenantID{ Tenant: "cgrates.org", ID: "ID", @@ -217,7 +217,7 @@ func testDspRplSupplierProfile(t *testing.T) { ArgDispatcher: &utils.ArgDispatcher{ APIKey: utils.StringPointer("repl12345")}, } - if err := dispEngine.RPC.Call(utils.ReplicatorSv1GetSupplierProfile, argSupplierProfile, &reply); err != nil { + if err := dispEngine.RPC.Call(utils.ReplicatorSv1GetRouteProfile, argRouteProfile, &reply); err != nil { t.Error("Unexpected error when calling ReplicatorSv1.GetSupplierProfile: ", err) } else if reply.ID != argSetSupplierProfile.ID { t.Errorf("Expecting: %+v, received: %+v", argSetSupplierProfile.ID, reply.ID) @@ -228,8 +228,8 @@ func testDspRplSupplierProfile(t *testing.T) { // Stop engine 1 allEngine.stopEngine(t) - // Get SupplierProfile - if err := dispEngine.RPC.Call(utils.ReplicatorSv1GetSupplierProfile, argSupplierProfile, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { + // Get RouteProfile + if err := dispEngine.RPC.Call(utils.ReplicatorSv1GetRouteProfile, argRouteProfile, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Errorf("Expecting: %+v, received: %+v, ", utils.ErrNotFound, err) } @@ -237,13 +237,13 @@ func testDspRplSupplierProfile(t *testing.T) { allEngine.startEngine(t) // Remove SupplierProfile - if err := dispEngine.RPC.Call(utils.ReplicatorSv1RemoveSupplierProfile, argSupplierProfile, &replyStr); err != nil { + if err := dispEngine.RPC.Call(utils.ReplicatorSv1RemoveRouteProfile, argRouteProfile, &replyStr); err != nil { t.Error(err) } else if replyStr != utils.OK { t.Error("Unexpected reply returned", replyStr) } - // Get SupplierProfile - if err := dispEngine.RPC.Call(utils.ReplicatorSv1GetSupplierProfile, argSupplierProfile, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { + // Get RouteProfile + if err := dispEngine.RPC.Call(utils.ReplicatorSv1GetRouteProfile, argRouteProfile, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Errorf("Expecting: %+v, received: %+v, ", utils.ErrNotFound, err) } } diff --git a/dispatchers/suppliers_it_test.go b/dispatchers/routes_it_test.go similarity index 73% rename from dispatchers/suppliers_it_test.go rename to dispatchers/routes_it_test.go index ba0fe07e3..5efe86249 100755 --- a/dispatchers/suppliers_it_test.go +++ b/dispatchers/routes_it_test.go @@ -70,12 +70,12 @@ func TestDspSupplierS(t *testing.T) { func testDspSupPing(t *testing.T) { var reply string - if err := allEngine.RPC.Call(utils.SupplierSv1Ping, new(utils.CGREvent), &reply); err != nil { + if err := allEngine.RPC.Call(utils.RouteSv1Ping, new(utils.CGREvent), &reply); err != nil { t.Error(err) } else if reply != utils.Pong { t.Errorf("Received: %s", reply) } - if err := dispEngine.RPC.Call(utils.SupplierSv1Ping, &utils.CGREventWithArgDispatcher{ + if err := dispEngine.RPC.Call(utils.RouteSv1Ping, &utils.CGREventWithArgDispatcher{ CGREvent: &utils.CGREvent{ Tenant: "cgrates.org", }, @@ -91,7 +91,7 @@ func testDspSupPing(t *testing.T) { func testDspSupPingFailover(t *testing.T) { var reply string - if err := allEngine.RPC.Call(utils.SupplierSv1Ping, new(utils.CGREvent), &reply); err != nil { + if err := allEngine.RPC.Call(utils.RouteSv1Ping, new(utils.CGREvent), &reply); err != nil { t.Error(err) } else if reply != utils.Pong { t.Errorf("Received: %s", reply) @@ -104,19 +104,19 @@ func testDspSupPingFailover(t *testing.T) { APIKey: utils.StringPointer("sup12345"), }, } - if err := dispEngine.RPC.Call(utils.SupplierSv1Ping, &ev, &reply); err != nil { + if err := dispEngine.RPC.Call(utils.RouteSv1Ping, &ev, &reply); err != nil { t.Error(err) } else if reply != utils.Pong { t.Errorf("Received: %s", reply) } allEngine.stopEngine(t) - if err := dispEngine.RPC.Call(utils.SupplierSv1Ping, &ev, &reply); err != nil { + if err := dispEngine.RPC.Call(utils.RouteSv1Ping, &ev, &reply); err != nil { t.Error(err) } else if reply != utils.Pong { t.Errorf("Received: %s", reply) } allEngine2.stopEngine(t) - if err := dispEngine.RPC.Call(utils.SupplierSv1Ping, &ev, &reply); err == nil { + if err := dispEngine.RPC.Call(utils.RouteSv1Ping, &ev, &reply); err == nil { t.Errorf("Expected error but recived %v and reply %v\n", err, reply) } allEngine.startEngine(t) @@ -124,29 +124,29 @@ func testDspSupPingFailover(t *testing.T) { } func testDspSupGetSupFailover(t *testing.T) { - var rpl *engine.SortedSuppliers - eRpl1 := &engine.SortedSuppliers{ + var rpl *engine.SortedRoutes + eRpl1 := &engine.SortedRoutes{ ProfileID: "SPL_WEIGHT_2", Sorting: utils.MetaWeight, Count: 1, - SortedSuppliers: []*engine.SortedSupplier{ + SortedRoutes: []*engine.SortedRoute{ { - SupplierID: "supplier1", - SupplierParameters: "", + RouteID: "supplier1", + RouteParameters: "", SortingData: map[string]interface{}{ utils.Weight: 10.0, }, }, }, } - eRpl := &engine.SortedSuppliers{ + eRpl := &engine.SortedRoutes{ ProfileID: "SPL_ACNT_1002", Sorting: utils.MetaLC, Count: 2, - SortedSuppliers: []*engine.SortedSupplier{ + SortedRoutes: []*engine.SortedRoute{ { - SupplierID: "supplier1", - SupplierParameters: "", + RouteID: "supplier1", + RouteParameters: "", SortingData: map[string]interface{}{ utils.Cost: 0.3166, utils.RatingPlanID: "RP_1002_LOW", @@ -154,8 +154,8 @@ func testDspSupGetSupFailover(t *testing.T) { }, }, { - SupplierID: "supplier2", - SupplierParameters: "", + RouteID: "supplier2", + RouteParameters: "", SortingData: map[string]interface{}{ utils.Cost: 0.6334, utils.RatingPlanID: "RP_1002", @@ -164,7 +164,7 @@ func testDspSupGetSupFailover(t *testing.T) { }, }, } - args := &engine.ArgsGetSuppliers{ + args := &engine.ArgsGetRoutes{ CGREvent: &utils.CGREvent{ Tenant: "cgrates.org", ID: utils.UUIDSha1Prefix(), @@ -182,14 +182,14 @@ func testDspSupGetSupFailover(t *testing.T) { APIKey: utils.StringPointer("sup12345"), }, } - if err := dispEngine.RPC.Call(utils.SupplierSv1GetSuppliers, + if err := dispEngine.RPC.Call(utils.RouteSv1GetRoutes, args, &rpl); err != nil { t.Error(err) } else if !reflect.DeepEqual(eRpl1, rpl) { t.Errorf("Expecting : %+v, received: %+v", utils.ToJSON(eRpl1), utils.ToJSON(rpl)) } allEngine2.stopEngine(t) - if err := dispEngine.RPC.Call(utils.SupplierSv1GetSuppliers, + if err := dispEngine.RPC.Call(utils.RouteSv1GetRoutes, args, &rpl); err != nil { t.Error(err) } else if !reflect.DeepEqual(eRpl, rpl) { @@ -199,8 +199,8 @@ func testDspSupGetSupFailover(t *testing.T) { } func testDspSupTestAuthKey(t *testing.T) { - var rpl *engine.SortedSuppliers - args := &engine.ArgsGetSuppliers{ + var rpl *engine.SortedRoutes + args := &engine.ArgsGetRoutes{ CGREvent: &utils.CGREvent{ ID: utils.UUIDSha1Prefix(), Time: &nowTime, @@ -216,22 +216,22 @@ func testDspSupTestAuthKey(t *testing.T) { APIKey: utils.StringPointer("12345"), }, } - if err := dispEngine.RPC.Call(utils.SupplierSv1GetSuppliers, + if err := dispEngine.RPC.Call(utils.RouteSv1GetRoutes, args, &rpl); err == nil || err.Error() != utils.ErrUnauthorizedApi.Error() { t.Error(err) } } func testDspSupTestAuthKey2(t *testing.T) { - var rpl *engine.SortedSuppliers - eRpl := &engine.SortedSuppliers{ + var rpl *engine.SortedRoutes + eRpl := &engine.SortedRoutes{ ProfileID: "SPL_ACNT_1002", Sorting: utils.MetaLC, Count: 2, - SortedSuppliers: []*engine.SortedSupplier{ + SortedRoutes: []*engine.SortedRoute{ { - SupplierID: "supplier1", - SupplierParameters: "", + RouteID: "supplier1", + RouteParameters: "", SortingData: map[string]interface{}{ utils.Cost: 0.3166, utils.RatingPlanID: "RP_1002_LOW", @@ -239,8 +239,8 @@ func testDspSupTestAuthKey2(t *testing.T) { }, }, { - SupplierID: "supplier2", - SupplierParameters: "", + RouteID: "supplier2", + RouteParameters: "", SortingData: map[string]interface{}{ utils.Cost: 0.6334, utils.RatingPlanID: "RP_1002", @@ -249,7 +249,7 @@ func testDspSupTestAuthKey2(t *testing.T) { }, }, } - args := &engine.ArgsGetSuppliers{ + args := &engine.ArgsGetRoutes{ CGREvent: &utils.CGREvent{ Tenant: "cgrates.org", ID: utils.UUIDSha1Prefix(), @@ -266,7 +266,7 @@ func testDspSupTestAuthKey2(t *testing.T) { APIKey: utils.StringPointer("sup12345"), }, } - if err := dispEngine.RPC.Call(utils.SupplierSv1GetSuppliers, + if err := dispEngine.RPC.Call(utils.RouteSv1GetRoutes, args, &rpl); err != nil { t.Error(err) } else if !reflect.DeepEqual(eRpl, rpl) { @@ -275,29 +275,29 @@ func testDspSupTestAuthKey2(t *testing.T) { } func testDspSupGetSupRoundRobin(t *testing.T) { - var rpl *engine.SortedSuppliers - eRpl1 := &engine.SortedSuppliers{ + var rpl *engine.SortedRoutes + eRpl1 := &engine.SortedRoutes{ ProfileID: "SPL_WEIGHT_2", Sorting: utils.MetaWeight, Count: 1, - SortedSuppliers: []*engine.SortedSupplier{ + SortedRoutes: []*engine.SortedRoute{ { - SupplierID: "supplier1", - SupplierParameters: "", + RouteID: "supplier1", + RouteParameters: "", SortingData: map[string]interface{}{ utils.Weight: 10.0, }, }, }, } - eRpl := &engine.SortedSuppliers{ + eRpl := &engine.SortedRoutes{ ProfileID: "SPL_ACNT_1002", Sorting: utils.MetaLC, Count: 2, - SortedSuppliers: []*engine.SortedSupplier{ + SortedRoutes: []*engine.SortedRoute{ { - SupplierID: "supplier1", - SupplierParameters: "", + RouteID: "supplier1", + RouteParameters: "", SortingData: map[string]interface{}{ utils.Cost: 0.3166, utils.RatingPlanID: "RP_1002_LOW", @@ -305,8 +305,8 @@ func testDspSupGetSupRoundRobin(t *testing.T) { }, }, { - SupplierID: "supplier2", - SupplierParameters: "", + RouteID: "supplier2", + RouteParameters: "", SortingData: map[string]interface{}{ utils.Cost: 0.6334, utils.RatingPlanID: "RP_1002", @@ -315,7 +315,7 @@ func testDspSupGetSupRoundRobin(t *testing.T) { }, }, } - args := &engine.ArgsGetSuppliers{ + args := &engine.ArgsGetRoutes{ CGREvent: &utils.CGREvent{ Tenant: "cgrates.org", ID: utils.UUIDSha1Prefix(), @@ -333,13 +333,13 @@ func testDspSupGetSupRoundRobin(t *testing.T) { APIKey: utils.StringPointer("sup12345"), }, } - if err := dispEngine.RPC.Call(utils.SupplierSv1GetSuppliers, + if err := dispEngine.RPC.Call(utils.RouteSv1GetRoutes, args, &rpl); err != nil { t.Error(err) } else if !reflect.DeepEqual(eRpl1, rpl) { t.Errorf("Expecting : %+v, received: %+v", utils.ToJSON(eRpl1), utils.ToJSON(rpl)) } - if err := dispEngine.RPC.Call(utils.SupplierSv1GetSuppliers, + if err := dispEngine.RPC.Call(utils.RouteSv1GetRoutes, args, &rpl); err != nil { t.Error(err) } else if !reflect.DeepEqual(eRpl, rpl) { @@ -364,7 +364,7 @@ func testDspSupGetSupplierForEvent(t *testing.T) { APIKey: utils.StringPointer("sup12345"), }, } - expected := engine.SupplierProfile{ + expected := engine.RouteProfile{ Tenant: "cgrates.org", ID: "SPL_ACNT_1002", FilterIDs: []string{"FLTR_ACNT_1002"}, @@ -373,28 +373,28 @@ func testDspSupGetSupplierForEvent(t *testing.T) { }, Sorting: utils.MetaLC, SortingParameters: []string{}, - Suppliers: []*engine.Supplier{ - &engine.Supplier{ - ID: "supplier1", - FilterIDs: nil, - AccountIDs: nil, - RatingPlanIDs: []string{"RP_1002_LOW"}, - ResourceIDs: nil, - StatIDs: nil, - Weight: 10, - Blocker: false, - SupplierParameters: "", + Routes: []*engine.Route{ + &engine.Route{ + ID: "supplier1", + FilterIDs: nil, + AccountIDs: nil, + RatingPlanIDs: []string{"RP_1002_LOW"}, + ResourceIDs: nil, + StatIDs: nil, + Weight: 10, + Blocker: false, + RouteParameters: "", }, - &engine.Supplier{ - ID: "supplier2", - FilterIDs: nil, - AccountIDs: nil, - RatingPlanIDs: []string{"RP_1002"}, - ResourceIDs: nil, - StatIDs: nil, - Weight: 20, - Blocker: false, - SupplierParameters: "", + &engine.Route{ + ID: "supplier2", + FilterIDs: nil, + AccountIDs: nil, + RatingPlanIDs: []string{"RP_1002"}, + ResourceIDs: nil, + StatIDs: nil, + Weight: 20, + Blocker: false, + RouteParameters: "", }, }, Weight: 10, @@ -402,16 +402,16 @@ func testDspSupGetSupplierForEvent(t *testing.T) { if *encoding == utils.MetaGOB { expected.SortingParameters = nil // empty slices are nil in gob } - var supProf []*engine.SupplierProfile - if err := dispEngine.RPC.Call(utils.SupplierSv1GetSupplierProfilesForEvent, + var supProf []*engine.RouteProfile + if err := dispEngine.RPC.Call(utils.RouteSv1GetRouteProfilesForEvent, ev, &supProf); err != nil { t.Fatal(err) } - sort.Slice(expected.Suppliers, func(i, j int) bool { - return expected.Suppliers[i].Weight < expected.Suppliers[j].Weight + sort.Slice(expected.Routes, func(i, j int) bool { + return expected.Routes[i].Weight < expected.Routes[j].Weight }) - sort.Slice(supProf[0].Suppliers, func(i, j int) bool { - return supProf[0].Suppliers[i].Weight < supProf[0].Suppliers[j].Weight + sort.Slice(supProf[0].Routes, func(i, j int) bool { + return supProf[0].Routes[i].Weight < supProf[0].Routes[j].Weight }) if !reflect.DeepEqual(expected, *supProf[0]) { t.Errorf("Expected: %s ,received: %s", utils.ToJSON(expected), utils.ToJSON(supProf)) diff --git a/dispatchers/sessions_it_test.go b/dispatchers/sessions_it_test.go index 6f2261575..9c2fe8376 100755 --- a/dispatchers/sessions_it_test.go +++ b/dispatchers/sessions_it_test.go @@ -191,7 +191,7 @@ func testDspSessionTestAuthKey(t *testing.T) { args := sessions.V1AuthorizeArgs{ GetMaxUsage: true, AuthorizeResources: true, - GetSuppliers: true, + GetRoutes: true, GetAttributes: true, CGREvent: &utils.CGREvent{ Tenant: "cgrates.org", @@ -224,7 +224,7 @@ func testDspSessionAuthorize(t *testing.T) { argsAuth := &sessions.V1AuthorizeArgs{ GetMaxUsage: true, AuthorizeResources: true, - GetSuppliers: true, + GetRoutes: true, GetAttributes: true, CGREvent: &utils.CGREvent{ Tenant: "cgrates.org", @@ -259,11 +259,11 @@ func testDspSessionAuthorize(t *testing.T) { t.Errorf("Unexpected ResourceAllocation: %s", *rply.ResourceAllocation) } eSplrs := "supplier1,supplier2" - tp := strings.Split(*rply.SuppliersDigest, ",") + tp := strings.Split(*rply.RoutesDigest, ",") sort.Strings(tp) - *rply.SuppliersDigest = strings.Join(tp, ",") - if eSplrs != *rply.SuppliersDigest { - t.Errorf("expecting: %v, received: %v", eSplrs, *rply.SuppliersDigest) + *rply.RoutesDigest = strings.Join(tp, ",") + if eSplrs != *rply.RoutesDigest { + t.Errorf("expecting: %v, received: %v", eSplrs, *rply.RoutesDigest) } eAttrs := "OfficeGroup:Marketing" if eAttrs != *rply.AttributesDigest { diff --git a/engine/libtest.go b/engine/libtest.go index 4ec318ced..382ba5c55 100644 --- a/engine/libtest.go +++ b/engine/libtest.go @@ -637,9 +637,5 @@ func GetDefaultEmptyCacheStats() map[string]*ltcache.CacheStats { Items: 0, Groups: 0, }, - utils.CacheSTIR: { - Items: 0, - Groups: 0, - }, } } diff --git a/general_tests/export_it_test.go b/general_tests/export_it_test.go index 5224f135e..9243d0b7a 100644 --- a/general_tests/export_it_test.go +++ b/general_tests/export_it_test.go @@ -57,7 +57,7 @@ var ( testExpVerifyThresholds, testExpVerifyResources, testExpVerifyStats, - testExpVerifySuppliers, + testExpVerifyRoutes, testExpCleanFiles, testExpStopCgrEngine, } @@ -343,9 +343,9 @@ func testExpVerifyStats(t *testing.T) { } } -func testExpVerifySuppliers(t *testing.T) { - var reply *engine.SupplierProfile - splPrf := &engine.SupplierProfile{ +func testExpVerifyRoutes(t *testing.T) { + var reply *engine.RouteProfile + splPrf := &engine.RouteProfile{ Tenant: "cgrates.org", ID: "SPL_ACNT_1002", FilterIDs: []string{"FLTR_ACNT_1002"}, @@ -354,26 +354,26 @@ func testExpVerifySuppliers(t *testing.T) { }, Sorting: utils.MetaLC, SortingParameters: []string{}, - Suppliers: []*engine.Supplier{ + Routes: []*engine.Route{ { - ID: "supplier1", - RatingPlanIDs: []string{"RP_1002_LOW"}, - Weight: 10, - Blocker: false, - SupplierParameters: utils.EmptyString, + ID: "supplier1", + RatingPlanIDs: []string{"RP_1002_LOW"}, + Weight: 10, + Blocker: false, + RouteParameters: utils.EmptyString, }, { - ID: "supplier2", - RatingPlanIDs: []string{"RP_1002"}, - Weight: 20, - Blocker: false, - SupplierParameters: utils.EmptyString, + ID: "supplier2", + RatingPlanIDs: []string{"RP_1002"}, + Weight: 20, + Blocker: false, + RouteParameters: utils.EmptyString, }, }, Weight: 10, } - splPrf2 := &engine.SupplierProfile{ + splPrf2 := &engine.RouteProfile{ Tenant: "cgrates.org", ID: "SPL_ACNT_1002", FilterIDs: []string{"FLTR_ACNT_1002"}, @@ -382,25 +382,25 @@ func testExpVerifySuppliers(t *testing.T) { }, Sorting: utils.MetaLC, SortingParameters: []string{}, - Suppliers: []*engine.Supplier{ + Routes: []*engine.Route{ { - ID: "supplier2", - RatingPlanIDs: []string{"RP_1002"}, - Weight: 20, - Blocker: false, - SupplierParameters: utils.EmptyString, + ID: "supplier2", + RatingPlanIDs: []string{"RP_1002"}, + Weight: 20, + Blocker: false, + RouteParameters: utils.EmptyString, }, { - ID: "supplier1", - RatingPlanIDs: []string{"RP_1002_LOW"}, - Weight: 10, - Blocker: false, - SupplierParameters: utils.EmptyString, + ID: "supplier1", + RatingPlanIDs: []string{"RP_1002_LOW"}, + Weight: 10, + Blocker: false, + RouteParameters: utils.EmptyString, }, }, Weight: 10, } - if err := expRpc.Call(utils.APIerSv1GetSupplierProfile, + if err := expRpc.Call(utils.APIerSv1GetRouteProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "SPL_ACNT_1002"}, &reply); err != nil { t.Fatal(err) } diff --git a/general_tests/supplier_it_test.go b/general_tests/route_it_test.go similarity index 87% rename from general_tests/supplier_it_test.go rename to general_tests/route_it_test.go index 93445ce6e..fdd8836f7 100644 --- a/general_tests/supplier_it_test.go +++ b/general_tests/route_it_test.go @@ -37,7 +37,7 @@ var ( splSv1CfgPath string splSv1Cfg *config.CGRConfig splSv1Rpc *rpc.Client - splPrf *v1.SupplierWithCache + splPrf *v1.RouteWithCache splSv1ConfDIR string //run tests for specific configuration sTestsSupplierSV1 = []func(t *testing.T){ @@ -127,18 +127,18 @@ func testV1SplSFromFolder(t *testing.T) { } func testV1SplSSetSupplierProfilesWithoutRatingPlanIDs(t *testing.T) { - var reply *engine.SupplierProfile - if err := splSv1Rpc.Call(utils.APIerSv1GetSupplierProfile, + var reply *engine.RouteProfile + if err := splSv1Rpc.Call(utils.APIerSv1GetRouteProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "TEST_PROFILE2"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) } - splPrf = &v1.SupplierWithCache{ - SupplierProfile: &engine.SupplierProfile{ + splPrf = &v1.RouteWithCache{ + RouteProfile: &engine.RouteProfile{ Tenant: "cgrates.org", ID: "TEST_PROFILE2", Sorting: utils.MetaLC, - Suppliers: []*engine.Supplier{ + Routes: []*engine.Route{ { ID: "SPL1", AccountIDs: []string{"accc"}, @@ -150,18 +150,18 @@ func testV1SplSSetSupplierProfilesWithoutRatingPlanIDs(t *testing.T) { }, } var result string - if err := splSv1Rpc.Call(utils.APIerSv1SetSupplierProfile, splPrf, &result); err != nil { + if err := splSv1Rpc.Call(utils.APIerSv1SetRouteProfile, splPrf, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } - if err := splSv1Rpc.Call(utils.APIerSv1GetSupplierProfile, + if err := splSv1Rpc.Call(utils.APIerSv1GetRouteProfile, &utils.TenantID{Tenant: "cgrates.org", 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) + } else if !reflect.DeepEqual(splPrf.RouteProfile, reply) { + t.Errorf("Expecting: %+v, received: %+v", splPrf.RouteProfile, reply) } - ev := &engine.ArgsGetSuppliers{ + ev := &engine.ArgsGetRoutes{ CGREvent: &utils.CGREvent{ Tenant: "cgrates.org", ID: "testV1SplSGetLeastCostSuppliers", @@ -174,12 +174,12 @@ func testV1SplSSetSupplierProfilesWithoutRatingPlanIDs(t *testing.T) { }, }, } - var suplsReply engine.SortedSuppliers - if err := splSv1Rpc.Call(utils.SupplierSv1GetSuppliers, + var suplsReply engine.SortedRoutes + if err := splSv1Rpc.Call(utils.RouteSv1GetRoutes, 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.APIerSv1RemoveSupplierProfile, utils.TenantID{ + if err := splSv1Rpc.Call(utils.APIerSv1RemoveRouteProfile, utils.TenantID{ Tenant: splPrf.Tenant, ID: splPrf.ID, }, &result); err != nil { @@ -190,20 +190,20 @@ func testV1SplSSetSupplierProfilesWithoutRatingPlanIDs(t *testing.T) { } func testV1SplSAddNewSplPrf(t *testing.T) { - var reply *engine.SupplierProfile - if err := splSv1Rpc.Call(utils.APIerSv1GetSupplierProfile, + var reply *engine.RouteProfile + if err := splSv1Rpc.Call(utils.APIerSv1GetRouteProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "SPL_ResourceTest"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) } //create a new Supplier Profile to test *reas and *reds sorting strategy - splPrf = &v1.SupplierWithCache{ - SupplierProfile: &engine.SupplierProfile{ + splPrf = &v1.RouteWithCache{ + RouteProfile: &engine.RouteProfile{ Tenant: "cgrates.org", ID: "SPL_ResourceTest", Sorting: utils.MetaReas, FilterIDs: []string{"*string:~*req.CustomField:ResourceTest"}, - Suppliers: []*engine.Supplier{ + Routes: []*engine.Route{ //supplier1 will have ResourceUsage = 11 { ID: "supplier1", @@ -229,16 +229,16 @@ func testV1SplSAddNewSplPrf(t *testing.T) { }, } var result string - if err := splSv1Rpc.Call(utils.APIerSv1SetSupplierProfile, splPrf, &result); err != nil { + if err := splSv1Rpc.Call(utils.APIerSv1SetRouteProfile, splPrf, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } - if err := splSv1Rpc.Call(utils.APIerSv1GetSupplierProfile, + if err := splSv1Rpc.Call(utils.APIerSv1GetRouteProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "SPL_ResourceTest"}, &reply); err != nil { t.Error(err) - } else if !reflect.DeepEqual(splPrf.SupplierProfile, reply) { - t.Errorf("Expecting: %+v, received: %+v", splPrf.SupplierProfile, reply) + } else if !reflect.DeepEqual(splPrf.RouteProfile, reply) { + t.Errorf("Expecting: %+v, received: %+v", splPrf.RouteProfile, reply) } } @@ -432,24 +432,24 @@ func testV1SplSPopulateResUsage(t *testing.T) { } func testV1SplSGetSortedSuppliers(t *testing.T) { - ev := &engine.ArgsGetSuppliers{ + ev := &engine.ArgsGetRoutes{ CGREvent: &utils.CGREvent{ Tenant: "cgrates.org", - ID: "testV1SplSGetSortedSuppliers", + ID: "testV1SplSGetSortedRoutes", Event: map[string]interface{}{ "CustomField": "ResourceTest", }, }, } expSupplierIDs := []string{"supplier3", "supplier2", "supplier1"} - var suplsReply engine.SortedSuppliers - if err := splSv1Rpc.Call(utils.SupplierSv1GetSuppliers, + var suplsReply engine.SortedRoutes + if err := splSv1Rpc.Call(utils.RouteSv1GetRoutes, ev, &suplsReply); err != nil { t.Error(err) } else { - rcvSupl := make([]string, len(suplsReply.SortedSuppliers)) - for i, supl := range suplsReply.SortedSuppliers { - rcvSupl[i] = supl.SupplierID + rcvSupl := make([]string, len(suplsReply.SortedRoutes)) + for i, supl := range suplsReply.SortedRoutes { + rcvSupl[i] = supl.RouteID } if suplsReply.ProfileID != "SPL_ResourceTest" { t.Errorf("Expecting: SPL_ResourceTest, received: %s", @@ -463,20 +463,20 @@ func testV1SplSGetSortedSuppliers(t *testing.T) { } func testV1SplSAddNewSplPrf2(t *testing.T) { - var reply *engine.SupplierProfile - if err := splSv1Rpc.Call(utils.APIerSv1GetSupplierProfile, + var reply *engine.RouteProfile + if err := splSv1Rpc.Call(utils.APIerSv1GetRouteProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "SPL_ResourceDescendent"}, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) } //create a new Supplier Profile to test *reas and *reds sorting strategy - splPrf = &v1.SupplierWithCache{ - SupplierProfile: &engine.SupplierProfile{ + splPrf = &v1.RouteWithCache{ + RouteProfile: &engine.RouteProfile{ Tenant: "cgrates.org", ID: "SPL_ResourceDescendent", Sorting: utils.MetaReds, FilterIDs: []string{"*string:~*req.CustomField:ResourceDescendent"}, - Suppliers: []*engine.Supplier{ + Routes: []*engine.Route{ //supplier1 will have ResourceUsage = 11 { ID: "supplier1", @@ -502,21 +502,21 @@ func testV1SplSAddNewSplPrf2(t *testing.T) { }, } var result string - if err := splSv1Rpc.Call(utils.APIerSv1SetSupplierProfile, splPrf, &result); err != nil { + if err := splSv1Rpc.Call(utils.APIerSv1SetRouteProfile, splPrf, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) } - if err := splSv1Rpc.Call(utils.APIerSv1GetSupplierProfile, + if err := splSv1Rpc.Call(utils.APIerSv1GetRouteProfile, &utils.TenantID{Tenant: "cgrates.org", ID: "SPL_ResourceDescendent"}, &reply); err != nil { t.Error(err) - } else if !reflect.DeepEqual(splPrf.SupplierProfile, reply) { - t.Errorf("Expecting: %+v, received: %+v", splPrf.SupplierProfile, reply) + } else if !reflect.DeepEqual(splPrf.RouteProfile, reply) { + t.Errorf("Expecting: %+v, received: %+v", splPrf.RouteProfile, reply) } } func testV1SplSGetSortedSuppliers2(t *testing.T) { - ev := &engine.ArgsGetSuppliers{ + ev := &engine.ArgsGetRoutes{ CGREvent: &utils.CGREvent{ Tenant: "cgrates.org", ID: "testV1SplSGetSortedSuppliers2", @@ -526,14 +526,14 @@ func testV1SplSGetSortedSuppliers2(t *testing.T) { }, } expSupplierIDs := []string{"supplier1", "supplier3", "supplier2"} - var suplsReply engine.SortedSuppliers - if err := splSv1Rpc.Call(utils.SupplierSv1GetSuppliers, + var suplsReply engine.SortedRoutes + if err := splSv1Rpc.Call(utils.RouteSv1GetRoutes, ev, &suplsReply); err != nil { t.Error(err) } else { - rcvSupl := make([]string, len(suplsReply.SortedSuppliers)) - for i, supl := range suplsReply.SortedSuppliers { - rcvSupl[i] = supl.SupplierID + rcvSupl := make([]string, len(suplsReply.SortedRoutes)) + for i, supl := range suplsReply.SortedRoutes { + rcvSupl[i] = supl.RouteID } if suplsReply.ProfileID != "SPL_ResourceDescendent" { t.Errorf("Expecting: SPL_ResourceDescendent, received: %s", @@ -703,7 +703,7 @@ func testV1SplSPopulateStats(t *testing.T) { } func testV1SplSGetSoredSuppliersWithLoad(t *testing.T) { - ev := &engine.ArgsGetSuppliers{ + ev := &engine.ArgsGetRoutes{ CGREvent: &utils.CGREvent{ Tenant: "cgrates.org", ID: "testV1SplSGetSoredSuppliersWithLoad", @@ -712,26 +712,26 @@ func testV1SplSGetSoredSuppliersWithLoad(t *testing.T) { }, }, } - expSuppliers := []*engine.SortedSupplier{ - &engine.SortedSupplier{ - SupplierID: "supplier2", - SupplierParameters: "", + expSuppliers := []*engine.SortedRoute{ + &engine.SortedRoute{ + RouteID: "supplier2", + RouteParameters: "", SortingData: map[string]interface{}{ "Load": 2.0, "Ratio": 7.0, "Weight": 20.0}, }, - &engine.SortedSupplier{ - SupplierID: "supplier3", - SupplierParameters: "", + &engine.SortedRoute{ + RouteID: "supplier3", + RouteParameters: "", SortingData: map[string]interface{}{ "Load": 3.0, "Ratio": 5.0, "Weight": 35.0}, }, - &engine.SortedSupplier{ - SupplierID: "supplier1", - SupplierParameters: "", + &engine.SortedRoute{ + RouteID: "supplier1", + RouteParameters: "", SortingData: map[string]interface{}{ "Load": 2.0, "Ratio": 2.0, @@ -739,8 +739,8 @@ func testV1SplSGetSoredSuppliersWithLoad(t *testing.T) { }, } - var suplsReply engine.SortedSuppliers - if err := splSv1Rpc.Call(utils.SupplierSv1GetSuppliers, + var suplsReply engine.SortedRoutes + if err := splSv1Rpc.Call(utils.RouteSv1GetRoutes, ev, &suplsReply); err != nil { t.Error(err) } else { @@ -748,9 +748,9 @@ func testV1SplSGetSoredSuppliersWithLoad(t *testing.T) { t.Errorf("Expecting: SPL_LOAD_DIST, received: %s", suplsReply.ProfileID) } - if !reflect.DeepEqual(suplsReply.SortedSuppliers, expSuppliers) { + if !reflect.DeepEqual(suplsReply.SortedRoutes, expSuppliers) { t.Errorf("Expecting: %+v, \n received: %+v", - utils.ToJSON(expSuppliers), utils.ToJSON(suplsReply.SortedSuppliers)) + utils.ToJSON(expSuppliers), utils.ToJSON(suplsReply.SortedRoutes)) } } } diff --git a/sessions/sessions.go b/sessions/sessions.go index 3ea5774be..00bc553a0 100644 --- a/sessions/sessions.go +++ b/sessions/sessions.go @@ -1699,18 +1699,18 @@ func NewV1AuthorizeArgs(attrs bool, attributeIDs []string, thrslds bool, thresholdIDs []string, statQueues bool, statIDs []string, res, maxUsage, routes, routesIgnoreErrs, routesEventCost bool, cgrEv *utils.CGREvent, argDisp *utils.ArgDispatcher, - supplierPaginator utils.Paginator, forceDuration bool, opts map[string]interface{}) (args *V1AuthorizeArgs) { + routePaginator utils.Paginator, forceDuration bool, opts map[string]interface{}) (args *V1AuthorizeArgs) { args = &V1AuthorizeArgs{ - GetAttributes: attrs, - AuthorizeResources: res, - GetMaxUsage: maxUsage, - ProcessThresholds: thrslds, - ProcessStats: statQueues, + GetAttributes: attrs, + AuthorizeResources: res, + GetMaxUsage: maxUsage, + ProcessThresholds: thrslds, + ProcessStats: statQueues, RoutesIgnoreErrors: routesIgnoreErrs, GetRoutes: routes, - CGREvent: cgrEv, - ForceDuration: forceDuration, - Opts: opts, + CGREvent: cgrEv, + ForceDuration: forceDuration, + Opts: opts, } if routesEventCost { args.RoutesMaxCost = utils.MetaRoutesEventCost @@ -1732,19 +1732,19 @@ func NewV1AuthorizeArgs(attrs bool, attributeIDs []string, // V1AuthorizeArgs are options available in auth request type V1AuthorizeArgs struct { - GetAttributes bool - AuthorizeResources bool - GetMaxUsage bool - ForceDuration bool - ProcessThresholds bool - ProcessStats bool + GetAttributes bool + AuthorizeResources bool + GetMaxUsage bool + ForceDuration bool + ProcessThresholds bool + ProcessStats bool GetRoutes bool RoutesMaxCost string RoutesIgnoreErrors bool - AttributeIDs []string - ThresholdIDs []string - StatIDs []string - Opts map[string]interface{} + AttributeIDs []string + ThresholdIDs []string + StatIDs []string + Opts map[string]interface{} *utils.CGREvent utils.Paginator *utils.ArgDispatcher @@ -1910,7 +1910,7 @@ func (sS *SessionS) BiRPCv1AuthorizeEvent(clnt rpcclient.ClientConnector, } if args.GetRoutes { routesReply, err := sS.getRoutes(args.CGREvent.Clone(), args.ArgDispatcher, - args.Paginator, args.RoutesIgnoreErrors, args.RoutesMaxCost) + args.Paginator, args.RoutesIgnoreErrors, args.RoutesMaxCost, args.Opts) if err != nil { return err } @@ -2685,17 +2685,17 @@ func NewV1ProcessMessageArgs(attrs bool, attributeIDs []string, routePaginator utils.Paginator, forceDuration bool, opts map[string]interface{}) (args *V1ProcessMessageArgs) { args = &V1ProcessMessageArgs{ - AllocateResources: resrc, - Debit: acnts, - GetAttributes: attrs, - ProcessThresholds: thds, - ProcessStats: stats, + AllocateResources: resrc, + Debit: acnts, + GetAttributes: attrs, + ProcessThresholds: thds, + ProcessStats: stats, RoutesIgnoreErrors: routesIgnoreErrs, GetRoutes: routes, - CGREvent: cgrEv, - ArgDispatcher: argDisp, - ForceDuration: forceDuration, - Opts: opts, + CGREvent: cgrEv, + ArgDispatcher: argDisp, + ForceDuration: forceDuration, + Opts: opts, } if routesEventCost { args.RoutesMaxCost = utils.MetaRoutesEventCost @@ -2715,19 +2715,19 @@ func NewV1ProcessMessageArgs(attrs bool, attributeIDs []string, // V1ProcessMessageArgs are the options passed to ProcessMessage API type V1ProcessMessageArgs struct { - GetAttributes bool - AllocateResources bool - Debit bool - ForceDuration bool - ProcessThresholds bool - ProcessStats bool + GetAttributes bool + AllocateResources bool + Debit bool + ForceDuration bool + ProcessThresholds bool + ProcessStats bool GetRoutes bool RoutesMaxCost string RoutesIgnoreErrors bool - AttributeIDs []string - ThresholdIDs []string - StatIDs []string - Opts map[string]interface{} + AttributeIDs []string + ThresholdIDs []string + StatIDs []string + Opts map[string]interface{} *utils.CGREvent utils.Paginator *utils.ArgDispatcher @@ -2884,7 +2884,7 @@ func (sS *SessionS) BiRPCv1ProcessMessage(clnt rpcclient.ClientConnector, } if args.GetRoutes { routesReply, err := sS.getRoutes(args.CGREvent.Clone(), args.ArgDispatcher, - args.Paginator, args.RoutesIgnoreErrors, args.RoutesMaxCost) + args.Paginator, args.RoutesIgnoreErrors, args.RoutesMaxCost, args.Opts) if err != nil { return err } @@ -3582,9 +3582,9 @@ func (sS *SessionS) processStats(cgrEv *utils.CGREvent, argDisp *utils.ArgDispat // getRoutes will receive the event and send it to SupplierS to find the suppliers func (sS *SessionS) getRoutes(cgrEv *utils.CGREvent, argDisp *utils.ArgDispatcher, pag utils.Paginator, - ignoreErrors bool, maxCost string, opts map[string]interface{}) (splsReply engine.SortedSuppliers, err error) { - if len(sS.cgrCfg.SessionSCfg().SupplSConns) == 0 { - return splsReply, utils.NewErrNotConnected(utils.SupplierS) + ignoreErrors bool, maxCost string, opts map[string]interface{}) (routesReply engine.SortedRoutes, err error) { + if len(sS.cgrCfg.SessionSCfg().RouteSConns) == 0 { + return routesReply, utils.NewErrNotConnected(utils.RouteS) } if acd, has := cgrEv.Event[utils.ACD]; has { cgrEv.Event[utils.Usage] = acd diff --git a/utils/cgrevent.go b/utils/cgrevent.go index 88fe38428..dad275eb7 100644 --- a/utils/cgrevent.go +++ b/utils/cgrevent.go @@ -130,8 +130,8 @@ func (ev *CGREvent) Clone() (clned *CGREvent) { // ExtractedArgs stores the extracted arguments from CGREvent type ExtractedArgs struct { - ArgDispatcher *ArgDispatcher - SupplierPaginator *Paginator + ArgDispatcher *ArgDispatcher + RoutePaginator *Paginator } // CGREvents is a group of generic events processed by CGR services @@ -206,19 +206,18 @@ func getArgDispatcherFromOpts(ev map[string]interface{}) (arg *ArgDispatcher) { return } -// consumeRoutePaginator will consume routePaginator if presented -func (ev *CGREvent) consumeRoutePaginator() (args *Paginator) { +// getRoutePaginatorFromOpts will consume supplierPaginator if present +func getRoutePaginatorFromOpts(ev map[string]interface{}) (args *Paginator, err error) { args = new(Paginator) if ev == nil { return } //check if we have suppliersLimit in event and in case it has add it in args - limitIface, hasRoutesLimit := ev.Event[MetaRoutesLimit] + limitIface, hasRoutesLimit := ev[RoutesLimit] if hasRoutesLimit { - delete(ev.Event, MetaRoutesLimit) - limit, err := IfaceAsInt64(limitIface) - if err != nil { - Logger.Err(err.Error()) + delete(ev, RoutesLimit) + var limit int64 + if limit, err = IfaceAsInt64(limitIface); err != nil { return } args = &Paginator{ @@ -226,20 +225,18 @@ func (ev *CGREvent) consumeRoutePaginator() (args *Paginator) { } } //check if we have offset in event and in case it has add it in args - offsetIface, hasRoutesOffset := ev.Event[MetaRoutesOffset] - if hasRoutesOffset { - delete(ev.Event, MetaRoutesOffset) - offset, err := IfaceAsInt64(offsetIface) - if err != nil { - Logger.Err(err.Error()) - return - } - if !hasRoutesLimit { //in case we don't have limit, but we have offset we need to initialize the struct - args = &Paginator{ - Offset: IntPointer(int(offset)), - } - } else { - args.Offset = IntPointer(int(offset)) + offsetIface, hasRoutesOffset := ev[RoutesOffset] + if !hasRoutesOffset { + return + } + delete(ev, RoutesOffset) + var offset int64 + if offset, err = IfaceAsInt64(offsetIface); err != nil { + return + } + if !hasRoutesLimit { //in case we don't have limit, but we have offset we need to initialize the struct + args = &Paginator{ + Offset: IntPointer(int(offset)), } return } @@ -247,14 +244,8 @@ func (ev *CGREvent) consumeRoutePaginator() (args *Paginator) { return } -// ExtractedArgs stores the extracted arguments from CGREvent -type ExtractedArgs struct { - ArgDispatcher *ArgDispatcher - RoutePaginator *Paginator -} - -// ExtractArgs extracts the ArgDispatcher and RoutePaginator from the received event -func (ev *CGREvent) ExtractArgs(dispatcherFlag, consumeRoutePaginator bool) (ca ExtractedArgs) { +// ExtractArgsFromOpts extracts the posible arguments(ArgDispatcher and RoutePaginator) from options +func ExtractArgsFromOpts(ev map[string]interface{}, dispatcherFlag, consumeRoutePaginator bool) (ca ExtractedArgs, err error) { ca = ExtractedArgs{ ArgDispatcher: getArgDispatcherFromOpts(ev), } @@ -262,40 +253,7 @@ func (ev *CGREvent) ExtractArgs(dispatcherFlag, consumeRoutePaginator bool) (ca ca.ArgDispatcher = new(ArgDispatcher) } if consumeRoutePaginator { - ca.RoutePaginator = ev.consumeRoutePaginator() - } - return -} - -// CGREvents is a group of generic events processed by CGR services -// ie: derived CDRs -type CGREvents struct { - Tenant string - ID string - Time *time.Time // event time - Events []map[string]interface{} -} - -func NewCGREventWithArgDispatcher() *CGREventWithArgDispatcher { - return new(CGREventWithArgDispatcher) -} - -type CGREventWithArgDispatcher struct { - *CGREvent - *ArgDispatcher -} - -func (ev *CGREventWithArgDispatcher) Clone() (clned *CGREventWithArgDispatcher) { - if ev == nil { - return - } - clned = new(CGREventWithArgDispatcher) - if ev.CGREvent != nil { - clned.CGREvent = ev.CGREvent.Clone() - } - if ev.ArgDispatcher != nil { - clned.ArgDispatcher = new(ArgDispatcher) - *clned.ArgDispatcher = *ev.ArgDispatcher + ca.RoutePaginator, err = getRoutePaginatorFromOpts(ev) } return } diff --git a/utils/cgrevent_test.go b/utils/cgrevent_test.go index 29aa88522..e9d34a3eb 100644 --- a/utils/cgrevent_test.go +++ b/utils/cgrevent_test.go @@ -331,7 +331,7 @@ func TestCGREventconsumeArgDispatcher(t *testing.T) { func TestCGREventconsumeRoutePaginator(t *testing.T) { //empty check var opts map[string]interface{} - rcv, err := getSupplierPaginatorFromOpts(opts) + rcv, err := getRoutePaginatorFromOpts(opts) if err != nil { t.Error(err) } @@ -340,7 +340,7 @@ func TestCGREventconsumeRoutePaginator(t *testing.T) { t.Errorf("Expecting: %+v, received: %+v", eOut, rcv) } opts = nil - rcv, err = getSupplierPaginatorFromOpts(opts) + rcv, err = getRoutePaginatorFromOpts(opts) if err != nil { t.Error(err) } @@ -349,22 +349,22 @@ func TestCGREventconsumeRoutePaginator(t *testing.T) { } //normal check opts = map[string]interface{}{ - SuppliersLimit: 18, - SuppliersOffset: 20, + RoutesLimit: 18, + RoutesOffset: 20, } eOut = &Paginator{ Limit: IntPointer(18), Offset: IntPointer(20), } - rcv, err = getSupplierPaginatorFromOpts(opts) + rcv, err = getRoutePaginatorFromOpts(opts) if err != nil { t.Error(err) } //check if *suppliers_limit and *suppliers_offset was deleted - if _, has := opts[SuppliersLimit]; has { + if _, has := opts[RoutesLimit]; has { t.Errorf("*suppliers_limit wasn't deleted") - } else if _, has := opts[SuppliersOffset]; has { + } else if _, has := opts[RoutesOffset]; has { t.Errorf("*suppliers_offset wasn't deleted") } if !reflect.DeepEqual(eOut, rcv) { @@ -372,20 +372,20 @@ func TestCGREventconsumeRoutePaginator(t *testing.T) { } //check without *suppliers_limit, but with *suppliers_offset opts = map[string]interface{}{ - SuppliersOffset: 20, + RoutesOffset: 20, } eOut = &Paginator{ Offset: IntPointer(20), } - rcv, err = getSupplierPaginatorFromOpts(opts) + rcv, err = getRoutePaginatorFromOpts(opts) if err != nil { t.Error(err) } //check if *suppliers_limit and *suppliers_offset was deleted - if _, has := opts[SuppliersLimit]; has { + if _, has := opts[RoutesLimit]; has { t.Errorf("*suppliers_limit wasn't deleted") - } else if _, has := opts[SuppliersOffset]; has { + } else if _, has := opts[RoutesOffset]; has { t.Errorf("*suppliers_offset wasn't deleted") } if !reflect.DeepEqual(eOut, rcv) { @@ -393,10 +393,10 @@ func TestCGREventconsumeRoutePaginator(t *testing.T) { } //check with notAnInt at *suppliers_limit opts = map[string]interface{}{ - SuppliersLimit: "Not an int", + RoutesLimit: "Not an int", } eOut = new(Paginator) - rcv, err = getSupplierPaginatorFromOpts(opts) + rcv, err = getRoutePaginatorFromOpts(opts) if err == nil { t.Error("Expected error") } @@ -405,10 +405,10 @@ func TestCGREventconsumeRoutePaginator(t *testing.T) { } //check with notAnInt at and *suppliers_offset opts = map[string]interface{}{ - SuppliersOffset: "Not an int", + RoutesOffset: "Not an int", } eOut = new(Paginator) - rcv, err = getSupplierPaginatorFromOpts(opts) + rcv, err = getRoutePaginatorFromOpts(opts) if err == nil { t.Error("Expected error") } @@ -434,7 +434,7 @@ func TestCGREventConsumeArgs(t *testing.T) { if err != nil { t.Error(err) } - eOut.SupplierPaginator = new(Paginator) + eOut.RoutePaginator = new(Paginator) if !reflect.DeepEqual(eOut, rcv) { t.Errorf("Expecting: %+v, received: %+v", eOut, rcv) } @@ -456,8 +456,8 @@ func TestCGREventConsumeArgs(t *testing.T) { t.Error(err) } eOut = ExtractedArgs{ - SupplierPaginator: new(Paginator), - ArgDispatcher: new(ArgDispatcher), + RoutePaginator: new(Paginator), + ArgDispatcher: new(ArgDispatcher), } if !reflect.DeepEqual(eOut, rcv) { t.Errorf("Expecting: %+v, received: %+v", eOut, rcv) diff --git a/utils/consts.go b/utils/consts.go index be37bfb2d..2a7b02ece 100755 --- a/utils/consts.go +++ b/utils/consts.go @@ -596,7 +596,7 @@ const ( MetaHdr = "*hdr" MetaTrl = "*trl" MetaTmp = "*tmp" - MetaOpts = "*opts" + MetaOpts = "*opts" CGROriginHost = "cgr_originhost" MetaInitiate = "*initiate" MetaUpdate = "*update" @@ -655,65 +655,65 @@ const ( Service = "Service" MetaRoutesLimit = "*routes_limit" MetaRoutesOffset = "*routes_offset" - ApierV = "ApierV" - MetaApier = "*apier" - MetaAnalyzer = "*analyzer" - CGREventString = "CGREvent" - MetaTextPlain = "*text_plain" - MetaIgnoreErrors = "*ignore_errors" - MetaRelease = "*release" - MetaAllocate = "*allocate" - MetaAuthorize = "*authorize" - MetaSTIRAuthenticate = "*stir_authenticate" - MetaSTIRInitiate = "*stir_initiate" - MetaInit = "*init" - MetaRatingPlanCost = "*rating_plan_cost" - RatingPlanIDs = "RatingPlanIDs" - ERs = "ERs" - Ratio = "Ratio" - Load = "Load" - Slash = "/" - UUID = "UUID" - ActionsID = "ActionsID" - MetaAct = "*act" - DestinationPrefix = "DestinationPrefix" - DestinationID = "DestinationID" - ExportTemplate = "ExportTemplate" - ExportFormat = "ExportFormat" - Synchronous = "Synchronous" - Attempts = "Attempts" - FieldSeparator = "FieldSeparator" - ExportPath = "ExportPath" - ExportID = "ExportID" - ExportFileName = "ExportFileName" - GroupID = "GroupID" - ThresholdType = "ThresholdType" - ThresholdValue = "ThresholdValue" - Recurrent = "Recurrent" - Executed = "Executed" - MinSleep = "MinSleep" - ActivationDate = "ActivationDate" - ExpirationDate = "ExpirationDate" - MinQueuedItems = "MinQueuedItems" - OrderIDStart = "OrderIDStart" - OrderIDEnd = "OrderIDEnd" - MinCost = "MinCost" - MaxCost = "MaxCost" - MetaLoaders = "*loaders" - TmpSuffix = ".tmp" - MetaDiamreq = "*diamreq" - MetaCost = "*cost" - MetaGroup = "*group" - InternalRPCSet = "InternalRPCSet" - FileName = "FileName" - MetaRadauth = "*radauth" - UserPassword = "UserPassword" - RadauthFailed = "RADAUTH_FAILED" - MetaPAP = "*pap" - MetaCHAP = "*chap" - MetaMSCHAPV2 = "*mschapv2" - MetaDynaprepaid = "*dynaprepaid" - MetaFD = "*fd" + ApierV = "ApierV" + MetaApier = "*apier" + MetaAnalyzer = "*analyzer" + CGREventString = "CGREvent" + MetaTextPlain = "*text_plain" + MetaIgnoreErrors = "*ignore_errors" + MetaRelease = "*release" + MetaAllocate = "*allocate" + MetaAuthorize = "*authorize" + MetaSTIRAuthenticate = "*stir_authenticate" + MetaSTIRInitiate = "*stir_initiate" + MetaInit = "*init" + MetaRatingPlanCost = "*rating_plan_cost" + RatingPlanIDs = "RatingPlanIDs" + ERs = "ERs" + Ratio = "Ratio" + Load = "Load" + Slash = "/" + UUID = "UUID" + ActionsID = "ActionsID" + MetaAct = "*act" + DestinationPrefix = "DestinationPrefix" + DestinationID = "DestinationID" + ExportTemplate = "ExportTemplate" + ExportFormat = "ExportFormat" + Synchronous = "Synchronous" + Attempts = "Attempts" + FieldSeparator = "FieldSeparator" + ExportPath = "ExportPath" + ExportID = "ExportID" + ExportFileName = "ExportFileName" + GroupID = "GroupID" + ThresholdType = "ThresholdType" + ThresholdValue = "ThresholdValue" + Recurrent = "Recurrent" + Executed = "Executed" + MinSleep = "MinSleep" + ActivationDate = "ActivationDate" + ExpirationDate = "ExpirationDate" + MinQueuedItems = "MinQueuedItems" + OrderIDStart = "OrderIDStart" + OrderIDEnd = "OrderIDEnd" + MinCost = "MinCost" + MaxCost = "MaxCost" + MetaLoaders = "*loaders" + TmpSuffix = ".tmp" + MetaDiamreq = "*diamreq" + MetaCost = "*cost" + MetaGroup = "*group" + InternalRPCSet = "InternalRPCSet" + FileName = "FileName" + MetaRadauth = "*radauth" + UserPassword = "UserPassword" + RadauthFailed = "RADAUTH_FAILED" + MetaPAP = "*pap" + MetaCHAP = "*chap" + MetaMSCHAPV2 = "*mschapv2" + MetaDynaprepaid = "*dynaprepaid" + MetaFD = "*fd" SortingData = "SortingData" Count = "Count" ProfileID = "ProfileID" @@ -2106,8 +2106,8 @@ const ( RouteID = "RouteID" // SupplierS - SuppliersLimit = "SuppliersLimit" - SuppliersOffset = "SuppliersOffset" + RoutesLimit = "RoutesLimit" + RoutesOffset = "RoutesOffset" ) func buildCacheInstRevPrefixes() {