mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Add Context after ID and before FilterID(AttributeProfile)
This commit is contained in:
committed by
Dan Christian Bogos
parent
78c458bc70
commit
b03b79e0ae
@@ -148,8 +148,8 @@ func testAttributeSGetAttributeForEvent(t *testing.T) {
|
||||
eAttrPrf := &engine.ExternalAttributeProfile{
|
||||
Tenant: ev.Tenant,
|
||||
ID: "ATTR_1",
|
||||
FilterIDs: []string{"FLTR_ACNT_1007"},
|
||||
Context: utils.ALIAS_CONTEXT_RATING,
|
||||
FilterIDs: []string{"FLTR_ACNT_1007"},
|
||||
ActivationInterval: &utils.ActivationInterval{
|
||||
ActivationTime: time.Date(2014, 1, 14, 0, 0, 0, 0, time.UTC)},
|
||||
Substitute: []*engine.Substitute{
|
||||
@@ -171,8 +171,8 @@ func testAttributeSGetAttributeForEvent(t *testing.T) {
|
||||
eAttrPrf2 := &engine.ExternalAttributeProfile{
|
||||
Tenant: ev.Tenant,
|
||||
ID: "ATTR_1",
|
||||
FilterIDs: []string{"FLTR_ACNT_1007"},
|
||||
Context: utils.ALIAS_CONTEXT_RATING,
|
||||
FilterIDs: []string{"FLTR_ACNT_1007"},
|
||||
ActivationInterval: &utils.ActivationInterval{
|
||||
ActivationTime: time.Date(2014, 1, 14, 0, 0, 0, 0, time.UTC)},
|
||||
Substitute: []*engine.Substitute{
|
||||
@@ -255,6 +255,7 @@ func testAttributeSSetAlsPrf(t *testing.T) {
|
||||
alsPrf = &engine.ExternalAttributeProfile{
|
||||
Tenant: "cgrates.org",
|
||||
ID: "ApierTest",
|
||||
Context: "*rating",
|
||||
FilterIDs: []string{"FLTR_ACNT_dan", "FLTR_DST_DE"},
|
||||
ActivationInterval: &utils.ActivationInterval{
|
||||
ActivationTime: time.Date(2014, 7, 14, 14, 35, 0, 0, time.UTC).Local(),
|
||||
|
||||
@@ -530,9 +530,9 @@ CREATE TABLE tp_attributes (
|
||||
`tpid` varchar(64) NOT NULL,
|
||||
`tenant` varchar(64) NOT NULL,
|
||||
`id` varchar(64) NOT NULL,
|
||||
`context` varchar(64) NOT NULL,
|
||||
`filter_ids` varchar(64) NOT NULL,
|
||||
`activation_interval` varchar(64) NOT NULL,
|
||||
`context` varchar(64) NOT NULL,
|
||||
`field_name` varchar(64) NOT NULL,
|
||||
`initial` varchar(64) NOT NULL,
|
||||
`alias` varchar(64) NOT NULL,
|
||||
|
||||
@@ -520,9 +520,9 @@ CREATE INDEX tp_suppliers_unique ON tp_suppliers ("tpid", "tenant", "id",
|
||||
"tpid" varchar(64) NOT NULL,
|
||||
"tenant"varchar(64) NOT NULL,
|
||||
"id" varchar(64) NOT NULL,
|
||||
"context" varchar(64) NOT NULL,
|
||||
"filter_ids" varchar(64) NOT NULL,
|
||||
"activation_interval" varchar(64) NOT NULL,
|
||||
"context" varchar(64) NOT NULL,
|
||||
"field_name" varchar(64) NOT NULL,
|
||||
"initial" varchar(64) NOT NULL,
|
||||
"alias" varchar(64) NOT NULL,
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
#,Tenant,ID,FilterIDs,ActivationInterval,Context,FieldName,Initial,Alias,Append,Weight
|
||||
cgrates.org,ALS1,FLTR_1,2014-07-29T15:00:00Z,con1,Field1,Initial1,Alias1,true,20
|
||||
#,Tenant,ID,Context,FilterIDs,ActivationInterval,FieldName,Initial,Alias,Append,Weight
|
||||
cgrates.org,ALS1,con1,FLTR_1,2014-07-29T15:00:00Z,Field1,Initial1,Alias1,true,20
|
||||
cgrates.org,ALS1,,,,Field2,Initial2,Alias2,false,
|
||||
|
||||
|
@@ -1,3 +1,3 @@
|
||||
#Tenant,ID,FilterIDs,ActivationInterval,Context,FieldName,Initial,Alias,Append,Weight
|
||||
cgrates.org,ATTR_1,FLTR_ACNT_1007,2014-01-14T00:00:00Z,*rating,Account,*any,1001,false,10
|
||||
#Tenant,ID,Context,FilterIDs,ActivationInterval,FieldName,Initial,Alias,Append,Weight
|
||||
cgrates.org,ATTR_1,*rating,FLTR_ACNT_1007,2014-01-14T00:00:00Z,Account,*any,1001,false,10
|
||||
cgrates.org,ATTR_1,,,,Subject,*any,1001,true,
|
||||
|
||||
|
@@ -30,12 +30,12 @@ func TestExternalAttributeProfileAsAttributeProfile(t *testing.T) {
|
||||
extAttr := &ExternalAttributeProfile{
|
||||
Tenant: "cgrates.org",
|
||||
ID: "ALS1",
|
||||
Context: "con1",
|
||||
FilterIDs: []string{"FLTR_ACNT_dan", "FLTR_DST_DE"},
|
||||
ActivationInterval: &utils.ActivationInterval{
|
||||
ActivationTime: time.Date(2014, 7, 14, 14, 35, 0, 0, time.UTC).Local(),
|
||||
ExpiryTime: time.Date(2014, 7, 14, 14, 35, 0, 0, time.UTC).Local(),
|
||||
},
|
||||
Context: "con1",
|
||||
Substitute: []*Substitute{
|
||||
&Substitute{
|
||||
FieldName: "FL1",
|
||||
@@ -57,12 +57,12 @@ func TestExternalAttributeProfileAsAttributeProfile(t *testing.T) {
|
||||
expected := &AttributeProfile{
|
||||
Tenant: "cgrates.org",
|
||||
ID: "ALS1",
|
||||
Context: "con1",
|
||||
FilterIDs: []string{"FLTR_ACNT_dan", "FLTR_DST_DE"},
|
||||
ActivationInterval: &utils.ActivationInterval{
|
||||
ActivationTime: time.Date(2014, 7, 14, 14, 35, 0, 0, time.UTC).Local(),
|
||||
ExpiryTime: time.Date(2014, 7, 14, 14, 35, 0, 0, time.UTC).Local(),
|
||||
},
|
||||
Context: "con1",
|
||||
Substitutes: attrMap,
|
||||
Weight: 20,
|
||||
}
|
||||
@@ -85,12 +85,12 @@ func TestNewExternalAttributeProfileFromAttributeProfile(t *testing.T) {
|
||||
attrPrf := &AttributeProfile{
|
||||
Tenant: "cgrates.org",
|
||||
ID: "ALS1",
|
||||
Context: "con1",
|
||||
FilterIDs: []string{"FLTR_ACNT_dan", "FLTR_DST_DE"},
|
||||
ActivationInterval: &utils.ActivationInterval{
|
||||
ActivationTime: time.Date(2014, 7, 14, 14, 35, 0, 0, time.UTC).Local(),
|
||||
ExpiryTime: time.Date(2014, 7, 14, 14, 35, 0, 0, time.UTC).Local(),
|
||||
},
|
||||
Context: "con1",
|
||||
Substitutes: attrMap,
|
||||
Weight: 20,
|
||||
}
|
||||
@@ -98,12 +98,12 @@ func TestNewExternalAttributeProfileFromAttributeProfile(t *testing.T) {
|
||||
expected := &ExternalAttributeProfile{
|
||||
Tenant: "cgrates.org",
|
||||
ID: "ALS1",
|
||||
Context: "con1",
|
||||
FilterIDs: []string{"FLTR_ACNT_dan", "FLTR_DST_DE"},
|
||||
ActivationInterval: &utils.ActivationInterval{
|
||||
ActivationTime: time.Date(2014, 7, 14, 14, 35, 0, 0, time.UTC).Local(),
|
||||
ExpiryTime: time.Date(2014, 7, 14, 14, 35, 0, 0, time.UTC).Local(),
|
||||
},
|
||||
Context: "con1",
|
||||
Substitute: []*Substitute{
|
||||
&Substitute{
|
||||
FieldName: "FL1",
|
||||
|
||||
@@ -34,9 +34,9 @@ type Substitute struct {
|
||||
type AttributeProfile struct {
|
||||
Tenant string
|
||||
ID string
|
||||
Context string // bind this AttributeProfile to specific context
|
||||
FilterIDs []string
|
||||
ActivationInterval *utils.ActivationInterval // Activation interval
|
||||
Context string // bind this AttributeProfile to specific context
|
||||
Substitutes map[string]map[string]*Substitute // map[FieldName][InitialValue]*Attribute
|
||||
Weight float64
|
||||
}
|
||||
@@ -56,9 +56,9 @@ func (aps AttributeProfiles) Sort() {
|
||||
type ExternalAttributeProfile struct {
|
||||
Tenant string
|
||||
ID string
|
||||
Context string // bind this AttributeProfile to specific context
|
||||
FilterIDs []string
|
||||
ActivationInterval *utils.ActivationInterval // Activation interval
|
||||
Context string // bind this AttributeProfile to specific context
|
||||
Substitute []*Substitute
|
||||
Weight float64
|
||||
}
|
||||
@@ -67,10 +67,10 @@ func (eap *ExternalAttributeProfile) AsAttributeProfile() *AttributeProfile {
|
||||
alsPrf := &AttributeProfile{
|
||||
Tenant: eap.Tenant,
|
||||
ID: eap.ID,
|
||||
Weight: eap.Weight,
|
||||
Context: eap.Context,
|
||||
FilterIDs: eap.FilterIDs,
|
||||
ActivationInterval: eap.ActivationInterval,
|
||||
Context: eap.Context,
|
||||
Weight: eap.Weight,
|
||||
}
|
||||
alsMap := make(map[string]map[string]*Substitute)
|
||||
for _, als := range eap.Substitute {
|
||||
@@ -85,10 +85,10 @@ func NewExternalAttributeProfileFromAttributeProfile(alsPrf *AttributeProfile) *
|
||||
extals := &ExternalAttributeProfile{
|
||||
Tenant: alsPrf.Tenant,
|
||||
ID: alsPrf.ID,
|
||||
Weight: alsPrf.Weight,
|
||||
ActivationInterval: alsPrf.ActivationInterval,
|
||||
Context: alsPrf.Context,
|
||||
ActivationInterval: alsPrf.ActivationInterval,
|
||||
FilterIDs: alsPrf.FilterIDs,
|
||||
Weight: alsPrf.Weight,
|
||||
}
|
||||
for key, val := range alsPrf.Substitutes {
|
||||
for key2, val2 := range val {
|
||||
|
||||
@@ -298,8 +298,8 @@ 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,FilterIDs,ActivationInterval,Context,FieldName,Initial,Alias,Append,Weight
|
||||
cgrates.org,ALS1,FLTR_1,2014-07-29T15:00:00Z,con1,Field1,Initial1,Alias1,true,20
|
||||
#,Tenant,ID,Context,FilterIDs,ActivationInterval,FieldName,Initial,Alias,Append,Weight
|
||||
cgrates.org,ALS1,con1,FLTR_1,2014-07-29T15:00:00Z,Field1,Initial1,Alias1,true,20
|
||||
cgrates.org,ALS1,,,,Field2,Initial2,Alias2,false,
|
||||
`
|
||||
)
|
||||
|
||||
@@ -1065,12 +1065,12 @@ func TestAPItoAttributeProfile(t *testing.T) {
|
||||
TPid: "TP1",
|
||||
Tenant: "cgrates.org",
|
||||
ID: "ALS1",
|
||||
Context: "con1",
|
||||
FilterIDs: []string{"FLTR_ACNT_dan", "FLTR_DST_DE"},
|
||||
ActivationInterval: &utils.TPActivationInterval{
|
||||
ActivationTime: "2014-07-14T14:35:00Z",
|
||||
ExpiryTime: "",
|
||||
},
|
||||
Context: "con1",
|
||||
Substitutes: []*utils.TPRequestSubstitute{
|
||||
&utils.TPRequestSubstitute{
|
||||
FieldName: "FL1",
|
||||
@@ -1092,11 +1092,11 @@ func TestAPItoAttributeProfile(t *testing.T) {
|
||||
expected := &AttributeProfile{
|
||||
Tenant: "cgrates.org",
|
||||
ID: "ALS1",
|
||||
Context: "con1",
|
||||
FilterIDs: []string{"FLTR_ACNT_dan", "FLTR_DST_DE"},
|
||||
ActivationInterval: &utils.ActivationInterval{
|
||||
ActivationTime: time.Date(2014, 7, 14, 14, 35, 0, 0, time.UTC),
|
||||
},
|
||||
Context: "con1",
|
||||
Substitutes: attrMap,
|
||||
Weight: 20,
|
||||
}
|
||||
@@ -1112,12 +1112,12 @@ func TestAPItoModelTPAttribute(t *testing.T) {
|
||||
TPid: "TP1",
|
||||
Tenant: "cgrates.org",
|
||||
ID: "ALS1",
|
||||
Context: "con1",
|
||||
FilterIDs: []string{"FLTR_ACNT_dan", "FLTR_DST_DE"},
|
||||
ActivationInterval: &utils.TPActivationInterval{
|
||||
ActivationTime: "2014-07-14T14:35:00Z",
|
||||
ExpiryTime: "",
|
||||
},
|
||||
Context: "con1",
|
||||
Substitutes: []*utils.TPRequestSubstitute{
|
||||
&utils.TPRequestSubstitute{
|
||||
FieldName: "FL1",
|
||||
@@ -1133,8 +1133,8 @@ func TestAPItoModelTPAttribute(t *testing.T) {
|
||||
Tpid: "TP1",
|
||||
Tenant: "cgrates.org",
|
||||
ID: "ALS1",
|
||||
FilterIDs: "FLTR_ACNT_dan;FLTR_DST_DE",
|
||||
Context: "con1",
|
||||
FilterIDs: "FLTR_ACNT_dan;FLTR_DST_DE",
|
||||
FieldName: "FL1",
|
||||
Initial: "In1",
|
||||
Alias: "Al1",
|
||||
@@ -1155,8 +1155,8 @@ func TestModelAsTPAttribute(t *testing.T) {
|
||||
Tpid: "TP1",
|
||||
Tenant: "cgrates.org",
|
||||
ID: "ALS1",
|
||||
FilterIDs: "FLTR_ACNT_dan;FLTR_DST_DE",
|
||||
Context: "con1",
|
||||
FilterIDs: "FLTR_ACNT_dan;FLTR_DST_DE",
|
||||
FieldName: "FL1",
|
||||
Initial: "In1",
|
||||
Alias: "Al1",
|
||||
@@ -1169,12 +1169,12 @@ func TestModelAsTPAttribute(t *testing.T) {
|
||||
TPid: "TP1",
|
||||
Tenant: "cgrates.org",
|
||||
ID: "ALS1",
|
||||
Context: "con1",
|
||||
FilterIDs: []string{"FLTR_ACNT_dan", "FLTR_DST_DE"},
|
||||
ActivationInterval: &utils.TPActivationInterval{
|
||||
ActivationTime: "2014-07-14T14:35:00Z",
|
||||
ExpiryTime: "",
|
||||
},
|
||||
Context: "con1",
|
||||
Substitutes: []*utils.TPRequestSubstitute{
|
||||
&utils.TPRequestSubstitute{
|
||||
FieldName: "FL1",
|
||||
|
||||
@@ -546,9 +546,9 @@ type TPAttribute struct {
|
||||
Tpid string
|
||||
Tenant string `index:"0" re:""`
|
||||
ID string `index:"1" re:""`
|
||||
FilterIDs string `index:"2" re:""`
|
||||
ActivationInterval string `index:"3" re:""`
|
||||
Context string `index:"4" re:""`
|
||||
Context string `index:"2" re:""`
|
||||
FilterIDs string `index:"3" re:""`
|
||||
ActivationInterval string `index:"4" re:""`
|
||||
FieldName string `index:"5" re:""`
|
||||
Initial string `index:"6" re:""`
|
||||
Alias string `index:"7" re:""`
|
||||
|
||||
Reference in New Issue
Block a user