Symptom data collection
Change-Id: Idde3b26e046610f4df4107b2c37f0a21c1f66832
Signed-off-by: Abukar Mohamed <abukar.mohamed@nokia.com>
diff --git a/pkg/restful/restful.go b/pkg/restful/restful.go
index 86f2cf0..c911895 100755
--- a/pkg/restful/restful.go
+++ b/pkg/restful/restful.go
@@ -23,7 +23,6 @@
"encoding/json"
"errors"
"fmt"
- //"io/ioutil"
"log"
"net/http"
"os"
@@ -76,6 +75,7 @@
appmgr.Logger.Info("Xapp manager started ... serving on %s:%d\n", server.Host, server.Port)
+ go r.symptomdataServer()
go r.RetrieveApps()
if err := server.Serve(); err != nil {
log.Fatal(err.Error())
@@ -427,3 +427,26 @@
}
return
}
+
+func (r *Restful) symptomdataServer() {
+ http.HandleFunc("/ric/v1/symptomdata", func(w http.ResponseWriter, req *http.Request) {
+ d, _ := r.GetApps()
+ xappData := struct {
+ XappList models.AllDeployedXapps `json:"xappList"`
+ ConfigList models.AllXappConfig `json:"configList"`
+ SubscriptionList models.AllSubscriptions `json:"subscriptionList"`
+ }{
+ d,
+ r.getAppConfig(),
+ r.rh.GetAllSubscriptions(),
+ }
+
+ w.Header().Set("Content-Type", "application/json")
+ w.Header().Set("Content-Disposition", "attachment; filename=platform/apps_info.json")
+ w.WriteHeader(http.StatusOK)
+ resp, _ := json.MarshalIndent(xappData, "", " ")
+ w.Write(resp)
+ })
+
+ http.ListenAndServe(":8081", nil)
+}