From dbb33a88dfd7cbb9bd760065fc93035851de771c Mon Sep 17 00:00:00 2001
From: Patryk Konopka
Date: Fri, 23 Jun 2017 14:41:24 +0200
Subject: [PATCH] Added Nicira(OpenVSwitch) ct, and ct_clear actions
---
java_gen/java_type.py | 16 ++++-
.../openflow/protocol/match/MatchField.java | 11 +++-
.../openflow/protocol/match/MatchFields.java | 4 ++
openflow_input/nicira_ct | 45 +++++++++++++
openflow_input/nicira_ct_clear | 39 ++++++++++++
openflow_input/oxm_nicira_ct | 63 +++++++++++++++++++
6 files changed, 176 insertions(+), 2 deletions(-)
create mode 100644 openflow_input/nicira_ct
create mode 100644 openflow_input/nicira_ct_clear
create mode 100644 openflow_input/oxm_nicira_ct
diff --git a/java_gen/java_type.py b/java_gen/java_type.py
index 4c2ef7f3c..6009f6325 100644
--- a/java_gen/java_type.py
+++ b/java_gen/java_type.py
@@ -295,6 +295,11 @@ def gen_fixed_length_string_jtype(length):
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', 'short[]') \
+ .op(read='ChannelUtils.readList(bb, $length, U16.READER)',
+ write='ChannelUtils.writeList(bb, $name)',
+ default="ImmutableList.of()",
+ funnel="FunnelUtils.putList($name, sink)")
u32_list = JType('List', 'int[]') \
.op(
read='ChannelUtils.readList(bb, $length, U32.READER)',
@@ -386,7 +391,7 @@ def gen_fixed_length_string_jtype(length):
.op(read="IPv6Address.read16Bytes(bb)", \
write="$name.write16Bytes(bb)",
default='IPv6Address.NONE')
-ipv6_list = JType('List') \
+ipv6_list = JType('List') \
.op(read='ChannelUtils.readList(bb, $length, IPv6Address.READER)',
write='ChannelUtils.writeList(bb, $name)',
default='ImmutableList.of()',
@@ -590,6 +595,7 @@ def gen_fixed_length_string_jtype(length):
'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_oxs_t)' : oxs_list,
@@ -681,6 +687,14 @@ def gen_fixed_length_string_jtype(length):
'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_tcp_flags' : { 'value' : u16obj },
'of_oxm_tcp_flags_masked' : { 'value' : u16obj, 'value_mask' : u16obj },
'of_oxm_ovs_tcp_flags' : { 'value' : u16obj },
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 ad365c6bd..8673656dc 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
@@ -92,7 +92,16 @@ private MatchField(final String name, final MatchFields id, Prerequisite>... p
public final static MatchField IPV4_DST =
new MatchField("ipv4_dst", MatchFields.IPV4_DST,
new Prerequisite(MatchField.ETH_TYPE, EthType.IPv4));
-
+
+ public final static MatchField CONNTRACK_STATE =
+ new MatchField("ct_state", MatchFields.CONNTRACK_STATE);
+
+ public final static MatchField CONNTRACK_ZONE =
+ new MatchField("ct_zone", MatchFields.CONNTRACK_ZONE);
+
+ public final static MatchField CONNTRACK_MARK =
+ new MatchField("ct_mark", MatchFields.CONNTRACK_MARK);
+
public final static MatchField TCP_SRC = new MatchField(
"tcp_src", MatchFields.TCP_SRC,
new Prerequisite(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 33de568d2..4701d373a 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
@@ -42,6 +42,10 @@ public enum MatchFields {
MPLS_TC,
MPLS_BOS,
TUNNEL_ID,
+ CONNTRACK_STATE,
+ CONNTRACK_ZONE,
+ CONNTRACK_MARK,
+ CONNTRACK_LABEL,
IPV6_EXTHDR,
PBB_UCA,
TCP_FLAGS,
diff --git a/openflow_input/nicira_ct b/openflow_input/nicira_ct
new file mode 100644
index 000000000..7e5880fe5
--- /dev/null
+++ b/openflow_input/nicira_ct
@@ -0,0 +1,45 @@
+// 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
+#version 6
+
+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 000000000..af1307cc1
--- /dev/null
+++ b/openflow_input/nicira_ct_clear
@@ -0,0 +1,39 @@
+// 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
+#version 6
+
+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/oxm_nicira_ct b/openflow_input/oxm_nicira_ct
new file mode 100644
index 000000000..61c5fec98
--- /dev/null
+++ b/openflow_input/oxm_nicira_ct
@@ -0,0 +1,63 @@
+// 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
+#version 6
+
+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_zone_masked : of_oxm {
+ uint32_t type_len == 0x0001d504;
+ uint16_t value;
+ uint16_t value_mask;
+};
+
+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;
+};