VOL-1714 Fixes an issue where flow_stats reply in ofagent fails.

Change-Id: I4291db3065b320b56ab6003b4097533e5d2a7d96
diff --git a/python/ofagent/converter.py b/python/ofagent/converter.py
index d3c7bea..185fb59 100755
--- a/python/ofagent/converter.py
+++ b/python/ofagent/converter.py
@@ -166,12 +166,26 @@
         elif type == pb2.OFPIT_GOTO_TABLE:
             return of13.instruction.goto_table(
                 table_id=inst['goto_table']['table_id'])
-
+        elif type == pb2.OFPIT_WRITE_ACTIONS:
+            return of13.instruction.write_actions(
+                actions=[make_loxi_action(a)
+                         for a in inst['actions']['actions']])
+        elif type == pb2.OFPIT_WRITE_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'])
         else:
             raise NotImplementedError('Instruction type %d' % type)
 
     kw['match'] = make_loxi_match(kw['match'])
-    kw['instructions'] = [make_loxi_instruction(i) for i in kw['instructions']]
+    # if the flow action is drop, then the instruction is not found in the dict
+    if 'instructions' in kw:
+        kw['instructions'] = [make_loxi_instruction(i) for i in kw['instructions']]
     del kw['id']
     return of13.flow_stats_entry(**kw)
 
diff --git a/python/ofagent/grpc_client.py b/python/ofagent/grpc_client.py
index 508ce5c..7f6d274 100755
--- a/python/ofagent/grpc_client.py
+++ b/python/ofagent/grpc_client.py
@@ -172,11 +172,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)