Code Review
/
ric-plt
/
a1.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
RMR handler for A1 policy query
[ric-plt/a1.git]
/
a1-go
/
pkg
/
resthooks
/
resthooks.go
diff --git
a/a1-go/pkg/resthooks/resthooks.go
b/a1-go/pkg/resthooks/resthooks.go
index
c57c2e8
..
508bc49
100644
(file)
--- a/
a1-go/pkg/resthooks/resthooks.go
+++ b/
a1-go/pkg/resthooks/resthooks.go
@@
-30,6
+30,8
@@
import (
"gerrit.o-ran-sc.org/r/ric-plt/a1/pkg/a1"
"gerrit.o-ran-sc.org/r/ric-plt/a1/pkg/models"
"gerrit.o-ran-sc.org/r/ric-plt/a1/pkg/a1"
"gerrit.o-ran-sc.org/r/ric-plt/a1/pkg/models"
+ "gerrit.o-ran-sc.org/r/ric-plt/a1/pkg/policy"
+ "gerrit.o-ran-sc.org/r/ric-plt/a1/pkg/restapi/operations/a1_mediator"
"gerrit.o-ran-sc.org/r/ric-plt/a1/pkg/rmr"
"gerrit.o-ran-sc.org/r/ric-plt/sdlgo"
"github.com/santhosh-tekuri/jsonschema/v5"
"gerrit.o-ran-sc.org/r/ric-plt/a1/pkg/rmr"
"gerrit.o-ran-sc.org/r/ric-plt/sdlgo"
"github.com/santhosh-tekuri/jsonschema/v5"
@@
-85,14
+87,27
@@
func (rh *Resthook) IsValidJson(err error) bool {
return err == invalidJsonSchema
}
func NewResthook() *Resthook {
return err == invalidJsonSchema
}
func NewResthook() *Resthook {
- return createResthook(sdlgo.NewSyncStorage(), rmr.NewRMRSender())
+ sdl := sdlgo.NewSyncStorage()
+ policyManager := policy.NewPolicyManager(sdl)
+ return createResthook(sdl, rmr.NewRMRSender(policyManager))
}
func createResthook(sdlInst iSdl, rmrSenderInst rmr.IRmrSender) *Resthook {
}
func createResthook(sdlInst iSdl, rmrSenderInst rmr.IRmrSender) *Resthook {
- r
eturn
&Resthook{
+ r
h :=
&Resthook{
db: sdlInst,
iRmrSenderInst: rmrSenderInst,
}
db: sdlInst,
iRmrSenderInst: rmrSenderInst,
}
+
+ return rh
+}
+
+func (rh *Resthook) GetA1Health() bool {
+ data, _ := rh.db.GetAll(a1MediatorNs)
+ if data != nil {
+ a1.Logger.Debug("Database connected and A1 is healthy")
+ return true
+ }
+ return false
}
func (rh *Resthook) GetAllPolicyType() []models.PolicyTypeID {
}
func (rh *Resthook) GetAllPolicyType() []models.PolicyTypeID {