cm
This commit is contained in:
@@ -1541,7 +1541,7 @@ func XormInsertAlarmForwardLog(logData *AlarmForwardLog) (int64, error) {
|
||||
|
||||
type SystemLog struct {
|
||||
ID int `json:"-" xorm:"pk 'id' autoincr"`
|
||||
User string `json:"user" xorm:"user"`
|
||||
UserName string `json:"user_name" xorm:"user_name"`
|
||||
ProcessName string `json:"process_name" xorm:"process_name"`
|
||||
ProcessID int32 `json:"process_id" xorm:"process_id"`
|
||||
Operation string `json:"operation" xorm:"operation"`
|
||||
@@ -1624,21 +1624,21 @@ func XormUpdateNeLicense(neType, neID string, capcity int) (int64, error) {
|
||||
}
|
||||
|
||||
type NorthboundCm struct {
|
||||
ID int `json:"-" xorm:"pk 'id' autoincr"`
|
||||
Timestamp string `json:"timestamp" xorm:"timestamp"`
|
||||
TimeZone string `json:"timeZone" xorm:"time_zone"`
|
||||
VendorName string `json:"vendorName" xorm:"vendor_name"`
|
||||
NeType string `json:"neType" xorm:"ne_type"`
|
||||
CmVersion string `json:"cmVersion" xorm:"cm_version"`
|
||||
RmUID string `json:"rmUID" xorm:"rm_uid"`
|
||||
NeID string `json:"neID" xorm:"ne_id"`
|
||||
UserLabel string `json:"userLabel" xorm:"user_label"`
|
||||
ObjectType string `json:"objectType" xorm:"object_type"`
|
||||
PvFlag string `json:"pvFlag" xorm:"pv_flag"`
|
||||
VMID string `json:"vmID" xorm:"vm_id"`
|
||||
VnfInstanceID string `json:"vnf_instance_id"`
|
||||
ValueJSON interface{} `json:"valueJson" xorm:"value_json"`
|
||||
Status string `json:"status" xorm:"status"`
|
||||
ID int `json:"-" xorm:"pk '-' autoincr"`
|
||||
Timestamp string `json:"timestamp" xorm:"timestamp"`
|
||||
TimeZone string `json:"timeZone" xorm:"time_zone"`
|
||||
VendorName string `json:"vendorName" xorm:"vendor_name"`
|
||||
NeType string `json:"neType" xorm:"ne_type"`
|
||||
CmVersion string `json:"cmVersion" xorm:"cm_version"`
|
||||
RmUID string `json:"rmUID" xorm:"rm_uid"`
|
||||
NeID string `json:"neID" xorm:"ne_id"`
|
||||
UserLabel string `json:"userLabel" xorm:"user_label"`
|
||||
ObjectType string `json:"objectType" xorm:"object_type"`
|
||||
PvFlag string `json:"pvFlag" xorm:"pv_flag"`
|
||||
VMID string `json:"vmID" xorm:"vm_id"`
|
||||
VnfInstanceID string `json:"vnf_instance_id"`
|
||||
ValueJSON string `json:"valueJson" xorm:"value_json"`
|
||||
Status string `json:"status" xorm:"status"`
|
||||
}
|
||||
|
||||
func XormGetNorthboundCm(neType string, cmResults *[]NorthboundCm) error {
|
||||
@@ -1646,9 +1646,10 @@ func XormGetNorthboundCm(neType string, cmResults *[]NorthboundCm) error {
|
||||
|
||||
cmResult := new(NorthboundCm)
|
||||
rows, err := xEngine.Table("northbound_cm").
|
||||
Where("`ne_type` = ?", neType).
|
||||
Distinct("object_type").
|
||||
Where("`ne_type` = ?", neType).
|
||||
Desc("timestamp").
|
||||
Cols("*").
|
||||
Rows(cmResult)
|
||||
if err != nil {
|
||||
log.Error("Failed to get table northbound_cm:", err)
|
||||
@@ -1665,3 +1666,21 @@ func XormGetNorthboundCm(neType string, cmResults *[]NorthboundCm) error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func XormGetNorthboundCmLatestObject(neType, neID, objectType string) (*NorthboundCm, error) {
|
||||
log.Info("XormGetNorthboundCmLatestObject processing... ")
|
||||
|
||||
cmResult := new(NorthboundCm)
|
||||
_, err := xEngine.Table("northbound_cm").
|
||||
Where("`ne_type`=? and `ne_id`=? and `object_type`=?", neType, neID, objectType).
|
||||
Desc("timestamp").
|
||||
Cols("*").
|
||||
Limit(1).
|
||||
Get(cmResult)
|
||||
if err != nil {
|
||||
log.Error("Failed to get table northbound_cm:", err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return cmResult, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user