Refactor API tags in swagger.yaml to use shortened prefixes

- Updated tags from 'network_data' to 'ne_data' for consistency and brevity.
- Changed 'network_element' to 'ne' across various endpoints for improved readability.
- Adjusted related descriptions in the tags section to reflect the new naming conventions.
This commit is contained in:
TsMask
2025-08-21 14:30:09 +08:00
parent a72aa00f89
commit 45e226ce1a
171 changed files with 1177 additions and 741 deletions

View File

@@ -0,0 +1,24 @@
package model
// NeConfig 网元_参数配置可用属性值
type NeConfig struct {
ID int64 `json:"id" gorm:"column:id;primaryKey;autoIncrement"`
NeType string `json:"neType" binding:"required" gorm:"column:ne_type"` // 网元类型
ParamName string `json:"paramName" binding:"required" gorm:"column:param_name"` // 参数名
ParamDisplay string `json:"paramDisplay" binding:"required" gorm:"column:param_display"` // 参数显示名
ParamType string `json:"paramType" gorm:"column:param_type"` // 参数类型 list列表单层 array数组多层
ParamJson string `json:"-" gorm:"column:param_json"` // accesss属性控制只读read-only/read/ro 读写read-write
ParamSort int64 `json:"paramSort" gorm:"column:param_sort"` // 参数排序
ParamPerms string `json:"paramPerms" gorm:"column:param_perms"` // 操作权限 get只读 put可编辑 delete可删除 post可新增
Visible string `json:"visible" gorm:"column:visible"` // 可见性 默认public 单独网元self
UpdateTime int64 `json:"updateTime" gorm:"column:update_time"` // 更新时间
// ====== 非数据库字段属性 ======
ParamData []map[string]any `json:"paramData,omitempty" binding:"required" gorm:"-"` // 与ParamJSONStr配合转换
}
// TableName 表名称
func (*NeConfig) TableName() string {
return "ne_config"
}

View File

@@ -0,0 +1,23 @@
package model
// NeConfigBackup 网元配置文件备份记录 ne_config_backup
type NeConfigBackup struct {
ID int64 `json:"id" gorm:"column:id;primaryKey;autoIncrement"`
NeType string `json:"neType" gorm:"column:ne_type"` // 网元类型
NeId string `json:"neId" gorm:"column:ne_id"` // 网元ID
Name string `json:"name" gorm:"column:name"` // 压缩包名称
Path string `json:"path" gorm:"column:path"` // 压缩包位置
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"` // 更新时间
// ====== 非数据库字段属性 ======
}
// TableName 表名称
func (*NeConfigBackup) TableName() string {
return "ne_config_backup"
}

View File

@@ -0,0 +1,41 @@
package model
import "encoding/json"
// NeHost 网元主机表 ne_host
type NeHost struct {
ID int64 `json:"id" gorm:"column:id;primaryKey;autoIncrement"`
HostType string `json:"hostType" gorm:"column:host_type" binding:"oneof=ssh telnet redis"` // 连接类型 ssh telnet redis
GroupID string `json:"groupId" gorm:"column:group_id"` // 分组0默认 1网元 2系统
Title string `json:"title" gorm:"column:title"` // 标题名称
Addr string `json:"addr" gorm:"column:addr" binding:"required"` // 主机地址
Port int64 `json:"port" gorm:"column:port" binding:"required,number,max=65535,min=1"` // 端口 22 4100 6379
User string `json:"user" gorm:"column:user" binding:"required"` // 认证用户名
AuthMode string `json:"authMode" gorm:"column:auth_mode" binding:"oneof=0 1 2"` // 认证模式0密码 1主机私钥 2已免密
Password string `json:"password" gorm:"column:password"` // 认证密码
PrivateKey string `json:"privateKey" gorm:"column:private_key"` // 认证私钥
PassPhrase string `json:"passPhrase" gorm:"column:pass_phrase"` // 认证私钥密码
DBName string `json:"dbName" gorm:"column:db_name"` // 数据库名称
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"` // 更新时间
}
// TableName 表名称
func (*NeHost) TableName() string {
return "ne_host"
}
// CopyTo 网元主机信息将josn同key名的结构体复制给另一个结构体
func (m *NeHost) CopyTo(to interface{}) error {
b, err := json.Marshal(m)
if err != nil {
return err
}
if err = json.Unmarshal(b, to); err != nil {
return err
}
return nil
}

