[VOL-3228] device-id logging consistancy
Change-Id: Idd00d569d5e8724ab9df03ad5a5744b655ba3448
diff --git a/rw_core/core/device/agent.go b/rw_core/core/device/agent.go
index 7775d47..ebfb641 100755
--- a/rw_core/core/device/agent.go
+++ b/rw_core/core/device/agent.go
@@ -167,7 +167,7 @@
}
defer agent.requestQueue.RequestComplete()
- logger.Infow(ctx, "stopping-device-agent", log.Fields{"deviceId": agent.deviceID, "parentId": agent.parentID})
+ logger.Infow(ctx, "stopping-device-agent", log.Fields{"device-id": agent.deviceID, "parentId": agent.parentID})
// Remove the device from the KV store
if err := agent.dbProxy.Remove(ctx, agent.deviceID); err != nil {
@@ -401,7 +401,7 @@
cloned := agent.cloneDeviceWithoutLock()
if cloned.AdminState == voltha.AdminState_DISABLED {
- logger.Debugw(ctx, "device-already-disabled", log.Fields{"id": agent.deviceID})
+ logger.Debugw(ctx, "device-already-disabled", log.Fields{"device-id": agent.deviceID})
agent.requestQueue.RequestComplete()
return nil
}
@@ -584,7 +584,7 @@
logger.Debugw(ctx, "updateDeviceStatus-oper", log.Fields{"ok": ok, "val": s})
cloned.OperStatus = operStatus
}
- logger.Debugw(ctx, "updateDeviceStatus", log.Fields{"deviceId": cloned.Id, "operStatus": cloned.OperStatus, "connectStatus": cloned.ConnectStatus})
+ logger.Debugw(ctx, "updateDeviceStatus", log.Fields{"device-id": cloned.Id, "operStatus": cloned.OperStatus, "connectStatus": cloned.ConnectStatus})
// Store the device
return agent.updateDeviceAndReleaseLock(ctx, cloned)
}
@@ -620,7 +620,7 @@
}
}
}
- logger.Debugw(ctx, "update-field-status", log.Fields{"deviceId": cloned.Id, "name": name, "updated": updated})
+ logger.Debugw(ctx, "update-field-status", log.Fields{"device-id": cloned.Id, "name": name, "updated": updated})
// Save the data
if err := agent.updateDeviceAndReleaseLock(ctx, cloned); err != nil {
@@ -633,7 +633,7 @@
return err
}
defer agent.requestQueue.RequestComplete()
- logger.Debugw(ctx, "simulateAlarm", log.Fields{"id": agent.deviceID})
+ logger.Debugw(ctx, "simulateAlarm", log.Fields{"device-id": agent.deviceID})
device := agent.getDeviceReadOnlyWithoutLock()
@@ -661,7 +661,7 @@
agent.requestQueue.RequestComplete()
return status.Errorf(codes.Internal, "failed-update-device:%s: %s", agent.deviceID, err)
}
- logger.Debugw(ctx, "updated-device-in-store", log.Fields{"deviceId: ": agent.deviceID})
+ logger.Debugw(ctx, "updated-device-in-store", log.Fields{"device-id: ": agent.deviceID})
previousState := getDeviceStates(agent.device)
// update the device
@@ -671,7 +671,7 @@
agent.requestQueue.RequestComplete()
if err := agent.deviceMgr.processTransition(log.WithSpanFromContext(context.Background(), ctx), device, previousState); err != nil {
- logger.Errorw(ctx, "failed-process-transition", log.Fields{"deviceId": device.Id, "previousAdminState": previousState.Admin, "currentAdminState": device.AdminState})
+ log.Errorw("failed-process-transition", log.Fields{"device-id": device.Id, "previousAdminState": previousState.Admin, "currentAdminState": device.AdminState})
}
return nil
}
@@ -680,7 +680,7 @@
if err := agent.requestQueue.WaitForGreenLight(ctx); err != nil {
return err
}
- logger.Debugw(ctx, "updateDeviceReason", log.Fields{"deviceId": agent.deviceID, "reason": reason})
+ logger.Debugw(ctx, "updateDeviceReason", log.Fields{"device-id": agent.deviceID, "reason": reason})
cloned := agent.cloneDeviceWithoutLock()
cloned.Reason = reason
@@ -688,7 +688,7 @@
}
func (agent *Agent) ChildDeviceLost(ctx context.Context, device *voltha.Device) error {
- logger.Debugw(ctx, "childDeviceLost", log.Fields{"child-device-id": device.Id, "parent-device-ud": agent.deviceID})
+ logger.Debugw(ctx, "childDeviceLost", log.Fields{"child-device-id": device.Id, "parent-device-id": agent.deviceID})
// Remove the associated peer ports on the parent device
for portID := range agent.portLoader.ListIDs() {
diff --git a/rw_core/core/device/agent_flow.go b/rw_core/core/device/agent_flow.go
index 56b09da..e49fa14 100644
--- a/rw_core/core/device/agent_flow.go
+++ b/rw_core/core/device/agent_flow.go
@@ -293,7 +293,7 @@
//deleteAllFlows deletes all flows in the device table
func (agent *Agent) deleteAllFlows(ctx context.Context) error {
- logger.Debugw(ctx, "deleteAllFlows", log.Fields{"deviceId": agent.deviceID})
+ logger.Debugw(ctx, "deleteAllFlows", log.Fields{"device-id": agent.deviceID})
for flowID := range agent.flowLoader.ListIDs() {
if flowHandle, have := agent.flowLoader.Lock(flowID); have {
diff --git a/rw_core/core/device/agent_image.go b/rw_core/core/device/agent_image.go
index 0f9c75e..daae220 100644
--- a/rw_core/core/device/agent_image.go
+++ b/rw_core/core/device/agent_image.go
@@ -39,7 +39,7 @@
return nil, status.Errorf(codes.FailedPrecondition, "device-id:%s, expected-admin-state:%s", agent.deviceID, voltha.AdminState_ENABLED)
}
if device.AdminState != voltha.AdminState_ENABLED {
- logger.Debugw(ctx, "device-not-enabled", log.Fields{"id": agent.deviceID})
+ logger.Debugw(ctx, "device-not-enabled", log.Fields{"device-id": agent.deviceID})
agent.requestQueue.RequestComplete()
return nil, status.Errorf(codes.FailedPrecondition, "deviceId:%s, expected-admin-state:%s", agent.deviceID, voltha.AdminState_ENABLED)
}
diff --git a/rw_core/core/device/agent_port.go b/rw_core/core/device/agent_port.go
index 8e68318..eeffd09 100644
--- a/rw_core/core/device/agent_port.go
+++ b/rw_core/core/device/agent_port.go
@@ -116,7 +116,7 @@
}
func (agent *Agent) deleteAllPorts(ctx context.Context) error {
- logger.Debugw(ctx, "deleteAllPorts", log.Fields{"deviceId": agent.deviceID})
+ logger.Debugw(ctx, "deleteAllPorts", log.Fields{"device-id": agent.deviceID})
device, err := agent.getDeviceReadOnly(ctx)
if err != nil {
@@ -142,7 +142,7 @@
}
func (agent *Agent) addPort(ctx context.Context, port *voltha.Port) error {
- logger.Debugw(ctx, "addPort", log.Fields{"deviceId": agent.deviceID})
+ logger.Debugw(ctx, "addPort", log.Fields{"device-id": agent.deviceID})
port.AdminState = voltha.AdminState_ENABLED
diff --git a/rw_core/core/device/logical_agent.go b/rw_core/core/device/logical_agent.go
index 73bd37f..ecc9008 100644
--- a/rw_core/core/device/logical_agent.go
+++ b/rw_core/core/device/logical_agent.go
@@ -196,7 +196,7 @@
if err := agent.ldProxy.Remove(ctx, agent.logicalDeviceID); err != nil {
returnErr = err
} else {
- logger.Debugw(ctx, "logicaldevice-removed", log.Fields{"logicaldeviceId": agent.logicalDeviceID})
+ logger.Debugw(ctx, "logicaldevice-removed", log.Fields{"logical-device-id": agent.logicalDeviceID})
}
// TODO: remove all entries from all loaders
// TODO: don't allow any more modifications to flows/groups/meters/ports or to any logical device field
@@ -218,7 +218,7 @@
}
func (agent *LogicalAgent) addFlowsAndGroupsToDevices(ctx context.Context, deviceRules *fu.DeviceRules, flowMetadata *voltha.FlowMetadata) []coreutils.Response {
- logger.Debugw(ctx, "send-add-flows-to-device-manager", log.Fields{"logicalDeviceID": agent.logicalDeviceID, "deviceRules": deviceRules, "flowMetadata": flowMetadata})
+ logger.Debugw(ctx, "send-add-flows-to-device-manager", log.Fields{"logical-device-id": agent.logicalDeviceID, "deviceRules": deviceRules, "flowMetadata": flowMetadata})
responses := make([]coreutils.Response, 0)
for deviceID, value := range deviceRules.GetRules() {
@@ -230,7 +230,7 @@
start := time.Now()
if err := agent.deviceMgr.addFlowsAndGroups(subCtx, deviceId, value.ListFlows(), value.ListGroups(), flowMetadata); err != nil {
logger.Errorw(ctx, "flow-add-failed", log.Fields{
- "deviceID": deviceId,
+ "device-id": deviceId,
"error": err,
"wait-time": time.Since(start),
"flows": value.ListFlows(),
@@ -246,7 +246,7 @@
}
func (agent *LogicalAgent) deleteFlowsAndGroupsFromDevices(ctx context.Context, deviceRules *fu.DeviceRules, flowMetadata *voltha.FlowMetadata, mod *ofp.OfpFlowMod) []coreutils.Response {
- logger.Debugw(ctx, "send-delete-flows-to-device-manager", log.Fields{"logicalDeviceID": agent.logicalDeviceID})
+ logger.Debugw(ctx, "send-delete-flows-to-device-manager", log.Fields{"logical-device-id": agent.logicalDeviceID})
responses := make([]coreutils.Response, 0)
for deviceID, value := range deviceRules.GetRules() {
@@ -272,7 +272,7 @@
}
func (agent *LogicalAgent) updateFlowsAndGroupsOfDevice(ctx context.Context, deviceRules *fu.DeviceRules, flowMetadata *voltha.FlowMetadata) []coreutils.Response {
- logger.Debugw(ctx, "send-update-flows-to-device-manager", log.Fields{"logicalDeviceID": agent.logicalDeviceID})
+ logger.Debugw(ctx, "send-update-flows-to-device-manager", log.Fields{"logical-device-id": agent.logicalDeviceID})
responses := make([]coreutils.Response, 0)
for deviceID, value := range deviceRules.GetRules() {
@@ -282,7 +282,7 @@
subCtx, cancel := context.WithTimeout(log.WithSpanFromContext(context.Background(), ctx), agent.defaultTimeout)
defer cancel()
if err := agent.deviceMgr.updateFlowsAndGroups(subCtx, deviceId, value.ListFlows(), value.ListGroups(), flowMetadata); err != nil {
- logger.Errorw(ctx, "flow-update-failed", log.Fields{"deviceID": deviceId, "error": err})
+ logger.Errorw(ctx, "flow-update-failed", log.Fields{"device-id": deviceId, "error": err})
response.Error(status.Errorf(codes.Internal, "flow-update-failed: %s", deviceId))
}
response.Done()
@@ -299,7 +299,7 @@
responses = append(responses, response)
uniPort, err := agent.getUNILogicalPortNo(flow)
if err != nil {
- logger.Error(ctx, "no-uni-port-in-flow", log.Fields{"deviceID": agent.rootDeviceID, "flow": flow, "error": err})
+ logger.Error(ctx, "no-uni-port-in-flow", log.Fields{"device-id": agent.rootDeviceID, "flow": flow, "error": err})
response.Error(err)
response.Done()
continue
@@ -333,7 +333,7 @@
//frame := packet.GetData()
//TODO: Use a channel between the logical agent and the device agent
if err := agent.deviceMgr.packetOut(ctx, agent.rootDeviceID, outPort, packet); err != nil {
- logger.Error(ctx, "packetout-failed", log.Fields{"logicalDeviceID": agent.rootDeviceID})
+ logger.Error(ctx, "packetout-failed", log.Fields{"logical-device-id": agent.rootDeviceID})
}
}
diff --git a/rw_core/core/device/logical_agent_group.go b/rw_core/core/device/logical_agent_group.go
index 10d14b7..011b196 100644
--- a/rw_core/core/device/logical_agent_group.go
+++ b/rw_core/core/device/logical_agent_group.go
@@ -57,7 +57,7 @@
case ofp.OfpGroupModCommand_OFPGC_MODIFY:
return agent.groupModify(ctx, groupMod)
}
- return status.Errorf(codes.Internal, "unhandled-command: lDeviceId:%s, command:%s", agent.logicalDeviceID, groupMod.GetCommand())
+ return status.Errorf(codes.Internal, "unhandled-command: logical-device-id:%s, command:%s", agent.logicalDeviceID, groupMod.GetCommand())
}
func (agent *LogicalAgent) groupAdd(ctx context.Context, groupMod *ofp.OfpGroupMod) error {
@@ -91,7 +91,7 @@
// Wait for completion
go func() {
if res := coreutils.WaitForNilOrErrorResponses(agent.defaultTimeout, respChnls...); res != nil {
- logger.Warnw(ctx, "failure-updating-device-flows-groups", log.Fields{"logicalDeviceId": agent.logicalDeviceID, "errors": res})
+ logger.Warnw(ctx, "failure-updating-device-flows-groups", log.Fields{"logical-device-id": agent.logicalDeviceID, "errors": res})
//TODO: Revert flow changes
}
}()
@@ -125,7 +125,7 @@
// an error while deleting flows can cause inconsistent state.
flows, err := agent.deleteFlowsHavingGroup(ctx, groupID)
if err != nil {
- logger.Errorw(ctx, "cannot-update-flow-for-group-delete", log.Fields{"logicalDeviceId": agent.logicalDeviceID, "groupID": groupID})
+ logger.Errorw(ctx, "cannot-update-flow-for-group-delete", log.Fields{"logical-device-id": agent.logicalDeviceID, "groupID": groupID})
return err
}
for flowID, flow := range flows {
@@ -166,7 +166,7 @@
// Wait for completion
go func() {
if res := coreutils.WaitForNilOrErrorResponses(agent.defaultTimeout, respChnls...); res != nil {
- logger.Warnw(ctx, "failure-updating-device-flows-groups", log.Fields{"logicalDeviceId": agent.logicalDeviceID, "errors": res})
+ logger.Warnw(ctx, "failure-updating-device-flows-groups", log.Fields{"logical-device-id": agent.logicalDeviceID, "errors": res})
//TODO: Revert flow changes
}
}()
@@ -199,7 +199,7 @@
//update KV
if err := groupHandle.Update(ctx, groupEntry); err != nil {
- logger.Errorw(ctx, "Cannot-update-logical-group", log.Fields{"logicalDeviceId": agent.logicalDeviceID})
+ logger.Errorw(ctx, "Cannot-update-logical-group", log.Fields{"logical-device-id": agent.logicalDeviceID})
return err
}
@@ -209,7 +209,7 @@
// Wait for completion
go func() {
if res := coreutils.WaitForNilOrErrorResponses(agent.defaultTimeout, respChnls...); res != nil {
- logger.Warnw(ctx, "failure-updating-device-flows-groups", log.Fields{"logicalDeviceId": agent.logicalDeviceID, "errors": res})
+ logger.Warnw(ctx, "failure-updating-device-flows-groups", log.Fields{"logical-device-id": agent.logicalDeviceID, "errors": res})
//TODO: Revert flow changes
}
}()
diff --git a/rw_core/core/device/logical_agent_meter.go b/rw_core/core/device/logical_agent_meter.go
index aab7e5a..274deb1 100644
--- a/rw_core/core/device/logical_agent_meter.go
+++ b/rw_core/core/device/logical_agent_meter.go
@@ -55,7 +55,7 @@
return agent.meterModify(ctx, meterMod)
}
return status.Errorf(codes.Internal,
- "unhandled-command: lDeviceId:%s, command:%s", agent.logicalDeviceID, meterMod.GetCommand())
+ "unhandled-command: logical-device-id:%s, command:%s", agent.logicalDeviceID, meterMod.GetCommand())
}
func (agent *LogicalAgent) meterAdd(ctx context.Context, meterMod *ofp.OfpMeterMod) error {
diff --git a/rw_core/core/device/logical_agent_meter_helpers.go b/rw_core/core/device/logical_agent_meter_helpers.go
index 2c0193d..47ee439 100644
--- a/rw_core/core/device/logical_agent_meter_helpers.go
+++ b/rw_core/core/device/logical_agent_meter_helpers.go
@@ -94,7 +94,7 @@
Stats: &newStats,
}
if err := meterHandle.Update(ctx, newMeter); err != nil {
- logger.Debugw(ctx, "unable-to-update-meter-in-db", log.Fields{"logicalDevice": agent.logicalDeviceID, "meterID": meterID})
+ logger.Debugw(ctx, "unable-to-update-meter-in-db", log.Fields{"logical-device-id": agent.logicalDeviceID, "meterID": meterID})
return false
}
diff --git a/rw_core/core/device/logical_agent_port.go b/rw_core/core/device/logical_agent_port.go
index b8bec82..f1878be 100644
--- a/rw_core/core/device/logical_agent_port.go
+++ b/rw_core/core/device/logical_agent_port.go
@@ -45,7 +45,7 @@
}
func (agent *LogicalAgent) updateLogicalPort(ctx context.Context, device *voltha.Device, devicePorts map[uint32]*voltha.Port, port *voltha.Port) error {
- logger.Debugw(ctx, "updateLogicalPort", log.Fields{"deviceId": device.Id, "port": port})
+ logger.Debugw(ctx, "updateLogicalPort", log.Fields{"device-id": device.Id, "port": port})
switch port.Type {
case voltha.Port_ETHERNET_NNI:
if err := agent.addNNILogicalPort(ctx, device.Id, devicePorts, port); err != nil {
@@ -82,17 +82,17 @@
// added to it. While the logical device was being created we could have received requests to add
// NNI and UNI ports which were discarded. Now is the time to add them if needed
func (agent *LogicalAgent) setupLogicalPorts(ctx context.Context) error {
- logger.Infow(ctx, "setupLogicalPorts", log.Fields{"logicalDeviceId": agent.logicalDeviceID})
+ logger.Infow(ctx, "setupLogicalPorts", log.Fields{"logical-device-id": agent.logicalDeviceID})
// First add any NNI ports which could have been missing
if err := agent.setupNNILogicalPorts(ctx, agent.rootDeviceID); err != nil {
- logger.Errorw(ctx, "error-setting-up-NNI-ports", log.Fields{"error": err, "deviceId": agent.rootDeviceID})
+ logger.Errorw(ctx, "error-setting-up-NNI-ports", log.Fields{"error": err, "device-id": agent.rootDeviceID})
return err
}
// Now, set up the UNI ports if needed.
children, err := agent.deviceMgr.GetAllChildDevices(ctx, agent.rootDeviceID)
if err != nil {
- logger.Errorw(ctx, "error-getting-child-devices", log.Fields{"error": err, "deviceId": agent.rootDeviceID})
+ logger.Errorw(ctx, "error-getting-child-devices", log.Fields{"error": err, "device-id": agent.rootDeviceID})
return err
}
responses := make([]coreutils.Response, 0)
@@ -104,13 +104,13 @@
childPorts, err := agent.deviceMgr.listDevicePorts(ctx, child.Id)
if err != nil {
- logger.Error(ctx, "setting-up-UNI-ports-failed", log.Fields{"deviceID": child.Id})
+ logger.Error(ctx, "setting-up-UNI-ports-failed", log.Fields{"device-id": child.Id})
response.Error(status.Errorf(codes.Internal, "UNI-ports-setup-failed: %s", child.Id))
return
}
if err = agent.setupUNILogicalPorts(ctx, child, childPorts); err != nil {
- logger.Error(ctx, "setting-up-UNI-ports-failed", log.Fields{"deviceID": child.Id})
+ logger.Error(ctx, "setting-up-UNI-ports-failed", log.Fields{"device-id": child.Id})
response.Error(status.Errorf(codes.Internal, "UNI-ports-setup-failed: %s", child.Id))
}
}(log.WithSpanFromContext(context.Background(), ctx), child)
@@ -124,12 +124,12 @@
// setupNNILogicalPorts creates an NNI port on the logical device that represents an NNI interface on a root device
func (agent *LogicalAgent) setupNNILogicalPorts(ctx context.Context, deviceID string) error {
- logger.Infow(ctx, "setupNNILogicalPorts-start", log.Fields{"logicalDeviceId": agent.logicalDeviceID})
+ logger.Infow(ctx, "setupNNILogicalPorts-start", log.Fields{"logical-device-id": agent.logicalDeviceID})
// Build the logical device based on information retrieved from the device adapter
devicePorts, err := agent.deviceMgr.listDevicePorts(ctx, deviceID)
if err != nil {
- logger.Errorw(ctx, "error-retrieving-device-ports", log.Fields{"error": err, "deviceId": deviceID})
+ logger.Errorw(ctx, "error-retrieving-device-ports", log.Fields{"error": err, "device-id": deviceID})
return err
}
@@ -146,7 +146,7 @@
// updatePortState updates the port state of the device
func (agent *LogicalAgent) updatePortState(ctx context.Context, portNo uint32, operStatus voltha.OperStatus_Types) error {
- logger.Infow(ctx, "updatePortState-start", log.Fields{"logicalDeviceId": agent.logicalDeviceID, "portNo": portNo, "state": operStatus})
+ logger.Infow(ctx, "updatePortState-start", log.Fields{"logical-device-id": agent.logicalDeviceID, "portNo": portNo, "state": operStatus})
portHandle, have := agent.portLoader.Lock(portNo)
if !have {
@@ -179,7 +179,7 @@
// setupUNILogicalPorts creates a UNI port on the logical device that represents a child UNI interface
func (agent *LogicalAgent) setupUNILogicalPorts(ctx context.Context, childDevice *voltha.Device, childDevicePorts map[uint32]*voltha.Port) error {
- logger.Infow(ctx, "setupUNILogicalPorts", log.Fields{"logicalDeviceId": agent.logicalDeviceID})
+ logger.Infow(ctx, "setupUNILogicalPorts", log.Fields{"logical-device-id": agent.logicalDeviceID})
// Build the logical device based on information retrieved from the device adapter
var err error
//Get UNI port number
@@ -195,7 +195,7 @@
// deleteAllLogicalPorts deletes all logical ports associated with this logical device
func (agent *LogicalAgent) deleteAllLogicalPorts(ctx context.Context) error {
- logger.Infow(ctx, "updatePortsState-start", log.Fields{"logicalDeviceId": agent.logicalDeviceID})
+ logger.Infow(ctx, "updatePortsState-start", log.Fields{"logical-device-id": agent.logicalDeviceID})
// for each port
for portID := range agent.portLoader.ListIDs() {
@@ -216,7 +216,7 @@
// Reset the logical device routes
go func() {
if err := agent.buildRoutes(log.WithSpanFromContext(context.Background(), ctx)); err != nil {
- logger.Warnw(ctx, "device-routes-not-ready", log.Fields{"logicalDeviceId": agent.logicalDeviceID, "error": err})
+ logger.Warnw(ctx, "device-routes-not-ready", log.Fields{"logical-device-id": agent.logicalDeviceID, "error": err})
}
}()
return nil
@@ -353,7 +353,7 @@
func (agent *LogicalAgent) addUNILogicalPort(ctx context.Context, deviceID string, deviceAdminState voltha.AdminState_Types, deviceOperStatus voltha.OperStatus_Types, devicePorts map[uint32]*voltha.Port, port *voltha.Port) error {
logger.Debugw(ctx, "addUNILogicalPort", log.Fields{"port": port})
if deviceAdminState != voltha.AdminState_ENABLED || deviceOperStatus != voltha.OperStatus_ACTIVE {
- logger.Infow(ctx, "device-not-ready", log.Fields{"deviceId": deviceID, "admin": deviceAdminState, "oper": deviceOperStatus})
+ logger.Infow(ctx, "device-not-ready", log.Fields{"device-id": deviceID, "admin": deviceAdminState, "oper": deviceOperStatus})
return nil
}
ofpPort := *port.OfpPort
diff --git a/rw_core/core/device/logical_manager.go b/rw_core/core/device/logical_manager.go
index 457b5eb..5661fdd 100644
--- a/rw_core/core/device/logical_manager.go
+++ b/rw_core/core/device/logical_manager.go
@@ -88,7 +88,7 @@
// GetLogicalDevice provides a cloned most up to date logical device. If device is not in memory
// it will be fetched from the dB
func (ldMgr *LogicalManager) GetLogicalDevice(ctx context.Context, id *voltha.ID) (*voltha.LogicalDevice, error) {
- logger.Debugw(ctx, "getlogicalDevice", log.Fields{"logicaldeviceid": id})
+ logger.Debugw(ctx, "getlogicalDevice", log.Fields{"logical-device-id": id})
if agent := ldMgr.getLogicalDeviceAgent(ctx, id.Id); agent != nil {
return agent.GetLogicalDeviceReadOnly(ctx)
}
@@ -108,7 +108,7 @@
}
func (ldMgr *LogicalManager) createLogicalDevice(ctx context.Context, device *voltha.Device) (*string, error) {
- logger.Debugw(ctx, "creating-logical-device", log.Fields{"deviceId": device.Id})
+ logger.Debugw(ctx, "creating-logical-device", log.Fields{"device-id": device.Id})
// Sanity check
if !device.Root {
return nil, errors.New("device-not-root")
@@ -121,18 +121,18 @@
id := utils.CreateLogicalDeviceID()
sn := strings.Replace(device.MacAddress, ":", "", -1)
if id == "" {
- logger.Errorw(ctx, "mac-address-not-set", log.Fields{"deviceId": device.Id, "serial-number": sn})
+ logger.Errorw(ctx, "mac-address-not-set", log.Fields{"device-id": device.Id, "serial-number": sn})
return nil, errors.New("mac-address-not-set")
}
- logger.Debugw(ctx, "logical-device-id", log.Fields{"logicaldeviceId": id})
+ logger.Debugw(ctx, "logical-device-id", log.Fields{"logical-device-id": id})
agent := newLogicalAgent(ctx, id, sn, device.Id, ldMgr, ldMgr.deviceMgr, ldMgr.dbPath, ldMgr.ldProxy, ldMgr.defaultTimeout)
ldMgr.addLogicalDeviceAgentToMap(agent)
// Update the root device with the logical device Id reference
if err := ldMgr.deviceMgr.setParentID(ctx, device, id); err != nil {
- logger.Errorw(ctx, "failed-setting-parent-id", log.Fields{"logicalDeviceId": id, "deviceId": device.Id})
+ logger.Errorw(ctx, "failed-setting-parent-id", log.Fields{"logical-device-id": id, "device-id": device.Id})
return nil, err
}
@@ -154,13 +154,13 @@
// reference of this logical device in cache. The device Id is passed as param because the logical device may already
// have been removed from the model. This function returns the logical device Id if found
func (ldMgr *LogicalManager) stopManagingLogicalDeviceWithDeviceID(ctx context.Context, id string) string {
- logger.Infow(ctx, "stop-managing-logical-device", log.Fields{"deviceId": id})
+ logger.Infow(ctx, "stop-managing-logical-device", log.Fields{"device-id": id})
// Go over the list of logical device agents to find the one which has rootDeviceId as id
var ldID = ""
ldMgr.logicalDeviceAgents.Range(func(key, value interface{}) bool {
ldAgent := value.(*LogicalAgent)
if ldAgent.rootDeviceID == id {
- logger.Infow(ctx, "stopping-logical-device-agent", log.Fields{"lDeviceId": key})
+ logger.Infow(ctx, "stopping-logical-device-agent", log.Fields{"logical-device-id": key})
if err := ldAgent.stop(ctx); err != nil {
logger.Errorw(ctx, "failed-to-stop-LDAgent", log.Fields{"error": err})
return false
@@ -233,7 +233,7 @@
}
func (ldMgr *LogicalManager) deleteLogicalDevice(ctx context.Context, device *voltha.Device) error {
- logger.Debugw(ctx, "deleting-logical-device", log.Fields{"deviceId": device.Id})
+ logger.Debugw(ctx, "deleting-logical-device", log.Fields{"device-id": device.Id})
// Sanity check
if !device.Root {
return errors.New("device-not-root")
@@ -281,7 +281,7 @@
// ListLogicalDeviceFlows returns the flows of logical device
func (ldMgr *LogicalManager) ListLogicalDeviceFlows(ctx context.Context, id *voltha.ID) (*openflow_13.Flows, error) {
- logger.Debugw(ctx, "ListLogicalDeviceFlows", log.Fields{"logicaldeviceid": id.Id})
+ logger.Debugw(ctx, "ListLogicalDeviceFlows", log.Fields{"logical-device-id": id.Id})
agent := ldMgr.getLogicalDeviceAgent(ctx, id.Id)
if agent == nil {
return nil, status.Errorf(codes.NotFound, "%s", id.Id)
@@ -298,7 +298,7 @@
// ListLogicalDeviceFlowGroups returns logical device flow groups
func (ldMgr *LogicalManager) ListLogicalDeviceFlowGroups(ctx context.Context, id *voltha.ID) (*openflow_13.FlowGroups, error) {
- logger.Debugw(ctx, "ListLogicalDeviceFlowGroups", log.Fields{"logicaldeviceid": id.Id})
+ logger.Debugw(ctx, "ListLogicalDeviceFlowGroups", log.Fields{"logical-device-id": id.Id})
agent := ldMgr.getLogicalDeviceAgent(ctx, id.Id)
if agent == nil {
return nil, status.Errorf(codes.NotFound, "%s", id.Id)
@@ -315,7 +315,7 @@
// ListLogicalDevicePorts returns logical device ports
func (ldMgr *LogicalManager) ListLogicalDevicePorts(ctx context.Context, id *voltha.ID) (*voltha.LogicalPorts, error) {
- logger.Debugw(ctx, "ListLogicalDevicePorts", log.Fields{"logicaldeviceid": id.Id})
+ logger.Debugw(ctx, "ListLogicalDevicePorts", log.Fields{"logical-device-id": id.Id})
agent := ldMgr.getLogicalDeviceAgent(ctx, id.Id)
if agent == nil {
return nil, status.Errorf(codes.NotFound, "%s", id.Id)
@@ -407,13 +407,13 @@
}
func (ldMgr *LogicalManager) deleteAllLogicalPorts(ctx context.Context, device *voltha.Device) error {
- logger.Debugw(ctx, "deleteAllLogicalPorts", log.Fields{"deviceId": device.Id})
+ logger.Debugw(ctx, "deleteAllLogicalPorts", log.Fields{"device-id": device.Id})
var ldID *string
var err error
//Get the logical device Id for this device
if ldID, err = ldMgr.getLogicalDeviceID(ctx, device); err != nil {
- logger.Warnw(ctx, "no-logical-device-found", log.Fields{"deviceId": device.Id, "error": err})
+ logger.Warnw(ctx, "no-logical-device-found", log.Fields{"device-id": device.Id, "error": err})
return err
}
if agent := ldMgr.getLogicalDeviceAgent(ctx, *ldID); agent != nil {
@@ -425,13 +425,13 @@
}
func (ldMgr *LogicalManager) updatePortState(ctx context.Context, deviceID string, portNo uint32, state voltha.OperStatus_Types) error {
- logger.Debugw(ctx, "updatePortState", log.Fields{"deviceId": deviceID, "state": state, "portNo": portNo})
+ logger.Debugw(ctx, "updatePortState", log.Fields{"device-id": deviceID, "state": state, "portNo": portNo})
var ldID *string
var err error
//Get the logical device Id for this device
if ldID, err = ldMgr.getLogicalDeviceIDFromDeviceID(ctx, deviceID); err != nil {
- logger.Warnw(ctx, "no-logical-device-found", log.Fields{"deviceId": deviceID, "error": err})
+ logger.Warnw(ctx, "no-logical-device-found", log.Fields{"device-id": deviceID, "error": err})
return err
}
if agent := ldMgr.getLogicalDeviceAgent(ctx, *ldID); agent != nil {
@@ -444,7 +444,7 @@
// UpdateLogicalDeviceFlowTable updates logical device flow table
func (ldMgr *LogicalManager) UpdateLogicalDeviceFlowTable(ctx context.Context, flow *openflow_13.FlowTableUpdate) (*empty.Empty, error) {
- logger.Debugw(ctx, "UpdateLogicalDeviceFlowTable", log.Fields{"logicalDeviceId": flow.Id})
+ logger.Debugw(ctx, "UpdateLogicalDeviceFlowTable", log.Fields{"logical-device-id": flow.Id})
agent := ldMgr.getLogicalDeviceAgent(ctx, flow.Id)
if agent == nil {
return nil, status.Errorf(codes.NotFound, "%s", flow.Id)
@@ -454,7 +454,7 @@
// UpdateLogicalDeviceMeterTable - This function sends meter mod request to logical device manager and waits for response
func (ldMgr *LogicalManager) UpdateLogicalDeviceMeterTable(ctx context.Context, meter *openflow_13.MeterModUpdate) (*empty.Empty, error) {
- logger.Debugw(ctx, "UpdateLogicalDeviceMeterTable", log.Fields{"logicalDeviceId": meter.Id})
+ logger.Debugw(ctx, "UpdateLogicalDeviceMeterTable", log.Fields{"logical-device-id": meter.Id})
agent := ldMgr.getLogicalDeviceAgent(ctx, meter.Id)
if agent == nil {
return nil, status.Errorf(codes.NotFound, "%s", meter.Id)
@@ -464,7 +464,7 @@
// ListLogicalDeviceMeters returns logical device meters
func (ldMgr *LogicalManager) ListLogicalDeviceMeters(ctx context.Context, id *voltha.ID) (*openflow_13.Meters, error) {
- logger.Debugw(ctx, "ListLogicalDeviceMeters", log.Fields{"logicalDeviceId": id.Id})
+ logger.Debugw(ctx, "ListLogicalDeviceMeters", log.Fields{"logical-device-id": id.Id})
agent := ldMgr.getLogicalDeviceAgent(ctx, id.Id)
if agent == nil {
return nil, status.Errorf(codes.NotFound, "%s", id.Id)
@@ -480,7 +480,7 @@
// UpdateLogicalDeviceFlowGroupTable updates logical device flow group table
func (ldMgr *LogicalManager) UpdateLogicalDeviceFlowGroupTable(ctx context.Context, flow *openflow_13.FlowGroupTableUpdate) (*empty.Empty, error) {
- logger.Debugw(ctx, "UpdateGroupTable", log.Fields{"logicalDeviceId": flow.Id})
+ logger.Debugw(ctx, "UpdateGroupTable", log.Fields{"logical-device-id": flow.Id})
agent := ldMgr.getLogicalDeviceAgent(ctx, flow.Id)
if agent == nil {
return nil, status.Errorf(codes.NotFound, "%s", flow.Id)
@@ -490,7 +490,7 @@
// EnableLogicalDevicePort enables logical device port
func (ldMgr *LogicalManager) EnableLogicalDevicePort(ctx context.Context, id *voltha.LogicalPortId) (*empty.Empty, error) {
- logger.Debugw(ctx, "EnableLogicalDevicePort", log.Fields{"logicalDeviceId": id})
+ logger.Debugw(ctx, "EnableLogicalDevicePort", log.Fields{"logical-device-id": id})
agent := ldMgr.getLogicalDeviceAgent(ctx, id.Id)
if agent == nil {
return nil, status.Errorf(codes.NotFound, "%s", id.Id)
@@ -504,7 +504,7 @@
// DisableLogicalDevicePort disables logical device port
func (ldMgr *LogicalManager) DisableLogicalDevicePort(ctx context.Context, id *voltha.LogicalPortId) (*empty.Empty, error) {
- logger.Debugw(ctx, "DisableLogicalDevicePort", log.Fields{"logicalDeviceId": id})
+ logger.Debugw(ctx, "DisableLogicalDevicePort", log.Fields{"logical-device-id": id})
agent := ldMgr.getLogicalDeviceAgent(ctx, id.Id)
if agent == nil {
return nil, status.Errorf(codes.NotFound, "%s", id.Id)
@@ -517,11 +517,11 @@
}
func (ldMgr *LogicalManager) packetIn(ctx context.Context, logicalDeviceID string, port uint32, transactionID string, packet []byte) error {
- logger.Debugw(ctx, "packetIn", log.Fields{"logicalDeviceId": logicalDeviceID, "port": port})
+ logger.Debugw(ctx, "packetIn", log.Fields{"logical-device-id": logicalDeviceID, "port": port})
if agent := ldMgr.getLogicalDeviceAgent(ctx, logicalDeviceID); agent != nil {
agent.packetIn(ctx, port, transactionID, packet)
} else {
- logger.Error(ctx, "logical-device-not-exist", log.Fields{"logicalDeviceId": logicalDeviceID})
+ logger.Error(ctx, "logical-device-not-exist", log.Fields{"logical-device-id": logicalDeviceID})
}
return nil
}
@@ -554,7 +554,7 @@
if agent := ldMgr.getLogicalDeviceAgent(packets.Context(), packet.Id); agent != nil {
agent.packetOut(packets.Context(), packet.PacketOut)
} else {
- logger.Errorf(ctx, "No logical device agent present", log.Fields{"logicalDeviceID": packet.Id})
+ logger.Errorf(ctx, "No logical device agent present", log.Fields{"logical-device-id": packet.Id})
}
}
diff --git a/rw_core/core/device/manager.go b/rw_core/core/device/manager.go
index 1e2d2a4..0afddbe 100755
--- a/rw_core/core/device/manager.go
+++ b/rw_core/core/device/manager.go
@@ -123,7 +123,7 @@
return agent.(*Agent)
}
//TODO: Change the return params to return an error as well
- logger.Errorw(ctx, "loading-device-failed", log.Fields{"deviceId": deviceID, "error": err})
+ logger.Errorw(ctx, "loading-device-failed", log.Fields{"device-id": deviceID, "error": err})
return nil
}
@@ -289,7 +289,7 @@
// This function is called only in the Core that does not own this device. In the Core that owns this device then a
// deletion deletion also includes removal of any reference of this device.
func (dMgr *Manager) stopManagingDevice(ctx context.Context, id string) {
- logger.Infow(ctx, "stopManagingDevice", log.Fields{"deviceId": id})
+ logger.Infow(ctx, "stopManagingDevice", log.Fields{"device-id": id})
if dMgr.IsDeviceInCache(id) { // Proceed only if an agent is present for this device
if root, _ := dMgr.IsRootDevice(id); root {
// stop managing the logical device
@@ -306,7 +306,7 @@
// RunPostDeviceDelete removes any reference of this device
func (dMgr *Manager) RunPostDeviceDelete(ctx context.Context, cDevice *voltha.Device) error {
- logger.Infow(ctx, "RunPostDeviceDelete", log.Fields{"deviceId": cDevice.Id})
+ logger.Infow(ctx, "RunPostDeviceDelete", log.Fields{"device-id": cDevice.Id})
dMgr.stopManagingDevice(ctx, cDevice.Id)
return nil
}
@@ -320,7 +320,7 @@
// getDeviceReadOnly will returns a device, either from memory or from the dB, if present
func (dMgr *Manager) getDeviceReadOnly(ctx context.Context, id string) (*voltha.Device, error) {
- logger.Debugw(ctx, "getDeviceReadOnly", log.Fields{"deviceid": id})
+ logger.Debugw(ctx, "getDeviceReadOnly", log.Fields{"device-id": id})
if agent := dMgr.getDeviceAgent(ctx, id); agent != nil {
return agent.getDeviceReadOnly(ctx)
}
@@ -328,7 +328,7 @@
}
func (dMgr *Manager) listDevicePorts(ctx context.Context, id string) (map[uint32]*voltha.Port, error) {
- logger.Debugw(ctx, "listDevicePorts", log.Fields{"deviceid": id})
+ logger.Debugw(ctx, "listDevicePorts", log.Fields{"device-id": id})
agent := dMgr.getDeviceAgent(ctx, id)
if agent == nil {
return nil, status.Errorf(codes.NotFound, "%s", id)
@@ -338,7 +338,7 @@
// GetChildDevice will return a device, either from memory or from the dB, if present
func (dMgr *Manager) GetChildDevice(ctx context.Context, parentDeviceID string, serialNumber string, onuID int64, parentPortNo int64) (*voltha.Device, error) {
- logger.Debugw(ctx, "GetChildDevice", log.Fields{"parentDeviceid": parentDeviceID, "serialNumber": serialNumber,
+ logger.Debugw(ctx, "GetChildDevice", log.Fields{"parent-device-id": parentDeviceID, "serialNumber": serialNumber,
"parentPortNo": parentPortNo, "onuId": onuID})
parentDevicePorts, err := dMgr.listDevicePorts(ctx, parentDeviceID)
@@ -347,7 +347,7 @@
}
childDeviceIds := dMgr.getAllChildDeviceIds(ctx, parentDevicePorts)
if len(childDeviceIds) == 0 {
- logger.Debugw(ctx, "no-child-devices", log.Fields{"parentDeviceId": parentDeviceID, "serialNumber": serialNumber, "onuId": onuID})
+ logger.Debugw(ctx, "no-child-devices", log.Fields{"parent-device-id": parentDeviceID, "serialNumber": serialNumber, "onuId": onuID})
return nil, status.Errorf(codes.NotFound, "%s", parentDeviceID)
}
@@ -359,14 +359,14 @@
foundOnuID := false
if searchDevice.ProxyAddress.OnuId == uint32(onuID) {
if searchDevice.ParentPortNo == uint32(parentPortNo) {
- logger.Debugw(ctx, "found-child-by-onuid", log.Fields{"parentDeviceId": parentDeviceID, "onuId": onuID})
+ logger.Debugw(ctx, "found-child-by-onuid", log.Fields{"parent-device-id": parentDeviceID, "onuId": onuID})
foundOnuID = true
}
}
foundSerialNumber := false
if searchDevice.SerialNumber == serialNumber {
- logger.Debugw(ctx, "found-child-by-serialnumber", log.Fields{"parentDeviceId": parentDeviceID, "serialNumber": serialNumber})
+ logger.Debugw(ctx, "found-child-by-serialnumber", log.Fields{"parent-device-id": parentDeviceID, "serialNumber": serialNumber})
foundSerialNumber = true
}
@@ -386,11 +386,11 @@
}
if foundChildDevice != nil {
- logger.Debugw(ctx, "child-device-found", log.Fields{"parentDeviceId": parentDeviceID, "foundChildDevice": foundChildDevice})
+ logger.Debugw(ctx, "child-device-found", log.Fields{"parent-device-id": parentDeviceID, "foundChildDevice": foundChildDevice})
return foundChildDevice, nil
}
- logger.Debugw(ctx, "child-device-not-found", log.Fields{"parentDeviceId": parentDeviceID,
+ logger.Debugw(ctx, "child-device-not-found", log.Fields{"parent-device-id": parentDeviceID,
"serialNumber": serialNumber, "onuId": onuID, "parentPortNo": parentPortNo})
return nil, status.Errorf(codes.NotFound, "%s", parentDeviceID)
}
@@ -405,7 +405,7 @@
}
childDeviceIds := dMgr.getAllChildDeviceIds(ctx, parentDevicePorts)
if len(childDeviceIds) == 0 {
- logger.Debugw(ctx, "no-child-devices", log.Fields{"parentDeviceId": proxyAddress.DeviceId})
+ logger.Debugw(ctx, "no-child-devices", log.Fields{"parent-device-id": proxyAddress.DeviceId})
return nil, status.Errorf(codes.NotFound, "%s", proxyAddress)
}
@@ -458,10 +458,10 @@
for _, device := range devices {
// If device is not in memory then set it up
if !dMgr.IsDeviceInCache(device.Id) {
- logger.Debugw(ctx, "loading-device-from-Model", log.Fields{"id": device.Id})
+ logger.Debugw(ctx, "loading-device-from-Model", log.Fields{"device-id": device.Id})
agent := newAgent(dMgr.adapterProxy, device, dMgr, dMgr.dbPath, dMgr.dProxy, dMgr.defaultTimeout)
if _, err := agent.start(ctx, nil); err != nil {
- logger.Warnw(ctx, "failure-starting-agent", log.Fields{"deviceId": device.Id})
+ logger.Warnw(ctx, "failure-starting-agent", log.Fields{"device-id": device.Id})
} else {
dMgr.addDeviceAgentToMap(agent)
}
@@ -521,15 +521,15 @@
dMgr.devicesLoadingLock.Unlock()
// Proceed with the loading only if the device exist in the Model (could have been deleted)
if device, err = dMgr.getDeviceFromModel(ctx, deviceID); err == nil {
- logger.Debugw(ctx, "loading-device", log.Fields{"deviceId": deviceID})
+ logger.Debugw(ctx, "loading-device", log.Fields{"device-id": deviceID})
agent := newAgent(dMgr.adapterProxy, device, dMgr, dMgr.dbPath, dMgr.dProxy, dMgr.defaultTimeout)
if _, err = agent.start(ctx, nil); err != nil {
- logger.Warnw(ctx, "Failure loading device", log.Fields{"deviceId": deviceID, "error": err})
+ logger.Warnw(ctx, "Failure loading device", log.Fields{"device-id": deviceID, "error": err})
} else {
dMgr.addDeviceAgentToMap(agent)
}
} else {
- logger.Debugw(ctx, "Device not in model", log.Fields{"deviceId": deviceID})
+ logger.Debugw(ctx, "Device not in model", log.Fields{"device-id": deviceID})
}
// announce completion of task to any number of waiting channels
dMgr.devicesLoadingLock.Lock()
@@ -558,26 +558,26 @@
// loadRootDeviceParentAndChildren loads the children and parents of a root device in memory
func (dMgr *Manager) loadRootDeviceParentAndChildren(ctx context.Context, device *voltha.Device, devicePorts map[uint32]*voltha.Port) error {
- logger.Debugw(ctx, "loading-parent-and-children", log.Fields{"deviceId": device.Id})
+ logger.Debugw(ctx, "loading-parent-and-children", log.Fields{"device-id": device.Id})
if device.Root {
// Scenario A
if device.ParentId != "" {
// Load logical device if needed.
if err := dMgr.logicalDeviceMgr.load(ctx, device.ParentId); err != nil {
- logger.Warnw(ctx, "failure-loading-logical-device", log.Fields{"lDeviceId": device.ParentId})
+ logger.Warnw(ctx, "failure-loading-logical-device", log.Fields{"logical-device-id": device.ParentId})
}
} else {
- logger.Debugw(ctx, "no-parent-to-load", log.Fields{"deviceId": device.Id})
+ logger.Debugw(ctx, "no-parent-to-load", log.Fields{"device-id": device.Id})
}
// Load all child devices, if needed
childDeviceIds := dMgr.getAllChildDeviceIds(ctx, devicePorts)
for childDeviceID := range childDeviceIds {
if _, err := dMgr.loadDevice(ctx, childDeviceID); err != nil {
- logger.Warnw(ctx, "failure-loading-device", log.Fields{"deviceId": childDeviceID, "error": err})
+ logger.Warnw(ctx, "failure-loading-device", log.Fields{"device-id": childDeviceID, "error": err})
return err
}
}
- logger.Debugw(ctx, "loaded-children", log.Fields{"deviceId": device.Id, "numChildren": len(childDeviceIds)})
+ logger.Debugw(ctx, "loaded-children", log.Fields{"device-id": device.Id, "numChildren": len(childDeviceIds)})
}
return nil
}
@@ -611,10 +611,10 @@
// Load all children as well as the parent of this device (logical_device)
if err := dMgr.loadRootDeviceParentAndChildren(ctx, device, devicePorts); err != nil {
- logger.Warnw(ctx, "failure-loading-device-parent-and-children", log.Fields{"deviceId": deviceID})
+ logger.Warnw(ctx, "failure-loading-device-parent-and-children", log.Fields{"device-id": deviceID})
return err
}
- logger.Debugw(ctx, "successfully-loaded-parent-and-children", log.Fields{"deviceId": deviceID})
+ logger.Debugw(ctx, "successfully-loaded-parent-and-children", log.Fields{"device-id": deviceID})
} else {
// Scenario B - use the parentId of that device (root device) to trigger the loading
if device.ParentId != "" {
@@ -641,7 +641,7 @@
var err error
for _, id := range ids.Items {
if err = dMgr.load(ctx, id.Id); err != nil {
- logger.Warnw(ctx, "failure-reconciling-device", log.Fields{"deviceId": id.Id, "error": err})
+ logger.Warnw(ctx, "failure-reconciling-device", log.Fields{"device-id": id.Id, "error": err})
} else {
reconciled++
}
@@ -770,7 +770,7 @@
}
func (dMgr *Manager) UpdateDeviceUsingAdapterData(ctx context.Context, device *voltha.Device) error {
- logger.Debugw(ctx, "UpdateDeviceUsingAdapterData", log.Fields{"deviceid": device.Id, "device": device})
+ logger.Debugw(ctx, "UpdateDeviceUsingAdapterData", log.Fields{"device-id": device.Id, "device": device})
if agent := dMgr.getDeviceAgent(ctx, device.Id); agent != nil {
return agent.updateDeviceUsingAdapterData(ctx, device)
}
@@ -821,7 +821,7 @@
}
func (dMgr *Manager) addFlowsAndGroups(ctx context.Context, deviceID string, flows []*ofp.OfpFlowStats, groups []*ofp.OfpGroupEntry, flowMetadata *voltha.FlowMetadata) error {
- logger.Debugw(ctx, "addFlowsAndGroups", log.Fields{"deviceid": deviceID, "groups:": groups, "flowMetadata": flowMetadata})
+ logger.Debugw(ctx, "addFlowsAndGroups", log.Fields{"device-id": deviceID, "groups:": groups, "flowMetadata": flowMetadata})
if agent := dMgr.getDeviceAgent(ctx, deviceID); agent != nil {
return agent.addFlowsAndGroups(ctx, flows, groups, flowMetadata)
}
@@ -841,7 +841,7 @@
}
func (dMgr *Manager) deleteFlowsAndGroups(ctx context.Context, deviceID string, flows []*ofp.OfpFlowStats, groups []*ofp.OfpGroupEntry, flowMetadata *voltha.FlowMetadata) error {
- logger.Debugw(ctx, "deleteFlowsAndGroups", log.Fields{"deviceid": deviceID})
+ logger.Debugw(ctx, "deleteFlowsAndGroups", log.Fields{"device-id": deviceID})
if agent := dMgr.getDeviceAgent(ctx, deviceID); agent != nil {
return agent.deleteFlowsAndGroups(ctx, flows, groups, flowMetadata)
}
@@ -849,7 +849,7 @@
}
func (dMgr *Manager) updateFlowsAndGroups(ctx context.Context, deviceID string, flows []*ofp.OfpFlowStats, groups []*ofp.OfpGroupEntry, flowMetadata *voltha.FlowMetadata) error {
- logger.Debugw(ctx, "updateFlowsAndGroups", log.Fields{"deviceid": deviceID})
+ logger.Debugw(ctx, "updateFlowsAndGroups", log.Fields{"device-id": deviceID})
if agent := dMgr.getDeviceAgent(ctx, deviceID); agent != nil {
return agent.updateFlowsAndGroups(ctx, flows, groups, flowMetadata)
}
@@ -894,7 +894,7 @@
}
func (dMgr *Manager) getSwitchCapability(ctx context.Context, deviceID string) (*ic.SwitchCapability, error) {
- logger.Debugw(ctx, "getSwitchCapability", log.Fields{"deviceid": deviceID})
+ logger.Debugw(ctx, "getSwitchCapability", log.Fields{"device-id": deviceID})
if agent := dMgr.getDeviceAgent(ctx, deviceID); agent != nil {
return agent.getSwitchCapability(ctx)
}
@@ -902,7 +902,7 @@
}
func (dMgr *Manager) GetPorts(ctx context.Context, deviceID string, portType voltha.Port_PortType) (*voltha.Ports, error) {
- logger.Debugw(ctx, "GetPorts", log.Fields{"deviceid": deviceID, "portType": portType})
+ logger.Debugw(ctx, "GetPorts", log.Fields{"device-id": deviceID, "portType": portType})
agent := dMgr.getDeviceAgent(ctx, deviceID)
if agent == nil {
return nil, status.Errorf(codes.NotFound, "%s", deviceID)
@@ -911,7 +911,7 @@
}
func (dMgr *Manager) UpdateDeviceStatus(ctx context.Context, deviceID string, operStatus voltha.OperStatus_Types, connStatus voltha.ConnectStatus_Types) error {
- logger.Debugw(ctx, "UpdateDeviceStatus", log.Fields{"deviceid": deviceID, "operStatus": operStatus, "connStatus": connStatus})
+ logger.Debugw(ctx, "UpdateDeviceStatus", log.Fields{"device-id": deviceID, "operStatus": operStatus, "connStatus": connStatus})
if agent := dMgr.getDeviceAgent(ctx, deviceID); agent != nil {
return agent.updateDeviceStatus(ctx, operStatus, connStatus)
}
@@ -919,7 +919,7 @@
}
func (dMgr *Manager) UpdateChildrenStatus(ctx context.Context, deviceID string, operStatus voltha.OperStatus_Types, connStatus voltha.ConnectStatus_Types) error {
- logger.Debugw(ctx, "UpdateChildrenStatus", log.Fields{"parentDeviceid": deviceID, "operStatus": operStatus, "connStatus": connStatus})
+ logger.Debugw(ctx, "UpdateChildrenStatus", log.Fields{"parent-device-id": deviceID, "operStatus": operStatus, "connStatus": connStatus})
parentDevicePorts, err := dMgr.listDevicePorts(ctx, deviceID)
if err != nil {
return status.Errorf(codes.Aborted, "%s", err.Error())
@@ -935,10 +935,10 @@
}
func (dMgr *Manager) UpdatePortState(ctx context.Context, deviceID string, portType voltha.Port_PortType, portNo uint32, operStatus voltha.OperStatus_Types) error {
- logger.Debugw(ctx, "UpdatePortState", log.Fields{"deviceid": deviceID, "portType": portType, "portNo": portNo, "operStatus": operStatus})
+ logger.Debugw(ctx, "UpdatePortState", log.Fields{"device-id": deviceID, "portType": portType, "portNo": portNo, "operStatus": operStatus})
if agent := dMgr.getDeviceAgent(ctx, deviceID); agent != nil {
if err := agent.updatePortState(ctx, portType, portNo, operStatus); err != nil {
- logger.Errorw(ctx, "updating-port-state-failed", log.Fields{"deviceid": deviceID, "portNo": portNo, "error": err})
+ logger.Errorw(ctx, "updating-port-state-failed", log.Fields{"device-id": deviceID, "portNo": portNo, "error": err})
return err
}
// Notify the logical device manager to change the port state
@@ -963,7 +963,7 @@
}
func (dMgr *Manager) DeleteAllPorts(ctx context.Context, deviceID string) error {
- logger.Debugw(ctx, "DeleteAllPorts", log.Fields{"deviceid": deviceID})
+ logger.Debugw(ctx, "DeleteAllPorts", log.Fields{"device-id": deviceID})
if agent := dMgr.getDeviceAgent(ctx, deviceID); agent != nil {
if err := agent.deleteAllPorts(ctx); err != nil {
return err
@@ -978,7 +978,7 @@
}
}()
} else {
- logger.Warnw(ctx, "failed-to-retrieve-device", log.Fields{"deviceId": deviceID})
+ logger.Warnw(ctx, "failed-to-retrieve-device", log.Fields{"device-id": deviceID})
return err
}
return nil
@@ -988,7 +988,7 @@
//UpdatePortsState updates all ports on the device
func (dMgr *Manager) UpdatePortsState(ctx context.Context, deviceID string, portTypeFilter uint32, state voltha.OperStatus_Types) error {
- logger.Debugw(ctx, "UpdatePortsState", log.Fields{"deviceid": deviceID})
+ logger.Debugw(ctx, "UpdatePortsState", log.Fields{"device-id": deviceID})
agent := dMgr.getDeviceAgent(ctx, deviceID)
if agent == nil {
return status.Errorf(codes.NotFound, "%s", deviceID)
@@ -997,7 +997,7 @@
return status.Error(codes.Unimplemented, "state-change-not-implemented")
}
if err := agent.updatePortsOperState(ctx, portTypeFilter, state); err != nil {
- logger.Warnw(ctx, "updatePortsOperState-failed", log.Fields{"deviceId": deviceID, "error": err})
+ logger.Warnw(ctx, "updatePortsOperState-failed", log.Fields{"device-id": deviceID, "error": err})
return err
}
return nil
@@ -1005,7 +1005,7 @@
func (dMgr *Manager) ChildDeviceDetected(ctx context.Context, parentDeviceID string, parentPortNo int64, deviceType string,
channelID int64, vendorID string, serialNumber string, onuID int64) (*voltha.Device, error) {
- logger.Debugw(ctx, "ChildDeviceDetected", log.Fields{"parentDeviceId": parentDeviceID, "parentPortNo": parentPortNo, "deviceType": deviceType, "channelId": channelID, "vendorId": vendorID, "serialNumber": serialNumber, "onuId": onuID})
+ logger.Debugw(ctx, "ChildDeviceDetected", log.Fields{"parent-device-id": parentDeviceID, "parentPortNo": parentPortNo, "deviceType": deviceType, "channelId": channelID, "vendorId": vendorID, "serialNumber": serialNumber, "onuId": onuID})
if deviceType == "" && vendorID != "" {
logger.Debug(ctx, "device-type-is-nil-fetching-device-type")
@@ -1048,7 +1048,7 @@
}
if device, err := dMgr.GetChildDevice(ctx, parentDeviceID, serialNumber, onuID, parentPortNo); err == nil {
- logger.Warnw(ctx, "child-device-exists", log.Fields{"parentId": parentDeviceID, "serialNumber": serialNumber})
+ logger.Warnw(ctx, "child-device-exists", log.Fields{"parent-device-id": parentDeviceID, "serialNumber": serialNumber})
return device, status.Errorf(codes.AlreadyExists, "%s", serialNumber)
}
@@ -1089,7 +1089,7 @@
})
handlers := dMgr.stateTransitions.GetTransitionHandler(ctx, device, previousState)
if handlers == nil {
- logger.Debugw(ctx, "no-op-transition", log.Fields{"deviceId": device.Id})
+ logger.Debugw(ctx, "no-op-transition", log.Fields{"device-id": device.Id})
return nil
}
logger.Debugw(ctx, "handler-found", log.Fields{"num-expectedHandlers": len(handlers), "isParent": device.Root, "current-data": device, "previous-state": previousState})
@@ -1104,7 +1104,7 @@
}
func (dMgr *Manager) packetOut(ctx context.Context, deviceID string, outPort uint32, packet *ofp.OfpPacketOut) error {
- logger.Debugw(ctx, "packetOut", log.Fields{"deviceId": deviceID, "outPort": outPort})
+ logger.Debugw(ctx, "packetOut", log.Fields{"device-id": deviceID, "outPort": outPort})
if agent := dMgr.getDeviceAgent(ctx, deviceID); agent != nil {
return agent.packetOut(ctx, outPort, packet)
}
@@ -1113,16 +1113,16 @@
// PacketIn receives packet from adapter
func (dMgr *Manager) PacketIn(ctx context.Context, deviceID string, port uint32, transactionID string, packet []byte) error {
- logger.Debugw(ctx, "PacketIn", log.Fields{"deviceId": deviceID, "port": port})
+ logger.Debugw(ctx, "PacketIn", log.Fields{"device-id": deviceID, "port": port})
// Get the logical device Id based on the deviceId
var device *voltha.Device
var err error
if device, err = dMgr.getDeviceReadOnly(ctx, deviceID); err != nil {
- logger.Errorw(ctx, "device-not-found", log.Fields{"deviceId": deviceID})
+ logger.Errorw(ctx, "device-not-found", log.Fields{"device-id": deviceID})
return err
}
if !device.Root {
- logger.Errorw(ctx, "device-not-root", log.Fields{"deviceId": deviceID})
+ logger.Errorw(ctx, "device-not-root", log.Fields{"device-id": deviceID})
return status.Errorf(codes.FailedPrecondition, "%s", deviceID)
}
@@ -1133,7 +1133,7 @@
}
func (dMgr *Manager) setParentID(ctx context.Context, device *voltha.Device, parentID string) error {
- logger.Debugw(ctx, "setParentId", log.Fields{"deviceId": device.Id, "parentId": parentID})
+ logger.Debugw(ctx, "setParentId", log.Fields{"device-id": device.Id, "parentId": parentID})
if agent := dMgr.getDeviceAgent(ctx, device.Id); agent != nil {
return agent.setParentID(ctx, device, parentID)
}
@@ -1145,7 +1145,7 @@
logger.Info(ctx, "CreateLogicalDevice")
// Verify whether the logical device has already been created
if cDevice.ParentId != "" {
- logger.Debugw(ctx, "Parent device already exist.", log.Fields{"deviceId": cDevice.Id, "logicalDeviceId": cDevice.Id})
+ logger.Debugw(ctx, "Parent device already exist.", log.Fields{"device-id": cDevice.Id, "logical-device-id": cDevice.Id})
return nil
}
var err error
@@ -1161,7 +1161,7 @@
logger.Info(ctx, "DeleteLogicalDevice")
var err error
if err = dMgr.logicalDeviceMgr.deleteLogicalDevice(ctx, cDevice); err != nil {
- logger.Warnw(ctx, "deleteLogical-device-error", log.Fields{"deviceId": cDevice.Id})
+ logger.Warnw(ctx, "deleteLogical-device-error", log.Fields{"device-id": cDevice.Id})
return err
}
// Remove the logical device Id from the parent device
@@ -1196,7 +1196,7 @@
logger.Debug(ctx, "ChildDevicesLost")
parentDevice, err := dMgr.getDeviceReadOnly(ctx, parentDeviceID)
if err != nil {
- logger.Warnw(ctx, "failed-getting-device", log.Fields{"deviceId": parentDeviceID, "error": err})
+ logger.Warnw(ctx, "failed-getting-device", log.Fields{"parent-device-id": parentDeviceID, "error": err})
return err
}
return dMgr.DisableAllChildDevices(ctx, parentDevice)
@@ -1208,12 +1208,12 @@
logger.Debug(ctx, "ChildDevicesDetected")
parentDevicePorts, err := dMgr.listDevicePorts(ctx, parentDeviceID)
if err != nil {
- logger.Warnw(ctx, "failed-getting-device", log.Fields{"deviceId": parentDeviceID, "error": err})
+ logger.Warnw(ctx, "failed-getting-device", log.Fields{"device-id": parentDeviceID, "error": err})
return err
}
childDeviceIds := dMgr.getAllChildDeviceIds(ctx, parentDevicePorts)
if len(childDeviceIds) == 0 {
- logger.Debugw(ctx, "no-child-device", log.Fields{"parentDeviceId": parentDeviceID})
+ logger.Debugw(ctx, "no-child-device", log.Fields{"parent-device-id": parentDeviceID})
}
allChildEnableRequestSent := true
for childDeviceID := range childDeviceIds {
@@ -1227,7 +1227,7 @@
}(log.WithSpanFromContext(context.Background(), ctx))
} else {
err = status.Errorf(codes.Unavailable, "no agent for child device %s", childDeviceID)
- logger.Errorw(ctx, "no-child-device-agent", log.Fields{"parentDeviceId": parentDeviceID, "childId": childDeviceID})
+ logger.Errorw(ctx, "no-child-device-agent", log.Fields{"parent-device-id": parentDeviceID, "childId": childDeviceID})
allChildEnableRequestSent = false
}
}
@@ -1250,7 +1250,7 @@
if agent := dMgr.getDeviceAgent(ctx, childDeviceID); agent != nil {
if err := agent.disableDevice(ctx); err != nil {
// Just log the error - this error happens only if the child device was already in deleted state.
- logger.Errorw(ctx, "failure-disable-device", log.Fields{"deviceId": childDeviceID, "error": err.Error()})
+ logger.Errorw(ctx, "failure-disable-device", log.Fields{"device-id": childDeviceID, "error": err.Error()})
}
}
}
@@ -1264,7 +1264,7 @@
for childDeviceID := range dMgr.getAllChildDeviceIds(ctx, ports) {
if agent := dMgr.getDeviceAgent(ctx, childDeviceID); agent != nil {
if err := agent.deleteDevice(ctx); err != nil {
- logger.Warnw(ctx, "failure-delete-device", log.Fields{"deviceId": childDeviceID, "error": err.Error()})
+ logger.Warnw(ctx, "failure-delete-device", log.Fields{"device-id": childDeviceID, "error": err.Error()})
}
// No further action is required here. The deleteDevice will change the device state where the resulting
// callback will take care of cleaning the child device agent.
@@ -1311,7 +1311,7 @@
//GetAllChildDevices is a helper method to get all the child device IDs from the device passed as parameter
func (dMgr *Manager) GetAllChildDevices(ctx context.Context, parentDeviceID string) (*voltha.Devices, error) {
- logger.Debugw(ctx, "GetAllChildDevices", log.Fields{"parentDeviceId": parentDeviceID})
+ logger.Debugw(ctx, "GetAllChildDevices", log.Fields{"parent-device-id": parentDeviceID})
if parentDevicePorts, err := dMgr.listDevicePorts(ctx, parentDeviceID); err == nil {
childDevices := make([]*voltha.Device, 0)
for deviceID := range dMgr.getAllChildDeviceIds(ctx, parentDevicePorts) {
@@ -1510,7 +1510,7 @@
// GetParentDeviceID returns parent device id, either from memory or from the dB, if present
func (dMgr *Manager) GetParentDeviceID(ctx context.Context, deviceID string) string {
if device, _ := dMgr.getDeviceReadOnly(ctx, deviceID); device != nil {
- logger.Infow(ctx, "GetParentDeviceId", log.Fields{"deviceId": device.Id, "parentId": device.ParentId})
+ logger.Infow(ctx, "GetParentDeviceId", log.Fields{"device-id": device.Id, "parentId": device.ParentId})
return device.ParentId
}
return ""
@@ -1531,7 +1531,7 @@
}
func (dMgr *Manager) UpdateDeviceReason(ctx context.Context, deviceID string, reason string) error {
- logger.Debugw(ctx, "UpdateDeviceReason", log.Fields{"deviceid": deviceID, "reason": reason})
+ logger.Debugw(ctx, "UpdateDeviceReason", log.Fields{"device-id": deviceID, "reason": reason})
if agent := dMgr.getDeviceAgent(ctx, deviceID); agent != nil {
return agent.updateDeviceReason(ctx, reason)
}