VOL-490 Add ETH_TYPE and IPV4_DEST fields to match_fields of decomposed flow rule for device

Change-Id: Ia0c4327b33c892146747250149158b0df3fdaaf2
diff --git a/tests/utests/voltha/core/test_flow_decomposer.py b/tests/utests/voltha/core/test_flow_decomposer.py
index 9d1630d..6d6b5d5 100644
--- a/tests/utests/voltha/core/test_flow_decomposer.py
+++ b/tests/utests/voltha/core/test_flow_decomposer.py
@@ -613,7 +613,9 @@
             match_fields=[
                 in_port(2),
                 vlan_vid(ofp.OFPVID_PRESENT | 170),
-                vlan_pcp(0)
+                vlan_pcp(0),
+                eth_type(0x800),
+                ipv4_dst(0xe00a0a0a)
             ],
             actions=[
                 pop_vlan(),
diff --git a/tests/utests/voltha/core/test_logical_device_agent.py b/tests/utests/voltha/core/test_logical_device_agent.py
index 45c78d0..42ced6f 100644
--- a/tests/utests/voltha/core/test_logical_device_agent.py
+++ b/tests/utests/voltha/core/test_logical_device_agent.py
@@ -509,7 +509,8 @@
 
         self.assertFlowsEqual(self.device_flows['olt'].items[1], mk_flow_stat(
             priority=1000,
-            match_fields=[in_port(0), vlan_vid(4096 + 140)],
+            match_fields=[in_port(0), eth_type(0x800), vlan_vid(4096 + 140),
+                ipv4_dst(0xe60a0a0a)],
             actions=[
                 pop_vlan(),
                 output(1)
@@ -557,7 +558,8 @@
 
         self.assertFlowsEqual(self.device_flows['olt'].items[1], mk_flow_stat(
             priority=1000,
-            match_fields=[in_port(0), vlan_vid(4096 + 140)],
+            match_fields=[in_port(0), eth_type(0x800), vlan_vid(4096 + 140),
+                ipv4_dst(0xe60a0a0a)],
             actions=[
                 pop_vlan(),
                 output(1)
@@ -603,7 +605,8 @@
 
         self.assertFlowsEqual(self.device_flows['olt'].items[1], mk_flow_stat(
             priority=1000,
-            match_fields=[in_port(0), vlan_vid(4096 + 140)],
+            match_fields=[in_port(0), eth_type(0x800), vlan_vid(4096 + 140),
+                ipv4_dst(0xe60a0a0a)],
             actions=[
                 pop_vlan(),
                 output(1)
@@ -721,7 +724,7 @@
         self.lda._flow_table_updated(self.flows)
 
         # now check device level flows
-        self.assertEqual(len(self.device_flows['olt'].items), 9)
+        self.assertEqual(len(self.device_flows['olt'].items), 12)
         self.assertEqual(len(self.device_flows['onu1'].items), 5)
         self.assertEqual(len(self.device_flows['onu2'].items), 5)
         self.assertEqual(len(self.device_groups['olt'].items), 0)
@@ -755,26 +758,41 @@
         ))
         self.assertFlowsEqual(self.device_flows['olt'].items[4], mk_flow_stat(
             priority=1000,
-            match_fields=[in_port(0), vlan_vid(4096 + 140)],
+            match_fields=[in_port(0), eth_type(0x800), vlan_vid(4096 + 140), ipv4_dst(0xe4010101)],
             actions=[pop_vlan(), output(1)]
         ))
         self.assertFlowsEqual(self.device_flows['olt'].items[5], mk_flow_stat(
+            priority=1000,
+            match_fields=[in_port(0), eth_type(0x800), vlan_vid(4096 + 140), ipv4_dst(0xe4010102)],
+            actions=[pop_vlan(), output(1)]
+        ))
+        self.assertFlowsEqual(self.device_flows['olt'].items[6], mk_flow_stat(
+            priority=1000,
+            match_fields=[in_port(0), eth_type(0x800), vlan_vid(4096 + 140), ipv4_dst(0xe4010103)],
+            actions=[pop_vlan(), output(1)]
+        ))
+        self.assertFlowsEqual(self.device_flows['olt'].items[7], mk_flow_stat(
+            priority=1000,
+            match_fields=[in_port(0), eth_type(0x800), vlan_vid(4096 + 140), ipv4_dst(0xe4010104)],
+            actions=[pop_vlan(), output(1)]
+        ))
+        self.assertFlowsEqual(self.device_flows['olt'].items[8], mk_flow_stat(
             priority=500,
             match_fields=[in_port(0), vlan_vid(4096 + 1000), metadata(101)],
             actions=[pop_vlan(), output(1)]
         ))
-        self.assertFlowsEqual(self.device_flows['olt'].items[6], mk_flow_stat(
+        self.assertFlowsEqual(self.device_flows['olt'].items[9], mk_flow_stat(
             priority=500,
             match_fields=[in_port(1), vlan_vid(4096 + 101)],
             actions=[
                 push_vlan(0x8100), set_field(vlan_vid(4096 + 1000)), output(0)]
         ))
-        self.assertFlowsEqual(self.device_flows['olt'].items[7], mk_flow_stat(
+        self.assertFlowsEqual(self.device_flows['olt'].items[10], mk_flow_stat(
             priority=500,
             match_fields=[in_port(0), vlan_vid(4096 + 1000), metadata(102)],
             actions=[pop_vlan(), output(1)]
         ))
-        self.assertFlowsEqual(self.device_flows['olt'].items[8], mk_flow_stat(
+        self.assertFlowsEqual(self.device_flows['olt'].items[11], mk_flow_stat(
             priority=500,
             match_fields=[in_port(1), vlan_vid(4096 + 102)],
             actions=[
diff --git a/voltha/core/flow_decomposer.py b/voltha/core/flow_decomposer.py
index 523d6fc..8f4e6bd 100644
--- a/voltha/core/flow_decomposer.py
+++ b/voltha/core/flow_decomposer.py
@@ -650,7 +650,7 @@
                             in_port(ingress_hop.ingress_port.port_no)
                         ] + [
                             field for field in get_ofb_fields(flow)
-                            if field.type not in (IN_PORT, ETH_TYPE, IPV4_DST)
+                            if field.type not in (IN_PORT,)
                         ],
                         actions=[
                             action for action in get_actions(flow)