RIC-702: Clean-up logging in routing manager
Signed-off-by: wahidw <abdulwahid.w@nokia.com>
Change-Id: Iae8a951f521478ee120b52d971cad7df358c8c18
diff --git a/RELNOTES b/RELNOTES
index e9dfe1c..8c62e10 100644
--- a/RELNOTES
+++ b/RELNOTES
@@ -1,3 +1,6 @@
+### v0.8.1
+* RIC-702: Clean-up logging in routing manager
+
### v0.7.9
* Replacing deprecated SDL APIs
diff --git a/cmd/rtmgr.go b/cmd/rtmgr.go
index 834df26..dc4a6f6 100644
--- a/cmd/rtmgr.go
+++ b/cmd/rtmgr.go
@@ -76,7 +76,7 @@
}
dummy_whid := int(xapp.Rmr.Openwh("rtmgr:4560"))
- xapp.Logger.Info("created dummy Wormhole ID for routingmanager and dummy_whid :%d", dummy_whid)
+ xapp.Logger.Info("Wormhole ID created for routingmanager:%d", dummy_whid)
go func() {
restful.LaunchRest(xapp.Config.GetString("nbiurl"))
diff --git a/container-tag.yaml b/container-tag.yaml
index b66320d..2a12ede 100644
--- a/container-tag.yaml
+++ b/container-tag.yaml
@@ -2,4 +2,4 @@
# By default this file is in the docker build directory,
# but the location can configured in the JJB template.
---
-tag: 0.7.9
+tag: 0.8.1
diff --git a/pkg/nbi/control.go b/pkg/nbi/control.go
index 91f2475..98d7821 100644
--- a/pkg/nbi/control.go
+++ b/pkg/nbi/control.go
@@ -108,13 +108,13 @@
switch msg.Mtype {
case xapp.RICMessageTypes["RMRRM_REQ_TABLE"]:
if rtmgr.Rtmgr_ready == false {
- xapp.Logger.Info("Update Route Table Request(RMR to RM), message discarded as routing manager is not ready")
+ xapp.Logger.Info("Update route Table Request(RMR -> RM), message discarded as routing manager is not ready")
} else {
- xapp.Logger.Info("Update Route Table Request(RMR to RM)")
+ xapp.Logger.Info("Update Route Table Request(RMR -> RM)")
go c.handleUpdateToRoutingManagerRequest(msg)
}
case xapp.RICMessageTypes["RMRRM_TABLE_STATE"]:
- xapp.Logger.Info("state of table to route mgr %s,payload %s", xapp_msg.String(), msg.Payload)
+ xapp.Logger.Info("State of route table to route mgr %s,payload %s", xapp_msg.String(), msg.Payload)
default:
err := errors.New("Message Type " + strconv.Itoa(msg.Mtype) + " is discarded")
xapp.Logger.Error("Unknown message type: %v", err)
@@ -146,7 +146,7 @@
if strings.Contains(msg.String(), "ricxapp") {
ep := sbiEngine.CheckEndpoint(string(params.Payload))
if ep == nil {
- xapp.Logger.Error("Update Routing Table Request can't handle due to end point %s is not avail in complete ep list: ", string(params.Payload))
+ xapp.Logger.Error("Update Routing Table Request, can't handle due to end point %s is not available in complete ep list: ", string(params.Payload))
return
}
}
@@ -163,7 +163,7 @@
policies := rpeEngine.GeneratePolicies(rtmgr.Eps, data)
err = sbiEngine.DistributeToEp(policies, *epstr, whid)
if err != nil {
- xapp.Logger.Error("Routing table cannot be published due to: " + err.Error())
+ xapp.Logger.Error("Not able to publish the routing table due to: " + err.Error())
return
}
}
@@ -178,7 +178,7 @@
if err != nil {
return nil, errors.New("Cannot get data from sdl interface due to: " + err.Error())
} else {
- xapp.Logger.Debug("Cannot get data from sdl interface, data is null")
+ xapp.Logger.Debug("Cannot get data from sdl interface due to data is null")
return nil, errors.New("Cannot get data from sdl interface")
}
}
@@ -228,7 +228,7 @@
nbiErr := nbiEngine.Initialize(xapp.Config.GetString("xmurl"), xapp.Config.GetString("nbiurl"), xapp.Config.GetString("rtfile"), xapp.Config.GetString("cfgfile"), xapp.Config.GetString("e2murl"), sdlEngine, rpeEngine, &m)
if nbiErr != nil {
- xapp.Logger.Error("Failed to initialize nbi due to: " + nbiErr.Error())
+ xapp.Logger.Error("Initialization of nbi failed due to: " + nbiErr.Error())
return
}
diff --git a/pkg/nbi/httprestful.go b/pkg/nbi/httprestful.go
index 7db7071..ebbf050 100644
--- a/pkg/nbi/httprestful.go
+++ b/pkg/nbi/httprestful.go
@@ -84,7 +84,7 @@
func recvNewE2Tdata(e2tData *models.E2tData) (*rtmgr.E2TInstance, string, error) {
var str string
- xapp.Logger.Info("data received")
+ xapp.Logger.Info("Data received")
if nil != e2tData {
@@ -136,9 +136,9 @@
} else {
appdata, err := recvXappCallbackData(data)
if err != nil {
- xapp.Logger.Error("cannot get data from rest api dute to: " + err.Error())
+ xapp.Logger.Error("Cannot get data from rest api dute to: " + err.Error())
} else if appdata != nil {
- xapp.Logger.Debug("Fetching all xApps deployed in xApp Manager through GET operation.")
+ xapp.Logger.Debug("Fetching all xApps deployed in xApp Manager through GET operation")
alldata, err1 := httpGetXApps(xapp.Config.GetString("xmurl"))
if alldata != nil && err1 == nil {
m.Lock()
@@ -224,7 +224,7 @@
xapp.Logger.Error(err.Error())
return err
}
- xapp.Logger.Debug("received XApp subscription data")
+ xapp.Logger.Debug("Received xApp subscription data")
addSubscription(&rtmgr.Subs, data)
xapp.Logger.Debug("Endpoints: %v", rtmgr.Eps)
updateEp()
@@ -252,12 +252,12 @@
}
if !subscriptionExists(data) {
- xapp.Logger.Warn("subscription not found: %d", *data.SubscriptionID)
- err := fmt.Errorf("subscription not found: %d", *data.SubscriptionID)
+ xapp.Logger.Warn("Subscription not found: %d", *data.SubscriptionID)
+ err := fmt.Errorf("Subscription not found: %d", *data.SubscriptionID)
return err
}
- xapp.Logger.Debug("received XApp subscription delete data")
+ xapp.Logger.Debug("Received xApp subscription delete data")
delSubscription(&rtmgr.Subs, data)
updateEp()
return sendRoutesToAll()
@@ -285,7 +285,7 @@
return err
}
}
- xapp.Logger.Debug("received XApp subscription Merge data")
+ xapp.Logger.Debug("Received XApp subscription Merge data")
updateSubscription(&xapplist)
updateEp()
return sendRoutesToAll()
@@ -306,7 +306,7 @@
}
//e2taddchan <- data
e2data, meiddata, _ := recvNewE2Tdata(data)
- xapp.Logger.Debug("received create New E2T data")
+ xapp.Logger.Debug("Received create New E2T data")
m.Lock()
sdlEngine.WriteNewE2TInstance(xapp.Config.GetString("rtfile"), e2data, meiddata)
m.Unlock()
@@ -349,7 +349,7 @@
xapp.Logger.Warn(" Association of RAN to E2T Instance data validation failed: " + err.Error())
return err
}
- xapp.Logger.Debug("received associate RAN list to E2T instance mapping from E2 Manager")
+ xapp.Logger.Debug("Received associate RAN list to E2T instance mapping from E2 Manager")
m.Lock()
sdlEngine.WriteAssRANToE2TInstance(xapp.Config.GetString("rtfile"), data)
m.Unlock()
@@ -365,7 +365,7 @@
xapp.Logger.Warn(" Disassociation of RAN List from E2T Instance data validation failed: " + err.Error())
return err
}
- xapp.Logger.Debug("received disassociate RANs from E2T instance")
+ xapp.Logger.Debug("Received disassociate RANs from E2T instance")
m.Lock()
sdlEngine.WriteDisAssRANFromE2TInstance(xapp.Config.GetString("rtfile"), data)
m.Unlock()
@@ -504,7 +504,7 @@
} else if err == nil {
readErr = errors.New("unexpected HTTP status code")
} else {
- xapp.Logger.Warn("cannot get xapp data due to: " + err.Error())
+ xapp.Logger.Warn("Cannot get xapp data due to: " + err.Error())
readErr = err
}
}
@@ -526,7 +526,7 @@
} else if err == nil {
readErr = errors.New("unexpected HTTP status code")
} else {
- xapp.Logger.Warn("cannot get E2T data from E2M due to: " + err.Error())
+ xapp.Logger.Warn("Cannot get E2T data from E2M due to: " + err.Error())
readErr = err
}
time.Sleep(2 * time.Second)
@@ -559,7 +559,7 @@
break
} else {
readErr = err
- xapp.Logger.Warn("cannot get xapp data due to: " + readErr.Error())
+ xapp.Logger.Warn("Cannot get xapp data due to: " + readErr.Error())
}
time.Sleep(2 * time.Second)
}
@@ -585,7 +585,7 @@
xapp.Logger.Info("Value of formed string = %s", formstring)
newstring := strings.Split(formstring, " ")
for i, _ := range newstring {
- xapp.Logger.Info("in Loop Value of formed string = %s", newstring)
+ xapp.Logger.Info("Value of formed string in loop = %s", newstring)
rtmgr.DynamicRouteList = append(rtmgr.DynamicRouteList, newstring[i])
}
}
@@ -666,7 +666,7 @@
subdata.SubscriptionID = &subs.SubID
subdata.Address = &subs.Fqdn
subdata.Port = &subs.Port
- xapp.Logger.Debug("Deletion Subscription List has %v", subdata)
+ xapp.Logger.Debug("Deleting Subscription List has %v", subdata)
delSubscription(&rtmgr.Subs, &subdata)
break
}
@@ -701,7 +701,7 @@
}
func Adddelrmrroute(routelist models.Routelist, rtflag bool) error {
- xapp.Logger.Info("Updating rmrroute with Route list: %v,flag: %v", routelist, rtflag)
+ xapp.Logger.Info("Updating rmr route with Route list: %v,flag: %v", routelist, rtflag)
for _, rlist := range routelist {
var subid int32
var data string
@@ -728,7 +728,7 @@
xapp.SdlStorage.Store(rtmgr.RTMGR_SDL_NS, "routes", routearray)
} else {
if err == true {
- xapp.Logger.Info("Successfully deleted route: %s", data)
+ xapp.Logger.Info("route %s deleted successfully", data)
routearray := strings.Join(rtmgr.DynamicRouteList, " ")
xapp.SdlStorage.Store(rtmgr.RTMGR_SDL_NS, "routes", routearray)
} else {
diff --git a/pkg/rpe/rmr.go b/pkg/rpe/rmr.go
index 8279e17..df7bb3f 100644
--- a/pkg/rpe/rmr.go
+++ b/pkg/rpe/rmr.go
@@ -182,6 +182,6 @@
}
func (r *RmrPush) GeneratePartialPolicies(eps rtmgr.Endpoints, xappSubData *models.XappSubscriptionData, updatetype rtmgr.RMRUpdateType) *[]string {
- xapp.Logger.Debug("Invoked rmr.GeneratePartialRMR, args: %v: ", eps)
+ xapp.Logger.Debug("Invoked rmr.GeneratePartialPolicies, args: %v: ", eps)
return r.generatePartialRMRPolicies(eps, xappSubData, "", updatetype)
}
diff --git a/pkg/rpe/rpe.go b/pkg/rpe/rpe.go
index a11baf8..60b5f83 100644
--- a/pkg/rpe/rpe.go
+++ b/pkg/rpe/rpe.go
@@ -107,7 +107,7 @@
pc, _, _, ok := runtime.Caller(1)
details := runtime.FuncForPC(pc)
if ok && details != nil {
- xapp.Logger.Error("Route addition skipped: Either TX or RX endpoint not present. Caller function is %s", details.Name())
+ xapp.Logger.Error("Addition of route skipped due to either TX or RX endpoint not present. Caller function is %s", details.Name())
}
} else {
if tx != nil {
@@ -125,8 +125,8 @@
SubID: subId,
RouteType: routeType}
*routeTable = append(*routeTable, route)
- // xapp.Logger.Debug("Route added: MessageTyp: %v, Tx: %v, Rx: %v, SubId: %v", messageId, tx.Uuid, rx.Uuid, subId)
- // xapp.Logger.Trace("Route added: MessageTyp: %v, Tx: %v, Rx: %v, SubId: %v", messageId, tx, rx, subId)
+ // xapp.Logger.Debug("Route added: MessageType: %v, Tx: %v, Rx: %v, SubId: %v", messageId, tx.Uuid, rx.Uuid, subId)
+ // xapp.Logger.Trace("Route added: MessageType: %v, Tx: %v, Rx: %v, SubId: %v", messageId, tx, rx, subId)
}
}
@@ -154,8 +154,8 @@
SubID: subId,
RouteType: routeType}
*routeTable = append(*routeTable, route)
- // xapp.Logger.Debug("Route added: MessageTyp: %v, Tx: %v, Rx: %v, SubId: %v", messageId, tx.Uuid, rx.Uuid, subId)
- // xapp.Logger.Trace("Route added: MessageTyp: %v, Tx: %v, Rx: %v, SubId: %v", messageId, tx, rx, subId)
+ // xapp.Logger.Debug("Route added: MessageType: %v, Tx: %v, Rx: %v, SubId: %v", messageId, tx.Uuid, rx.Uuid, SubId)
+ // xapp.Logger.Trace("Route added: MessageType: %v, Tx: %v, Rx: %v, SubId: %v", messageId, tx, rx, SubId)
}
func (r *Rpe) generateXappRoutes(xAppEp *rtmgr.Endpoint, subManEp *rtmgr.Endpoint, routeTable *rtmgr.RouteTable) {
diff --git a/pkg/sbi/nngpush.go b/pkg/sbi/nngpush.go
index ec4d25a..7ba43c5 100644
--- a/pkg/sbi/nngpush.go
+++ b/pkg/sbi/nngpush.go
@@ -49,7 +49,7 @@
var rmrcallid = 1
var rmrdynamiccallid = 201
var addendpointct = 1
-
+var count int
var conn sync.Mutex
type RmrPush struct {
@@ -96,7 +96,7 @@
time.Sleep(time.Duration(10) * time.Second)
ep.Whid = int(xapp.Rmr.Openwh(endpoint))
if ep.Whid < 0 {
- return errors.New("can't open warmhole connection for endpoint:" + ep.Uuid + " due to invalid Wormhole ID: " + string(ep.Whid) + " count: " + strconv.Itoa(count))
+ return errors.New("cannot open wormhole connection for endpoint:" + ep.Uuid + " due to invalid Wormhole ID: " + string(ep.Whid) + " count: " + strconv.Itoa(count))
}
} else {
xapp.Logger.Debug("Wormhole ID is %v and EP is %v", ep.Whid, endpoint)
@@ -144,7 +144,7 @@
if result[i].status == true {
count++
} else {
- xapp.Logger.Error("RMR send failed for endpoint %v", result[i].endpoint)
+ xapp.Logger.Error("RMR sent failed for endpoint %v", result[i].endpoint)
}
}
@@ -160,6 +160,15 @@
xapp.Logger.Debug("Push policy to endpoint: " + ep.Uuid)
ret := c.send_data(ep, policies, call_id)
+ for count = 0; count <= 2 && ret == false; count++ {
+ time.Sleep(time.Second)
+ ret := c.send_data(ep, policies, call_id)
+ if ret == true {
+ break
+ }
+ xapp.Logger.Error("Invoked send_data to try again due to return value : %v", ret)
+ }
+
conn.Lock()
rtmgr.RMRConnStatus[ep.Uuid] = ret
conn.Unlock()
diff --git a/pkg/sbi/sbi.go b/pkg/sbi/sbi.go
index 8833987..b65e778 100644
--- a/pkg/sbi/sbi.go
+++ b/pkg/sbi/sbi.go
@@ -103,7 +103,7 @@
Keepalive: true,
}
if err := sbi.AddEndpoint(ep); err != nil {
- xapp.Logger.Error("can't create socket for endpoint: " + ep.Name + " due to:" + err.Error())
+ xapp.Logger.Error("Cannot create socket for endpoint: " + ep.Name + " due to:" + err.Error())
continue
}
rtmgr.Eps[uuid] = ep
@@ -136,7 +136,7 @@
}
xapp.Logger.Debug("ep created: %v", ep)
if err := sbi.AddEndpoint(ep); err != nil {
- xapp.Logger.Error("can't create socket for endpoint: " + ep.Name + " due to:" + err.Error())
+ xapp.Logger.Error("Cannot create socket for endpoint: " + ep.Name + " due to:" + err.Error())
continue
}
rtmgr.Eps[uuid] = ep
@@ -168,7 +168,7 @@
}
xapp.Logger.Debug("ep created: %v", ep)
if err := sbi.AddEndpoint(ep); err != nil {
- xapp.Logger.Error("can't create socket for endpoint: " + ep.Name + " due to:" + err.Error())
+ xapp.Logger.Error("Cannot create socket for endpoint: " + ep.Name + " due to:" + err.Error())
continue
}
rtmgr.Eps[uuid] = ep
diff --git a/pkg/sdl/file.go b/pkg/sdl/file.go
index 28274fc..468fbd7 100644
--- a/pkg/sdl/file.go
+++ b/pkg/sdl/file.go
@@ -59,7 +59,7 @@
var rcs *rtmgr.RicComponents
jsonFile, err := os.Open(file)
if err != nil {
- return nil, errors.New("cannot open the file due to: " + err.Error())
+ return nil, errors.New("Cannot open the file due to: " + err.Error())
}
defer jsonFile.Close()
byteValue, err := ioutil.ReadAll(jsonFile)
@@ -76,12 +76,10 @@
}
func (f *File) WriteAll(file string, rcs *rtmgr.RicComponents) error {
- xapp.Logger.Debug("Invoked sdl.WriteAll")
- xapp.Logger.Debug("file.fileWriteAll writes into file: " + file)
- xapp.Logger.Debug("file.fileWriteAll writes data: %v", *rcs)
+ xapp.Logger.Debug("Invoked sdl.WriteAll:" + file + ", file.fileWriteAll writes data: %v", *rcs )
byteValue, err := json.Marshal(rcs)
if err != nil {
- return errors.New("cannot convert data due to: " + err.Error())
+ return errors.New("Cannot convert data due to: " + err.Error())
}
err = ioutil.WriteFile(file, byteValue, 0644)
if err != nil {
@@ -91,14 +89,12 @@
}
func (f *File) WriteXApps(file string, xApps *[]rtmgr.XApp) error {
- xapp.Logger.Debug("Invoked sdl.WriteXApps")
- xapp.Logger.Debug("file.fileWriteXApps writes into file: " + file)
- xapp.Logger.Debug("file.fileWriteXApps writes data: %v", *xApps)
+ xapp.Logger.Debug("Invoked sdl.WriteXApps: " + file + ", file.fileWriteXApps writes data: %v", *xApps )
ricData, err := NewFile().ReadAll(file)
if err != nil {
- xapp.Logger.Error("cannot get data from sdl interface due to: " + err.Error())
- return errors.New("cannot read full ric data to modify xApps data, due to: " + err.Error())
+ xapp.Logger.Error("Cannot get data from sdl interface due to: " + err.Error())
+ return errors.New("Cannot read full ric data to modify xApps data, due to: " + err.Error())
}
ricData.XApps = *xApps
@@ -114,14 +110,12 @@
}
func (f *File) WriteNewE2TInstance(file string, E2TInst *rtmgr.E2TInstance, meiddata string) error {
- xapp.Logger.Debug("Invoked sdl.WriteNewE2TInstance")
- xapp.Logger.Debug("file.WriteNewE2TInstance writes into file: " + file)
- xapp.Logger.Debug("file.WriteNewE2TInstance writes data: %v", *E2TInst)
+ xapp.Logger.Debug("Invoked sdl.WriteNewE2TInstance: " + file + ", file.WriteNewE2TInstance writes data: %v", *E2TInst )
ricData, err := NewFile().ReadAll(file)
- if err != nil {
- xapp.Logger.Error("cannot get data from sdl interface due to: " + err.Error())
- return errors.New("cannot read full ric data to modify xApps data, due to: " + err.Error())
+ if err != nil {
+ xapp.Logger.Error("Cannot get data from sdl interface due to: " + err.Error())
+ return errors.New("cannot read full ric data to modify xApps data due to: " + err.Error())
}
ricData.E2Ts[E2TInst.Fqdn] = *E2TInst
if len(meiddata) > 0 {
@@ -146,19 +140,17 @@
}
func (f *File) WriteAssRANToE2TInstance(file string, rane2tmap models.RanE2tMap) error {
- xapp.Logger.Debug("Invoked sdl.WriteAssRANToE2TInstance")
- xapp.Logger.Debug("file.WriteAssRANToE2TInstance writes into file: " + file)
- xapp.Logger.Debug("file.WriteAssRANToE2TInstance writes data: %v", rane2tmap)
+ xapp.Logger.Debug("Invoked sdl.WriteAssRANToE2TInstance: " + file + ", file.WriteAssRANToE2TInstance writes data: %v", rane2tmap)
ricData, err := NewFile().ReadAll(file)
if err != nil {
- xapp.Logger.Error("cannot get data from sdl interface due to: " + err.Error())
- return errors.New("cannot read full ric data to modify xApps data, due to: " + err.Error())
+ xapp.Logger.Error("Cannot get data from sdl interface due to: " + err.Error())
+ return errors.New("cannot read full ric data to modify xApps data due to: " + err.Error())
}
//ricData.MeidMap = []string{}
for _, element := range rane2tmap {
- xapp.Logger.Info("data received")
+ xapp.Logger.Info("Data received")
var str, meidar string
for _, meid := range element.RanNamelist {
meidar += meid + " "
@@ -188,20 +180,18 @@
}
func (f *File) WriteDisAssRANFromE2TInstance(file string, disassranmap models.RanE2tMap) error {
- xapp.Logger.Debug("Invoked sdl.WriteDisAssRANFromE2TInstance")
- xapp.Logger.Debug("file.WriteDisAssRANFromE2TInstance writes into file: " + file)
- xapp.Logger.Debug("file.WriteDisAssRANFromE2TInstance writes data: %v", disassranmap)
+ xapp.Logger.Debug("Invoked sdl.WriteDisAssRANFromE2TInstance: " + file + ",file.WriteDisAssRANFromE2TInstance writes data: %v", disassranmap)
ricData, err := NewFile().ReadAll(file)
if err != nil {
- xapp.Logger.Error("cannot get data from sdl interface due to: " + err.Error())
- return errors.New("cannot read full ric data to modify xApps data, due to: " + err.Error())
+ xapp.Logger.Error("Cannot get data from sdl interface due to: " + err.Error())
+ return errors.New("cannot read full ric data to modify xApps data due to: " + err.Error())
}
var str, meiddel, meiddisdel string
//ricData.MeidMap = []string{}
for _, element := range disassranmap {
- xapp.Logger.Info("data received")
+ xapp.Logger.Info("Data received")
for _, meid := range element.RanNamelist {
meiddisdel += meid + " "
}
@@ -255,14 +245,12 @@
}
func (f *File) WriteDeleteE2TInstance(file string, E2TInst *models.E2tDeleteData) error {
- xapp.Logger.Debug("Invoked sdl.WriteDeleteE2TInstance")
- xapp.Logger.Debug("file.WriteDeleteE2TInstance writes into file: " + file)
- xapp.Logger.Debug("file.WriteDeleteE2TInstance writes data: %v", *E2TInst)
+ xapp.Logger.Debug("Invoked sdl.WriteDeleteE2TInstance: " + file + ",file.WriteDeleteE2TInstance writes data: %v", *E2TInst)
ricData, err := NewFile().ReadAll(file)
if err != nil {
- xapp.Logger.Error("cannot get data from sdl interface due to: " + err.Error())
- return errors.New("cannot read full ric data to modify xApps data, due to: " + err.Error())
+ xapp.Logger.Error("Cannot get data from sdl interface due to: " + err.Error())
+ return errors.New("cannot read full ric data to modify xApps data due to: " + err.Error())
}
//ricData.MeidMap = []string{}
@@ -287,7 +275,7 @@
for _, element := range E2TInst.RanAssocList {
var str, meidar string
- xapp.Logger.Info("data received")
+ xapp.Logger.Info("Data received")
for _, meid := range element.RanNamelist {
meidar = meid + " "
}