mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Renamed Contex column for Dispatchers.csv to Subsystems
This commit is contained in:
committed by
Dan Christian Bogos
parent
738b3a8ed3
commit
c65fc66407
@@ -430,7 +430,7 @@ CREATE TABLE tp_dispatchers (
|
||||
`tpid` varchar(64) NOT NULL,
|
||||
`tenant` varchar(64) NOT NULL,
|
||||
`id` varchar(64) NOT NULL,
|
||||
`contexts` varchar(64) NOT NULL,
|
||||
`subsystems` varchar(64) NOT NULL,
|
||||
`filter_ids` varchar(64) NOT NULL,
|
||||
`activation_interval` varchar(64) NOT NULL,
|
||||
`strategy` varchar(64) NOT NULL,
|
||||
|
||||
@@ -415,16 +415,22 @@ CREATE INDEX tp_suppliers_unique ON tp_suppliers ("tpid", "tenant", "id",
|
||||
|
||||
DROP TABLE IF EXISTS tp_dispatchers;
|
||||
CREATE TABLE tp_dispatchers (
|
||||
"pk" SERIAL PRIMARY KEY,
|
||||
"tpid" varchar(64) NOT NULL,
|
||||
"tenant"varchar(64) NOT NULL,
|
||||
"id" varchar(64) NOT NULL,
|
||||
"filter_ids" varchar(64) NOT NULL,
|
||||
"activation_interval" varchar(64) NOT NULL,
|
||||
"strategy" varchar(64) NOT NULL,
|
||||
"hosts" varchar(64) NOT NULL,
|
||||
"weight" decimal(8,2) NOT NULL,
|
||||
"created_at" TIMESTAMP WITH TIME ZONE
|
||||
"pk" SERIAL PRIMARY KEY,
|
||||
"tpid" varchar(64) NOT NULL,
|
||||
"tenant" varchar(64) NOT NULL,
|
||||
"id" varchar(64) NOT NULL,
|
||||
"subsystems" varchar(64) NOT NULL,
|
||||
"filter_ids" varchar(64) NOT NULL,
|
||||
"activation_interval" varchar(64) NOT NULL,
|
||||
"strategy" varchar(64) NOT NULL,
|
||||
"strategy_parameters" varchar(64) NOT NULL,
|
||||
"conn_id" varchar(64) NOT NULL,
|
||||
"conn_filter_ids" varchar(64) NOT NULL,
|
||||
"conn_weight" decimal(8,2) NOT NULL,
|
||||
"conn_blocker" BOOLEAN NOT NULL,
|
||||
"conn_parameters" varchar(64) NOT NULL,
|
||||
"weight" decimal(8,2) NOT NULL,
|
||||
"created_at" TIMESTAMP WITH TIME ZONE
|
||||
);
|
||||
CREATE INDEX tp_dispatchers_ids ON tp_dispatchers (tpid);
|
||||
CREATE INDEX tp_dispatchers_unique ON tp_dispatchers ("tpid", "tenant", "id",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#Tenant,ID,Contexts,FilterIDs,ActivationInterval,Strategy,StrategyParameters,ConnID,ConnFilterIDs,ConnWeight,ConnBlocker,ConnParameters,Weight
|
||||
#Tenant,ID,Subsystems,FilterIDs,ActivationInterval,Strategy,StrategyParameters,ConnID,ConnFilterIDs,ConnWeight,ConnBlocker,ConnParameters,Weight
|
||||
cgrates.org,PING1,*any,,,*weight,,ALL,,20,false,,10
|
||||
cgrates.org,PING1,,,,,,ALL2,,10,,,
|
||||
cgrates.org,EVENT1,*any,*string:EventName:Event1,,*weight,,ALL2,,20,false,,20
|
||||
|
||||
|
@@ -2406,11 +2406,11 @@ func (tps TPDispatchers) AsTPDispatchers() (result []*utils.TPDispatcherProfile)
|
||||
ID: tp.ID,
|
||||
}
|
||||
}
|
||||
if tp.Contexts != "" {
|
||||
if tp.Subsystems != "" {
|
||||
if _, has := contextMap[tenantID]; !has {
|
||||
contextMap[tenantID] = make(utils.StringMap)
|
||||
}
|
||||
contextSplit := strings.Split(tp.Contexts, utils.INFIELD_SEP)
|
||||
contextSplit := strings.Split(tp.Subsystems, utils.INFIELD_SEP)
|
||||
for _, context := range contextSplit {
|
||||
contextMap[tenantID][context] = true
|
||||
}
|
||||
@@ -2525,7 +2525,7 @@ func APItoModelTPDispatcher(tpDPP *utils.TPDispatcherProfile) (mdls TPDispatcher
|
||||
}
|
||||
|
||||
filters := strings.Join(tpDPP.FilterIDs, utils.INFIELD_SEP)
|
||||
context := strings.Join(tpDPP.Subsystems, utils.INFIELD_SEP)
|
||||
subsystems := strings.Join(tpDPP.Subsystems, utils.INFIELD_SEP)
|
||||
|
||||
interval := ""
|
||||
if tpDPP.ActivationInterval != nil {
|
||||
@@ -2544,7 +2544,7 @@ func APItoModelTPDispatcher(tpDPP *utils.TPDispatcherProfile) (mdls TPDispatcher
|
||||
Tpid: tpDPP.TPid,
|
||||
Tenant: tpDPP.Tenant,
|
||||
ID: tpDPP.ID,
|
||||
Contexts: context,
|
||||
Subsystems: subsystems,
|
||||
FilterIDs: filters,
|
||||
ActivationInterval: interval,
|
||||
Strategy: tpDPP.Strategy,
|
||||
@@ -2560,7 +2560,7 @@ func APItoModelTPDispatcher(tpDPP *utils.TPDispatcherProfile) (mdls TPDispatcher
|
||||
Tpid: tpDPP.TPid,
|
||||
Tenant: tpDPP.Tenant,
|
||||
ID: tpDPP.ID,
|
||||
Contexts: context,
|
||||
Subsystems: subsystems,
|
||||
FilterIDs: filters,
|
||||
ActivationInterval: interval,
|
||||
Strategy: tpDPP.Strategy,
|
||||
|
||||
@@ -1807,7 +1807,7 @@ func TestAPItoModelTPDispatcher(t *testing.T) {
|
||||
Tpid: "TP1",
|
||||
Tenant: "cgrates.org",
|
||||
ID: "Dsp",
|
||||
Contexts: "*any",
|
||||
Subsystems: "*any",
|
||||
FilterIDs: "FLTR_ACNT_dan;FLTR_DST_DE",
|
||||
Strategy: utils.MetaFirst,
|
||||
ActivationInterval: "2014-07-14T14:35:00Z",
|
||||
|
||||
@@ -392,7 +392,7 @@ type TPDispatcher struct {
|
||||
Tpid string //
|
||||
Tenant string `index:"0" re:""`
|
||||
ID string `index:"1" re:""`
|
||||
Contexts string `index:"2" re:""`
|
||||
Subsystems string `index:"2" re:""`
|
||||
FilterIDs string `index:"3" re:""`
|
||||
ActivationInterval string `index:"4" re:""`
|
||||
Strategy string `index:"5" re:""`
|
||||
|
||||
@@ -1046,7 +1046,7 @@ cgrates.org,Charge2,*string:Account:1003,2014-07-29T15:00:00Z,*default,Attr3,10
|
||||
|
||||
func TestLoaderProcessDispatches(t *testing.T) {
|
||||
dipatcherCSV := `
|
||||
#Tenant,ID,Contexts,FilterIDs,ActivationInterval,Strategy,StrategyParameters,ConnID,ConnFilterIDs,ConnWeight,ConnBlocker,ConnParameters,Weight
|
||||
#Tenant,ID,Subsystems,FilterIDs,ActivationInterval,Strategy,StrategyParameters,ConnID,ConnFilterIDs,ConnWeight,ConnBlocker,ConnParameters,Weight
|
||||
cgrates.org,EVENT1,*any,*string:EventName:Event1,,*weight,,ALL2,,20,false,,20
|
||||
cgrates.org,EVENT1,,,,,,ALL,,10,,,
|
||||
|
||||
@@ -1075,8 +1075,8 @@ cgrates.org,EVENT1,,,,,,ALL,,10,,,
|
||||
Mandatory: true,
|
||||
},
|
||||
&config.FCTemplate{
|
||||
Tag: "Contexts",
|
||||
FieldId: "Contexts",
|
||||
Tag: "Subsystems",
|
||||
FieldId: "Subsystems",
|
||||
Type: utils.META_COMPOSED,
|
||||
Value: config.NewRSRParsersMustCompile("~2", true, utils.INFIELD_SEP),
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user