diff --git a/config/config_defaults.go b/config/config_defaults.go index 74dbabe80..55880088e 100755 --- a/config/config_defaults.go +++ b/config/config_defaults.go @@ -651,6 +651,25 @@ const CGRATES_CFG_JSON = ` {"tag": "Weight", "field_id": "Weight", "type": "*composed", "value": "~6"}, ], }, + { + "type": "*dispatchers", // data source type + "file_name": "Dispatchers.csv", // file name in the tp_in_dir + "fields": [ + {"tag": "Tenant", "field_id": "Tenant", "type": "*composed", "value": "~0", "mandatory": true}, + {"tag": "ID", "field_id": "ID", "type": "*composed", "value": "~1", "mandatory": true}, + {"tag": "Contexts", "field_id": "Contexts", "type": "*composed", "value": "~2"}, + {"tag": "FilterIDs", "field_id": "FilterIDs", "type": "*composed", "value": "~3"}, + {"tag": "ActivationInterval", "field_id": "ActivationInterval", "type": "*composed", "value": "~4"}, + {"tag": "Strategy", "field_id": "Strategy", "type": "*composed", "value": "~5"}, + {"tag": "StrategyParameters", "field_id": "StrategyParameters", "type": "*composed", "value": "~6"}, + {"tag": "ConnID", "field_id": "ConnID", "type": "*composed", "value": "~7"}, + {"tag": "ConnFilterIDs", "field_id": "ConnFilterIDs", "type": "*composed", "value": "~8"}, + {"tag": "ConnWeight", "field_id": "ConnWeight", "type": "*composed", "value": "~9"}, + {"tag": "ConnBlocker", "field_id": "ConnBlocker", "type": "*composed", "value": "~10"}, + {"tag": "ConnParameters", "field_id": "ConnParameters", "type": "*composed", "value": "~11"}, + {"tag": "Weight", "field_id": "Weight", "type": "*composed", "value": "~12"}, + ], + }, ], }, ], diff --git a/config/config_json_test.go b/config/config_json_test.go index e42c32cc0..06149d847 100755 --- a/config/config_json_test.go +++ b/config/config_json_test.go @@ -1241,6 +1241,66 @@ func TestDfLoaderJsonCfg(t *testing.T) { Value: utils.StringPointer("~6")}, }, }, + { + Type: utils.StringPointer(utils.MetaDispatchers), + File_name: utils.StringPointer(utils.DispatchersCsv), + Fields: &[]*FcTemplateJsonCfg{ + {Tag: utils.StringPointer(utils.Tenant), + Field_id: utils.StringPointer(utils.Tenant), + Type: utils.StringPointer(utils.META_COMPOSED), + Value: utils.StringPointer("~0"), + Mandatory: utils.BoolPointer(true)}, + {Tag: utils.StringPointer(utils.ID), + Field_id: utils.StringPointer(utils.ID), + Type: utils.StringPointer(utils.META_COMPOSED), + Value: utils.StringPointer("~1"), + Mandatory: utils.BoolPointer(true)}, + {Tag: utils.StringPointer("Contexts"), + Field_id: utils.StringPointer("Contexts"), + Type: utils.StringPointer(utils.META_COMPOSED), + Value: utils.StringPointer("~2")}, + {Tag: utils.StringPointer("FilterIDs"), + Field_id: utils.StringPointer("FilterIDs"), + Type: utils.StringPointer(utils.META_COMPOSED), + Value: utils.StringPointer("~3")}, + {Tag: utils.StringPointer("ActivationInterval"), + Field_id: utils.StringPointer("ActivationInterval"), + Type: utils.StringPointer(utils.META_COMPOSED), + Value: utils.StringPointer("~4")}, + {Tag: utils.StringPointer("Strategy"), + Field_id: utils.StringPointer("Strategy"), + Type: utils.StringPointer(utils.META_COMPOSED), + Value: utils.StringPointer("~5")}, + {Tag: utils.StringPointer("StrategyParameters"), + Field_id: utils.StringPointer("StrategyParameters"), + Type: utils.StringPointer(utils.META_COMPOSED), + Value: utils.StringPointer("~6")}, + {Tag: utils.StringPointer("ConnID"), + Field_id: utils.StringPointer("ConnID"), + Type: utils.StringPointer(utils.META_COMPOSED), + Value: utils.StringPointer("~7")}, + {Tag: utils.StringPointer("ConnFilterIDs"), + Field_id: utils.StringPointer("ConnFilterIDs"), + Type: utils.StringPointer(utils.META_COMPOSED), + Value: utils.StringPointer("~8")}, + {Tag: utils.StringPointer("ConnWeight"), + Field_id: utils.StringPointer("ConnWeight"), + Type: utils.StringPointer(utils.META_COMPOSED), + Value: utils.StringPointer("~9")}, + {Tag: utils.StringPointer("ConnBlocker"), + Field_id: utils.StringPointer("ConnBlocker"), + Type: utils.StringPointer(utils.META_COMPOSED), + Value: utils.StringPointer("~10")}, + {Tag: utils.StringPointer("ConnParameters"), + Field_id: utils.StringPointer("ConnParameters"), + Type: utils.StringPointer(utils.META_COMPOSED), + Value: utils.StringPointer("~11")}, + {Tag: utils.StringPointer("Weight"), + Field_id: utils.StringPointer("Weight"), + Type: utils.StringPointer(utils.META_COMPOSED), + Value: utils.StringPointer("~12")}, + }, + }, }, }, } diff --git a/config/config_test.go b/config/config_test.go index d1c24a798..5fa8c30a9 100755 --- a/config/config_test.go +++ b/config/config_test.go @@ -1444,6 +1444,77 @@ func TestCgrLoaderCfgITDefaults(t *testing.T) { Value: NewRSRParsersMustCompile("~6", true, utils.INFIELD_SEP)}, }, }, + { + Type: utils.MetaDispatchers, + Filename: utils.DispatchersCsv, + Fields: []*FCTemplate{ + {Tag: "Tenant", + FieldId: "Tenant", + Type: utils.META_COMPOSED, + Value: NewRSRParsersMustCompile("~0", true, utils.INFIELD_SEP), + Mandatory: true}, + {Tag: "ID", + FieldId: "ID", + Type: utils.META_COMPOSED, + Value: NewRSRParsersMustCompile("~1", true, utils.INFIELD_SEP), + Mandatory: true}, + {Tag: "Contexts", + FieldId: "Contexts", + Type: utils.META_COMPOSED, + Value: NewRSRParsersMustCompile("~2", true, utils.INFIELD_SEP), + }, + {Tag: "FilterIDs", + FieldId: "FilterIDs", + Type: utils.META_COMPOSED, + Value: NewRSRParsersMustCompile("~3", true, utils.INFIELD_SEP), + }, + {Tag: "ActivationInterval", + FieldId: "ActivationInterval", + Type: utils.META_COMPOSED, + Value: NewRSRParsersMustCompile("~4", true, utils.INFIELD_SEP), + }, + {Tag: "Strategy", + FieldId: "Strategy", + Type: utils.META_COMPOSED, + Value: NewRSRParsersMustCompile("~5", true, utils.INFIELD_SEP), + }, + {Tag: "StrategyParameters", + FieldId: "StrategyParameters", + Type: utils.META_COMPOSED, + Value: NewRSRParsersMustCompile("~6", true, utils.INFIELD_SEP), + }, + {Tag: "ConnID", + FieldId: "ConnID", + Type: utils.META_COMPOSED, + Value: NewRSRParsersMustCompile("~7", true, utils.INFIELD_SEP), + }, + {Tag: "ConnFilterIDs", + FieldId: "ConnFilterIDs", + Type: utils.META_COMPOSED, + Value: NewRSRParsersMustCompile("~8", true, utils.INFIELD_SEP), + }, + {Tag: "ConnWeight", + FieldId: "ConnWeight", + Type: utils.META_COMPOSED, + Value: NewRSRParsersMustCompile("~9", true, utils.INFIELD_SEP), + }, + {Tag: "ConnBlocker", + FieldId: "ConnBlocker", + Type: utils.META_COMPOSED, + Value: NewRSRParsersMustCompile("~10", true, utils.INFIELD_SEP), + }, + {Tag: "ConnParameters", + FieldId: "ConnParameters", + Type: utils.META_COMPOSED, + Value: NewRSRParsersMustCompile("~11", true, utils.INFIELD_SEP), + }, + {Tag: "Weight", + FieldId: "Weight", + Type: utils.META_COMPOSED, + Value: NewRSRParsersMustCompile("~12", true, utils.INFIELD_SEP), + }, + }, + }, }, }, } diff --git a/engine/spls_highestcost.go b/engine/spls_highestcost.go index a59c431e6..1a5ab1eae 100755 --- a/engine/spls_highestcost.go +++ b/engine/spls_highestcost.go @@ -43,7 +43,7 @@ func (hcs *HightCostSorter) SortSuppliers(prflID string, suppls []*Supplier, for _, s := range suppls { if len(s.RatingPlanIDs) == 0 { utils.Logger.Warning( - fmt.Sprintf("<%s> RatingPlanIDs is empty for suplier with ID: %s", + fmt.Sprintf("<%s> supplier: <%s> - empty RatingPlanIDs", utils.SupplierS, s.ID)) return nil, utils.NewErrMandatoryIeMissing("RatingPlanIDs") } diff --git a/engine/spls_leastcost.go b/engine/spls_leastcost.go index 740ab66f4..282287fef 100644 --- a/engine/spls_leastcost.go +++ b/engine/spls_leastcost.go @@ -43,7 +43,7 @@ func (lcs *LeastCostSorter) SortSuppliers(prflID string, suppls []*Supplier, for _, s := range suppls { if len(s.RatingPlanIDs) == 0 { utils.Logger.Warning( - fmt.Sprintf("<%s> RatingPlanIDs is empty for suplier with ID: %s", + fmt.Sprintf("<%s> supplier: <%s> - empty RatingPlanIDs", utils.SupplierS, s.ID)) return nil, utils.NewErrMandatoryIeMissing("RatingPlanIDs") } diff --git a/loaders/loader_test.go b/loaders/loader_test.go index c955f3bbb..f9fa557ec 100644 --- a/loaders/loader_test.go +++ b/loaders/loader_test.go @@ -1075,11 +1075,10 @@ cgrates.org,EVENT1,,,,,,ALL,,10,,, Mandatory: true, }, &config.FCTemplate{ - Tag: "Contexts", - FieldId: "Contexts", - Type: utils.META_COMPOSED, - Value: config.NewRSRParsersMustCompile("~2", true, utils.INFIELD_SEP), - Mandatory: true, + Tag: "Contexts", + FieldId: "Contexts", + Type: utils.META_COMPOSED, + Value: config.NewRSRParsersMustCompile("~2", true, utils.INFIELD_SEP), }, &config.FCTemplate{ Tag: "FilterIDs",