mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-12 18:46:24 +05:00
Add Type in AttributeProfile
This commit is contained in:
committed by
Dan Christian Bogos
parent
6b79c01287
commit
ff49c8997e
@@ -387,6 +387,7 @@ CREATE TABLE tp_attributes (
|
||||
`activation_interval` varchar(64) NOT NULL,
|
||||
`attribute_filter_ids` varchar(64) NOT NULL,
|
||||
`field_name` varchar(64) NOT NULL,
|
||||
`type` varchar(64) NOT NULL,
|
||||
`substitute` varchar(64) NOT NULL,
|
||||
`blocker` BOOLEAN NOT NULL,
|
||||
`weight` decimal(8,2) NOT NULL,
|
||||
|
||||
@@ -378,6 +378,7 @@ CREATE INDEX tp_suppliers_unique ON tp_suppliers ("tpid", "tenant", "id",
|
||||
"activation_interval" varchar(64) NOT NULL,
|
||||
"attribute_filter_ids" varchar(64) NOT NULL,
|
||||
"field_name" varchar(64) NOT NULL,
|
||||
"type" varchar(64) NOT NULL,
|
||||
"substitute" varchar(64) NOT NULL,
|
||||
"blocker" BOOLEAN NOT NULL,
|
||||
"weight" decimal(8,2) NOT NULL,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#Tenant,ID,Contexts,FilterIDs,ActivationInterval,AttributeFilterIDs,FieldName,Substitute,Blocker,Weight
|
||||
cgrates.org,LRN_Dst3125650565,lrn,*string:~Destination:3125650565,,,Destination,13128543000,false,10
|
||||
cgrates.org,LRN_Dst3125650565,,,,,OriginalDestination,3125650565,false,10
|
||||
cgrates.org,LRN_LATA_Dst13128543000,lrn,*string:~Destination:13128543000;*rsr::~OriginalDestination(!^$),,,DestinationLATA,358,false,20
|
||||
cgrates.org,LRN_LATA_Cli9174269000,lrn,*string:~Account:9174269000;*rsr::~DestinationLATA(!^$),,,CallerLATA,132,false,30
|
||||
cgrates.org,LRN_JURISDICTION_NY,lrn,FLTR_INTRALATA_NEWYORK,,,LRNJurisdiction,INTRA,false,50
|
||||
cgrates.org,LRN_JURISDICTION_IL,lrn,FLTR_INTRALATA_ILLINOIS,,,LRNJurisdiction,INTRA,false,50
|
||||
cgrates.org,LRN_JURISDICTION_INTER,lrn,*string:~Destination:13128543000;*rsr::~CallerLATA(!^$),,,LRNJurisdiction,INTER,false,40
|
||||
#Tenant,ID,Contexts,FilterIDs,ActivationInterval,AttributeFilterIDs,FieldName,Type,Substitute,Blocker,Weight
|
||||
cgrates.org,LRN_Dst3125650565,lrn,*string:~Destination:3125650565,,,Destination,*constant,13128543000,false,10
|
||||
cgrates.org,LRN_Dst3125650565,,,,,OriginalDestination,*constant,3125650565,false,10
|
||||
cgrates.org,LRN_LATA_Dst13128543000,lrn,*string:~Destination:13128543000;*rsr::~OriginalDestination(!^$),,,DestinationLATA,*constant,358,false,20
|
||||
cgrates.org,LRN_LATA_Cli9174269000,lrn,*string:~Account:9174269000;*rsr::~DestinationLATA(!^$),,,CallerLATA,*constant,132,false,30
|
||||
cgrates.org,LRN_JURISDICTION_NY,lrn,FLTR_INTRALATA_NEWYORK,,,LRNJurisdiction,*constant,INTRA,false,50
|
||||
cgrates.org,LRN_JURISDICTION_IL,lrn,FLTR_INTRALATA_ILLINOIS,,,LRNJurisdiction,*constant,INTRA,false,50
|
||||
cgrates.org,LRN_JURISDICTION_INTER,lrn,*string:~Destination:13128543000;*rsr::~CallerLATA(!^$),,,LRNJurisdiction,*constant,INTER,false,40
|
||||
|
||||
|
@@ -1,14 +1,14 @@
|
||||
#Tenant,ID,Contexts,FilterIDs,ActivationInterval,AttributeFilterIDs,FieldName,Substitute,Blocker,Weight
|
||||
cgrates.org,ATTR_1001_SIMPLEAUTH,simpleauth,*string:~Account:1001,,,Password,CGRateS.org,false,20
|
||||
cgrates.org,ATTR_API_ATTR_FAKE_AUTH,*auth,*string:~APIKey:12345,,,APIMethods,,false,20
|
||||
cgrates.org,ATTR_API_ATTR_AUTH,*auth,*string:~APIKey:attr12345,,,APIMethods,AttributeSv1.Ping&AttributeSv1.GetAttributeForEvent&AttributeSv1.ProcessEvent,false,20
|
||||
cgrates.org,ATTR_API_CHRG_AUTH,*auth,*string:~APIKey:chrg12345,,,APIMethods,ChargerSv1.Ping&ChargerSv1.GetChargersForEvent&ChargerSv1.ProcessEvent,false,20
|
||||
cgrates.org,ATTR_API_THR_AUTH,*auth,*string:~APIKey:thr12345,,,APIMethods,ThresholdSv1.Ping&ThresholdSv1.GetThresholdsForEvent&ThresholdSv1.ProcessEvent&ThresholdSv1.GetThreshold&ThresholdSv1.GetThresholdIDs,false,20
|
||||
cgrates.org,ATTR_API_SUP_AUTH,*auth,*string:~APIKey:sup12345,,,APIMethods,SupplierSv1.Ping&SupplierSv1.GetSuppliers,false,20
|
||||
cgrates.org,ATTR_API_STAT_AUTH,*auth,*string:~APIKey:stat12345,,,APIMethods,StatSv1.Ping&StatSv1.GetStatQueuesForEvent&StatSv1.GetQueueStringMetrics&StatSv1.ProcessEvent&StatSv1.GetQueueIDs&StatSv1.GetQueueFloatMetrics,false,20
|
||||
cgrates.org,ATTR_API_RES_AUTH,*auth,*string:~APIKey:res12345,,,APIMethods,ResourceSv1.Ping&ResourceSv1.GetResourcesForEvent&ResourceSv1.AuthorizeResources&ResourceSv1.AllocateResources&ResourceSv1.ReleaseResources,false,20
|
||||
cgrates.org,ATTR_API_SES_AUTH,*auth,*string:~APIKey:ses12345,,,APIMethods,SessionSv1.Ping&SessionSv1.AuthorizeEventWithDigest&SessionSv1.InitiateSessionWithDigest&SessionSv1.UpdateSession&SessionSv1.TerminateSession&SessionSv1.ProcessCDR&SessionSv1.ProcessEvent&SessionSv1.GetActiveSessions&SessionSv1.GetActiveSessionsCount&SessionSv1.ForceDisconnect&SessionSv1.GetPassiveSessions&SessionSv1.GetPassiveSessionsCount&SessionSv1.SetPassiveSession&SessionSv1.ReplicateSessions,false,20
|
||||
cgrates.org,ATTR_API_RSP_AUTH,*auth,*string:~APIKey:rsp12345,,,APIMethods,Responder.Status&Responder.GetTimeout&Responder.Shutdown&Responder.Ping,false,20
|
||||
cgrates.org,ATTR_API_CHC_AUTH,*auth,*string:~APIKey:chc12345,,,APIMethods,CacheSv1.Ping&CacheSv1.GetCacheStats&CacheSv1.LoadCache&CacheSv1.PrecacheStatus&CacheSv1.GetItemIDs&CacheSv1.HasItem&CacheSv1.GetItemExpiryTime&CacheSv1.ReloadCache&CacheSv1.RemoveItem&CacheSv1.FlushCache&CacheSv1.Clear,false,20
|
||||
cgrates.org,ATTR_API_GRD_AUTH,*auth,*string:~APIKey:grd12345,,,APIMethods,GuardianSv1.Ping&GuardianSv1.RemoteLock&GuardianSv1.RemoteUnlock,false,20
|
||||
cgrates.org,ATTR_API_SCHD_AUTH,*auth,*string:~APIKey:sched12345,,,APIMethods,SchedulerSv1.Ping,false,20
|
||||
#Tenant,ID,Contexts,FilterIDs,ActivationInterval,AttributeFilterIDs,FieldName,Type,Substitute,Blocker,Weight
|
||||
cgrates.org,ATTR_1001_SIMPLEAUTH,simpleauth,*string:~Account:1001,,,Password,*constant,CGRateS.org,false,20
|
||||
cgrates.org,ATTR_API_ATTR_FAKE_AUTH,*auth,*string:~APIKey:12345,,,APIMethods,*constant,,false,20
|
||||
cgrates.org,ATTR_API_ATTR_AUTH,*auth,*string:~APIKey:attr12345,,,APIMethods,*constant,AttributeSv1.Ping&AttributeSv1.GetAttributeForEvent&AttributeSv1.ProcessEvent,false,20
|
||||
cgrates.org,ATTR_API_CHRG_AUTH,*auth,*string:~APIKey:chrg12345,,,APIMethods,*constant,ChargerSv1.Ping&ChargerSv1.GetChargersForEvent&ChargerSv1.ProcessEvent,false,20
|
||||
cgrates.org,ATTR_API_THR_AUTH,*auth,*string:~APIKey:thr12345,,,APIMethods,*constant,ThresholdSv1.Ping&ThresholdSv1.GetThresholdsForEvent&ThresholdSv1.ProcessEvent&ThresholdSv1.GetThreshold&ThresholdSv1.GetThresholdIDs,false,20
|
||||
cgrates.org,ATTR_API_SUP_AUTH,*auth,*string:~APIKey:sup12345,,,APIMethods,*constant,SupplierSv1.Ping&SupplierSv1.GetSuppliers,false,20
|
||||
cgrates.org,ATTR_API_STAT_AUTH,*auth,*string:~APIKey:stat12345,,,APIMethods,*constant,StatSv1.Ping&StatSv1.GetStatQueuesForEvent&StatSv1.GetQueueStringMetrics&StatSv1.ProcessEvent&StatSv1.GetQueueIDs&StatSv1.GetQueueFloatMetrics,false,20
|
||||
cgrates.org,ATTR_API_RES_AUTH,*auth,*string:~APIKey:res12345,,,APIMethods,*constant,ResourceSv1.Ping&ResourceSv1.GetResourcesForEvent&ResourceSv1.AuthorizeResources&ResourceSv1.AllocateResources&ResourceSv1.ReleaseResources,false,20
|
||||
cgrates.org,ATTR_API_SES_AUTH,*auth,*string:~APIKey:ses12345,,,APIMethods,*constant,SessionSv1.Ping&SessionSv1.AuthorizeEventWithDigest&SessionSv1.InitiateSessionWithDigest&SessionSv1.UpdateSession&SessionSv1.TerminateSession&SessionSv1.ProcessCDR&SessionSv1.ProcessEvent&SessionSv1.GetActiveSessions&SessionSv1.GetActiveSessionsCount&SessionSv1.ForceDisconnect&SessionSv1.GetPassiveSessions&SessionSv1.GetPassiveSessionsCount&SessionSv1.SetPassiveSession&SessionSv1.ReplicateSessions,false,20
|
||||
cgrates.org,ATTR_API_RSP_AUTH,*auth,*string:~APIKey:rsp12345,,,APIMethods,*constant,Responder.Status&Responder.GetTimeout&Responder.Shutdown&Responder.Ping,false,20
|
||||
cgrates.org,ATTR_API_CHC_AUTH,*auth,*string:~APIKey:chc12345,,,APIMethods,*constant,CacheSv1.Ping&CacheSv1.GetCacheStats&CacheSv1.LoadCache&CacheSv1.PrecacheStatus&CacheSv1.GetItemIDs&CacheSv1.HasItem&CacheSv1.GetItemExpiryTime&CacheSv1.ReloadCache&CacheSv1.RemoveItem&CacheSv1.FlushCache&CacheSv1.Clear,false,20
|
||||
cgrates.org,ATTR_API_GRD_AUTH,*auth,*string:~APIKey:grd12345,,,APIMethods,*constant,GuardianSv1.Ping&GuardianSv1.RemoteLock&GuardianSv1.RemoteUnlock,false,20
|
||||
cgrates.org,ATTR_API_SCHD_AUTH,*auth,*string:~APIKey:sched12345,,,APIMethods,*constant,SchedulerSv1.Ping,false,20
|
||||
|
||||
|
@@ -1,3 +1,3 @@
|
||||
#Tenant,ID,Contexts,FilterIDs,ActivationInterval,AttributeFilterIDs,FieldName,Substitute,Blocker,Weight
|
||||
cgrates.org,ATTR_1,*sessions;*cdrs,*string:~Account:1007,2014-01-14T00:00:00Z,,Account,1001,false,10
|
||||
cgrates.org,ATTR_1,,,,,Subject,1001,,
|
||||
#Tenant,ID,Contexts,FilterIDs,ActivationInterval,AttributeFilterIDs,FieldName,Type,Substitute,Blocker,Weight
|
||||
cgrates.org,ATTR_1,*sessions;*cdrs,*string:~Account:1007,2014-01-14T00:00:00Z,,Account,*constant,1001,false,10
|
||||
cgrates.org,ATTR_1,,,,,Subject,*constant,1001,,
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#Tenant,ID,Context,FilterIDs,ActivationInterval,AttributeFilterIDs,FieldName,Substitute,Blocker,Weight
|
||||
cgrates.org,ATTR_ACNT_1001,*sessions,FLTR_ACCOUNT_1001,,,OfficeGroup,Marketing,false,10
|
||||
cgrates.org,ATTR_SUPPLIER1,*chargers,,,,Subject,SUPPLIER1,false,10
|
||||
cgrates.org,ATTR_PAYPAL,*cdrs,*string:~Subject:ANY2CNT,,,PayPalAccount,paypal@cgrates.org,false,10
|
||||
#Tenant,ID,Context,FilterIDs,ActivationInterval,AttributeFilterIDs,FieldName,Type,Substitute,Blocker,Weight
|
||||
cgrates.org,ATTR_ACNT_1001,*sessions,FLTR_ACCOUNT_1001,,,OfficeGroup,*constant,Marketing,false,10
|
||||
cgrates.org,ATTR_SUPPLIER1,*chargers,,,,Subject,*constant,SUPPLIER1,false,10
|
||||
cgrates.org,ATTR_PAYPAL,*cdrs,*string:~Subject:ANY2CNT,,,PayPalAccount,*constant,paypal@cgrates.org,false,10
|
||||
|
||||
|
@@ -1,3 +1,3 @@
|
||||
#Tenant,ID,Contexts,FilterIDs,ActivationInterval,AttributeFilterIDs,FieldName,Substitute,Blocker,Weight
|
||||
cgrates.org,ALS1,con1,FLTR_1,2014-07-29T15:00:00Z,*string:Field1:Initial1,Field1,Sub1,false,20
|
||||
cgrates.org,ALS1,,,,*string:Field1:Initial2,Field2,Sub2,,
|
||||
#Tenant,ID,Contexts,FilterIDs,ActivationInterval,AttributeFilterIDs,FieldName,Type,Substitute,Blocker,Weight
|
||||
cgrates.org,ALS1,con1,FLTR_1,2014-07-29T15:00:00Z,*string:Field1:Initial1,Field1,*constant,Sub1,false,20
|
||||
cgrates.org,ALS1,,,,*string:Field1:Initial2,Field2,*constant,Sub2,,
|
||||
|
||||
|
@@ -1,22 +1,22 @@
|
||||
#Tenant,ID,Contexts,FilterIDs,ActivationInterval,AttributeFilterIDs,FieldName,Substitute,Blocker,Weight
|
||||
cgrates.org,ATTR_1001_SIMPLEAUTH,simpleauth,*string:~Account:1001,,,Password,CGRateS.org,false,20
|
||||
cgrates.org,ATTR_1002_SIMPLEAUTH,simpleauth,*string:~Account:1002,,,Password,CGRateS.org,false,20
|
||||
cgrates.org,ATTR_1003_SIMPLEAUTH,simpleauth,*string:~Account:1003,,,Password,CGRateS.org,false,20
|
||||
cgrates.org,ATTR_1001_SESSIONAUTH,*sessions,*string:~Account:1001,,,Password,CGRateS.org,false,10
|
||||
cgrates.org,ATTR_1001_SESSIONAUTH,,,,,RequestType,*prepaid,,
|
||||
cgrates.org,ATTR_1001_SESSIONAUTH,,,,,PaypalAccount,cgrates@paypal.com,,
|
||||
cgrates.org,ATTR_1001_SESSIONAUTH,,,,,LCRProfile,premium_cli,,
|
||||
cgrates.org,ATTR_1002_SESSIONAUTH,*sessions,*string:~Account:1002,,,Password,CGRateS.org,false,10
|
||||
cgrates.org,ATTR_1002_SESSIONAUTH,,,,,RequestType,*postpaid,,
|
||||
cgrates.org,ATTR_1002_SESSIONAUTH,,,,,PaypalAccount,cgrates@paypal.com,,
|
||||
cgrates.org,ATTR_1002_SESSIONAUTH,,,,,LCRProfile,premium_cli,,
|
||||
cgrates.org,ATTR_1002_SESSIONAUTH,,,,,ResourceAllocation,"ResGroup1",,
|
||||
cgrates.org,ATTR_1003_SESSIONAUTH,*sessions,*string:~Account:1003,,,Password,CGRateS.org,false,10
|
||||
cgrates.org,ATTR_1003_SESSIONAUTH,,,,,RequestType,*prepaid,,
|
||||
cgrates.org,ATTR_1003_SESSIONAUTH,,,,,PaypalAccount,cgrates@paypal.com,,
|
||||
cgrates.org,ATTR_1003_SESSIONAUTH,,,,,LCRProfile,premium_cli,,
|
||||
cgrates.com,ATTR_TNT_ALIAS,*any,*string:~SubscriberId:1006,,,Account,1001,false,10
|
||||
cgrates.com,ATTR_TNT_ALIAS,*any,,,,RequestType,*prepaid,,
|
||||
cgrates.com,ATTR_TNT_ALIAS,*any,,,,*tenant,cgrates.org,,
|
||||
cgrates.com,ATTR_TNT_1001,*any,*string:~Account:1001,,,*tenant,cgrates.org,,
|
||||
cgrates.com,ATTR_TNT_DISC,*any,*string:~Account:testDiamInitWithSessionDisconnect,,,*tenant,cgrates.org,,
|
||||
#Tenant,ID,Contexts,FilterIDs,ActivationInterval,AttributeFilterIDs,FieldName,Type,Substitute,Blocker,Weight
|
||||
cgrates.org,ATTR_1001_SIMPLEAUTH,simpleauth,*string:~Account:1001,,,Password,*constant,CGRateS.org,false,20
|
||||
cgrates.org,ATTR_1002_SIMPLEAUTH,simpleauth,*string:~Account:1002,,,Password,*constant,CGRateS.org,false,20
|
||||
cgrates.org,ATTR_1003_SIMPLEAUTH,simpleauth,*string:~Account:1003,,,Password,*constant,CGRateS.org,false,20
|
||||
cgrates.org,ATTR_1001_SESSIONAUTH,*sessions,*string:~Account:1001,,,Password,*constant,CGRateS.org,false,10
|
||||
cgrates.org,ATTR_1001_SESSIONAUTH,,,,,RequestType,*constant,*prepaid,,
|
||||
cgrates.org,ATTR_1001_SESSIONAUTH,,,,,PaypalAccount,*constant,cgrates@paypal.com,,
|
||||
cgrates.org,ATTR_1001_SESSIONAUTH,,,,,LCRProfile,*constant,premium_cli,,
|
||||
cgrates.org,ATTR_1002_SESSIONAUTH,*sessions,*string:~Account:1002,,,Password,*constant,CGRateS.org,false,10
|
||||
cgrates.org,ATTR_1002_SESSIONAUTH,,,,,RequestType,*constant,*postpaid,,
|
||||
cgrates.org,ATTR_1002_SESSIONAUTH,,,,,PaypalAccount,*constant,cgrates@paypal.com,,
|
||||
cgrates.org,ATTR_1002_SESSIONAUTH,,,,,LCRProfile,*constant,premium_cli,,
|
||||
cgrates.org,ATTR_1002_SESSIONAUTH,,,,,ResourceAllocation,*constant,"ResGroup1",,
|
||||
cgrates.org,ATTR_1003_SESSIONAUTH,*sessions,*string:~Account:1003,,,Password,*constant,CGRateS.org,false,10
|
||||
cgrates.org,ATTR_1003_SESSIONAUTH,,,,,RequestType,*constant,*prepaid,,
|
||||
cgrates.org,ATTR_1003_SESSIONAUTH,,,,,PaypalAccount,*constant,cgrates@paypal.com,,
|
||||
cgrates.org,ATTR_1003_SESSIONAUTH,,,,,LCRProfile,*constant,premium_cli,,
|
||||
cgrates.com,ATTR_TNT_ALIAS,*any,*string:~SubscriberId:1006,,,Account,*constant,1001,false,10
|
||||
cgrates.com,ATTR_TNT_ALIAS,*any,,,,RequestType,*constant,*prepaid,,
|
||||
cgrates.com,ATTR_TNT_ALIAS,*any,,,,*tenant,*constant,cgrates.org,,
|
||||
cgrates.com,ATTR_TNT_1001,*any,*string:~Account:1001,,,*tenant,*constant,cgrates.org,,
|
||||
cgrates.com,ATTR_TNT_DISC,*any,*string:~Account:testDiamInitWithSessionDisconnect,,,*tenant,*constant,cgrates.org,,
|
||||
|
||||
|
@@ -120,6 +120,7 @@ func testDspAttrGetAttrFailover(t *testing.T) {
|
||||
{
|
||||
FilterIDs: []string{},
|
||||
FieldName: "Password",
|
||||
Type: utils.META_CONSTANT,
|
||||
Substitute: config.NewRSRParsersMustCompile("CGRateS.org", true, utils.INFIELD_SEP),
|
||||
},
|
||||
},
|
||||
@@ -295,6 +296,7 @@ func testDspAttrTestAuthKey2(t *testing.T) {
|
||||
{
|
||||
FilterIDs: []string{},
|
||||
FieldName: "Password",
|
||||
Type: utils.META_CONSTANT,
|
||||
Substitute: config.NewRSRParsersMustCompile("CGRateS.org", true, utils.INFIELD_SEP),
|
||||
},
|
||||
},
|
||||
@@ -386,6 +388,7 @@ func testDspAttrGetAttrRoundRobin(t *testing.T) {
|
||||
{
|
||||
FilterIDs: []string{},
|
||||
FieldName: "Password",
|
||||
Type: utils.META_CONSTANT,
|
||||
Substitute: config.NewRSRParsersMustCompile("CGRateS.org", true, utils.INFIELD_SEP),
|
||||
},
|
||||
},
|
||||
|
||||
@@ -169,16 +169,34 @@ func (alS *AttributeService) processEvent(args *AttrArgsProcessEvent) (
|
||||
continue
|
||||
}
|
||||
}
|
||||
substitute, err := attribute.Substitute.ParseEvent(args.Event)
|
||||
var substitute string
|
||||
var err error
|
||||
switch attribute.Type {
|
||||
case utils.META_CONSTANT:
|
||||
substitute, err = attribute.Substitute.ParseValue(utils.EmptyString)
|
||||
case utils.MetaVariable, utils.META_COMPOSED:
|
||||
substitute, err = attribute.Substitute.ParseEvent(args.Event)
|
||||
default: // backwards compatible in case that Type is empty
|
||||
substitute, err = attribute.Substitute.ParseEvent(args.Event)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
rply.AlteredFields = append(rply.AlteredFields, attribute.FieldName)
|
||||
if substitute == utils.META_NONE {
|
||||
delete(rply.CGREvent.Event, attribute.FieldName)
|
||||
} else {
|
||||
rply.CGREvent.Event[attribute.FieldName] = substitute
|
||||
continue
|
||||
}
|
||||
rply.AlteredFields = append(rply.AlteredFields, attribute.FieldName)
|
||||
if attribute.Type == utils.META_COMPOSED {
|
||||
evStrVal, err := utils.IfaceAsString(rply.CGREvent.Event[attribute.FieldName])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
substitute = evStrVal + substitute
|
||||
}
|
||||
rply.CGREvent.Event[attribute.FieldName] = substitute
|
||||
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ import (
|
||||
type Attribute struct {
|
||||
FilterIDs []string
|
||||
FieldName string
|
||||
Type string
|
||||
Substitute config.RSRParsers
|
||||
}
|
||||
|
||||
|
||||
@@ -257,9 +257,9 @@ cgrates.org,SPP_1,,,,,supplier1,FLTR_DST_DE,Account2,RPL_3,ResGroup3,Stat2,10,,,
|
||||
cgrates.org,SPP_1,,,,,supplier1,,,,ResGroup4,Stat3,10,,,
|
||||
`
|
||||
attributeProfiles = `
|
||||
#Tenant,ID,Contexts,FilterIDs,ActivationInterval,AttributeFilterIDs,FieldName,Substitute,Blocker,Weight
|
||||
cgrates.org,ALS1,con1,FLTR_1,2014-07-29T15:00:00Z,*string:Field1:Initial,Field1,Sub1,true,20
|
||||
cgrates.org,ALS1,con2;con3,,,,Field2,Sub2,true,20
|
||||
#Tenant,ID,Contexts,FilterIDs,ActivationInterval,AttributeFilterIDs,FieldName,Type,Substitute,Blocker,Weight
|
||||
cgrates.org,ALS1,con1,FLTR_1,2014-07-29T15:00:00Z,*string:Field1:Initial,Field1,*variable,Sub1,true,20
|
||||
cgrates.org,ALS1,con2;con3,,,,Field2,*variable,Sub2,true,20
|
||||
`
|
||||
chargerProfiles = `
|
||||
#Tenant,ID,FilterIDs,ActivationInterval,RunID,AttributeIDs,Weight
|
||||
@@ -1513,11 +1513,13 @@ func TestLoadAttributeProfiles(t *testing.T) {
|
||||
&utils.TPAttribute{
|
||||
FilterIDs: []string{"*string:Field1:Initial"},
|
||||
FieldName: "Field1",
|
||||
Type: utils.MetaVariable,
|
||||
Substitute: "Sub1",
|
||||
},
|
||||
&utils.TPAttribute{
|
||||
FilterIDs: []string{},
|
||||
FieldName: "Field2",
|
||||
Type: utils.MetaVariable,
|
||||
Substitute: "Sub2",
|
||||
},
|
||||
},
|
||||
|
||||
@@ -2070,6 +2070,7 @@ func (tps TPAttributes) AsTPAttributes() (result []*utils.TPAttributeProfile) {
|
||||
}
|
||||
th.Attributes = append(th.Attributes, &utils.TPAttribute{
|
||||
FilterIDs: filterIDs,
|
||||
Type: tp.Type,
|
||||
FieldName: tp.FieldName,
|
||||
Substitute: tp.Substitute,
|
||||
})
|
||||
@@ -2135,6 +2136,7 @@ func APItoModelTPAttribute(th *utils.TPAttributeProfile) (mdls TPAttributes) {
|
||||
}
|
||||
mdl.FieldName = reqAttribute.FieldName
|
||||
mdl.Substitute = reqAttribute.Substitute
|
||||
mdl.Type = reqAttribute.Type
|
||||
mdls = append(mdls, mdl)
|
||||
}
|
||||
return
|
||||
@@ -2164,6 +2166,7 @@ func APItoAttributeProfile(tpAttr *utils.TPAttributeProfile, timezone string) (a
|
||||
attrPrf.Attributes[i] = &Attribute{
|
||||
FilterIDs: reqAttr.FilterIDs,
|
||||
FieldName: reqAttr.FieldName,
|
||||
Type: reqAttr.Type,
|
||||
Substitute: sbstPrsr,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -367,9 +367,10 @@ type TPAttribute struct {
|
||||
ActivationInterval string `index:"4" re:""`
|
||||
AttributeFilterIDs string `index:"5" re:""`
|
||||
FieldName string `index:"6" re:""`
|
||||
Substitute string `index:"7" re:""`
|
||||
Blocker bool `index:"8" re:""`
|
||||
Weight float64 `index:"9" re:"\d+\.?\d*"`
|
||||
Type string `index:"7" re:""`
|
||||
Substitute string `index:"8" re:""`
|
||||
Blocker bool `index:"9" re:""`
|
||||
Weight float64 `index:"10" re:"\d+\.?\d*"`
|
||||
CreatedAt time.Time
|
||||
}
|
||||
|
||||
|
||||
@@ -1148,6 +1148,7 @@ type TPSupplierProfile struct {
|
||||
type TPAttribute struct {
|
||||
FilterIDs []string
|
||||
FieldName string
|
||||
Type string
|
||||
Substitute string
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user