if ok := n.SubscribeStatus("o-ran-sc-ric-alarm-v1", "/o-ran-sc-ric-alarm-v1:ric/alarms"); !ok {
return ok
}
+ if ok := n.SubscribeStatus("o-ran-sc-ric-xapp-desc-v1", "/o-ran-sc-ric-xapp-desc-v1:ric/configuration"); !ok {
+ return ok
+ }
return true
}
log.Info("nbiGnbStateCB: module='%s' xpath='%s' rpath='%s' [id=%d]", mod, C.GoString(xpath), C.GoString(rpath), reqid)
if mod == "o-ran-sc-ric-xapp-desc-v1" {
+
+ if C.GoString(xpath) == "/o-ran-sc-ric-xapp-desc-v1:ric/configuration" {
+ nbGetAllXappsDefCfg(session, parent)
+ return C.SR_ERR_OK
+ }
+
xappnamespace := os.Getenv("XAPP_NAMESPACE")
if xappnamespace == "" {
xappnamespace = "ricxapp"
return true
}
+func nbGetAllXappsDefCfg(session *C.sr_session_ctx_t, parent **C.char) {
+ var xappNameList []string
+ var xappCfgList []string
+
+ //Get the default config of all deployed xapps from appgmr using rest api
+ xappNameList, xappCfgList = sbiClient.GetAllDeployedXappsConfig()
+ if xappCfgList == nil || len(xappCfgList) == 0 {
+ log.Error("GetAllDeployedXappsConfig() Failure")
+ return
+ }
+ log.Info("GetAllDeployedXappsConfig Success, recvd xapp config")
+
+ //Loop thru the list of recvd xapps for config
+ for i, xappCfg := range xappCfgList {
+ path := fmt.Sprintf("/o-ran-sc-ric-xapp-desc-v1:ric/configuration/xapps/xapp[name='%s']", xappNameList[i])
+ nbiClient.CreateNewElement(session, parent, path, "name", xappNameList[i])
+ nbiClient.CreateNewElement(session, parent, path, "config", xappCfg)
+ }
+}
+
type iRnib interface {
GetListGnbIds() ([]*xapp.RNIBNbIdentity, xapp.RNIBIRNibError)
GetListEnbIds() ([]*xapp.RNIBNbIdentity, xapp.RNIBIRNibError)
import (
"bytes"
+ "encoding/json"
"fmt"
httptransport "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
return resp, nil
}
+
+func (s *SBIClient) GetAllDeployedXappsConfig() ([]string, []string) {
+
+ //Trigger http rest api to appmgr to get config of all deployed xapps
+ params := apixapp.NewGetAllXappConfigParamsWithTimeout(s.timeout)
+ result, err := s.CreateTransport(s.appmgrAddr).Xapp.GetAllXappConfig(params)
+ if err != nil {
+ log.Error("GetAllDeployedXappsConfig() unsuccessful: %v", err)
+ return nil, nil
+ }
+
+ var xappCfgList []string
+ var xappNameList []string
+ var allXappCfg apimodel.AllXappConfig
+
+ allXappCfg = apimodel.AllXappConfig(result.Payload)
+ for i, xappCfg := range allXappCfg {
+ var xappName string
+ var xappJsonStrCfg string
+ xappName = string(*(xappCfg.Metadata.XappName))
+ xappJsonCfgMap := xappCfg.Config.(map[string]interface{})
+ bs, err := json.Marshal(xappJsonCfgMap)
+ if err != nil {
+ log.Error("json marshal failure after AllXappConfig: %v", err)
+ return nil, nil
+ }
+ xappJsonStrCfg = string(bs)
+ log.Info(" %d %s xapp config json data: %v", i, xappName, xappJsonStrCfg)
+ xappCfgList = append(xappCfgList, xappJsonStrCfg)
+ xappNameList = append(xappNameList, xappName)
+ }
+
+ return xappNameList, xappCfgList
+}
+
GetAllPodStatus(namespace string) ([]PodStatus, error)
GetAlerts() (*alert.GetAlertsOK, error)
+
+ GetAllDeployedXappsConfig() ([]string, []string)
}
description
"JSON string of override file for 'helm install' command";
}
+ leaf config {
+ type string;
+ description
+ "configuration of the xapp";
+ }
description
"xApp descriptor";
}
description
"State data of the xApps";
}
+ container configuration {
+ config false;
+ container xapps {
+ list xapp {
+ key "name";
+ uses xapp-descriptor;
+ description
+ "xApp descriptor";
+ }
+ description
+ "List of xApps for which config to be extracted";
+ }
+ description
+ "config get data of the xApps";
+ }
description
"Root object for xApp management and status";
}
-}
\ No newline at end of file
+}