feat: support add redis queue with alarm/nbi_pm/nbi_kpi, support generate all nbi pm data
This commit is contained in:
@@ -29,3 +29,11 @@ func LoadAlarmRelationRules(path string) error {
|
||||
}
|
||||
return yaml.Unmarshal(data, &RelationRules)
|
||||
}
|
||||
|
||||
func LoadNbiRelationRulesConfig(path string) error {
|
||||
data, err := os.ReadFile(path)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return yaml.Unmarshal(data, &RelationRules)
|
||||
}
|
||||
|
||||
@@ -126,6 +126,8 @@ type YamlConfig struct {
|
||||
Enabled bool `yaml:"enabled"`
|
||||
File string `yaml:"file"`
|
||||
} `yaml:"testConfig"`
|
||||
|
||||
NbiConfig NbiConfig `yaml:"nbiConfig"`
|
||||
}
|
||||
|
||||
type RestParam struct {
|
||||
@@ -187,6 +189,18 @@ type AlarmConfig struct {
|
||||
} `yaml:"relatedRules"`
|
||||
}
|
||||
|
||||
type NbiConfig struct {
|
||||
Enabled bool `yaml:"enabled"`
|
||||
PmConfig struct {
|
||||
Enabled bool `yaml:"enabled"`
|
||||
File string `yaml:"file"`
|
||||
} `yaml:"pmConfig"`
|
||||
RelationRules struct {
|
||||
Enabled bool `yaml:"enabled"`
|
||||
File string `yaml:"file"`
|
||||
} `yaml:"relationRules"`
|
||||
}
|
||||
|
||||
type MMLParam struct {
|
||||
Sleep int64 `yaml:"sleep"`
|
||||
DeadLine int64 `yaml:"deadLine"`
|
||||
@@ -280,6 +294,15 @@ func ReadConfig(configFile string) {
|
||||
if yamlConfig.Alarm.RelatedRules.Enabled {
|
||||
LoadAlarmRelationRules(yamlConfig.Alarm.RelatedRules.File)
|
||||
}
|
||||
|
||||
if yamlConfig.NbiConfig.Enabled {
|
||||
if yamlConfig.NbiConfig.PmConfig.Enabled {
|
||||
LoadNbiPmConfig(yamlConfig.NbiConfig.PmConfig.File)
|
||||
}
|
||||
if yamlConfig.NbiConfig.RelationRules.Enabled {
|
||||
LoadNbiRelationRulesConfig(yamlConfig.NbiConfig.RelationRules.File)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func ReadOriginalConfig(configFile string) {
|
||||
|
||||
28
lib/config/nbi_pm_config.go
Normal file
28
lib/config/nbi_pm_config.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
"gopkg.in/yaml.v2"
|
||||
)
|
||||
|
||||
type NbiPmConfig struct {
|
||||
SchemaPath string `yaml:"schemaPath"`
|
||||
RandomMin int `yaml:"randomMin"`
|
||||
RandomMax int `yaml:"randomMax"`
|
||||
MergeMode string `yaml:"mergeMode"` // MergeModeNone/MergeModeMerge/MergeModeSchema
|
||||
}
|
||||
|
||||
var nbiPmConfig NbiPmConfig
|
||||
|
||||
func GetNbiPmConfig() NbiPmConfig {
|
||||
return nbiPmConfig
|
||||
}
|
||||
|
||||
func LoadNbiPmConfig(path string) error {
|
||||
data, err := os.ReadFile(path)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return yaml.Unmarshal(data, &nbiPmConfig)
|
||||
}
|
||||
Reference in New Issue
Block a user