[VOL-5544]:Optimising Logs in openolt adapter during flows configuration/deletion and olt activation
Change-Id: Icab6664e12af5317634d8cb6a02b1c2c93bd720a
Signed-off-by: balaji.nagarajan <balaji.nagarajan@radisys.com>
diff --git a/internal/pkg/core/device_handler.go b/internal/pkg/core/device_handler.go
index 7f26406..b8be44b 100755
--- a/internal/pkg/core/device_handler.go
+++ b/internal/pkg/core/device_handler.go
@@ -1856,7 +1856,7 @@
logger.Infow(ctx, "Child device still present ignoring discovery indication", log.Fields{"sn": sn})
return true, nil
}
- logger.Infow(ctx, "No device present in core , continuing with discovery", log.Fields{"sn": sn})
+ logger.Debugw(ctx, "No device present in core , continuing with discovery", log.Fields{"sn": sn})
return false, nil
} else {
@@ -1927,7 +1927,7 @@
// we know the processing has inProcess.
// Note that this is done after checking if we are already processing
// to avoid changing the value from a different thread
- logger.Infow(ctx, "onu-processing-completed", log.Fields{"sn": sn})
+ logger.Debugw(ctx, "onu-processing-completed", log.Fields{"sn": sn})
dh.discOnus.Store(sn, false)
}
}
@@ -2043,7 +2043,7 @@
"serial-number": sn}, error)
return error
}
- logger.Infow(ctx, "onu-child-device-added",
+ logger.Debugw(ctx, "onu-child-device-added",
log.Fields{"onuDevice": onuDevice,
"sn": sn,
"onu-id": onuID,
@@ -4602,7 +4602,7 @@
// TODO: Use a connection tracker such that the adapter connection is stopped when the last device that adapter
// supports is deleted
func (dh *DeviceHandler) setupChildInterAdapterClient(ctx context.Context, endpoint string) error {
- logger.Infow(ctx, "setting-child-adapter-connection", log.Fields{"child-endpoint": endpoint})
+ logger.Debugw(ctx, "setting-child-adapter-connection", log.Fields{"child-endpoint": endpoint})
dh.lockChildAdapterClients.Lock()
defer dh.lockChildAdapterClients.Unlock()
diff --git a/internal/pkg/core/openolt_flowmgr.go b/internal/pkg/core/openolt_flowmgr.go
index 2ffc7a6..134b095 100644
--- a/internal/pkg/core/openolt_flowmgr.go
+++ b/internal/pkg/core/openolt_flowmgr.go
@@ -261,7 +261,7 @@
// load interface to multicast queue map from kv store
flowMgr.grpMgr.LoadInterfaceToMulticastQueueMap(ctx)
- logger.Info(ctx, "initialization-of-flow-manager-success")
+ logger.Debugw(ctx, "initialization-of-flow-manager-success", log.Fields{"device-id": dh.device.Id})
return &flowMgr
}
@@ -563,7 +563,7 @@
return olterrors.NewErrAdapter("failed-to-create-traffic-schedulers-in-device", log.Fields{"TrafficScheds": TrafficSched}, err)
}
cancel()
- logger.Infow(ctx, "successfully-created-traffic-schedulers", log.Fields{
+ logger.Debugw(ctx, "successfully-created-traffic-schedulers", log.Fields{
"direction": sq.direction,
"traffic-queues": trafficQueues,
"device-id": f.deviceHandler.device.Id})
@@ -660,7 +660,7 @@
"traffic-queues": TrafficQueues,
"device-id": f.deviceHandler.device.Id}, err)
}
- logger.Infow(ctx, "removed-traffic-queues-successfully", log.Fields{"device-id": f.deviceHandler.device.Id, "trafficQueues": TrafficQueues})
+ logger.Debugw(ctx, "removed-traffic-queues-successfully", log.Fields{"device-id": f.deviceHandler.device.Id, "trafficQueues": TrafficQueues})
return err
}
@@ -790,7 +790,7 @@
"device-id": f.deviceHandler.device.Id,
"err": err})
} else {
- logger.Infow(ctx, "removed-traffic-queues-successfully", log.Fields{"device-id": f.deviceHandler.device.Id,
+ logger.Debugw(ctx, "removed-traffic-queues-successfully", log.Fields{"device-id": f.deviceHandler.device.Id,
"direction": sq.direction,
"intf-id": sq.intfID,
"onu-id": sq.onuID,
@@ -817,7 +817,7 @@
"device-id": f.deviceHandler.device.Id,
"err": err})
} else {
- logger.Infow(ctx, "removed-traffic-schedulers-successfully", log.Fields{"device-id": f.deviceHandler.device.Id,
+ logger.Debugw(ctx, "removed-traffic-schedulers-successfully", log.Fields{"device-id": f.deviceHandler.device.Id,
"direction": sq.direction,
"intf-id": sq.intfID,
"onu-id": sq.onuID,
@@ -849,7 +849,7 @@
// Check tech profile instance already exists for derived port name
techProfileInstance, _ := f.techprofile.GetTPInstance(ctx, tpPath)
if techProfileInstance == nil {
- logger.Infow(ctx, "tp-instance-not-found--creating-new",
+ logger.Debugw(ctx, "tp-instance-not-found--creating-new",
log.Fields{
"path": tpPath,
"device-id": f.deviceHandler.device.Id})
@@ -2128,7 +2128,7 @@
// nolint: gocyclo
func (f *OpenOltFlowMgr) clearFlowFromDeviceAndResourceManager(ctx context.Context, flow *ofp.OfpFlowStats, flowDirection string, nni_port uint32) error {
- logger.Infow(ctx, "clear-flow-from-resource-manager",
+ logger.Debugw(ctx, "clear-flow-from-resource-manager",
log.Fields{
"flowDirection": flowDirection,
"flow": *flow,
@@ -2212,7 +2212,7 @@
// RemoveFlow removes the flow from the device
func (f *OpenOltFlowMgr) RemoveFlow(ctx context.Context, flow *ofp.OfpFlowStats) error {
- logger.Infow(ctx, "removing-flow", log.Fields{"flow": *flow})
+ logger.Debugw(ctx, "removing-flow", log.Fields{"flow": *flow})
var direction string
actionInfo := make(map[string]interface{})
@@ -2302,7 +2302,7 @@
f.incomingFlows[onuID] <- flowCb
// Wait on the channel for flow handlers return value
err := <-errChan
- logger.Infow(ctx, "process-flow-received-resp", log.Fields{"err": err, "totalTimeSeconds": time.Since(startTime).Seconds()})
+ logger.Debugw(ctx, "process-flow-received-resp", log.Fields{"err": err, "totalTimeSeconds": time.Since(startTime).Seconds()})
return err
}
logger.Errorw(ctx, "flow handler routine not active for onu", log.Fields{"onuID": onuID, "ponPortIdx": f.ponPortIdx})
@@ -2319,17 +2319,17 @@
// process the flow completely before proceeding to handle the next flow
case flowCb = <-subscriberFlowChannel:
if flowCb.addFlow {
- logger.Info(flowCb.ctx, "adding-flow-start")
+ logger.Debug(flowCb.ctx, "adding-flow-start")
startTime := time.Now()
err := f.AddFlow(flowCb.ctx, flowCb.flow, flowCb.flowMetadata)
- logger.Infow(flowCb.ctx, "adding-flow-complete", log.Fields{"processTimeSecs": time.Since(startTime).Seconds()})
+ logger.Infow(flowCb.ctx, "adding-flow-complete", log.Fields{"processTimeSecs": time.Since(startTime).Seconds(), "flow": flowCb.flow})
// Pass the return value over the return channel
*flowCb.errChan <- err
} else {
- logger.Info(flowCb.ctx, "removing-flow-start")
+ logger.Debug(flowCb.ctx, "removing-flow-start")
startTime := time.Now()
err := f.RemoveFlow(flowCb.ctx, flowCb.flow)
- logger.Infow(flowCb.ctx, "removing-flow-complete", log.Fields{"processTimeSecs": time.Since(startTime).Seconds()})
+ logger.Infow(flowCb.ctx, "removing-flow-complete", log.Fields{"processTimeSecs": time.Since(startTime).Seconds(), "flow": flowCb.flow})
// Pass the return value over the return channel
*flowCb.errChan <- err
}
@@ -2408,7 +2408,7 @@
if ethType, ok := classifierInfo[EthType]; ok {
if ethType.(uint32) == LldpEthType {
- logger.Info(ctx, "adding-lldp-flow")
+ logger.Debug(ctx, "adding-lldp-flow")
return f.addLLDPFlow(ctx, flow, portNo)
}
if ethType.(uint32) == PPPoEDEthType {
@@ -2582,7 +2582,7 @@
"onu-id": onuDev.deviceID,
"proxyDeviceID": onuDev.proxyDeviceID}, err)
}
- logger.Infow(ctx, "success-sending-load-tech-profile-request-to-brcm-onu-adapter", log.Fields{"tpid": TpID})
+ logger.Debugw(ctx, "success-sending-load-tech-profile-request-to-brcm-onu-adapter", log.Fields{"tpid": TpID})
return nil
}
diff --git a/internal/pkg/core/openolt_groupmgr.go b/internal/pkg/core/openolt_groupmgr.go
index f2456ac..f52c481 100644
--- a/internal/pkg/core/openolt_groupmgr.go
+++ b/internal/pkg/core/openolt_groupmgr.go
@@ -55,7 +55,7 @@
grpMgr.resourceMgr = rMgr
grpMgr.interfaceToMcastQueueMap = make(map[uint32]*QueueInfoBrief)
grpMgr.interfaceToMcastQueueMapLock = sync.RWMutex{}
- logger.Info(ctx, "initialization-of-group-manager-success")
+ logger.Debugw(ctx, "initialization-of-group-manager-success", log.Fields{"device-id": dh.device.Id})
return &grpMgr
}
diff --git a/internal/pkg/resourcemanager/resourcemanager.go b/internal/pkg/resourcemanager/resourcemanager.go
index f5b3f12..96245ca 100644
--- a/internal/pkg/resourcemanager/resourcemanager.go
+++ b/internal/pkg/resourcemanager/resourcemanager.go
@@ -269,7 +269,7 @@
if err := ResourceMgr.LoadLocalCacheFromKVStore(ctx); err != nil {
logger.Error(ctx, "failed-to-load-local-cache-from-kvstore")
}
- logger.Info(ctx, "Initialization of resource manager success!")
+ logger.Infow(ctx, "Initialization of resource manager success!", log.Fields{"device-id": deviceID})
return &ResourceMgr
}