From cbea3ec6033667412f5fcf55a582f8e4bbf30c9d Mon Sep 17 00:00:00 2001 From: DanB Date: Tue, 1 Mar 2016 13:02:45 +0100 Subject: [PATCH] Diameter config template - adding flags option --- config/cfgcdrfield.go | 1 - config/config_defaults.go | 9 +++++---- config/config_json_test.go | 1 + config/daconfig.go | 7 +++++++ config/libconfig_json.go | 1 + 5 files changed, 14 insertions(+), 5 deletions(-) diff --git a/config/cfgcdrfield.go b/config/cfgcdrfield.go index 922115644..06b02e2d5 100644 --- a/config/cfgcdrfield.go +++ b/config/cfgcdrfield.go @@ -80,7 +80,6 @@ type CfgCdrField struct { Strip string Padding string Layout string - Flags utils.StringMap // Various flags to influence behavior Mandatory bool } diff --git a/config/config_defaults.go b/config/config_defaults.go index 930333429..0ef467e70 100644 --- a/config/config_defaults.go +++ b/config/config_defaults.go @@ -278,10 +278,11 @@ const CGRATES_CFG_JSON = ` "product_name": "CGRateS", // diameter Product-Name AVP used in replies "request_processors": [ { - "id": "*default", // formal identifier of this processor - "dry_run": false, // do not send the events to SMG, just log them - "publish_event": false, // if enabled, it will publish internal event to pubsub - "request_filter": "Subscription-Id>Subscription-Id-Type(0)", // filter requests processed by this processor + "id": "*default", // formal identifier of this processor + "dry_run": false, // do not send the events to SMG, just log them + "publish_event": false, // if enabled, it will publish internal event to pubsub + "request_filter": "Subscription-Id>Subscription-Id-Type(0)", // filter requests processed by this processor + "flags": [], // flags to influence processing behavior "continue_on_success": false, // continue to the next template if executed "ccr_fields":[ // import content_fields template, tag will match internally CDR field, in case of .csv value will be represented by index of the field value {"tag": "TOR", "field_id": "ToR", "type": "*composed", "value": "^*voice", "mandatory": true}, diff --git a/config/config_json_test.go b/config/config_json_test.go index 59637b796..e7ac7e927 100644 --- a/config/config_json_test.go +++ b/config/config_json_test.go @@ -441,6 +441,7 @@ func TestDiameterAgentJsonCfg(t *testing.T) { Dry_run: utils.BoolPointer(false), Publish_event: utils.BoolPointer(false), Request_filter: utils.StringPointer("Subscription-Id>Subscription-Id-Type(0)"), + Flags: utils.StringSlicePointer([]string{}), Continue_on_success: utils.BoolPointer(false), CCR_fields: &[]*CdrFieldJsonCfg{ &CdrFieldJsonCfg{Tag: utils.StringPointer("TOR"), Field_id: utils.StringPointer(utils.TOR), Type: utils.StringPointer(utils.META_COMPOSED), diff --git a/config/daconfig.go b/config/daconfig.go index b56fd73a3..ae92905b5 100644 --- a/config/daconfig.go +++ b/config/daconfig.go @@ -108,6 +108,7 @@ type DARequestProcessor struct { DryRun bool PublishEvent bool RequestFilter utils.RSRFields + Flags utils.StringMap // Various flags to influence behavior ContinueOnSuccess bool CCRFields []*CfgCdrField CCAFields []*CfgCdrField @@ -132,6 +133,12 @@ func (self *DARequestProcessor) loadFromJsonCfg(jsnCfg *DARequestProcessorJsnCfg return err } } + if jsnCfg.Flags != nil { + self.Flags = utils.StringMapFromSlice(*jsnCfg.Flags) + } + if jsnCfg.Continue_on_success != nil { + self.ContinueOnSuccess = *jsnCfg.Continue_on_success + } if jsnCfg.CCR_fields != nil { if self.CCRFields, err = CfgCdrFieldsFromCdrFieldsJsonCfg(*jsnCfg.CCR_fields); err != nil { return err diff --git a/config/libconfig_json.go b/config/libconfig_json.go index 3facc6945..7ab6b093a 100644 --- a/config/libconfig_json.go +++ b/config/libconfig_json.go @@ -263,6 +263,7 @@ type DARequestProcessorJsnCfg struct { Dry_run *bool Publish_event *bool Request_filter *string + Flags *[]string Continue_on_success *bool CCR_fields *[]*CdrFieldJsonCfg CCA_fields *[]*CdrFieldJsonCfg