[VOL-2231] Cleaning the packet-in/out logs and dumping packets in HEX

Change-Id: I22fe6b8b39fb683cea89bb93b1baa2ed2a664398
diff --git a/rw_core/core/device_agent.go b/rw_core/core/device_agent.go
index 3d356ec..97c0b2d 100755
--- a/rw_core/core/device_agent.go
+++ b/rw_core/core/device_agent.go
@@ -17,6 +17,7 @@
 
 import (
 	"context"
+	"encoding/hex"
 	"fmt"
 	"reflect"
 	"sync"
@@ -1005,7 +1006,11 @@
 func (agent *DeviceAgent) packetOut(outPort uint32, packet *ofp.OfpPacketOut) error {
 	//	Send packet to adapter
 	if err := agent.adapterProxy.packetOut(agent.deviceType, agent.deviceId, outPort, packet); err != nil {
-		log.Debugw("packet-out-error", log.Fields{"id": agent.lastData.Id, "error": err})
+		log.Debugw("packet-out-error", log.Fields{
+			"id":     agent.lastData.Id,
+			"error":  err,
+			"packet": hex.EncodeToString(packet.Data),
+		})
 		return err
 	}
 	return nil
diff --git a/rw_core/core/grpc_nbi_api_handler.go b/rw_core/core/grpc_nbi_api_handler.go
index 87f42c6..0aa74f5 100755
--- a/rw_core/core/grpc_nbi_api_handler.go
+++ b/rw_core/core/grpc_nbi_api_handler.go
@@ -17,6 +17,7 @@
 
 import (
 	"context"
+	"encoding/hex"
 	"encoding/json"
 	"errors"
 	"github.com/golang/protobuf/ptypes/empty"
@@ -959,7 +960,9 @@
 	for {
 		select {
 		case packet := <-handler.packetInQueue:
-			log.Debugw("sending-packet-in", log.Fields{"packet": packet})
+			log.Debugw("sending-packet-in", log.Fields{
+				"packet": hex.EncodeToString(packet.PacketIn.Data),
+			})
 			if err := packetsIn.Send(&packet); err != nil {
 				log.Errorw("failed-to-send-packet", log.Fields{"error": err})
 				// save the last failed packet in
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) {