[VOL-2517] Use VLAN_ANY to check for tagged traffic instead of valid 4095

Change-Id: I2b3498cc22b668d2d12bf571d33ca5aa825075ad
diff --git a/.gitignore b/.gitignore
index a7a6963..f2597c0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,3 +5,4 @@
 .tox
 coverage.xml
 nose2-results.xml
+.idea/
diff --git a/VERSION b/VERSION
index 7c8d436..21bb5e1 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.2.5-dev
+2.2.5
diff --git a/ofagent/converter.py b/ofagent/converter.py
index 6280331..38ceb03 100755
--- a/ofagent/converter.py
+++ b/ofagent/converter.py
@@ -24,6 +24,7 @@
 import loxi.of13 as of13
 from protobuf_to_dict import protobuf_to_dict, TYPE_CALLABLE_MAP
 from voltha_protos import openflow_13_pb2 as pb2
+from utils import RESERVED_TRANSPARENT_VLAN
 
 
 type_callable_map = copy(TYPE_CALLABLE_MAP)
@@ -87,7 +88,6 @@
     assert oxm_field['oxm_class'] == pb2.OFPXMC_OPENFLOW_BASIC
     ofb_field = oxm_field['ofb_field']
     field_type = ofb_field.get('type', 0)
-
     if field_type == pb2.OFPXMT_OFB_ETH_TYPE:
         return (
             of13.oxm.eth_type(value=ofb_field['eth_type']))
@@ -101,8 +101,12 @@
             of13.oxm.ip_proto(value=ofb_field['ip_proto']))
 
     elif field_type == pb2.OFPXMT_OFB_VLAN_VID:
-        return (
-            of13.oxm.vlan_vid(value=ofb_field['vlan_vid']))
+        if ofb_field.get('vlan_vid') == RESERVED_TRANSPARENT_VLAN and ofb_field['vlan_vid_mask'] == RESERVED_TRANSPARENT_VLAN:
+           return (
+               of13.oxm.vlan_vid_masked(value=ofb_field['vlan_vid_mask'], value_mask=ofb_field['vlan_vid_mask']))
+        else:
+           return (
+               of13.oxm.vlan_vid(value=ofb_field['vlan_vid']))
 
     elif field_type == pb2.OFPXMT_OFB_VLAN_PCP:
         return (
@@ -478,6 +482,14 @@
             type=pb2.OFPXMT_OFB_METADATA,
             table_metadata=lo.value))
 
+def loxi_oxm_vlan_vid_masked_to_ofp_oxm(lo):
+    return pb2.ofp_oxm_field(
+        oxm_class=pb2.OFPXMC_OPENFLOW_BASIC,
+        ofb_field=pb2.ofp_oxm_ofb_field(
+            type=pb2.OFPXMT_OFB_VLAN_VID,
+            vlan_vid=lo.value,
+            vlan_vid_mask=lo.value))
+
 
 def loxi_apply_actions_to_ofp_instruction(lo):
     return pb2.ofp_instruction(
@@ -582,6 +594,7 @@
     of13.oxm.udp_src: loxi_oxm_udp_src_to_ofp_oxm,
     of13.oxm.udp_dst: loxi_oxm_udp_dst_to_ofp_oxm,
     of13.oxm.metadata: loxi_oxm_metadata_to_ofp_oxm,
+    of13.oxm.vlan_vid_masked: loxi_oxm_vlan_vid_masked_to_ofp_oxm,
 
     of13.instruction.apply_actions: loxi_apply_actions_to_ofp_instruction,
     of13.instruction.clear_actions: loxi_clear_actions_to_ofp_instruction,
diff --git a/ofagent/of_connection.py b/ofagent/of_connection.py
index a941111..8930472 100755
--- a/ofagent/of_connection.py
+++ b/ofagent/of_connection.py
@@ -98,7 +98,7 @@
         :return: None
         """
         assert self.connected
-
+        
         if msg.xid is None:
             msg.xid = self._gen_xid()
         buf = msg.pack()
diff --git a/ofagent/utils.py b/ofagent/utils.py
index 7e72bef..c73ecb1 100755
--- a/ofagent/utils.py
+++ b/ofagent/utils.py
@@ -17,6 +17,9 @@
 
 from loxi.pp import PrettyPrinter
 
+# ReservedVlan Transparent Vlan (Masked Vlan, VLAN_ANY in ONOS Flows)
+
+RESERVED_TRANSPARENT_VLAN = 4096
 
 def pp(obj):
     pp = PrettyPrinter(maxwidth=80)