DiameterAgent SMGeneric connection configuration

This commit is contained in:
DanB
2015-11-14 13:19:41 +01:00
parent 2be5e726ee
commit 72a51fe1d9
4 changed files with 16 additions and 4 deletions

View File

@@ -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
}

View File

@@ -262,7 +262,8 @@ const CGRATES_CFG_JSON = `
"diameter_agent": {
"enabled": false, // enables the diameter agent: <true|false>
"listen": "127.0.0.1:3868", // address where to listen for diameter requests <x.y.z.y:1234>
"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

View File

@@ -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"),

View File

@@ -27,6 +27,7 @@ import (
type DiameterAgentCfg struct {
Enabled bool // enables the diameter agent: <true|false>
Listen string // address where to listen for diameter requests <x.y.z.y:1234>
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
}