From 72a51fe1d9c3a338bf3afb6a516a618085207cc8 Mon Sep 17 00:00:00 2001 From: DanB Date: Sat, 14 Nov 2015 13:19:41 +0100 Subject: [PATCH] DiameterAgent SMGeneric connection configuration --- config/config.go | 6 ++++++ config/config_defaults.go | 3 ++- config/config_json_test.go | 7 ++++--- config/daconfig.go | 4 ++++ 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/config/config.go b/config/config.go index 26a3d51de..32c486591 100644 --- a/config/config.go +++ b/config/config.go @@ -378,6 +378,12 @@ func (self *CGRConfig) checkConfigSanity() error { return errors.New("CDRS not enabled but referenced by SM-OpenSIPS component") } } + // DAgent checks + if self.DiameterAgentCfg.Enabled { + if self.DiameterAgentCfg.SMGeneric == utils.INTERNAL && !self.SmGenericConfig.Enabled { + return errors.New("SMGeneric not enabled but referenced by DiameterAgent component") + } + } return nil } diff --git a/config/config_defaults.go b/config/config_defaults.go index f3471a1fe..77709da09 100644 --- a/config/config_defaults.go +++ b/config/config_defaults.go @@ -262,7 +262,8 @@ const CGRATES_CFG_JSON = ` "diameter_agent": { "enabled": false, // enables the diameter agent: "listen": "127.0.0.1:3868", // address where to listen for diameter requests - "timezone": "", // timezone for timestamps where not specified <""|UTC|Local|$IANA_TZ_DB> + "sm_generic": "internal", // Connection towards SMG component for session management + "timezone": "", // timezone for timestamps where not specified, empty for general defaults <""|UTC|Local|$IANA_TZ_DB> "request_processors": [ { "id": "*default", // Identifier of this processor diff --git a/config/config_json_test.go b/config/config_json_test.go index 4685ce464..03c7269d0 100644 --- a/config/config_json_test.go +++ b/config/config_json_test.go @@ -416,9 +416,10 @@ func TestSmOsipsJsonCfg(t *testing.T) { func TestDiameterAgentJsonCfg(t *testing.T) { eCfg := &DiameterAgentJsonCfg{ - Enabled: utils.BoolPointer(false), - Listen: utils.StringPointer("127.0.0.1:3868"), - Timezone: utils.StringPointer(""), + Enabled: utils.BoolPointer(false), + Listen: utils.StringPointer("127.0.0.1:3868"), + Sm_generic: utils.StringPointer("internal"), + Timezone: utils.StringPointer(""), Request_processors: &[]*DARequestProcessorJsnCfg{ &DARequestProcessorJsnCfg{ Id: utils.StringPointer("*default"), diff --git a/config/daconfig.go b/config/daconfig.go index 2c2691aba..61eb86d8b 100644 --- a/config/daconfig.go +++ b/config/daconfig.go @@ -27,6 +27,7 @@ import ( type DiameterAgentCfg struct { Enabled bool // enables the diameter agent: Listen string // address where to listen for diameter requests + SMGeneric string // connection towards SMG component Timezone string // timezone for timestamps where not specified <""|UTC|Local|$IANA_TZ_DB> RequestProcessors []*DARequestProcessor } @@ -41,6 +42,9 @@ func (self *DiameterAgentCfg) loadFromJsonCfg(jsnCfg *DiameterAgentJsonCfg) erro if jsnCfg.Listen != nil { self.Listen = *jsnCfg.Listen } + if jsnCfg.Sm_generic != nil { + self.SMGeneric = *jsnCfg.Sm_generic + } if jsnCfg.Timezone != nil { self.Timezone = *jsnCfg.Timezone }