cm
This commit is contained in:
@@ -10,6 +10,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
cmschema "ems.agt/crontask/cm/schema"
|
cmschema "ems.agt/crontask/cm/schema"
|
||||||
|
"ems.agt/lib/dborm"
|
||||||
"ems.agt/lib/global"
|
"ems.agt/lib/global"
|
||||||
"ems.agt/lib/log"
|
"ems.agt/lib/log"
|
||||||
|
|
||||||
@@ -69,6 +70,9 @@ func (t *TaskFunc) GenNFXmlFile(neType string) error {
|
|||||||
|
|
||||||
resultMap, _ := t.ReadCmYaml(cmfile)
|
resultMap, _ := t.ReadCmYaml(cmfile)
|
||||||
|
|
||||||
|
var cmResults []dborm.NorthboundCm
|
||||||
|
err = dborm.XormGetNorthboundCm(neType, &cmResults)
|
||||||
|
|
||||||
ti := time.Now()
|
ti := time.Now()
|
||||||
timestamp := ti.Format("2006-01-02 15:04:05")
|
timestamp := ti.Format("2006-01-02 15:04:05")
|
||||||
timefile := ti.Format("20060102150405")
|
timefile := ti.Format("20060102150405")
|
||||||
|
|||||||
@@ -1622,3 +1622,46 @@ func XormUpdateNeLicense(neType, neID string, capcity int) (int64, error) {
|
|||||||
affected, err := res.RowsAffected()
|
affected, err := res.RowsAffected()
|
||||||
return affected, err
|
return affected, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func XormGetNorthboundCm(neType string, cmResults *[]NorthboundCm) error {
|
||||||
|
log.Info("XormGetNorthboundCm processing... ")
|
||||||
|
|
||||||
|
cmResult := new(NorthboundCm)
|
||||||
|
rows, err := xEngine.Table("northbound_cm").
|
||||||
|
Where("`ne_type` = ?", neType).
|
||||||
|
Distinct("object_type").
|
||||||
|
Desc("timestamp").
|
||||||
|
Rows(cmResult)
|
||||||
|
if err != nil {
|
||||||
|
log.Error("Failed to get table northbound_cm:", err)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer rows.Close()
|
||||||
|
for rows.Next() {
|
||||||
|
err := rows.Scan(cmResult)
|
||||||
|
if err != nil {
|
||||||
|
log.Error("Failed to get table northbound_cm:", err)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
*cmResults = append(*cmResults, *cmResult)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user