View File

@@ -0,0 +1,20 @@
package model
// NeHostCmd 网元主机命令表 ne_host_cmd
type NeHostCmd struct {
ID int64 `json:"id" gorm:"column:id;primaryKey;autoIncrement"`
CmdType string `json:"cmdType" gorm:"column:cmd_type"` // 命令类型
GroupID string `json:"groupId" gorm:"column:group_id"` // 分组0默认 1快速命令
Title string `json:"title" gorm:"column:title" binding:"required"` // 标题名称
Command string `json:"command" gorm:"column:command" binding:"required"` // 命令字符串
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"` // 更新时间
}
// TableName 表名称
func (*NeHostCmd) TableName() string {
return "ne_host_cmd"
}

View File

@@ -0,0 +1,37 @@
package model
// NeInfo 网元信息对象 ne_info
type NeInfo struct {
ID int64 `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"` // 网元ID
RmUID string `json:"rmUid" gorm:"column:rm_uid"` // 网元资源唯一标识
NeName string `json:"neName" gorm:"column:ne_name"` // 网元名称
IP string `json:"ip" gorm:"column:ip" binding:"required"` // 网元服务IP
Port int64 `json:"port" gorm:"column:port" binding:"required,number,max=65535,min=1"` // 端口
PvFlag string `json:"pvFlag" gorm:"column:pv_flag" binding:"omitempty,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 int64 `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"
}

View File

@@ -0,0 +1,28 @@
package model
// NeLicense 网元授权激活信息 ne_license
type NeLicense struct {
ID int64 `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"` // 网元ID
ActivationRequestCode string `json:"activationRequestCode" gorm:"column:activation_request_code"` // 激活申请代码
LicensePath string `json:"licensePath" gorm:"column:license_path"` // 激活授权文件
Capability int64 `json:"capability" gorm:"column:capability"` // 容量
SerialNum string `json:"serialNum" gorm:"column:serial_num"` // 序列号
ExpiryDate string `json:"expiryDate" gorm:"column:expiry_date"` // 许可证到期日期
Status string `json:"status" gorm:"column:status"` // 状态 0无效 1有效
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"` // 更新时间
// ====== 非数据库字段属性 ======
Reload bool `json:"reload,omitempty" gorm:"-"` // 刷新重启网元
}
// TableName 表名称
func (*NeLicense) TableName() string {
return "ne_license"
}

View File

@@ -0,0 +1,23 @@
package model
// NeSoftware 网元软件包 ne_software
type NeSoftware struct {
ID int64 `json:"id" gorm:"column:id;primaryKey;autoIncrement"`
NeType string `json:"neType" gorm:"column:ne_type" binding:"required"` // 网元类型
Name string `json:"name" gorm:"column:name" binding:"required"` // 包名称
Path string `json:"path" gorm:"column:path"` // 包路径
Version string `json:"version" gorm:"column:version" binding:"required"` // 包版本
Description string `json:"description" gorm:"column:description"` // 包说明
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"` // 更新时间
// ====== 非数据库字段属性 ======
}
// TableName 表名称
func (*NeSoftware) TableName() string {
return "ne_software"
}

View File

@@ -0,0 +1,27 @@
package model
// NeVersion 网元版本信息 ne_version
type NeVersion struct {
ID int64 `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"` // 网元ID
Name string `json:"name" gorm:"column:name"` // 当前包名
Version string `json:"version" gorm:"column:version" binding:"required"` // 当前版本
Path string `json:"path" gorm:"column:path" binding:"required"` // 当前软件包
PreName string `json:"preName" gorm:"column:pre_name"` // 上一版本包名
PreVersion string `json:"preVersion" gorm:"column:pre_version"` // 上一版本
PrePath string `json:"prePath" gorm:"column:pre_path"` // 上一版本软件包
NewName string `json:"newName" gorm:"column:new_name"` // 新版本包名
NewVersion string `json:"newVersion" gorm:"column:new_version"` // 新版本
NewPath string `json:"newPath" gorm:"column:new_path"` // 新版本软件包
Status string `json:"status" gorm:"column:status"` // 当前状态 1当前版本 2上一版本 3有新版本
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"` // 更新时间
}
// TableName 表名称
func (*NeVersion) TableName() string {
return "ne_version"
}