Implement Onboarding of xApp
[ric-plt/ricdms.git] / pkg / restful / restful.go
index 4255e2b..2670fb6 100644 (file)
@@ -24,9 +24,11 @@ import (
        "os"
 
        ph "gerrit.o-ran-sc.org/r/ric-plt/ricdms/pkg/health"
+       po "gerrit.o-ran-sc.org/r/ric-plt/ricdms/pkg/onboard"
        "gerrit.o-ran-sc.org/r/ric-plt/ricdms/pkg/restapi"
        "gerrit.o-ran-sc.org/r/ric-plt/ricdms/pkg/restapi/operations"
        "gerrit.o-ran-sc.org/r/ric-plt/ricdms/pkg/restapi/operations/health"
+       "gerrit.o-ran-sc.org/r/ric-plt/ricdms/pkg/restapi/operations/onboard"
        "gerrit.o-ran-sc.org/r/ric-plt/ricdms/pkg/resthooks"
        "gerrit.o-ran-sc.org/r/ric-plt/ricdms/pkg/ricdms"
        "github.com/go-openapi/loads"
@@ -37,6 +39,7 @@ func NewRestful() *Restful {
        r := &Restful{
                rh: resthooks.NewResthook(
                        ph.NewHealthChecker(),
+                       po.NewOnboarder(),
                ),
        }
        r.setupHandler()
@@ -57,6 +60,12 @@ func (r *Restful) setupHandler() {
                return resp
        })
 
+       api.OnboardPostOnboardxAppsHandler = onboard.PostOnboardxAppsHandlerFunc(func(poap onboard.PostOnboardxAppsParams) middleware.Responder {
+               ricdms.Logger.Debug("==> onboard API invoked.")
+               resp := r.rh.OnBoard(poap.Body)
+               return resp
+       })
+
        r.api = api
 }