FIX: ne status, ba
This commit is contained in:
@@ -15,6 +15,7 @@ import (
|
|||||||
"ems.agt/lib/log"
|
"ems.agt/lib/log"
|
||||||
"ems.agt/lib/services"
|
"ems.agt/lib/services"
|
||||||
"ems.agt/restagent/config"
|
"ems.agt/restagent/config"
|
||||||
|
tokenConst "ems.agt/src/framework/constants/token"
|
||||||
|
|
||||||
"github.com/go-resty/resty/v2"
|
"github.com/go-resty/resty/v2"
|
||||||
"github.com/gorilla/mux"
|
"github.com/gorilla/mux"
|
||||||
@@ -22,6 +23,7 @@ import (
|
|||||||
|
|
||||||
var (
|
var (
|
||||||
UriParamOmcNeConfig = config.DefaultUriPrefix + "/systemManagement/v1/elementType/%s/objectType/config/omcNeConfig"
|
UriParamOmcNeConfig = config.DefaultUriPrefix + "/systemManagement/v1/elementType/%s/objectType/config/omcNeConfig"
|
||||||
|
UriOmcNeConfig = config.DefaultUriPrefix + "/systemManagement/v1/elementType/omc/objectType/config/omcNeConfig"
|
||||||
// NE CM export/import
|
// NE CM export/import
|
||||||
NeCmUri = config.DefaultUriPrefix + "/systemManagement/{apiVersion}/elementType/{elementTypeValue}/objectType/cm"
|
NeCmUri = config.DefaultUriPrefix + "/systemManagement/{apiVersion}/elementType/{elementTypeValue}/objectType/cm"
|
||||||
// NE info
|
// NE info
|
||||||
@@ -34,6 +36,7 @@ var (
|
|||||||
UriNeInstance = config.DefaultUriPrefix + "/systemManagement/{apiVersion}/elementType/{elementTypeValue}/objectType/instance/{action}"
|
UriNeInstance = config.DefaultUriPrefix + "/systemManagement/{apiVersion}/elementType/{elementTypeValue}/objectType/instance/{action}"
|
||||||
|
|
||||||
CustomUriParamOmcNeConfig = config.UriPrefix + "/systemManagement/v1/elementType/%s/objectType/config/omcNeConfig"
|
CustomUriParamOmcNeConfig = config.UriPrefix + "/systemManagement/v1/elementType/%s/objectType/config/omcNeConfig"
|
||||||
|
CustomUriOmcNeConfig = config.UriPrefix + "/systemManagement/v1/elementType/omc/objectType/config/omcNeConfig"
|
||||||
CustomNeCmUri = config.UriPrefix + "/systemManagement/{apiVersion}/elementType/{elementTypeValue}/objectType/cm"
|
CustomNeCmUri = config.UriPrefix + "/systemManagement/{apiVersion}/elementType/{elementTypeValue}/objectType/cm"
|
||||||
CustomUriNeInfo = config.UriPrefix + "/systemManagement/{apiVersion}/elementType/{elementTypeValue}/objectType/neInfo"
|
CustomUriNeInfo = config.UriPrefix + "/systemManagement/{apiVersion}/elementType/{elementTypeValue}/objectType/neInfo"
|
||||||
CustomUriNeCmFile = config.UriPrefix + "/systemManagement/{apiVersion}/{neType}/neBackup/{fileName}"
|
CustomUriNeCmFile = config.UriPrefix + "/systemManagement/{apiVersion}/{neType}/neBackup/{fileName}"
|
||||||
@@ -231,6 +234,8 @@ func PutNeInfo(w http.ResponseWriter, r *http.Request) {
|
|||||||
services.ResponseNotFound404UriNotExist(w, r)
|
services.ResponseNotFound404UriNotExist(w, r)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
neTypeLower := strings.ToLower(neType)
|
||||||
|
neTypeUpper := strings.ToUpper(neType)
|
||||||
syncFlag := services.GetUriParamString(r, "sync2ne", ",", false, false)
|
syncFlag := services.GetUriParamString(r, "sync2ne", ",", false, false)
|
||||||
body, err := io.ReadAll(io.LimitReader(r.Body, global.RequestBodyMaxLen))
|
body, err := io.ReadAll(io.LimitReader(r.Body, global.RequestBodyMaxLen))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -246,7 +251,7 @@ func PutNeInfo(w http.ResponseWriter, r *http.Request) {
|
|||||||
log.Debug("NE info:", neInfo)
|
log.Debug("NE info:", neInfo)
|
||||||
|
|
||||||
//if !config.GetYamlConfig().OMC.Chk2Ne {
|
//if !config.GetYamlConfig().OMC.Chk2Ne {
|
||||||
if syncFlag == "false" {
|
if syncFlag == "false" || neTypeUpper == config.GetYamlConfig().OMC.NeType {
|
||||||
neInfo.Status = NEStatusMaintain
|
neInfo.Status = NEStatusMaintain
|
||||||
affected, err := dborm.XormUpdateNeInfo(neInfo)
|
affected, err := dborm.XormUpdateNeInfo(neInfo)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -263,7 +268,7 @@ func PutNeInfo(w http.ResponseWriter, r *http.Request) {
|
|||||||
} else {
|
} else {
|
||||||
hostUri := global.CombineHostUri(neInfo.Ip, neInfo.Port)
|
hostUri := global.CombineHostUri(neInfo.Ip, neInfo.Port)
|
||||||
//hostUri := fmt.Sprintf("http://%s:%v", neInfo.Ip, neInfo.Port)
|
//hostUri := fmt.Sprintf("http://%s:%v", neInfo.Ip, neInfo.Port)
|
||||||
apiUri := fmt.Sprintf(UriParamOmcNeConfig, strings.ToLower(neType))
|
apiUri := fmt.Sprintf(UriParamOmcNeConfig, neTypeLower)
|
||||||
requestURI2NF := fmt.Sprintf("%s%s", hostUri, apiUri)
|
requestURI2NF := fmt.Sprintf("%s%s", hostUri, apiUri)
|
||||||
log.Debug("requestURI2NF:", requestURI2NF)
|
log.Debug("requestURI2NF:", requestURI2NF)
|
||||||
|
|
||||||
@@ -279,6 +284,7 @@ func PutNeInfo(w http.ResponseWriter, r *http.Request) {
|
|||||||
body, _ = json.Marshal(omcNeConfig)
|
body, _ = json.Marshal(omcNeConfig)
|
||||||
response, err := client.R().
|
response, err := client.R().
|
||||||
EnableTrace().
|
EnableTrace().
|
||||||
|
SetHeaders(map[string]string{tokenConst.HEADER_KEY: r.Header.Get(tokenConst.HEADER_KEY)}).
|
||||||
SetHeaders(map[string]string{"User-Agent": config.GetDefaultUserAgent()}).
|
SetHeaders(map[string]string{"User-Agent": config.GetDefaultUserAgent()}).
|
||||||
SetHeaders(map[string]string{"Content-Type": "application/json;charset=UTF-8"}).
|
SetHeaders(map[string]string{"Content-Type": "application/json;charset=UTF-8"}).
|
||||||
SetBody(body).
|
SetBody(body).
|
||||||
@@ -316,6 +322,28 @@ func PutNeInfo(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func PutOMCNeConfig(w http.ResponseWriter, r *http.Request) {
|
||||||
|
vars := mux.Vars(r)
|
||||||
|
neType := vars["elementTypeValue"]
|
||||||
|
if neType == "" {
|
||||||
|
log.Error("elementTypeValue is empty")
|
||||||
|
services.ResponseNotFound404UriNotExist(w, r)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
body, err := io.ReadAll(io.LimitReader(r.Body, global.RequestBodyMaxLen))
|
||||||
|
if err != nil {
|
||||||
|
log.Error("Failed to io.ReadAll:", err)
|
||||||
|
services.ResponseNotFound404UriNotExist(w, r)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
neInfo := new(dborm.NeInfo)
|
||||||
|
_ = json.Unmarshal(body, neInfo)
|
||||||
|
neInfo.NeType = strings.ToUpper(neType)
|
||||||
|
|
||||||
|
services.ResponseStatusOK204NoContent(w)
|
||||||
|
}
|
||||||
|
|
||||||
func DeleteNeInfo(w http.ResponseWriter, r *http.Request) {
|
func DeleteNeInfo(w http.ResponseWriter, r *http.Request) {
|
||||||
log.Debug("DeleteNeInfo processing... ")
|
log.Debug("DeleteNeInfo processing... ")
|
||||||
|
|
||||||
|
|||||||
@@ -48,9 +48,9 @@ func GetParamConfigFromNF(w http.ResponseWriter, r *http.Request) {
|
|||||||
getNeInfoURI := restHostPort + getNeInfoPattern
|
getNeInfoURI := restHostPort + getNeInfoPattern
|
||||||
neId := services.GetUriParamString(r, "ne_id", ",", true, true)
|
neId := services.GetUriParamString(r, "ne_id", ",", true, true)
|
||||||
if neId == "" {
|
if neId == "" {
|
||||||
getNeInfoURI = getNeInfoURI + fmt.Sprintf("?WHERE=status in ('0','3')+and+ne_type='%s'", neType)
|
getNeInfoURI = getNeInfoURI + fmt.Sprintf("?WHERE=status+in+('0','3')+and+ne_type='%s'", neType)
|
||||||
} else {
|
} else {
|
||||||
getNeInfoURI = getNeInfoURI + fmt.Sprintf("?WHERE=status in ('0','3')+and+ne_type='%v'+and+ne_id+in+%v", neType, neId)
|
getNeInfoURI = getNeInfoURI + fmt.Sprintf("?WHERE=status+in+('0','3')+and+ne_type='%v'+and+ne_id+in+%v", neType, neId)
|
||||||
}
|
}
|
||||||
log.Debug("getNeInfoURI:", getNeInfoURI)
|
log.Debug("getNeInfoURI:", getNeInfoURI)
|
||||||
|
|
||||||
@@ -63,11 +63,11 @@ func GetParamConfigFromNF(w http.ResponseWriter, r *http.Request) {
|
|||||||
SetHeaders(map[string]string{"Content-Type": "application/json;charset=UTF-8"}).
|
SetHeaders(map[string]string{"Content-Type": "application/json;charset=UTF-8"}).
|
||||||
Get(getNeInfoURI)
|
Get(getNeInfoURI)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Get from database is failure!")
|
log.Error("Failed to Get:", err)
|
||||||
services.ResponseInternalServerError500NFConnectRefused(w)
|
services.ResponseInternalServerError500ProcessError(w, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
log.Debug("NE info:", string(resp.Body()))
|
log.Trace("NE info:", string(resp.Body()))
|
||||||
|
|
||||||
// var neList []dborm.NeInfo
|
// var neList []dborm.NeInfo
|
||||||
neList, _ := dborm.XormParseResult(resp.Body())
|
neList, _ := dborm.XormParseResult(resp.Body())
|
||||||
|
|||||||
@@ -750,7 +750,7 @@ func GetStateFromNF(w http.ResponseWriter, r *http.Request) {
|
|||||||
restHostPort := fmt.Sprintf("http://127.0.0.1:%d", config.GetYamlConfig().Rest[0].Port)
|
restHostPort := fmt.Sprintf("http://127.0.0.1:%d", config.GetYamlConfig().Rest[0].Port)
|
||||||
getNeInfoPattern := fmt.Sprintf(config.DefaultUriPrefix+"/databaseManagement/v1/elementType/%s/objectType/ne_info",
|
getNeInfoPattern := fmt.Sprintf(config.DefaultUriPrefix+"/databaseManagement/v1/elementType/%s/objectType/ne_info",
|
||||||
config.GetYamlConfig().Database.Name)
|
config.GetYamlConfig().Database.Name)
|
||||||
getNeInfoURI := restHostPort + getNeInfoPattern + "?WHERE=status in ('0','3')"
|
getNeInfoURI := restHostPort + getNeInfoPattern + "?WHERE=status+in+('0','3')"
|
||||||
log.Debug("getNeInfoPattern:", getNeInfoPattern)
|
log.Debug("getNeInfoPattern:", getNeInfoPattern)
|
||||||
|
|
||||||
resp, err := client.R().
|
resp, err := client.R().
|
||||||
@@ -774,9 +774,9 @@ func GetStateFromNF(w http.ResponseWriter, r *http.Request) {
|
|||||||
getNeInfoURI := restHostPort + getNeInfoPattern
|
getNeInfoURI := restHostPort + getNeInfoPattern
|
||||||
neId := services.GetUriParamString(r, "ne_id", ",", true, true)
|
neId := services.GetUriParamString(r, "ne_id", ",", true, true)
|
||||||
if neId == "" {
|
if neId == "" {
|
||||||
getNeInfoURI = getNeInfoURI + fmt.Sprintf("?WHERE=status in ('0','3')+and+ne_type='%s'", neType)
|
getNeInfoURI = getNeInfoURI + fmt.Sprintf("?WHERE=status+in+('0','3')+and+ne_type='%s'", neType)
|
||||||
} else {
|
} else {
|
||||||
getNeInfoURI = getNeInfoURI + fmt.Sprintf("?WHERE=status in ('0','3')+and+ne_type='%v'+and+ne_id+in+%v", neType, neId)
|
getNeInfoURI = getNeInfoURI + fmt.Sprintf("?WHERE=status+in+('0','3')+and+ne_type='%v'+and+ne_id+in+%v", neType, neId)
|
||||||
}
|
}
|
||||||
log.Debug("getNeInfoURI:", getNeInfoURI)
|
log.Debug("getNeInfoURI:", getNeInfoURI)
|
||||||
|
|
||||||
@@ -881,10 +881,11 @@ func GetEMSState(ip string) *SysState {
|
|||||||
version = global.Version
|
version = global.Version
|
||||||
}
|
}
|
||||||
hostName, _ := os.Hostname()
|
hostName, _ := os.Hostname()
|
||||||
|
dbInfo, _ := dborm.XormGetMySQLVersion()
|
||||||
emsState := &SysState{
|
emsState := &SysState{
|
||||||
HostName: hostName,
|
HostName: hostName,
|
||||||
OsInfo: getUnameStr(),
|
OsInfo: getUnameStr(),
|
||||||
DbInfo: "mysql Ver 15.1 Distrib 10.3.35-MariaDB, for Linux (aarch64) using readline 5.1",
|
DbInfo: dbInfo,
|
||||||
IpAddr: []string{ip},
|
IpAddr: []string{ip},
|
||||||
Port: config.GetYamlConfig().Rest[0].Port,
|
Port: config.GetYamlConfig().Rest[0].Port,
|
||||||
Version: version,
|
Version: version,
|
||||||
|
|||||||
@@ -196,6 +196,34 @@ type NeInfo struct {
|
|||||||
UpdateTime string `json:"-" xorm:"-"`
|
UpdateTime string `json:"-" xorm:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func XormGetMySQLVersion() (string, error) {
|
||||||
|
var versionInfo string = ""
|
||||||
|
|
||||||
|
var ver, verComment, verCompileOS, verCompile string
|
||||||
|
_, err := xEngine.SQL("SHOW VARIABLES LIKE 'version'").Get(&ver, &ver)
|
||||||
|
if err != nil {
|
||||||
|
return versionInfo, err
|
||||||
|
}
|
||||||
|
|
||||||
|
_, err = xEngine.SQL("SHOW VARIABLES LIKE 'version_comment'").Get(&verComment, &verComment)
|
||||||
|
if err != nil {
|
||||||
|
return versionInfo, err
|
||||||
|
}
|
||||||
|
|
||||||
|
_, err = xEngine.SQL("SHOW VARIABLES LIKE 'version_compile_os'").Get(&verCompileOS, &verCompileOS)
|
||||||
|
if err != nil {
|
||||||
|
return versionInfo, err
|
||||||
|
}
|
||||||
|
|
||||||
|
_, err = xEngine.SQL("SHOW VARIABLES LIKE 'version_compile_machine'").Get(&verCompile, &verCompile)
|
||||||
|
if err != nil {
|
||||||
|
return versionInfo, err
|
||||||
|
}
|
||||||
|
|
||||||
|
versionInfo = fmt.Sprintf("%s %s, for %s (%s)", ver, verComment, verCompileOS, verCompile)
|
||||||
|
return versionInfo, nil
|
||||||
|
}
|
||||||
|
|
||||||
func XormGetNeInfo(neType string, neId string) (*NeInfo, error) {
|
func XormGetNeInfo(neType string, neId string) (*NeInfo, error) {
|
||||||
log.Debug("XormGetNeInfo processing... ")
|
log.Debug("XormGetNeInfo processing... ")
|
||||||
|
|
||||||
|
|||||||
@@ -164,6 +164,10 @@ func init() {
|
|||||||
Register("POST", cm.CustomUriNeInfo, cm.PostNeInfo, nil)
|
Register("POST", cm.CustomUriNeInfo, cm.PostNeInfo, nil)
|
||||||
Register("PUT", cm.CustomUriNeInfo, cm.PutNeInfo, nil)
|
Register("PUT", cm.CustomUriNeInfo, cm.PutNeInfo, nil)
|
||||||
Register("DELETE", cm.CustomUriNeInfo, cm.DeleteNeInfo, nil)
|
Register("DELETE", cm.CustomUriNeInfo, cm.DeleteNeInfo, nil)
|
||||||
|
|
||||||
|
Register("PUT", cm.UriOmcNeConfig, cm.PutOMCNeConfig, nil)
|
||||||
|
Register("PUT", cm.CustomUriOmcNeConfig, cm.PutOMCNeConfig, nil)
|
||||||
|
|
||||||
//ne service action handle
|
//ne service action handle
|
||||||
Register("POST", cm.UriNeService, cm.PostNeServiceAction, nil)
|
Register("POST", cm.UriNeService, cm.PostNeServiceAction, nil)
|
||||||
//ne service action handle
|
//ne service action handle
|
||||||
|
|||||||
@@ -35,45 +35,75 @@ CustomizedDirGeneric=${OMCStaticDir}/generic.d
|
|||||||
check_args "$@"
|
check_args "$@"
|
||||||
|
|
||||||
case "${M_ARG}" in
|
case "${M_ARG}" in
|
||||||
install | upgrade | upgvue3)
|
install)
|
||||||
|
${OMCBinDir}/importdb.sh ${M_ARG}
|
||||||
|
|
||||||
|
case "$C_ARG" in
|
||||||
|
ba)
|
||||||
|
echo "Setting BA customized OMC ..."
|
||||||
|
for SQL in ${CustomizedDirBA}/db/*.sql; do
|
||||||
|
mysql -u${USER} -p${PASSWORD} -P ${PORT} --protocol tcp -D ${DBNAME} < ${SQL};
|
||||||
|
done
|
||||||
|
cp -rf ${CustomizedDirBA}/logo/* ${OMCStaticDir}/logo
|
||||||
|
cp -rf ${CustomizedDirBA}/doc/* ${OMCStaticDir}/helpDoc
|
||||||
|
;;
|
||||||
|
agt)
|
||||||
|
echo "Setting AGT customized OMC ..."
|
||||||
|
for SQL in ${CustomizedDirBA}/db/*.sql; do
|
||||||
|
mysql -u${USER} -p${PASSWORD} -P ${PORT} --protocol tcp -D ${DBNAME} < ${SQL};
|
||||||
|
done
|
||||||
|
cp -rf ${CustomizedDirBA}/logo/* ${OMCStaticDir}/logo
|
||||||
|
cp -rf ${CustomizedDirBA}/doc/* ${OMCStaticDir}/helpDoc
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
echo "Setting Generic OMC ..."
|
||||||
|
for SQL in ${CustomizedDirGeneric}/db/*.sql; do
|
||||||
|
mysql -u${USER} -p${PASSWORD} -P ${PORT} --protocol tcp -D ${DBNAME} < ${SQL};
|
||||||
|
done
|
||||||
|
cp -rf ${CustomizedDirGeneric}/logo/* ${OMCStaticDir}/logo
|
||||||
|
cp -rf ${CustomizedDirGeneric}/doc/* ${OMCStaticDir}/helpDoc
|
||||||
|
;;
|
||||||
|
"")
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
upgrade | upgvue3)
|
||||||
${OMCBinDir}/importdb.sh ${M_ARG}
|
${OMCBinDir}/importdb.sh ${M_ARG}
|
||||||
;;
|
;;
|
||||||
skip)
|
skip)
|
||||||
|
case "$C_ARG" in
|
||||||
|
ba)
|
||||||
|
echo "Setting BA customized OMC ..."
|
||||||
|
for SQL in ${CustomizedDirBA}/db/*.sql; do
|
||||||
|
mysql -u${USER} -p${PASSWORD} -P ${PORT} --protocol tcp -D ${DBNAME} < ${SQL};
|
||||||
|
done
|
||||||
|
cp -rf ${CustomizedDirBA}/logo/* ${OMCStaticDir}/logo
|
||||||
|
cp -rf ${CustomizedDirBA}/doc/* ${OMCStaticDir}/helpDoc
|
||||||
|
;;
|
||||||
|
agt)
|
||||||
|
echo "Setting AGT customized OMC ..."
|
||||||
|
for SQL in ${CustomizedDirBA}/db/*.sql; do
|
||||||
|
mysql -u${USER} -p${PASSWORD} -P ${PORT} --protocol tcp -D ${DBNAME} < ${SQL};
|
||||||
|
done
|
||||||
|
cp -rf ${CustomizedDirBA}/logo/* ${OMCStaticDir}/logo
|
||||||
|
cp -rf ${CustomizedDirBA}/doc/* ${OMCStaticDir}/helpDoc
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
echo "Setting Generic OMC ..."
|
||||||
|
for SQL in ${CustomizedDirGeneric}/db/*.sql; do
|
||||||
|
mysql -u${USER} -p${PASSWORD} -P ${PORT} --protocol tcp -D ${DBNAME} < ${SQL};
|
||||||
|
done
|
||||||
|
cp -rf ${CustomizedDirGeneric}/logo/* ${OMCStaticDir}/logo
|
||||||
|
cp -rf ${CustomizedDirGeneric}/doc/* ${OMCStaticDir}/helpDoc
|
||||||
|
;;
|
||||||
|
"")
|
||||||
|
;;
|
||||||
|
esac
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
${OMCBinDir}/importdb.sh
|
${OMCBinDir}/importdb.sh
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
case "$C_ARG" in
|
|
||||||
ba)
|
|
||||||
echo "Setting BA customized OMC ..."
|
|
||||||
for SQL in ${CustomizedDirBA}/db/*.sql; do
|
|
||||||
mysql -u${USER} -p${PASSWORD} -P ${PORT} --protocol tcp -D ${DBNAME} < ${SQL};
|
|
||||||
done
|
|
||||||
rm -f ${OMCStaticDir}/logo/*.png
|
|
||||||
cp -rf ${CustomizedDirBA}/logo/* ${OMCStaticDir}/logo
|
|
||||||
rm -f ${OMCStaticDir}/helpDoc/*.pdf
|
|
||||||
cp -rf ${CustomizedDirBA}/doc/* ${OMCStaticDir}/helpDoc
|
|
||||||
;;
|
|
||||||
agt)
|
|
||||||
echo "Setting AGT customized OMC ..."
|
|
||||||
for SQL in ${CustomizedDirBA}/db/*.sql; do
|
|
||||||
mysql -u${USER} -p${PASSWORD} -P ${PORT} --protocol tcp -D ${DBNAME} < ${SQL};
|
|
||||||
done
|
|
||||||
rm -f ${OMCStaticDir}/logo/*.png
|
|
||||||
cp -rf ${CustomizedDirBA}/logo/* ${OMCStaticDir}/logo
|
|
||||||
rm -f ${OMCStaticDir}/helpDoc/*.pdf
|
|
||||||
cp -rf ${CustomizedDirBA}/doc/* ${OMCStaticDir}/helpDoc
|
|
||||||
;;
|
|
||||||
|
|
||||||
*)
|
|
||||||
echo "Setting Generic OMC ..."
|
|
||||||
if [ ${M_ARG} == "install" ]; then
|
|
||||||
cp -rf ${CustomizedDirGeneric}/logo/* ${OMCStaticDir}/logo
|
|
||||||
cp -rf ${CustomizedDirGeneric}/doc/* ${OMCStaticDir}/helpDoc
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
"")
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
@@ -14,7 +14,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
/**无Token可访问白名单 */
|
/**无Token可访问白名单 */
|
||||||
var URL_WHITE_LIST = []string{"/performanceManagement", "/faultManagement", "/systemState"}
|
var URL_WHITE_LIST = []string{"/performanceManagement", "/faultManagement", "/systemState", "/omcNeConfig"}
|
||||||
|
|
||||||
// PreAuthorize 用户身份授权认证校验
|
// PreAuthorize 用户身份授权认证校验
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ func (s *BarProcessor) Execute(data any) (any, error) {
|
|||||||
log.Debug("StatusCode: ", response.StatusCode())
|
log.Debug("StatusCode: ", response.StatusCode())
|
||||||
switch response.StatusCode() {
|
switch response.StatusCode() {
|
||||||
case http.StatusOK, http.StatusCreated, http.StatusNoContent, http.StatusAccepted:
|
case http.StatusOK, http.StatusCreated, http.StatusNoContent, http.StatusAccepted:
|
||||||
log.Debug("response body:", string(response.Body()))
|
log.Trace("response body:", string(response.Body()))
|
||||||
state := new(SystemState)
|
state := new(SystemState)
|
||||||
_ = json.Unmarshal(response.Body(), &state)
|
_ = json.Unmarshal(response.Body(), &state)
|
||||||
neState := new(dborm.NeState)
|
neState := new(dborm.NeState)
|
||||||
@@ -143,7 +143,7 @@ func (s *BarProcessor) Execute(data any) (any, error) {
|
|||||||
neState.MemUsage = string(mu)
|
neState.MemUsage = string(mu)
|
||||||
ds, _ := json.Marshal(state.DiskSpace)
|
ds, _ := json.Marshal(state.DiskSpace)
|
||||||
neState.DiskSpace = string(ds)
|
neState.DiskSpace = string(ds)
|
||||||
log.Debug("neState:", neState)
|
log.Trace("neState:", neState)
|
||||||
_, err := dborm.XormInsertNeState(neState)
|
_, err := dborm.XormInsertNeState(neState)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Failed to insert ne_state:", err)
|
log.Error("Failed to insert ne_state:", err)
|
||||||
@@ -152,7 +152,7 @@ func (s *BarProcessor) Execute(data any) (any, error) {
|
|||||||
}
|
}
|
||||||
succNum++
|
succNum++
|
||||||
default:
|
default:
|
||||||
log.Debug("response body:", string(response.Body()))
|
log.Trace("response body:", string(response.Body()))
|
||||||
body := new(map[string]interface{})
|
body := new(map[string]interface{})
|
||||||
_ = json.Unmarshal(response.Body(), &body)
|
_ = json.Unmarshal(response.Body(), &body)
|
||||||
failNum++
|
failNum++
|
||||||
|
|||||||
Reference in New Issue
Block a user