fix: nbi_cm replace northbound_cm

This commit is contained in:
2024-05-14 15:17:40 +08:00
parent 9f76d8241e
commit d782cfcc74
4 changed files with 10 additions and 10 deletions

View File

@@ -839,7 +839,7 @@
"end": "(Number of results = %d)\n\n" "end": "(Number of results = %d)\n\n"
} }
"northbound_cm": { "nbi_cm": {
"retFmt": "GetDB", "retFmt": "GetDB",
"retMsg": "RetCode = %d operation succeeded\n\n", "retMsg": "RetCode = %d operation succeeded\n\n",
"errMsg": "ErrorCode = %d operation failed: %s\n\n", "errMsg": "ErrorCode = %d operation failed: %s\n\n",

View File

@@ -211,18 +211,18 @@ func XormGetNorthboundPm(date string, index int, neType string, pms *[]Northboun
log.Debug("XormGetNorthboundPm processing... ") log.Debug("XormGetNorthboundPm processing... ")
pm := new(NorthboundPm) pm := new(NorthboundPm)
rows, err := dbClient.xEngine.Table("northbound_pm"). rows, err := dbClient.xEngine.Table("nbi_pm").
Where("`ne_type` = ? AND `date` = ? AND `index` = ?", neType, date, index). Where("`ne_type` = ? AND `date` = ? AND `index` = ?", neType, date, index).
Rows(pm) Rows(pm)
if err != nil { if err != nil {
log.Error("Failed to get table northbound_pm from database:", err) log.Error("Failed to get table nbi_pm from database:", err)
return nil, err return nil, err
} }
defer rows.Close() defer rows.Close()
for rows.Next() { for rows.Next() {
err := rows.Scan(pm) err := rows.Scan(pm)
if err != nil { if err != nil {
log.Error("Failed to get table northbound_pm from database:", err) log.Error("Failed to get table nbi_pm from database:", err)
return nil, err return nil, err
} }
*pms = append(*pms, *pm) *pms = append(*pms, *pm)

View File

@@ -82,7 +82,7 @@ func (t *TaskFunc) GenNFPMXmlFile(neType string) error {
var pmResults []NorthboundPm var pmResults []NorthboundPm
_, err = XormGetNorthboundPm(date, index, neType, &pmResults) _, err = XormGetNorthboundPm(date, index, neType, &pmResults)
if err != nil { if err != nil {
log.Error("Failed to get northbound_pm:", err) log.Error("Failed to get nbi_pm:", err)
return err return err
} }

View File

@@ -1777,21 +1777,21 @@ func XormGetNorthboundCm(neType string, cmResults *[]NorthboundCm) error {
log.Info("XormGetNorthboundCm processing... ") log.Info("XormGetNorthboundCm processing... ")
cmResult := new(NorthboundCm) cmResult := new(NorthboundCm)
rows, err := xEngine.Table("northbound_cm"). rows, err := xEngine.Table("nbi_cm").
Distinct("object_type"). Distinct("object_type").
Where("`ne_type` = ?", neType). Where("`ne_type` = ?", neType).
Desc("timestamp"). Desc("timestamp").
Cols("*"). Cols("*").
Rows(cmResult) Rows(cmResult)
if err != nil { if err != nil {
log.Error("Failed to get table northbound_cm:", err) log.Error("Failed to get table nbi_cm:", err)
return err return err
} }
defer rows.Close() defer rows.Close()
for rows.Next() { for rows.Next() {
err := rows.Scan(cmResult) err := rows.Scan(cmResult)
if err != nil { if err != nil {
log.Error("Failed to get table northbound_cm:", err) log.Error("Failed to get table nbi_cm:", err)
return err return err
} }
*cmResults = append(*cmResults, *cmResult) *cmResults = append(*cmResults, *cmResult)
@@ -1803,14 +1803,14 @@ func XormGetNorthboundCmLatestObject(neType, neID, objectType string) (*Northbou
log.Info("XormGetNorthboundCmLatestObject processing... ") log.Info("XormGetNorthboundCmLatestObject processing... ")
cmResult := new(NorthboundCm) cmResult := new(NorthboundCm)
_, err := xEngine.Table("northbound_cm"). _, err := xEngine.Table("nbi_cm").
Where("`ne_type`=? and `ne_id`=? and `object_type`=?", neType, neID, objectType). Where("`ne_type`=? and `ne_id`=? and `object_type`=?", neType, neID, objectType).
Desc("timestamp"). Desc("timestamp").
Cols("*"). Cols("*").
Limit(1). Limit(1).
Get(cmResult) Get(cmResult)
if err != nil { if err != nil {
log.Error("Failed to get table northbound_cm:", err) log.Error("Failed to get table nbi_cm:", err)
return nil, err return nil, err
} }