[VOL-3228] device-id logging consistancy
Change-Id: I3918e87616c027f93f41a523db98ef2cad50ef57
diff --git a/internal/pkg/core/device_handler.go b/internal/pkg/core/device_handler.go
index 55cf231..1990072 100644
--- a/internal/pkg/core/device_handler.go
+++ b/internal/pkg/core/device_handler.go
@@ -356,7 +356,7 @@
for {
select {
case <-dh.stopIndications:
- logger.Debugw(ctx, "stopping-collecting-indications-for-olt", log.Fields{"deviceID:": dh.device.Id})
+ logger.Debugw(ctx, "stopping-collecting-indications-for-olt", log.Fields{"device-id": dh.device.Id})
break Loop
default:
indication, err := indications.Recv()
@@ -380,7 +380,7 @@
backoff := time.NewTimer(indicationBackoff.NextBackOff())
select {
case <-dh.stopIndications:
- logger.Debugw(ctx, "stopping-collecting-indications-for-olt", log.Fields{"deviceID:": dh.device.Id})
+ logger.Debugw(ctx, "stopping-collecting-indications-for-olt", log.Fields{"device-id": dh.device.Id})
if !backoff.Stop() {
<-backoff.C
}
@@ -467,7 +467,7 @@
// Send or clear Alarm
if err := dh.eventMgr.oltUpDownIndication(ctx, oltIndication, dh.device.Id, raisedTs); err != nil {
return olterrors.NewErrAdapter("failed-indication", log.Fields{
- "device_id": dh.device.Id,
+ "device-id": dh.device.Id,
"indication": oltIndication,
"timestamp": raisedTs}, err)
}
@@ -846,7 +846,7 @@
for {
select {
case <-dh.stopCollector:
- logger.Debugw(ctx, "stopping-collector-for-olt", log.Fields{"deviceID:": dh.device.Id})
+ logger.Debugw(ctx, "stopping-collector-for-olt", log.Fields{"device-id": dh.device.Id})
return
case <-time.After(time.Duration(dh.metrics.ToPmConfigs().DefaultFreq) * time.Second):
@@ -1564,7 +1564,7 @@
ports, err := dh.coreProxy.ListDevicePorts(ctx, device.Id)
if err != nil {
- return olterrors.NewErrAdapter("list-ports-failed", log.Fields{"device": device.Id}, err)
+ return olterrors.NewErrAdapter("list-ports-failed", log.Fields{"device-id": device.Id}, err)
}
if err := dh.disableAdminDownPorts(ctx, ports); err != nil {
return olterrors.NewErrAdapter("port-status-update-failed-after-olt-reenable", log.Fields{"device": device}, err)
@@ -2073,7 +2073,7 @@
// ChildDeviceLost deletes ONU and clears pon resources related to it.
func (dh *DeviceHandler) ChildDeviceLost(ctx context.Context, pPortNo uint32, onuID uint32) error {
- logger.Debugw(ctx, "child-device-lost", log.Fields{"pdeviceID": dh.device.Id})
+ logger.Debugw(ctx, "child-device-lost", log.Fields{"parent-device-id": dh.device.Id})
intfID := PortNoToIntfID(pPortNo, voltha.Port_PON_OLT)
onuKey := dh.formOnuKey(intfID, onuID)
onuDevice, ok := dh.onus.Load(onuKey)
diff --git a/internal/pkg/core/openolt.go b/internal/pkg/core/openolt.go
index f694c36..996c0f5 100644
--- a/internal/pkg/core/openolt.go
+++ b/internal/pkg/core/openolt.go
@@ -115,7 +115,7 @@
if device == nil {
return olterrors.NewErrInvalidValue(log.Fields{"device": nil}, nil).Log()
}
- logger.Infow(ctx, "adopt-device", log.Fields{"deviceId": device.Id})
+ logger.Infow(ctx, "adopt-device", log.Fields{"device-id": device.Id})
var handler *DeviceHandler
if handler = oo.getDeviceHandler(device.Id); handler == nil {
handler := NewDeviceHandler(oo.coreProxy, oo.adapterProxy, oo.eventProxy, device, oo)
@@ -129,7 +129,7 @@
//Get_ofp_device_info returns OFP information for the given device
func (oo *OpenOLT) Get_ofp_device_info(ctx context.Context, device *voltha.Device) (*ic.SwitchCapability, error) {
- logger.Infow(ctx, "Get_ofp_device_info", log.Fields{"deviceId": device.Id})
+ logger.Infow(ctx, "Get_ofp_device_info", log.Fields{"device-id": device.Id})
if handler := oo.getDeviceHandler(device.Id); handler != nil {
return handler.GetOfpDeviceInfo(device)
}
@@ -170,7 +170,7 @@
if device == nil {
return olterrors.NewErrInvalidValue(log.Fields{"device": nil}, nil)
}
- logger.Infow(ctx, "reconcile-device", log.Fields{"deviceId": device.Id})
+ logger.Infow(ctx, "reconcile-device", log.Fields{"device-id": device.Id})
var handler *DeviceHandler
if handler = oo.getDeviceHandler(device.Id); handler == nil {
handler := NewDeviceHandler(oo.coreProxy, oo.adapterProxy, oo.eventProxy, device, oo)
@@ -188,7 +188,7 @@
//Disable_device disables the given device
func (oo *OpenOLT) Disable_device(ctx context.Context, device *voltha.Device) error {
- logger.Infow(ctx, "disable-device", log.Fields{"deviceId": device.Id})
+ logger.Infow(ctx, "disable-device", log.Fields{"device-id": device.Id})
if handler := oo.getDeviceHandler(device.Id); handler != nil {
return handler.DisableDevice(ctx, device)
}
@@ -197,7 +197,7 @@
//Reenable_device enables the olt device after disable
func (oo *OpenOLT) Reenable_device(ctx context.Context, device *voltha.Device) error {
- logger.Infow(ctx, "reenable-device", log.Fields{"deviceId": device.Id})
+ logger.Infow(ctx, "reenable-device", log.Fields{"device-id": device.Id})
if handler := oo.getDeviceHandler(device.Id); handler != nil {
return handler.ReenableDevice(ctx, device)
}
@@ -206,7 +206,7 @@
//Reboot_device reboots the given device
func (oo *OpenOLT) Reboot_device(ctx context.Context, device *voltha.Device) error {
- logger.Infow(ctx, "reboot-device", log.Fields{"deviceId": device.Id})
+ logger.Infow(ctx, "reboot-device", log.Fields{"device-id": device.Id})
if handler := oo.getDeviceHandler(device.Id); handler != nil {
return handler.RebootDevice(ctx, device)
}
@@ -220,7 +220,7 @@
//Delete_device unimplemented
func (oo *OpenOLT) Delete_device(ctx context.Context, device *voltha.Device) error {
- logger.Infow(ctx, "delete-device", log.Fields{"deviceId": device.Id})
+ logger.Infow(ctx, "delete-device", log.Fields{"device-id": device.Id})
if handler := oo.getDeviceHandler(device.Id); handler != nil {
if err := handler.DeleteDevice(ctx, device); err != nil {
logger.Errorw(ctx, "failed-to-handle-delete-device", log.Fields{"device-id": device.Id})
@@ -243,7 +243,7 @@
//Update_flows_incrementally updates (add/remove) the flows on a given device
func (oo *OpenOLT) Update_flows_incrementally(ctx context.Context, device *voltha.Device, flows *openflow_13.FlowChanges, groups *openflow_13.FlowGroupChanges, flowMetadata *voltha.FlowMetadata) error {
- logger.Debugw(ctx, "Update_flows_incrementally", log.Fields{"deviceId": device.Id, "flows": flows, "flowMetadata": flowMetadata})
+ logger.Debugw(ctx, "Update_flows_incrementally", log.Fields{"device-id": device.Id, "flows": flows, "flowMetadata": flowMetadata})
if handler := oo.getDeviceHandler(device.Id); handler != nil {
return handler.UpdateFlowsIncrementally(ctx, device, flows, groups, flowMetadata)
}
@@ -262,7 +262,7 @@
//Receive_packet_out sends packet out to the device
func (oo *OpenOLT) Receive_packet_out(ctx context.Context, deviceID string, egressPortNo int, packet *openflow_13.OfpPacketOut) error {
- logger.Debugw(ctx, "Receive_packet_out", log.Fields{"deviceId": deviceID, "egress_port_no": egressPortNo, "pkt": packet})
+ logger.Debugw(ctx, "Receive_packet_out", log.Fields{"device-id": deviceID, "egress_port_no": egressPortNo, "pkt": packet})
if handler := oo.getDeviceHandler(deviceID); handler != nil {
return handler.PacketOut(ctx, egressPortNo, packet)
}
@@ -306,19 +306,19 @@
// Enable_port to Enable PON/NNI interface
func (oo *OpenOLT) Enable_port(ctx context.Context, deviceID string, port *voltha.Port) error {
- logger.Infow(ctx, "Enable_port", log.Fields{"deviceId": deviceID, "port": port})
+ logger.Infow(ctx, "Enable_port", log.Fields{"device-id": deviceID, "port": port})
return oo.enableDisablePort(ctx, deviceID, port, true)
}
// Disable_port to Disable pon/nni interface
func (oo *OpenOLT) Disable_port(ctx context.Context, deviceID string, port *voltha.Port) error {
- logger.Infow(ctx, "Disable_port", log.Fields{"deviceId": deviceID, "port": port})
+ logger.Infow(ctx, "Disable_port", log.Fields{"device-id": deviceID, "port": port})
return oo.enableDisablePort(ctx, deviceID, port, false)
}
// enableDisablePort to Disable pon or Enable PON interface
func (oo *OpenOLT) enableDisablePort(ctx context.Context, deviceID string, port *voltha.Port, enablePort bool) error {
- logger.Infow(ctx, "enableDisablePort", log.Fields{"deviceId": deviceID, "port": port})
+ logger.Infow(ctx, "enableDisablePort", log.Fields{"device-id": deviceID, "port": port})
if port == nil {
return olterrors.NewErrInvalidValue(log.Fields{
"reason": "port cannot be nil",
@@ -326,14 +326,14 @@
"port": nil}, nil)
}
if handler := oo.getDeviceHandler(deviceID); handler != nil {
- logger.Debugw(ctx, "Enable_Disable_Port", log.Fields{"deviceId": deviceID, "port": port})
+ logger.Debugw(ctx, "Enable_Disable_Port", log.Fields{"device-id": deviceID, "port": port})
if enablePort {
if err := handler.EnablePort(ctx, port); err != nil {
- return olterrors.NewErrAdapter("error-occurred-during-enable-port", log.Fields{"deviceID": deviceID, "port": port}, err)
+ return olterrors.NewErrAdapter("error-occurred-during-enable-port", log.Fields{"device-id": deviceID, "port": port}, err)
}
} else {
if err := handler.DisablePort(ctx, port); err != nil {
- return olterrors.NewErrAdapter("error-occurred-during-disable-port", log.Fields{"deviceID": deviceID, "port": port}, err)
+ return olterrors.NewErrAdapter("error-occurred-during-disable-port", log.Fields{"device-id": deviceID, "port": port}, err)
}
}
}
@@ -342,7 +342,7 @@
//Child_device_lost deletes the ONU and its references from PONResources
func (oo *OpenOLT) Child_device_lost(ctx context.Context, deviceID string, pPortNo uint32, onuID uint32) error {
- logger.Infow(ctx, "Child-device-lost", log.Fields{"parentId": deviceID})
+ logger.Infow(ctx, "Child-device-lost", log.Fields{"parent-device-id": deviceID})
if handler := oo.getDeviceHandler(deviceID); handler != nil {
return handler.ChildDeviceLost(ctx, pPortNo, onuID)
}
diff --git a/internal/pkg/resourcemanager/resourcemanager.go b/internal/pkg/resourcemanager/resourcemanager.go
index a2c9286..3f642cf 100755
--- a/internal/pkg/resourcemanager/resourcemanager.go
+++ b/internal/pkg/resourcemanager/resourcemanager.go
@@ -163,7 +163,7 @@
// the resources.
func NewResourceMgr(ctx context.Context, deviceID string, KVStoreAddress string, kvStoreType string, deviceType string, devInfo *openolt.DeviceInfo) *OpenOltResourceMgr {
var ResourceMgr OpenOltResourceMgr
- logger.Debugf(ctx, "Init new resource manager , address: %s, deviceid: %s", KVStoreAddress, deviceID)
+ logger.Debugf(ctx, "Init new resource manager , address: %s, device-id: %s", KVStoreAddress, deviceID)
ResourceMgr.Address = KVStoreAddress
ResourceMgr.DeviceType = deviceType
ResourceMgr.DevInfo = devInfo