feat: support add redis queue with alarm/nbi_pm/nbi_kpi, support generate all nbi pm data

This commit is contained in:
simon
2025-08-11 17:10:13 +08:00
parent d4923d008c
commit 46ccc0ab83
26 changed files with 14059 additions and 41 deletions

View File

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

View File

@@ -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) {

View 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)
}