xapp-frame is a simple framework for rapid development of RIC xapps, and supports various services essential for RIC xapps such as RESTful APIs, RMR (RIC Message Routing), database backend services and watching and populating config-map changes in K8S environment.
package main
import "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/xapp"
type ExampleXapp struct {
}
func (m *ExampleXapp) Consume(rp *xapp.RMRParams) (err error) {
xapp.Logger.Debug("Message received - type=%d len=%d", rp.Mtype, rp.PayloadLen)
xapp.Sdl.Store("myKey", rp.Payload)
xapp.Rmr.Send(r)
return nil
}
func main() {
xapp.Run(ExampleXapp{})
}
git clone https://gerrit.o-ran-sc.org/r/ric-plt/xapp-frame cd xapp-frame
GO111MODULE=on GO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o example-xapp examples/example-xapp.go
RMR_SEED_RT=config/uta_rtg.rt ./example-xapp -f config/config-file.yaml
Congratulations! You've just built your first xapp application.
xapp.Logger.SetLevel(4) xapp.Logger.Info("Status inquiry ...")
xapp.Sdl.Store("myKey", payload)
mid := Rmr.GetRicMessageId("RIC_SUB_RESP") xapp.Rmr.Send(mid, 1234, len, payload)
xapp.Resource.InjectRoute("/ric/v1/health/stat", statisticsHandler, "GET") Resource.InjectQueryRoute("/ric/v1/user", handler, "GET", "foo", "bar", "id", "mykey")
This project is licensed under the Apache License 2.0 - see the LICENSE.md file for details