-#
#==================================================================================
# Copyright (c) 2019 AT&T Intellectual Property.
# Copyright (c) 2019 Nokia
# url: "http://127.0.0.1"
- name: "health"
description: "Health of the system"
+- name: "debug"
+ description: "Debug Information"
schemes:
#- "https"
- "http"
description: "The health of the system"
schema:
"$ref": "#/definitions/health-status"
+ /getdebuginfo:
+ get:
+ tags:
+ - "debug"
+ summary: "Get Information for debugging"
+ description: "By performing a GET method, API caller is able to get the dump of routes tables, subcription list and E2T's"
+ operationId: "get_debuginfo"
+ consumes:
+ - "application/json"
+ produces:
+ - "application/json"
+ responses:
+ 200:
+ description: "Debug Info from routing manager"
+ schema:
+ "$ref": "#/definitions/debuginfo"
+ 201:
+ description: "Error while fetching Debug data"
/handles:
get:
tags:
$ref: '#/definitions/ranNamelist'
ranAssocList:
$ref: "#/definitions/ran-e2t-map"
-
+ endpoint:
+ type: "object"
+ properties:
+ EndPointName:
+ type: "string"
+ EndPointFqdn:
+ type: "string"
+ EndPointPort:
+ type: "integer"
+ format: "uint16"
+ minimum: 0
+ maximum: 65535
+
+ debuginfo:
+ type: "object"
+ required:
+ - "RouteTable"
+ properties:
+ RouteTable:
+ type: "array"
+ items:
+ type: "string"
+ RouteConfigs:
+ type: "string"
externalDocs:
description: "Routing Manager"
url: "http://placeholder"
-
-
"routing-manager/pkg/models"
"routing-manager/pkg/restapi"
"routing-manager/pkg/restapi/operations"
+ "routing-manager/pkg/restapi/operations/debug"
"routing-manager/pkg/restapi/operations/handle"
"routing-manager/pkg/rpe"
"routing-manager/pkg/rtmgr"
return nil
}
+func dumpDebugData() (models.Debuginfo, error) {
+ var response models.Debuginfo
+ sdlEngine, _ := sdl.GetSdl("file")
+ rpeEngine, _ := rpe.GetRpe("rmrpush")
+ data, err := sdlEngine.ReadAll(xapp.Config.GetString("rtfile"))
+ if err != nil || data == nil {
+ xapp.Logger.Error("Cannot get data from sdl interface due to: " + err.Error())
+ return response, err
+ }
+ response.RouteTable = *rpeEngine.GeneratePolicies(rtmgr.Eps, data)
+
+ prettyJSON, err := json.MarshalIndent(data, "", "")
+ response.RouteConfigs = string(prettyJSON)
+
+ return response, err
+}
+
func launchRest(nbiif *string, datach chan<- *models.XappCallbackData, subchan chan<- *models.XappSubscriptionData, subupdatechan chan<- *rtmgr.XappList,
subdelchan chan<- *models.XappSubscriptionData, e2taddchan chan<- *models.E2tData, assranchan chan<- models.RanE2tMap, disassranchan chan<- models.RanE2tMap, e2tdelchan chan<- *models.E2tDeleteData) {
swaggerSpec, err := loads.Embedded(restapi.SwaggerJSON, restapi.FlatSwaggerJSON)
return handle.NewDeleteE2tHandleCreated()
}
})
+ api.DebugGetDebuginfoHandler = debug.GetDebuginfoHandlerFunc(
+ func(params debug.GetDebuginfoParams) middleware.Responder {
+ response, err := dumpDebugData()
+ if err != nil {
+ return debug.NewGetDebuginfoCreated()
+ } else {
+ return debug.NewGetDebuginfoOK().WithPayload(&response)
+ }
+ })
// start to serve API
xapp.Logger.Info("Starting the HTTP Rest service")
if err := server.Serve(); err != nil {