Fixes an issue where flow_stats reply in ofagent fails.

When there is no metadata, i.e. it is zero, the write-metadata field
in the of flow_stats_reply should adjust accordingly. Also added some
debug logs for packet-in/out on both sides of grpc channel between
ofagent and core.

Change-Id: I8ad2955ec707947b4c7e0af138bcc0238cf3c4c2
diff --git a/ofagent/converter.py b/ofagent/converter.py
index 1bebc4f..78b48b5 100644
--- a/ofagent/converter.py
+++ b/ofagent/converter.py
@@ -208,8 +208,11 @@
                 actions=[make_loxi_action(a)
                          for a in inst['actions']['actions']])
         elif type == pb2.OFPIT_WRITE_METADATA:
-            return of13.instruction.write_metadata(
-                metadata=inst['write_metadata']['metadata'])
+            if 'metadata' in inst['write_metadata']:
+                return of13.instruction.write_metadata(
+                        metadata=inst['write_metadata']['metadata'])
+            else:
+                return of13.instruction.write_metadata(0)
         elif type == pb2.OFPIT_METER:
             return of13.instruction.meter(
                 meter_id=inst['meter']['meter_id'])
diff --git a/ofagent/grpc_client.py b/ofagent/grpc_client.py
index 155f18d..65d675f 100644
--- a/ofagent/grpc_client.py
+++ b/ofagent/grpc_client.py
@@ -144,11 +144,13 @@
             packet_in = yield self.packet_in_queue.get()
             device_id = packet_in.id
             ofp_packet_in = packet_in.packet_in
+            self.log.debug('grpc client to send packet-in')
             self.connection_manager.forward_packet_in(device_id, ofp_packet_in)
             if self.stopped:
                 break
 
     def send_packet_out(self, device_id, packet_out):
+        self.log.debug('grpc client to send packet-out')
         packet_out = PacketOut(id=device_id, packet_out=packet_out)
         self.packet_out_queue.put(packet_out)
 
diff --git a/voltha/adapters/openolt/openolt_device.py b/voltha/adapters/openolt/openolt_device.py
index 50bc24b..53144a5 100644
--- a/voltha/adapters/openolt/openolt_device.py
+++ b/voltha/adapters/openolt/openolt_device.py
@@ -412,7 +412,7 @@
                                     omci_indication.pkt)
 
     def packet_indication(self, pkt_indication):
-        self.log.debug("packet indication",
+        self.log.debug("packet-indication",
                        intf_type=pkt_indication.intf_type,
                        intf_id=pkt_indication.intf_id,
                        port_no=pkt_indication.port_no,