Merge into master from pull request #165:
bsn_gentable extension (https://github.com/floodlight/loxigen/pull/165)
diff --git a/c_gen/c_code_gen.py b/c_gen/c_code_gen.py
index 3621507..78a809e 100644
--- a/c_gen/c_code_gen.py
+++ b/c_gen/c_code_gen.py
@@ -449,6 +449,7 @@
of_object_id_t of_oxm_to_object_id(uint32_t type_len, of_version_t version);
of_object_id_t of_message_experimenter_to_object_id(of_message_t msg, of_version_t version);
of_object_id_t of_message_to_object_id(of_message_t msg, int length);
+of_object_id_t of_bsn_tlv_to_object_id(int tlv_type, of_version_t version);
int of_object_wire_init(of_object_t *obj, of_object_id_t base_object_id, int max_len);
@@ -697,6 +698,11 @@
uint64_t lo;
} of_bitmap_128_t;
+typedef struct of_checksum_128_s {
+ uint64_t hi;
+ uint64_t lo;
+} of_checksum_128_t;
+
/* These are types which change across versions. */
typedef uint32_t of_port_no_t;
typedef uint16_t of_fm_cmd_t;
@@ -1544,7 +1550,7 @@
m_type = "octets_data"
return "of_wire_buffer_%s_%s" % (m_type, a_type)
-def get_len_macro(cls, m_type, version):
+def get_len_macro(cls, m_name, m_type, version):
"""
Get the length macro for m_type in cls
"""
@@ -1556,6 +1562,12 @@
return "_TLV16_LEN(obj, offset)"
if cls == "of_packet_out" and m_type == "of_list_action_t":
return "_PACKET_OUT_ACTION_LEN(obj)"
+ if cls == "of_bsn_gentable_entry_add" and m_name == "key":
+ return "of_object_u16_get(obj, 18)"
+ if cls == "of_bsn_gentable_entry_desc_stats_entry" and m_name == "key":
+ return "of_object_u16_get(obj, 2)"
+ if cls == "of_bsn_gentable_entry_stats_entry" and m_name == "key":
+ return "of_object_u16_get(obj, 2)"
# Default is everything to the end of the object
return "_END_LEN(obj, offset)"
@@ -1582,6 +1594,12 @@
pass
elif (cls == "of_packet_out" and m_name == "data"):
pass
+ elif (cls == "of_bsn_gentable_entry_add" and m_name == "value"):
+ pass
+ elif (cls == "of_bsn_gentable_entry_desc_stats_entry" and m_name == "value"):
+ pass
+ elif (cls == "of_bsn_gentable_entry_stats_entry" and m_name == "stats"):
+ pass
else:
debug("Error: Unknown member with offset == -1")
debug(" cls %s, m_name %s, version %d" % (cls, m_name, version))
@@ -1596,7 +1614,7 @@
if not loxi_utils.type_is_scalar(m_type):
if loxi_utils.class_is_var_len(m_type[:-2], version) or \
m_type == "of_match_t":
- len_macro = get_len_macro(cls, m_type, version)
+ len_macro = get_len_macro(cls, m_name, m_type, version)
else:
len_macro = "%d" % of_g.base_length[(m_type[:-2], version)]
out.write(" cur_len = %s;\n" % len_macro)
@@ -1712,6 +1730,16 @@
/* Special case for setting action lengths */
_PACKET_OUT_ACTION_LEN_SET(obj, %(m_name)s->length);
""" % dict(m_name=m_name))
+ elif cls == "of_bsn_gentable_entry_add" and m_name == "key":
+ out.write("""
+ /* Special case for setting key length */
+ of_object_u16_set(obj, 18, %(m_name)s->length);
+""" % dict(m_name=m_name))
+ elif cls in ["of_bsn_gentable_entry_desc_stats_entry", "of_bsn_gentable_entry_stats_entry"] and m_name == "key":
+ out.write("""
+ /* Special case for setting key length */
+ of_object_u16_set(obj, 2, %(m_name)s->length);
+""" % dict(m_name=m_name))
elif m_type not in ["of_match_t", "of_octets_t"]:
out.write("""
/* @fixme Shouldn't this precede copying value's data to buffer? */
@@ -2352,6 +2380,10 @@
out.write("""
obj->wire_type_get = of_hello_elem_wire_object_id_get;
""")
+ if loxi_utils.class_is_bsn_tlv(cls):
+ out.write("""
+ obj->wire_type_get = of_bsn_tlv_wire_object_id_get;
+""")
if loxi_utils.class_is_oxm(cls):
out.write("""
obj->wire_length_get = of_oxm_wire_length_get;
diff --git a/c_gen/c_test_gen.py b/c_gen/c_test_gen.py
index ac2845f..637819c 100644
--- a/c_gen/c_test_gen.py
+++ b/c_gen/c_test_gen.py
@@ -99,6 +99,7 @@
# BSN extensions
of_bsn_vport_q_in_q_t="vport",
of_bitmap_128_t="bitmap_128",
+ of_checksum_128_t="checksum_128",
)
if m_type.find("of_list_") == 0:
@@ -112,7 +113,7 @@
"of_match_bmap_t", "of_ipv4_t"]
string_types = [ "of_port_name_t", "of_table_name_t",
"of_desc_str_t", "of_serial_num_t", "of_mac_addr_t",
- "of_ipv6_t", "of_bitmap_128_t"]
+ "of_ipv6_t", "of_bitmap_128_t", "of_checksum_128_t"]
scalar_types = integer_types[:]
scalar_types.extend(string_types)
@@ -136,7 +137,17 @@
"of_bsn_port_counter_stats_request",
"of_bsn_port_counter_stats_reply",
"of_bsn_vlan_counter_stats_request",
- "of_bsn_vlan_counter_stats_reply"]
+ "of_bsn_vlan_counter_stats_reply",
+ "of_bsn_gentable_entry_desc_stats_request",
+ "of_bsn_gentable_entry_desc_stats_reply",
+ "of_bsn_gentable_entry_stats_request",
+ "of_bsn_gentable_entry_stats_reply",
+ "of_bsn_gentable_desc_stats_request",
+ "of_bsn_gentable_desc_stats_reply",
+ "of_bsn_gentable_stats_request",
+ "of_bsn_gentable_stats_reply",
+ "of_bsn_gentable_bucket_stats_request",
+ "of_bsn_gentable_bucket_stats_reply"]
if (cls in classes and (
m_name == "experimenter" or
diff --git a/c_gen/c_type_maps.py b/c_gen/c_type_maps.py
index 06161ec..d4525ba 100644
--- a/c_gen/c_type_maps.py
+++ b/c_gen/c_type_maps.py
@@ -151,6 +151,10 @@
gen_type_to_object_id(out, "message_type_to_id", "OF_MESSAGE",
"OF_%s", type_maps.message_types, max_type_value)
+ gen_type_to_object_id(out, "bsn_tlv_type_to_id", "OF_BSN_TLV",
+ "OF_BSN_TLV_%s", type_maps.bsn_tlv_types,
+ max_type_value)
+
def gen_type_to_obj_map_functions(out):
"""
Generate the templated type map functions
@@ -588,6 +592,12 @@
out.write(msg_template %
dict(name="message", u_name="MESSAGE", ar_len=ar_len))
+ # BSN TLV elem types array gen
+ ar_len = type_maps.type_array_len(type_maps.bsn_tlv_types,
+ max_type_value)
+ out.write(map_template %
+ dict(name="bsn_tlv", u_name="BSN_TLV", ar_len=ar_len))
+
def gen_type_data_header(out):
out.write("""
@@ -678,6 +688,8 @@
of_object_id_t *id);
extern void of_hello_elem_wire_object_id_get(of_object_t *obj,
of_object_id_t *id);
+extern void of_bsn_tlv_wire_object_id_get(of_object_t *obj,
+ of_object_id_t *id);
#define OF_OXM_LENGTH_GET(hdr) (((hdr) & 0xff) + 4)
#define OF_OXM_LENGTH_SET(hdr, val) \\
diff --git a/c_gen/c_validator_gen.py b/c_gen/c_validator_gen.py
index 126530a..9bb0407 100644
--- a/c_gen/c_validator_gen.py
+++ b/c_gen/c_validator_gen.py
@@ -222,6 +222,12 @@
%(m_name)s_offset = %(match_offset)s + OF_MATCH_BYTES(match_len);
%(m_name)s_len = len - %(m_name)s_offset;
""" % dict(m_name=m_name, cls=cls, match_offset=match_offset))
+ elif cls == "of_bsn_gentable_entry_add" and m_name == "value":
+ continue;
+ elif cls == "of_bsn_gentable_entry_desc_stats_entry" and m_name == "value":
+ continue;
+ elif cls == "of_bsn_gentable_entry_stats_entry" and m_name == "stats":
+ continue;
else:
out.write("""
diff --git a/c_gen/loxi_utils_legacy.py b/c_gen/loxi_utils_legacy.py
index 6a0fb2e..4092d4f 100644
--- a/c_gen/loxi_utils_legacy.py
+++ b/c_gen/loxi_utils_legacy.py
@@ -118,6 +118,8 @@
return True
if cls == "of_match_v4":
return True
+ if cls.find("of_bsn_tlv") == 0:
+ return True
return False
def class_is_u16_len(cls):
@@ -126,7 +128,9 @@
"""
return cls in ["of_group_desc_stats_entry", "of_group_stats_entry",
"of_flow_stats_entry", "of_bucket", "of_table_features",
- "of_bsn_port_counter_stats_entry", "of_bsn_vlan_counter_stats_entry"]
+ "of_bsn_port_counter_stats_entry", "of_bsn_vlan_counter_stats_entry",
+ "of_bsn_gentable_entry_desc_stats_entry", "of_bsn_gentable_entry_stats_entry",
+ "of_bsn_gentable_desc_stats_entry"]
def class_is_oxm(cls):
"""
@@ -246,6 +250,14 @@
"""
return (cls.find("of_list_") == 0)
+def class_is_bsn_tlv(cls):
+ """
+ Return True if cls_name is a BSN TLV object
+ """
+ if cls.find("of_bsn_tlv") == 0:
+ return True
+ return False
+
def type_is_of_object(m_type):
"""
Return True if m_type is an OF object type
diff --git a/c_gen/of_g_legacy.py b/c_gen/of_g_legacy.py
index 6f0947c..1fadba0 100644
--- a/c_gen/of_g_legacy.py
+++ b/c_gen/of_g_legacy.py
@@ -77,7 +77,7 @@
## These members do not get normal accessors
skip_members = ["version", "type", "length", "err_type", "stats_type", "len",
- "type_len", "actions_len", "_command", "command"]
+ "type_len", "actions_len", "_command", "command", "key_length"]
## Some OpenFlow string length constants
#
@@ -206,13 +206,14 @@
# short_name="match_v4"),
of_octets_t = dict(bytes=-1, short_name="octets"),
of_bitmap_128_t = dict(bytes=16, short_name="bitmap_128"),
+ of_checksum_128_t = dict(bytes=16, short_name="checksum_128"),
)
of_scalar_types = ["char", "uint8_t", "uint16_t", "uint32_t", "uint64_t",
"of_port_no_t", "of_fm_cmd_t", "of_wc_bmap_t",
"of_match_bmap_t", "of_port_name_t", "of_table_name_t",
"of_desc_str_t", "of_serial_num_t", "of_mac_addr_t",
- "of_ipv6_t", "of_ipv4_t", "of_bitmap_128_t"]
+ "of_ipv6_t", "of_ipv4_t", "of_bitmap_128_t", "of_checksum_128_t"]
##
# LOXI identifiers
diff --git a/c_gen/templates/loci_dump.h b/c_gen/templates/loci_dump.h
index d44832a..9cc719c 100644
--- a/c_gen/templates/loci_dump.h
+++ b/c_gen/templates/loci_dump.h
@@ -96,6 +96,8 @@
#define LOCI_DUMP_bitmap_128(writer, cookie, val) writer(cookie, "%" PRIx64 "%" PRIx64, (val).hi, (val).lo)
+#define LOCI_DUMP_checksum_128(writer, cookie, val) writer(cookie, "%016" PRIx64 "%016" PRIx64, (val).hi, (val).lo)
+
/**
* Generic version for any object
*/
diff --git a/c_gen/templates/loci_int.h b/c_gen/templates/loci_int.h
index 241cf7b..01ad4a8 100644
--- a/c_gen/templates/loci_int.h
+++ b/c_gen/templates/loci_int.h
@@ -277,4 +277,21 @@
((object_id) == OF_FLOW_DELETE_STRICT) || \
((object_id) == OF_FLOW_ADD))
+/**
+ * Macro to calculate variable offset of value member in of_bsn_gentable_entry_add
+ * @param obj An object of type of_bsn_gentable_entry_add_t
+ */
+
+#define _BSN_GENTABLE_ENTRY_ADD_VALUE_OFFSET(obj) \
+ (of_object_u16_get(obj, 18) + \
+ of_object_fixed_len[(obj)->version][OF_BSN_GENTABLE_ENTRY_ADD])
+
+#define _BSN_GENTABLE_ENTRY_DESC_STATS_ENTRY_VALUE_OFFSET(obj) \
+ (of_object_u16_get(obj, 2) + \
+ of_object_fixed_len[(obj)->version][OF_BSN_GENTABLE_ENTRY_DESC_STATS_ENTRY])
+
+#define _BSN_GENTABLE_ENTRY_STATS_ENTRY_STATS_OFFSET(obj) \
+ (of_object_u16_get(obj, 2) + \
+ of_object_fixed_len[(obj)->version][OF_BSN_GENTABLE_ENTRY_STATS_ENTRY])
+
#endif /* __LOCI_INT_H__ */
diff --git a/c_gen/templates/loci_show.h b/c_gen/templates/loci_show.h
index a66c321..1856ae5 100644
--- a/c_gen/templates/loci_show.h
+++ b/c_gen/templates/loci_show.h
@@ -164,6 +164,8 @@
#define LOCI_SHOW_bitmap_128(writer, cookie, val) writer(cookie, "%" PRIx64 "%" PRIx64, (val).hi, (val).lo)
+#define LOCI_SHOW_checksum_128(writer, cookie, val) writer(cookie, "%016" PRIx64 "%016" PRIx64, (val).hi, (val).lo)
+
/**
* Generic version for any object
*/
@@ -373,5 +375,12 @@
#define LOCI_SHOW_u64_time_ms(writer, cookie, val) LOCI_SHOW_u64(writer, cookie, val)
#define LOCI_SHOW_desc_str_uri(writer, cookie, val) LOCI_SHOW_desc_str(writer, cookie, val)
#define LOCI_SHOW_u8_state(writer, cookie, val) LOCI_SHOW_u8(writer, cookie, val)
+#define LOCI_SHOW_u16_table_id(writer, cookie, val) LOCI_SHOW_u16(writer, cookie, val)
+#define LOCI_SHOW_u32_deleted_count(writer, cookie, val) LOCI_SHOW_u32(writer, cookie, val)
+#define LOCI_SHOW_u32_error_count(writer, cookie, val) LOCI_SHOW_u32(writer, cookie, val)
+#define LOCI_SHOW_checksum_128_checksum(writer, cookie, val) LOCI_SHOW_checksum_128(writer, cookie, val)
+#define LOCI_SHOW_checksum_128_checksum_mask(writer, cookie, val) LOCI_SHOW_checksum_128(writer, cookie, val)
+#define LOCI_SHOW_u32_buckets_size(writer, cookie, val) LOCI_SHOW_u32(writer, cookie, val)
+#define LOCI_SHOW_u32_entry_count(writer, cookie, val) LOCI_SHOW_u32(writer, cookie, val)
#endif /* _LOCI_SHOW_H_ */
diff --git a/c_gen/templates/of_type_maps.c b/c_gen/templates/of_type_maps.c
index 7310988..15b3816 100644
--- a/c_gen/templates/of_type_maps.c
+++ b/c_gen/templates/of_type_maps.c
@@ -446,6 +446,23 @@
ASSERT(*id != OF_OBJECT_INVALID);
}
+/**
+ * Get the object ID based on the wire buffer for a bsn_tlv object
+ * @param obj The object being referenced
+ * @param id Where to store the object ID
+ */
+
+void
+of_bsn_tlv_wire_object_id_get(of_object_t *obj, of_object_id_t *id)
+{
+ int wire_type;
+
+ of_tlv16_wire_type_get(obj, &wire_type);
+ ASSERT(wire_type >= 0 && wire_type < OF_BSN_TLV_ITEM_COUNT);
+ *id = of_bsn_tlv_type_to_id[obj->version][wire_type];
+ ASSERT(*id != OF_OBJECT_INVALID);
+}
+
/****************************************************************
* OXM type/length functions.
****************************************************************/
@@ -715,7 +732,12 @@
case OF_EXPERIMENTER_ID_BSN:
switch (subtype) {
case 1: return OF_BSN_LACP_STATS_REQUEST;
+ case 2: return OF_BSN_GENTABLE_ENTRY_DESC_STATS_REQUEST;
+ case 3: return OF_BSN_GENTABLE_ENTRY_STATS_REQUEST;
+ case 4: return OF_BSN_GENTABLE_DESC_STATS_REQUEST;
+ case 5: return OF_BSN_GENTABLE_BUCKET_STATS_REQUEST;
case 6: return OF_BSN_SWITCH_PIPELINE_STATS_REQUEST;
+ case 7: return OF_BSN_GENTABLE_STATS_REQUEST;
case 8: return OF_BSN_PORT_COUNTER_STATS_REQUEST;
case 9: return OF_BSN_VLAN_COUNTER_STATS_REQUEST;
}
@@ -730,7 +752,12 @@
case OF_EXPERIMENTER_ID_BSN:
switch (subtype) {
case 1: return OF_BSN_LACP_STATS_REPLY;
+ case 2: return OF_BSN_GENTABLE_ENTRY_DESC_STATS_REPLY;
+ case 3: return OF_BSN_GENTABLE_ENTRY_STATS_REPLY;
+ case 4: return OF_BSN_GENTABLE_DESC_STATS_REPLY;
+ case 5: return OF_BSN_GENTABLE_BUCKET_STATS_REPLY;
case 6: return OF_BSN_SWITCH_PIPELINE_STATS_REPLY;
+ case 7: return OF_BSN_GENTABLE_STATS_REPLY;
case 8: return OF_BSN_PORT_COUNTER_STATS_REPLY;
case 9: return OF_BSN_VLAN_COUNTER_STATS_REPLY;
}
diff --git a/c_gen/templates/of_wire_buf.h b/c_gen/templates/of_wire_buf.h
index 117332c..f977004 100644
--- a/c_gen/templates/of_wire_buf.h
+++ b/c_gen/templates/of_wire_buf.h
@@ -900,6 +900,26 @@
#define of_wire_buffer_bitmap_128_set(buf, offset, addr) \
(of_wire_buffer_u64_set(buf, offset, addr.hi), of_wire_buffer_u64_set(buf, offset+8, addr.lo))
+/**
+ * Get a checksum_128 from a wire buffer
+ * @param wbuf The pointer to the wire buffer structure
+ * @param offset Offset in the wire buffer
+ * @param checksum Pointer to where to store the checksum_128
+ */
+
+#define of_wire_buffer_checksum_128_get(buf, offset, checksum) \
+ (of_wire_buffer_u64_get(buf, offset, &checksum->hi), of_wire_buffer_u64_get(buf, offset+8, &checksum->lo))
+
+/**
+ * Set a checksum_128 in a wire buffer
+ * @param wbuf The pointer to the wire buffer structure
+ * @param offset Offset in the wire buffer
+ * @param checksum The variable holding checksum_128 to store
+ */
+
+#define of_wire_buffer_checksum_128_set(buf, offset, checksum) \
+ (of_wire_buffer_u64_set(buf, offset, checksum.hi), of_wire_buffer_u64_set(buf, offset+8, checksum.lo))
+
/* Relocate data from start offset to the end of the buffer to a new position */
static inline void
of_wire_buffer_move_end(of_wire_buffer_t *wbuf, int start_offset, int new_offset)
diff --git a/c_gen/type_maps.py b/c_gen/type_maps.py
index f285a33..2a53519 100644
--- a/c_gen/type_maps.py
+++ b/c_gen/type_maps.py
@@ -136,6 +136,13 @@
of_g.VERSION_1_3:dict(),
}
+bsn_tlv_types = {
+ of_g.VERSION_1_0:dict(),
+ of_g.VERSION_1_1:dict(),
+ of_g.VERSION_1_2:dict(),
+ of_g.VERSION_1_3:dict(),
+ }
+
# All inheritance data for non-messages
inheritance_data = dict(
of_instruction = instruction_types,
@@ -148,7 +155,8 @@
of_table_feature_prop = table_feature_prop_types,
of_meter_band = meter_band_types,
# BSN specific inheritance extensions
- of_bsn_vport = bsn_vport_types
+ of_bsn_vport = bsn_vport_types,
+ of_bsn_tlv = bsn_tlv_types,
)
def class_is_virtual(cls):
diff --git a/java_gen/java_model.py b/java_gen/java_model.py
index f1c8c12..c4e4ea5 100644
--- a/java_gen/java_model.py
+++ b/java_gen/java_model.py
@@ -68,7 +68,15 @@
OFExperimenterStatsReply=set(('data','subtype')),
OFInstructionExperimenter=set(('data',)))
# map: $java_type -> set(java_name_property)
- write_blacklist = defaultdict(lambda: set(), OFOxm=set(('typeLen',)), OFAction=set(('type',)), OFInstruction=set(('type',)), OFFlowMod=set(('command', )), OFExperimenter=set(('data','subtype')), OFActionExperimenter=set(('data',)))
+ write_blacklist = defaultdict(
+ lambda: set(),
+ OFOxm=set(('typeLen',)),
+ OFAction=set(('type',)),
+ OFInstruction=set(('type',)),
+ OFFlowMod=set(('command', )),
+ OFExperimenter=set(('data','subtype')),
+ OFActionExperimenter=set(('data',)),
+ OFBsnTlv=set(('type',)))
# interfaces that are virtual
virtual_interfaces = set(['OFOxm', 'OFInstruction', 'OFFlowMod', 'OFBsnVport' ])
@@ -512,6 +520,8 @@
return ("", "OFHelloElem", None)
elif loxi_utils.class_is_table_feature_prop(self.c_name):
return ("", "OFTableFeatureProp", None)
+ elif loxi_utils.class_is_bsn_tlv(self.c_name):
+ return ("", "OFBsnTlv", None)
else:
return ("", None, None)
diff --git a/java_gen/java_type.py b/java_gen/java_type.py
index 1bed988..ac1e672 100644
--- a/java_gen/java_type.py
+++ b/java_gen/java_type.py
@@ -480,6 +480,10 @@
.op(version=ANY, read="ClassId.read4Bytes(bb)", write="$name.write4Bytes(bb)", default="ClassId.NONE")
boolean_value = JType('OFBooleanValue', 'OFBooleanValue') \
.op(read='OFBooleanValue.of(bb.readByte() != 0)', write='bb.writeByte($name.getInt())', default="OFBooleanValue.FALSE")
+checksum = JType("OFChecksum128") \
+ .op(read='OFChecksum128.read16Bytes(bb)',
+ write='$name.write16Bytes(bb)',
+ default='OFChecksum128.ZERO')
generic_t = JType("T")
@@ -513,7 +517,8 @@
'of_wc_bmap_t': flow_wildcards,
'of_oxm_t': oxm,
'of_meter_features_t': meter_features,
- 'of_bitmap_128_t': port_bitmap
+ 'of_bitmap_128_t': port_bitmap,
+ 'of_checksum_128_t': checksum,
}
## Map that defines exceptions from the standard loxi->java mapping scheme
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/OFChecksum128.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/OFChecksum128.java
new file mode 100644
index 0000000..7578dc6
--- /dev/null
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/OFChecksum128.java
@@ -0,0 +1,80 @@
+package org.projectfloodlight.openflow.types;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+
+import com.google.common.hash.PrimitiveSink;
+
+public class OFChecksum128 implements OFValueType<OFChecksum128> {
+
+ static final int LENGTH = 16;
+
+ private final long raw1; // MSBs
+ private final long raw2; // LSBs
+
+ public static final OFChecksum128 ZERO = new OFChecksum128(0, 0);
+
+ private OFChecksum128(long raw1, long raw2) {
+ this.raw1 = raw1;
+ this.raw2 = raw2;
+ }
+
+ public static OFChecksum128 of(long raw1, long raw2) {
+ if (raw1 == 0 && raw2 == 0)
+ return ZERO;
+ return new OFChecksum128(raw1, raw2);
+ }
+
+ @Override
+ public int getLength() {
+ return LENGTH;
+ }
+
+ @Override
+ public OFChecksum128 applyMask(OFChecksum128 mask) {
+ return of(this.raw1 & mask.raw1, this.raw2 & mask.raw2);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (!(obj instanceof OFChecksum128))
+ return false;
+ OFChecksum128 other = (OFChecksum128)obj;
+ return (other.raw1 == this.raw1 && other.raw2 == this.raw2);
+ }
+
+ @Override
+ public int hashCode() {
+ return (int)(31 * raw1 + raw2);
+ }
+
+ public void write16Bytes(ChannelBuffer cb) {
+ cb.writeLong(raw1);
+ cb.writeLong(raw2);
+ }
+
+ public static OFChecksum128 read16Bytes(ChannelBuffer cb) {
+ long raw1 = cb.readLong();
+ long raw2 = cb.readLong();
+ return of(raw1, raw2);
+ }
+
+ @Override
+ public String toString() {
+ return String.format("0x%016x%016x", raw1, raw2);
+ }
+
+ @Override
+ public int compareTo(OFChecksum128 o) {
+ long c = this.raw1 - o.raw1;
+ if (c != 0)
+ return Long.signum(c);
+ return Long.signum(this.raw2 - o.raw2);
+ }
+
+ @Override
+ public void putTo(PrimitiveSink sink) {
+ sink.putLong(raw1);
+ sink.putLong(raw2);
+ }
+
+}
diff --git a/lang_python.py b/lang_python.py
index 9087b43..019b62d 100644
--- a/lang_python.py
+++ b/lang_python.py
@@ -85,7 +85,7 @@
1: ["action", "common", "const", "message", "util"],
2: ["action", "common", "const", "instruction", "message", "util"],
3: ["action", "common", "const", "instruction", "message", "oxm", "util"],
- 4: ["action", "action_id", "common", "const", "instruction", "instruction_id", "message", "meter_band", "oxm", "util"],
+ 4: ["action", "action_id", "common", "const", "instruction", "instruction_id", "message", "meter_band", "oxm", "bsn_tlv", "util"],
}
def make_gen(name, version):
diff --git a/loxi_front_end/frontend.py b/loxi_front_end/frontend.py
index 545b5bc..bc79ed9 100644
--- a/loxi_front_end/frontend.py
+++ b/loxi_front_end/frontend.py
@@ -52,10 +52,11 @@
if m_ast[2] == 'length' or m_ast[2] == 'len': # Should be moved to parser
return ir.OFLengthMember(name=m_ast[2], oftype=get_type(m_ast[1], ctx))
elif m_ast[2] == 'actions_len':
- # HACK only usage so far
return ir.OFFieldLengthMember(name=m_ast[2], oftype=get_type(m_ast[1], ctx), field_name='actions')
if m_ast[2] == 'version': # Should be moved to parser
return ir.OFVersionMember(name=m_ast[2], oftype=get_type(m_ast[1], ctx))
+ elif m_ast[2] == 'key_length':
+ return ir.OFFieldLengthMember(name=m_ast[2], oftype=get_type(m_ast[1], ctx), field_name='key')
else:
return ir.OFDataMember(name=m_ast[2], oftype=get_type(m_ast[1], ctx))
elif m_ast[0] == 'discriminator':
diff --git a/loxi_ir/ir_offset.py b/loxi_ir/ir_offset.py
index 0f27f5e..e705fcc 100644
--- a/loxi_ir/ir_offset.py
+++ b/loxi_ir/ir_offset.py
@@ -100,6 +100,7 @@
of_match_v3_t = (8, False),
of_octets_t = (0, False),
of_bitmap_128_t = (16, True),
+ of_checksum_128_t = (16, True),
)
def type_dec_to_count_base(m_type):
diff --git a/loxi_utils/loxi_utils.py b/loxi_utils/loxi_utils.py
index d5937ac..5d725a5 100644
--- a/loxi_utils/loxi_utils.py
+++ b/loxi_utils/loxi_utils.py
@@ -145,6 +145,12 @@
u = _unified_by_name(cls)
return u.is_instanceof("of_stats_request") or u.ir_instanceof("of_stats_reply")
+def class_is_bsn_tlv(cls):
+ """
+ Return True if cls_name is a bsn_tlv object
+ """
+ return _unified_by_name(cls).is_instanceof("of_bsn_tlv")
+
def class_is_list(cls):
"""
Return True if cls_name is a list object
diff --git a/openflow_input/bsn_gentable b/openflow_input/bsn_gentable
new file mode 100644
index 0000000..674d298
--- /dev/null
+++ b/openflow_input/bsn_gentable
@@ -0,0 +1,353 @@
+// 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 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 4
+
+// We have a number of switch agents that need to be configured by the
+// controller and report stats. Some of them will have large tables (1000+
+// entries) and so need an efficient synchronization mechanism (as can be
+// accomplished using the cookie field in flowtable entries). It's a
+// significant amount of work to do this from scratch for each new table.
+// This extension (and the corresponding Indigo code) provides a framework
+// to ease implementing new tables.
+
+// We don't plan on replacing our use of the OpenFlow flow table and group
+// table with this scheme. This is intended for controlling switch
+// functionality like the ARP and LACP agents which don't map at all to
+// flow-mods.
+
+// Each switch will have a number of tables indexed by a 16-bit table ID. Each
+// table has a name, id, a set of entries, and an array of checksum buckets.
+// There is no order to the entries; stats requests will return them in an
+// arbitrary order. The controller is expected to use the table name to
+// determine the semantics of a table.
+
+// Each entry has a key, value, stats, and checksum. The key and value are TLV
+// lists given by the controller in a gentable_entry_add message. The switch must
+// return these lists in stats replies exactly as it received them. The stats
+// are a list of TLVs controlled by the switch. The stats are expected to
+// include more than simple counters (for example, last hit time or seen TCP
+// flags). The checksum is an opaque value used for table synchronization.
+
+// LOXI includes a built-in type of_checksum_128_t, which is 128 bits but
+// only requires 32-bit alignment.
+
+
+// These TLV classes are used for keys, values, and stats. Like OXM, lists of
+// TLVs are tightly packed without padding. TLV lists may include duplicates
+// and the semantics of this is left to the particular table.
+//
+// If this is eventually standardized it would be good to add a "class" type
+// member as in OXM.
+struct of_bsn_tlv {
+ uint16_t type == ?;
+ uint16_t length;
+};
+
+
+// This message sets key=value in the given table. If key already exists in the
+// table then it modifies the value, preserving stats.
+//
+// If the switch cannot process the message then it should reply with an error
+// message. The contents of the table must not be changed in case of an error.
+struct of_bsn_gentable_entry_add : of_bsn_header {
+ uint8_t version;
+ uint8_t type == 4;
+ uint16_t length;
+ uint32_t xid;
+ uint32_t experimenter == 0x5c16c7;
+ uint32_t subtype == 46;
+ uint16_t table_id;
+ uint16_t key_length;
+ of_checksum_128_t checksum;
+ list(of_bsn_tlv_t) key;
+ list(of_bsn_tlv_t) value;
+};
+
+
+// This message deletes the entry with the given key in the given table.
+//
+// If the switch cannot process the message then it should reply with an error
+// message. The contents of the table must not be changed in case of an error.
+// If the key does not exist in the table an error message will be generated.
+struct of_bsn_gentable_entry_delete : of_bsn_header {
+ uint8_t version;
+ uint8_t type == 4;
+ uint16_t length;
+ uint32_t xid;
+ uint32_t experimenter == 0x5c16c7;
+ uint32_t subtype == 47;
+ uint16_t table_id;
+ list(of_bsn_tlv_t) key;
+};
+
+
+// This message deletes a range of table entries. The checksum_mask must be a
+// prefix mask. The checksum must be zero in the bits where the checksum_mask
+// is zero.
+//
+// The switch may fail to delete some table entries. No error messages will be
+// sent, but the error_count in the reply message will be incremented.
+struct of_bsn_gentable_clear_request : of_bsn_header {
+ uint8_t version;
+ uint8_t type == 4;
+ uint16_t length;
+ uint32_t xid;
+ uint32_t experimenter == 0x5c16c7;
+ uint32_t subtype == 48;
+ uint16_t table_id;
+ pad(2);
+ of_checksum_128_t checksum;
+ of_checksum_128_t checksum_mask;
+};
+
+struct of_bsn_gentable_clear_reply : of_bsn_header {
+ uint8_t version;
+ uint8_t type == 4;
+ uint16_t length;
+ uint32_t xid;
+ uint32_t experimenter == 0x5c16c7;
+ uint32_t subtype == 49;
+ uint16_t table_id;
+ pad(2);
+ uint32_t deleted_count;
+ uint32_t error_count;
+};
+
+
+// This message sets the size of the buckets array. The switch may reject this
+// message if the table has entries. buckets_size must be a power of 2.
+struct of_bsn_gentable_set_buckets_size : of_bsn_header {
+ uint8_t version;
+ uint8_t type == 4;
+ uint16_t length;
+ uint32_t xid;
+ uint32_t experimenter == 0x5c16c7;
+ uint32_t subtype == 50;
+ uint16_t table_id;
+ pad(2);
+ uint32_t buckets_size;
+};
+
+
+// Retrieve the configuration state (key, value, and checksum) for each table
+// entry in a range of buckets.
+//
+// The checksum_mask must be a prefix mask. The checksum must be zero in the
+// bits where the checksum_mask is zero.
+struct of_bsn_gentable_entry_desc_stats_request : of_bsn_stats_request {
+ uint8_t version;
+ uint8_t type == 18;
+ uint16_t length;
+ uint32_t xid;
+ uint16_t stats_type == 0xffff;
+ enum ofp_stats_request_flags flags;
+ pad(4);
+ uint32_t experimenter == 0x5c16c7;
+ uint32_t subtype == 2;
+ uint16_t table_id;
+ pad(2);
+ of_checksum_128_t checksum;
+ of_checksum_128_t checksum_mask;
+};
+
+struct of_bsn_gentable_entry_desc_stats_entry {
+ uint16_t length;
+ uint16_t key_length;
+ of_checksum_128_t checksum;
+ list(of_bsn_tlv_t) key;
+ list(of_bsn_tlv_t) value;
+};
+
+struct of_bsn_gentable_entry_desc_stats_reply : of_bsn_stats_reply {
+ uint8_t version;
+ uint8_t type == 19;
+ uint16_t length;
+ uint32_t xid;
+ uint16_t stats_type == 0xffff;
+ enum ofp_stats_reply_flags flags;
+ pad(4);
+ uint32_t experimenter == 0x5c16c7;
+ uint32_t subtype == 2;
+ list(of_bsn_gentable_entry_desc_stats_entry_t) entries;
+};
+
+
+// Retrieve the runtime state (key and stats) for each table entry in a range
+// of buckets.
+//
+// The checksum_mask must be a prefix mask. The checksum must be zero in the
+// bits where the checksum_mask is zero.
+struct of_bsn_gentable_entry_stats_request : of_bsn_stats_request {
+ uint8_t version;
+ uint8_t type == 18;
+ uint16_t length;
+ uint32_t xid;
+ uint16_t stats_type == 0xffff;
+ enum ofp_stats_request_flags flags;
+ pad(4);
+ uint32_t experimenter == 0x5c16c7;
+ uint32_t subtype == 3;
+ uint16_t table_id;
+ pad(2);
+ of_checksum_128_t checksum;
+ of_checksum_128_t checksum_mask;
+};
+
+struct of_bsn_gentable_entry_stats_entry {
+ uint16_t length;
+ uint16_t key_length;
+ list(of_bsn_tlv_t) key;
+ list(of_bsn_tlv_t) stats;
+};
+
+struct of_bsn_gentable_entry_stats_reply : of_bsn_stats_reply {
+ uint8_t version;
+ uint8_t type == 19;
+ uint16_t length;
+ uint32_t xid;
+ uint16_t stats_type == 0xffff;
+ enum ofp_stats_reply_flags flags;
+ pad(4);
+ uint32_t experimenter == 0x5c16c7;
+ uint32_t subtype == 3;
+ list(of_bsn_gentable_entry_stats_entry_t) entries;
+};
+
+
+// Retrieve the description for all tables.
+struct of_bsn_gentable_desc_stats_request : of_bsn_stats_request {
+ uint8_t version;
+ uint8_t type == 18;
+ uint16_t length;
+ uint32_t xid;
+ uint16_t stats_type == 0xffff;
+ enum ofp_stats_request_flags flags;
+ pad(4);
+ uint32_t experimenter == 0x5c16c7;
+ uint32_t subtype == 4;
+};
+
+struct of_bsn_gentable_desc_stats_entry {
+ uint16_t length;
+ uint16_t table_id;
+ of_table_name_t name;
+ uint32_t buckets_size;
+ uint32_t max_entries;
+ pad(4);
+ /* TODO properties */
+};
+
+struct of_bsn_gentable_desc_stats_reply : of_bsn_stats_reply {
+ uint8_t version;
+ uint8_t type == 19;
+ uint16_t length;
+ uint32_t xid;
+ uint16_t stats_type == 0xffff;
+ enum ofp_stats_reply_flags flags;
+ pad(4);
+ uint32_t experimenter == 0x5c16c7;
+ uint32_t subtype == 4;
+ list(of_bsn_gentable_desc_stats_entry_t) entries;
+};
+
+
+// Retrieves stats for every table. This includes the total checksum, so the
+// controller can quickly check whether the whole table is in sync.
+//
+// The checksum of a table is the XOR of the checksums of all entries in the
+// table.
+struct of_bsn_gentable_stats_request : of_bsn_stats_request {
+ uint8_t version;
+ uint8_t type == 18;
+ uint16_t length;
+ uint32_t xid;
+ uint16_t stats_type == 0xffff;
+ enum ofp_stats_request_flags flags;
+ pad(4);
+ uint32_t experimenter == 0x5c16c7;
+ uint32_t subtype == 7;
+};
+
+struct of_bsn_gentable_stats_entry {
+ uint16_t table_id;
+ pad(2);
+ uint32_t entry_count;
+ of_checksum_128_t checksum;
+};
+
+struct of_bsn_gentable_stats_reply : of_bsn_stats_reply {
+ uint8_t version;
+ uint8_t type == 19;
+ uint16_t length;
+ uint32_t xid;
+ uint16_t stats_type == 0xffff;
+ enum ofp_stats_reply_flags flags;
+ pad(4);
+ uint32_t experimenter == 0x5c16c7;
+ uint32_t subtype == 7;
+ list(of_bsn_gentable_stats_entry_t) entries;
+};
+
+
+// Retrieves the checksum for every bucket in a table. The entries are ordered
+// by bucket index.
+//
+// The checksum of a bucket is the XOR of the checksums of all entries in the
+// bucket.
+struct of_bsn_gentable_bucket_stats_request : of_bsn_stats_request {
+ uint8_t version;
+ uint8_t type == 18;
+ uint16_t length;
+ uint32_t xid;
+ uint16_t stats_type == 0xffff;
+ enum ofp_stats_request_flags flags;
+ pad(4);
+ uint32_t experimenter == 0x5c16c7;
+ uint32_t subtype == 5;
+ uint16_t table_id;
+};
+
+struct of_bsn_gentable_bucket_stats_entry {
+ of_checksum_128_t checksum;
+};
+
+struct of_bsn_gentable_bucket_stats_reply : of_bsn_stats_reply {
+ uint8_t version;
+ uint8_t type == 19;
+ uint16_t length;
+ uint32_t xid;
+ uint16_t stats_type == 0xffff;
+ enum ofp_stats_reply_flags flags;
+ pad(4);
+ uint32_t experimenter == 0x5c16c7;
+ uint32_t subtype == 5;
+ list(of_bsn_gentable_bucket_stats_entry_t) entries;
+};
diff --git a/openflow_input/bsn_tlv b/openflow_input/bsn_tlv
new file mode 100644
index 0000000..5086217
--- /dev/null
+++ b/openflow_input/bsn_tlv
@@ -0,0 +1,78 @@
+// 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 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 4
+
+struct of_bsn_tlv_port : of_bsn_tlv {
+ uint16_t type == 0;
+ uint16_t length;
+ of_port_no_t value;
+};
+
+struct of_bsn_tlv_mac : of_bsn_tlv {
+ uint16_t type == 1;
+ uint16_t length;
+ of_mac_addr_t value;
+};
+
+struct of_bsn_tlv_rx_packets : of_bsn_tlv {
+ uint16_t type == 2;
+ uint16_t length;
+ uint64_t value;
+};
+
+struct of_bsn_tlv_tx_packets : of_bsn_tlv {
+ uint16_t type == 3;
+ uint16_t length;
+ uint64_t value;
+};
+
+struct of_bsn_tlv_ipv4 : of_bsn_tlv {
+ uint16_t type == 4;
+ uint16_t length;
+ of_ipv4_t value;
+};
+
+struct of_bsn_tlv_idle_time : of_bsn_tlv {
+ uint16_t type == 5;
+ uint16_t length;
+ uint64_t value; /* Milliseconds */
+};
+
+struct of_bsn_tlv_vlan_vid : of_bsn_tlv {
+ uint16_t type == 6;
+ uint16_t length;
+ uint16_t value;
+};
+
+struct of_bsn_tlv_idle_notification : of_bsn_tlv {
+ uint16_t type == 7;
+ uint16_t length;
+};
diff --git a/py_gen/codegen.py b/py_gen/codegen.py
index de3fdba..44b4814 100644
--- a/py_gen/codegen.py
+++ b/py_gen/codegen.py
@@ -45,6 +45,7 @@
'of_instruction': 'instruction',
'of_instruction_id': 'instruction_id',
'of_meter_band': 'meter_band',
+ 'of_bsn_tlv': 'bsn_tlv',
}
# Return the module and class names for the generated Python class
@@ -123,6 +124,11 @@
def generate_util(out, name, version):
util.render_template(out, 'util.py', version=version)
+def generate_bsn_tlv(out, name, version):
+ util.render_template(out, 'module.py',
+ ofclasses=modules_by_version[version]['bsn_tlv'],
+ version=version)
+
def init():
for version in loxi_globals.OFVersions.target_versions:
modules_by_version[version] = build_ofclasses(version)
diff --git a/py_gen/oftype.py b/py_gen/oftype.py
index 40bcb40..7e28a0c 100644
--- a/py_gen/oftype.py
+++ b/py_gen/oftype.py
@@ -111,6 +111,11 @@
init='None',
pack='%s.pack()',
unpack='oxm.oxm.unpack(%s)'),
+
+ 'of_checksum_128_t': OFTypeData(
+ init='0',
+ pack='util.pack_checksum_128(%s)',
+ unpack="util.unpack_checksum_128(%s)"),
}
## Fixed length strings
diff --git a/py_gen/templates/init.py b/py_gen/templates/init.py
index f66e62a..3b73baa 100644
--- a/py_gen/templates/init.py
+++ b/py_gen/templates/init.py
@@ -38,6 +38,7 @@
:: #endif
:: if version >= 4:
import meter_band
+import bsn_tlv
:: #endif
from const import *
from common import *
diff --git a/py_gen/templates/module.py b/py_gen/templates/module.py
index 30c45ad..02f0002 100644
--- a/py_gen/templates/module.py
+++ b/py_gen/templates/module.py
@@ -46,6 +46,7 @@
import action_id
import instruction_id
import meter_band
+import bsn_tlv
:: #endif
import util
import loxi.generic_util
diff --git a/py_gen/templates/util.py b/py_gen/templates/util.py
index ed2698a..d690939 100644
--- a/py_gen/templates/util.py
+++ b/py_gen/templates/util.py
@@ -182,3 +182,10 @@
except loxi.ProtocolError:
return None
return [x for x in loxi.generic_util.unpack_list(reader, deserializer) if x != None]
+
+def pack_checksum_128(value):
+ return struct.pack("!QQ", (value >> 64) & MASK64, value & MASK64)
+
+def unpack_checksum_128(reader):
+ hi, lo = reader.read("!QQ")
+ return (hi << 64) | lo
diff --git a/test_data/of13/bsn_gentable_bucket_stats_reply.data b/test_data/of13/bsn_gentable_bucket_stats_reply.data
new file mode 100644
index 0000000..8e0772f
--- /dev/null
+++ b/test_data/of13/bsn_gentable_bucket_stats_reply.data
@@ -0,0 +1,54 @@
+-- binary
+04 13 # version, type
+00 38 # length
+12 34 56 78 # xid
+ff ff # stats_type
+00 00 # flags
+00 00 00 00 # pad
+00 5c 16 c7 # experimenter
+00 00 00 05 # subtype
+88 77 66 55 44 33 22 11 FF EE DD CC BB AA 99 88 # entries[0].checksum
+12 34 23 45 34 56 45 67 56 78 67 89 78 9A 89 AB # entries[1].checksum
+-- python
+ofp.message.bsn_gentable_bucket_stats_reply(
+ xid=0x12345678,
+ entries=[
+ ofp.bsn_gentable_bucket_stats_entry(
+ checksum=0x8877665544332211FFEEDDCCBBAA9988),
+ ofp.bsn_gentable_bucket_stats_entry(
+ checksum=0x123423453456456756786789789A89AB),
+ ])
+-- java
+builder.setXid(0x12345678)
+ .setEntries(
+ ImmutableList.<OFBsnGentableBucketStatsEntry>of(
+ factory.bsnGentableBucketStatsEntry(OFChecksum128.of(0x8877665544332211L, 0xFFEEDDCCBBAA9988L)),
+ factory.bsnGentableBucketStatsEntry(OFChecksum128.of(0x1234234534564567L, 0x56786789789A89ABL))
+ )
+ )
+-- c
+obj = of_bsn_gentable_bucket_stats_reply_new(OF_VERSION_1_3);
+of_bsn_gentable_bucket_stats_reply_xid_set(obj, 0x12345678);
+{
+ of_object_t *list = of_list_bsn_gentable_bucket_stats_entry_new(OF_VERSION_1_3);
+ {
+ of_object_t *entry = of_bsn_gentable_bucket_stats_entry_new(OF_VERSION_1_3);
+ {
+ of_checksum_128_t checksum = { 0x8877665544332211L, 0xFFEEDDCCBBAA9988L };
+ of_bsn_gentable_bucket_stats_entry_checksum_set(entry, checksum);
+ }
+ of_list_append(list, entry);
+ of_object_delete(entry);
+ }
+ {
+ of_object_t *entry = of_bsn_gentable_bucket_stats_entry_new(OF_VERSION_1_3);
+ {
+ of_checksum_128_t checksum = { 0x1234234534564567L, 0x56786789789A89ABL };
+ of_bsn_gentable_bucket_stats_entry_checksum_set(entry, checksum);
+ }
+ of_list_append(list, entry);
+ of_object_delete(entry);
+ }
+ of_bsn_gentable_bucket_stats_reply_entries_set(obj, list);
+ of_object_delete(list);
+}
diff --git a/test_data/of13/bsn_gentable_bucket_stats_request.data b/test_data/of13/bsn_gentable_bucket_stats_request.data
new file mode 100644
index 0000000..b756b54
--- /dev/null
+++ b/test_data/of13/bsn_gentable_bucket_stats_request.data
@@ -0,0 +1,14 @@
+-- binary
+04 12 # version, type
+00 1a # length
+12 34 56 78 # xid
+ff ff # stats_type
+00 00 # flags
+00 00 00 00 # pad
+00 5c 16 c7 # experimenter
+00 00 00 05 # subtype
+12 34 # table_id
+-- python
+ofp.message.bsn_gentable_bucket_stats_request(
+ xid=0x12345678,
+ table_id=0x1234)
diff --git a/test_data/of13/bsn_gentable_clear_request.data b/test_data/of13/bsn_gentable_clear_request.data
new file mode 100644
index 0000000..911ee27
--- /dev/null
+++ b/test_data/of13/bsn_gentable_clear_request.data
@@ -0,0 +1,33 @@
+-- binary
+04 04 # version, type
+00 34 # length
+12 34 56 78 # xid
+00 5c 16 c7 # experimenter
+00 00 00 30 # subtype
+00 14 # table_id
+00 00 # pad
+fe dc ba 98 76 54 32 10 ff ee cc bb aa 99 00 00 # checksum
+ff ff ff ff ff ff ff ff ff ff ff ff ff ff 00 00 # checksum_mask
+-- python
+ofp.message.bsn_gentable_clear_request(
+ xid=0x12345678,
+ table_id=20,
+ checksum= 0xFEDCBA9876543210FFEECCBBAA990000,
+ checksum_mask=0xFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000)
+-- java
+builder.setXid(0x12345678)
+ .setChecksum(OFChecksum128.of(0xFEDCBA9876543210L, 0xFFEECCBBAA990000L))
+ .setChecksumMask(OFChecksum128.of(0xFFFFFFFFFFFFFFFFL, 0xFFFFFFFFFFFF0000L))
+ .setTableId(20)
+-- c
+obj = of_bsn_gentable_clear_request_new(OF_VERSION_1_3);
+of_bsn_gentable_clear_request_xid_set(obj, 0x12345678);
+of_bsn_gentable_clear_request_table_id_set(obj, 20);
+{
+ of_checksum_128_t checksum = { 0xFEDCBA9876543210L, 0xFFEECCBBAA990000L };
+ of_bsn_gentable_clear_request_checksum_set(obj, checksum);
+}
+{
+ of_checksum_128_t checksum_mask = { 0xFFFFFFFFFFFFFFFFL, 0xFFFFFFFFFFFF0000L };
+ of_bsn_gentable_clear_request_checksum_mask_set(obj, checksum_mask);
+}
diff --git a/test_data/of13/bsn_gentable_desc_stats_reply.data b/test_data/of13/bsn_gentable_desc_stats_reply.data
new file mode 100644
index 0000000..64346c8
--- /dev/null
+++ b/test_data/of13/bsn_gentable_desc_stats_reply.data
@@ -0,0 +1,86 @@
+-- binary
+04 13 # version, type
+00 78 # length
+12 34 56 78 # xid
+ff ff # stats_type
+00 00 # flags
+00 00 00 00 # pad
+00 5c 16 c7 # experimenter
+00 00 00 04 # subtype
+
+# entries[0]
+00 30 # length
+00 00 # table id
+74 61 62 6c 65 20 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 # name
+00 00 00 20 # buckets_size
+00 00 00 40 # max_entries
+00 00 00 00 # pad
+
+# entries[1]
+00 30 # length
+00 01 # table id
+74 61 62 6c 65 20 31 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e # name
+00 00 00 40 # buckets_size
+00 00 00 80 # max_entries
+00 00 00 00 # pad
+-- python
+ofp.message.bsn_gentable_desc_stats_reply(
+ xid=0x12345678,
+ entries=[
+ ofp.bsn_gentable_desc_stats_entry(
+ table_id=0,
+ name="table 0",
+ buckets_size=32,
+ max_entries=64),
+ ofp.bsn_gentable_desc_stats_entry(
+ table_id=1,
+ name="table 1".ljust(32, '.'),
+ buckets_size=64,
+ max_entries=128),
+ ])
+-- java
+builder.setXid(0x12345678)
+ .setEntries(
+ ImmutableList.<OFBsnGentableDescStatsEntry>of(
+ factory.buildBsnGentableDescStatsEntry()
+ .setTableId(0)
+ .setName("table 0")
+ .setBucketsSize(32)
+ .setMaxEntries(64)
+ .build(),
+ factory.buildBsnGentableDescStatsEntry()
+ .setTableId(1)
+ .setName("table 1.........................")
+ .setBucketsSize(64)
+ .setMaxEntries(128)
+ .build()
+ )
+ )
+-- c
+obj = of_bsn_gentable_desc_stats_reply_new(OF_VERSION_1_3);
+of_bsn_gentable_desc_stats_reply_xid_set(obj, 0x12345678);
+{
+ of_object_t *list = of_list_bsn_gentable_desc_stats_entry_new(OF_VERSION_1_3);
+ {
+ of_table_name_t name = "table 0";
+ of_object_t *entry = of_bsn_gentable_desc_stats_entry_new(OF_VERSION_1_3);
+ of_bsn_gentable_desc_stats_entry_table_id_set(entry, 0);
+ of_bsn_gentable_desc_stats_entry_name_set(entry, name);
+ of_bsn_gentable_desc_stats_entry_buckets_size_set(entry, 32);
+ of_bsn_gentable_desc_stats_entry_max_entries_set(entry, 64);
+ of_list_append(list, entry);
+ of_object_delete(entry);
+ }
+ {
+ of_table_name_t name = "table 1.........................";
+ of_object_t *entry = of_bsn_gentable_desc_stats_entry_new(OF_VERSION_1_3);
+ of_bsn_gentable_desc_stats_entry_table_id_set(entry, 1);
+ of_bsn_gentable_desc_stats_entry_name_set(entry, name);
+ of_bsn_gentable_desc_stats_entry_buckets_size_set(entry, 64);
+ of_bsn_gentable_desc_stats_entry_max_entries_set(entry, 128);
+ of_list_append(list, entry);
+ of_object_delete(entry);
+ }
+ of_bsn_gentable_desc_stats_reply_entries_set(obj, list);
+ of_object_delete(list);
+}
diff --git a/test_data/of13/bsn_gentable_desc_stats_request.data b/test_data/of13/bsn_gentable_desc_stats_request.data
new file mode 100644
index 0000000..977fe29
--- /dev/null
+++ b/test_data/of13/bsn_gentable_desc_stats_request.data
@@ -0,0 +1,12 @@
+-- binary
+04 12 # version, type
+00 18 # length
+12 34 56 78 # xid
+ff ff # stats_type
+00 00 # flags
+00 00 00 00 # pad
+00 5c 16 c7 # experimenter
+00 00 00 04 # subtype
+-- python
+ofp.message.bsn_gentable_desc_stats_request(
+ xid=0x12345678)
diff --git a/test_data/of13/bsn_gentable_entry_add.data b/test_data/of13/bsn_gentable_entry_add.data
new file mode 100644
index 0000000..d8db0f8
--- /dev/null
+++ b/test_data/of13/bsn_gentable_entry_add.data
@@ -0,0 +1,98 @@
+-- binary
+04 04 # version, type
+00 48 # length
+12 34 56 78 # xid
+00 5c 16 c7 # experimenter
+00 00 00 2e # subtype
+00 14 # table_id
+00 12 # key_length
+fe dc ba 98 76 54 32 10 ff ee cc bb aa 99 88 77 # checksum
+
+00 00 # key[0].type
+00 08 # key[0].length
+00 00 00 05 # key[0].value
+
+00 01 # key[1].type
+00 0a # key[1].length
+01 23 45 67 89 ab # key[1].value
+
+00 00 # value[0].type
+00 08 # value[0].length
+00 00 00 06 # value[0].value
+
+00 01 # value[1].type
+00 0a # value[1].length
+ff ee dd cc bb aa # value[1].value
+-- python
+ofp.message.bsn_gentable_entry_add(
+ xid=0x12345678,
+ checksum=0xFEDCBA9876543210FFEECCBBAA998877,
+ table_id=20,
+ key=[
+ ofp.bsn_tlv.port(5),
+ ofp.bsn_tlv.mac([0x01, 0x23, 0x45, 0x67, 0x89, 0xab]),
+ ],
+ value=[
+ ofp.bsn_tlv.port(6),
+ ofp.bsn_tlv.mac([0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa]),
+ ])
+-- java
+builder.setXid(0x12345678)
+ .setChecksum(OFChecksum128.of(0xFEDCBA9876543210L, 0xFFEECCBBAA998877L))
+ .setTableId(20)
+ .setKey(
+ ImmutableList.<OFBsnTlv>of(
+ factory.bsnTlvPort(OFPort.of(5)),
+ factory.bsnTlvMac(MacAddress.of("01:23:45:67:89:ab"))
+ )
+ )
+ .setValue(
+ ImmutableList.<OFBsnTlv>of(
+ factory.bsnTlvPort(OFPort.of(6)),
+ factory.bsnTlvMac(MacAddress.of("ff:ee:dd:cc:bb:aa"))
+ )
+ )
+-- c
+obj = of_bsn_gentable_entry_add_new(OF_VERSION_1_3);
+of_bsn_gentable_entry_add_xid_set(obj, 0x12345678);
+of_bsn_gentable_entry_add_table_id_set(obj, 20);
+{
+ of_checksum_128_t checksum = { 0xFEDCBA9876543210L, 0xFFEECCBBAA998877L };
+ of_bsn_gentable_entry_add_checksum_set(obj, checksum);
+}
+{
+ of_object_t *list = of_list_bsn_tlv_new(OF_VERSION_1_3);
+ {
+ of_object_t *tlv = of_bsn_tlv_port_new(OF_VERSION_1_3);
+ of_bsn_tlv_port_value_set(tlv, 5);
+ of_list_append(list, tlv);
+ of_object_delete(tlv);
+ }
+ {
+ of_mac_addr_t mac = { { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab } };
+ of_object_t *tlv = of_bsn_tlv_mac_new(OF_VERSION_1_3);
+ of_bsn_tlv_mac_value_set(tlv, mac);
+ of_list_append(list, tlv);
+ of_object_delete(tlv);
+ }
+ of_bsn_gentable_entry_add_key_set(obj, list);
+ of_object_delete(list);
+}
+{
+ of_object_t *list = of_list_bsn_tlv_new(OF_VERSION_1_3);
+ {
+ of_object_t *tlv = of_bsn_tlv_port_new(OF_VERSION_1_3);
+ of_bsn_tlv_port_value_set(tlv, 6);
+ of_list_append(list, tlv);
+ of_object_delete(tlv);
+ }
+ {
+ of_mac_addr_t mac = { { 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa } };
+ of_object_t *tlv = of_bsn_tlv_mac_new(OF_VERSION_1_3);
+ of_bsn_tlv_mac_value_set(tlv, mac);
+ of_list_append(list, tlv);
+ of_object_delete(tlv);
+ }
+ of_bsn_gentable_entry_add_value_set(obj, list);
+ of_object_delete(list);
+}
diff --git a/test_data/of13/bsn_gentable_entry_delete.data b/test_data/of13/bsn_gentable_entry_delete.data
new file mode 100644
index 0000000..0f17bfd
--- /dev/null
+++ b/test_data/of13/bsn_gentable_entry_delete.data
@@ -0,0 +1,54 @@
+-- binary
+04 04 # version, type
+00 24 # length
+12 34 56 78 # xid
+00 5c 16 c7 # experimenter
+00 00 00 2f # subtype
+00 14 # table_id
+
+00 00 # key[0].type
+00 08 # key[0].length
+00 00 00 05 # key[0].value
+
+00 01 # key[1].type
+00 0a # key[1].length
+01 23 45 67 89 ab # key[1].value
+-- python
+ofp.message.bsn_gentable_entry_delete(
+ xid=0x12345678,
+ table_id=20,
+ key=[
+ ofp.bsn_tlv.port(5),
+ ofp.bsn_tlv.mac([0x01, 0x23, 0x45, 0x67, 0x89, 0xab]),
+ ])
+-- java
+builder.setXid(0x12345678)
+ .setTableId(20)
+ .setKey(
+ ImmutableList.<OFBsnTlv>of(
+ factory.bsnTlvPort(OFPort.of(5)),
+ factory.bsnTlvMac(MacAddress.of("01:23:45:67:89:ab"))
+ )
+ )
+-- c
+obj = of_bsn_gentable_entry_delete_new(OF_VERSION_1_3);
+of_bsn_gentable_entry_delete_xid_set(obj, 0x12345678);
+of_bsn_gentable_entry_delete_table_id_set(obj, 20);
+{
+ of_object_t *list = of_list_bsn_tlv_new(OF_VERSION_1_3);
+ {
+ of_object_t *tlv = of_bsn_tlv_port_new(OF_VERSION_1_3);
+ of_bsn_tlv_port_value_set(tlv, 5);
+ of_list_append(list, tlv);
+ of_object_delete(tlv);
+ }
+ {
+ of_mac_addr_t mac = { { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab } };
+ of_object_t *tlv = of_bsn_tlv_mac_new(OF_VERSION_1_3);
+ of_bsn_tlv_mac_value_set(tlv, mac);
+ of_list_append(list, tlv);
+ of_object_delete(tlv);
+ }
+ of_bsn_gentable_entry_delete_key_set(obj, list);
+ of_object_delete(list);
+}
diff --git a/test_data/of13/bsn_gentable_entry_desc_stats_reply.data b/test_data/of13/bsn_gentable_entry_desc_stats_reply.data
new file mode 100644
index 0000000..40de7dd
--- /dev/null
+++ b/test_data/of13/bsn_gentable_entry_desc_stats_reply.data
@@ -0,0 +1,148 @@
+-- binary
+04 13 # version, type
+00 64 # length
+12 34 56 78 # xid
+ff ff # stats_type
+00 00 # flags
+00 00 00 00 # pad
+00 5c 16 c7 # experimenter
+00 00 00 2 # subtype
+
+# entries[0]
+00 26 # length
+00 08 # key_length
+fe dc ba 98 76 54 32 10 ff ee cc bb aa 99 88 00 # checksum
+00 00 # key[0].type
+00 08 # key[0].length
+00 00 00 05 # key[0].value
+00 01 # value[0].type
+00 0a # value[0].length
+ff ee dd cc bb 00 # value[0].value
+
+# entries[1]
+00 26 # length
+00 08 # key_length
+fe dc ba 98 76 54 32 10 ff ee cc bb aa 99 88 01 # checksum
+00 00 # key[0].type
+00 08 # key[0].length
+00 00 00 06 # key[0].value
+00 01 # value[0].type
+00 0a # value[0].length
+ff ee dd cc bb 01 # value[0].value
+-- python
+ofp.message.bsn_gentable_entry_desc_stats_reply(
+ xid=0x12345678,
+ entries=[
+ ofp.bsn_gentable_entry_desc_stats_entry(
+ checksum=0xFEDCBA9876543210FFEECCBBAA998800,
+ key=[
+ ofp.bsn_tlv.port(5),
+ ],
+ value=[
+ ofp.bsn_tlv.mac([0xff, 0xee, 0xdd, 0xcc, 0xbb, 0x00]),
+ ]),
+ ofp.bsn_gentable_entry_desc_stats_entry(
+ checksum=0xFEDCBA9876543210FFEECCBBAA998801,
+ key=[
+ ofp.bsn_tlv.port(6),
+ ],
+ value=[
+ ofp.bsn_tlv.mac([0xff, 0xee, 0xdd, 0xcc, 0xbb, 0x01]),
+ ]),
+ ])
+-- java
+builder.setXid(0x12345678)
+ .setEntries(
+ ImmutableList.<OFBsnGentableEntryDescStatsEntry>of(
+ factory.buildBsnGentableEntryDescStatsEntry()
+ .setChecksum(OFChecksum128.of(0xFEDCBA9876543210L, 0xFFEECCBBAA998800L))
+ .setKey(ImmutableList.<OFBsnTlv>of(
+ factory.bsnTlvPort(OFPort.of(5))
+ ))
+ .setValue(ImmutableList.<OFBsnTlv>of(
+ factory.bsnTlvMac(MacAddress.of("ff:ee:dd:cc:bb:00"))
+ ))
+ .build(),
+ factory.buildBsnGentableEntryDescStatsEntry()
+ .setChecksum(OFChecksum128.of(0xFEDCBA9876543210L, 0xFFEECCBBAA998801L))
+ .setKey(ImmutableList.<OFBsnTlv>of(
+ factory.bsnTlvPort(OFPort.of(6))
+ ))
+ .setValue(ImmutableList.<OFBsnTlv>of(
+ factory.bsnTlvMac(MacAddress.of("ff:ee:dd:cc:bb:01"))
+ ))
+ .build()
+ )
+ )
+-- c
+obj = of_bsn_gentable_entry_desc_stats_reply_new(OF_VERSION_1_3);
+of_bsn_gentable_entry_desc_stats_reply_xid_set(obj, 0x12345678);
+{
+ of_object_t *list = of_list_bsn_gentable_entry_desc_stats_entry_new(OF_VERSION_1_3);
+ {
+ of_object_t *entry = of_bsn_gentable_entry_desc_stats_entry_new(OF_VERSION_1_3);
+ {
+ of_checksum_128_t checksum = { 0xFEDCBA9876543210L, 0xFFEECCBBAA998800L };
+ of_bsn_gentable_entry_desc_stats_entry_checksum_set(entry, checksum);
+ }
+ {
+ of_object_t *tlvs = of_list_bsn_tlv_new(OF_VERSION_1_3);
+ {
+ of_object_t *tlv = of_bsn_tlv_port_new(OF_VERSION_1_3);
+ of_bsn_tlv_port_value_set(tlv, 5);
+ of_list_append(tlvs, tlv);
+ of_object_delete(tlv);
+ }
+ of_bsn_gentable_entry_desc_stats_entry_key_set(entry, tlvs);
+ of_object_delete(tlvs);
+ }
+ {
+ of_object_t *tlvs = of_list_bsn_tlv_new(OF_VERSION_1_3);
+ {
+ of_object_t *tlv = of_bsn_tlv_mac_new(OF_VERSION_1_3);
+ of_mac_addr_t mac = { { 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0x00 } };
+ of_bsn_tlv_mac_value_set(tlv, mac);
+ of_list_append(tlvs, tlv);
+ of_object_delete(tlv);
+ }
+ of_bsn_gentable_entry_desc_stats_entry_value_set(entry, tlvs);
+ of_object_delete(tlvs);
+ }
+ of_list_append(list, entry);
+ of_object_delete(entry);
+ }
+ {
+ of_object_t *entry = of_bsn_gentable_entry_desc_stats_entry_new(OF_VERSION_1_3);
+ {
+ of_checksum_128_t checksum = { 0xFEDCBA9876543210L, 0xFFEECCBBAA998801L };
+ of_bsn_gentable_entry_desc_stats_entry_checksum_set(entry, checksum);
+ }
+ {
+ of_object_t *tlvs = of_list_bsn_tlv_new(OF_VERSION_1_3);
+ {
+ of_object_t *tlv = of_bsn_tlv_port_new(OF_VERSION_1_3);
+ of_bsn_tlv_port_value_set(tlv, 6);
+ of_list_append(tlvs, tlv);
+ of_object_delete(tlv);
+ }
+ of_bsn_gentable_entry_desc_stats_entry_key_set(entry, tlvs);
+ of_object_delete(tlvs);
+ }
+ {
+ of_object_t *tlvs = of_list_bsn_tlv_new(OF_VERSION_1_3);
+ {
+ of_object_t *tlv = of_bsn_tlv_mac_new(OF_VERSION_1_3);
+ of_mac_addr_t mac = { { 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0x01 } };
+ of_bsn_tlv_mac_value_set(tlv, mac);
+ of_list_append(tlvs, tlv);
+ of_object_delete(tlv);
+ }
+ of_bsn_gentable_entry_desc_stats_entry_value_set(entry, tlvs);
+ of_object_delete(tlvs);
+ }
+ of_list_append(list, entry);
+ of_object_delete(entry);
+ }
+ of_bsn_gentable_entry_desc_stats_reply_entries_set(obj, list);
+ of_object_delete(list);
+}
diff --git a/test_data/of13/bsn_gentable_entry_desc_stats_request.data b/test_data/of13/bsn_gentable_entry_desc_stats_request.data
new file mode 100644
index 0000000..4971f06
--- /dev/null
+++ b/test_data/of13/bsn_gentable_entry_desc_stats_request.data
@@ -0,0 +1,19 @@
+-- binary
+04 12 # version, type
+00 3c # length
+12 34 56 78 # xid
+ff ff # stats_type
+00 00 # flags
+00 00 00 00 # pad
+00 5c 16 c7 # experimenter
+00 00 00 2 # subtype
+00 14 # table_id
+00 00 # pad
+fe dc ba 98 76 54 32 10 ff ee cc bb aa 99 00 00 # checksum
+ff ff ff ff ff ff ff ff ff ff ff ff ff ff 00 00 # checksum_mask
+-- python
+ofp.message.bsn_gentable_entry_desc_stats_request(
+ xid=0x12345678,
+ table_id=20,
+ checksum= 0xFEDCBA9876543210FFEECCBBAA990000,
+ checksum_mask=0xFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000)
diff --git a/test_data/of13/bsn_gentable_entry_stats_reply.data b/test_data/of13/bsn_gentable_entry_stats_reply.data
new file mode 100644
index 0000000..cd4ab62
--- /dev/null
+++ b/test_data/of13/bsn_gentable_entry_stats_reply.data
@@ -0,0 +1,154 @@
+-- binary
+04 13 # version, type
+00 60 # length
+12 34 56 78 # xid
+ff ff # stats_type
+00 00 # flags
+00 00 00 00 # pad
+00 5c 16 c7 # experimenter
+00 00 00 03 # subtype
+
+# entries[0]
+00 24 # length
+00 08 # key_length
+00 00 # key[0].type
+00 08 # key[0].length
+00 00 00 05 # key[0].value
+00 02 # stats[0].type
+00 0c # stats[0].length
+00 00 00 00 00 00 00 64 # stats[0].value
+00 03 # stats[0].type
+00 0c # stats[0].length
+00 00 00 00 00 00 00 65 # stats[0].value
+
+# entries[1]
+00 24 # length
+00 08 # key_length
+00 00 # key[0].type
+00 08 # key[0].length
+00 00 00 06 # key[0].value
+00 02 # stats[0].type
+00 0c # stats[0].length
+00 00 00 00 00 00 00 64 # stats[0].value
+00 03 # stats[0].type
+00 0c # stats[0].length
+00 00 00 00 00 00 00 65 # stats[0].value
+-- python
+ofp.message.bsn_gentable_entry_stats_reply(
+ xid=0x12345678,
+ entries=[
+ ofp.bsn_gentable_entry_stats_entry(
+ key=[
+ ofp.bsn_tlv.port(5),
+ ],
+ stats=[
+ ofp.bsn_tlv.rx_packets(100),
+ ofp.bsn_tlv.tx_packets(101),
+ ]),
+ ofp.bsn_gentable_entry_stats_entry(
+ key=[
+ ofp.bsn_tlv.port(6),
+ ],
+ stats=[
+ ofp.bsn_tlv.rx_packets(100),
+ ofp.bsn_tlv.tx_packets(101),
+ ]),
+ ])
+-- java
+builder.setXid(0x12345678)
+ .setEntries(
+ ImmutableList.<OFBsnGentableEntryStatsEntry>of(
+ factory.bsnGentableEntryStatsEntry(
+ ImmutableList.<OFBsnTlv>of(
+ factory.bsnTlvPort(OFPort.of(5))
+ ),
+ ImmutableList.<OFBsnTlv>of(
+ factory.bsnTlvRxPackets(U64.of(100)),
+ factory.bsnTlvTxPackets(U64.of(101))
+ )
+ ),
+ factory.bsnGentableEntryStatsEntry(
+ ImmutableList.<OFBsnTlv>of(
+ factory.bsnTlvPort(OFPort.of(6))
+ ),
+ ImmutableList.<OFBsnTlv>of(
+ factory.bsnTlvRxPackets(U64.of(100)),
+ factory.bsnTlvTxPackets(U64.of(101))
+ )
+ )
+ )
+ )
+-- c
+obj = of_bsn_gentable_entry_stats_reply_new(OF_VERSION_1_3);
+of_bsn_gentable_entry_stats_reply_xid_set(obj, 0x12345678);
+{
+ of_object_t *list = of_list_bsn_gentable_entry_stats_entry_new(OF_VERSION_1_3);
+ {
+ of_object_t *entry = of_bsn_gentable_entry_stats_entry_new(OF_VERSION_1_3);
+ {
+ of_object_t *tlvs = of_list_bsn_tlv_new(OF_VERSION_1_3);
+ {
+ of_object_t *tlv = of_bsn_tlv_port_new(OF_VERSION_1_3);
+ of_bsn_tlv_port_value_set(tlv, 5);
+ of_list_append(tlvs, tlv);
+ of_object_delete(tlv);
+ }
+ of_bsn_gentable_entry_stats_entry_key_set(entry, tlvs);
+ of_object_delete(tlvs);
+ }
+ {
+ of_object_t *tlvs = of_list_bsn_tlv_new(OF_VERSION_1_3);
+ {
+ of_object_t *tlv = of_bsn_tlv_rx_packets_new(OF_VERSION_1_3);
+ of_bsn_tlv_rx_packets_value_set(tlv, 100);
+ of_list_append(tlvs, tlv);
+ of_object_delete(tlv);
+ }
+ {
+ of_object_t *tlv = of_bsn_tlv_tx_packets_new(OF_VERSION_1_3);
+ of_bsn_tlv_tx_packets_value_set(tlv, 101);
+ of_list_append(tlvs, tlv);
+ of_object_delete(tlv);
+ }
+ of_bsn_gentable_entry_stats_entry_stats_set(entry, tlvs);
+ of_object_delete(tlvs);
+ }
+ of_list_append(list, entry);
+ of_object_delete(entry);
+ }
+ {
+ of_object_t *entry = of_bsn_gentable_entry_stats_entry_new(OF_VERSION_1_3);
+ {
+ of_object_t *tlvs = of_list_bsn_tlv_new(OF_VERSION_1_3);
+ {
+ of_object_t *tlv = of_bsn_tlv_port_new(OF_VERSION_1_3);
+ of_bsn_tlv_port_value_set(tlv, 6);
+ of_list_append(tlvs, tlv);
+ of_object_delete(tlv);
+ }
+ of_bsn_gentable_entry_stats_entry_key_set(entry, tlvs);
+ of_object_delete(tlvs);
+ }
+ {
+ of_object_t *tlvs = of_list_bsn_tlv_new(OF_VERSION_1_3);
+ {
+ of_object_t *tlv = of_bsn_tlv_rx_packets_new(OF_VERSION_1_3);
+ of_bsn_tlv_rx_packets_value_set(tlv, 100);
+ of_list_append(tlvs, tlv);
+ of_object_delete(tlv);
+ }
+ {
+ of_object_t *tlv = of_bsn_tlv_tx_packets_new(OF_VERSION_1_3);
+ of_bsn_tlv_tx_packets_value_set(tlv, 101);
+ of_list_append(tlvs, tlv);
+ of_object_delete(tlv);
+ }
+ of_bsn_gentable_entry_stats_entry_stats_set(entry, tlvs);
+ of_object_delete(tlvs);
+ }
+ of_list_append(list, entry);
+ of_object_delete(entry);
+ }
+ of_bsn_gentable_entry_stats_reply_entries_set(obj, list);
+ of_object_delete(list);
+}
diff --git a/test_data/of13/bsn_gentable_entry_stats_request.data b/test_data/of13/bsn_gentable_entry_stats_request.data
new file mode 100644
index 0000000..a288a55
--- /dev/null
+++ b/test_data/of13/bsn_gentable_entry_stats_request.data
@@ -0,0 +1,19 @@
+-- binary
+04 12 # version, type
+00 3c # length
+12 34 56 78 # xid
+ff ff # stats_type
+00 00 # flags
+00 00 00 00 # pad
+00 5c 16 c7 # experimenter
+00 00 00 3 # subtype
+00 14 # table_id
+00 00 # pad
+fe dc ba 98 76 54 32 10 ff ee cc bb aa 99 00 00 # checksum
+ff ff ff ff ff ff ff ff ff ff ff ff ff ff 00 00 # checksum_mask
+-- python
+ofp.message.bsn_gentable_entry_stats_request(
+ xid=0x12345678,
+ table_id=20,
+ checksum= 0xFEDCBA9876543210FFEECCBBAA990000,
+ checksum_mask=0xFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000)
diff --git a/test_data/of13/bsn_gentable_set_buckets_size.data b/test_data/of13/bsn_gentable_set_buckets_size.data
new file mode 100644
index 0000000..7833736
--- /dev/null
+++ b/test_data/of13/bsn_gentable_set_buckets_size.data
@@ -0,0 +1,14 @@
+-- binary
+04 04 # version, type
+00 18 # length
+12 34 56 78 # xid
+00 5c 16 c7 # experimenter
+00 00 00 32 # subtype
+00 14 # table_id
+00 00 # pad
+00 11 22 33 # buckets_size
+-- python
+ofp.message.bsn_gentable_set_buckets_size(
+ xid=0x12345678,
+ table_id=20,
+ buckets_size=0x00112233)
diff --git a/test_data/of13/bsn_tlv_port.data b/test_data/of13/bsn_tlv_port.data
new file mode 100644
index 0000000..303b0ec
--- /dev/null
+++ b/test_data/of13/bsn_tlv_port.data
@@ -0,0 +1,6 @@
+-- binary
+00 00 # type
+00 08 # length
+00 00 00 05 # value
+-- python
+ofp.bsn_tlv.port(5)