[VOL-2930] Changed log behaviour for openolt adapter
Change-Id: Ia5256e66a30504d8c62196cead9d401016a1fbc6
diff --git a/VERSION b/VERSION
index 037b009..7bf4b6a 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.4.6-dev
+2.4.6
diff --git a/internal/pkg/core/olt_platform.go b/internal/pkg/core/olt_platform.go
index 0c2c777..b5e8f36 100644
--- a/internal/pkg/core/olt_platform.go
+++ b/internal/pkg/core/olt_platform.go
@@ -126,7 +126,7 @@
func MkUniPortNum(intfID, onuID, uniID uint32) uint32 {
var limit = int(onuID)
if limit > MaxOnusPerPon {
- logger.Warn("Warning: exceeded the MAX ONUS per PON")
+ logger.Warn("exceeded-the-max-onus-per-pon")
}
return (intfID << (bitsForUniID + bitsForONUID)) | (onuID << bitsForUniID) | uniID
}
@@ -171,7 +171,7 @@
//IntfIDFromNniPortNum returns Intf ID derived from portNum
func IntfIDFromNniPortNum(portNum uint32) (uint32, error) {
if portNum < minNniIntPortNum || portNum > maxNniPortNum {
- logger.Errorw("NNIPortNumber is not in valid range", log.Fields{"portNum": portNum})
+ logger.Errorw("nniportnumber-is-not-in-valid-range", log.Fields{"portnum": portNum})
return uint32(0), olterrors.ErrInvalidPortRange
}
return (portNum & 0xFFFF), nil
@@ -261,17 +261,21 @@
}
if uniPortNo == 0 {
- return 0, 0, 0, 0, 0, 0, olterrors.NewErrNotFound("pon-interface", log.Fields{
- "flow-direction": flowDirection}, nil)
+ return 0, 0, 0, 0, 0, 0, olterrors.NewErrNotFound("pon-interface", log.Fields{"flow-direction": flowDirection}, nil)
}
ponIntf = IntfIDFromUniPortNum(uniPortNo)
onuID = OnuIDFromUniPortNum(uniPortNo)
uniID = UniIDFromPortNum(uniPortNo)
- logger.Debugw("flow extract info result",
- log.Fields{"uniPortNo": uniPortNo, "ponIntf": ponIntf,
- "onuID": onuID, "uniID": uniID, "inPort": inPort, "ethType": ethType})
+ logger.Debugw("flow-extract-info-result",
+ log.Fields{
+ "uniportno": uniPortNo,
+ "pon-intf": ponIntf,
+ "onu-id": onuID,
+ "uni-id": uniID,
+ "inport": inPort,
+ "ethtype": ethType})
return uniPortNo, ponIntf, onuID, uniID, inPort, ethType, nil
}
diff --git a/internal/pkg/core/olt_state_transitions.go b/internal/pkg/core/olt_state_transitions.go
index 6572339..cd6df1d 100644
--- a/internal/pkg/core/olt_state_transitions.go
+++ b/internal/pkg/core/olt_state_transitions.go
@@ -149,14 +149,17 @@
// Check whether the transtion is valid from current state
if !tMap.isValidTransition(trigger) {
- logger.Errorw("Invalid transition triggered ", log.Fields{"CurrentState": tMap.currentDeviceState, "Trigger": trigger})
+ logger.Errorw("invalid-transition-triggered",
+ log.Fields{
+ "current-state": tMap.currentDeviceState,
+ "trigger": trigger})
return
}
// Invoke the before handlers
beforeHandlers := tMap.transitions[trigger].before
if beforeHandlers == nil {
- logger.Debugw("No handlers for before", log.Fields{"trigger": trigger})
+ logger.Debugw("no-handlers-for-before", log.Fields{"trigger": trigger})
}
for _, handler := range beforeHandlers {
logger.Debugw("running-before-handler", log.Fields{"handler": funcName(handler)})
@@ -169,12 +172,12 @@
// Update the state
tMap.currentDeviceState = tMap.transitions[trigger].currentState
- logger.Debugw("Updated device state ", log.Fields{"CurrentDeviceState": tMap.currentDeviceState})
+ logger.Debugw("updated-device-state ", log.Fields{"current-device-state": tMap.currentDeviceState})
// Invoke the after handlers
afterHandlers := tMap.transitions[trigger].after
if afterHandlers == nil {
- logger.Debugw("No handlers for after", log.Fields{"trigger": trigger})
+ logger.Debugw("no-handlers-for-after", log.Fields{"trigger": trigger})
}
for _, handler := range afterHandlers {
logger.Debugw("running-after-handler", log.Fields{"handler": funcName(handler)})
diff --git a/internal/pkg/core/openolt_eventmgr.go b/internal/pkg/core/openolt_eventmgr.go
index 8db576f..a692aef 100644
--- a/internal/pkg/core/openolt_eventmgr.go
+++ b/internal/pkg/core/openolt_eventmgr.go
@@ -106,58 +106,58 @@
var err error
switch alarmInd.Data.(type) {
case *oop.AlarmIndication_LosInd:
- logger.Debugw("Received LOS indication", log.Fields{"alarm_ind": alarmInd})
+ logger.Debugw("received-los-indication", log.Fields{"alarm-ind": alarmInd})
err = em.oltLosIndication(alarmInd.GetLosInd(), deviceID, raisedTs)
case *oop.AlarmIndication_OnuAlarmInd:
- logger.Debugw("Received onu alarm indication ", log.Fields{"alarm_ind": alarmInd})
+ logger.Debugw("received-onu-alarm-indication ", log.Fields{"alarm-ind": alarmInd})
err = em.onuAlarmIndication(alarmInd.GetOnuAlarmInd(), deviceID, raisedTs)
case *oop.AlarmIndication_DyingGaspInd:
- logger.Debugw("Received dying gasp indication", log.Fields{"alarm_ind": alarmInd})
+ logger.Debugw("received-dying-gasp-indication", log.Fields{"alarm-ind": alarmInd})
err = em.onuDyingGaspIndication(alarmInd.GetDyingGaspInd(), deviceID, raisedTs)
case *oop.AlarmIndication_OnuActivationFailInd:
- logger.Debugw("Received onu activation fail indication ", log.Fields{"alarm_ind": alarmInd})
+ logger.Debugw("received-onu-activation-fail-indication ", log.Fields{"alarm-ind": alarmInd})
err = em.onuActivationFailIndication(alarmInd.GetOnuActivationFailInd(), deviceID, raisedTs)
case *oop.AlarmIndication_OnuLossOmciInd:
- logger.Debugw("Received onu loss omci indication ", log.Fields{"alarm_ind": alarmInd})
+ logger.Debugw("received-onu-loss-omci-indication ", log.Fields{"alarm-ind": alarmInd})
err = em.onuLossOmciIndication(alarmInd.GetOnuLossOmciInd(), deviceID, raisedTs)
case *oop.AlarmIndication_OnuDriftOfWindowInd:
- logger.Debugw("Received onu drift of window indication ", log.Fields{"alarm_ind": alarmInd})
+ logger.Debugw("received-onu-drift-of-window-indication ", log.Fields{"alarm-ind": alarmInd})
err = em.onuDriftOfWindowIndication(alarmInd.GetOnuDriftOfWindowInd(), deviceID, raisedTs)
case *oop.AlarmIndication_OnuSignalDegradeInd:
- logger.Debugw("Received onu signal degrade indication ", log.Fields{"alarm_ind": alarmInd})
+ logger.Debugw("received-onu-signal-degrade-indication ", log.Fields{"alarm-ind": alarmInd})
err = em.onuSignalDegradeIndication(alarmInd.GetOnuSignalDegradeInd(), deviceID, raisedTs)
case *oop.AlarmIndication_OnuSignalsFailInd:
- logger.Debugw("Received onu signal fail indication ", log.Fields{"alarm_ind": alarmInd})
+ logger.Debugw("received-onu-signal-fail-indication ", log.Fields{"alarm-ind": alarmInd})
err = em.onuSignalsFailIndication(alarmInd.GetOnuSignalsFailInd(), deviceID, raisedTs)
case *oop.AlarmIndication_OnuStartupFailInd:
- logger.Debugw("Received onu startup fail indication ", log.Fields{"alarm_ind": alarmInd})
+ logger.Debugw("received-onu-startup-fail-indication ", log.Fields{"alarm-ind": alarmInd})
err = em.onuStartupFailedIndication(alarmInd.GetOnuStartupFailInd(), deviceID, raisedTs)
case *oop.AlarmIndication_OnuTiwiInd:
- logger.Debugw("Received onu transmission warning indication ", log.Fields{"alarm_ind": alarmInd})
- logger.Debugw("Not implemented yet", log.Fields{"alarm_ind": "Onu-Transmission-indication"})
+ logger.Debugw("received-onu-transmission-warning-indication ", log.Fields{"alarm-ind": alarmInd})
+ logger.Warnw("not-implemented-yet", log.Fields{"alarm-ind": "Onu-Transmission-indication"})
case *oop.AlarmIndication_OnuLossOfSyncFailInd:
- logger.Debugw("Received onu Loss of Sync Fail indication ", log.Fields{"alarm_ind": alarmInd})
+ logger.Debugw("received-onu-loss-of-sync-fail-indication ", log.Fields{"alarm-ind": alarmInd})
err = em.onuLossOfSyncIndication(alarmInd.GetOnuLossOfSyncFailInd(), deviceID, raisedTs)
case *oop.AlarmIndication_OnuItuPonStatsInd:
- logger.Debugw("Received onu Itu Pon Stats indication ", log.Fields{"alarm_ind": alarmInd})
- logger.Debugw("Not implemented yet", log.Fields{"alarm_ind": alarmInd})
+ logger.Debugw("received-onu-itu-pon-stats-indication ", log.Fields{"alarm-ind": alarmInd})
+ logger.Warnw("not-implemented-yet", log.Fields{"alarm-ind": alarmInd})
case *oop.AlarmIndication_OnuRemoteDefectInd:
- logger.Debugw("Received onu remote defect indication ", log.Fields{"alarm_ind": alarmInd})
+ logger.Debugw("received-onu-remote-defect-indication ", log.Fields{"alarm-ind": alarmInd})
err = em.onuRemoteDefectIndication(alarmInd.GetOnuRemoteDefectInd(), deviceID, raisedTs)
case *oop.AlarmIndication_OnuDeactivationFailureInd:
- logger.Debugw("Received onu deactivation failure indication ", log.Fields{"alarm_ind": alarmInd})
+ logger.Debugw("received-onu-deactivation-failure-indication ", log.Fields{"alarm-ind": alarmInd})
err = em.onuDeactivationFailureIndication(alarmInd.GetOnuDeactivationFailureInd(), deviceID, raisedTs)
case *oop.AlarmIndication_OnuLossGemDelineationInd:
- logger.Debugw("Received onu loss of GEM channel delineation indication ", log.Fields{"alarm_ind": alarmInd})
+ logger.Debugw("received-onu-loss-of-gem-channel-delineation-indication ", log.Fields{"alarm-ind": alarmInd})
err = em.onuLossOfGEMChannelDelineationIndication(alarmInd.GetOnuLossGemDelineationInd(), deviceID, raisedTs)
case *oop.AlarmIndication_OnuPhysicalEquipmentErrorInd:
- logger.Debugw("Received onu physical equipment error indication ", log.Fields{"alarm_ind": alarmInd})
+ logger.Debugw("received-onu-physical-equipment-error-indication ", log.Fields{"alarm-ind": alarmInd})
err = em.onuPhysicalEquipmentErrorIndication(alarmInd.GetOnuPhysicalEquipmentErrorInd(), deviceID, raisedTs)
case *oop.AlarmIndication_OnuLossOfAckInd:
- logger.Debugw("Received onu loss of acknowledgement indication ", log.Fields{"alarm_ind": alarmInd})
+ logger.Debugw("received-onu-loss-of-acknowledgement-indication ", log.Fields{"alarm-ind": alarmInd})
err = em.onuLossOfAcknowledgementIndication(alarmInd.GetOnuLossOfAckInd(), deviceID, raisedTs)
case *oop.AlarmIndication_OnuDiffReachExceededInd:
- logger.Debugw("Received onu differential reach exceeded indication ", log.Fields{"alarm_ind": alarmInd})
+ logger.Debugw("received-onu-differential-reach-exceeded-indication ", log.Fields{"alarm-ind": alarmInd})
err = em.onuDifferentialReachExceededIndication(alarmInd.GetOnuDiffReachExceededInd(), deviceID, raisedTs)
default:
err = olterrors.NewErrInvalidValue(log.Fields{"indication-type": alarmInd}, nil)
@@ -186,7 +186,7 @@
if err := em.eventProxy.SendDeviceEvent(&de, communication, olt, raisedTs); err != nil {
return olterrors.NewErrCommunication("send-olt-event", log.Fields{"device-id": deviceID}, err)
}
- logger.Debugw("OLT UpDown event sent to KAFKA", log.Fields{})
+ logger.Debugw("olt-updown-event-sent-to-kafka", log.Fields{})
return nil
}
@@ -204,9 +204,15 @@
de.DeviceEventName = fmt.Sprintf("%s_%s", onuDiscoveryEvent, "RAISE_EVENT")
/* Send event to KAFKA */
if err := em.eventProxy.SendDeviceEvent(&de, equipment, pon, raisedTs); err != nil {
- return olterrors.NewErrCommunication("send-onu-discovery-event", log.Fields{"serial-number": serialNumber, "intf-id": onuDisc.IntfId}, err)
+ return olterrors.NewErrCommunication("send-onu-discovery-event",
+ log.Fields{
+ "serial-number": serialNumber,
+ "intf-id": onuDisc.IntfId}, err)
}
- logger.Debugw("ONU discovery event sent to KAFKA", log.Fields{"serial-number": serialNumber, "intf-id": onuDisc.IntfId})
+ logger.Debugw("onu-discovery-event-sent-to-kafka",
+ log.Fields{
+ "serial-number": serialNumber,
+ "intf-id": onuDisc.IntfId})
return nil
}
@@ -249,7 +255,7 @@
if err := em.eventProxy.SendDeviceEvent(&de, communication, olt, raisedTs); err != nil {
return err
}
- logger.Debugw("OLT LOS event sent to KAFKA", log.Fields{"intf-id": oltLos.IntfId})
+ logger.Debugw("olt-los-event-sent-to-kafka", log.Fields{"intf-id": oltLos.IntfId})
return nil
}
@@ -274,7 +280,7 @@
if err := em.eventProxy.SendDeviceEvent(&de, communication, pon, raisedTs); err != nil {
return err
}
- logger.Debugw("ONU dying gasp event sent to KAFKA", log.Fields{"intf-id": dgi.IntfId})
+ logger.Debugw("onu-dying-gasp-event-sent-to-kafka", log.Fields{"intf-id": dgi.IntfId})
return nil
}
@@ -396,7 +402,7 @@
if err := em.eventProxy.SendDeviceEvent(&de, communication, onu, raisedTs); err != nil {
return err
}
- logger.Debugw("ONU LOS event sent to KAFKA", log.Fields{"onu-id": onuAlarm.OnuId, "intf-id": onuAlarm.IntfId})
+ logger.Debugw("onu-los-event-sent-to-kafka", log.Fields{"onu-id": onuAlarm.OnuId, "intf-id": onuAlarm.IntfId})
return nil
}
@@ -415,7 +421,7 @@
if err := em.eventProxy.SendDeviceEvent(&de, equipment, pon, raisedTs); err != nil {
return err
}
- logger.Debugw("ONU activation failure event sent to KAFKA", log.Fields{"onu-id": oaf.OnuId, "intf-id": oaf.IntfId})
+ logger.Debugw("onu-activation-failure-event-sent-to-kafka", log.Fields{"onu-id": oaf.OnuId, "intf-id": oaf.IntfId})
return nil
}
@@ -437,7 +443,7 @@
if err := em.eventProxy.SendDeviceEvent(&de, communication, pon, raisedTs); err != nil {
return err
}
- logger.Debugw("ONU loss of OMCI channel event sent to KAFKA", log.Fields{"onu-id": onuLossOmci.OnuId, "intf-id": onuLossOmci.IntfId})
+ logger.Debugw("onu-loss-of-omci-channel-event-sent-to-kafka", log.Fields{"onu-id": onuLossOmci.OnuId, "intf-id": onuLossOmci.IntfId})
return nil
}
@@ -461,7 +467,7 @@
if err := em.eventProxy.SendDeviceEvent(&de, communication, pon, raisedTs); err != nil {
return err
}
- logger.Debugw("ONU drift of window event sent to KAFKA", log.Fields{"onu-id": onuDriftWindow.OnuId, "intf-id": onuDriftWindow.IntfId})
+ logger.Debugw("onu-drift-of-window-event-sent-to-kafka", log.Fields{"onu-id": onuDriftWindow.OnuId, "intf-id": onuDriftWindow.IntfId})
return nil
}
@@ -484,7 +490,7 @@
if err := em.eventProxy.SendDeviceEvent(&de, communication, pon, raisedTs); err != nil {
return err
}
- logger.Debugw("ONU signal degrade event sent to KAFKA", log.Fields{"onu-id": onuSignalDegrade.OnuId, "intf-id": onuSignalDegrade.IntfId})
+ logger.Debugw("onu-signal-degrade-event-sent-to-kafka", log.Fields{"onu-id": onuSignalDegrade.OnuId, "intf-id": onuSignalDegrade.IntfId})
return nil
}
@@ -507,7 +513,7 @@
if err := em.eventProxy.SendDeviceEvent(&de, communication, pon, raisedTs); err != nil {
return err
}
- logger.Debugw("ONU signals fail event sent to KAFKA", log.Fields{"onu-id": onuSignalsFail.OnuId, "intf-id": onuSignalsFail.IntfId})
+ logger.Debugw("onu-signals-fail-event-sent-to-kafka", log.Fields{"onu-id": onuSignalsFail.OnuId, "intf-id": onuSignalsFail.IntfId})
return nil
}
@@ -530,7 +536,7 @@
if err := em.eventProxy.SendDeviceEvent(&de, communication, pon, raisedTs); err != nil {
return err
}
- logger.Debugw("ONU startup fail event sent to KAFKA", log.Fields{"onu-id": onuStartupFail.OnuId, "intf-id": onuStartupFail.IntfId})
+ logger.Debugw("onu-startup-fail-event-sent-to-kafka", log.Fields{"onu-id": onuStartupFail.OnuId, "intf-id": onuStartupFail.IntfId})
return nil
}
@@ -553,7 +559,7 @@
if err := em.eventProxy.SendDeviceEvent(&de, security, onu, raisedTs); err != nil {
return err
}
- logger.Debugw("ONU loss of key sync event sent to KAFKA", log.Fields{"onu-id": onuLOKI.OnuId, "intf-id": onuLOKI.IntfId})
+ logger.Debugw("onu-loss-of-key-sync-event-sent-to-kafka", log.Fields{"onu-id": onuLOKI.OnuId, "intf-id": onuLOKI.IntfId})
return nil
}
@@ -564,13 +570,13 @@
portID := IntfIDToPortNo(ifindication.IntfId, voltha.Port_PON_OLT)
device, err := em.handler.coreProxy.GetDevice(ctx.Background(), deviceID, deviceID)
if err != nil {
- return olterrors.NewErrAdapter("Error while fetching Device object", log.Fields{"DeviceId": deviceID}, err)
+ return olterrors.NewErrAdapter("error-while-fetching-device-object", log.Fields{"DeviceId": deviceID}, err)
}
for _, port := range device.Ports {
if port.PortNo == portID {
// Events are suppressed if the Port Adminstate is not enabled.
if port.AdminState != common.AdminState_ENABLED {
- logger.Debugw("Port disable/enable event not generated because, The port is not enabled by operator", log.Fields{"deviceId": deviceID, "port": port})
+ logger.Debugw("port-disable/enable-event-not-generated--the-port-is-not-enabled-by-operator", log.Fields{"deviceId": deviceID, "port": port})
return nil
}
break
@@ -611,7 +617,7 @@
if err := em.eventProxy.SendDeviceEvent(&de, equipment, onu, raisedTs); err != nil {
return err
}
- logger.Debugw("ONU deactivation failure event sent to KAFKA", log.Fields{"onu-id": onuDFI.OnuId, "intf-id": onuDFI.IntfId})
+ logger.Debugw("onu-deactivation-failure-event-sent-to-kafka", log.Fields{"onu-id": onuDFI.OnuId, "intf-id": onuDFI.IntfId})
return nil
}
@@ -632,7 +638,7 @@
if err := em.eventProxy.SendDeviceEvent(de, equipment, onu, raisedTs); err != nil {
return err
}
- logger.Debugw("ONU remote defect event sent to KAFKA", log.Fields{"onu-id": onuRDI.OnuId, "intf-id": onuRDI.IntfId})
+ logger.Debugw("onu-remote-defect-event-sent-to-kafka", log.Fields{"onu-id": onuRDI.OnuId, "intf-id": onuRDI.IntfId})
return nil
}
@@ -657,7 +663,7 @@
if err := em.eventProxy.SendDeviceEvent(de, communication, onu, raisedTs); err != nil {
return err
}
- logger.Debugw("ONU loss of GEM channel delineation event sent to KAFKA", log.Fields{"onu-id": onuGCD.OnuId, "intf-id": onuGCD.IntfId})
+ logger.Debugw("onu-loss-of-gem-channel-delineation-event-sent-to-kafka", log.Fields{"onu-id": onuGCD.OnuId, "intf-id": onuGCD.IntfId})
return nil
}
@@ -681,7 +687,7 @@
if err := em.eventProxy.SendDeviceEvent(de, equipment, onu, raisedTs); err != nil {
return err
}
- logger.Debugw("ONU physical equipment error event sent to KAFKA", log.Fields{"onu-id": onuErr.OnuId, "intf-id": onuErr.IntfId})
+ logger.Debugw("onu-physical-equipment-error-event-sent-to-kafka", log.Fields{"onu-id": onuErr.OnuId, "intf-id": onuErr.IntfId})
return nil
}
@@ -705,7 +711,7 @@
if err := em.eventProxy.SendDeviceEvent(de, equipment, onu, raisedTs); err != nil {
return err
}
- logger.Debugw("ONU physical equipment error event sent to KAFKA", log.Fields{"onu-id": onuLOA.OnuId, "intf-id": onuLOA.IntfId})
+ logger.Debugw("onu-physical-equipment-error-event-sent-to-kafka", log.Fields{"onu-id": onuLOA.OnuId, "intf-id": onuLOA.IntfId})
return nil
}
@@ -730,6 +736,6 @@
if err := em.eventProxy.SendDeviceEvent(de, equipment, onu, raisedTs); err != nil {
return err
}
- log.Debugw("ONU differential reach exceeded event sent to KAFKA", log.Fields{"onu-id": onuDRE.OnuId, "intf-id": onuDRE.IntfId})
+ log.Debugw("onu-differential-reach-exceeded–event-sent-to-kafka", log.Fields{"onu-id": onuDRE.OnuId, "intf-id": onuDRE.IntfId})
return nil
}
diff --git a/internal/pkg/core/openolt_flowmgr.go b/internal/pkg/core/openolt_flowmgr.go
index 0031887..7fce2f3 100644
--- a/internal/pkg/core/openolt_flowmgr.go
+++ b/internal/pkg/core/openolt_flowmgr.go
@@ -227,7 +227,7 @@
//NewFlowManager creates OpenOltFlowMgr object and initializes the parameters
func NewFlowManager(ctx context.Context, dh *DeviceHandler, rMgr *rsrcMgr.OpenOltResourceMgr) *OpenOltFlowMgr {
- logger.Infow("Initializing flow manager", log.Fields{"deviceId": dh.device.Id})
+ logger.Infow("initializing-flow-manager", log.Fields{"device-id": dh.device.Id})
var flowMgr OpenOltFlowMgr
var err error
var idx uint32
@@ -236,7 +236,7 @@
flowMgr.resourceMgr = rMgr
flowMgr.techprofile = make(map[uint32]tp.TechProfileIf)
if err = flowMgr.populateTechProfilePerPonPort(); err != nil {
- logger.Errorw("Error while populating tech profile mgr", log.Fields{"error": err})
+ logger.Errorw("error-while-populating-tech-profile-mgr", log.Fields{"error": err})
return nil
}
flowMgr.onuIdsLock = sync.RWMutex{}
@@ -247,7 +247,7 @@
//Load the onugem info cache from kv store on flowmanager start
for idx = 0; idx < ponPorts; idx++ {
if flowMgr.onuGemInfo[idx], err = rMgr.GetOnuGemInfo(ctx, idx); err != nil {
- logger.Error("Failed to load onu gem info cache")
+ logger.Error("failed-to-load-onu-gem-info-cache")
}
//Load flowID list per gem map per interface from the kvstore.
flowMgr.loadFlowIDlistForGem(ctx, idx)
@@ -258,19 +258,19 @@
flowMgr.interfaceToMcastQueueMap = make(map[uint32]*queueInfoBrief)
//load interface to multicast queue map from kv store
flowMgr.loadInterfaceToMulticastQueueMap(ctx)
- logger.Info("Initialization of flow manager success!!")
+ logger.Info("initialization-of-flow-manager-success")
return &flowMgr
}
func (f *OpenOltFlowMgr) generateStoredFlowID(flowID uint32, direction string) (uint64, error) {
if direction == Upstream {
- logger.Debug("upstream flow, shifting id")
+ logger.Debugw("upstream-flow-shifting-id", log.Fields{"device-id": f.deviceHandler.device.Id})
return 0x1<<15 | uint64(flowID), nil
} else if direction == Downstream {
- logger.Debug("downstream flow, not shifting id")
+ logger.Debugw("downstream-flow-not-shifting-id", log.Fields{"device-id": f.deviceHandler.device.Id})
return uint64(flowID), nil
} else if direction == Multicast {
- logger.Debug("multicast flow, shifting id")
+ logger.Debugw("multicast-flow-shifting-id", log.Fields{"device-id": f.deviceHandler.device.Id})
return 0x2<<15 | uint64(flowID), nil
} else {
return 0, olterrors.NewErrInvalidValue(log.Fields{"direction": direction}, nil).Log()
@@ -278,8 +278,10 @@
}
func (f *OpenOltFlowMgr) registerFlow(ctx context.Context, flowFromCore *ofp.OfpFlowStats, deviceFlow *openoltpb2.Flow) {
- logger.Debug("Registering Flow for Device ", log.Fields{"flow": flowFromCore},
- log.Fields{"device": f.deviceHandler.device.Id})
+ logger.Debugw("registering-flow-for-device ",
+ log.Fields{
+ "flow": flowFromCore,
+ "device-id": f.deviceHandler.device.Id})
gemPK := gemPortKey{uint32(deviceFlow.AccessIntfId), uint32(deviceFlow.GemportId)}
flowIDList, ok := f.flowsUsedByGemPort[gemPK]
if !ok {
@@ -299,28 +301,47 @@
var TpInst *tp.TechProfile
logger.Infow("dividing-flow", log.Fields{
- "deviceId": f.deviceHandler.device.Id,
- "intfId": intfID, "onuId": onuID, "uniId": uniID, "portNo": portNo,
+ "device-id": f.deviceHandler.device.Id,
+ "intf-id": intfID,
+ "onu-id": onuID,
+ "uni-id": uniID,
+ "port-no": portNo,
"classifier": classifierInfo,
- "action": actionInfo, "UsMeterID": UsMeterID, "DsMeterID": DsMeterID, "TpID": TpID})
+ "action": actionInfo,
+ "usmeter-iD": UsMeterID,
+ "dsmeter-iD": DsMeterID,
+ "tp-id": TpID})
// only create tcont/gemports if there is actually an onu id. otherwise BAL throws an error. Usually this
// is because the flow is an NNI flow and there would be no onu resources associated with it
// TODO: properly deal with NNI flows
if onuID <= 0 {
- logger.Errorw("No onu id for flow", log.Fields{"portNo": portNo, "classifer": classifierInfo, "action": actionInfo})
+ logger.Errorw("no-onu-id-for-flow",
+ log.Fields{
+ "port-no": portNo,
+ "classifer": classifierInfo,
+ "action": actionInfo,
+ "device-id": f.deviceHandler.device.Id})
return
}
uni := getUniPortPath(f.deviceHandler.device.Id, intfID, int32(onuID), int32(uniID))
- logger.Debugw("uni-port-path", log.Fields{"uni": uni, "deviceId": f.deviceHandler.device.Id})
+ logger.Debugw("uni-port-path", log.Fields{
+ "uni": uni,
+ "device-id": f.deviceHandler.device.Id})
tpLockMapKey := tpLockKey{intfID, onuID, uniID}
if f.perUserFlowHandleLock.TryLock(tpLockMapKey) {
logger.Debugw("dividing-flow-create-tcont-gem-ports", log.Fields{
- "deviceId": f.deviceHandler.device.Id,
- "intfId": intfID, "onuId": onuID, "uniId": uniID, "portNo": portNo,
+ "device-id": f.deviceHandler.device.Id,
+ "intf-id": intfID,
+ "onu-id": onuID,
+ "uni-id": uniID,
+ "port-no": portNo,
"classifier": classifierInfo,
- "action": actionInfo, "UsMeterID": UsMeterID, "DsMeterID": DsMeterID, "TpID": TpID})
+ "action": actionInfo,
+ "usmeter-id": UsMeterID,
+ "dsmeter-id": DsMeterID,
+ "tp-id": TpID})
allocID, gemPorts, TpInst = f.createTcontGemports(ctx, intfID, onuID, uniID, uni, portNo, TpID, UsMeterID, DsMeterID, flowMetadata)
if allocID == 0 || gemPorts == nil || TpInst == nil {
logger.Error("alloc-id-gem-ports-tp-unavailable")
@@ -341,7 +362,11 @@
f.perUserFlowHandleLock.Unlock(tpLockMapKey)
} else {
logger.Errorw("failed-to-acquire-per-user-flow-handle-lock",
- log.Fields{"intfId": intfID, "onuId": onuID, "uniId": uniID})
+ log.Fields{
+ "intf-id": intfID,
+ "onu-id": onuID,
+ "uni-id": uniID,
+ "device-id": f.deviceHandler.device.Id})
return
}
}
@@ -349,9 +374,16 @@
// CreateSchedulerQueues creates traffic schedulers on the device with the given scheduler configuration and traffic shaping info
func (f *OpenOltFlowMgr) CreateSchedulerQueues(ctx context.Context, sq schedQueue) error {
- logger.Debugw("CreateSchedulerQueues", log.Fields{"Dir": sq.direction, "IntfID": sq.intfID,
- "OnuID": sq.onuID, "UniID": sq.uniID, "TpID": sq.tpID, "MeterID": sq.meterID,
- "TpInst": sq.tpInst, "flowMetadata": sq.flowMetadata})
+ logger.Debugw("CreateSchedulerQueues",
+ log.Fields{"dir": sq.direction,
+ "intf-id": sq.intfID,
+ "onu-id": sq.onuID,
+ "uni-id": sq.uniID,
+ "tp-id": sq.tpID,
+ "meter-id": sq.meterID,
+ "tp-inst": sq.tpInst,
+ "flowmetadata": sq.flowMetadata,
+ "device-id": f.deviceHandler.device.Id})
Direction, err := verifyMeterIDAndGetDirection(sq.meterID, sq.direction)
if err != nil {
@@ -366,21 +398,30 @@
var SchedCfg *tp_pb.SchedulerConfig
KvStoreMeter, err := f.resourceMgr.GetMeterIDForOnu(ctx, Direction, sq.intfID, sq.onuID, sq.uniID, sq.tpID)
if err != nil {
- return olterrors.NewErrNotFound("meter", log.Fields{"intfId": sq.intfID, "onuId": sq.onuID, "uniId": sq.uniID}, err)
+ return olterrors.NewErrNotFound("meter",
+ log.Fields{"intf-id": sq.intfID,
+ "onu-id": sq.onuID,
+ "uni-id": sq.uniID,
+ "device-id": f.deviceHandler.device.Id}, err)
}
if KvStoreMeter != nil {
if KvStoreMeter.MeterId == sq.meterID {
- logger.Debug("Scheduler already created for upstream")
+ logger.Debugw("scheduler-already-created-for-upstream", log.Fields{"device-id": f.deviceHandler.device.Id})
return nil
}
return olterrors.NewErrInvalidValue(log.Fields{
"unsupported": "meter-id",
"kv-store-meter-id": KvStoreMeter.MeterId,
- "meter-id-in-flow": sq.meterID}, nil)
+ "meter-id-in-flow": sq.meterID,
+ "device-id": f.deviceHandler.device.Id}, nil)
}
- logger.Debugw("Meter-does-not-exist-Creating-new", log.Fields{"MeterID": sq.meterID, "Direction": Direction})
+ logger.Debugw("meter-does-not-exist-creating-new",
+ log.Fields{
+ "meter-id": sq.meterID,
+ "direction": Direction,
+ "device-id": f.deviceHandler.device.Id})
if sq.direction == tp_pb.Direction_UPSTREAM {
SchedCfg, err = f.techprofile[sq.intfID].GetUsScheduler(sq.tpInst)
@@ -389,7 +430,12 @@
}
if err != nil {
- return olterrors.NewErrNotFound("scheduler-config", log.Fields{"IntfID": sq.intfID, "Direction": sq.direction, "tpInst": sq.tpInst}, err)
+ return olterrors.NewErrNotFound("scheduler-config",
+ log.Fields{
+ "intf-id": sq.intfID,
+ "direction": sq.direction,
+ "tp-inst": sq.tpInst,
+ "device-id": f.deviceHandler.device.Id}, err)
}
var meterConfig *ofp.OfpMeterConfig
@@ -397,25 +443,32 @@
for _, meter := range sq.flowMetadata.Meters {
if sq.meterID == meter.MeterId {
meterConfig = meter
- logger.Debugw("Found-meter-config-from-flowmetadata", log.Fields{"meterConfig": meterConfig})
+ logger.Debugw("found-meter-config-from-flowmetadata",
+ log.Fields{"meterConfig": meterConfig,
+ "device-id": f.deviceHandler.device.Id})
break
}
}
} else {
- logger.Error("Flow-metadata-is-not-present-in-flow")
+ logger.Errorw("flow-metadata-not-present-in-flow", log.Fields{"device-id": f.deviceHandler.device.Id})
}
if meterConfig == nil {
return olterrors.NewErrNotFound("meterbands", log.Fields{
"reason": "Could-not-get-meterbands-from-flowMetadata",
"flow-metadata": sq.flowMetadata,
- "meter-id": sq.meterID}, nil)
+ "meter-id": sq.meterID,
+ "device-id": f.deviceHandler.device.Id}, nil)
} else if len(meterConfig.Bands) < MaxMeterBand {
- logger.Errorw("Invalid-number-of-bands-in-meter", log.Fields{"Bands": meterConfig.Bands, "MeterID": sq.meterID})
+ logger.Errorw("invalid-number-of-bands-in-meter",
+ log.Fields{"Bands": meterConfig.Bands,
+ "meter-id": sq.meterID,
+ "device-id": f.deviceHandler.device.Id})
return olterrors.NewErrInvalidValue(log.Fields{
"reason": "Invalid-number-of-bands-in-meter",
"meterband-count": len(meterConfig.Bands),
"metabands": meterConfig.Bands,
- "meter-id": sq.meterID}, nil)
+ "meter-id": sq.meterID,
+ "device-id": f.deviceHandler.device.Id}, nil)
}
cir := meterConfig.Bands[0].Rate
cbs := meterConfig.Bands[0].BurstSize
@@ -429,17 +482,25 @@
TrafficSched[0].TechProfileId = sq.tpID
if err := f.pushSchedulerQueuesToDevice(ctx, sq, TrafficShaping, TrafficSched); err != nil {
- return olterrors.NewErrAdapter("failure-pushing-traffic-scheduler-and-queues-to-device", log.Fields{"intfID": sq.intfID, "direction": sq.direction}, err)
+ return olterrors.NewErrAdapter("failure-pushing-traffic-scheduler-and-queues-to-device",
+ log.Fields{"intf-id": sq.intfID,
+ "direction": sq.direction,
+ "device-id": f.deviceHandler.device.Id}, err)
}
/* After we successfully applied the scheduler configuration on the OLT device,
* store the meter id on the KV store, for further reference.
*/
if err := f.resourceMgr.UpdateMeterIDForOnu(ctx, Direction, sq.intfID, sq.onuID, sq.uniID, sq.tpID, meterConfig); err != nil {
- return olterrors.NewErrAdapter("failed-updating-meter-id", log.Fields{"onu-id": sq.onuID, "meter-id": sq.meterID}, err)
+ return olterrors.NewErrAdapter("failed-updating-meter-id",
+ log.Fields{"onu-id": sq.onuID,
+ "meter-id": sq.meterID,
+ "device-id": f.deviceHandler.device.Id}, err)
}
- logger.Debugw("updated-meter-info into KV store successfully", log.Fields{"Direction": Direction,
- "Meter": meterConfig})
+ logger.Infow("updated-meter-info-into-kv-store-successfully",
+ log.Fields{"direction": Direction,
+ "Meter": meterConfig,
+ "device-id": f.deviceHandler.device.Id})
return nil
}
@@ -448,27 +509,45 @@
trafficQueues, err := f.techprofile[sq.intfID].GetTrafficQueues(sq.tpInst, sq.direction)
if err != nil {
- return olterrors.NewErrAdapter("unable-to-construct-traffic-queue-configuration", log.Fields{"intfID": sq.intfID, "direction": sq.direction}, err)
+ return olterrors.NewErrAdapter("unable-to-construct-traffic-queue-configuration",
+ log.Fields{"intf-id": sq.intfID,
+ "direction": sq.direction,
+ "device-id": f.deviceHandler.device.Id}, err)
}
- logger.Debugw("Sending Traffic scheduler create to device", log.Fields{"Direction": sq.direction, "TrafficScheds": TrafficSched})
+ logger.Debugw("sending-traffic-scheduler-create-to-device",
+ log.Fields{
+ "direction": sq.direction,
+ "TrafficScheds": TrafficSched,
+ "device-id": f.deviceHandler.device.Id})
if _, err := f.deviceHandler.Client.CreateTrafficSchedulers(ctx, &tp_pb.TrafficSchedulers{
IntfId: sq.intfID, OnuId: sq.onuID,
UniId: sq.uniID, PortNo: sq.uniPort,
TrafficScheds: TrafficSched}); err != nil {
return olterrors.NewErrAdapter("failed-to-create-traffic-schedulers-in-device", log.Fields{"TrafficScheds": TrafficSched}, err)
}
+ logger.Infow("successfully-created-traffic-schedulers", log.Fields{
+ "direction": sq.direction,
+ "traffic-queues": trafficQueues,
+ "device-id": f.deviceHandler.device.Id})
// On receiving the CreateTrafficQueues request, the driver should create corresponding
// downstream queues.
- logger.Debugw("Sending Traffic Queues create to device", log.Fields{"Direction": sq.direction, "TrafficQueues": trafficQueues})
+ logger.Debugw("sending-traffic-queues-create-to-device",
+ log.Fields{"direction": sq.direction,
+ "traffic-queues": trafficQueues,
+ "device-id": f.deviceHandler.device.Id})
if _, err := f.deviceHandler.Client.CreateTrafficQueues(ctx,
&tp_pb.TrafficQueues{IntfId: sq.intfID, OnuId: sq.onuID,
UniId: sq.uniID, PortNo: sq.uniPort,
TrafficQueues: trafficQueues,
TechProfileId: TrafficSched[0].TechProfileId}); err != nil {
- return olterrors.NewErrAdapter("failed-to-create-traffic-queues-in-device", log.Fields{"TrafficQueues": trafficQueues}, err)
+ return olterrors.NewErrAdapter("failed-to-create-traffic-queues-in-device", log.Fields{"traffic-queues": trafficQueues}, err)
}
+ logger.Infow("successfully-created-traffic-schedulers", log.Fields{
+ "direction": sq.direction,
+ "traffic-queues": trafficQueues,
+ "device-id": f.deviceHandler.device.Id})
if sq.direction == tp_pb.Direction_DOWNSTREAM {
multicastTrafficQueues := f.techprofile[sq.intfID].GetMulticastTrafficQueues(sq.tpInst)
@@ -477,6 +556,7 @@
//assumed that there is only one queue per PON for the multicast service
//the default queue with multicastQueuePerPonPort.Priority per a pon interface is used for multicast service
//just put it in interfaceToMcastQueueMap to use for building group members
+ logger.Debugw("multicast-traffic-queues", log.Fields{"device-id": f.deviceHandler.device.Id})
multicastQueuePerPonPort := multicastTrafficQueues[0]
f.interfaceToMcastQueueMap[sq.intfID] = &queueInfoBrief{
gemPortID: multicastQueuePerPonPort.GemportId,
@@ -486,6 +566,8 @@
f.resourceMgr.AddMcastQueueForIntf(ctx, sq.intfID,
multicastQueuePerPonPort.GemportId,
multicastQueuePerPonPort.Priority)
+
+ logger.Infow("multicast-queues-successfully-updated", log.Fields{"device-id": f.deviceHandler.device.Id})
}
}
}
@@ -498,8 +580,14 @@
var Direction string
var SchedCfg *tp_pb.SchedulerConfig
var err error
- logger.Debugw("Removing schedulers and Queues in OLT", log.Fields{"Direction": sq.direction, "IntfID": sq.intfID,
- "OnuID": sq.onuID, "UniID": sq.uniID, "UniPort": sq.uniPort})
+ logger.Infow("removing-schedulers-and-queues-in-olt",
+ log.Fields{
+ "direction": sq.direction,
+ "intf-id": sq.intfID,
+ "onu-id": sq.onuID,
+ "uni-id": sq.uniID,
+ "uni-port": sq.uniPort,
+ "device-id": f.deviceHandler.device.Id})
if sq.direction == tp_pb.Direction_UPSTREAM {
SchedCfg, err = f.techprofile[sq.intfID].GetUsScheduler(sq.tpInst)
Direction = "upstream"
@@ -509,15 +597,28 @@
}
if err != nil {
- return olterrors.NewErrNotFound("scheduler-config", log.Fields{"IntID": sq.intfID, "Direction": sq.direction}, err)
+ return olterrors.NewErrNotFound("scheduler-config",
+ log.Fields{
+ "int-id": sq.intfID,
+ "direction": sq.direction,
+ "device-id": f.deviceHandler.device.Id}, err)
}
KVStoreMeter, err := f.resourceMgr.GetMeterIDForOnu(ctx, Direction, sq.intfID, sq.onuID, sq.uniID, sq.tpID)
if err != nil {
- return olterrors.NewErrNotFound("meter", log.Fields{"onuID": sq.onuID}, err)
+ return olterrors.NewErrNotFound("meter",
+ log.Fields{
+ "onu-id": sq.onuID,
+ "device-id": f.deviceHandler.device.Id}, err)
}
if KVStoreMeter == nil {
- logger.Debugw("No-meter-has-been-installed-yet", log.Fields{"direction": Direction, "IntfID": sq.intfID, "OnuID": sq.onuID, "UniID": sq.uniID})
+ logger.Warnw("no-meter-installed-yet",
+ log.Fields{
+ "direction": Direction,
+ "intf-id": sq.intfID,
+ "onu-id": sq.onuID,
+ "uni-id": sq.uniID,
+ "device-id": f.deviceHandler.device.Id})
return nil
}
cir := KVStoreMeter.Bands[0].Rate
@@ -534,7 +635,11 @@
TrafficQueues, err := f.techprofile[sq.intfID].GetTrafficQueues(sq.tpInst, sq.direction)
if err != nil {
- return olterrors.NewErrAdapter("unable-to-construct-traffic-queue-configuration", log.Fields{"intfID": sq.intfID, "direction": sq.direction}, err)
+ return olterrors.NewErrAdapter("unable-to-construct-traffic-queue-configuration",
+ log.Fields{
+ "intf-id": sq.intfID,
+ "direction": sq.direction,
+ "device-id": f.deviceHandler.device.Id}, err)
}
if _, err = f.deviceHandler.Client.RemoveTrafficQueues(ctx,
@@ -543,27 +648,40 @@
TrafficQueues: TrafficQueues,
TechProfileId: TrafficSched[0].TechProfileId}); err != nil {
return olterrors.NewErrAdapter("unable-to-remove-traffic-queues-from-device",
- log.Fields{"intfID": sq.intfID, "TrafficQueues": TrafficQueues}, err)
+ log.Fields{
+ "intf-id": sq.intfID,
+ "traffic-queues": TrafficQueues,
+ "device-id": f.deviceHandler.device.Id}, err)
}
- logger.Debug("Removed traffic queues successfully")
+ logger.Infow("removed-traffic-queues-successfully", log.Fields{"device-id": f.deviceHandler.device.Id})
if _, err = f.deviceHandler.Client.RemoveTrafficSchedulers(ctx, &tp_pb.TrafficSchedulers{
IntfId: sq.intfID, OnuId: sq.onuID,
UniId: sq.uniID, PortNo: sq.uniPort,
TrafficScheds: TrafficSched}); err != nil {
return olterrors.NewErrAdapter("unable-to-remove-traffic-schedulers-from-device",
- log.Fields{"intfID": sq.intfID, "TrafficSchedulers": TrafficSched}, err)
+ log.Fields{
+ "intf-id": sq.intfID,
+ "traffic-schedulers": TrafficSched}, err)
}
- logger.Debug("Removed traffic schedulers successfully")
+ logger.Infow("removed-traffic-schedulers-successfully", log.Fields{"device-id": f.deviceHandler.device.Id})
/* After we successfully remove the scheduler configuration on the OLT device,
* delete the meter id on the KV store.
*/
err = f.resourceMgr.RemoveMeterIDForOnu(ctx, Direction, sq.intfID, sq.onuID, sq.uniID, sq.tpID)
if err != nil {
- return olterrors.NewErrAdapter("unable-to-remove-meter", log.Fields{"onu": sq.onuID, "meter": KVStoreMeter.MeterId}, err)
+ return olterrors.NewErrAdapter("unable-to-remove-meter",
+ log.Fields{
+ "onu": sq.onuID,
+ "meter": KVStoreMeter.MeterId,
+ "device-id": f.deviceHandler.device.Id}, err)
}
- logger.Debugw("Removed-meter-from-KV-store successfully", log.Fields{"MeterId": KVStoreMeter.MeterId, "dir": Direction})
+ logger.Infow("removed-meter-from-KV-store-successfully",
+ log.Fields{
+ "meter-id": KVStoreMeter.MeterId,
+ "dir": Direction,
+ "device-id": f.deviceHandler.device.Id})
return err
}
@@ -580,30 +698,47 @@
tpPath := f.getTPpath(intfID, uni, TpID)
- logger.Infow("creating-new-tcont-and-gem", log.Fields{
- "pon": intfID, "onu": onuID, "uni": uniID,
- "deviceId": f.deviceHandler.device.Id, "tpId": TpID})
+ logger.Debugw("creating-new-tcont-and-gem", log.Fields{
+ "intf-id": intfID,
+ "onu-id": onuID,
+ "uni-id": uniID,
+ "device-id": f.deviceHandler.device.Id,
+ "tp-id": TpID})
// Check tech profile instance already exists for derived port name
techProfileInstance, _ := f.techprofile[intfID].GetTPInstanceFromKVStore(ctx, TpID, tpPath)
if techProfileInstance == nil {
- logger.Infow("tp-instance-not-found--creating-new", log.Fields{"path": tpPath, "deviceId": f.deviceHandler.device.Id})
+ logger.Infow("tp-instance-not-found--creating-new",
+ log.Fields{
+ "path": tpPath,
+ "device-id": f.deviceHandler.device.Id})
techProfileInstance, err = f.techprofile[intfID].CreateTechProfInstance(ctx, TpID, uni, intfID)
if err != nil {
// This should not happen, something wrong in KV backend transaction
- logger.Errorw("tp-instance-create-failed", log.Fields{"error": err, "tpID": TpID, "deviceId": f.deviceHandler.device.Id})
+ logger.Errorw("tp-instance-create-failed",
+ log.Fields{
+ "error": err,
+ "tp-id": TpID,
+ "device-id": f.deviceHandler.device.Id})
return 0, nil, nil
}
f.resourceMgr.UpdateTechProfileIDForOnu(ctx, intfID, onuID, uniID, TpID)
} else {
- logger.Debugw("Tech-profile-instance-already-exist-for-given port-name", log.Fields{"uni": uni, "deviceId": f.deviceHandler.device.Id})
+ logger.Debugw("tech-profile-instance-already-exist-for-given port-name",
+ log.Fields{
+ "uni": uni,
+ "device-id": f.deviceHandler.device.Id})
tpInstanceExists = true
}
if UsMeterID != 0 {
sq := schedQueue{direction: tp_pb.Direction_UPSTREAM, intfID: intfID, onuID: onuID, uniID: uniID, tpID: TpID,
uniPort: uniPort, tpInst: techProfileInstance, meterID: UsMeterID, flowMetadata: flowMetadata}
if err := f.CreateSchedulerQueues(ctx, sq); err != nil {
- logger.Errorw("CreateSchedulerQueues Failed-upstream", log.Fields{"error": err, "meterID": UsMeterID, "deviceId": f.deviceHandler.device.Id})
+ logger.Errorw("CreateSchedulerQueues-failed-upstream",
+ log.Fields{
+ "error": err,
+ "meter-id": UsMeterID,
+ "device-id": f.deviceHandler.device.Id})
return 0, nil, nil
}
}
@@ -611,7 +746,11 @@
sq := schedQueue{direction: tp_pb.Direction_DOWNSTREAM, intfID: intfID, onuID: onuID, uniID: uniID, tpID: TpID,
uniPort: uniPort, tpInst: techProfileInstance, meterID: DsMeterID, flowMetadata: flowMetadata}
if err := f.CreateSchedulerQueues(ctx, sq); err != nil {
- logger.Errorw("CreateSchedulerQueues Failed-downstream", log.Fields{"error": err, "meterID": DsMeterID, "deviceId": f.deviceHandler.device.Id})
+ logger.Errorw("CreateSchedulerQueues-failed-downstream",
+ log.Fields{
+ "error": err,
+ "meter-id": DsMeterID,
+ "device-id": f.deviceHandler.device.Id})
return 0, nil, nil
}
}
@@ -630,7 +769,11 @@
allgemPortIDs = appendUnique(allgemPortIDs, gemPortID)
}
- logger.Debugw("allocated-tcont-and-GEM-ports", log.Fields{"allocIDs": allocIDs, "gemports": allgemPortIDs, "deviceId": f.deviceHandler.device.Id})
+ logger.Infow("allocated-tcont-and-gem-ports",
+ log.Fields{
+ "alloc-ids": allocIDs,
+ "gemports": allgemPortIDs,
+ "device-id": f.deviceHandler.device.Id})
// Send Tconts and GEM ports to KV store
f.storeTcontsGEMPortsIntoKVStore(ctx, intfID, onuID, uniID, allocIDs, allgemPortIDs)
return allocID, gemPortIDs, techProfileInstance
@@ -638,19 +781,25 @@
func (f *OpenOltFlowMgr) storeTcontsGEMPortsIntoKVStore(ctx context.Context, intfID uint32, onuID uint32, uniID uint32, allocID []uint32, gemPortIDs []uint32) {
- logger.Debugw("storing-allocated-Tconts-and-GEM-ports-into-KV-store",
- log.Fields{"intfId": intfID, "onuId": onuID, "uniId": uniID, "allocID": allocID, "gemPortIDs": gemPortIDs, "deviceId": f.deviceHandler.device.Id})
+ logger.Debugw("storing-allocated-tconts-and-gem-ports-into-KV-store",
+ log.Fields{
+ "intf-id": intfID,
+ "onu-id": onuID,
+ "uni-id": uniID,
+ "alloc-id": allocID,
+ "gemport-ids": gemPortIDs,
+ "device-id": f.deviceHandler.device.Id})
/* Update the allocated alloc_id and gem_port_id for the ONU/UNI to KV store */
if err := f.resourceMgr.UpdateAllocIdsForOnu(ctx, intfID, onuID, uniID, allocID); err != nil {
- logger.Error("Errow while uploading allocID to KV store")
+ logger.Errorw("error-while-uploading-allocid-to-kv-store", log.Fields{"device-id": f.deviceHandler.device.Id})
}
if err := f.resourceMgr.UpdateGEMPortIDsForOnu(ctx, intfID, onuID, uniID, gemPortIDs); err != nil {
- logger.Error("Errow while uploading GEMports to KV store")
+ logger.Errorw("error-while-uploading-gemports-to-kv-store", log.Fields{"device-id": f.deviceHandler.device.Id})
}
if err := f.resourceMgr.UpdateGEMportsPonportToOnuMapOnKVStore(ctx, gemPortIDs, intfID, onuID, uniID); err != nil {
- logger.Error("Errow while uploading gemtopon map to KV store")
+ logger.Error("error-while-uploading-gemtopon-map-to-kv-store", log.Fields{"device-id": f.deviceHandler.device.Id})
}
- logger.Debugw("stored-tconts-and-GEM-into-KV-store-successfully", log.Fields{"deviceId": f.deviceHandler.device.Id})
+ logger.Infow("stored-tconts-and-gem-into-kv-store-successfully", log.Fields{"device-id": f.deviceHandler.device.Id})
for _, gemPort := range gemPortIDs {
f.addGemPortToOnuInfoMap(ctx, intfID, onuID, gemPort)
}
@@ -662,18 +811,25 @@
for _, intfID := range techRange.IntfIds {
f.techprofile[intfID] = f.resourceMgr.ResourceMgrs[uint32(intfID)].TechProfileMgr
tpCount++
- logger.Debugw("Init tech profile done", log.Fields{"intfID": intfID})
+ logger.Debugw("init-tech-profile-done",
+ log.Fields{
+ "intf-id": intfID,
+ "device-id": f.deviceHandler.device.Id})
}
}
//Make sure we have as many tech_profiles as there are pon ports on the device
if tpCount != int(f.resourceMgr.DevInfo.GetPonPorts()) {
return olterrors.NewErrInvalidValue(log.Fields{
- "reason": "TP count does not match number of PON ports",
+ "reason": "tP-count-does-not-match-number-of-pon-ports",
"tech-profile-count": tpCount,
- "pon-port-count": f.resourceMgr.DevInfo.GetPonPorts()}, nil)
+ "pon-port-count": f.resourceMgr.DevInfo.GetPonPorts(),
+ "device-id": f.deviceHandler.device.Id}, nil)
}
- logger.Infow("Populated techprofile for ponports successfully",
- log.Fields{"numofTech": tpCount, "numPonPorts": f.resourceMgr.DevInfo.GetPonPorts()})
+ logger.Infow("populated-techprofile-for-ponports-successfully",
+ log.Fields{
+ "numofTech": tpCount,
+ "numPonPorts": f.resourceMgr.DevInfo.GetPonPorts(),
+ "device-id": f.deviceHandler.device.Id})
return nil
}
@@ -682,7 +838,10 @@
uplinkAction map[string]interface{}, logicalFlow *ofp.OfpFlowStats,
allocID uint32, gemportID uint32, tpID uint32) error {
uplinkClassifier[PacketTagType] = SingleTag
- logger.Debugw("Adding upstream data flow", log.Fields{"uplinkClassifier": uplinkClassifier, "uplinkAction": uplinkAction})
+ logger.Debugw("adding-upstream-data-flow",
+ log.Fields{
+ "uplinkClassifier": uplinkClassifier,
+ "uplinkAction": uplinkAction})
return f.addHSIAFlow(ctx, intfID, onuID, uniID, portNo, uplinkClassifier, uplinkAction,
Upstream, logicalFlow, allocID, gemportID, tpID)
/* TODO: Install Secondary EAP on the subscriber vlan */
@@ -693,14 +852,21 @@
downlinkAction map[string]interface{}, logicalFlow *ofp.OfpFlowStats,
allocID uint32, gemportID uint32, tpID uint32) error {
downlinkClassifier[PacketTagType] = DoubleTag
- logger.Debugw("Adding downstream data flow", log.Fields{"downlinkClassifier": downlinkClassifier,
- "downlinkAction": downlinkAction})
+ logger.Debugw("adding-downstream-data-flow",
+ log.Fields{
+ "downlinkClassifier": downlinkClassifier,
+ "downlinkAction": downlinkAction})
// Ignore Downlink trap flow given by core, cannot do anything with this flow */
if vlan, exists := downlinkClassifier[VlanVid]; exists {
if vlan.(uint32) == (uint32(ofp.OfpVlanId_OFPVID_PRESENT) | 4000) { //private VLAN given by core
if metadata, exists := downlinkClassifier[Metadata]; exists { // inport is filled in metadata by core
if uint32(metadata.(uint64)) == MkUniPortNum(intfID, onuID, uniID) {
- logger.Infow("Ignoring DL trap device flow from core", log.Fields{"flow": logicalFlow})
+ logger.Infow("ignoring-dl-trap-device-flow-from-core",
+ log.Fields{
+ "flow": logicalFlow,
+ "device-id": f.deviceHandler.device.Id,
+ "onu-id": onuID,
+ "intf-id": intfID})
return nil
}
}
@@ -715,8 +881,9 @@
downlinkAction[VlanVid] = dlClVid & 0xfff
} else {
return olterrors.NewErrInvalidValue(log.Fields{
- "reason": "failed to convert VLANID classifier",
- "vlan-id": VlanVid}, nil).Log()
+ "reason": "failed-to-convert-vlanid-classifier",
+ "vlan-id": VlanVid,
+ "device-id": f.deviceHandler.device.Id}, nil).Log()
}
return f.addHSIAFlow(ctx, intfID, onuID, uniID, portNo, downlinkClassifier, downlinkAction,
@@ -733,46 +900,87 @@
takes priority over flow_cookie to find any available HSIA_FLOW
id for the ONU.
*/
- logger.Debugw("Adding HSIA flow", log.Fields{"intfId": intfID, "onuId": onuID, "uniId": uniID, "classifier": classifier,
- "action": action, "direction": direction, "allocId": allocID, "gemPortId": gemPortID,
- "logicalFlow": *logicalFlow})
+ logger.Infow("adding-hsia-flow",
+ log.Fields{
+ "intf-id": intfID,
+ "onu-id": onuID,
+ "uni-id": uniID,
+ "device-id": f.deviceHandler.device.Id,
+ "classifier": classifier,
+ "action": action,
+ "direction": direction,
+ "alloc-id": allocID,
+ "gemport-id": gemPortID,
+ "logicalflow": *logicalFlow})
var vlanPbit uint32 = 0xff // means no pbit
var vlanVid uint32
if _, ok := classifier[VlanPcp]; ok {
vlanPbit = classifier[VlanPcp].(uint32)
- logger.Debugw("Found pbit in the flow", log.Fields{"VlanPbit": vlanPbit})
+ logger.Debugw("found-pbit-in-flow",
+ log.Fields{
+ "vlan-pbit": vlanPbit,
+ "intf-id": intfID,
+ "onu-id": onuID,
+ "device-id": f.deviceHandler.device.Id})
} else {
- logger.Debugw("pbit-not-found-in-flow", log.Fields{"vlan-pcp": VlanPcp})
+ logger.Debugw("pbit-not-found-in-flow",
+ log.Fields{
+ "vlan-pcp": VlanPcp,
+ "intf-id": intfID,
+ "onu-id": onuID,
+ "device-id": f.deviceHandler.device.Id})
}
if _, ok := classifier[VlanVid]; ok {
vlanVid = classifier[VlanVid].(uint32)
- log.Debugw("Found vlan in the flow", log.Fields{"VlanVid": vlanVid})
+ log.Debugw("found-vlan-in-the-flow",
+ log.Fields{
+ "vlan-vid": vlanVid,
+ "intf-id": intfID,
+ "onu-id": onuID,
+ "device-id": f.deviceHandler.device.Id})
}
flowStoreCookie := getFlowStoreCookie(classifier, gemPortID)
if present := f.resourceMgr.IsFlowCookieOnKVStore(ctx, uint32(intfID), int32(onuID), int32(uniID), flowStoreCookie); present {
- logger.Debug("flow-already-exists")
+ logger.Infow("flow-already-exists",
+ log.Fields{
+ "device-id": f.deviceHandler.device.Id,
+ "intf-id": intfID,
+ "onu-id": onuID})
return nil
}
flowID, err := f.resourceMgr.GetFlowID(ctx, intfID, int32(onuID), int32(uniID), gemPortID, flowStoreCookie, HsiaFlow, vlanVid, vlanPbit)
if err != nil {
- return olterrors.NewErrNotFound("hsia-flow-id", log.Fields{"direction": direction}, err).Log()
+ return olterrors.NewErrNotFound("hsia-flow-id",
+ log.Fields{
+ "direction": direction,
+ "device-id": f.deviceHandler.device.Id,
+ "intf-id": intfID,
+ "onu-id": onuID,
+ }, err).Log()
}
classifierProto, err := makeOpenOltClassifierField(classifier)
if err != nil {
- return olterrors.NewErrInvalidValue(log.Fields{"classifier": classifier}, err).Log()
+ return olterrors.NewErrInvalidValue(log.Fields{"classifier": classifier, "device-id": f.deviceHandler.device.Id}, err).Log()
}
- logger.Debugw("Created classifier proto", log.Fields{"classifier": *classifierProto})
+ logger.Debugw("created-classifier-proto",
+ log.Fields{
+ "classifier": *classifierProto,
+ "device-id": f.deviceHandler.device.Id})
actionProto, err := makeOpenOltActionField(action, classifier)
if err != nil {
- return olterrors.NewErrInvalidValue(log.Fields{"action": action}, err).Log()
+ return olterrors.NewErrInvalidValue(log.Fields{"action": action, "device-id": f.deviceHandler.device.Id}, err).Log()
}
- logger.Debugw("Created action proto", log.Fields{"action": *actionProto})
+ logger.Debugw("created-action-proto",
+ log.Fields{
+ "action": *actionProto,
+ "device-id": f.deviceHandler.device.Id})
networkIntfID, err := getNniIntfID(classifier, action)
if err != nil {
return olterrors.NewErrNotFound("nni-interface-id",
log.Fields{
"classifier": classifier,
"action": action,
+ "device-id": f.deviceHandler.device.Id,
}, err).Log()
}
flow := openoltpb2.Flow{AccessIntfId: int32(intfID),
@@ -793,13 +1001,23 @@
if err := f.addFlowToDevice(ctx, logicalFlow, &flow); err != nil {
return olterrors.NewErrFlowOp("add", flowID, nil, err).Log()
}
- logger.Debug("HSIA flow added to device successfully", log.Fields{"direction": direction})
+ logger.Infow("hsia-flow-added-to-device-successfully",
+ log.Fields{"direction": direction,
+ "device-id": f.deviceHandler.device.Id,
+ "flow": flow,
+ "intf-id": intfID,
+ "onu-id": onuID})
flowsToKVStore := f.getUpdatedFlowInfo(ctx, &flow, flowStoreCookie, HsiaFlow, flowID, logicalFlow.Id)
if err := f.updateFlowInfoToKVStore(ctx, flow.AccessIntfId,
flow.OnuId,
flow.UniId,
flow.FlowId /*flowCategory,*/, flowsToKVStore); err != nil {
- return olterrors.NewErrPersistence("update", "flow", flowID, log.Fields{"flow": flow}, err).Log()
+ return olterrors.NewErrPersistence("update", "flow", flowID,
+ log.Fields{
+ "flow": flow,
+ "device-id": f.deviceHandler.device.Id,
+ "intf-id": intfID,
+ "onu-id": onuID}, err).Log()
}
return nil
}
@@ -812,7 +1030,8 @@
if err != nil {
return olterrors.NewErrNotFound("nni-interface-id", log.Fields{
"classifier": classifier,
- "action": action},
+ "action": action,
+ "device-id": f.deviceHandler.device.Id},
err).Log()
}
@@ -829,27 +1048,40 @@
flowStoreCookie := getFlowStoreCookie(classifier, gemPortID)
if present := f.resourceMgr.IsFlowCookieOnKVStore(ctx, uint32(intfID), int32(onuID), int32(uniID), flowStoreCookie); present {
- logger.Debug("Flow-exists--not-re-adding")
+ logger.Infow("flow-exists--not-re-adding",
+ log.Fields{
+ "device-id": f.deviceHandler.device.Id,
+ "intf-id": intfID,
+ "onu-id": onuID})
return nil
}
flowID, err := f.resourceMgr.GetFlowID(ctx, intfID, int32(onuID), int32(uniID), gemPortID, flowStoreCookie, DhcpFlow, 0 /*classifier[VLAN_PCP].(uint32)*/)
if err != nil {
- return olterrors.NewErrNotFound("flow", log.Fields{
- "interface-id": intfID,
- "gem-port": gemPortID,
- "cookie": flowStoreCookie},
+ return olterrors.NewErrNotFound("flow",
+ log.Fields{
+ "interface-id": intfID,
+ "gem-port": gemPortID,
+ "cookie": flowStoreCookie,
+ "device-id": f.deviceHandler.device.Id},
err).Log()
}
- logger.Debugw("Creating UL DHCP flow", log.Fields{"ul_classifier": classifier, "ul_action": action, "uplinkFlowId": flowID})
+ logger.Debugw("creating-ul-dhcp-flow",
+ log.Fields{
+ "ul_classifier": classifier,
+ "ul_action": action,
+ "uplinkFlowId": flowID,
+ "intf-id": intfID,
+ "onu-id": onuID,
+ "device-id": f.deviceHandler.device.Id})
classifierProto, err := makeOpenOltClassifierField(classifier)
if err != nil {
return olterrors.NewErrInvalidValue(log.Fields{"classifier": classifier}, err).Log()
}
- logger.Debugw("Created classifier proto", log.Fields{"classifier": *classifierProto})
+ logger.Debugw("created-classifier-proto", log.Fields{"classifier": *classifierProto})
actionProto, err := makeOpenOltActionField(action, classifier)
if err != nil {
return olterrors.NewErrInvalidValue(log.Fields{"action": action}, err).Log()
@@ -873,13 +1105,21 @@
if err := f.addFlowToDevice(ctx, logicalFlow, &dhcpFlow); err != nil {
return olterrors.NewErrFlowOp("add", flowID, log.Fields{"dhcp-flow": dhcpFlow}, err).Log()
}
- logger.Debug("DHCP UL flow added to device successfully")
+ logger.Infow("dhcp-ul-flow-added-to-device-successfully",
+ log.Fields{
+ "device-id": f.deviceHandler.device.Id,
+ "flow-id": flowID,
+ "intf-id": intfID,
+ "onu-id": onuID})
flowsToKVStore := f.getUpdatedFlowInfo(ctx, &dhcpFlow, flowStoreCookie, "DHCP", flowID, logicalFlow.Id)
if err := f.updateFlowInfoToKVStore(ctx, dhcpFlow.AccessIntfId,
dhcpFlow.OnuId,
dhcpFlow.UniId,
dhcpFlow.FlowId, flowsToKVStore); err != nil {
- return olterrors.NewErrPersistence("update", "flow", dhcpFlow.FlowId, log.Fields{"flow": dhcpFlow}, err).Log()
+ return olterrors.NewErrPersistence("update", "flow", dhcpFlow.FlowId,
+ log.Fields{
+ "flow": dhcpFlow,
+ "device-id": f.deviceHandler.device.Id}, err).Log()
}
return nil
@@ -897,9 +1137,11 @@
networkIntfID, err := getNniIntfID(classifier, action)
if err != nil {
- return olterrors.NewErrNotFound("nni-interface-id", log.Fields{
- "classifier": classifier,
- "action": action},
+ return olterrors.NewErrNotFound("nni-interface-id",
+ log.Fields{
+ "classifier": classifier,
+ "action": action,
+ "device-id": f.deviceHandler.device.Id},
err).Log()
}
@@ -914,31 +1156,45 @@
flowStoreCookie := getFlowStoreCookie(classifier, gemPortID)
if present := f.resourceMgr.IsFlowCookieOnKVStore(ctx, uint32(networkIntfID), int32(onuID), int32(uniID), flowStoreCookie); present {
- logger.Debug("Flow-exists-not-re-adding")
+ logger.Infow("flow-exists-not-re-adding", log.Fields{"device-id": f.deviceHandler.device.Id})
return nil
}
flowID, err := f.resourceMgr.GetFlowID(ctx, intfID, int32(onuID), int32(uniID), gemPortID, flowStoreCookie, flowType, 0, 0 /*classifier[VLAN_PCP].(uint32)*/)
if err != nil {
- return olterrors.NewErrNotFound("flow-id", log.Fields{
- "interface-id": intfID,
- "oni-id": onuID,
- "cookie": flowStoreCookie,
- "flow-type": flowType},
+ return olterrors.NewErrNotFound("flow-id",
+ log.Fields{
+ "intf-id": intfID,
+ "oni-id": onuID,
+ "cookie": flowStoreCookie,
+ "flow-type": flowType,
+ "device-id": f.deviceHandler.device.Id,
+ "onu-id": onuID},
err).Log()
}
- logger.Debugw("Creating upstream trap flow", log.Fields{"ul_classifier": classifier, "ul_action": action, "uplinkFlowId": flowID, "flowType": flowType})
+ logger.Debugw("creating-upstream-trap-flow",
+ log.Fields{
+ "ul_classifier": classifier,
+ "ul_action": action,
+ "uplinkFlowId": flowID,
+ "flowType": flowType,
+ "device-id": f.deviceHandler.device.Id,
+ "intf-id": intfID,
+ "onu-id": onuID})
classifierProto, err := makeOpenOltClassifierField(classifier)
if err != nil {
- return olterrors.NewErrInvalidValue(log.Fields{"classifier": classifier}, err).Log()
+ return olterrors.NewErrInvalidValue(log.Fields{"classifier": classifier, "device-id": f.deviceHandler.device.Id}, err).Log()
}
- logger.Debugw("Created classifier proto", log.Fields{"classifier": *classifierProto})
+ logger.Debugw("created-classifier-proto",
+ log.Fields{
+ "classifier": *classifierProto,
+ "device-id": f.deviceHandler.device.Id})
actionProto, err := makeOpenOltActionField(action, classifier)
if err != nil {
- return olterrors.NewErrInvalidValue(log.Fields{"action": action}, err).Log()
+ return olterrors.NewErrInvalidValue(log.Fields{"action": action, "device-id": f.deviceHandler.device.Id}, err).Log()
}
flow := openoltpb2.Flow{AccessIntfId: int32(intfID),
@@ -958,16 +1214,16 @@
}
if err := f.addFlowToDevice(ctx, logicalFlow, &flow); err != nil {
- return olterrors.NewErrFlowOp("add", flowID, log.Fields{"flow": flow}, err).Log()
+ return olterrors.NewErrFlowOp("add", flowID, log.Fields{"flow": flow, "device-id": f.deviceHandler.device.Id}, err).Log()
}
- logger.Debugf("%s UL flow added to device successfully", flowType)
+ logger.Infof("%s ul-flow-added-to-device-successfully", flowType)
flowsToKVStore := f.getUpdatedFlowInfo(ctx, &flow, flowStoreCookie, flowType, flowID, logicalFlow.Id)
if err := f.updateFlowInfoToKVStore(ctx, flow.AccessIntfId,
flow.OnuId,
flow.UniId,
flow.FlowId, flowsToKVStore); err != nil {
- return olterrors.NewErrPersistence("update", "flow", flow.FlowId, log.Fields{"flow": flow}, err).Log()
+ return olterrors.NewErrPersistence("update", "flow", flow.FlowId, log.Fields{"flow": flow, "device-id": f.deviceHandler.device.Id}, err).Log()
}
return nil
@@ -977,7 +1233,15 @@
func (f *OpenOltFlowMgr) addEAPOLFlow(ctx context.Context, intfID uint32, onuID uint32, uniID uint32, portNo uint32,
classifier map[string]interface{}, action map[string]interface{}, logicalFlow *ofp.OfpFlowStats, allocID uint32,
gemPortID uint32, vlanID uint32, tpID uint32) error {
- logger.Debugw("Adding EAPOL to device", log.Fields{"intfId": intfID, "onuId": onuID, "portNo": portNo, "allocId": allocID, "gemPortId": gemPortID, "vlanId": vlanID, "flow": logicalFlow})
+ logger.Infow("adding-eapol-to-device",
+ log.Fields{
+ "intf-id": intfID,
+ "onu-id": onuID,
+ "port-no": portNo,
+ "alloc-id": allocID,
+ "gemport-id": gemPortID,
+ "vlan-id": vlanID,
+ "flow": logicalFlow})
uplinkClassifier := make(map[string]interface{})
uplinkAction := make(map[string]interface{})
@@ -991,35 +1255,56 @@
uplinkAction[TrapToHost] = true
flowStoreCookie := getFlowStoreCookie(uplinkClassifier, gemPortID)
if present := f.resourceMgr.IsFlowCookieOnKVStore(ctx, uint32(intfID), int32(onuID), int32(uniID), flowStoreCookie); present {
- logger.Debug("Flow-exists-not-re-adding")
+ logger.Infow("flow-exists-not-re-adding", log.Fields{
+ "device-id": f.deviceHandler.device.Id,
+ "onu-id": onuID,
+ "intf-id": intfID})
return nil
}
//Add Uplink EAPOL Flow
uplinkFlowID, err := f.resourceMgr.GetFlowID(ctx, intfID, int32(onuID), int32(uniID), gemPortID, flowStoreCookie, "", 0, 0)
if err != nil {
- return olterrors.NewErrNotFound("flow-id", log.Fields{
- "interface-id": intfID,
- "onu-id": onuID,
- "coookie": flowStoreCookie},
+ return olterrors.NewErrNotFound("flow-id",
+ log.Fields{
+ "intf-id": intfID,
+ "onu-id": onuID,
+ "coookie": flowStoreCookie,
+ "device-id": f.deviceHandler.device.Id},
err).Log()
}
- logger.Debugw("Creating UL EAPOL flow", log.Fields{"ul_classifier": uplinkClassifier, "ul_action": uplinkAction, "uplinkFlowId": uplinkFlowID})
+ logger.Debugw("creating-ul-eapol-flow",
+ log.Fields{
+ "ul_classifier": uplinkClassifier,
+ "ul_action": uplinkAction,
+ "uplinkFlowId": uplinkFlowID,
+ "device-id": f.deviceHandler.device.Id,
+ "intf-id": intfID,
+ "onu-id": onuID})
classifierProto, err := makeOpenOltClassifierField(uplinkClassifier)
if err != nil {
- return olterrors.NewErrInvalidValue(log.Fields{"classifier": uplinkClassifier}, err).Log()
+ return olterrors.NewErrInvalidValue(log.Fields{
+ "classifier": uplinkClassifier,
+ "device-id": f.deviceHandler.device.Id}, err).Log()
}
- logger.Debugw("Created classifier proto", log.Fields{"classifier": *classifierProto})
+ logger.Debugw("created-classifier-proto",
+ log.Fields{
+ "classifier": *classifierProto,
+ "device-id": f.deviceHandler.device.Id})
actionProto, err := makeOpenOltActionField(uplinkAction, uplinkClassifier)
if err != nil {
- return olterrors.NewErrInvalidValue(log.Fields{"action": uplinkAction}, err).Log()
+ return olterrors.NewErrInvalidValue(log.Fields{"action": uplinkAction, "device-id": f.deviceHandler.device.Id}, err).Log()
}
- logger.Debugw("Created action proto", log.Fields{"action": *actionProto})
+ logger.Debugw("created-action-proto",
+ log.Fields{
+ "action": *actionProto,
+ "device-id": f.deviceHandler.device.Id})
networkIntfID, err := getNniIntfID(classifier, action)
if err != nil {
return olterrors.NewErrNotFound("nni-interface-id", log.Fields{
"classifier": classifier,
- "action": action},
+ "action": action,
+ "device-id": f.deviceHandler.device.Id},
err).Log()
}
@@ -1041,7 +1326,12 @@
if err := f.addFlowToDevice(ctx, logicalFlow, &upstreamFlow); err != nil {
return olterrors.NewErrFlowOp("add", uplinkFlowID, log.Fields{"flow": upstreamFlow}, err).Log()
}
- logger.Debug("EAPOL UL flow added to device successfully")
+ logger.Infow("eapol-ul-flow-added-to-device-successfully",
+ log.Fields{
+ "device-id": f.deviceHandler.device.Id,
+ "onu-id": onuID,
+ "intf-id": intfID,
+ })
flowCategory := "EAPOL"
flowsToKVStore := f.getUpdatedFlowInfo(ctx, &upstreamFlow, flowStoreCookie, flowCategory, uplinkFlowID, logicalFlow.Id)
if err := f.updateFlowInfoToKVStore(ctx, upstreamFlow.AccessIntfId,
@@ -1050,10 +1340,11 @@
upstreamFlow.FlowId,
/* lowCategory, */
flowsToKVStore); err != nil {
- return olterrors.NewErrPersistence("update", "flow", upstreamFlow.FlowId, log.Fields{"flow": upstreamFlow}, err).Log()
+ return olterrors.NewErrPersistence("update", "flow", upstreamFlow.FlowId,
+ log.Fields{
+ "flow": upstreamFlow,
+ "device-id": f.deviceHandler.device.Id}, err).Log()
}
-
- logger.Debugw("Added EAPOL flows to device successfully", log.Fields{"flow": logicalFlow})
return nil
}
@@ -1144,11 +1435,11 @@
for _, tpID := range tpIDList {
if err := f.DeleteTechProfileInstance(ctx, intfID, onuID, uniID, uniPortName, tpID); err != nil {
- olterrors.NewErrAdapter("delete-tech-profile-failed", nil, err).Log()
+ olterrors.NewErrAdapter("delete-tech-profile-failed", log.Fields{"device-id": f.deviceHandler.device.Id}, err).Log()
// return err
// We should continue to delete tech-profile instances for other TP IDs
}
- log.Debugw("tech-profile-deleted", log.Fields{"deviceId": f.deviceHandler.device.Id, "tp": tpID})
+ log.Debugw("tech-profile-deleted", log.Fields{"device-id": f.deviceHandler.device.Id, "tp-id": tpID})
}
return nil
}
@@ -1159,23 +1450,30 @@
uniPortName = getUniPortPath(f.deviceHandler.device.Id, intfID, int32(onuID), int32(uniID))
}
if err := f.techprofile[intfID].DeleteTechProfileInstance(ctx, tpID, uniPortName); err != nil {
- return olterrors.NewErrAdapter("failed-to-delete-tp-instance-from-kv-store", log.Fields{"tp-id": tpID, "uni-port-name": uniPortName}, err)
+ return olterrors.NewErrAdapter("failed-to-delete-tp-instance-from-kv-store",
+ log.Fields{
+ "tp-id": tpID,
+ "uni-port-name": uniPortName,
+ "device-id": f.deviceHandler.device.Id}, err)
}
return nil
}
func getFlowStoreCookie(classifier map[string]interface{}, gemPortID uint32) uint64 {
if len(classifier) == 0 { // should never happen
- logger.Error("Invalid classfier object")
+ logger.Error("invalid-classfier-object")
return 0
}
- logger.Debugw("generating flow store cookie", log.Fields{"classifier": classifier, "gemPortID": gemPortID})
+ logger.Debugw("generating-flow-store-cookie",
+ log.Fields{
+ "classifier": classifier,
+ "gemport-id": gemPortID})
var jsonData []byte
var flowString string
var err error
// TODO: Do we need to marshall ??
if jsonData, err = json.Marshal(classifier); err != nil {
- logger.Error("Failed to encode classifier")
+ logger.Error("failed-to-encode-classifier")
return 0
}
flowString = string(jsonData)
@@ -1187,7 +1485,7 @@
hash := big.NewInt(0)
hash.SetBytes(h.Sum(nil))
generatedHash := hash.Uint64()
- logger.Debugw("hash generated", log.Fields{"hash": generatedHash})
+ logger.Debugw("hash-generated", log.Fields{"hash": generatedHash})
return generatedHash
}
@@ -1205,13 +1503,23 @@
// Get existing flows matching flowid for given subscriber from KV store
existingFlows := f.resourceMgr.GetFlowIDInfo(ctx, intfID, flow.OnuId, flow.UniId, flow.FlowId)
if existingFlows != nil {
- logger.Debugw("Flow exists for given flowID, appending it to current flow", log.Fields{"flowID": flow.FlowId})
+ logger.Debugw("flow-exists-for-given-flowID--appending-it-to-current-flow",
+ log.Fields{
+ "flow-id": flow.FlowId,
+ "device-id": f.deviceHandler.device.Id,
+ "intf-id": intfID,
+ "onu-id": flow.OnuId})
//for _, f := range *existingFlows {
// flows = append(flows, f)
//}
flows = append(flows, *existingFlows...)
}
- logger.Debugw("Updated flows for given flowID and onuid", log.Fields{"updatedflow": flows, "flowid": flow.FlowId, "onu": flow.OnuId})
+ logger.Debugw("updated-flows-for-given-flowID-and-onuid",
+ log.Fields{
+ "updatedflow": flows,
+ "flow-id": flow.FlowId,
+ "onu-id": flow.OnuId,
+ "device-id": f.deviceHandler.device.Id})
return &flows
}
@@ -1239,12 +1547,24 @@
//}
func (f *OpenOltFlowMgr) updateFlowInfoToKVStore(ctx context.Context, intfID int32, onuID int32, uniID int32, flowID uint32, flows *[]rsrcMgr.FlowInfo) error {
- logger.Debugw("Storing flow(s) into KV store", log.Fields{"flows": *flows})
+ logger.Debugw("storing-flow(s)-into-kv-store", log.Fields{
+ "flow-id": flowID,
+ "device-id": f.deviceHandler.device.Id,
+ "intf-id": intfID,
+ "onu-id": onuID})
if err := f.resourceMgr.UpdateFlowIDInfo(ctx, intfID, onuID, uniID, flowID, flows); err != nil {
- logger.Debug("Error while Storing flow into KV store")
+ logger.Warnw("error-while-storing-flow-into-kv-store", log.Fields{
+ "device-id": f.deviceHandler.device.Id,
+ "onu-id": onuID,
+ "intf-id": intfID,
+ "flow-id": flowID})
return err
}
- logger.Info("Stored flow(s) into KV store successfully!")
+ logger.Infow("stored-flow(s)-into-kv-store-successfully!", log.Fields{
+ "device-id": f.deviceHandler.device.Id,
+ "onu-id": onuID,
+ "intf-id": intfID,
+ "flow-id": flowID})
return nil
}
@@ -1262,9 +1582,9 @@
}
logger.Debugw("sending-flow-to-device-via-grpc", log.Fields{
- "flow": *deviceFlow,
- "deviceId": f.deviceHandler.device.Id,
- })
+ "flow": *deviceFlow,
+ "device-id": f.deviceHandler.device.Id,
+ "intf-id": intfID})
_, err := f.deviceHandler.Client.FlowAdd(context.Background(), deviceFlow)
st, _ := status.FromError(err)
@@ -1272,17 +1592,17 @@
logger.Debug("flow-already-exists", log.Fields{
"err": err,
"deviceFlow": deviceFlow,
- "deviceId": f.deviceHandler.device.Id,
- })
+ "device-id": f.deviceHandler.device.Id,
+ "intf-id": intfID})
return nil
}
if err != nil {
- logger.Errorw("failed-to-Add-flow-to-device", log.Fields{
- "err": err,
- "deviceFlow": deviceFlow,
- "deviceId": f.deviceHandler.device.Id,
- })
+ logger.Errorw("failed-to-add-flow-to-device",
+ log.Fields{"err": err,
+ "device-flow": deviceFlow,
+ "device-id": f.deviceHandler.device.Id,
+ "intf-id": intfID})
f.resourceMgr.FreeFlowID(ctx, intfID, deviceFlow.OnuId, deviceFlow.UniId, deviceFlow.FlowId)
return err
}
@@ -1290,26 +1610,37 @@
// No need to register the flow if it is a trap on nni flow.
f.registerFlow(ctx, logicalFlow, deviceFlow)
}
- logger.Debugw("flow-added-to-device-successfully", log.Fields{
- "flow": *deviceFlow,
- "deviceId": f.deviceHandler.device.Id,
- })
+ logger.Infow("flow-added-to-device-successfully ",
+ log.Fields{
+ "flow": *deviceFlow,
+ "device-id": f.deviceHandler.device.Id,
+ "intf-id": intfID})
return nil
}
func (f *OpenOltFlowMgr) removeFlowFromDevice(deviceFlow *openoltpb2.Flow) error {
- logger.Debugw("Sending flow to device via grpc", log.Fields{"flow": *deviceFlow})
+ logger.Debugw("sending-flow-to-device-via-grpc",
+ log.Fields{
+ "flow": *deviceFlow,
+ "device-id": f.deviceHandler.device.Id})
_, err := f.deviceHandler.Client.FlowRemove(context.Background(), deviceFlow)
if err != nil {
if f.deviceHandler.device.ConnectStatus == common.ConnectStatus_UNREACHABLE {
- logger.Warnw("Can not remove flow from device since it's unreachable", log.Fields{"err": err, "deviceFlow": deviceFlow})
+ logger.Warnw("can-not-remove-flow-from-device--unreachable",
+ log.Fields{
+ "err": err,
+ "deviceFlow": deviceFlow,
+ "device-id": f.deviceHandler.device.Id})
//Assume the flow is removed
return nil
}
return olterrors.NewErrFlowOp("remove", deviceFlow.FlowId, log.Fields{"deviceFlow": deviceFlow}, err)
}
- logger.Debugw("Flow removed from device successfully ", log.Fields{"flow": *deviceFlow})
+ logger.Infow("flow-removed-from-device-successfully ",
+ log.Fields{
+ "flow": *deviceFlow,
+ "device-id": f.deviceHandler.device.Id})
return nil
}
@@ -1364,30 +1695,44 @@
}
var flowStoreCookie = getFlowStoreCookie(classifierInfo, uint32(0))
if present := f.resourceMgr.IsFlowCookieOnKVStore(ctx, uint32(networkInterfaceID), int32(onuID), int32(uniID), flowStoreCookie); present {
- logger.Debug("Flow-exists--not-re-adding")
+ logger.Infow("flow-exists--not-re-adding", log.Fields{"device-id": f.deviceHandler.device.Id})
return nil
}
flowID, err := f.resourceMgr.GetFlowID(ctx, uint32(networkInterfaceID), int32(onuID), int32(uniID), uint32(gemPortID), flowStoreCookie, "", 0)
if err != nil {
- return olterrors.NewErrNotFound("flow-id", log.Fields{
- "interface-id": networkInterfaceID,
- "onu-id": onuID,
- "uni-id": uniID,
- "gem-port-id": gemPortID,
- "cookie": flowStoreCookie},
+ return olterrors.NewErrNotFound("flow-id",
+ log.Fields{
+ "interface-id": networkInterfaceID,
+ "onu-id": onuID,
+ "uni-id": uniID,
+ "gem-port-id": gemPortID,
+ "cookie": flowStoreCookie,
+ "device-id": f.deviceHandler.device.Id},
err)
}
classifierProto, err := makeOpenOltClassifierField(classifierInfo)
if err != nil {
- return olterrors.NewErrInvalidValue(log.Fields{"classifier": classifierInfo}, err)
+ return olterrors.NewErrInvalidValue(
+ log.Fields{
+ "classifier": classifierInfo,
+ "device-id": f.deviceHandler.device.Id}, err)
}
- logger.Debugw("Created classifier proto", log.Fields{"classifier": *classifierProto})
+ logger.Debugw("created-classifier-proto",
+ log.Fields{
+ "classifier": *classifierProto,
+ "device-id": f.deviceHandler.device.Id})
actionProto, err := makeOpenOltActionField(actionInfo, classifierInfo)
if err != nil {
- return olterrors.NewErrInvalidValue(log.Fields{"action": actionInfo}, err)
+ return olterrors.NewErrInvalidValue(
+ log.Fields{
+ "action": actionInfo,
+ "device-id": f.deviceHandler.device.Id}, err)
}
- logger.Debugw("Created action proto", log.Fields{"action": *actionProto})
+ logger.Debugw("created-action-proto",
+ log.Fields{
+ "action": *actionProto,
+ "device-id": f.deviceHandler.device.Id})
downstreamflow := openoltpb2.Flow{AccessIntfId: int32(-1), // AccessIntfId not required
OnuId: int32(onuID), // OnuId not required
@@ -1402,15 +1747,25 @@
Cookie: flow.Cookie,
PortNo: portNo}
if err := f.addFlowToDevice(ctx, flow, &downstreamflow); err != nil {
- return olterrors.NewErrFlowOp("add", flowID, log.Fields{"flow": downstreamflow}, err)
+ return olterrors.NewErrFlowOp("add", flowID,
+ log.Fields{
+ "flow": downstreamflow,
+ "device-id": f.deviceHandler.device.Id}, err)
}
- logger.Debug("LLDP trap on NNI flow added to device successfully")
+ logger.Infow("lldp-trap-on-nni-flow-added-to-device-successfully",
+ log.Fields{
+ "device-id": f.deviceHandler.device.Id,
+ "onu-id": onuID,
+ "flow-id": flowID})
flowsToKVStore := f.getUpdatedFlowInfo(ctx, &downstreamflow, flowStoreCookie, "", flowID, flow.Id)
if err := f.updateFlowInfoToKVStore(ctx, int32(networkInterfaceID),
int32(onuID),
int32(uniID),
flowID, flowsToKVStore); err != nil {
- return olterrors.NewErrPersistence("update", "flow", flowID, log.Fields{"flow": downstreamflow}, err)
+ return olterrors.NewErrPersistence("update", "flow", flowID,
+ log.Fields{
+ "flow": downstreamflow,
+ "device-id": f.deviceHandler.device.Id}, err)
}
return nil
}
@@ -1424,16 +1779,28 @@
onuKey := f.deviceHandler.formOnuKey(intfID, onuID)
onuDev, ok := f.deviceHandler.onus.Load(onuKey)
if !ok {
- logger.Debugw("couldnt-find-onu-in-cache", log.Fields{"intfID": intfID, "onuID": onuID})
+ logger.Debugw("couldnt-find-onu-in-cache",
+ log.Fields{
+ "intf-id": intfID,
+ "onu-id": onuID,
+ "device-id": f.deviceHandler.device.Id})
onuDevice, err := f.getChildDevice(intfID, onuID)
if err != nil {
- return nil, olterrors.NewErrNotFound("onu-child-device", log.Fields{"onuId": onuID, "intfID": intfID}, err)
+ return nil, olterrors.NewErrNotFound("onu-child-device",
+ log.Fields{
+ "onu-id": onuID,
+ "intf-id": intfID,
+ "device-id": f.deviceHandler.device.Id}, err)
}
onuDev = NewOnuDevice(onuDevice.Id, onuDevice.Type, onuDevice.SerialNumber, onuDevice.ProxyAddress.OnuId, onuDevice.ProxyAddress.ChannelId, onuDevice.ProxyAddress.DeviceId, false)
//better to ad the device to cache here.
f.deviceHandler.StoreOnuDevice(onuDev.(*OnuDevice))
} else {
- logger.Debugw("Found-onu-in-cache", log.Fields{"intfID": intfID, "onuID": onuID})
+ logger.Debugw("found-onu-in-cache",
+ log.Fields{
+ "intf-id": intfID,
+ "onu-id": onuID,
+ "device-id": f.deviceHandler.device.Id})
}
return onuDev.(*OnuDevice), nil
@@ -1441,26 +1808,36 @@
//getChildDevice to fetch onu
func (f *OpenOltFlowMgr) getChildDevice(intfID uint32, onuID uint32) (*voltha.Device, error) {
- logger.Debugw("GetChildDevice", log.Fields{"pon port": intfID, "onuId": onuID})
+ logger.Infow("GetChildDevice",
+ log.Fields{
+ "pon-port": intfID,
+ "onu-id": onuID,
+ "device-id": f.deviceHandler.device.Id})
parentPortNo := IntfIDToPortNo(intfID, voltha.Port_PON_OLT)
onuDevice, err := f.deviceHandler.GetChildDevice(parentPortNo, onuID)
if err != nil {
- return nil, olterrors.NewErrNotFound("onu", log.Fields{
- "interface-id": parentPortNo,
- "onu-id": onuID},
+ return nil, olterrors.NewErrNotFound("onu",
+ log.Fields{
+ "interface-id": parentPortNo,
+ "onu-id": onuID,
+ "device-id": f.deviceHandler.device.Id},
err)
}
- logger.Debugw("Successfully received child device from core", log.Fields{"child_device_id": onuDevice.Id, "child_device_sn": onuDevice.SerialNumber})
+ logger.Infow("successfully-received-child-device-from-core",
+ log.Fields{
+ "device-id": f.deviceHandler.device.Id,
+ "child_device_id": onuDevice.Id,
+ "child_device_sn": onuDevice.SerialNumber})
return onuDevice, nil
}
func findNextFlow(flow *ofp.OfpFlowStats) *ofp.OfpFlowStats {
- logger.Info("unimplemented flow : %v", flow)
+ logger.Info("unimplemented-flow %v", flow)
return nil
}
func (f *OpenOltFlowMgr) clearFlowsAndSchedulerForLogicalPort(childDevice *voltha.Device, logicalPort *voltha.LogicalPort) {
- logger.Info("unimplemented device %v, logicalport %v", childDevice, logicalPort)
+ logger.Info("unimplemented-device %v, logicalport %v", childDevice, logicalPort)
}
func (f *OpenOltFlowMgr) decodeStoredID(id uint64) (uint64, string) {
@@ -1473,12 +1850,20 @@
func (f *OpenOltFlowMgr) sendDeleteGemPortToChild(intfID uint32, onuID uint32, uniID uint32, gemPortID uint32, tpPath string) error {
onuDev, err := f.getOnuDevice(intfID, onuID)
if err != nil {
- logger.Debugw("couldnt-find-onu-child-device", log.Fields{"intfID": intfID, "onuID": onuID, "uniID": uniID})
+ logger.Debugw("couldnt-find-onu-child-device",
+ log.Fields{
+ "intf-id": intfID,
+ "onu-id": onuID,
+ "uni-id": uniID,
+ "device-id": f.deviceHandler.device.Id})
return err
}
delGemPortMsg := &ic.InterAdapterDeleteGemPortMessage{UniId: uniID, TpPath: tpPath, GemPortId: gemPortID}
- logger.Debugw("sending gem port delete to openonu adapter", log.Fields{"msg": *delGemPortMsg})
+ logger.Debugw("sending-gem-port-delete-to-openonu-adapter",
+ log.Fields{
+ "msg": *delGemPortMsg,
+ "device-id": f.deviceHandler.device.Id})
if sendErr := f.deviceHandler.AdapterProxy.SendInterAdapterMessage(context.Background(),
delGemPortMsg,
ic.InterAdapterMessageType_DELETE_GEM_PORT_REQUEST,
@@ -1486,23 +1871,40 @@
onuDev.deviceType,
onuDev.deviceID,
onuDev.proxyDeviceID, ""); sendErr != nil {
- return olterrors.NewErrCommunication("send-delete-gem-port-to-onu-adapter", log.Fields{"fromAdapter": f.deviceHandler.device.Type,
- "toAdapter": onuDev.deviceType, "onuId": onuDev.deviceID,
- "proxyDeviceID": onuDev.proxyDeviceID}, sendErr)
+ return olterrors.NewErrCommunication("send-delete-gem-port-to-onu-adapter",
+ log.Fields{
+ "from-adapter": f.deviceHandler.device.Type,
+ "to-adapter": onuDev.deviceType,
+ "onu-id": onuDev.deviceID,
+ "proxyDeviceID": onuDev.proxyDeviceID,
+ "device-id": f.deviceHandler.device.Id}, sendErr)
}
- logger.Debugw("success sending del gem port to onu adapter", log.Fields{"msg": delGemPortMsg})
+ logger.Infow("success-sending-del-gem-port-to-onu-adapter",
+ log.Fields{
+ "msg": delGemPortMsg,
+ "from-adapter": f.deviceHandler.device.Type,
+ "to-adapter": onuDev.deviceType,
+ "device-id": f.deviceHandler.device.Id})
return nil
}
func (f *OpenOltFlowMgr) sendDeleteTcontToChild(intfID uint32, onuID uint32, uniID uint32, allocID uint32, tpPath string) error {
onuDev, err := f.getOnuDevice(intfID, onuID)
if err != nil {
- logger.Debugw("couldnt-find-onu-child-device", log.Fields{"intfID": intfID, "onuID": onuID, "uniID": uniID})
+ logger.Warnw("couldnt-find-onu-child-device",
+ log.Fields{
+ "intf-id": intfID,
+ "onu-id": onuID,
+ "uni-id": uniID,
+ "device-id": f.deviceHandler.device.Id})
return err
}
delTcontMsg := &ic.InterAdapterDeleteTcontMessage{UniId: uniID, TpPath: tpPath, AllocId: allocID}
- logger.Debugw("sending tcont delete to openonu adapter", log.Fields{"msg": *delTcontMsg})
+ logger.Debugw("sending-tcont-delete-to-openonu-adapter",
+ log.Fields{
+ "msg": *delTcontMsg,
+ "device-id": f.deviceHandler.device.Id})
if sendErr := f.deviceHandler.AdapterProxy.SendInterAdapterMessage(context.Background(),
delTcontMsg,
ic.InterAdapterMessageType_DELETE_TCONT_REQUEST,
@@ -1510,11 +1912,17 @@
onuDev.deviceType,
onuDev.deviceID,
onuDev.proxyDeviceID, ""); sendErr != nil {
- return olterrors.NewErrCommunication("send-delete-tcont-to-onu-adapter", log.Fields{"fromAdapter": f.deviceHandler.device.Type,
- "toAdapter": onuDev.deviceType, "onuId": onuDev.deviceID,
- "proxyDeviceID": onuDev.proxyDeviceID}, sendErr)
+ return olterrors.NewErrCommunication("send-delete-tcont-to-onu-adapter",
+ log.Fields{
+ "from-adapter": f.deviceHandler.device.Type,
+ "to-adapter": onuDev.deviceType, "onu-id": onuDev.deviceID,
+ "proxyDeviceID": onuDev.proxyDeviceID,
+ "device-id": f.deviceHandler.device.Id}, sendErr)
}
- logger.Debugw("success sending del tcont to onu adapter", log.Fields{"msg": delTcontMsg})
+ logger.Infow("success-sending-del-tcont-to-onu-adapter",
+ log.Fields{
+ "msg": delTcontMsg,
+ "device-id": f.deviceHandler.device.Id})
return nil
}
@@ -1524,18 +1932,31 @@
if val.(int) > 0 {
pnFlDels := val.(int) - 1
if pnFlDels > 0 {
- logger.Debugw("flow delete succeeded, more pending",
- log.Fields{"intf": Intf, "onuID": onuID, "uniID": uniID, "currPendingFlowCnt": pnFlDels})
+ logger.Debugw("flow-delete-succeeded--more-pending",
+ log.Fields{
+ "intf": Intf,
+ "onu-id": onuID,
+ "uni-id": uniID,
+ "currpendingflowcnt": pnFlDels,
+ "device-id": f.deviceHandler.device.Id})
f.pendingFlowDelete.Store(pnFlDelKey, pnFlDels)
} else {
- logger.Debugw("all pending flow deletes handled, removing entry from map",
- log.Fields{"intf": Intf, "onuID": onuID, "uniID": uniID})
+ logger.Debugw("all-pending-flow-deletes-handled--removing-entry-from-map",
+ log.Fields{
+ "intf": Intf,
+ "onu-id": onuID,
+ "uni-id": uniID,
+ "device-id": f.deviceHandler.device.Id})
f.pendingFlowDelete.Delete(pnFlDelKey)
}
}
} else {
- logger.Debugw("no pending delete flows found",
- log.Fields{"intf": Intf, "onuID": onuID, "uniID": uniID})
+ logger.Debugw("no-pending-delete-flows-found",
+ log.Fields{
+ "intf": Intf,
+ "onu-id": onuID,
+ "uni-id": uniID,
+ "device-id": f.deviceHandler.device.Id})
}
@@ -1548,8 +1969,13 @@
func (f *OpenOltFlowMgr) deleteGemPortFromLocalCache(intfID uint32, onuID uint32, gemPortID uint32) {
f.lockCache.Lock()
defer f.lockCache.Unlock()
- logger.Debugw("deleting-gem-from-local-cache",
- log.Fields{"gem": gemPortID, "intf": intfID, "onu": onuID, "deviceId": f.deviceHandler.device.Id, "onuGem": f.onuGemInfo[intfID]})
+ logger.Infow("deleting-gem-from-local-cache",
+ log.Fields{
+ "gem": gemPortID,
+ "intf-id": intfID,
+ "onu-id": onuID,
+ "device-id": f.deviceHandler.device.Id,
+ "onu-gem": f.onuGemInfo[intfID]})
onugem := f.onuGemInfo[intfID]
for i, onu := range onugem {
if onu.OnuID == onuID {
@@ -1558,8 +1984,13 @@
if gem == gemPortID {
onu.GemPorts = append(onu.GemPorts[:j], onu.GemPorts[j+1:]...)
onugem[i] = onu
- logger.Debugw("removed-gemport-from-local-cache",
- log.Fields{"intfID": intfID, "onuID": onuID, "deletedGemPortID": gemPortID, "gemPorts": onu.GemPorts, "deviceId": f.deviceHandler.device.Id})
+ logger.Infow("removed-gemport-from-local-cache",
+ log.Fields{
+ "intf-id": intfID,
+ "onu-id": onuID,
+ "deletedgemport-id": gemPortID,
+ "gemports": onu.GemPorts,
+ "device-id": f.deviceHandler.device.Id})
break
}
}
@@ -1575,7 +2006,13 @@
tpID, err := getTpIDFromFlow(flow)
if err != nil {
- return olterrors.NewErrNotFound("tpid", log.Fields{"flow": flow, "pon": Intf, "onuID": onuID, "uniID": uniID}, err)
+ return olterrors.NewErrNotFound("tp-id",
+ log.Fields{
+ "flow": flow,
+ "intf": Intf,
+ "onu-id": onuID,
+ "uni-id": uniID,
+ "device-id": f.deviceHandler.device.Id}, err)
}
if len(updatedFlows) >= 0 {
@@ -1584,38 +2021,61 @@
// For ex: Case of HSIA where same flow is shared
// between DS and US.
if err := f.updateFlowInfoToKVStore(ctx, int32(Intf), int32(onuID), int32(uniID), flowID, &updatedFlows); err != nil {
- olterrors.NewErrPersistence("update", "flow", flowID, log.Fields{"flow": updatedFlows}, err).Log()
+ olterrors.NewErrPersistence("update", "flow", flowID,
+ log.Fields{
+ "flow": updatedFlows,
+ "device-id": f.deviceHandler.device.Id}, err).Log()
}
if len(updatedFlows) == 0 {
// Do this for subscriber flows only (not trap from NNI flows)
if onuID != -1 && uniID != -1 {
pnFlDelKey := pendingFlowDeleteKey{Intf, uint32(onuID), uint32(uniID)}
if val, ok := f.pendingFlowDelete.Load(pnFlDelKey); !ok {
- logger.Debugw("creating entry for pending flow delete",
- log.Fields{"intf": Intf, "onuID": onuID, "uniID": uniID})
+ logger.Debugw("creating-entry-for-pending-flow-delete",
+ log.Fields{
+ "flow-id": flowID,
+ "intf": Intf,
+ "onu-id": onuID,
+ "uni-id": uniID,
+ "device-id": f.deviceHandler.device.Id})
f.pendingFlowDelete.Store(pnFlDelKey, 1)
} else {
pnFlDels := val.(int) + 1
- logger.Debugw("updating flow delete entry",
- log.Fields{"intf": Intf, "onuID": onuID, "uniID": uniID, "currPendingFlowCnt": pnFlDels})
+ logger.Debugw("updating-flow-delete-entry",
+ log.Fields{
+ "flow-id": flowID,
+ "intf": Intf,
+ "onu-id": onuID,
+ "uni-id": uniID,
+ "currPendingFlowCnt": pnFlDels,
+ "device-id": f.deviceHandler.device.Id})
f.pendingFlowDelete.Store(pnFlDelKey, pnFlDels)
}
defer f.deletePendingFlows(Intf, onuID, uniID)
}
- logger.Debugw("releasing-flow-id-to-resource-manager", log.Fields{
- "Intf": Intf, "onuId": onuID, "uniId": uniID, "flowId": flowID,
- "deviceId": f.deviceHandler.device.Id,
- })
+ logger.Debugw("releasing-flow-id-to-resource-manager",
+ log.Fields{
+ "Intf": Intf,
+ "onu-id": onuID,
+ "uni-id": uniID,
+ "flow-id": flowID,
+ "device-id": f.deviceHandler.device.Id})
f.resourceMgr.FreeFlowID(ctx, Intf, int32(onuID), int32(uniID), flowID)
uni := getUniPortPath(f.deviceHandler.device.Id, Intf, onuID, uniID)
tpPath := f.getTPpath(Intf, uni, tpID)
- logger.Debugw("Getting-techprofile-instance-for-subscriber", log.Fields{"TP-PATH": tpPath})
+ logger.Debugw("getting-techprofile-instance-for-subscriber",
+ log.Fields{
+ "TP-PATH": tpPath,
+ "device-id": f.deviceHandler.device.Id})
techprofileInst, err := f.techprofile[Intf].GetTPInstanceFromKVStore(ctx, tpID, tpPath)
if err != nil || techprofileInst == nil { // This should not happen, something wrong in KV backend transaction
- return olterrors.NewErrNotFound("tech-profile-in-kv-store", log.Fields{"tpID": tpID, "path": tpPath}, err)
+ return olterrors.NewErrNotFound("tech-profile-in-kv-store",
+ log.Fields{
+ "tp-id": tpID,
+ "path": tpPath}, err)
}
gemPK := gemPortKey{Intf, uint32(gemPortID)}
@@ -1631,10 +2091,14 @@
break
}
}
- logger.Debugw("Gem port id is still used by other flows", log.Fields{"gemPortID": gemPortID, "usedByFlows": flowIDs})
+ logger.Debugw("gem-port-id-is-still-used-by-other-flows",
+ log.Fields{
+ "gemport-id": gemPortID,
+ "usedByFlows": flowIDs,
+ "device-id": f.deviceHandler.device.Id})
return nil
}
- logger.Debugf("Gem port id %d is not used by another flow - releasing the gem port", gemPortID)
+ logger.Debugf("gem-port-id %d is-not-used-by-another-flow--releasing-the-gem-port", gemPortID)
f.resourceMgr.RemoveGemPortIDForOnu(ctx, Intf, uint32(onuID), uint32(uniID), uint32(gemPortID))
// TODO: The TrafficQueue corresponding to this gem-port also should be removed immediately.
// But it is anyway eventually removed later when the TechProfile is freed, so not a big issue for now.
@@ -1649,8 +2113,14 @@
f.onuIdsLock.Unlock()
// Delete the gem port on the ONU.
if err := f.sendDeleteGemPortToChild(Intf, uint32(onuID), uint32(uniID), uint32(gemPortID), tpPath); err != nil {
- logger.Errorw("error processing delete gem-port towards onu",
- log.Fields{"err": err, "pon": Intf, "onuID": onuID, "uniID": uniID, "gemPortId": gemPortID})
+ logger.Errorw("error-processing-delete-gem-port-towards-onu",
+ log.Fields{
+ "err": err,
+ "intf": Intf,
+ "onu-id": onuID,
+ "uni-id": uniID,
+ "device-id": f.deviceHandler.device.Id,
+ "gemport-id": gemPortID})
}
ok, _ := f.isTechProfileUsedByAnotherGem(ctx, Intf, uint32(onuID), uint32(uniID), tpID, techprofileInst, uint32(gemPortID))
@@ -1662,8 +2132,13 @@
f.resourceMgr.FreeAllocID(ctx, Intf, uint32(onuID), uint32(uniID), techprofileInst.UsScheduler.AllocID)
// Delete the TCONT on the ONU.
if err := f.sendDeleteTcontToChild(Intf, uint32(onuID), uint32(uniID), uint32(techprofileInst.UsScheduler.AllocID), tpPath); err != nil {
- logger.Errorw("error processing delete tcont towards onu",
- log.Fields{"pon": Intf, "onuID": onuID, "uniID": uniID, "allocId": techprofileInst.UsScheduler.AllocID})
+ logger.Errorw("error-processing-delete-tcont-towards-onu",
+ log.Fields{
+ "intf": Intf,
+ "onu-id": onuID,
+ "uni-id": uniID,
+ "device-id": f.deviceHandler.device.Id,
+ "alloc-id": techprofileInst.UsScheduler.AllocID})
}
}
}
@@ -1674,7 +2149,11 @@
// nolint: gocyclo
func (f *OpenOltFlowMgr) clearFlowFromResourceManager(ctx context.Context, flow *ofp.OfpFlowStats, flowDirection string) {
- logger.Debugw("clearFlowFromResourceManager", log.Fields{"flowDirection": flowDirection, "flow": *flow})
+ logger.Infow("clear-flow-from-resource-manager",
+ log.Fields{
+ "flowDirection": flowDirection,
+ "flow": *flow,
+ "device-id": f.deviceHandler.device.Id})
if flowDirection == Multicast {
f.clearMulticastFlowFromResourceManager(ctx, flow)
@@ -1696,16 +2175,19 @@
for _, field := range flows.GetOfbFields(flow) {
if field.Type == flows.IP_PROTO {
classifierInfo[IPProto] = field.GetIpProto()
- logger.Debug("field-type-ip-proto", log.Fields{"classifierInfo[IP_PROTO]": classifierInfo[IPProto].(uint32)})
+ logger.Debugw("field-type-ip-proto", log.Fields{"classifierInfo[IP_PROTO]": classifierInfo[IPProto].(uint32)})
}
}
- logger.Debugw("Extracted access info from flow to be deleted",
- log.Fields{"ponIntf": Intf, "onuID": onuID, "uniID": uniID})
+ logger.Infow("extracted-access-info-from-flow-to-be-deleted",
+ log.Fields{
+ "ponIntf": Intf,
+ "onu-id": onuID,
+ "uni-id": uniID})
if ethType == LldpEthType || ((classifierInfo[IPProto] == IPProtoDhcp) && (flowDirection == "downstream")) {
onuID = -1
uniID = -1
- logger.Debug("Trap on nni flow set oni, uni to -1")
+ logger.Debug("trap-on-nni-flow-set-oni--uni-to- -1")
Intf, err = IntfIDFromNniPortNum(inPort)
if err != nil {
logger.Errorw("invalid-in-port-number",
@@ -1719,8 +2201,12 @@
for _, flowID := range flowIds {
flowInfo := f.resourceMgr.GetFlowIDInfo(ctx, Intf, onuID, uniID, flowID)
if flowInfo == nil {
- logger.Debugw("No FlowInfo found found in KV store",
- log.Fields{"Intf": Intf, "onuID": onuID, "uniID": uniID, "flowID": flowID})
+ logger.Debugw("no-flowinfo-found-in-kv-store",
+ log.Fields{
+ "intf": Intf,
+ "onu-id": onuID,
+ "uni-id": uniID,
+ "flow-id": flowID})
return
}
updatedFlows = nil
@@ -1731,18 +2217,24 @@
for i, storedFlow := range updatedFlows {
if flow.Id == storedFlow.LogicalFlowID {
removeFlowMessage := openoltpb2.Flow{FlowId: storedFlow.Flow.FlowId, FlowType: storedFlow.Flow.FlowType}
- logger.Debugw("Flow to be deleted", log.Fields{"flow": storedFlow})
+ logger.Debugw("flow-to-be-deleted", log.Fields{"flow": storedFlow})
// DKB
if err = f.removeFlowFromDevice(&removeFlowMessage); err != nil {
logger.Errorw("failed-to-remove-flow", log.Fields{"error": err})
return
}
- logger.Debug("Flow removed from device successfully")
+ logger.Info("flow-removed-from-device-successfully")
//Remove the Flow from FlowInfo
updatedFlows = append(updatedFlows[:i], updatedFlows[i+1:]...)
if err = f.clearResources(ctx, flow, Intf, onuID, uniID, storedFlow.Flow.GemportId,
flowID, flowDirection, portNum, updatedFlows); err != nil {
- logger.Error("Failed to clear resources for flow", log.Fields{"flow": storedFlow})
+ logger.Error("failed-to-clear-resources-for-flow",
+ log.Fields{
+ "flow": storedFlow,
+ "device-id": f.deviceHandler.device.Id,
+ "flow-id": flowID,
+ "onu-id": onuID,
+ "intf": Intf})
return
}
}
@@ -1758,7 +2250,7 @@
networkInterfaceID, err := f.getNNIInterfaceIDOfMulticastFlow(ctx, classifierInfo)
if err != nil {
- logger.Warnw("No inPort found. Cannot release resources of the multicast flow.", log.Fields{"flowId:": flow.Id})
+ logger.Warnw("no-inport-found--cannot-release-resources-of-the-multicast-flow", log.Fields{"flowId:": flow.Id})
return
}
@@ -1772,8 +2264,12 @@
for _, flowID = range flowIds {
flowInfo := f.resourceMgr.GetFlowIDInfo(ctx, networkInterfaceID, onuID, uniID, flowID)
if flowInfo == nil {
- logger.Debugw("No multicast FlowInfo found in the KV store",
- log.Fields{"Intf": networkInterfaceID, "onuID": onuID, "uniID": uniID, "flowID": flowID})
+ logger.Debugw("no-multicast-flowinfo-found-in-the-kv-store",
+ log.Fields{
+ "intf": networkInterfaceID,
+ "onu-id": onuID,
+ "uni-id": uniID,
+ "flow-id": flowID})
continue
}
updatedFlows = nil
@@ -1783,7 +2279,11 @@
for i, storedFlow := range updatedFlows {
if flow.Id == storedFlow.LogicalFlowID {
removeFlowMessage := openoltpb2.Flow{FlowId: storedFlow.Flow.FlowId, FlowType: storedFlow.Flow.FlowType}
- logger.Debugw("Multicast flow to be deleted", log.Fields{"flow": storedFlow})
+ logger.Debugw("multicast-flow-to-be-deleted",
+ log.Fields{
+ "flow": storedFlow,
+ "flow-id": flow.Id,
+ "device-id": f.deviceHandler.device.Id})
//remove from device
if err := f.removeFlowFromDevice(&removeFlowMessage); err != nil {
// DKB
@@ -1793,15 +2293,19 @@
"error": err})
return
}
- logger.Debugw("Multicast flow removed from device successfully", log.Fields{"flowId": flow.Id})
+ logger.Infow("multicast-flow-removed-from-device-successfully", log.Fields{"flow-id": flow.Id})
//Remove the Flow from FlowInfo
updatedFlows = append(updatedFlows[:i], updatedFlows[i+1:]...)
if err := f.updateFlowInfoToKVStore(ctx, int32(networkInterfaceID), NoneOnuID, NoneUniID, flowID, &updatedFlows); err != nil {
- logger.Error("Failed to delete multicast flow from the KV store", log.Fields{"flow": storedFlow, "err": err})
+ logger.Errorw("failed-to-delete-multicast-flow-from-the-kv-store",
+ log.Fields{"flow": storedFlow,
+ "err": err})
return
}
//release flow id
- logger.Debugw("Releasing multicast flow id", log.Fields{"flowId": flowID, "interfaceID": networkInterfaceID})
+ logger.Debugw("releasing-multicast-flow-id",
+ log.Fields{"flow-id": flowID,
+ "interfaceID": networkInterfaceID})
f.resourceMgr.FreeFlowID(ctx, uint32(networkInterfaceID), NoneOnuID, NoneUniID, flowID)
}
}
@@ -1810,7 +2314,7 @@
//RemoveFlow removes the flow from the device
func (f *OpenOltFlowMgr) RemoveFlow(ctx context.Context, flow *ofp.OfpFlowStats) error {
- logger.Debugw("Removing Flow", log.Fields{"flow": flow})
+ logger.Infow("removing-flow", log.Fields{"flow": flow})
var direction string
actionInfo := make(map[string]interface{})
@@ -1820,7 +2324,7 @@
actionInfo[Output] = out.GetPort()
logger.Debugw("action-type-output", log.Fields{"out_port": actionInfo[Output].(uint32)})
} else {
- logger.Error("Invalid output port in action")
+ logger.Error("invalid-output-port-in-action")
return olterrors.NewErrInvalidValue(log.Fields{"invalid-out-port-action": 0}, nil)
}
}
@@ -1849,7 +2353,7 @@
f.perUserFlowHandleLock.Unlock(userKey)
} else {
// Ideally this should never happen
- logger.Errorw("failed to acquire lock to remove flow, flow remove aborted", log.Fields{"flow": flow})
+ logger.Errorw("failed-to-acquire-lock-to-remove-flow--remove-aborted", log.Fields{"flow": flow})
return errors.New("failed-to-acquire-per-user-lock")
}
@@ -1863,12 +2367,12 @@
select {
case <-time.After(20 * time.Millisecond):
if flowDelRefCnt, ok := f.pendingFlowDelete.Load(pnFlDelKey); !ok || flowDelRefCnt == 0 {
- logger.Debug("pending flow deletes completed")
+ logger.Debug("pending-flow-deletes-completed")
ch <- true
return
}
case <-ctx.Done():
- logger.Error("flow delete wait handler routine canceled")
+ logger.Error("flow-delete-wait-handler-routine-canceled")
return
}
}
@@ -1898,7 +2402,10 @@
var UsMeterID uint32
var DsMeterID uint32
- logger.Debug("Adding Flow", log.Fields{"flow": flow, "flowMetadata": flowMetadata})
+ logger.Infow("adding-flow",
+ log.Fields{
+ "flow": flow,
+ "flowmetadata": flowMetadata})
formulateClassifierInfoFromFlow(classifierInfo, flow)
err := formulateActionInfoFromFlow(actionInfo, classifierInfo, flow)
@@ -1920,12 +2427,15 @@
return err
}
- logger.Infow("Flow ports", log.Fields{"classifierInfo_inport": classifierInfo[InPort], "action_output": actionInfo[Output]})
+ logger.Debugw("flow-ports",
+ log.Fields{
+ "classifierinfo_inport": classifierInfo[InPort],
+ "action_output": actionInfo[Output]})
portNo, intfID, onuID, uniID := ExtractAccessFromFlow(classifierInfo[InPort].(uint32), actionInfo[Output].(uint32))
if ethType, ok := classifierInfo[EthType]; ok {
if ethType.(uint32) == LldpEthType {
- logger.Info("Adding LLDP flow")
+ logger.Info("adding-lldp-flow")
return f.addLLDPFlow(ctx, flow, portNo)
}
}
@@ -1949,32 +2459,54 @@
TpID, err := getTpIDFromFlow(flow)
if err != nil {
- return olterrors.NewErrNotFound("tpid-for-flow", log.Fields{"flow": flow, "pon": IntfID, "onuID": onuID, "uniID": uniID}, err)
+ return olterrors.NewErrNotFound("tpid-for-flow",
+ log.Fields{
+ "flow": flow,
+ "intf-id": IntfID,
+ "onu-id": onuID,
+ "uni-id": uniID}, err)
}
- logger.Debugw("TPID for this subcriber", log.Fields{"TpId": TpID, "pon": intfID, "onuID": onuID, "uniID": uniID})
+ logger.Debugw("tpid-for-this-subcriber",
+ log.Fields{
+ "tp-id": TpID,
+ "intf-id": intfID,
+ "onu-id": onuID,
+ "uni-id": uniID})
if IsUpstream(actionInfo[Output].(uint32)) {
UsMeterID = flows.GetMeterIdFromFlow(flow)
- logger.Debugw("Upstream-flow-meter-id", log.Fields{"UsMeterID": UsMeterID})
+ logger.Debugw("upstream-flow-meter-id", log.Fields{"us-meter-id": UsMeterID})
} else {
DsMeterID = flows.GetMeterIdFromFlow(flow)
- logger.Debugw("Downstream-flow-meter-id", log.Fields{"DsMeterID": DsMeterID})
+ logger.Debugw("downstream-flow-meter-id", log.Fields{"ds-meter-id": DsMeterID})
}
pnFlDelKey := pendingFlowDeleteKey{intfID, onuID, uniID}
if _, ok := f.pendingFlowDelete.Load(pnFlDelKey); !ok {
- logger.Debugw("no pending flows found, going ahead with flow install", log.Fields{"pon": intfID, "onuID": onuID, "uniID": uniID})
+ logger.Debugw("no-pending-flows-found--going-ahead-with-flow-install",
+ log.Fields{
+ "intf-id": intfID,
+ "onu-id": onuID,
+ "uni-id": uniID})
f.divideAndAddFlow(ctx, intfID, onuID, uniID, portNo, classifierInfo, actionInfo, flow, uint32(TpID), UsMeterID, DsMeterID, flowMetadata)
} else {
pendingFlowDelComplete := make(chan bool)
go f.waitForFlowDeletesToCompleteForOnu(ctx, intfID, onuID, uniID, pendingFlowDelComplete)
select {
case <-pendingFlowDelComplete:
- logger.Debugw("all pending flow deletes completed", log.Fields{"pon": intfID, "onuID": onuID, "uniID": uniID})
+ logger.Debugw("all-pending-flow-deletes-completed",
+ log.Fields{
+ "intf-id": intfID,
+ "onu-id": onuID,
+ "uni-id": uniID})
f.divideAndAddFlow(ctx, intfID, onuID, uniID, portNo, classifierInfo, actionInfo, flow, uint32(TpID), UsMeterID, DsMeterID, flowMetadata)
case <-time.After(10 * time.Second):
- return olterrors.NewErrTimeout("pending-flow-deletes", log.Fields{"pon": intfID, "onuID": onuID, "uniID": uniID}, nil)
+ return olterrors.NewErrTimeout("pending-flow-deletes",
+ log.Fields{
+ "intf-id": intfID,
+ "onu-id": onuID,
+ "uni-id": uniID}, nil)
}
}
return nil
@@ -1983,7 +2515,9 @@
// handleFlowWithGroup adds multicast flow to the device.
func (f *OpenOltFlowMgr) handleFlowWithGroup(ctx context.Context, actionInfo, classifierInfo map[string]interface{}, flow *ofp.OfpFlowStats) error {
classifierInfo[PacketTagType] = DoubleTag
- logger.Debugw("add-multicast-flow", log.Fields{"classifierInfo": classifierInfo, "actionInfo": actionInfo})
+ logger.Debugw("add-multicast-flow", log.Fields{
+ "classifier-info": classifierInfo,
+ "actionInfo": actionInfo})
networkInterfaceID, err := f.getNNIInterfaceIDOfMulticastFlow(ctx, classifierInfo)
if err != nil {
@@ -2002,7 +2536,10 @@
multicastMac := flows.ConvertToMulticastMacBytes(ipv4Dst.(uint32))
delete(classifierInfo, Ipv4Dst)
classifierInfo[EthDst] = multicastMac
- logger.Debugw("multicast-ip-to-mac-conversion-success", log.Fields{"ip:": ipv4Dst.(uint32), "mac:": multicastMac})
+ logger.Debugw("multicast-ip-to-mac-conversion-success",
+ log.Fields{
+ "ip:": ipv4Dst.(uint32),
+ "mac:": multicastMac})
}
}
delete(classifierInfo, EthType)
@@ -2013,17 +2550,18 @@
flowStoreCookie := getFlowStoreCookie(classifierInfo, uint32(0))
if present := f.resourceMgr.IsFlowCookieOnKVStore(ctx, uint32(networkInterfaceID), int32(onuID), int32(uniID), flowStoreCookie); present {
- logger.Debugw("multicast-flow-exists-not-re-adding", log.Fields{"classifierInfo": classifierInfo})
+ logger.Infow("multicast-flow-exists-not-re-adding", log.Fields{"classifier-info": classifierInfo})
return nil
}
flowID, err := f.resourceMgr.GetFlowID(ctx, uint32(networkInterfaceID), int32(onuID), int32(uniID), uint32(gemPortID), flowStoreCookie, "", 0, 0)
if err != nil {
- return olterrors.NewErrNotFound("multicast-flow-id", log.Fields{
- "interface-id": networkInterfaceID,
- "onu-id": onuID,
- "uni-id": uniID,
- "gem-port-id": gemPortID,
- "cookie": flowStoreCookie},
+ return olterrors.NewErrNotFound("multicast-flow-id",
+ log.Fields{
+ "interface-id": networkInterfaceID,
+ "onu-id": onuID,
+ "uni-id": uniID,
+ "gem-port-id": gemPortID,
+ "cookie": flowStoreCookie},
err)
}
classifierProto, err := makeOpenOltClassifierField(classifierInfo)
@@ -2043,7 +2581,7 @@
if err = f.addFlowToDevice(ctx, flow, &multicastFlow); err != nil {
return olterrors.NewErrFlowOp("add", flowID, log.Fields{"flow": multicastFlow}, err)
}
- logger.Debug("multicast flow added to device successfully")
+ logger.Info("multicast-flow-added-to-device-successfully")
//get cached group
group, _, err := f.GetFlowGroupFromKVStore(ctx, groupID, true)
if err == nil {
@@ -2096,7 +2634,7 @@
Action: f.buildGroupAction(),
}
- logger.Debugw("Sending group to device", log.Fields{"groupToOlt": groupToOlt})
+ logger.Debugw("sending-group-to-device", log.Fields{"groupToOlt": groupToOlt})
_, err := f.deviceHandler.Client.PerformGroupOperation(ctx, &groupToOlt)
if err != nil {
return olterrors.NewErrAdapter("add-group-operation-failed", log.Fields{"groupToOlt": groupToOlt}, err)
@@ -2105,7 +2643,7 @@
if err := f.resourceMgr.AddFlowGroupToKVStore(ctx, group, true); err != nil {
return olterrors.NewErrPersistence("add", "flow-group", group.Desc.GroupId, log.Fields{"group": group}, err)
}
- logger.Debugw("add-group operation performed on the device successfully ", log.Fields{"groupToOlt": groupToOlt})
+ logger.Infow("add-group-operation-performed-on-the-device-successfully ", log.Fields{"groupToOlt": groupToOlt})
return nil
}
@@ -2138,19 +2676,27 @@
if groupExists {
// group already exists
current = f.buildGroup(group.Desc.GroupId, val.Desc.GetBuckets())
- logger.Debugw("modify-group: group exists.", log.Fields{"group on the device": val, "new": group})
+ logger.Debugw("modify-group--group exists",
+ log.Fields{
+ "group on the device": val,
+ "new": group})
} else {
current = f.buildGroup(group.Desc.GroupId, nil)
}
- logger.Debugw("modify-group: comparing current and new.", log.Fields{"group on the device": current, "new": newGroup})
+ logger.Debugw("modify-group--comparing-current-and-new",
+ log.Fields{
+ "group on the device": current,
+ "new": newGroup})
// get members to be added
membersToBeAdded := f.findDiff(current, newGroup)
// get members to be removed
membersToBeRemoved := f.findDiff(newGroup, current)
- logger.Infow("modify-group -> differences found", log.Fields{"membersToBeAdded": membersToBeAdded,
- "membersToBeRemoved": membersToBeRemoved, "groupId": group.Desc.GroupId})
+ logger.Infow("modify-group--differences found", log.Fields{
+ "membersToBeAdded": membersToBeAdded,
+ "membersToBeRemoved": membersToBeRemoved,
+ "groupId": group.Desc.GroupId})
groupToOlt := openoltpb2.Group{
GroupId: group.Desc.GroupId,
@@ -2174,9 +2720,12 @@
if err := f.resourceMgr.AddFlowGroupToKVStore(ctx, group, false); err != nil {
return olterrors.NewErrPersistence("add", "flow-group", group.Desc.GroupId, log.Fields{"group": group}, err)
}
- logger.Debugw("modify-group was success. Storing the group", log.Fields{"group": group, "existingGroup": current})
+ logger.Infow("modify-group-was-success--storing-group",
+ log.Fields{
+ "group": group,
+ "existingGroup": current})
} else {
- logger.Warnw("One of the group add/remove operations has failed. Cannot save group modifications",
+ logger.Warnw("one-of-the-group-add/remove-operations-failed--cannot-save-group-modifications",
log.Fields{"group": group})
if errAdd != nil {
return errAdd
@@ -2222,7 +2771,10 @@
//performGroupOperation call performGroupOperation operation of openolt proto
func (f *OpenOltFlowMgr) performGroupOperation(group *openoltpb2.Group) error {
- logger.Debugw("Sending group to device", log.Fields{"groupToOlt": group, "command": group.Command})
+ logger.Debugw("sending-group-to-device",
+ log.Fields{
+ "groupToOlt": group,
+ "command": group.Command})
_, err := f.deviceHandler.Client.PerformGroupOperation(context.Background(), group)
if err != nil {
return olterrors.NewErrAdapter("group-operation-failed", log.Fields{"groupToOlt": group}, err)
@@ -2258,12 +2810,14 @@
}
if !outPortFound {
- logger.Debugw("bucket skipped since no out port found in it",
- log.Fields{"ofBucket": ofBucket})
+ logger.Debugw("bucket-skipped-since-no-out-port-found-in-it", log.Fields{"ofBucket": ofBucket})
return nil
}
interfaceID := IntfIDFromUniPortNum(outPort)
- logger.Debugw("got associated interface id of the port", log.Fields{"portNumber:": outPort, "interfaceId:": interfaceID})
+ logger.Debugw("got-associated-interface-id-of-the-port",
+ log.Fields{
+ "portNumber:": outPort,
+ "interfaceId:": interfaceID})
if groupInfo, ok := f.interfaceToMcastQueueMap[interfaceID]; ok {
member := openoltpb2.GroupMember{
InterfaceId: interfaceID,
@@ -2274,8 +2828,7 @@
//add member to the group
return &member
}
- logger.Warnf("bucket skipped since interface-2-gem mapping cannot be found",
- log.Fields{"ofBucket": ofBucket})
+ logger.Warnf("bucket-skipped-since-interface-2-gem-mapping-cannot-be-found", log.Fields{"ofBucket": ofBucket})
return nil
}
@@ -2284,14 +2837,18 @@
onuDev, err := f.getOnuDevice(intfID, onuID)
if err != nil {
- logger.Errorw("couldnt-find-onu-child-device", log.Fields{"intfID": intfID, "onuID": onuID, "uniID": uniID})
+ logger.Errorw("couldnt-find-onu-child-device",
+ log.Fields{
+ "intf-id": intfID,
+ "onu-id": onuID,
+ "uni-id": uniID})
return err
}
- logger.Debugw("Got child device from OLT device handler", log.Fields{"deviceId": onuDev.deviceID})
+ logger.Debugw("got-child-device-from-olt-device-handler", log.Fields{"onu-id": onuDev.deviceID})
tpPath := f.getTPpath(intfID, uni, TpID)
tpDownloadMsg := &ic.InterAdapterTechProfileDownloadMessage{UniId: uniID, Path: tpPath}
- logger.Infow("Sending Load-tech-profile-request-to-brcm-onu-adapter", log.Fields{"msg": *tpDownloadMsg})
+ logger.Debugw("sending-load-tech-profile-request-to-brcm-onu-adapter", log.Fields{"msg": *tpDownloadMsg})
sendErr := f.deviceHandler.AdapterProxy.SendInterAdapterMessage(context.Background(),
tpDownloadMsg,
ic.InterAdapterMessageType_TECH_PROFILE_DOWNLOAD_REQUEST,
@@ -2300,11 +2857,14 @@
onuDev.deviceID,
onuDev.proxyDeviceID, "")
if sendErr != nil {
- return olterrors.NewErrCommunication("send-techprofile-download-request", log.Fields{"fromAdapter": f.deviceHandler.device.Type,
- "toAdapter": onuDev.deviceType, "onuId": onuDev.deviceID,
- "proxyDeviceID": onuDev.proxyDeviceID}, sendErr)
+ return olterrors.NewErrCommunication("send-techprofile-download-request",
+ log.Fields{
+ "from-adapter": f.deviceHandler.device.Type,
+ "to-adapter": onuDev.deviceType,
+ "onu-id": onuDev.deviceID,
+ "proxyDeviceID": onuDev.proxyDeviceID}, sendErr)
}
- logger.Debugw("success Sending Load-tech-profile-request-to-brcm-onu-adapter", log.Fields{"msg": tpDownloadMsg})
+ logger.Infow("success-sending-load-tech-profile-request-to-brcm-onu-adapter", log.Fields{"msg": tpDownloadMsg})
return nil
}
@@ -2318,7 +2878,13 @@
if err := f.resourceMgr.AddOnuGemInfo(ctx, intfID, onu); err != nil {
return err
}
- logger.Debugw("Updated onuinfo", log.Fields{"intfID": intfID, "onuID": onuID, "serialNum": serialNum, "onu": onu, "deviceId": f.deviceHandler.device.Id})
+ logger.Infow("updated-onuinfo",
+ log.Fields{
+ "intf-id": intfID,
+ "onu-id": onuID,
+ "serial-num": serialNum,
+ "onu": onu,
+ "device-id": f.deviceHandler.device.Id})
return nil
}
@@ -2326,8 +2892,13 @@
func (f *OpenOltFlowMgr) addGemPortToOnuInfoMap(ctx context.Context, intfID uint32, onuID uint32, gemPort uint32) {
f.lockCache.Lock()
defer f.lockCache.Unlock()
- logger.Debugw("adding-gem-to-onu-info-map",
- log.Fields{"gem": gemPort, "intf": intfID, "onu": onuID, "deviceId": f.deviceHandler.device.Id, "onuGem": f.onuGemInfo[intfID]})
+ logger.Infow("adding-gem-to-onu-info-map",
+ log.Fields{
+ "gem": gemPort,
+ "intf": intfID,
+ "onu": onuID,
+ "device-id": f.deviceHandler.device.Id,
+ "onu-gem": f.onuGemInfo[intfID]})
onugem := f.onuGemInfo[intfID]
// update the gem to the local cache as well as to kv strore
for idx, onu := range onugem {
@@ -2336,7 +2907,9 @@
for _, gem := range onu.GemPorts {
if gem == gemPort {
logger.Debugw("gem-already-in-cache-no-need-to-update-cache-and-kv-store",
- log.Fields{"gem": gemPort, "deviceId": f.deviceHandler.device.Id})
+ log.Fields{
+ "gem": gemPort,
+ "device-id": f.deviceHandler.device.Id})
return
}
}
@@ -2346,11 +2919,21 @@
}
err := f.resourceMgr.AddGemToOnuGemInfo(ctx, intfID, onuID, gemPort)
if err != nil {
- logger.Errorw("failed-to-add-gem-to-onu", log.Fields{"intfId": intfID, "onuId": onuID, "gemPort": gemPort, "deviceId": f.deviceHandler.device.Id})
+ logger.Errorw("failed-to-add-gem-to-onu",
+ log.Fields{
+ "intf-id": intfID,
+ "onu-id": onuID,
+ "gemPort": gemPort,
+ "device-id": f.deviceHandler.device.Id})
return
}
- logger.Debugw("gem-added-to-onu-info-map",
- log.Fields{"gem": gemPort, "intf": intfID, "onu": onuID, "deviceId": f.deviceHandler.device.Id, "onuGem": f.onuGemInfo[intfID]})
+ logger.Infow("gem-added-to-onu-info-map",
+ log.Fields{
+ "gem": gemPort,
+ "intf": intfID,
+ "onu": onuID,
+ "device-id": f.deviceHandler.device.Id,
+ "onu-gem": f.onuGemInfo[intfID]})
}
// This function Lookup maps by serialNumber or (intfId, gemPort)
@@ -2361,9 +2944,13 @@
f.lockCache.Lock()
defer f.lockCache.Unlock()
- logger.Debugw("Getting-ONU-ID-from-GEM-port-and-PON-port", log.Fields{
- "deviceId": f.deviceHandler.device.Id, "onuGemInfo": f.onuGemInfo[intfID],
- "serialNumber": serialNumber, "intfId": intfID, "gemPortId": gemPortID})
+ logger.Infow("getting-onu-id-from-gem-port-and-pon-port",
+ log.Fields{
+ "device-id": f.deviceHandler.device.Id,
+ "onu-geminfo": f.onuGemInfo[intfID],
+ "serial-number": serialNumber,
+ "intf-id": intfID,
+ "gemport-id": gemPortID})
// get onuid from the onugem info cache
onugem := f.onuGemInfo[intfID]
@@ -2405,11 +2992,12 @@
} else if packetIn.IntfType == "nni" {
logicalPortNum = IntfIDToPortNo(packetIn.IntfId, voltha.Port_ETHERNET_NNI)
}
- logger.Debugw("Retrieved logicalport from packet-in", log.Fields{
- "logicalPortNum": logicalPortNum,
- "IntfType": packetIn.IntfType,
- "packet": hex.EncodeToString(packetIn.Pkt),
- })
+ logger.Infow("retrieved-logicalport-from-packet-in",
+ log.Fields{
+ "logical-port-num": logicalPortNum,
+ "intf-type": packetIn.IntfType,
+ "packet": hex.EncodeToString(packetIn.Pkt),
+ })
return logicalPortNum, nil
}
@@ -2424,7 +3012,10 @@
gemPortID, ok := f.packetInGemPort[pktInkey]
if ok {
- logger.Debugw("Found gemport for pktin key", log.Fields{"pktinkey": pktInkey, "gem": gemPortID})
+ logger.Debugw("found-gemport-for-pktin-key",
+ log.Fields{
+ "pktinkey": pktInkey,
+ "gem": gemPortID})
return gemPortID, err
}
//If gem is not found in cache try to get it from kv store, if found in kv store, update the cache and return.
@@ -2432,12 +3023,17 @@
if err == nil {
if gemPortID != 0 {
f.packetInGemPort[pktInkey] = gemPortID
- logger.Debugw("Found gem port from kv store and updating cache with gemport",
- log.Fields{"pktinkey": pktInkey, "gem": gemPortID})
+ logger.Infow("found-gem-port-from-kv-store-and-updating-cache-with-gemport",
+ log.Fields{
+ "pktinkey": pktInkey,
+ "gem": gemPortID})
return gemPortID, nil
}
}
- return uint32(0), olterrors.NewErrNotFound("gem-port", log.Fields{"pktinkey": pktInkey, "gem": gemPortID}, err)
+ return uint32(0), olterrors.NewErrNotFound("gem-port",
+ log.Fields{
+ "pktinkey": pktInkey,
+ "gem": gemPortID}, err)
}
func installFlowOnAllGemports(ctx context.Context,
@@ -2457,7 +3053,11 @@
direction string,
tpID uint32,
vlanID ...uint32) {
- logger.Debugw("Installing flow on all GEM ports", log.Fields{"FlowType": FlowType, "gemPorts": gemPorts, "vlan": vlanID})
+ logger.Debugw("installing-flow-on-all-gem-ports",
+ log.Fields{
+ "FlowType": FlowType,
+ "gemPorts": gemPorts,
+ "vlan": vlanID})
// The bit mapping for a gemport is expressed in tech-profile as a binary string. For example, 0b00000001
// We need to trim prefix "0b", before further processing
@@ -2510,7 +3110,7 @@
}
func (f *OpenOltFlowMgr) addDHCPTrapFlowOnNNI(ctx context.Context, logicalFlow *ofp.OfpFlowStats, classifier map[string]interface{}, portNo uint32) error {
- logger.Debug("Adding trap-dhcp-of-nni-flow")
+ logger.Debug("adding-trap-dhcp-of-nni-flow")
action := make(map[string]interface{})
classifier[PacketTagType] = DoubleTag
action[TrapToHost] = true
@@ -2531,37 +3131,39 @@
allocID := -1
networkInterfaceID, err := getNniIntfID(classifier, action)
if err != nil {
- return olterrors.NewErrNotFound("nni-intreface-id", log.Fields{
- "classifier": classifier,
- "action": action},
+ return olterrors.NewErrNotFound("nni-intreface-id",
+ log.Fields{
+ "classifier": classifier,
+ "action": action},
err)
}
flowStoreCookie := getFlowStoreCookie(classifier, uint32(0))
if present := f.resourceMgr.IsFlowCookieOnKVStore(ctx, uint32(networkInterfaceID), int32(onuID), int32(uniID), flowStoreCookie); present {
- logger.Debug("Flow-exists-not-re-adding")
+ logger.Info("flow-exists-not-re-adding")
return nil
}
flowID, err := f.resourceMgr.GetFlowID(ctx, uint32(networkInterfaceID), int32(onuID), int32(uniID), uint32(gemPortID), flowStoreCookie, "", 0, 0)
if err != nil {
- return olterrors.NewErrNotFound("dhcp-trap-nni-flow-id", log.Fields{
- "interface-id": networkInterfaceID,
- "onu-id": onuID,
- "uni-id": uniID,
- "gem-port-id": gemPortID,
- "cookie": flowStoreCookie},
+ return olterrors.NewErrNotFound("dhcp-trap-nni-flow-id",
+ log.Fields{
+ "interface-id": networkInterfaceID,
+ "onu-id": onuID,
+ "uni-id": uniID,
+ "gem-port-id": gemPortID,
+ "cookie": flowStoreCookie},
err)
}
classifierProto, err := makeOpenOltClassifierField(classifier)
if err != nil {
return olterrors.NewErrInvalidValue(log.Fields{"classifier": classifier}, err)
}
- logger.Debugw("Created classifier proto", log.Fields{"classifier": *classifierProto})
+ logger.Debugw("created-classifier-proto", log.Fields{"classifier": *classifierProto})
actionProto, err := makeOpenOltActionField(action, classifier)
if err != nil {
return olterrors.NewErrInvalidValue(log.Fields{"action": action}, err)
}
- logger.Debugw("Created action proto", log.Fields{"action": *actionProto})
+ logger.Debugw("created-action-proto", log.Fields{"action": *actionProto})
downstreamflow := openoltpb2.Flow{AccessIntfId: int32(-1), // AccessIntfId not required
OnuId: int32(onuID), // OnuId not required
UniId: int32(uniID), // UniId not used
@@ -2578,7 +3180,7 @@
if err := f.addFlowToDevice(ctx, logicalFlow, &downstreamflow); err != nil {
return olterrors.NewErrFlowOp("add", flowID, log.Fields{"flow": downstreamflow}, err)
}
- logger.Debug("DHCP trap on NNI flow added to device successfully")
+ logger.Info("dhcp-trap-on-nni-flow-added–to-device-successfully")
flowsToKVStore := f.getUpdatedFlowInfo(ctx, &downstreamflow, flowStoreCookie, "", flowID, logicalFlow.Id)
if err := f.updateFlowInfoToKVStore(ctx, int32(networkInterfaceID),
int32(onuID),
@@ -2617,7 +3219,7 @@
//addIgmpTrapFlowOnNNI adds a trap-to-host flow on NNI
func (f *OpenOltFlowMgr) addIgmpTrapFlowOnNNI(ctx context.Context, logicalFlow *ofp.OfpFlowStats, classifier map[string]interface{}, portNo uint32) error {
- logger.Debugw("Adding igmp-trap-of-nni-flow", log.Fields{"classifierInfo": classifier})
+ logger.Infow("adding-igmp-trap-of-nni-flow", log.Fields{"classifier-info": classifier})
action := make(map[string]interface{})
classifier[PacketTagType] = getPacketTypeFromClassifiers(classifier)
action[TrapToHost] = true
@@ -2645,29 +3247,30 @@
}
flowStoreCookie := getFlowStoreCookie(classifier, uint32(0))
if present := f.resourceMgr.IsFlowCookieOnKVStore(ctx, uint32(networkInterfaceID), int32(onuID), int32(uniID), flowStoreCookie); present {
- logger.Debug("igmp-flow-exists-not-re-adding")
+ logger.Info("igmp-flow-exists-not-re-adding")
return nil
}
flowID, err := f.resourceMgr.GetFlowID(ctx, uint32(networkInterfaceID), int32(onuID), int32(uniID), uint32(gemPortID), flowStoreCookie, "", 0, 0)
if err != nil {
- return olterrors.NewErrNotFound("igmp-flow-id", log.Fields{
- "interface-id": networkInterfaceID,
- "onu-id": onuID,
- "uni-id": uniID,
- "gem-port-id": gemPortID,
- "cookie": flowStoreCookie},
+ return olterrors.NewErrNotFound("igmp-flow-id",
+ log.Fields{
+ "interface-id": networkInterfaceID,
+ "onu-id": onuID,
+ "uni-id": uniID,
+ "gem-port-id": gemPortID,
+ "cookie": flowStoreCookie},
err)
}
classifierProto, err := makeOpenOltClassifierField(classifier)
if err != nil {
return olterrors.NewErrInvalidValue(log.Fields{"classifier": classifier}, err)
}
- logger.Debugw("Created classifier proto for the IGMP flow", log.Fields{"classifier": *classifierProto})
+ logger.Debugw("created-classifier-proto-for-the-igmp-flow", log.Fields{"classifier": *classifierProto})
actionProto, err := makeOpenOltActionField(action, classifier)
if err != nil {
return olterrors.NewErrInvalidValue(log.Fields{"action": action}, err)
}
- logger.Debugw("Created action proto for the IGMP flow", log.Fields{"action": *actionProto})
+ logger.Debugw("created-action-proto-for-the-igmp-flow", log.Fields{"action": *actionProto})
downstreamflow := openoltpb2.Flow{AccessIntfId: int32(-1), // AccessIntfId not required
OnuId: int32(onuID), // OnuId not required
UniId: int32(uniID), // UniId not used
@@ -2684,7 +3287,7 @@
if err := f.addFlowToDevice(ctx, logicalFlow, &downstreamflow); err != nil {
return olterrors.NewErrFlowOp("add", flowID, log.Fields{"flow": downstreamflow}, err)
}
- logger.Debug("IGMP Trap on NNI flow added to device successfully")
+ logger.Info("igmp-trap-on-nni-flow-added-to-device-successfully")
flowsToKVStore := f.getUpdatedFlowInfo(ctx, &downstreamflow, flowStoreCookie, "", flowID, logicalFlow.Id)
if err := f.updateFlowInfoToKVStore(ctx, int32(networkInterfaceID),
int32(onuID),
@@ -2718,7 +3321,7 @@
allocID := TpInst.UsScheduler.AllocID
if ipProto, ok := classifierInfo[IPProto]; ok {
if ipProto.(uint32) == IPProtoDhcp {
- logger.Info("Adding DHCP flow")
+ logger.Info("adding-dhcp-flow")
if pcp, ok := classifierInfo[VlanPcp]; ok {
gemPort = f.techprofile[intfID].GetGemportIDForPbit(TpInst,
tp_pb.Direction_UPSTREAM,
@@ -2732,7 +3335,12 @@
}
} else if ipProto.(uint32) == IgmpProto {
- logger.Infow("Adding Us IGMP flow", log.Fields{"intfID": intfID, "onuID": onuID, "uniID": uniID, "classifierInfo:": classifierInfo})
+ logger.Infow("adding-us-igmp-flow",
+ log.Fields{
+ "intf-id": intfID,
+ "onu-id": onuID,
+ "uni-id": uniID,
+ "classifier-info:": classifierInfo})
if pcp, ok := classifierInfo[VlanPcp]; ok {
gemPort = f.techprofile[intfID].GetGemportIDForPbit(TpInst,
tp_pb.Direction_UPSTREAM,
@@ -2743,12 +3351,12 @@
installFlowOnAllGemports(ctx, f.addIGMPTrapFlow, nil, args, classifierInfo, actionInfo, flow, gemPorts, TpInst, IgmpFlow, Upstream, tpID)
}
} else {
- logger.Errorw("Invalid-Classifier-to-handle", log.Fields{"classifier": classifierInfo, "action": actionInfo})
+ logger.Errorw("invalid-classifier-to-handle", log.Fields{"classifier": classifierInfo, "action": actionInfo})
return
}
} else if ethType, ok := classifierInfo[EthType]; ok {
if ethType.(uint32) == EapEthType {
- logger.Info("Adding EAPOL flow")
+ logger.Info("adding-eapol-flow")
var vlanID uint32
if val, ok := classifierInfo[VlanVid]; ok {
vlanID = (val.(uint32)) & VlanvIDMask
@@ -2766,7 +3374,7 @@
}
}
} else if _, ok := actionInfo[PushVlan]; ok {
- logger.Info("Adding upstream data rule")
+ logger.Info("adding-upstream-data-rule")
if pcp, ok := classifierInfo[VlanPcp]; ok {
gemPort = f.techprofile[intfID].GetGemportIDForPbit(TpInst,
tp_pb.Direction_UPSTREAM,
@@ -2778,7 +3386,7 @@
installFlowOnAllGemports(ctx, f.addUpstreamDataFlow, nil, args, classifierInfo, actionInfo, flow, gemPorts, TpInst, HsiaFlow, Upstream, tpID)
}
} else if _, ok := actionInfo[PopVlan]; ok {
- logger.Info("Adding Downstream data rule")
+ logger.Info("adding-downstream-data-rule")
if pcp, ok := classifierInfo[VlanPcp]; ok {
gemPort = f.techprofile[intfID].GetGemportIDForPbit(TpInst,
tp_pb.Direction_DOWNSTREAM,
@@ -2790,7 +3398,11 @@
installFlowOnAllGemports(ctx, f.addDownstreamDataFlow, nil, args, classifierInfo, actionInfo, flow, gemPorts, TpInst, HsiaFlow, Downstream, tpID)
}
} else {
- logger.Errorw("Invalid-flow-type-to-handle", log.Fields{"classifier": classifierInfo, "action": actionInfo, "flow": flow})
+ logger.Errorw("invalid-flow-type-to-handle",
+ log.Fields{
+ "classifier": classifierInfo,
+ "action": actionInfo,
+ "flow": flow})
return
}
// Send Techprofile download event to child device in go routine as it takes time
@@ -2825,19 +3437,19 @@
// So, we need to check and make sure that no other gem port is referring to the given TP ID
// on any other uni port.
tpInstances := f.techprofile[ponIntf].FindAllTpInstances(ctx, tpID, ponIntf, onuID)
- logger.Debugw("got single instance tp instances", log.Fields{"tpInstances": tpInstances})
+ logger.Debugw("got-single-instance-tp-instances", log.Fields{"tp-instances": tpInstances})
for i := 0; i < len(tpInstances); i++ {
tpI := tpInstances[i]
tpGemPorts := tpI.UpstreamGemPortAttributeList
for _, tpGemPort := range tpGemPorts {
if tpGemPort.GemportID != gemPortID {
- logger.Debugw("single instance tp is in use by gem", log.Fields{"gemPort": tpGemPort.GemportID})
+ logger.Debugw("single-instance-tp-is-in-use-by-gem", log.Fields{"gemPort": tpGemPort.GemportID})
return true, tpGemPort.GemportID
}
}
}
}
- logger.Debug("tech profile is not in use by any gem")
+ logger.Debug("tech-profile-is-not-in-use-by-any-gem")
return false, 0
}
@@ -2880,7 +3492,7 @@
classifierInfo[TunnelID] = field.GetTunnelId()
logger.Debug("field-type-tunnelId", log.Fields{"classifierInfo[TUNNEL_ID]": classifierInfo[TunnelID].(uint64)})
} else {
- logger.Errorw("Un supported field type", log.Fields{"type": field.Type})
+ logger.Errorw("un-supported-field-type", log.Fields{"type": field.Type})
return
}
}
@@ -2891,7 +3503,7 @@
if action.Type == flows.OUTPUT {
if out := action.GetOutput(); out != nil {
actionInfo[Output] = out.GetPort()
- logger.Debugw("action-type-output", log.Fields{"out_port": actionInfo[Output].(uint32)})
+ logger.Debugw("action-type-output", log.Fields{"out-port": actionInfo[Output].(uint32)})
} else {
return olterrors.NewErrInvalidValue(log.Fields{"output-port": nil}, nil)
}
@@ -2901,12 +3513,14 @@
} else if action.Type == flows.PUSH_VLAN {
if out := action.GetPush(); out != nil {
if tpid := out.GetEthertype(); tpid != 0x8100 {
- logger.Errorw("Invalid ethertype in push action", log.Fields{"ethertype": actionInfo[PushVlan].(int32)})
+ logger.Errorw("invalid ethertype in push action", log.Fields{"ethertype": actionInfo[PushVlan].(int32)})
} else {
actionInfo[PushVlan] = true
actionInfo[TPID] = tpid
logger.Debugw("action-type-push-vlan",
- log.Fields{"push_tpid": actionInfo[TPID].(uint32), "in_port": classifierInfo[InPort].(uint32)})
+ log.Fields{
+ "push-tpid": actionInfo[TPID].(uint32),
+ "in-port": classifierInfo[InPort].(uint32)})
}
}
} else if action.Type == flows.SET_FIELD {
@@ -2936,7 +3550,7 @@
actionInfo[VlanVid] = vlan & 0xfff
logger.Debugw("action-set-vlan-vid", log.Fields{"actionInfo[VLAN_VID]": actionInfo[VlanVid].(uint32)})
} else {
- logger.Error("No Invalid vlan id in set vlan-vid action")
+ logger.Error("no-invalid-vlan-id-in-set-vlan-vid-action")
}
} else if fieldtype == ofp.OxmOfbFieldTypes_OFPXMT_OFB_VLAN_PCP {
pcp := ofbField.GetVlanPcp()
@@ -2950,7 +3564,7 @@
func formulateGroupActionInfoFromFlow(action *ofp.OfpAction, actionInfo map[string]interface{}) {
if action.GetGroup() == nil {
- logger.Warn("No group entry found in the group action")
+ logger.Warn("no-group-entry-found-in-the-group-action")
} else {
actionInfo[GroupID] = action.GetGroup().GroupId
logger.Debugw("action-group-id", log.Fields{"actionInfo[GroupID]": actionInfo[GroupID].(uint32)})
@@ -2959,42 +3573,53 @@
func formulateControllerBoundTrapFlowInfo(actionInfo, classifierInfo map[string]interface{}, flow *ofp.OfpFlowStats) error {
if isControllerFlow := IsControllerBoundFlow(actionInfo[Output].(uint32)); isControllerFlow {
- logger.Debug("Controller bound trap flows, getting inport from tunnelid")
+ logger.Debug("controller-bound-trap-flows--getting-inport-from-tunnelid")
/* Get UNI port/ IN Port from tunnel ID field for upstream controller bound flows */
if portType := IntfIDToPortTypeName(classifierInfo[InPort].(uint32)); portType == voltha.Port_PON_OLT {
if uniPort := flows.GetChildPortFromTunnelId(flow); uniPort != 0 {
classifierInfo[InPort] = uniPort
- logger.Debugw("upstream pon-to-controller-flow,inport-in-tunnelid", log.Fields{"newInPort": classifierInfo[InPort].(uint32), "outPort": actionInfo[Output].(uint32)})
+ logger.Debugw("upstream-pon-to-controller-flow--inport-in-tunnelid",
+ log.Fields{
+ "newinport": classifierInfo[InPort].(uint32),
+ "outport": actionInfo[Output].(uint32)})
} else {
- return olterrors.NewErrNotFound("child-in-port", log.Fields{
- "reason": "upstream pon-to-controller-flow, NO-inport-in-tunnelid",
- "flow": flow}, nil)
+ return olterrors.NewErrNotFound("child-in-port",
+ log.Fields{
+ "reason": "upstream-pon-to-controller-flow--no-inport-in-tunnelid",
+ "flow": flow}, nil)
}
}
} else {
- logger.Debug("Non-Controller flows, getting uniport from tunnelid")
+ logger.Debug("non-controller-flows--getting-uniport-from-tunnelid")
// Downstream flow from NNI to PON port , Use tunnel ID as new OUT port / UNI port
if portType := IntfIDToPortTypeName(actionInfo[Output].(uint32)); portType == voltha.Port_PON_OLT {
if uniPort := flows.GetChildPortFromTunnelId(flow); uniPort != 0 {
actionInfo[Output] = uniPort
- logger.Debugw("downstream-nni-to-pon-port-flow, outport-in-tunnelid", log.Fields{"newOutPort": actionInfo[Output].(uint32), "outPort": actionInfo[Output].(uint32)})
+ logger.Debugw("downstream-nni-to-pon-port-flow, outport-in-tunnelid",
+ log.Fields{
+ "newoutport": actionInfo[Output].(uint32),
+ "outport": actionInfo[Output].(uint32)})
} else {
- return olterrors.NewErrNotFound("out-port", log.Fields{
- "reason": "downstream-nni-to-pon-port-flow, no-outport-in-tunnelid",
- "flow": flow}, nil)
+ return olterrors.NewErrNotFound("out-port",
+ log.Fields{
+ "reason": "downstream-nni-to-pon-port-flow--no-outport-in-tunnelid",
+ "flow": flow}, nil)
}
// Upstream flow from PON to NNI port , Use tunnel ID as new IN port / UNI port
} else if portType := IntfIDToPortTypeName(classifierInfo[InPort].(uint32)); portType == voltha.Port_PON_OLT {
if uniPort := flows.GetChildPortFromTunnelId(flow); uniPort != 0 {
classifierInfo[InPort] = uniPort
- logger.Debugw("upstream-pon-to-nni-port-flow, inport-in-tunnelid", log.Fields{"newInPort": actionInfo[Output].(uint32),
- "outport": actionInfo[Output].(uint32)})
+ logger.Debugw("upstream-pon-to-nni-port-flow, inport-in-tunnelid",
+ log.Fields{
+ "newinport": actionInfo[Output].(uint32),
+ "outport": actionInfo[Output].(uint32)})
} else {
- return olterrors.NewErrNotFound("nni-port", log.Fields{
- "reason": "upstream-pon-to-nni-port-flow, no-inport-in-tunnelid",
- "in-port": classifierInfo[InPort].(uint32),
- "out-port": actionInfo[Output].(uint32),
- "flow": flow}, nil)
+ return olterrors.NewErrNotFound("nni-port",
+ log.Fields{
+ "reason": "upstream-pon-to-nni-port-flow--no-inport-in-tunnelid",
+ "in-port": classifierInfo[InPort].(uint32),
+ "out-port": actionInfo[Output].(uint32),
+ "flow": flow}, nil)
}
}
}
@@ -3039,7 +3664,7 @@
"error": err})
return uint32(0), err
}
- logger.Debugw("output Nni IntfID is", log.Fields{"intfid": intfID})
+ logger.Infow("output-nni-intfId-is", log.Fields{"intf-id": intfID})
return intfID, nil
} else if portType == voltha.Port_ETHERNET_NNI {
intfID, err := IntfIDFromNniPortNum(classifier[InPort].(uint32))
@@ -3050,7 +3675,7 @@
"error": err})
return uint32(0), err
}
- logger.Debugw("input Nni IntfID is", log.Fields{"intfid": intfID})
+ logger.Infow("input-nni-intfId-is", log.Fields{"intf-id": intfID})
return intfID, nil
}
return uint32(0), nil
@@ -3065,21 +3690,25 @@
lookupGemPort, ok := f.packetInGemPort[pktInkey]
if ok {
if lookupGemPort == gemPort {
- logger.Debugw("pktin key/value found in cache , no need to update kv as we are assuming both will be in sync",
- log.Fields{"pktinkey": pktInkey, "gem": gemPort})
+ logger.Infow("pktin-key/value-found-in-cache--no-need-to-update-kv--assume-both-in-sync",
+ log.Fields{
+ "pktinkey": pktInkey,
+ "gem": gemPort})
return
}
}
f.packetInGemPort[pktInkey] = gemPort
f.resourceMgr.UpdateGemPortForPktIn(ctx, pktInkey, gemPort)
- logger.Debugw("pktin key not found in local cache or value is different. updating cache and kv store", log.Fields{"pktinkey": pktInkey, "gem": gemPort})
+ logger.Infow("pktin-key-not-found-in-local-cache-value-is-different--updating-cache-and-kv-store",
+ log.Fields{
+ "pktinkey": pktInkey,
+ "gem": gemPort})
return
}
// AddUniPortToOnuInfo adds uni port to the onugem info both in cache and kvstore.
func (f *OpenOltFlowMgr) AddUniPortToOnuInfo(ctx context.Context, intfID uint32, onuID uint32, portNum uint32) {
-
f.lockCache.Lock()
defer f.lockCache.Unlock()
onugem := f.onuGemInfo[intfID]
@@ -3087,8 +3716,7 @@
if onu.OnuID == onuID {
for _, uni := range onu.UniPorts {
if uni == portNum {
- logger.Debugw("uni already in cache, no need to update cache and kv store",
- log.Fields{"uni": portNum})
+ logger.Infow("uni-already-in-cache--no-need-to-update-cache-and-kv-store", log.Fields{"uni": portNum})
return
}
}
@@ -3102,7 +3730,7 @@
func (f *OpenOltFlowMgr) loadFlowIDlistForGem(ctx context.Context, intf uint32) {
flowIDsList, err := f.resourceMgr.GetFlowIDsGemMapForInterface(ctx, intf)
if err != nil {
- logger.Error("Failed to get flowid list per gem", log.Fields{"intf": intf})
+ logger.Error("failed-to-get-flowid-list-per-gem", log.Fields{"intf": intf})
return
}
for gem, FlowIDs := range flowIDsList {
@@ -3117,7 +3745,7 @@
func (f *OpenOltFlowMgr) loadInterfaceToMulticastQueueMap(ctx context.Context) {
storedMulticastQueueMap, err := f.resourceMgr.GetMcastQueuePerInterfaceMap(ctx)
if err != nil {
- logger.Error("Failed to get pon interface to multicast queue map")
+ logger.Error("failed-to-get-pon-interface-to-multicast-queue-map")
return
}
for intf, queueInfo := range storedMulticastQueueMap {
diff --git a/internal/pkg/core/statsmanager.go b/internal/pkg/core/statsmanager.go
index 0cb148d..3512f89 100755
--- a/internal/pkg/core/statsmanager.go
+++ b/internal/pkg/core/statsmanager.go
@@ -19,13 +19,15 @@
import (
"fmt"
+ "sync"
+ "time"
+
+ "strconv"
+
"github.com/opencord/voltha-lib-go/v3/pkg/log"
"github.com/opencord/voltha-openolt-adapter/internal/pkg/olterrors"
"github.com/opencord/voltha-protos/v3/go/openolt"
"github.com/opencord/voltha-protos/v3/go/voltha"
- "strconv"
- "sync"
- "time"
)
var mutex = &sync.Mutex{}
@@ -234,7 +236,7 @@
}
return PONPorts, nil
} else {
- logger.Errorf("Invalid type of interface %s", Intftype)
+ logger.Errorw("invalid-type-of-interface", log.Fields{"interface-type": Intftype})
return nil, olterrors.NewErrInvalidValue(log.Fields{"interface-type": Intftype}, nil)
}
}
@@ -255,17 +257,23 @@
if IntfType == "nni" {
IntfID := IntfIDToPortNo(PortNum, voltha.Port_ETHERNET_NNI)
nniID := PortNoToIntfID(IntfID, voltha.Port_ETHERNET_NNI)
- logger.Debugf("NniID %v", nniID)
+ logger.Debugw("interface-type-nni",
+ log.Fields{
+ "nni-id": nniID,
+ "intf-type": IntfType})
return NewNniPort(PortNum, nniID)
} else if IntfType == "pon" {
// PON ports require a different configuration
// intf_id and pon_id are currently equal.
IntfID := IntfIDToPortNo(PortNum, voltha.Port_PON_OLT)
PONID := PortNoToIntfID(IntfID, voltha.Port_PON_OLT)
- logger.Debugf("PonID %v", PONID)
+ logger.Debugw("interface-type-pon",
+ log.Fields{
+ "pon-id": PONID,
+ "intf-type": IntfType})
return NewPONPort(PONID, DeviceID, IntfID, PortNum)
} else {
- logger.Errorf("Invalid type of interface %s", IntfType)
+ logger.Errorw("invalid-type-of-interface", log.Fields{"intf-type": IntfType})
return nil
}
}
@@ -352,7 +360,10 @@
// publishMatrics will publish the pon port metrics
func (StatMgr OpenOltStatisticsMgr) publishMetrics(val map[string]float32,
port *voltha.Port, devID string, devType string) {
- logger.Debugw("publish-metrics", log.Fields{"port": port.Label, "metrics": val})
+ logger.Debugw("publish-metrics",
+ log.Fields{
+ "port": port.Label,
+ "metrics": val})
var metricInfo voltha.MetricInformation
var ke voltha.KpiEvent2
@@ -385,20 +396,20 @@
ke.Ts = float64(time.Now().UnixNano())
if err := StatMgr.Device.EventProxy.SendKpiEvent("STATS_EVENT", &ke, voltha.EventCategory_EQUIPMENT, volthaEventSubCatgry, raisedTs); err != nil {
- logger.Errorw("Failed to send Pon stats", log.Fields{"err": err})
+ logger.Errorw("failed-to-send-pon-stats", log.Fields{"err": err})
}
}
// PortStatisticsIndication handles the port statistics indication
func (StatMgr *OpenOltStatisticsMgr) PortStatisticsIndication(PortStats *openolt.PortStatistics, NumPonPorts uint32) {
StatMgr.PortsStatisticsKpis(PortStats, NumPonPorts)
- logger.Debugw("Received port stats indication", log.Fields{"PortStats": PortStats})
+ logger.Debugw("received-port-stats-indication", log.Fields{"port-stats": PortStats})
// TODO send stats to core topic to the voltha kafka or a different kafka ?
}
// FlowStatisticsIndication to be implemented
func FlowStatisticsIndication(self, FlowStats *openolt.FlowStatistics) {
- logger.Debugf("flow-stats-collected %v", FlowStats)
+ logger.Debugw("flow-stats-collected", log.Fields{"flow-stats": FlowStats})
//TODO send to kafka ?
}
@@ -440,7 +451,7 @@
mutex.Lock()
StatMgr.NorthBoundPort[0] = &portNNIStat
mutex.Unlock()
- logger.Debugf("Received-NNI-Stats: %v", StatMgr.NorthBoundPort)
+ logger.Debugw("received-nni-stats", log.Fields{"nni-stats": StatMgr.NorthBoundPort})
}
for i := uint32(0); i < NumPonPorts; i++ {
@@ -462,7 +473,7 @@
mutex.Lock()
StatMgr.SouthBoundPort[i] = &portPonStat
mutex.Unlock()
- logger.Debugf("Received-PON-Stats-for-Port %v : %v", i, portPonStat)
+ logger.Debugw("received-pon-stats-for-port", log.Fields{"port-pon-stats": portPonStat})
}
}