feat: 网元OAM配置文件默认格式数据

This commit is contained in:
TsMask
2024-04-29 18:21:42 +08:00
parent 93a4a40374
commit 10ac5629a8

View File

@@ -486,6 +486,52 @@ func (r *NeInfoImpl) NeConfigFileWirte(neInfo model.NeInfo, filePath, fileType s
return nil
}
// neConfOAMData 网元OAM配置文件默认格式数据
func (r *NeInfoImpl) neConfOAMData() map[string]any {
return map[string]any{
"httpManageCfg": map[string]any{
"ipType": "ipv4",
// 必改
"ipv4": "172.60.5.2",
"ipv6": "",
"port": 33030,
"scheme": "http",
},
"oamConfig": map[string]any{
"enable": true,
"ipType": "ipv4",
// 必改
"ipv4": "172.60.5.1",
"ipv6": "",
"port": 33030,
"scheme": "http",
// 必改
"neConfig": map[string]any{
"neId": "001",
"rmUid": "4400HX1XXX001",
"neName": "XXX_001",
"dn": "-",
"vendorName": "GD",
"province": "-",
"pvFlag": "PNF",
},
},
"snmpConfig": map[string]any{
"enable": false,
"ipType": "ipv4",
// 必改
"ipv4": "172.60.5.2",
"ipv6": "",
"port": 4957,
},
"kpiConfig": map[string]any{
"enable": true,
// 必改
"timer": 60,
},
}
}
// NeConfOAMRead 网元OAM配置文件读取
func (r *NeInfoImpl) NeConfOAMRead(neType, neId string) (map[string]any, error) {
neTypeLower := strings.ToLower(neType)
@@ -499,8 +545,12 @@ func (r *NeInfoImpl) NeConfOAMRead(neType, neId string) (map[string]any, error)
// 读取文件内容
bytes, err := os.ReadFile(localFilePath)
if err != nil {
logger.Warnf("NeConfOAMRead ReadFile => %s", err.Error())
return nil, fmt.Errorf("read file error")
// logger.Warnf("NeConfOAMRead ReadFile => %s", err.Error())
// return nil, fmt.Errorf("read file error")
// 无保留文件时返回默认文件数据
oamData := r.neConfOAMData()
r.NeConfOAMWirte(neType, neId, oamData, false)
return oamData, nil
}
content := string(bytes)