X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=agent%2Fpkg%2Fnbi%2Fnbi.go;fp=agent%2Fpkg%2Fnbi%2Fnbi.go;h=83c3431eefe71804bfcbc759cbec05fc24333e71;hb=5a2379411775bf502d3481b720a60a0b851fea01;hp=d86de578434043d125af6e5211098a213ac63ffb;hpb=100d755380d0af933a8b803d6b0c7a2411f01fab;p=ric-plt%2Fo1.git diff --git a/agent/pkg/nbi/nbi.go b/agent/pkg/nbi/nbi.go index d86de57..83c3431 100755 --- a/agent/pkg/nbi/nbi.go +++ b/agent/pkg/nbi/nbi.go @@ -135,6 +135,9 @@ func (n *Nbi) SubscribeStatusData() bool { 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 } @@ -275,6 +278,12 @@ func nbiGnbStateCB(session *C.sr_session_ctx_t, module *C.char, xpath *C.char, r 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" @@ -460,6 +469,26 @@ func (n *Nbi) testGnbStateCB(module string) bool { 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)