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"
}
gnbs, err := rnib.GetListGnbIds()
- if err != nil || len(gnbs) == 0 {
- log.Info("Rnib.GetListGnbIds() returned elementCount=%d err:%v", len(gnbs), err)
- return C.SR_ERR_OK
- }
+ log.Info("Rnib.GetListGnbIds() returned elementCount=%d err:%v", len(gnbs), err)
+ if err == nil && len(gnbs) > 0 {
+ for _, gnb := range gnbs {
+ ranName := gnb.GetInventoryName()
+ info, err := rnib.GetNodeb(ranName)
+ if err != nil {
+ log.Error("GetNodeb() failed for ranName=%s: %v", ranName, err)
+ continue
+ }
- for _, gnb := range gnbs {
- ranName := gnb.GetInventoryName()
- info, err := rnib.GetNodeb(ranName)
- if err != nil {
- log.Error("GetNodeb() failed for ranName=%s: %v", ranName, err)
- continue
+ prot := nbiClient.E2APProt2Str(int(info.E2ApplicationProtocol))
+ connStat := nbiClient.ConnStatus2Str(int(info.ConnectionStatus))
+ ntype := nbiClient.NodeType2Str(int(info.NodeType))
+
+ log.Info("gNB info: %s -> %s %s %s -> %s %s", ranName, prot, connStat, ntype, gnb.GetGlobalNbId().GetPlmnId(), gnb.GetGlobalNbId().GetNbId())
+
+ path := fmt.Sprintf("/o-ran-sc-ric-gnb-status-v1:ric/nodes/node[ran-name='%s']", ranName)
+ nbiClient.CreateNewElement(session, parent, path, "ran-name", ranName)
+ nbiClient.CreateNewElement(session, parent, path, "ip", info.Ip)
+ nbiClient.CreateNewElement(session, parent, path, "port", fmt.Sprintf("%d", info.Port))
+ nbiClient.CreateNewElement(session, parent, path, "plmn-id", gnb.GetGlobalNbId().GetPlmnId())
+ nbiClient.CreateNewElement(session, parent, path, "nb-id", gnb.GetGlobalNbId().GetNbId())
+ nbiClient.CreateNewElement(session, parent, path, "e2ap-protocol", prot)
+ nbiClient.CreateNewElement(session, parent, path, "connection-status", connStat)
+ nbiClient.CreateNewElement(session, parent, path, "node", ntype)
}
+ }
- prot := nbiClient.E2APProt2Str(int(info.E2ApplicationProtocol))
- connStat := nbiClient.ConnStatus2Str(int(info.ConnectionStatus))
- ntype := nbiClient.NodeType2Str(int(info.NodeType))
-
- log.Info("gNB info: %s -> %s %s %s -> %s %s", ranName, prot, connStat, ntype, gnb.GetGlobalNbId().GetPlmnId(), gnb.GetGlobalNbId().GetNbId())
+ //Check if any Enbs are connected to RIC
+ enbs, err2 := rnib.GetListEnbIds()
+ log.Info("Rnib.GetListEnbIds() returned elementCount=%d err:%v", len(gnbs), err)
+ if err2 == nil || len(enbs) > 0 {
+ log.Info("Getting Enb details from list of Enbs")
+ for _, enb := range enbs {
+ ranName := enb.GetInventoryName()
+ info, err := rnib.GetNodeb(ranName)
+ if err != nil {
+ log.Error("GetNodeb() failed for ranName=%s: %v", ranName, err)
+ continue
+ }
- path := fmt.Sprintf("/o-ran-sc-ric-gnb-status-v1:ric/nodes/node[ran-name='%s']", ranName)
- nbiClient.CreateNewElement(session, parent, path, "ran-name", ranName)
- nbiClient.CreateNewElement(session, parent, path, "ip", info.Ip)
- nbiClient.CreateNewElement(session, parent, path, "port", fmt.Sprintf("%d", info.Port))
- nbiClient.CreateNewElement(session, parent, path, "plmn-id", gnb.GetGlobalNbId().GetPlmnId())
- nbiClient.CreateNewElement(session, parent, path, "nb-id", gnb.GetGlobalNbId().GetNbId())
- nbiClient.CreateNewElement(session, parent, path, "e2ap-protocol", prot)
- nbiClient.CreateNewElement(session, parent, path, "connection-status", connStat)
- nbiClient.CreateNewElement(session, parent, path, "node", ntype)
+ prot := nbiClient.E2APProt2Str(int(info.E2ApplicationProtocol))
+ connStat := nbiClient.ConnStatus2Str(int(info.ConnectionStatus))
+ ntype := nbiClient.NodeType2Str(int(info.NodeType))
+
+ log.Info("eNB info: %s -> %s %s %s -> %s %s", ranName, prot, connStat, ntype, enb.GetGlobalNbId().GetPlmnId(), enb.GetGlobalNbId().GetNbId())
+
+ path := fmt.Sprintf("/o-ran-sc-ric-gnb-status-v1:ric/nodes/node[ran-name='%s']", ranName)
+ nbiClient.CreateNewElement(session, parent, path, "ran-name", ranName)
+ nbiClient.CreateNewElement(session, parent, path, "ip", info.Ip)
+ nbiClient.CreateNewElement(session, parent, path, "port", fmt.Sprintf("%d", info.Port))
+ nbiClient.CreateNewElement(session, parent, path, "plmn-id", enb.GetGlobalNbId().GetPlmnId())
+ nbiClient.CreateNewElement(session, parent, path, "nb-id", enb.GetGlobalNbId().GetNbId())
+ nbiClient.CreateNewElement(session, parent, path, "e2ap-protocol", prot)
+ nbiClient.CreateNewElement(session, parent, path, "connection-status", connStat)
+ nbiClient.CreateNewElement(session, parent, path, "node", ntype)
+ }
}
+
return C.SR_ERR_OK
}
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)
GetNodeb(invName string) (*xapp.RNIBNodebInfo, xapp.RNIBIRNibError)
}