This patch solves the following bugs:

* For the EAPOL trap flow, ONOS sends flow-mod including the meter id before the related meter-mod. Because of this, Voltha sends wrong flow count for the meter stats reply
* Getting the tech profile id & inner vlan id from the write metadata instruction
* ofp_flow_removed implementation is added

Change-Id: Ib74c7b80db85506f675c2d7ff25bf644c64e5398
diff --git a/ofagent/agent.py b/ofagent/agent.py
index 6117c8f..5c2da16 100644
--- a/ofagent/agent.py
+++ b/ofagent/agent.py
@@ -160,9 +160,11 @@
     def forward_change_event(self, event):
         # assert isinstance(event, ChangeEvent)
         log.info('got-change-event', change_event=event)
-        if event.HasField("port_status"):
-            if self.proto_handler is not None:
+        if self.proto_handler is not None:
+            if event.HasField("port_status"):
                 self.proto_handler.forward_port_status(event.port_status)
+            elif event.HasField("flow_removed"):
+                self.proto_handler.forward_flow_removed(event.flow_removed)
         else:
             log.error('unknown-change-event', change_event=event)
 
diff --git a/ofagent/converter.py b/ofagent/converter.py
index 7156d60..1bebc4f 100644
--- a/ofagent/converter.py
+++ b/ofagent/converter.py
@@ -66,6 +66,14 @@
         desc=ofp_port_to_loxi_port_desc(pb.desc)
     )
 
+def ofp_flow_removed_to_loxi_flow_removed(pb):
+    return of13.message.flow_removed(
+        cookie=pb.cookie,
+        priority=pb.priority,
+        reason=pb.reason,
+        table_id=pb.table_id,
+        match=make_loxi_match(pb2dict(pb.match))
+    )
 
 def ofp_port_stats_to_loxi_port_stats(pb):
     kw = pb2dict(pb)
@@ -265,6 +273,7 @@
 to_loxi_converters = {
     'ofp_port': ofp_port_to_loxi_port_desc,
     'ofp_port_status': ofp_port_status_to_loxi_port_status,
+    'ofp_flow_removed': ofp_flow_removed_to_loxi_flow_removed,
     'ofp_flow_stats': ofp_flow_stats_to_loxi_flow_stats,
     'ofp_packet_in': ofp_packet_in_to_loxi_packet_in,
     'ofp_group_stats': ofp_group_stats_to_loxi_group_stats,
diff --git a/ofagent/of_protocol_handler.py b/ofagent/of_protocol_handler.py
index 813c8a8..7deee6d 100644
--- a/ofagent/of_protocol_handler.py
+++ b/ofagent/of_protocol_handler.py
@@ -347,3 +347,6 @@
 
     def forward_port_status(self, ofp_port_status):
         self.cxn.send(to_loxi(ofp_port_status))
+
+    def forward_flow_removed(self, ofp_flow_removed):
+        self.cxn.send(to_loxi(ofp_flow_removed))