[VOL-2231] Cleaning the packet-in/out logs and dumping packets in HEX
Change-Id: I22fe6b8b39fb683cea89bb93b1baa2ed2a664398
diff --git a/rw_core/core/logical_device_agent.go b/rw_core/core/logical_device_agent.go
index 1bdfc1c..e04b4d6 100644
--- a/rw_core/core/logical_device_agent.go
+++ b/rw_core/core/logical_device_agent.go
@@ -17,6 +17,7 @@
import (
"context"
+ "encoding/hex"
"errors"
"fmt"
"github.com/gogo/protobuf/proto"
@@ -1882,7 +1883,10 @@
}
func (agent *LogicalDeviceAgent) packetOut(packet *ofp.OfpPacketOut) {
- log.Debugw("packet-out", log.Fields{"packet": packet.GetInPort()})
+ log.Debugw("packet-out", log.Fields{
+ "packet": hex.EncodeToString(packet.Data),
+ "inPort": packet.GetInPort(),
+ })
outPort := fu.GetPacketOutPort(packet)
//frame := packet.GetData()
//TODO: Use a channel between the logical agent and the device agent
@@ -1892,10 +1896,14 @@
}
func (agent *LogicalDeviceAgent) packetIn(port uint32, transactionId string, packet []byte) {
- log.Debugw("packet-in", log.Fields{"port": port, "packet": packet, "transactionId": transactionId})
+ log.Debugw("packet-in", log.Fields{
+ "port": port,
+ "packet": hex.EncodeToString(packet),
+ "transactionId": transactionId,
+ })
packetIn := fu.MkPacketIn(port, packet)
agent.ldeviceMgr.grpcNbiHdlr.sendPacketIn(agent.logicalDeviceId, transactionId, packetIn)
- log.Debugw("sending-packet-in", log.Fields{"packet-in": packetIn})
+ log.Debugw("sending-packet-in", log.Fields{"packet": hex.EncodeToString(packetIn.Data)})
}
func (agent *LogicalDeviceAgent) addLogicalPortToMap(portNo uint32, nniPort bool) {