Files
be.ems/src/modules/network_element/model/ne_info.go
TsMask 8cd86a62d6 feat: 网元参数配置数据支持版本区分功能
feat(database): add ne_version and schema columns to ne_info table

feat(database): update ne_info table structure in upgrade script

fix(ne_config): handle id as number in Info and Add methods

fix(ne_config): validate neId and fetch neInfo in ListByNeType and DataAdd methods

fix(ne_info): extract version from ServerState in Add and Edit methods

refactor(ne_config): update NeConfig model to include NeVersion

refactor(ne_info): add NeVersion and Schema fields to NeInfo model

test(ne_config): enhance test cases to include version parsing and saving

refactor(ne_config): improve cache handling and querying by NeType and NeVersion

fix(ne_info): update NeInfo version during status change
2025-10-17 10:17:07 +08:00

40 lines
2.0 KiB
Go

package model
// NeInfo 网元信息对象 ne_info
type NeInfo struct {
ID string `json:"id" gorm:"column:id;primaryKey;autoIncrement"`
NeType string `json:"neType" gorm:"column:ne_type" binding:"required"`
NeId string `json:"neId" gorm:"column:ne_id" binding:"required"`
RmUID string `json:"rmUid" gorm:"column:rm_uid"`
NeName string `json:"neName" gorm:"column:ne_name"`
NeVersion string `json:"neVersion" gorm:"column:ne_version"` // 网元版本
Schema string `json:"schema" gorm:"column:schema"` // 网元模式 http/https
IP string `json:"ip" gorm:"column:ip" binding:"required"`
Port int64 `json:"port" gorm:"column:port" binding:"required,number,max=65535,min=1"`
PvFlag string `json:"pvFlag" gorm:"column:pv_flag" binding:"oneof=PNF VNF"` // ''PNF'',''VNF''
Province string `json:"province" gorm:"column:province"` // 省份地域
VendorName string `json:"vendorName" gorm:"column:vendor_name"`
Dn string `json:"dn" gorm:"column:dn"`
NeAddress string `json:"neAddress" gorm:"column:ne_address"` // MAC地址
HostIDs string `json:"hostIds" gorm:"column:host_ids"` // 网元主机ID组 数据格式(ssh,telnet) UDM(ssh,telnet,redis) UPF(ssh,telnet,telnet)
Status string `json:"status" gorm:"column:status"` // 0离线 1在线 2配置待下发 3备用模式
Remark string `json:"remark" gorm:"column:remark"` // 备注
CreateBy string `json:"createBy" gorm:"column:create_by"` // 创建者
CreateTime int64 `json:"createTime" gorm:"column:create_time"` // 创建时间
UpdateBy string `json:"updateBy" gorm:"column:update_by"` // 更新者
UpdateTime int64 `json:"updateTime" gorm:"column:update_time"` // 更新时间
// ====== 非数据库字段属性 ======
// 服务状态
ServerState map[string]any `json:"serverState,omitempty" gorm:"-"`
// 主机对象组
Hosts []NeHost `json:"hosts,omitempty" gorm:"-"`
}
// TableName 表名称
func (*NeInfo) TableName() string {
return "ne_info"
}