diff --git a/agents/agentreq.go b/agents/agentreq.go index 202ec4f17..335528f9c 100644 --- a/agents/agentreq.go +++ b/agents/agentreq.go @@ -65,7 +65,6 @@ func NewAgentRequest(req utils.DataProvider, Trailer: trailer, Opts: opts, } - ar.dynamicProvider = utils.NewDynamicDataProvider(ar) // populate tenant if tntIf, err := ar.ParseField( &config.FCTemplate{Type: utils.META_COMPOSED, @@ -81,20 +80,19 @@ func NewAgentRequest(req utils.DataProvider, // AgentRequest represents data related to one request towards agent // implements utils.DataProvider so we can pass it to filters type AgentRequest struct { - Request utils.DataProvider // request - Vars utils.NavigableMap2 // shared data - CGRRequest *utils.OrderedNavigableMap // Used in reply to access the request that was send - CGRReply *utils.NavigableMap2 - Reply *utils.OrderedNavigableMap - Tenant string - Timezone string - filterS *engine.FilterS - Header utils.DataProvider - Trailer utils.DataProvider - diamreq *utils.OrderedNavigableMap // used in case of building requests (ie. DisconnectSession) - tmp utils.NavigableMap2 // used in case you want to store temporary items and access them later - Opts *utils.OrderedNavigableMap - dynamicProvider *utils.DynamicDataProvider + Request utils.DataProvider // request + Vars utils.NavigableMap2 // shared data + CGRRequest *utils.OrderedNavigableMap // Used in reply to access the request that was send + CGRReply *utils.NavigableMap2 + Reply *utils.OrderedNavigableMap + Tenant string + Timezone string + filterS *engine.FilterS + Header utils.DataProvider + Trailer utils.DataProvider + diamreq *utils.OrderedNavigableMap // used in case of building requests (ie. DisconnectSession) + tmp utils.NavigableMap2 // used in case you want to store temporary items and access them later + Opts *utils.OrderedNavigableMap } // String implements utils.DataProvider @@ -185,7 +183,7 @@ func (ar *AgentRequest) SetFields(tplFlds []*config.FCTemplate) (err error) { ar.tmp = utils.NavigableMap2{} for _, tplFld := range tplFlds { if pass, err := ar.filterS.Pass(ar.Tenant, - tplFld.Filters, ar.dynamicProvider); err != nil { + tplFld.Filters, ar); err != nil { return err } else if !pass { continue diff --git a/agents/libdiam.go b/agents/libdiam.go index 1101d73e6..870131e77 100644 --- a/agents/libdiam.go +++ b/agents/libdiam.go @@ -335,9 +335,9 @@ func (dP *diameterDP) FieldAsInterface(fldPath []string) (data interface{}, err // lastPath can contain selector inside lastPath := fldPath[len(fldPath)-1] var slctrStr string - if splt := strings.Split(lastPath, "<"); len(splt) != 1 { + if splt := strings.Split(lastPath, utils.IdxStart); len(splt) != 1 { lastPath = splt[0] - if splt[1][len(splt[1])-1:] != ">" { + if splt[1][len(splt[1])-1:] != utils.IdxEnd { return nil, fmt.Errorf("filter rule <%s> needs to end in ]", splt[1]) } slctrStr = splt[1][:len(splt[1])-1] // also strip the last ] diff --git a/agents/libdiam_test.go b/agents/libdiam_test.go index c0128372d..d1777e1e6 100644 --- a/agents/libdiam_test.go +++ b/agents/libdiam_test.go @@ -84,20 +84,20 @@ func TestDPFieldAsInterface(t *testing.T) { } eOut = interface{}("208708000003") // with filter on second group item if out, err := dP.FieldAsInterface([]string{"Subscription-Id", - "Subscription-Id-Data<1>"}); err != nil { // on index + "Subscription-Id-Data[1]"}); err != nil { // on index t.Error(err) } else if eOut != out { t.Errorf("Expecting: %v, received: %v", eOut, out) } if out, err := dP.FieldAsInterface([]string{"Subscription-Id", - "Subscription-Id-Data<~Subscription-Id-Type(1)>"}); err != nil { // on filter + "Subscription-Id-Data[~Subscription-Id-Type(1)]"}); err != nil { // on filter t.Error(err) } else if out != eOut { // can be any result since both entries are matching single filter t.Errorf("expecting: %v, received: %v", eOut, out) } eOut = interface{}("208708000004") if out, err := dP.FieldAsInterface([]string{"Subscription-Id", - "Subscription-Id-Data<~Subscription-Id-Type(2)|~Value-Digits(20000)>"}); err != nil { // on multiple filter + "Subscription-Id-Data[~Subscription-Id-Type(2)|~Value-Digits(20000)]"}); err != nil { // on multiple filter t.Error(err) } else if eOut != out { t.Errorf("Expecting: %v, received: %v", eOut, out) diff --git a/config/rsrparser.go b/config/rsrparser.go index f0f6c1c40..7ed7fb2cd 100644 --- a/config/rsrparser.go +++ b/config/rsrparser.go @@ -32,14 +32,14 @@ var ( ) func NewRSRParsers(parsersRules string, rsrSeparator string) (prsrs RSRParsers, err error) { - if parsersRules == "" { + if parsersRules == utils.EmptyString { return } - if count := strings.Count(parsersRules, "`"); count%2 != 0 { // check if we have matching ` + if count := strings.Count(parsersRules, utils.RSRConstSep); count%2 != 0 { // check if we have matching ` return nil, fmt.Errorf("Unclosed unspilit syntax") } else if count != 0 { var splitedRule []string - for idx := strings.IndexByte(parsersRules, '`'); idx != -1; idx = strings.IndexByte(parsersRules, '`') { + for idx := strings.IndexByte(parsersRules, utils.RSRConstChar); idx != -1; idx = strings.IndexByte(parsersRules, utils.RSRConstChar) { insideARulePrefix := !strings.HasSuffix(parsersRules[:idx], utils.INFIELD_SEP) // if doesn't have ; we need to concatenate it with last rule if insideARulePrefix { splitedRule = append(splitedRule, strings.Split(parsersRules[:idx], utils.INFIELD_SEP)...) @@ -47,7 +47,7 @@ func NewRSRParsers(parsersRules string, rsrSeparator string) (prsrs RSRParsers, splitedRule = append(splitedRule, strings.Split(parsersRules[:idx-1], utils.INFIELD_SEP)...) } parsersRules = parsersRules[idx+1:] - idx = strings.IndexByte(parsersRules, '`') + idx = strings.IndexByte(parsersRules, utils.RSRConstChar) if insideARulePrefix { splitedRule[len(splitedRule)-1] += parsersRules[:idx] } else { @@ -60,7 +60,7 @@ func NewRSRParsers(parsersRules string, rsrSeparator string) (prsrs RSRParsers, } insideARuleSufix := !strings.HasPrefix(parsersRules, utils.INFIELD_SEP) // if doesn't have ; we need to concatenate it with last rule if insideARuleSufix { - idx = strings.IndexByte(parsersRules, ';') + idx = strings.IndexByte(parsersRules, utils.FALLBACK_SEP) // ';' if idx == -1 { idx = len(parsersRules) splitedRule[len(splitedRule)-1] += parsersRules[:idx] @@ -81,8 +81,8 @@ func NewRSRParsers(parsersRules string, rsrSeparator string) (prsrs RSRParsers, } return NewRSRParsersFromSlice(splitedRule) } - if dynIdxStart := strings.IndexByte(parsersRules, '<'); dynIdxStart != -1 { - if dynIdxEnd := strings.IndexByte(parsersRules[dynIdxStart:], '>'); dynIdxEnd != -1 { + if dynIdxStart := strings.IndexByte(parsersRules, utils.RSRDynStartChar); dynIdxStart != -1 { + if dynIdxEnd := strings.IndexByte(parsersRules[dynIdxStart:], utils.RSRDynEndChar); dynIdxEnd != -1 { return NewDynRSRParser(parsersRules, rsrSeparator, dynIdxStart, dynIdxStart+dynIdxEnd) } } @@ -137,7 +137,7 @@ func (prsrs RSRParsers) ParseValue(value interface{}) (out string, err error) { for _, prsr := range prsrs { var outPrsr string if outPrsr, err = prsr.ParseValue(value); err != nil { - return "", err + return utils.EmptyString, err } out += outPrsr } @@ -148,7 +148,7 @@ func (prsrs RSRParsers) ParseDataProvider(dP utils.DataProvider) (out string, er for _, prsr := range prsrs { var outPrsr string if outPrsr, err = prsr.ParseDataProvider(dP); err != nil { - return "", err + return utils.EmptyString, err } out += outPrsr } @@ -159,7 +159,7 @@ func (prsrs RSRParsers) ParseDataProviderWithInterfaces(dP utils.DataProvider) ( for _, prsr := range prsrs { var outPrsr string if outPrsr, err = prsr.ParseDataProviderWithInterfaces(dP); err != nil { - return "", err + return utils.EmptyString, err } out += outPrsr } @@ -206,8 +206,8 @@ func (prsr *RSRParser) AttrName() string { // Compile parses Rules string and repopulates other fields func (prsr *RSRParser) Compile() (err error) { parserRules := prsr.Rules - if dynIdxStart := strings.IndexByte(parserRules, '<'); dynIdxStart != -1 { - if dynIdxEnd := strings.IndexByte(parserRules[dynIdxStart:], '>'); dynIdxEnd != -1 { + if dynIdxStart := strings.IndexByte(parserRules, utils.RSRDynStartChar); dynIdxStart != -1 { + if dynIdxEnd := strings.IndexByte(parserRules[dynIdxStart:], utils.RSRDynEndChar); dynIdxEnd != -1 { var dynrules RSRParsers if dynrules, err = NewRSRParsers(parserRules[dynIdxStart+1:dynIdxStart+dynIdxEnd], CgrConfig().GeneralCfg().RSRSep); err != nil { @@ -220,8 +220,8 @@ func (prsr *RSRParser) Compile() (err error) { } } - if idxConverters := strings.Index(parserRules, "{*"); idxConverters != -1 { // converters in the string - if !strings.HasSuffix(parserRules, "}") { + if idxConverters := strings.Index(parserRules, utils.RSRDataConverterPrefix); idxConverters != -1 { // converters in the string + if !strings.HasSuffix(parserRules, utils.RSRDataConverterSufix) { return fmt.Errorf("invalid converter terminator in rule: <%s>", parserRules) } @@ -368,8 +368,8 @@ func NewDynRSRParser(parsersRules string, sep string, idxStart, idxEnd int) (prs return } lastRules := parsersRules[sepIdx+1:] - if dynIdxStart := strings.IndexByte(lastRules, '<'); dynIdxStart != -1 { - if dynIdxEnd := strings.IndexByte(lastRules[dynIdxStart:], '>'); dynIdxEnd != -1 { + if dynIdxStart := strings.IndexByte(lastRules, utils.RSRDynStartChar); dynIdxStart != -1 { + if dynIdxEnd := strings.IndexByte(lastRules[dynIdxStart:], utils.RSRDynEndChar); dynIdxEnd != -1 { var lastrsr RSRParsers if lastrsr, err = NewDynRSRParser(lastRules, sep, dynIdxStart, dynIdxStart+dynIdxEnd); err != nil { diff --git a/data/conf/samples/diam_tutmysql/data.json b/data/conf/samples/diam_tutmysql/data.json index c1474863a..38b1c7d8c 100644 --- a/data/conf/samples/diam_tutmysql/data.json +++ b/data/conf/samples/diam_tutmysql/data.json @@ -34,7 +34,7 @@ { "tag": "Account", "path": "*cgreq.Account", "type": "*variable", "mandatory": true, - "value": "~*req.Subscription-Id.Subscription-Id-Data<~Subscription-Id-Type(1)>" + "value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(1)]" }, { "tag": "Destination", "path": "*cgreq.Destination", @@ -93,7 +93,7 @@ { "tag": "Account", "path": "Account", "type": "*variable", "mandatory": true, - "value": "~*req.Subscription-Id.Subscription-Id-Data<~Subscription-Id-Type(0)>" + "value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]" }, { "tag": "Usage", "path": "Usage", @@ -101,7 +101,7 @@ }, { "tag": "LastUsed", "path": "LastUsed", "type": "*sum", - "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Input-Octets<~Rating-Group(1)>;~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Output-Octets<~Rating-Group(1)>" + "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Input-Octets[~Rating-Group(1)>;~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Output-Octets[~Rating-Group(1)]" }, ], "reply_fields": [ @@ -119,7 +119,7 @@ "id": "data_update_grp2", "filters": [ "*string:~*vars.*cmd:CCR", "*string:~*req.CC-Request-Type:2", - "*string:~*req.Multiple-Services-Credit-Control.Rating-Group<1>:2", + "*string:~*req.Multiple-Services-Credit-Control.Rating-Group[1]:2", "*prefix:~*req.Service-Context-Id:gprs" ], "flags": ["*update", "*accounts"], @@ -148,7 +148,7 @@ { "tag": "Account", "path": "Account", "type": "*variable", "mandatory": true, - "value": "~*req.Subscription-Id.Subscription-Id-Data<~Subscription-Id-Type(0)>" + "value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]" }, { "tag": "Destination", "path": "Destination", @@ -170,7 +170,7 @@ }, { "tag": "LastUsed", "path": "LastUsed", "type": "*sum", - "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Input-Octets<~Rating-Group(2)>;~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Output-Octets<~Rating-Group(2)>" + "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Input-Octets[~Rating-Group(2)>;~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Output-Octets[~Rating-Group(2)]" }, ], "reply_fields": [ diff --git a/data/conf/samples/diam_tutmysql/sms.json b/data/conf/samples/diam_tutmysql/sms.json index 1e82f07ff..dd20c0949 100644 --- a/data/conf/samples/diam_tutmysql/sms.json +++ b/data/conf/samples/diam_tutmysql/sms.json @@ -41,7 +41,7 @@ { "tag": "Account", "path": "*cgreq.Account", "type": "*variable", "mandatory": true, - "value": "~*req.Subscription-Id.Subscription-Id-Data<~Subscription-Id-Type(0)>" + "value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]" }, { "tag": "Destination", "path": "*cgreq.Destination", diff --git a/data/conf/samples/diam_tutmysql/voice.json b/data/conf/samples/diam_tutmysql/voice.json index 3c79ed198..8ffa6e80f 100644 --- a/data/conf/samples/diam_tutmysql/voice.json +++ b/data/conf/samples/diam_tutmysql/voice.json @@ -33,7 +33,7 @@ { "tag": "Account", "path": "*cgreq.Account", "type": "*variable", "mandatory": true, - "value": "~*req.Service-Information.IMS-Information.Calling-Party-Address<0>:s/tel:\\+(\\d+)/${1}/" + "value": "~*req.Service-Information.IMS-Information.Calling-Party-Address[0]:s/tel:\\+(\\d+)/${1}/" }, { "tag": "Account", "path": "*cgreq.Account", @@ -125,7 +125,7 @@ { "tag": "Account", "path": "*cgreq.Account", "type": "*variable", "mandatory": true, - "value": "~*req.Service-Information.IMS-Information.Calling-Party-Address<0>:s/tel:\\+(\\d+)/${1}/" + "value": "~*req.Service-Information.IMS-Information.Calling-Party-Address[0]:s/tel:\\+(\\d+)/${1}/" }, { "tag": "Account", "path": "*cgreq.Account", diff --git a/data/conf/samples/diamagent_internal/data.json b/data/conf/samples/diamagent_internal/data.json index 13df967be..9066f4254 100644 --- a/data/conf/samples/diamagent_internal/data.json +++ b/data/conf/samples/diamagent_internal/data.json @@ -38,7 +38,7 @@ "tag": "Account", "path": "*cgreq.Account", "type": "*variable", - "value": "~*req.Subscription-Id.Subscription-Id-Data<~Subscription-Id-Type(1)>", + "value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(1)]", "mandatory": true }, { @@ -137,7 +137,7 @@ "tag": "Account", "path": "*cgreq.Account", "type": "*variable", - "value": "~*req.Subscription-Id.Subscription-Id-Data<~Subscription-Id-Type(0)>" + "value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]" }, { "tag": "Destination", @@ -169,7 +169,7 @@ "tag": "LastUsed", "path": "*cgreq.LastUsed", "type": "*sum", - "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Input-Octets<~Rating-Group(1)>;~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Output-Octets<~Rating-Group(1)>" + "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Input-Octets[~Rating-Group(1)];~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Output-Octets[~Rating-Group(1)]" }, ], "reply_fields": [ @@ -194,7 +194,7 @@ "filters": [ "*string:~*vars.*cmd:CCR", "*string:~*req.CC-Request-Type:2", - "*string:~*req.Multiple-Services-Credit-Control.Rating-Group<1>:2", + "*string:~*req.Multiple-Services-Credit-Control.Rating-Group[1]:2", "*prefix:~*req.Service-Context-Id:gprs" ], "flags": ["*update", "*accounts"], @@ -242,7 +242,7 @@ "path": "*cgreq.Account", "type": "*variable", "mandatory": true, - "value": "~*req.Subscription-Id.Subscription-Id-Data<~Subscription-Id-Type(0)>" + "value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]" }, { "tag": "Destination", @@ -274,7 +274,7 @@ "tag": "LastUsed", "path": "*cgreq.LastUsed", "type": "*sum", - "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Input-Octets<~Rating-Group(2)>;~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Output-Octets<~Rating-Group(2)>" + "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Input-Octets[~Rating-Group(2)];~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Output-Octets[~Rating-Group(2)]" }, ], "reply_fields": [ @@ -340,7 +340,7 @@ "path": "*cgreq.Account", "type": "*variable", "mandatory": true, - "value": "~*req.Subscription-Id.Subscription-Id-Data<~Subscription-Id-Type(0)>" + "value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]" }, { "tag": "Destination", diff --git a/data/conf/samples/diamagent_internal/dryrun.json b/data/conf/samples/diamagent_internal/dryrun.json index 62570e1e5..2323e3f42 100644 --- a/data/conf/samples/diamagent_internal/dryrun.json +++ b/data/conf/samples/diamagent_internal/dryrun.json @@ -65,14 +65,14 @@ "path": "*cgreq.UsedUnits1", "type": "*variable", "mandatory": true, - "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets<~Rating-Group(1)>" + "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets[~Rating-Group(1)]" }, { "tag": "UsedUnits2", "path": "*cgreq.UsedUnits2", "type": "*variable", "mandatory": true, - "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets<~Rating-Group(2)>" + "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets[~Rating-Group(2)]" }, ], @@ -167,14 +167,14 @@ "path": "*cgreq.UsedUnits1", "type": "*variable", "mandatory": true, - "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets<~Rating-Group(1)>" + "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets[~Rating-Group(1)]" }, { "tag": "UsedUnits2", "path": "*cgreq.UsedUnits2", "type": "*variable", "mandatory": true, - "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets<~Rating-Group(2)>" + "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets[~Rating-Group(2)]" }, ], "reply_fields":[ diff --git a/data/conf/samples/diamagent_internal/message.json b/data/conf/samples/diamagent_internal/message.json index f5299746c..784707957 100644 --- a/data/conf/samples/diamagent_internal/message.json +++ b/data/conf/samples/diamagent_internal/message.json @@ -42,7 +42,7 @@ "path": "*cgreq.Account", "type": "*variable", "mandatory": true, - "value": "~*req.Subscription-Id.Subscription-Id-Data<~Subscription-Id-Type(0)>" + "value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]" }, { "tag": "Destination", diff --git a/data/conf/samples/diamagent_internal/mms.json b/data/conf/samples/diamagent_internal/mms.json index 74f4641de..4ec65e707 100644 --- a/data/conf/samples/diamagent_internal/mms.json +++ b/data/conf/samples/diamagent_internal/mms.json @@ -42,7 +42,7 @@ "path": "*cgreq.Account", "type": "*variable", "mandatory": true, - "value": "~*req.Subscription-Id.Subscription-Id-Data<~Subscription-Id-Type(0)>" + "value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]" }, { "tag": "Destination", diff --git a/data/conf/samples/diamagent_internal/simpa.json b/data/conf/samples/diamagent_internal/simpa.json index 31b2b5cfb..7c46da38a 100644 --- a/data/conf/samples/diamagent_internal/simpa.json +++ b/data/conf/samples/diamagent_internal/simpa.json @@ -42,7 +42,7 @@ "path": "*cgreq.Account", "type": "*variable", "mandatory": true, - "value": "~*req.Subscription-Id.Subscription-Id-Data<~Subscription-Id-Type(0)>" + "value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]" }, { "tag": "AnswerTime", diff --git a/data/conf/samples/diamagent_internal/wrong_template.json b/data/conf/samples/diamagent_internal/wrong_template.json index 37a57ad2c..391411dd3 100644 --- a/data/conf/samples/diamagent_internal/wrong_template.json +++ b/data/conf/samples/diamagent_internal/wrong_template.json @@ -43,7 +43,7 @@ "path": "*cgreq.Account", "type": "*variable", "mandatory": true, - "value": "~*req.Subscription-Id.Subscription-Id-Data<~Subscription-Id-Type(0)>" + "value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]" }, { "tag": "Destination", diff --git a/data/conf/samples/diamagent_mongo/data.json b/data/conf/samples/diamagent_mongo/data.json index 13df967be..9066f4254 100644 --- a/data/conf/samples/diamagent_mongo/data.json +++ b/data/conf/samples/diamagent_mongo/data.json @@ -38,7 +38,7 @@ "tag": "Account", "path": "*cgreq.Account", "type": "*variable", - "value": "~*req.Subscription-Id.Subscription-Id-Data<~Subscription-Id-Type(1)>", + "value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(1)]", "mandatory": true }, { @@ -137,7 +137,7 @@ "tag": "Account", "path": "*cgreq.Account", "type": "*variable", - "value": "~*req.Subscription-Id.Subscription-Id-Data<~Subscription-Id-Type(0)>" + "value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]" }, { "tag": "Destination", @@ -169,7 +169,7 @@ "tag": "LastUsed", "path": "*cgreq.LastUsed", "type": "*sum", - "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Input-Octets<~Rating-Group(1)>;~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Output-Octets<~Rating-Group(1)>" + "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Input-Octets[~Rating-Group(1)];~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Output-Octets[~Rating-Group(1)]" }, ], "reply_fields": [ @@ -194,7 +194,7 @@ "filters": [ "*string:~*vars.*cmd:CCR", "*string:~*req.CC-Request-Type:2", - "*string:~*req.Multiple-Services-Credit-Control.Rating-Group<1>:2", + "*string:~*req.Multiple-Services-Credit-Control.Rating-Group[1]:2", "*prefix:~*req.Service-Context-Id:gprs" ], "flags": ["*update", "*accounts"], @@ -242,7 +242,7 @@ "path": "*cgreq.Account", "type": "*variable", "mandatory": true, - "value": "~*req.Subscription-Id.Subscription-Id-Data<~Subscription-Id-Type(0)>" + "value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]" }, { "tag": "Destination", @@ -274,7 +274,7 @@ "tag": "LastUsed", "path": "*cgreq.LastUsed", "type": "*sum", - "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Input-Octets<~Rating-Group(2)>;~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Output-Octets<~Rating-Group(2)>" + "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Input-Octets[~Rating-Group(2)];~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Output-Octets[~Rating-Group(2)]" }, ], "reply_fields": [ @@ -340,7 +340,7 @@ "path": "*cgreq.Account", "type": "*variable", "mandatory": true, - "value": "~*req.Subscription-Id.Subscription-Id-Data<~Subscription-Id-Type(0)>" + "value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]" }, { "tag": "Destination", diff --git a/data/conf/samples/diamagent_mongo/dryrun.json b/data/conf/samples/diamagent_mongo/dryrun.json index 62570e1e5..2323e3f42 100644 --- a/data/conf/samples/diamagent_mongo/dryrun.json +++ b/data/conf/samples/diamagent_mongo/dryrun.json @@ -65,14 +65,14 @@ "path": "*cgreq.UsedUnits1", "type": "*variable", "mandatory": true, - "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets<~Rating-Group(1)>" + "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets[~Rating-Group(1)]" }, { "tag": "UsedUnits2", "path": "*cgreq.UsedUnits2", "type": "*variable", "mandatory": true, - "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets<~Rating-Group(2)>" + "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets[~Rating-Group(2)]" }, ], @@ -167,14 +167,14 @@ "path": "*cgreq.UsedUnits1", "type": "*variable", "mandatory": true, - "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets<~Rating-Group(1)>" + "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets[~Rating-Group(1)]" }, { "tag": "UsedUnits2", "path": "*cgreq.UsedUnits2", "type": "*variable", "mandatory": true, - "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets<~Rating-Group(2)>" + "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets[~Rating-Group(2)]" }, ], "reply_fields":[ diff --git a/data/conf/samples/diamagent_mongo/message.json b/data/conf/samples/diamagent_mongo/message.json index f5299746c..784707957 100644 --- a/data/conf/samples/diamagent_mongo/message.json +++ b/data/conf/samples/diamagent_mongo/message.json @@ -42,7 +42,7 @@ "path": "*cgreq.Account", "type": "*variable", "mandatory": true, - "value": "~*req.Subscription-Id.Subscription-Id-Data<~Subscription-Id-Type(0)>" + "value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]" }, { "tag": "Destination", diff --git a/data/conf/samples/diamagent_mongo/mms.json b/data/conf/samples/diamagent_mongo/mms.json index 74f4641de..4ec65e707 100644 --- a/data/conf/samples/diamagent_mongo/mms.json +++ b/data/conf/samples/diamagent_mongo/mms.json @@ -42,7 +42,7 @@ "path": "*cgreq.Account", "type": "*variable", "mandatory": true, - "value": "~*req.Subscription-Id.Subscription-Id-Data<~Subscription-Id-Type(0)>" + "value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]" }, { "tag": "Destination", diff --git a/data/conf/samples/diamagent_mongo/simpa.json b/data/conf/samples/diamagent_mongo/simpa.json index 31b2b5cfb..7c46da38a 100644 --- a/data/conf/samples/diamagent_mongo/simpa.json +++ b/data/conf/samples/diamagent_mongo/simpa.json @@ -42,7 +42,7 @@ "path": "*cgreq.Account", "type": "*variable", "mandatory": true, - "value": "~*req.Subscription-Id.Subscription-Id-Data<~Subscription-Id-Type(0)>" + "value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]" }, { "tag": "AnswerTime", diff --git a/data/conf/samples/diamagent_mongo/wrong_template.json b/data/conf/samples/diamagent_mongo/wrong_template.json index 37a57ad2c..391411dd3 100644 --- a/data/conf/samples/diamagent_mongo/wrong_template.json +++ b/data/conf/samples/diamagent_mongo/wrong_template.json @@ -43,7 +43,7 @@ "path": "*cgreq.Account", "type": "*variable", "mandatory": true, - "value": "~*req.Subscription-Id.Subscription-Id-Data<~Subscription-Id-Type(0)>" + "value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]" }, { "tag": "Destination", diff --git a/data/conf/samples/diamagent_mysql/data.json b/data/conf/samples/diamagent_mysql/data.json index 3f60f3d23..59e80982d 100644 --- a/data/conf/samples/diamagent_mysql/data.json +++ b/data/conf/samples/diamagent_mysql/data.json @@ -38,7 +38,7 @@ "tag": "Account", "path": "*cgreq.Account", "type": "*variable", - "value": "~*req.Subscription-Id.Subscription-Id-Data<~Subscription-Id-Type(1)>", + "value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(1)]", "mandatory": true }, { @@ -137,7 +137,7 @@ "tag": "Account", "path": "*cgreq.Account", "type": "*variable", - "value": "~*req.Subscription-Id.Subscription-Id-Data<~Subscription-Id-Type(0)>" + "value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]" }, { "tag": "Destination", @@ -169,7 +169,7 @@ "tag": "LastUsed", "path": "*cgreq.LastUsed", "type": "*sum", - "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Input-Octets<~Rating-Group(1)>;~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Output-Octets<~Rating-Group(1)>" + "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Input-Octets[~Rating-Group(1)];~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Output-Octets[~Rating-Group(1)]" }, ], "reply_fields": [ @@ -194,7 +194,7 @@ "filters": [ "*string:~*vars.*cmd:CCR", "*string:~*req.CC-Request-Type:2", - "*string:~*req.Multiple-Services-Credit-Control.Rating-Group<1>:2", + "*string:~*req.Multiple-Services-Credit-Control.Rating-Group[1]:2", "*prefix:~*req.Service-Context-Id:gprs" ], "flags": ["*update", "*accounts"], @@ -242,7 +242,7 @@ "path": "*cgreq.Account", "type": "*variable", "mandatory": true, - "value": "~*req.Subscription-Id.Subscription-Id-Data<~Subscription-Id-Type(0)>" + "value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]" }, { "tag": "Destination", @@ -274,7 +274,7 @@ "tag": "LastUsed", "path": "*cgreq.LastUsed", "type": "*sum", - "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Input-Octets<~Rating-Group(2)>;~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Output-Octets<~Rating-Group(2)>" + "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Input-Octets[~Rating-Group(2)];~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Output-Octets[~Rating-Group(2)]" }, ], "reply_fields": [ @@ -340,7 +340,7 @@ "path": "*cgreq.Account", "type": "*variable", "mandatory": true, - "value": "~*req.Subscription-Id.Subscription-Id-Data<~Subscription-Id-Type(0)>" + "value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]" }, { "tag": "Destination", diff --git a/data/conf/samples/diamagent_mysql/dryrun.json b/data/conf/samples/diamagent_mysql/dryrun.json index 22be79f93..6b384af11 100644 --- a/data/conf/samples/diamagent_mysql/dryrun.json +++ b/data/conf/samples/diamagent_mysql/dryrun.json @@ -65,14 +65,14 @@ "path": "*cgreq.UsedUnits1", "type": "*variable", "mandatory": true, - "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets<~Rating-Group(1)>" + "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets[~Rating-Group(1)]" }, { "tag": "UsedUnits2", "path": "*cgreq.UsedUnits2", "type": "*variable", "mandatory": true, - "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets<~Rating-Group(2)>" + "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets[~Rating-Group(2)]" }, ], @@ -167,14 +167,14 @@ "path": "*cgreq.UsedUnits1", "type": "*variable", "mandatory": true, - "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets<~Rating-Group(1)>" + "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets[~Rating-Group(1)]" }, { "tag": "UsedUnits2", "path": "*cgreq.UsedUnits2", "type": "*variable", "mandatory": true, - "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets<~Rating-Group(2)>" + "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets[~Rating-Group(2)]" }, ], "reply_fields":[ diff --git a/data/conf/samples/diamagent_mysql/message.json b/data/conf/samples/diamagent_mysql/message.json index f5299746c..784707957 100644 --- a/data/conf/samples/diamagent_mysql/message.json +++ b/data/conf/samples/diamagent_mysql/message.json @@ -42,7 +42,7 @@ "path": "*cgreq.Account", "type": "*variable", "mandatory": true, - "value": "~*req.Subscription-Id.Subscription-Id-Data<~Subscription-Id-Type(0)>" + "value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]" }, { "tag": "Destination", diff --git a/data/conf/samples/diamagent_mysql/mms.json b/data/conf/samples/diamagent_mysql/mms.json index 74f4641de..4ec65e707 100644 --- a/data/conf/samples/diamagent_mysql/mms.json +++ b/data/conf/samples/diamagent_mysql/mms.json @@ -42,7 +42,7 @@ "path": "*cgreq.Account", "type": "*variable", "mandatory": true, - "value": "~*req.Subscription-Id.Subscription-Id-Data<~Subscription-Id-Type(0)>" + "value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]" }, { "tag": "Destination", diff --git a/data/conf/samples/diamagent_mysql/simpa.json b/data/conf/samples/diamagent_mysql/simpa.json index 31b2b5cfb..7c46da38a 100644 --- a/data/conf/samples/diamagent_mysql/simpa.json +++ b/data/conf/samples/diamagent_mysql/simpa.json @@ -42,7 +42,7 @@ "path": "*cgreq.Account", "type": "*variable", "mandatory": true, - "value": "~*req.Subscription-Id.Subscription-Id-Data<~Subscription-Id-Type(0)>" + "value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]" }, { "tag": "AnswerTime", diff --git a/data/conf/samples/diamagent_mysql/wrong_template.json b/data/conf/samples/diamagent_mysql/wrong_template.json index 37a57ad2c..391411dd3 100644 --- a/data/conf/samples/diamagent_mysql/wrong_template.json +++ b/data/conf/samples/diamagent_mysql/wrong_template.json @@ -43,7 +43,7 @@ "path": "*cgreq.Account", "type": "*variable", "mandatory": true, - "value": "~*req.Subscription-Id.Subscription-Id-Data<~Subscription-Id-Type(0)>" + "value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]" }, { "tag": "Destination", diff --git a/data/conf/samples/diamsctpagent_internal/data.json b/data/conf/samples/diamsctpagent_internal/data.json index f22cd3481..a67c877b8 100755 --- a/data/conf/samples/diamsctpagent_internal/data.json +++ b/data/conf/samples/diamsctpagent_internal/data.json @@ -15,7 +15,7 @@ {"tag": "RequestType", "path": "*cgreq.RequestType", "type": "*constant", "value": "*prepaid"}, {"tag": "Category", "path": "*cgreq.Category", "type": "*constant", "value": "generic"}, {"tag": "Account", "path": "*cgreq.Account", "type": "*variable", - "value": "~*req.Subscription-Id.Subscription-Id-Data<~Subscription-Id-Type(1)>", "mandatory": true}, + "value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(1)]", "mandatory": true}, {"tag": "Destination", "path": "*cgreq.Destination", "type": "*constant", "value": "data"}, {"tag": "SetupTime", "path": "*cgreq.SetupTime", "type": "*variable", "value": "~*req.Event-Timestamp", "mandatory": true}, @@ -45,7 +45,7 @@ {"tag": "RequestType", "path": "*cgreq.RequestType", "type": "*constant", "value": "*prepaid"}, {"tag": "Category", "path": "*cgreq.Category", "type": "*contant", "value": "generic"}, {"tag": "Account", "path": "*cgreq.Account", "type": "*variable", - "value": "~*req.Subscription-Id.Subscription-Id-Data<~Subscription-Id-Type(0)>"}, + "value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]"}, {"tag": "Destination", "path": "*cgreq.Destination", "type": "*constant", "value": "data"}, {"tag": "SetupTime", "path": "*cgreq.SetupTime", "type": "*variable", "value": "~*req.Event-Timestamp", "mandatory": true}, @@ -53,7 +53,7 @@ "value": "~*req.Event-Timestamp", "mandatory": true}, {"tag": "Usage", "path": "*cgreq.Usage", "type": "*constant", "value": "2048"}, {"tag": "LastUsed", "path": "*cgreq.LastUsed", "type": "*sum", - "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Input-Octets<~Rating-Group(1)>;~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Output-Octets<~Rating-Group(1)>"}, + "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Input-Octets[~Rating-Group(1)];~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Output-Octets[~Rating-Group(1)]"}, ], "reply_fields": [ {"tag": "CCATemplate", "type": "*template", "value": "*cca"}, @@ -65,7 +65,7 @@ { "id": "data_update_grp2", "filters": ["*string:~*vars.*cmd:CCR", "*string:~*req.CC-Request-Type:2", - "*string:~*req.Multiple-Services-Credit-Control.Rating-Group<1>:2", "*prefix:~*req.Service-Context-Id:gprs"], + "*string:~*req.Multiple-Services-Credit-Control.Rating-Group[1]:2", "*prefix:~*req.Service-Context-Id:gprs"], "flags": ["*update", "*accounts"], "request_fields":[ {"tag": "ToR", "path": "*cgreq.ToR", "type": "*constant", "value": "*data"}, @@ -77,7 +77,7 @@ {"tag": "RequestType", "path": "*cgreq.RequestType", "type": "*constant", "value": "*prepaid"}, {"tag": "Category", "path": "*cgreq.Category", "type": "*constant", "value": "generic"}, {"tag": "Account", "path": "*cgreq.Account", "type": "*variable", "mandatory": true, - "value": "~*req.Subscription-Id.Subscription-Id-Data<~Subscription-Id-Type(0)>"}, + "value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]"}, {"tag": "Destination", "path": "*cgreq.Destination", "type": "*constant", "value": "data"}, {"tag": "SetupTime", "path": "*cgreq.SetupTime", "type": "*variable", "value": "~*req.Event-Timestamp", "mandatory": true}, @@ -85,7 +85,7 @@ "value": "~*req.Event-Timestamp", "mandatory": true}, {"tag": "Usage", "path": "*cgreq.Usage", "type": "*constant", "value": "2048"}, {"tag": "LastUsed", "path": "*cgreq.LastUsed", "type": "*sum", - "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Input-Octets<~Rating-Group(2)>;~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Output-Octets<~Rating-Group(2)>"}, + "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Input-Octets[~Rating-Group(2)];~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Output-Octets[~Rating-Group(2)]"}, ], "reply_fields": [ {"tag": "CCATemplate", "type": "*template", "value": "*cca"}, @@ -108,7 +108,7 @@ {"tag": "RequestType", "path": "*cgreq.RequestType", "type": "*constant", "value": "*prepaid"}, {"tag": "Category", "path": "*cgreq.Category", "type": "*constant", "value": "generic"}, {"tag": "Account", "path": "*cgreq.Account", "type": "*variable", "mandatory": true, - "value": "~*req.Subscription-Id.Subscription-Id-Data<~Subscription-Id-Type(0)>"}, + "value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]"}, {"tag": "Destination", "path": "*cgreq.Destination", "type": "*constant", "value": "data"}, {"tag": "SetupTime", "path": "*cgreq.SetupTime", "type": "*variable", "value": "~*req.Event-Timestamp", "mandatory": true}, diff --git a/data/conf/samples/diamsctpagent_internal/dryrun.json b/data/conf/samples/diamsctpagent_internal/dryrun.json index 77e473738..c64413e4b 100755 --- a/data/conf/samples/diamsctpagent_internal/dryrun.json +++ b/data/conf/samples/diamsctpagent_internal/dryrun.json @@ -20,9 +20,9 @@ {"tag": "SetupTime", "path": "*cgreq.SetupTime", "type": "*variable", "value": "~*req.Event-Timestamp", "mandatory": true}, {"tag": "UsedUnits1", "path": "*cgreq.UsedUnits1", "type": "*variable", "mandatory": true, - "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets<~Rating-Group(1)>"}, + "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets[~Rating-Group(1)]"}, {"tag": "UsedUnits2", "path": "*cgreq.UsedUnits2", "type": "*variable", "mandatory": true, - "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets<~Rating-Group(2)>"}, + "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets[~Rating-Group(2)]"}, ], "reply_fields":[ @@ -54,9 +54,9 @@ {"tag": "SetupTime", "path": "*cgreq.SetupTime", "type": "*variable", "value": "~*req.Event-Timestamp", "mandatory": true}, {"tag": "UsedUnits1", "path": "*cgreq.UsedUnits1", "type": "*variable", "mandatory": true, - "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets<~Rating-Group(1)>"}, + "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets[~Rating-Group(1)]"}, {"tag": "UsedUnits2", "path": "*cgreq.UsedUnits2", "type": "*variable", "mandatory": true, - "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets<~Rating-Group(2)>"}, + "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets[~Rating-Group(2)]"}, ], "reply_fields":[ diff --git a/data/conf/samples/diamsctpagent_internal/message.json b/data/conf/samples/diamsctpagent_internal/message.json index 702f45954..c45b0eba4 100755 --- a/data/conf/samples/diamsctpagent_internal/message.json +++ b/data/conf/samples/diamsctpagent_internal/message.json @@ -15,7 +15,7 @@ {"tag": "Category", "path": "*cgreq.Category", "type": "*constant", "value": "sms"}, {"tag": "RequestType", "path": "*cgreq.RequestType", "type": "*constant", "value": "*prepaid"}, {"tag": "Account", "path": "*cgreq.Account", "type": "*variable", "mandatory": true, - "value": "~*req.Subscription-Id.Subscription-Id-Data<~Subscription-Id-Type(0)>"}, + "value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]"}, {"tag": "Destination", "path": "*cgreq.Destination", "type": "*variable", "mandatory": true, "value": "~*req.Service-Information.SMS-Information.Recipient-Address.Address-Data"}, {"tag": "SetupTime", "path": "*cgreq.SetupTime", "type": "*variable", diff --git a/data/conf/samples/diamsctpagent_internal/mms.json b/data/conf/samples/diamsctpagent_internal/mms.json index 74f4641de..4ec65e707 100644 --- a/data/conf/samples/diamsctpagent_internal/mms.json +++ b/data/conf/samples/diamsctpagent_internal/mms.json @@ -42,7 +42,7 @@ "path": "*cgreq.Account", "type": "*variable", "mandatory": true, - "value": "~*req.Subscription-Id.Subscription-Id-Data<~Subscription-Id-Type(0)>" + "value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]" }, { "tag": "Destination", diff --git a/data/conf/samples/diamsctpagent_internal/simpa.json b/data/conf/samples/diamsctpagent_internal/simpa.json index df26b954e..4df22b605 100755 --- a/data/conf/samples/diamsctpagent_internal/simpa.json +++ b/data/conf/samples/diamsctpagent_internal/simpa.json @@ -15,7 +15,7 @@ {"tag": "RequestType", "path": "*cgreq.RequestType", "type": "*constant", "value": "*prepaid"}, {"tag": "Category", "path": "*cgreq.Category", "type": "*constant", "value": "generic"}, {"tag": "Account", "path": "*cgreq.Account", "type": "*variable", "mandatory": true, - "value": "~*req.Subscription-Id.Subscription-Id-Data<~Subscription-Id-Type(0)>"}, + "value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]"}, {"tag": "AnswerTime", "path": "*cgreq.AnswerTime", "type": "*variable", "value": "~*req.Event-Timestamp", "mandatory": true}, {"tag": "Usage", "path": "*cgreq.Usage", "type": "*value_exponent", "mandatory": true, diff --git a/data/conf/samples/diamsctpagent_mongo/data.json b/data/conf/samples/diamsctpagent_mongo/data.json index f22cd3481..a67c877b8 100755 --- a/data/conf/samples/diamsctpagent_mongo/data.json +++ b/data/conf/samples/diamsctpagent_mongo/data.json @@ -15,7 +15,7 @@ {"tag": "RequestType", "path": "*cgreq.RequestType", "type": "*constant", "value": "*prepaid"}, {"tag": "Category", "path": "*cgreq.Category", "type": "*constant", "value": "generic"}, {"tag": "Account", "path": "*cgreq.Account", "type": "*variable", - "value": "~*req.Subscription-Id.Subscription-Id-Data<~Subscription-Id-Type(1)>", "mandatory": true}, + "value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(1)]", "mandatory": true}, {"tag": "Destination", "path": "*cgreq.Destination", "type": "*constant", "value": "data"}, {"tag": "SetupTime", "path": "*cgreq.SetupTime", "type": "*variable", "value": "~*req.Event-Timestamp", "mandatory": true}, @@ -45,7 +45,7 @@ {"tag": "RequestType", "path": "*cgreq.RequestType", "type": "*constant", "value": "*prepaid"}, {"tag": "Category", "path": "*cgreq.Category", "type": "*contant", "value": "generic"}, {"tag": "Account", "path": "*cgreq.Account", "type": "*variable", - "value": "~*req.Subscription-Id.Subscription-Id-Data<~Subscription-Id-Type(0)>"}, + "value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]"}, {"tag": "Destination", "path": "*cgreq.Destination", "type": "*constant", "value": "data"}, {"tag": "SetupTime", "path": "*cgreq.SetupTime", "type": "*variable", "value": "~*req.Event-Timestamp", "mandatory": true}, @@ -53,7 +53,7 @@ "value": "~*req.Event-Timestamp", "mandatory": true}, {"tag": "Usage", "path": "*cgreq.Usage", "type": "*constant", "value": "2048"}, {"tag": "LastUsed", "path": "*cgreq.LastUsed", "type": "*sum", - "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Input-Octets<~Rating-Group(1)>;~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Output-Octets<~Rating-Group(1)>"}, + "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Input-Octets[~Rating-Group(1)];~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Output-Octets[~Rating-Group(1)]"}, ], "reply_fields": [ {"tag": "CCATemplate", "type": "*template", "value": "*cca"}, @@ -65,7 +65,7 @@ { "id": "data_update_grp2", "filters": ["*string:~*vars.*cmd:CCR", "*string:~*req.CC-Request-Type:2", - "*string:~*req.Multiple-Services-Credit-Control.Rating-Group<1>:2", "*prefix:~*req.Service-Context-Id:gprs"], + "*string:~*req.Multiple-Services-Credit-Control.Rating-Group[1]:2", "*prefix:~*req.Service-Context-Id:gprs"], "flags": ["*update", "*accounts"], "request_fields":[ {"tag": "ToR", "path": "*cgreq.ToR", "type": "*constant", "value": "*data"}, @@ -77,7 +77,7 @@ {"tag": "RequestType", "path": "*cgreq.RequestType", "type": "*constant", "value": "*prepaid"}, {"tag": "Category", "path": "*cgreq.Category", "type": "*constant", "value": "generic"}, {"tag": "Account", "path": "*cgreq.Account", "type": "*variable", "mandatory": true, - "value": "~*req.Subscription-Id.Subscription-Id-Data<~Subscription-Id-Type(0)>"}, + "value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]"}, {"tag": "Destination", "path": "*cgreq.Destination", "type": "*constant", "value": "data"}, {"tag": "SetupTime", "path": "*cgreq.SetupTime", "type": "*variable", "value": "~*req.Event-Timestamp", "mandatory": true}, @@ -85,7 +85,7 @@ "value": "~*req.Event-Timestamp", "mandatory": true}, {"tag": "Usage", "path": "*cgreq.Usage", "type": "*constant", "value": "2048"}, {"tag": "LastUsed", "path": "*cgreq.LastUsed", "type": "*sum", - "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Input-Octets<~Rating-Group(2)>;~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Output-Octets<~Rating-Group(2)>"}, + "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Input-Octets[~Rating-Group(2)];~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Output-Octets[~Rating-Group(2)]"}, ], "reply_fields": [ {"tag": "CCATemplate", "type": "*template", "value": "*cca"}, @@ -108,7 +108,7 @@ {"tag": "RequestType", "path": "*cgreq.RequestType", "type": "*constant", "value": "*prepaid"}, {"tag": "Category", "path": "*cgreq.Category", "type": "*constant", "value": "generic"}, {"tag": "Account", "path": "*cgreq.Account", "type": "*variable", "mandatory": true, - "value": "~*req.Subscription-Id.Subscription-Id-Data<~Subscription-Id-Type(0)>"}, + "value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]"}, {"tag": "Destination", "path": "*cgreq.Destination", "type": "*constant", "value": "data"}, {"tag": "SetupTime", "path": "*cgreq.SetupTime", "type": "*variable", "value": "~*req.Event-Timestamp", "mandatory": true}, diff --git a/data/conf/samples/diamsctpagent_mongo/dryrun.json b/data/conf/samples/diamsctpagent_mongo/dryrun.json index 77e473738..c64413e4b 100755 --- a/data/conf/samples/diamsctpagent_mongo/dryrun.json +++ b/data/conf/samples/diamsctpagent_mongo/dryrun.json @@ -20,9 +20,9 @@ {"tag": "SetupTime", "path": "*cgreq.SetupTime", "type": "*variable", "value": "~*req.Event-Timestamp", "mandatory": true}, {"tag": "UsedUnits1", "path": "*cgreq.UsedUnits1", "type": "*variable", "mandatory": true, - "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets<~Rating-Group(1)>"}, + "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets[~Rating-Group(1)]"}, {"tag": "UsedUnits2", "path": "*cgreq.UsedUnits2", "type": "*variable", "mandatory": true, - "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets<~Rating-Group(2)>"}, + "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets[~Rating-Group(2)]"}, ], "reply_fields":[ @@ -54,9 +54,9 @@ {"tag": "SetupTime", "path": "*cgreq.SetupTime", "type": "*variable", "value": "~*req.Event-Timestamp", "mandatory": true}, {"tag": "UsedUnits1", "path": "*cgreq.UsedUnits1", "type": "*variable", "mandatory": true, - "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets<~Rating-Group(1)>"}, + "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets[~Rating-Group(1)]"}, {"tag": "UsedUnits2", "path": "*cgreq.UsedUnits2", "type": "*variable", "mandatory": true, - "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets<~Rating-Group(2)>"}, + "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets[~Rating-Group(2)]"}, ], "reply_fields":[ diff --git a/data/conf/samples/diamsctpagent_mongo/message.json b/data/conf/samples/diamsctpagent_mongo/message.json index 702f45954..c45b0eba4 100755 --- a/data/conf/samples/diamsctpagent_mongo/message.json +++ b/data/conf/samples/diamsctpagent_mongo/message.json @@ -15,7 +15,7 @@ {"tag": "Category", "path": "*cgreq.Category", "type": "*constant", "value": "sms"}, {"tag": "RequestType", "path": "*cgreq.RequestType", "type": "*constant", "value": "*prepaid"}, {"tag": "Account", "path": "*cgreq.Account", "type": "*variable", "mandatory": true, - "value": "~*req.Subscription-Id.Subscription-Id-Data<~Subscription-Id-Type(0)>"}, + "value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]"}, {"tag": "Destination", "path": "*cgreq.Destination", "type": "*variable", "mandatory": true, "value": "~*req.Service-Information.SMS-Information.Recipient-Address.Address-Data"}, {"tag": "SetupTime", "path": "*cgreq.SetupTime", "type": "*variable", diff --git a/data/conf/samples/diamsctpagent_mongo/mms.json b/data/conf/samples/diamsctpagent_mongo/mms.json index 74f4641de..4ec65e707 100644 --- a/data/conf/samples/diamsctpagent_mongo/mms.json +++ b/data/conf/samples/diamsctpagent_mongo/mms.json @@ -42,7 +42,7 @@ "path": "*cgreq.Account", "type": "*variable", "mandatory": true, - "value": "~*req.Subscription-Id.Subscription-Id-Data<~Subscription-Id-Type(0)>" + "value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]" }, { "tag": "Destination", diff --git a/data/conf/samples/diamsctpagent_mongo/simpa.json b/data/conf/samples/diamsctpagent_mongo/simpa.json index df26b954e..4df22b605 100755 --- a/data/conf/samples/diamsctpagent_mongo/simpa.json +++ b/data/conf/samples/diamsctpagent_mongo/simpa.json @@ -15,7 +15,7 @@ {"tag": "RequestType", "path": "*cgreq.RequestType", "type": "*constant", "value": "*prepaid"}, {"tag": "Category", "path": "*cgreq.Category", "type": "*constant", "value": "generic"}, {"tag": "Account", "path": "*cgreq.Account", "type": "*variable", "mandatory": true, - "value": "~*req.Subscription-Id.Subscription-Id-Data<~Subscription-Id-Type(0)>"}, + "value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]"}, {"tag": "AnswerTime", "path": "*cgreq.AnswerTime", "type": "*variable", "value": "~*req.Event-Timestamp", "mandatory": true}, {"tag": "Usage", "path": "*cgreq.Usage", "type": "*value_exponent", "mandatory": true, diff --git a/data/conf/samples/diamsctpagent_mysql/data.json b/data/conf/samples/diamsctpagent_mysql/data.json index f22cd3481..a67c877b8 100755 --- a/data/conf/samples/diamsctpagent_mysql/data.json +++ b/data/conf/samples/diamsctpagent_mysql/data.json @@ -15,7 +15,7 @@ {"tag": "RequestType", "path": "*cgreq.RequestType", "type": "*constant", "value": "*prepaid"}, {"tag": "Category", "path": "*cgreq.Category", "type": "*constant", "value": "generic"}, {"tag": "Account", "path": "*cgreq.Account", "type": "*variable", - "value": "~*req.Subscription-Id.Subscription-Id-Data<~Subscription-Id-Type(1)>", "mandatory": true}, + "value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(1)]", "mandatory": true}, {"tag": "Destination", "path": "*cgreq.Destination", "type": "*constant", "value": "data"}, {"tag": "SetupTime", "path": "*cgreq.SetupTime", "type": "*variable", "value": "~*req.Event-Timestamp", "mandatory": true}, @@ -45,7 +45,7 @@ {"tag": "RequestType", "path": "*cgreq.RequestType", "type": "*constant", "value": "*prepaid"}, {"tag": "Category", "path": "*cgreq.Category", "type": "*contant", "value": "generic"}, {"tag": "Account", "path": "*cgreq.Account", "type": "*variable", - "value": "~*req.Subscription-Id.Subscription-Id-Data<~Subscription-Id-Type(0)>"}, + "value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]"}, {"tag": "Destination", "path": "*cgreq.Destination", "type": "*constant", "value": "data"}, {"tag": "SetupTime", "path": "*cgreq.SetupTime", "type": "*variable", "value": "~*req.Event-Timestamp", "mandatory": true}, @@ -53,7 +53,7 @@ "value": "~*req.Event-Timestamp", "mandatory": true}, {"tag": "Usage", "path": "*cgreq.Usage", "type": "*constant", "value": "2048"}, {"tag": "LastUsed", "path": "*cgreq.LastUsed", "type": "*sum", - "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Input-Octets<~Rating-Group(1)>;~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Output-Octets<~Rating-Group(1)>"}, + "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Input-Octets[~Rating-Group(1)];~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Output-Octets[~Rating-Group(1)]"}, ], "reply_fields": [ {"tag": "CCATemplate", "type": "*template", "value": "*cca"}, @@ -65,7 +65,7 @@ { "id": "data_update_grp2", "filters": ["*string:~*vars.*cmd:CCR", "*string:~*req.CC-Request-Type:2", - "*string:~*req.Multiple-Services-Credit-Control.Rating-Group<1>:2", "*prefix:~*req.Service-Context-Id:gprs"], + "*string:~*req.Multiple-Services-Credit-Control.Rating-Group[1]:2", "*prefix:~*req.Service-Context-Id:gprs"], "flags": ["*update", "*accounts"], "request_fields":[ {"tag": "ToR", "path": "*cgreq.ToR", "type": "*constant", "value": "*data"}, @@ -77,7 +77,7 @@ {"tag": "RequestType", "path": "*cgreq.RequestType", "type": "*constant", "value": "*prepaid"}, {"tag": "Category", "path": "*cgreq.Category", "type": "*constant", "value": "generic"}, {"tag": "Account", "path": "*cgreq.Account", "type": "*variable", "mandatory": true, - "value": "~*req.Subscription-Id.Subscription-Id-Data<~Subscription-Id-Type(0)>"}, + "value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]"}, {"tag": "Destination", "path": "*cgreq.Destination", "type": "*constant", "value": "data"}, {"tag": "SetupTime", "path": "*cgreq.SetupTime", "type": "*variable", "value": "~*req.Event-Timestamp", "mandatory": true}, @@ -85,7 +85,7 @@ "value": "~*req.Event-Timestamp", "mandatory": true}, {"tag": "Usage", "path": "*cgreq.Usage", "type": "*constant", "value": "2048"}, {"tag": "LastUsed", "path": "*cgreq.LastUsed", "type": "*sum", - "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Input-Octets<~Rating-Group(2)>;~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Output-Octets<~Rating-Group(2)>"}, + "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Input-Octets[~Rating-Group(2)];~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Output-Octets[~Rating-Group(2)]"}, ], "reply_fields": [ {"tag": "CCATemplate", "type": "*template", "value": "*cca"}, @@ -108,7 +108,7 @@ {"tag": "RequestType", "path": "*cgreq.RequestType", "type": "*constant", "value": "*prepaid"}, {"tag": "Category", "path": "*cgreq.Category", "type": "*constant", "value": "generic"}, {"tag": "Account", "path": "*cgreq.Account", "type": "*variable", "mandatory": true, - "value": "~*req.Subscription-Id.Subscription-Id-Data<~Subscription-Id-Type(0)>"}, + "value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]"}, {"tag": "Destination", "path": "*cgreq.Destination", "type": "*constant", "value": "data"}, {"tag": "SetupTime", "path": "*cgreq.SetupTime", "type": "*variable", "value": "~*req.Event-Timestamp", "mandatory": true}, diff --git a/data/conf/samples/diamsctpagent_mysql/dryrun.json b/data/conf/samples/diamsctpagent_mysql/dryrun.json index 77e473738..c64413e4b 100755 --- a/data/conf/samples/diamsctpagent_mysql/dryrun.json +++ b/data/conf/samples/diamsctpagent_mysql/dryrun.json @@ -20,9 +20,9 @@ {"tag": "SetupTime", "path": "*cgreq.SetupTime", "type": "*variable", "value": "~*req.Event-Timestamp", "mandatory": true}, {"tag": "UsedUnits1", "path": "*cgreq.UsedUnits1", "type": "*variable", "mandatory": true, - "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets<~Rating-Group(1)>"}, + "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets[~Rating-Group(1)]"}, {"tag": "UsedUnits2", "path": "*cgreq.UsedUnits2", "type": "*variable", "mandatory": true, - "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets<~Rating-Group(2)>"}, + "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets[~Rating-Group(2)]"}, ], "reply_fields":[ @@ -54,9 +54,9 @@ {"tag": "SetupTime", "path": "*cgreq.SetupTime", "type": "*variable", "value": "~*req.Event-Timestamp", "mandatory": true}, {"tag": "UsedUnits1", "path": "*cgreq.UsedUnits1", "type": "*variable", "mandatory": true, - "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets<~Rating-Group(1)>"}, + "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets[~Rating-Group(1)]"}, {"tag": "UsedUnits2", "path": "*cgreq.UsedUnits2", "type": "*variable", "mandatory": true, - "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets<~Rating-Group(2)>"}, + "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets[~Rating-Group(2)]"}, ], "reply_fields":[ diff --git a/data/conf/samples/diamsctpagent_mysql/message.json b/data/conf/samples/diamsctpagent_mysql/message.json index 702f45954..c45b0eba4 100755 --- a/data/conf/samples/diamsctpagent_mysql/message.json +++ b/data/conf/samples/diamsctpagent_mysql/message.json @@ -15,7 +15,7 @@ {"tag": "Category", "path": "*cgreq.Category", "type": "*constant", "value": "sms"}, {"tag": "RequestType", "path": "*cgreq.RequestType", "type": "*constant", "value": "*prepaid"}, {"tag": "Account", "path": "*cgreq.Account", "type": "*variable", "mandatory": true, - "value": "~*req.Subscription-Id.Subscription-Id-Data<~Subscription-Id-Type(0)>"}, + "value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]"}, {"tag": "Destination", "path": "*cgreq.Destination", "type": "*variable", "mandatory": true, "value": "~*req.Service-Information.SMS-Information.Recipient-Address.Address-Data"}, {"tag": "SetupTime", "path": "*cgreq.SetupTime", "type": "*variable", diff --git a/data/conf/samples/diamsctpagent_mysql/mms.json b/data/conf/samples/diamsctpagent_mysql/mms.json index 74f4641de..4ec65e707 100644 --- a/data/conf/samples/diamsctpagent_mysql/mms.json +++ b/data/conf/samples/diamsctpagent_mysql/mms.json @@ -42,7 +42,7 @@ "path": "*cgreq.Account", "type": "*variable", "mandatory": true, - "value": "~*req.Subscription-Id.Subscription-Id-Data<~Subscription-Id-Type(0)>" + "value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]" }, { "tag": "Destination", diff --git a/data/conf/samples/diamsctpagent_mysql/simpa.json b/data/conf/samples/diamsctpagent_mysql/simpa.json index df26b954e..4df22b605 100755 --- a/data/conf/samples/diamsctpagent_mysql/simpa.json +++ b/data/conf/samples/diamsctpagent_mysql/simpa.json @@ -15,7 +15,7 @@ {"tag": "RequestType", "path": "*cgreq.RequestType", "type": "*constant", "value": "*prepaid"}, {"tag": "Category", "path": "*cgreq.Category", "type": "*constant", "value": "generic"}, {"tag": "Account", "path": "*cgreq.Account", "type": "*variable", "mandatory": true, - "value": "~*req.Subscription-Id.Subscription-Id-Data<~Subscription-Id-Type(0)>"}, + "value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]"}, {"tag": "AnswerTime", "path": "*cgreq.AnswerTime", "type": "*variable", "value": "~*req.Event-Timestamp", "mandatory": true}, {"tag": "Usage", "path": "*cgreq.Usage", "type": "*value_exponent", "mandatory": true, diff --git a/data/conf/samples/dispatchers/diamagent/data.json b/data/conf/samples/dispatchers/diamagent/data.json index c3ad9b264..35f92df17 100644 --- a/data/conf/samples/dispatchers/diamagent/data.json +++ b/data/conf/samples/dispatchers/diamagent/data.json @@ -16,7 +16,7 @@ {"tag": "RequestType", "path": "*cgreq.RequestType", "type": "*constant", "value": "*prepaid"}, {"tag": "Category", "path": "*cgreq.Category", "type": "*constant", "value": "generic"}, {"tag": "Account", "path": "*cgreq.Account", "type": "*variable", - "value": "~*req.Subscription-Id.Subscription-Id-Data<~Subscription-Id-Type(1)>", "mandatory": true}, + "value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(1)]", "mandatory": true}, {"tag": "Destination", "path": "*cgreq.Destination", "type": "*constant", "value": "data"}, {"tag": "SetupTime", "path": "*cgreq.SetupTime", "type": "*variable", "value": "~*req.Event-Timestamp", "mandatory": true}, @@ -47,7 +47,7 @@ {"tag": "RequestType", "path": "*cgreq.RequestType", "type": "*constant", "value": "*prepaid"}, {"tag": "Category", "path": "*cgreq.Category", "type": "*contant", "value": "generic"}, {"tag": "Account", "path": "*cgreq.Account", "type": "*variable", - "value": "~*req.Subscription-Id.Subscription-Id-Data<~Subscription-Id-Type(0)>"}, + "value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]"}, {"tag": "Destination", "path": "*cgreq.Destination", "type": "*constant", "value": "data"}, {"tag": "SetupTime", "path": "*cgreq.SetupTime", "type": "*variable", "value": "~*req.Event-Timestamp", "mandatory": true}, @@ -55,7 +55,7 @@ "value": "~*req.Event-Timestamp", "mandatory": true}, {"tag": "Usage", "path": "*cgreq.Usage", "type": "*constant", "value": "2048"}, {"tag": "LastUsed", "path": "*cgreq.LastUsed", "type": "*sum", - "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Input-Octets<~Rating-Group(1)>;~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Output-Octets<~Rating-Group(1)>"}, + "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Input-Octets[~Rating-Group(1)];~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Output-Octets[~Rating-Group(1)]"}, ], "reply_fields": [ {"tag": "CCATemplate", "type": "*template", "value": "*cca"}, @@ -67,7 +67,7 @@ { "id": "data_update_grp2", "filters": ["*string:~*vars.*cmd:CCR", "*string:~*req.CC-Request-Type:2", - "*string:~*req.Multiple-Services-Credit-Control.Rating-Group<1>:2", "*prefix:~*req.Service-Context-Id:gprs"], + "*string:~*req.Multiple-Services-Credit-Control.Rating-Group[1]:2", "*prefix:~*req.Service-Context-Id:gprs"], "flags": ["*update", "*accounts"], "request_fields":[ {"tag": "ToR", "path": "*cgreq.ToR", "type": "*constant", "value": "*data"}, @@ -80,7 +80,7 @@ {"tag": "RequestType", "path": "*cgreq.RequestType", "type": "*constant", "value": "*prepaid"}, {"tag": "Category", "path": "*cgreq.Category", "type": "*constant", "value": "generic"}, {"tag": "Account", "path": "*cgreq.Account", "type": "*variable", "mandatory": true, - "value": "~*req.Subscription-Id.Subscription-Id-Data<~Subscription-Id-Type(0)>"}, + "value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]"}, {"tag": "Destination", "path": "*cgreq.Destination", "type": "*constant", "value": "data"}, {"tag": "SetupTime", "path": "*cgreq.SetupTime", "type": "*variable", "value": "~*req.Event-Timestamp", "mandatory": true}, @@ -88,7 +88,7 @@ "value": "~*req.Event-Timestamp", "mandatory": true}, {"tag": "Usage", "path": "*cgreq.Usage", "type": "*constant", "value": "2048"}, {"tag": "LastUsed", "path": "*cgreq.LastUsed", "type": "*sum", - "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Input-Octets<~Rating-Group(2)>;~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Output-Octets<~Rating-Group(2)>"}, + "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Input-Octets[~Rating-Group(2)];~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Output-Octets[~Rating-Group(2)]"}, ], "reply_fields": [ {"tag": "CCATemplate", "type": "*template", "value": "*cca"}, @@ -112,7 +112,7 @@ {"tag": "RequestType", "path": "*cgreq.RequestType", "type": "*constant", "value": "*prepaid"}, {"tag": "Category", "path": "*cgreq.Category", "type": "*constant", "value": "generic"}, {"tag": "Account", "path": "*cgreq.Account", "type": "*variable", "mandatory": true, - "value": "~*req.Subscription-Id.Subscription-Id-Data<~Subscription-Id-Type(0)>"}, + "value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]"}, {"tag": "Destination", "path": "*cgreq.Destination", "type": "*constant", "value": "data"}, {"tag": "SetupTime", "path": "*cgreq.SetupTime", "type": "*variable", "value": "~*req.Event-Timestamp", "mandatory": true}, diff --git a/data/conf/samples/dispatchers/diamagent/dryrun.json b/data/conf/samples/dispatchers/diamagent/dryrun.json index 2ec1e267e..86f6a6764 100644 --- a/data/conf/samples/dispatchers/diamagent/dryrun.json +++ b/data/conf/samples/dispatchers/diamagent/dryrun.json @@ -21,9 +21,9 @@ {"tag": "SetupTime", "path": "*cgreq.SetupTime", "type": "*variable", "value": "~*req.Event-Timestamp", "mandatory": true}, {"tag": "UsedUnits1", "path": "*cgreq.UsedUnits1", "type": "*variable", "mandatory": true, - "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets<~Rating-Group(1)>"}, + "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets[~Rating-Group(1)]"}, {"tag": "UsedUnits2", "path": "*cgreq.UsedUnits2", "type": "*variable", "mandatory": true, - "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets<~Rating-Group(2)>"}, + "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets[~Rating-Group(2)]"}, ], "reply_fields":[ @@ -56,9 +56,9 @@ {"tag": "SetupTime", "path": "*cgreq.SetupTime", "type": "*variable", "value": "~*req.Event-Timestamp", "mandatory": true}, {"tag": "UsedUnits1", "path": "*cgreq.UsedUnits1", "type": "*variable", "mandatory": true, - "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets<~Rating-Group(1)>"}, + "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets[~Rating-Group(1)]"}, {"tag": "UsedUnits2", "path": "*cgreq.UsedUnits2", "type": "*variable", "mandatory": true, - "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets<~Rating-Group(2)>"}, + "value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets[~Rating-Group(2)]"}, ], "reply_fields":[ diff --git a/data/conf/samples/dispatchers/diamagent/message.json b/data/conf/samples/dispatchers/diamagent/message.json index 1b3bee6bc..d4c954001 100644 --- a/data/conf/samples/dispatchers/diamagent/message.json +++ b/data/conf/samples/dispatchers/diamagent/message.json @@ -16,7 +16,7 @@ {"tag": "Category", "path": "*cgreq.Category", "type": "*constant", "value": "sms"}, {"tag": "RequestType", "path": "*cgreq.RequestType", "type": "*constant", "value": "*prepaid"}, {"tag": "Account", "path": "*cgreq.Account", "type": "*variable", "mandatory": true, - "value": "~*req.Subscription-Id.Subscription-Id-Data<~Subscription-Id-Type(0)>"}, + "value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]"}, {"tag": "Destination", "path": "*cgreq.Destination", "type": "*variable", "mandatory": true, "value": "~*req.Service-Information.SMS-Information.Recipient-Address.Address-Data"}, {"tag": "SetupTime", "path": "*cgreq.SetupTime", "type": "*variable", diff --git a/data/conf/samples/dispatchers/diamagent/mms.json b/data/conf/samples/dispatchers/diamagent/mms.json index e2c9c2983..c78caf338 100644 --- a/data/conf/samples/dispatchers/diamagent/mms.json +++ b/data/conf/samples/dispatchers/diamagent/mms.json @@ -47,7 +47,7 @@ "path": "*cgreq.Account", "type": "*variable", "mandatory": true, - "value": "~*req.Subscription-Id.Subscription-Id-Data<~Subscription-Id-Type(0)>" + "value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]" }, { "tag": "Destination", diff --git a/data/conf/samples/dispatchers/diamagent/simpa.json b/data/conf/samples/dispatchers/diamagent/simpa.json index 5ece23225..0856fd257 100644 --- a/data/conf/samples/dispatchers/diamagent/simpa.json +++ b/data/conf/samples/dispatchers/diamagent/simpa.json @@ -16,7 +16,7 @@ {"tag": "RequestType", "path": "*cgreq.RequestType", "type": "*constant", "value": "*prepaid"}, {"tag": "Category", "path": "*cgreq.Category", "type": "*constant", "value": "generic"}, {"tag": "Account", "path": "*cgreq.Account", "type": "*variable", "mandatory": true, - "value": "~*req.Subscription-Id.Subscription-Id-Data<~Subscription-Id-Type(0)>"}, + "value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]"}, {"tag": "AnswerTime", "path": "*cgreq.AnswerTime", "type": "*variable", "value": "~*req.Event-Timestamp", "mandatory": true}, {"tag": "Usage", "path": "*cgreq.Usage", "type": "*value_exponent", "mandatory": true, diff --git a/ees/eereq.go b/ees/eereq.go index 3a8a95689..057e6778f 100644 --- a/ees/eereq.go +++ b/ees/eereq.go @@ -44,7 +44,6 @@ func NewEventExporterRequest(req utils.DataProvider, dc utils.MapStorage, trl: utils.NewOrderedNavigableMap(), dc: dc, } - eeR.dynamicProvider = utils.NewDynamicDataProvider(eeR) return } @@ -60,8 +59,7 @@ type EventExporterRequest struct { trl *utils.OrderedNavigableMap // Used in reply to access the request that was send dc utils.MapStorage - filterS *engine.FilterS - dynamicProvider *utils.DynamicDataProvider + filterS *engine.FilterS } // String implements utils.DataProvider @@ -127,7 +125,7 @@ func (eeR *EventExporterRequest) FieldAsString(fldPath []string) (val string, er func (eeR *EventExporterRequest) SetFields(tplFlds []*config.FCTemplate) (err error) { for _, tplFld := range tplFlds { if pass, err := eeR.filterS.Pass(eeR.tnt, - tplFld.Filters, eeR.dynamicProvider); err != nil { + tplFld.Filters, eeR); err != nil { return err } else if !pass { continue @@ -147,7 +145,7 @@ func (eeR *EventExporterRequest) SetFields(tplFlds []*config.FCTemplate) (err er } var fullPath *utils.FullPath var itmPath []string - if fullPath, err = eeR.dynamicProvider.GetFullFieldPath(tplFld.Path); err != nil { + if fullPath, err = utils.GetFullFieldPath(tplFld.Path, eeR); err != nil { return } else if fullPath == nil { // no dynamic path fullPath = &utils.FullPath{ @@ -222,18 +220,18 @@ func (eeR *EventExporterRequest) ParseField( out = eeR.RemoteHost().String() isString = true case utils.MetaVariable, utils.META_COMPOSED, utils.MetaGroup: - out, err = cfgFld.Value.ParseDataProvider(eeR.dynamicProvider) + out, err = cfgFld.Value.ParseDataProvider(eeR) isString = true case utils.META_USAGE_DIFFERENCE: if len(cfgFld.Value) != 2 { return nil, fmt.Errorf("invalid arguments <%s> to %s", utils.ToJSON(cfgFld.Value), utils.META_USAGE_DIFFERENCE) } - strVal1, err := cfgFld.Value[0].ParseDataProvider(eeR.dynamicProvider) + strVal1, err := cfgFld.Value[0].ParseDataProvider(eeR) if err != nil { return "", err } - strVal2, err := cfgFld.Value[1].ParseDataProvider(eeR.dynamicProvider) + strVal2, err := cfgFld.Value[1].ParseDataProvider(eeR) if err != nil { return "", err } @@ -252,7 +250,7 @@ func (eeR *EventExporterRequest) ParseField( return nil, fmt.Errorf("invalid arguments <%s> to %s", utils.ToJSON(cfgFld.Value), utils.MetaCCUsage) } - strVal1, err := cfgFld.Value[0].ParseDataProvider(eeR.dynamicProvider) // ReqNr + strVal1, err := cfgFld.Value[0].ParseDataProvider(eeR) // ReqNr if err != nil { return "", err } @@ -261,7 +259,7 @@ func (eeR *EventExporterRequest) ParseField( return "", fmt.Errorf("invalid requestNumber <%s> to %s", strVal1, utils.MetaCCUsage) } - strVal2, err := cfgFld.Value[1].ParseDataProvider(eeR.dynamicProvider) // TotalUsage + strVal2, err := cfgFld.Value[1].ParseDataProvider(eeR) // TotalUsage if err != nil { return "", err } @@ -270,7 +268,7 @@ func (eeR *EventExporterRequest) ParseField( return "", fmt.Errorf("invalid usedCCTime <%s> to %s", strVal2, utils.MetaCCUsage) } - strVal3, err := cfgFld.Value[2].ParseDataProvider(eeR.dynamicProvider) // DebitInterval + strVal3, err := cfgFld.Value[2].ParseDataProvider(eeR) // DebitInterval if err != nil { return "", err } @@ -287,7 +285,7 @@ func (eeR *EventExporterRequest) ParseField( case utils.MetaSum: iFaceVals := make([]interface{}, len(cfgFld.Value)) for i, val := range cfgFld.Value { - strVal, err := val.ParseDataProvider(eeR.dynamicProvider) + strVal, err := val.ParseDataProvider(eeR) if err != nil { return "", err } @@ -297,7 +295,7 @@ func (eeR *EventExporterRequest) ParseField( case utils.MetaDifference: iFaceVals := make([]interface{}, len(cfgFld.Value)) for i, val := range cfgFld.Value { - strVal, err := val.ParseDataProvider(eeR.dynamicProvider) + strVal, err := val.ParseDataProvider(eeR) if err != nil { return "", err } @@ -307,7 +305,7 @@ func (eeR *EventExporterRequest) ParseField( case utils.MetaMultiply: iFaceVals := make([]interface{}, len(cfgFld.Value)) for i, val := range cfgFld.Value { - strVal, err := val.ParseDataProvider(eeR.dynamicProvider) + strVal, err := val.ParseDataProvider(eeR) if err != nil { return "", err } @@ -317,7 +315,7 @@ func (eeR *EventExporterRequest) ParseField( case utils.MetaDivide: iFaceVals := make([]interface{}, len(cfgFld.Value)) for i, val := range cfgFld.Value { - strVal, err := val.ParseDataProvider(eeR.dynamicProvider) + strVal, err := val.ParseDataProvider(eeR) if err != nil { return "", err } @@ -329,7 +327,7 @@ func (eeR *EventExporterRequest) ParseField( return nil, fmt.Errorf("invalid arguments <%s> to %s", utils.ToJSON(cfgFld.Value), utils.MetaValueExponent) } - strVal1, err := cfgFld.Value[0].ParseDataProvider(eeR.dynamicProvider) // String Value + strVal1, err := cfgFld.Value[0].ParseDataProvider(eeR) // String Value if err != nil { return "", err } @@ -338,7 +336,7 @@ func (eeR *EventExporterRequest) ParseField( return "", fmt.Errorf("invalid value <%s> to %s", strVal1, utils.MetaValueExponent) } - strVal2, err := cfgFld.Value[1].ParseDataProvider(eeR.dynamicProvider) // String Exponent + strVal2, err := cfgFld.Value[1].ParseDataProvider(eeR) // String Exponent if err != nil { return "", err } @@ -349,7 +347,7 @@ func (eeR *EventExporterRequest) ParseField( out = strconv.FormatFloat(utils.Round(val*math.Pow10(exp), config.CgrConfig().GeneralCfg().RoundingDecimals, utils.ROUNDING_MIDDLE), 'f', -1, 64) case utils.MetaUnixTimestamp: - val, err := cfgFld.Value.ParseDataProvider(eeR.dynamicProvider) + val, err := cfgFld.Value.ParseDataProvider(eeR) if err != nil { return nil, err } diff --git a/utils/consts.go b/utils/consts.go index aef483284..fac878c57 100755 --- a/utils/consts.go +++ b/utils/consts.go @@ -642,6 +642,12 @@ const ( AttrValueSep = "=" ANDSep = "&" PipeSep = "|" + RSRConstSep = "`" + RSRConstChar = '`' + RSRDataConverterPrefix = "{*" + RSRDataConverterSufix = "}" + RSRDynStartChar = '<' + RSRDynEndChar = '>' MetaApp = "*app" MetaAppID = "*appid" MetaCmd = "*cmd" diff --git a/utils/dynamicdataprovider.go b/utils/dynamicdataprovider.go deleted file mode 100644 index 0de7c0e15..000000000 --- a/utils/dynamicdataprovider.go +++ /dev/null @@ -1,210 +0,0 @@ -/* -Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments -Copyright (C) ITsysCOM GmbH - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see -*/ - -package utils - -import ( - "strings" -) - -// NewDynamicDataProvider constructs a dynamic data provider -func NewDynamicDataProvider(dp DataProvider) *DynamicDataProvider { - return &DynamicDataProvider{ - DataProvider: dp, - cache: make(map[string]interface{}), - } -} - -// DynamicDataProvider is a data source from multiple formats -type DynamicDataProvider struct { - DataProvider - cache map[string]interface{} -} - -// FieldAsInterface to overwrite the FieldAsInterface function from the given DataProvider -func (ddp *DynamicDataProvider) FieldAsInterface(fldPath []string) (out interface{}, err error) { - path := strings.Join(fldPath, NestingSep) // join the path so we can check it in cache and parse it more easy - if val, has := ddp.cache[path]; has { // check if we have the path in cache - return val, nil - } - var newPath string - if newPath, err = ddp.processFieldPath(path); err != nil { // process the path - return - } - if newPath == EmptyString { // no new path means no dynamic path so just take the value from the data provider - return ddp.DataProvider.FieldAsInterface(fldPath) - } - // split the new path and get that field - if out, err = ddp.DataProvider.FieldAsInterface(strings.Split(newPath, NestingSep)); err != nil { - return - } - // if no error save in cache the path - ddp.cache[path] = out - return -} - -// GetFullFieldPath returns the full path for the -func (ddp *DynamicDataProvider) GetFullFieldPath(fldPath string) (fpath *FullPath, err error) { - var newPath string - if newPath, err = ddp.processFieldPathForSet(fldPath); err != nil || newPath == EmptyString { - return - } - fpath = &FullPath{ - PathItems: NewPathItems(strings.Split(newPath, NestingSep)), - Path: newPath, - } - - return -} - -// FieldAsString returns the value from path as string -func (ddp DynamicDataProvider) FieldAsString(fldPath []string) (str string, err error) { - var val interface{} - if val, err = ddp.FieldAsInterface(fldPath); err != nil { - return - } - return IfaceAsString(val), nil -} - -// does the same thing as ... but replaces [ with . if the value between [] is dynamic -func (ddp *DynamicDataProvider) processFieldPathForSet(fldPath string) (newPath string, err error) { - idx := strings.Index(fldPath, IdxStart) - if idx == -1 { - return // no proccessing requred - } - var hasDyn bool // to be able to determine if the path has selector - newPath = fldPath[:idx] // add the first path of the path without the "[" - for idx != -1 { // stop when we do not find any "[" - fldPath = fldPath[idx+1:] // move the path to the begining of the index - nextBeginIdx := strings.Index(fldPath, IdxStart) // get the next "[" if any - nextEndIdx := strings.Index(fldPath, IdxEnd) // get the next "]" if any - if nextEndIdx == -1 { // no end index found so return error - err = ErrWrongPath - newPath = EmptyString - return - } - - // parse the rest of the field path until we match the [ ] - bIdx, eIdx := nextBeginIdx, nextEndIdx - for nextBeginIdx != -1 && nextBeginIdx < nextEndIdx { // do this until no new [ is found or the next begining [ is after the end ] - nextBeginIdx = strings.Index(fldPath[bIdx+1:], IdxStart) // get the next "[" if any - nextEndIdx = strings.Index(fldPath[eIdx+1:], IdxEnd) // get the next "]" if any - if nextEndIdx == -1 { // no end index found so return error - err = ErrWrongPath - newPath = EmptyString - return - } - if nextBeginIdx == -1 { // if no index found do not increment but replace it - bIdx = -1 - } else { - bIdx += nextBeginIdx + 1 - } - // increment the indexes - eIdx += nextEndIdx + 1 - } - var val string - var isDyn bool - for _, path := range strings.Split(fldPath[:eIdx], PipeSep) { // proccess the found path - var iface interface{} - if strings.HasPrefix(path, DynamicDataPrefix) { - isDyn = true - path2 := strings.TrimPrefix(path, DynamicDataPrefix) - if iface, err = ddp.FieldAsInterface(strings.Split(path2, NestingSep)); err != nil { - newPath = EmptyString - return - } - val += IfaceAsString(iface) // compose the value - } else { - - val += IfaceAsString(path) // compose the value - } - } - if isDyn { - hasDyn = true - val = NestingSep + val - } else { - val = IdxStart + val + IdxEnd - } - - if bIdx == -1 { // if is the last ocurence add the rest of the path and exit - newPath += val + fldPath[eIdx+1:] - } else { - // else just add until the next [ - newPath += val + fldPath[eIdx+1:bIdx] - } - idx = bIdx - } - if !hasDyn { // the path doesn't have dynamic selector - newPath = EmptyString - } - return -} - -func (ddp *DynamicDataProvider) processFieldPath(fldPath string) (newPath string, err error) { - idx := strings.Index(fldPath, IdxStart) - if idx == -1 { - return // no proccessing requred - } - newPath = fldPath[:idx+1] // add the first path of the path with the "[" included - for idx != -1 { // stop when we do not find any "[" - fldPath = fldPath[idx+1:] // move the path to the begining of the index - nextBeginIdx := strings.Index(fldPath, IdxStart) // get the next "[" if any - nextEndIdx := strings.Index(fldPath, IdxEnd) // get the next "]" if any - if nextEndIdx == -1 { // no end index found so return error - err = ErrWrongPath - newPath = EmptyString - return - } - - // parse the rest of the field path until we match the [ ] - bIdx, eIdx := nextBeginIdx, nextEndIdx - for nextBeginIdx != -1 && nextBeginIdx < nextEndIdx { // do this until no new [ is found or the next begining [ is after the end ] - nextBeginIdx = strings.Index(fldPath[bIdx+1:], IdxStart) // get the next "[" if any - nextEndIdx = strings.Index(fldPath[eIdx+1:], IdxEnd) // get the next "]" if any - if nextEndIdx == -1 { // no end index found so return error - err = ErrWrongPath - newPath = EmptyString - return - } - if nextBeginIdx == -1 { // if no index found do not increment but replace it - bIdx = -1 - } else { - bIdx += nextBeginIdx + 1 - } - // increment the indexes - eIdx += nextEndIdx + 1 - } - var val string - for _, path := range strings.Split(fldPath[:eIdx], PipeSep) { // proccess the found path - var iface interface{} - if iface, err = DPDynamicInterface(path, ddp); err != nil { - newPath = EmptyString - return - } - val += IfaceAsString(iface) // compose the value - } - if bIdx == -1 { // if is the last ocurence add the rest of the path and exit - newPath += val + fldPath[eIdx:] - } else { - // else just add until the next [ - newPath += val + fldPath[eIdx:bIdx+1] - } - idx = bIdx - } - return -} diff --git a/utils/dynamicdataprovider_test.go b/utils/dynamicdataprovider_test.go deleted file mode 100644 index bf3129964..000000000 --- a/utils/dynamicdataprovider_test.go +++ /dev/null @@ -1,254 +0,0 @@ -/* -Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments -Copyright (C) ITsysCOM GmbH - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see -*/ -package utils - -import ( - "strings" - "testing" -) - -func TestDynamicDataProviderFieldAsInterface(t *testing.T) { - dp := MapStorage{ - MetaCgrep: MapStorage{ - "Stir": MapStorage{ - "CHRG_ROUTE1_END": "Identity1", - "CHRG_ROUTE2_END": "Identity2", - "CHRG_ROUTE3_END": "Identity3", - "CHRG_ROUTE4_END": "Identity4", - }, - "Routes": MapStorage{ - "SortedRoutes": []MapStorage{ - {"ID": "ROUTE1"}, - {"ID": "ROUTE2"}, - {"ID": "ROUTE3"}, - {"ID": "ROUTE4"}, - }, - }, - "BestRoute": 0, - }, - } - ddp := NewDynamicDataProvider(dp) - path := "*cgrep.Stir[CHRG_|~*cgrep.Routes.SortedRoutes[~*cgrep.BestRoute].ID|_END]" - out, err := ddp.FieldAsInterface(strings.Split(path, NestingSep)) - if err != nil { - t.Fatal(err) - } - expected := "Identity1" - if out != expected { - t.Errorf("Expected: %q,received %q", expected, out) - } - path = "*cgrep.Stir[CHRG_|~*cgrep.Routes.SortedRoutes[~*cgrep.BestRoute].ID|_END" - _, err = ddp.FieldAsInterface(strings.Split(path, NestingSep)) - if err != ErrWrongPath { - t.Errorf("Expected error %s received %v", ErrWrongPath, err) - } -} - -func TestDynamicDataProviderFieldAsInterface2(t *testing.T) { - dp := MapStorage{ - MetaCgrep: MapStorage{ - "Stir": map[string]interface{}{ - "CHRG_ROUTE1_END": "Identity1", - "CHRG_ROUTE2_END": "Identity2", - "CHRG_ROUTE3_END": "Identity3", - "CHRG_ROUTE4_END": "Identity4", - }, - "Routes": map[string]interface{}{ - "SortedRoutes": []map[string]interface{}{ - {"ID": "ROUTE1"}, - {"ID": "ROUTE2"}, - {"ID": "ROUTE3"}, - {"ID": "ROUTE4"}, - }, - }, - "BestRoute": 0, - }, - } - ddp := NewDynamicDataProvider(dp) - path := "*cgrep.Stir[CHRG_|~*cgrep.Routes.SortedRoutes[~*cgrep.BestRoute].ID|_END]" - out, err := ddp.FieldAsInterface(strings.Split(path, NestingSep)) - if err != nil { - t.Fatal(err) - } - expected := "Identity1" - if out != expected { - t.Errorf("Expected: %q,received %q", expected, out) - } - path = "*cgrep.Stir[CHRG_|~*cgrep.Routes.SortedRoutes[~*cgrep.BestRoute].ID|_END" - _, err = ddp.FieldAsInterface(strings.Split(path, NestingSep)) - if err != ErrWrongPath { - t.Errorf("Expected error %s received %v", ErrWrongPath, err) - } -} - -func TestDynamicDataProviderProccesFieldPath2(t *testing.T) { - dp := MapStorage{ - MetaCgrep: MapStorage{ - "Stir": MapStorage{ - "CHRG_ROUTE1_END": "Identity1", - "CHRG_ROUTE2_END": "Identity2", - "CHRG_ROUTE3_END": "Identity3", - "CHRG_ROUTE4_END": "Identity4", - }, - "Routes": MapStorage{ - "SortedRoutes": []MapStorage{ - {"ID": "ROUTE1"}, - {"ID": "ROUTE2"}, - {"ID": "ROUTE3"}, - {"ID": "ROUTE4"}, - }, - }, - "BestRoute": 0, - }, - } - ddp := NewDynamicDataProvider(dp) - newpath, err := ddp.processFieldPathForSet("~*cgrep.Stir[CHRG_|~*cgrep.Routes.SortedRoutes[1].ID|_END].Something[CHRG_|~*cgrep.Routes.SortedRoutes[~*cgrep.BestRoute].ID|_END]") - if err != nil { - t.Fatal(err) - } - expectedPath := "~*cgrep.Stir.CHRG_ROUTE2_END.Something.CHRG_ROUTE1_END" - if newpath != expectedPath { - t.Errorf("Expected: %q,received %q", expectedPath, newpath) - } - _, err = ddp.processFieldPathForSet("~*cgrep.Stir[CHRG_|~*cgrep.Routes.SortedRoutes[1].ID|_END].Something[CHRG_|~*cgrep.Routes.SortedRoutes[~*cgrep.BestRoute].ID|_END") - if err != ErrWrongPath { - t.Errorf("Expected error %s received %v", ErrWrongPath, err) - } - - _, err = ddp.processFieldPathForSet("~*cgrep.Stir[CHRG_") - if err != ErrWrongPath { - t.Errorf("Expected error %s received %v", ErrWrongPath, err) - } - - _, err = ddp.processFieldPathForSet("~*cgrep.Stir[CHRG_|~*cgrep.Routes.SortedRoutes[1].ID2|_END]") - if err != ErrNotFound { - t.Errorf("Expected error %s received %v", ErrNotFound, err) - } - newpath, err = ddp.processFieldPathForSet("~*cgrep.Stir[1]") - if err != nil { - t.Fatal(err) - } - if newpath != EmptyString { - t.Errorf("Expected: %q,received %q", EmptyString, newpath) - } -} - -func TestDynamicDataProviderFieldAsString(t *testing.T) { - dp := MapStorage{ - MetaCgrep: MapStorage{ - "Stir": map[string]interface{}{ - "CHRG_ROUTE1_END": "Identity1", - "CHRG_ROUTE2_END": "Identity2", - "CHRG_ROUTE3_END": "Identity3", - "CHRG_ROUTE4_END": "Identity4", - }, - "Routes": map[string]interface{}{ - "SortedRoutes": []map[string]interface{}{ - {"ID": "ROUTE1"}, - {"ID": "ROUTE2"}, - {"ID": "ROUTE3"}, - {"ID": "ROUTE4"}, - }, - }, - "BestRoute": 0, - }, - } - ddp := NewDynamicDataProvider(dp) - path := "*cgrep.Stir[CHRG_|~*cgrep.Routes.SortedRoutes[~*cgrep.BestRoute].ID|_END]" - out, err := ddp.FieldAsString(strings.Split(path, NestingSep)) - if err != nil { - t.Fatal(err) - } - expected := "Identity1" - if out != expected { - t.Errorf("Expected: %q,received %q", expected, out) - } - path = "*cgrep.Stir[CHRG_|~*cgrep.Routes.SortedRoutes[~*cgrep.BestRoute].ID|_END" - _, err = ddp.FieldAsString(strings.Split(path, NestingSep)) - if err != ErrWrongPath { - t.Errorf("Expected error %s received %v", ErrWrongPath, err) - } -} - -func TestDynamicDataProviderGetFullFieldPath(t *testing.T) { - dp := MapStorage{ - MetaCgrep: MapStorage{ - "Stir": MapStorage{ - "CHRG_ROUTE1_END": "Identity1", - "CHRG_ROUTE2_END": "Identity2", - "CHRG_ROUTE3_END": "Identity3", - "CHRG_ROUTE4_END": "Identity4", - }, - "Routes": MapStorage{ - "SortedRoutes": []MapStorage{ - {"ID": "ROUTE1"}, - {"ID": "ROUTE2"}, - {"ID": "ROUTE3"}, - {"ID": "ROUTE4"}, - }, - }, - "BestRoute": 0, - }, - } - ddp := NewDynamicDataProvider(dp) - newpath, err := ddp.GetFullFieldPath("~*cgrep.Stir[CHRG_|~*cgrep.Routes.SortedRoutes[1].ID|_END].Something[CHRG_|~*cgrep.Routes.SortedRoutes[~*cgrep.BestRoute].ID|_END]") - if err != nil { - t.Fatal(err) - } - expectedPath := "~*cgrep.Stir.CHRG_ROUTE2_END.Something.CHRG_ROUTE1_END" - if newpath.Path != expectedPath { - t.Errorf("Expected: %q,received %q", expectedPath, newpath) - } - _, err = ddp.GetFullFieldPath("~*cgrep.Stir[CHRG_|~*cgrep.Routes.SortedRoutes[1].ID|_END].Something[CHRG_|~*cgrep.Routes.SortedRoutes[~*cgrep.BestRoute].ID|_END") - if err != ErrWrongPath { - t.Errorf("Expected error %s received %v", ErrWrongPath, err) - } - - _, err = ddp.GetFullFieldPath("~*cgrep.Stir[CHRG_") - if err != ErrWrongPath { - t.Errorf("Expected error %s received %v", ErrWrongPath, err) - } - - _, err = ddp.GetFullFieldPath("~*cgrep.Stir[CHRG_|~*cgrep.Routes.SortedRoutes[1].ID2|_END]") - if err != ErrNotFound { - t.Errorf("Expected error %s received %v", ErrNotFound, err) - } - newpath, err = ddp.GetFullFieldPath("~*cgrep.Stir[1]") - if err != nil { - t.Fatal(err) - } - if newpath != nil { - t.Errorf("Expected: %v,received %q", nil, newpath) - } - - newpath, err = ddp.GetFullFieldPath("~*cgrep.Stir") - if err != nil { - t.Fatal(err) - } - if newpath != nil { - t.Errorf("Expected: %v,received %q", nil, newpath) - } - - newpath, err = ddp.GetFullFieldPath("*cgrep.Stir[CHRG_|~*cgrep.Routes.SortedRoutes[~*cgrep.BestRoute].ID|_END]") - if err != nil { - t.Fatal(err) - } - if newpath == nil { - t.Errorf("Expected: %v,received %q", nil, newpath) - } -} diff --git a/utils/dynamicfieldpath.go b/utils/dynamicfieldpath.go new file mode 100644 index 000000000..b88d4047d --- /dev/null +++ b/utils/dynamicfieldpath.go @@ -0,0 +1,91 @@ +/* +Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments +Copyright (C) ITsysCOM GmbH + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*/ + +package utils + +import ( + "strings" +) + +// GetFullFieldPath returns the full path for the +func GetFullFieldPath(fldPath string, dP DataProvider) (fpath *FullPath, err error) { + var newPath string + if newPath, err = processFieldPath(fldPath, dP); err != nil || newPath == EmptyString { + return + } + fpath = &FullPath{ + PathItems: NewPathItems(strings.Split(newPath, NestingSep)), + Path: newPath, + } + + return +} + +// replaces the dynamic path between <> +func processFieldPath(fldPath string, dP DataProvider) (newPath string, err error) { + idx := strings.IndexByte(fldPath, RSRDynStartChar) + if idx == -1 { + return // no proccessing requred + } + newPath = fldPath[:idx] // add the first path of the path without the "<" + for idx != -1 { // stop when we do not find any "<" + fldPath = fldPath[idx+1:] // move the path to the begining of the index + nextBeginIdx := strings.IndexByte(fldPath, RSRDynStartChar) // get the next "<" if any + nextEndIdx := strings.IndexByte(fldPath, RSRDynEndChar) // get the next ">" if any + if nextEndIdx == -1 { // no end index found so return error + err = ErrWrongPath + newPath = EmptyString + return + } + + // parse the rest of the field path until we match the [ ] + bIdx, eIdx := nextBeginIdx, nextEndIdx + for nextBeginIdx != -1 && nextBeginIdx < nextEndIdx { // do this until no new [ is found or the next begining [ is after the end ] + nextBeginIdx = strings.IndexByte(fldPath[bIdx+1:], RSRDynStartChar) // get the next "<" if any + nextEndIdx = strings.IndexByte(fldPath[eIdx+1:], RSRDynEndChar) // get the next ">" if any + if nextEndIdx == -1 { // no end index found so return error + err = ErrWrongPath + newPath = EmptyString + return + } + if nextBeginIdx == -1 { // if no index found do not increment but replace it + bIdx = -1 + } else { + bIdx += nextBeginIdx + 1 + } + // increment the indexes + eIdx += nextEndIdx + 1 + } + var val string + for _, path := range strings.Split(fldPath[:eIdx], PipeSep) { // proccess the found path + if val, err = DPDynamicString(path, dP); err != nil { + newPath = EmptyString + return + } + } + + if bIdx == -1 { // if is the last ocurence add the rest of the path and exit + newPath += val + fldPath[eIdx+1:] + } else { + // else just add until the next [ + newPath += val + fldPath[eIdx+1:bIdx] + } + idx = bIdx + } + return +} diff --git a/utils/dynamicfieldpath_test.go b/utils/dynamicfieldpath_test.go new file mode 100644 index 000000000..8ed873e05 --- /dev/null +++ b/utils/dynamicfieldpath_test.go @@ -0,0 +1,140 @@ +/* +Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments +Copyright (C) ITsysCOM GmbH + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*/ +package utils + +import ( + "testing" +) + +func TestDynamicDataProviderProccesFieldPath(t *testing.T) { + dp := MapStorage{ + MetaCgrep: MapStorage{ + "Stir": MapStorage{ + "CHRG_ROUTE1_END": "Identity1", + "CHRG_ROUTE2_END": "Identity2", + "CHRG_ROUTE3_END": "Identity3", + "CHRG_ROUTE4_END": "Identity4", + }, + "Routes": MapStorage{ + "SortedRoutes": []MapStorage{ + {"ID": "ROUTE1"}, + {"ID": "ROUTE2"}, + {"ID": "ROUTE3"}, + {"ID": "ROUTE4"}, + }, + }, + "BestRoute": 0, + }, + } + newpath, err := processFieldPath("~*cgrep.Stir[CHRG_|~*cgrep.Routes.SortedRoutes[1].ID|_END].Something[CHRG_|~*cgrep.Routes.SortedRoutes[~*cgrep.BestRoute].ID|_END]", dp) + if err != nil { + t.Fatal(err) + } + expectedPath := "~*cgrep.Stir.CHRG_ROUTE2_END.Something.CHRG_ROUTE1_END" + if newpath != expectedPath { + t.Errorf("Expected: %q,received %q", expectedPath, newpath) + } + _, err = processFieldPath("~*cgrep.Stir[CHRG_|~*cgrep.Routes.SortedRoutes[1].ID|_END].Something[CHRG_|~*cgrep.Routes.SortedRoutes[~*cgrep.BestRoute].ID|_END", dp) + if err != ErrWrongPath { + t.Errorf("Expected error %s received %v", ErrWrongPath, err) + } + + _, err = processFieldPath("~*cgrep.Stir[CHRG_", dp) + if err != ErrWrongPath { + t.Errorf("Expected error %s received %v", ErrWrongPath, err) + } + + _, err = processFieldPath("~*cgrep.Stir[CHRG_|~*cgrep.Routes.SortedRoutes[1].ID2|_END]", dp) + if err != ErrNotFound { + t.Errorf("Expected error %s received %v", ErrNotFound, err) + } + newpath, err = processFieldPath("~*cgrep.Stir[1]", dp) + if err != nil { + t.Fatal(err) + } + if newpath != EmptyString { + t.Errorf("Expected: %q,received %q", EmptyString, newpath) + } +} + +func TestDynamicDataProviderGetFullFieldPath(t *testing.T) { + dp := MapStorage{ + MetaCgrep: MapStorage{ + "Stir": MapStorage{ + "CHRG_ROUTE1_END": "Identity1", + "CHRG_ROUTE2_END": "Identity2", + "CHRG_ROUTE3_END": "Identity3", + "CHRG_ROUTE4_END": "Identity4", + }, + "Routes": MapStorage{ + "SortedRoutes": []MapStorage{ + {"ID": "ROUTE1"}, + {"ID": "ROUTE2"}, + {"ID": "ROUTE3"}, + {"ID": "ROUTE4"}, + }, + }, + "BestRoute": 0, + }, + } + newpath, err := GetFullFieldPath("~*cgrep.Stir[CHRG_|~*cgrep.Routes.SortedRoutes[1].ID|_END].Something[CHRG_|~*cgrep.Routes.SortedRoutes[~*cgrep.BestRoute].ID|_END]", dp) + if err != nil { + t.Fatal(err) + } + expectedPath := "~*cgrep.Stir.CHRG_ROUTE2_END.Something.CHRG_ROUTE1_END" + if newpath.Path != expectedPath { + t.Errorf("Expected: %q,received %q", expectedPath, newpath) + } + _, err = GetFullFieldPath("~*cgrep.Stir[CHRG_|~*cgrep.Routes.SortedRoutes[1].ID|_END].Something[CHRG_|~*cgrep.Routes.SortedRoutes[~*cgrep.BestRoute].ID|_END", dp) + if err != ErrWrongPath { + t.Errorf("Expected error %s received %v", ErrWrongPath, err) + } + + _, err = GetFullFieldPath("~*cgrep.Stir[CHRG_", dp) + if err != ErrWrongPath { + t.Errorf("Expected error %s received %v", ErrWrongPath, err) + } + + _, err = GetFullFieldPath("~*cgrep.Stir[CHRG_|~*cgrep.Routes.SortedRoutes[1].ID2|_END]", dp) + if err != ErrNotFound { + t.Errorf("Expected error %s received %v", ErrNotFound, err) + } + newpath, err = GetFullFieldPath("~*cgrep.Stir[1]", dp) + if err != nil { + t.Fatal(err) + } + if newpath != nil { + t.Errorf("Expected: %v,received %q", nil, newpath) + } + + newpath, err = GetFullFieldPath("~*cgrep.Stir", dp) + if err != nil { + t.Fatal(err) + } + if newpath != nil { + t.Errorf("Expected: %v,received %q", nil, newpath) + } + + newpath, err = GetFullFieldPath("*cgrep.Stir[CHRG_|~*cgrep.Routes.SortedRoutes[~*cgrep.BestRoute].ID|_END]", dp) + if err != nil { + t.Fatal(err) + } + if newpath == nil { + t.Errorf("Expected: %v,received %q", nil, newpath) + } +}