4 **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.
8 ![Architecture](assets/xappframe-arch.png)
10 ## Features and Components
13 * Health check/probes (readiness and liveliness)
14 * Reading and watching config-map
18 * Encoding and decoding of commonly used RIC ASN.1 messages
23 #### Below is a simple example xapp. For more information, see the sample code in the xapp/examples folder:
27 import "gitlabe1.ext.net.nokia.com/ric_dev/nokia-xapps/xapp/pkg/xapp"
29 type MessageCounsumer struct {
32 func (m MessageCounsumer) Consume(mtype, len int, payload []byte) (err error) {
33 xapp.Logger.Debug("Message received - type=%d len=%d", mtype, len)
35 xapp.Sdl.Store("myKey", payload)
36 xapp.Rmr.Send(10005, len, payload)
41 xapp.Run(MessageCounsumer{})
44 #### Installing and running the example xapp
46 git clone git@gitlabe1.ext.net.nokia.com:ric_dev/nokia-xapps/xapp.git
51 go build example-xapp.go
54 Congratulations! You've just built your first **xapp** application.
60 #### API Usage and Examples
61 * Setting logging level and writing to log
63 xapp.Logger.SetLevel(4)
64 xapp.Logger.Info("Status inquiry ...")
66 * Storing key-value data to SDL
68 xapp.Sdl.Store("myKey", payload)
70 * Sending RMR messages
72 mid := Rmr.GetRicMessageId("RIC_SUB_RESP")
73 xapp.Rmr.Send(mid, 1234, len, payload)
75 * Injecting REST API resources (URL)
77 xapp.Resource.InjectRoute("/ric/v1/health/stat", statisticsHandler, "GET")
78 Resource.InjectQueryRoute("/ric/v1/user", handler, "GET", "foo", "bar", "id", "mykey")
86 This project is licensed under the Apache License 2.0 - see the [LICENSE.md](LICENSE.md) file for details