[ONOS-6208]Implemention of onos and loxi for OVS NAT and connection tracking support

Change-Id: I96160840fc65befcc206ff63ca9b564de9ad0c68
diff --git a/java_gen/java_type.py b/java_gen/java_type.py
index eede14e..a50bfa9 100644
--- a/java_gen/java_type.py
+++ b/java_gen/java_type.py
@@ -295,6 +295,11 @@
 u32 = JType('long', 'int') \
         .op(read='U32.f(bb.readInt())', write='bb.writeInt(U32.t($name))', pub_type=True) \
         .op(read='bb.readInt()', write='bb.writeInt($name)', pub_type=False)
+u16_list = JType('List<U16>', 'short[]') \
+        .op(read='ChannelUtils.readList(bb, $length, U16.READER)',
+            write='ChannelUtils.writeList(bb, $name)',
+            default="ImmutableList.<U16>of()",
+            funnel="FunnelUtils.putList($name, sink)")
 u32_list = JType('List<U32>', 'int[]') \
         .op(
                 read='ChannelUtils.readList(bb, $length, U32.READER)',
@@ -375,7 +380,7 @@
         .op(read="IPv6Address.read16Bytes(bb)", \
             write="$name.write16Bytes(bb)",
             default='IPv6Address.NONE')
-ipv6_list =  JType('List<IPv46ddress>') \
+ipv6_list =  JType('List<IPv6Address>') \
         .op(read='ChannelUtils.readList(bb, $length, IPv6Address.READER)',
             write='ChannelUtils.writeList(bb, $name)',
             default='ImmutableList.<IPv6Address>of()',
@@ -573,6 +578,7 @@
         'list(of_packet_queue_t)' : packet_queue_list,
         'list(of_uint64_t)' : u64_list,
         'list(of_uint32_t)' : u32_list,
+        'list(of_uint16_t)' : u16_list,
         'list(of_uint8_t)' : u8_list,
         'list(of_oxm_t)' : oxm_list,
         'list(of_ipv4_t)' : ipv4_list,
@@ -665,6 +671,14 @@
         'of_oxm_pbb_uca' : { 'value' : boolean_value },
         'of_oxm_pbb_uca_masked' : { 'value' : boolean_value, 'value_mask' : boolean_value },
 
+        'of_oxm_conntrack_state' : { 'value' : u32obj },
+        'of_oxm_conntrack_state_masked' : { 'value' : u32obj, 'value_mask' : u32obj },
+        'of_oxm_conntrack_zone' : { 'value' : u16obj },
+        'of_oxm_conntrack_mark' : { 'value' : u32obj },
+        'of_oxm_conntrack_mark_masked' : { 'value' : u32obj, 'value_mask' : u32obj },
+        'of_oxm_conntrack_label' : { 'value' : port_bitmap_128 },
+        'of_oxm_conntrack_label_masked' : { 'value' : port_bitmap_128, 'value_mask' : port_bitmap_128 },
+
         'of_oxm_bsn_in_ports_128' : { 'value': port_bitmap_128 },
         'of_oxm_bsn_in_ports_128_masked' : { 'value': port_bitmap_128, 'value_mask': port_bitmap_128 },
 
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/protocol/match/MatchField.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/protocol/match/MatchField.java
index 9a8b4ef..48f38d7 100644
--- a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/protocol/match/MatchField.java
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/protocol/match/MatchField.java
@@ -87,7 +87,16 @@
     public final static MatchField<IPv4Address> IPV4_DST =
             new MatchField<IPv4Address>("ipv4_dst", MatchFields.IPV4_DST,
                     new Prerequisite<EthType>(MatchField.ETH_TYPE, EthType.IPv4));
+    
+    public final static MatchField<U32> CONNTRACK_STATE =
+            new MatchField<U32>("ct_state", MatchFields.CONNTRACK_STATE);
 
+    public final static MatchField<U16> CONNTRACK_ZONE =
+            new MatchField<U16>("ct_zone", MatchFields.CONNTRACK_ZONE);
+    
+    public final static MatchField<U32> CONNTRACK_MARK =
+            new MatchField<U32>("ct_mark", MatchFields.CONNTRACK_MARK);
+    
     public final static MatchField<TransportPort> TCP_SRC = new MatchField<TransportPort>(
             "tcp_src", MatchFields.TCP_SRC,
             new Prerequisite<IpProtocol>(MatchField.IP_PROTO, IpProtocol.TCP));
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/protocol/match/MatchFields.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/protocol/match/MatchFields.java
index 1f1556c..9274153 100644
--- a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/protocol/match/MatchFields.java
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/protocol/match/MatchFields.java
@@ -40,6 +40,10 @@
     MPLS_TC,
     MPLS_BOS,
     TUNNEL_ID,
+    CONNTRACK_STATE,
+    CONNTRACK_ZONE,
+    CONNTRACK_MARK,
+    CONNTRACK_LABEL,
     IPV6_EXTHDR,
     PBB_UCA,
     TUNNEL_IPV4_SRC,
diff --git a/openflow_input/nicira_ct b/openflow_input/nicira_ct
new file mode 100644
index 0000000..0a4f2f2
--- /dev/null
+++ b/openflow_input/nicira_ct
@@ -0,0 +1,44 @@
+// Copyright 2015, Big Switch Networks, Inc.
+//
+// LoxiGen is licensed under the Eclipse Public License, version 1.0 (EPL), with
+// the following special exception:
+//
+// LOXI Exception
+//
+// As a special exception to the terms of the EPL, you may distribute libraries
+// generated by LoxiGen (LoxiGen Libraries) under the terms of your choice, provided
+// that copyright and licensing notices generated by LoxiGen are not altered or removed
+// from the LoxiGen Libraries and the notice provided below is (i) included in
+// the LoxiGen Libraries, if distributed in source code form and (ii) included in any
+// documentation for the LoxiGen Libraries, if distributed in binary form.
+//
+// Notice: "Copyright 2015, Big Switch Networks, Inc. This library was generated by the LoxiGen Compiler."
+//
+// You may not use this file except in compliance with the EPL or LOXI Exception. You may obtain
+// a copy of the EPL at:
+//
+// http://www.eclipse.org/legal/epl-v10.html
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// EPL for the specific language governing permissions and limitations
+// under the EPL.
+
+#version 3
+#version 4
+#version 5
+
+struct of_action_nicira_ct : of_action_nicira {
+    uint16_t type == 65535;
+    uint16_t len;
+    uint32_t experimenter == 0x2320;
+    uint16_t subtype == 35;
+    uint16_t flags;
+    uint32_t zone_src;
+    uint16_t zone;
+    uint8_t recirc_table;
+    pad(3);
+    uint16_t alg;
+    list(of_action_t) actions;
+};
diff --git a/openflow_input/nicira_ct_clear b/openflow_input/nicira_ct_clear
new file mode 100644
index 0000000..bd26e13
--- /dev/null
+++ b/openflow_input/nicira_ct_clear
@@ -0,0 +1,38 @@
+// Copyright 2015, Big Switch Networks, Inc.
+//
+// LoxiGen is licensed under the Eclipse Public License, version 1.0 (EPL), with
+// the following special exception:
+//
+// LOXI Exception
+//
+// As a special exception to the terms of the EPL, you may distribute libraries
+// generated by LoxiGen (LoxiGen Libraries) under the terms of your choice, provided
+// that copyright and licensing notices generated by LoxiGen are not altered or removed
+// from the LoxiGen Libraries and the notice provided below is (i) included in
+// the LoxiGen Libraries, if distributed in source code form and (ii) included in any
+// documentation for the LoxiGen Libraries, if distributed in binary form.
+//
+// Notice: "Copyright 2013, Big Switch Networks, Inc. This library was generated by the LoxiGen Compiler."
+//
+// You may not use this file except in compliance with the EPL or LOXI Exception. You may obtain
+// a copy of the EPL at:
+//
+// http://www.eclipse.org/legal/epl-v10.html
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// EPL for the specific language governing permissions and limitations
+// under the EPL.
+
+#version 3
+#version 4
+#version 5
+
+struct of_action_nicira_ct_clear : of_action_nicira {
+    uint16_t type == 65535;
+    uint16_t len;
+    uint32_t experimenter == 0x2320;
+    uint16_t subtype == 43;
+    pad(6);
+};
diff --git a/openflow_input/nicira_nat b/openflow_input/nicira_nat
new file mode 100644
index 0000000..940c05d
--- /dev/null
+++ b/openflow_input/nicira_nat
@@ -0,0 +1,44 @@
+// Copyright 2015, Big Switch Networks, Inc.
+//
+// LoxiGen is licensed under the Eclipse Public License, version 1.0 (EPL), with
+// the following special exception:
+//
+// LOXI Exception
+//
+// As a special exception to the terms of the EPL, you may distribute libraries
+// generated by LoxiGen (LoxiGen Libraries) under the terms of your choice, provided
+// that copyright and licensing notices generated by LoxiGen are not altered or removed
+// from the LoxiGen Libraries and the notice provided below is (i) included in
+// the LoxiGen Libraries, if distributed in source code form and (ii) included in any
+// documentation for the LoxiGen Libraries, if distributed in binary form.
+//
+// Notice: "Copyright 2015, Big Switch Networks, Inc. This library was generated by the LoxiGen Compiler."
+//
+// You may not use this file except in compliance with the EPL or LOXI Exception. You may obtain
+// a copy of the EPL at:
+//
+// http://www.eclipse.org/legal/epl-v10.html
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// EPL for the specific language governing permissions and limitations
+// under the EPL.
+
+#version 3
+#version 4
+#version 5
+
+struct of_action_nicira_nat : of_action_nicira {
+    uint16_t type == 65535;
+    uint16_t len;
+    uint32_t experimenter == 0x2320;
+    uint16_t subtype == 36;
+    pad(2);
+    uint16_t flags;
+    uint16_t range_present;
+    list(of_ipv4_t) ipv4_range;
+    list(of_ipv6_t) ipv6_range;
+    list(of_uint16_t) port_range;
+    list(of_uint8_t) pad;
+};
diff --git a/openflow_input/oxm_nicira_ct b/openflow_input/oxm_nicira_ct
new file mode 100644
index 0000000..7462539
--- /dev/null
+++ b/openflow_input/oxm_nicira_ct
@@ -0,0 +1,56 @@
+// Copyright 2013, Big Switch Networks, Inc.
+//
+// LoxiGen is licensed under the Eclipse Public License, version 1.0 (EPL), with
+// the following special exception:
+//
+// LOXI Exception
+//
+// As a special exception to the terms of the EPL, you may distribute libraries
+// generated by LoxiGen (LoxiGen Libraries) under the terms of your choice, provided
+// that copyright and licensing notices generated by LoxiGen are not altered or removd
+// from the LoxiGen Libraries and the notice provided below is (i) included in
+// the LoxiGen Libraries, if distributed in source code form and (ii) included in any
+// documentation for the LoxiGen Libraries, if distributed in binary form.
+//
+// Notice: "Copyright 2013, Big Switch Networks, Inc. This library was generated by t"
+//
+// You may not use this file except in compliance with the EPL or LOXI Exception. Youn
+// a copy of the EPL at:
+//
+// http://www.eclipse.org/legal/epl-v10.html
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// EPL for the specific language governing permissions and limitations
+// under the EPL.
+#version 3
+#version 4
+#version 5
+
+struct of_oxm_conntrack_state : of_oxm {
+    uint32_t type_len == 0x0001d204;
+    uint32_t value;
+};
+
+struct of_oxm_conntrack_state_masked : of_oxm {
+    uint32_t type_len == 0x0001d308;
+    uint32_t value;
+    uint32_t value_mask;
+};
+
+struct of_oxm_conntrack_zone : of_oxm {
+    uint32_t type_len == 0x0001d402;
+    uint16_t value;
+};
+
+struct of_oxm_conntrack_mark : of_oxm {
+    uint32_t type_len == 0x0001d604;
+    uint32_t value;
+};
+
+struct of_oxm_conntrack_mark_masked : of_oxm {
+    uint32_t type_len == 0x0001d708;
+    uint32_t value;
+    uint32_t value_mask;
+};