Adding OCS OpenFlow Protocol Extensions from Calient
diff --git a/c_gen/c_code_gen.py b/c_gen/c_code_gen.py
index 896e9ad..d138103 100644
--- a/c_gen/c_code_gen.py
+++ b/c_gen/c_code_gen.py
@@ -664,6 +664,8 @@
 typedef char of_desc_str_t[OF_DESC_STR_LEN];
 typedef char of_serial_num_t[OF_SERIAL_NUM_LEN];
 typedef char of_str64_t[64];
+typedef char of_str32_t[32];
+typedef char of_str6_t[6];
 
 typedef struct of_bitmap_128_s {
     uint64_t hi;
diff --git a/c_gen/c_test_gen.py b/c_gen/c_test_gen.py
index 0784fd4..50d496b 100644
--- a/c_gen/c_test_gen.py
+++ b/c_gen/c_test_gen.py
@@ -93,6 +93,8 @@
         of_desc_str_t="desc_str",
         of_serial_num_t="ser_num",
         of_str64_t="str64",
+        of_str32_t="str32",
+        of_str6_t="str6",
         of_mac_addr_t="mac_addr",
         of_ipv6_t="ipv6",
         # Non-scalars; more TBD
@@ -124,7 +126,8 @@
 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_checksum_128_t",
-                "of_str64_t", "of_app_code_t", "of_bitmap_512_t"]
+                "of_str64_t", "of_str32_t", "of_str6_t",
+                "of_app_code_t", "of_bitmap_512_t"]
 
 scalar_types = integer_types[:]
 scalar_types.extend(string_types)
diff --git a/c_gen/of_g_legacy.py b/c_gen/of_g_legacy.py
index caabc1a..fe58e56 100644
--- a/c_gen/of_g_legacy.py
+++ b/c_gen/of_g_legacy.py
@@ -201,6 +201,8 @@
     of_serial_num_t = dict(bytes=ofp_constants["OF_SERIAL_NUM_LEN"],
                            short_name="ser_num"),
     of_str64_t = dict(bytes=64, short_name="str64"),
+    of_str32_t = dict(bytes=32, short_name="str32"),
+    of_str6_t = dict(bytes=6, short_name="str6"),
     of_match_v1_t = dict(bytes=40, to_w="match_v1_hton",
                          from_w="match_v1_ntoh",
                          short_name="match_v1"),
@@ -228,7 +230,7 @@
                    "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_checksum_128_t",
-                   "of_str64_t", "of_bitmap_512_t"]
+                   "of_str64_t", "of_str32_t", "of_str6_t", "of_bitmap_512_t"]
 
 ##
 # LOXI identifiers
diff --git a/c_gen/templates/loci_dump.h b/c_gen/templates/loci_dump.h
index 89c5f2a..2eb11b7 100644
--- a/c_gen/templates/loci_dump.h
+++ b/c_gen/templates/loci_dump.h
@@ -91,6 +91,8 @@
 #define LOCI_DUMP_desc_str(writer, cookie, val) LOCI_DUMP_string(writer, cookie, val)
 #define LOCI_DUMP_ser_num(writer, cookie, val) LOCI_DUMP_string(writer, cookie, val)
 #define LOCI_DUMP_str64(writer, cookie, val) LOCI_DUMP_string(writer, cookie, val)
+#define LOCI_DUMP_str6(writer, cookie, val) LOCI_DUMP_string(writer, cookie, val)
+#define LOCI_DUMP_str32(writer, cookie, val) LOCI_DUMP_string(writer, cookie, val)
 
 int loci_dump_match(loci_writer_f writer, void* cookie, of_match_t *match);
 #define LOCI_DUMP_match(writer, cookie, val) loci_dump_match(writer, cookie, &val)
diff --git a/c_gen/templates/loci_show.h b/c_gen/templates/loci_show.h
index dc35959..6aa2f81 100644
--- a/c_gen/templates/loci_show.h
+++ b/c_gen/templates/loci_show.h
@@ -105,6 +105,8 @@
 #define LOCI_SHOW_desc_str(writer, cookie, val) LOCI_SHOW_string(writer, cookie, val)
 #define LOCI_SHOW_ser_num(writer, cookie, val) LOCI_SHOW_string(writer, cookie, val)
 #define LOCI_SHOW_str64(writer, cookie, val) LOCI_SHOW_string(writer, cookie, val)
+#define LOCI_SHOW_str6(writer, cookie, val) LOCI_SHOW_string(writer, cookie, val)
+#define LOCI_SHOW_str32(writer, cookie, val) LOCI_SHOW_string(writer, cookie, val)
 
 int loci_show_match(loci_writer_f writer, void *cookie, of_match_t *match);
 #define LOCI_SHOW_match(writer, cookie, val) loci_show_match(writer, cookie, &val)
diff --git a/c_gen/templates/of_wire_buf.h b/c_gen/templates/of_wire_buf.h
index 9ade2c4..4edc3a6 100644
--- a/c_gen/templates/of_wire_buf.h
+++ b/c_gen/templates/of_wire_buf.h
@@ -888,6 +888,52 @@
 #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))
 
+/**
+ * Get a str32 string from a wire buffer
+ * @param wbuf The pointer to the wire buffer structure
+ * @param offset Offset in the wire buffer
+ * @param s The string
+ *
+ * Uses the octets function.
+ */
+
+#define of_wire_buffer_str32_get(buf, offset, s) \
+    _wbuf_octets_get(buf, offset, (uint8_t *)s, 32)
+
+/**
+ * Set a str32 string in a wire buffer
+ * @param wbuf The pointer to the wire buffer structure
+ * @param offset Offset in the wire buffer
+ * @param s Where to store the str32
+ *
+ * Uses the octets function.
+ */
+
+#define of_wire_buffer_str32_set(buf, offset, s) \
+    _wbuf_octets_set(buf, offset, (uint8_t *)s, 32)
+
+/**
+ * Get a str6 string from a wire buffer
+ * @param wbuf The pointer to the wire buffer structure
+ * @param offset Offset in the wire buffer
+ * @param s The string
+ *
+ * Uses the octets function.
+ */
+
+#define of_wire_buffer_str6_get(buf, offset, s) \
+    _wbuf_octets_get(buf, offset, (uint8_t *)s, 6)
+/**
+ * Set a str6 string in a wire buffer
+ * @param wbuf The pointer to the wire buffer structure
+ * @param offset Offset in the wire buffer
+ * @param s Where to store the str6
+ *
+ * Uses the octets function.
+ */
+
+#define of_wire_buffer_str6_set(buf, offset, s) \
+    _wbuf_octets_set(buf, offset, (uint8_t *)s, 6)
 
 /**
  * Get a bitmap_512 from a wire buffer
diff --git a/java_gen/java_type.py b/java_gen/java_type.py
index 00debb5..1a48d86 100644
--- a/java_gen/java_type.py
+++ b/java_gen/java_type.py
@@ -360,6 +360,8 @@
 serial_num = gen_fixed_length_string_jtype(32)
 table_name = gen_fixed_length_string_jtype(32)
 str64 = gen_fixed_length_string_jtype(64)
+str32 = gen_fixed_length_string_jtype(32)
+str6 = gen_fixed_length_string_jtype(6)
 ipv4 = JType("IPv4Address") \
         .op(read="IPv4Address.read4Bytes(bb)", \
             write="$name.write4Bytes(bb)",
@@ -576,6 +578,8 @@
         'of_port_name_t': port_name,
         'of_table_name_t': table_name,
         'of_str64_t': str64,
+        'of_str32_t': str32,
+        'of_str6_t': str6,
         'of_ipv4_t': ipv4,
         'of_ipv6_t': ipv6,
         'of_wc_bmap_t': flow_wildcards,
diff --git a/loxi_ir/ir_offset.py b/loxi_ir/ir_offset.py
index 490c6b0..64c01b6 100644
--- a/loxi_ir/ir_offset.py
+++ b/loxi_ir/ir_offset.py
@@ -104,6 +104,8 @@
     of_desc_str_t = (ofp_constants["OF_DESC_STR_LEN"], True),
     of_serial_num_t = (ofp_constants["OF_SERIAL_NUM_LEN"], True),
     of_str64_t = (64, True),
+    of_str32_t = (32, True),
+    of_str6_t = (6, True),
     of_match_v1_t = (40, True),
     of_match_v2_t = (88, True),
     of_match_v3_t = (8, False),
diff --git a/openflow_input/calient b/openflow_input/calient
new file mode 100644
index 0000000..2818e64
--- /dev/null
+++ b/openflow_input/calient
@@ -0,0 +1,33 @@
+#version 4
+
+struct of_calient_stats_request : of_experimenter_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 == 0x0080F958;
+    uint32_t subtype == ?;
+};
+
+struct of_calient_stats_reply : of_experimenter_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 == 0x0080F958;
+    uint32_t subtype == ?;
+};
+
+enum ofp_calient_ocs_alarm(wire_type=uint8_t, bitmask=True){
+    OFPOCSALM_CLEAR = 1,    /* Clear- no alarm */
+    OFPOCSALM_Minor = 2,    /* loss is greater than 5.25 */
+    OFPOCSALM_Major = 3,    /* loss is greater than 7.25 */
+    OFPOCSALM_Critical = 4, /* loss is greater than 10.25 */
+};
+
diff --git a/openflow_input/calient_flow_stats b/openflow_input/calient_flow_stats
new file mode 100644
index 0000000..241cc04
--- /dev/null
+++ b/openflow_input/calient_flow_stats
@@ -0,0 +1,84 @@
+#version 4
+
+struct of_calient_flow_stats_request : of_calient_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 == 0x0080F958;
+    uint32_t subtype == 2;     /* OFPEMPFS = 2 */
+    uint8_t table_id;          /* Recommended to be set to 0. Ignored */
+    pad(3); 
+    uint32_t out_port;         /* Require matching entries to include this as an output port.
+                                  A value of OFPP_ANY indicates no restriction. Ignored */
+    uint32_t out_group;        /* Require matching entries to include this as an output group.
+                                  A value of OFPP_ANY indicates no restriction. Ignored */
+    pad(4);                    /* Align to 64 bits */
+    uint64_t cookie;           /* Ignored */
+    uint64_t cookie_mask;      /* Ignored */
+    of_match_t match;          /* Fields to match. Variable size */
+};
+
+enum ofp_calient_cflow_admin_state(wire_type=uint8_t, bitmask=True){
+     OFPCAS_InService = 1,      /* when the connection is activated */
+     OFPCAS_UnderManagement = 2,/*Default Connection state – (when connection is not activated)*/
+};
+
+   
+enum ofp_calient_cflow_operational_state(wire_type=uint8_t, bitmask=True){
+     OFPCOS_InService = 1,   /* When connection is activated */
+     OFPCOS_OutOfService = 2,/*When connection has a critical alarm  ( activated or otherwise) */
+     OFPCOS_Ready = 3,       /*When AS state is UnderManagement */
+     OFPCOS_Degraded = 4,    /*When connection is activated and has a  Major alarm */
+};
+                              
+enum ofp_calient_cflow_Capability(wire_type=uint8_t, bitmask=True){
+    OFPCCS_Ok = 1,          /* Connection has been made successfully */
+    OFPCCS_Failed = 2,      /* Connection has Failed */
+    OFPCCS_Initializing = 3,/* Connection making is in progress */
+};
+
+struct of_calient_flow_stats_entry {
+    uint16_t length;
+    uint8_t table_id;        /* Ignored */
+    pad(1);
+    uint32_t duration_sec;   /* Not supported for now */
+    uint32_t duration_nsec;  /* Not supported for now */
+    uint16_t priority;       /* Not supported */
+    uint16_t idle_timeout;   /* Set to 0 as entries must be explicitly removed */
+    uint16_t hard_timeout;   /* Set to 0 as entries must be explicitly removed */
+    enum ofp_flow_mod_flags flags;
+    pad(4);
+    uint64_t cookie;         /* Ignored */
+    enum ofp_calient_cflow_admin_state admin_status;      /* AS = IS(Activated)/UMA */
+    enum ofp_calient_cflow_operational_state oper_status; /* OS = UMA/OOS */
+    enum ofp_calient_cflow_Capability  oper_capability;   /* OC = FAIL/OK/INIT */
+    enum ofp_calient_ocs_alarm alarm;                     /* Alarm = NA/MJ/MN/CR */
+    of_str6_t port_power;
+    pad(2);
+    of_str6_t connected_port_power;
+    pad(2);
+    of_str64_t cflow_name;   /* Connection name */
+    of_match_t match;
+};
+
+
+struct of_calient_flow_stats_reply : of_calient_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 == 0x0080F958;
+    uint32_t subtype == 2;
+    uint16_t data_length;
+    pad(6);
+    list(of_calient_flow_stats_entry_t)flow_stats;
+};
+
+
diff --git a/openflow_input/calient_port_desc_stats b/openflow_input/calient_port_desc_stats
new file mode 100644
index 0000000..f4b3367
--- /dev/null
+++ b/openflow_input/calient_port_desc_stats
@@ -0,0 +1,92 @@
+#version 4
+
+struct of_calient_port_desc_stats_request : of_calient_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 == 0x0080F958;
+    uint32_t subtype == 1;
+};
+
+
+struct of_calient_port_desc_prop {
+    uint16_t type == ?; /* One of OFPPDPT_*. */
+    uint16_t length;    /* Length in bytes of this property. */
+};
+
+
+enum ofp_calient_optical_port_admin_state(wire_type=uint8_t, bitmask=True){
+    OFPAS_IN_SERVICE = 1,     /*Circuit Port in Service*/
+    OFPAS_OUT_OF_SERVICE = 2, /*Circuit Port out of Service*/
+    OFPAS_OOS_NP = 3          /*Circuit Port out of Service, not provisioned*/
+};
+
+enum ofp_calient_optical_port_oper_state(wire_type=uint8_t, bitmask=True){
+    OFPOS_IN_SERVICE = 8,     /*Circuit Port in Service*/
+    OFPOS_OUT_OF_SERVICE = 16 /*Circuit Port out of Service*/
+};
+
+enum ofp_calient_optical_port_oper_capability(wire_type=uint8_t, bitmask=True){
+    OFPCS_NoHardware = 1,  /* when port is not in connection */
+    OFPCS_Ok = 2,          /* port is in Connection which is made successfully */
+    OFPCS_Failed = 3,      /* when port is in Connection which is Failed */
+    OFPCS_Initializing = 4,/* when port is in Connection which is being made */
+};
+
+
+
+
+
+struct of_calient_port_desc_prop_optical : of_calient_port_desc_prop{
+    uint16_t type == 2; /* OFPPDPT_OPTICAL_CIRCUIT */
+    uint16_t length;    /* Length in bytes of this property. */
+    enum ofp_calient_optical_port_admin_state in_admin_status;
+    enum ofp_calient_optical_port_oper_state  in_oper_status;
+    enum ofp_calient_optical_port_oper_capability in_oper_capability;
+    enum ofp_calient_optical_port_admin_state out_admin_status;
+    enum ofp_calient_optical_port_oper_state  out_oper_status;
+    enum ofp_calient_optical_port_oper_capability out_oper_capability;
+    of_str6_t inport_power;       /* Input Port Power */
+    of_str6_t outport_power;      /* Output Port Power */
+    pad(2);
+    uint64_t in_peer_node;        /* Peer node datapath id connected to the input optical port */
+    uint64_t out_peer_node;       /* Peer node datapath id connected to the output optical port */
+    uint16_t in_peer_port;        /* Peer port number connected to the input optical port */
+    uint16_t out_peer_port;       /* Peer port number connected to the output optical port */
+    pad(4);
+    of_str32_t in_circuit_id;     /* Circuit Id associated with the input port */
+    of_str32_t out_circuit_id;    /* Circuit id associated with the output port */
+    of_str64_t in_alias;          /* Alias(name) for the input port */
+    of_str64_t out_alias;         /* Alias(name) for the output port */
+};
+
+struct of_calient_port_desc_stats_entry {
+    uint16_t length;
+    pad(2);
+    of_port_no_t port_no;
+    of_mac_addr_t hw_addr;
+    pad(2);
+    of_port_name_t name; /* Not used.NULL */
+    uint32_t config;     /* Not used. Always 0. */
+    uint32_t state;      /* Not used. Always 0. */
+    list(of_calient_port_desc_prop_t) properties;
+};
+
+struct of_calient_port_desc_stats_reply : of_calient_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 == 0x0080F958;
+    uint32_t subtype == 1;
+    list(of_calient_port_desc_stats_entry_t)port_desc;
+};
+
+
diff --git a/openflow_input/calient_port_stats b/openflow_input/calient_port_stats
new file mode 100644
index 0000000..2d2e8ea
--- /dev/null
+++ b/openflow_input/calient_port_stats
@@ -0,0 +1,54 @@
+#version 4
+
+struct of_calient_port_stats_request : of_calient_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 == 0x0080F958;
+    uint32_t subtype == 3;
+    of_port_no_t port_no;
+    pad(4);
+};
+
+
+struct of_calient_port_stats_entry {
+    uint16_t length;
+    pad(2);
+    of_port_no_t port_no;
+    enum ofp_calient_optical_port_admin_state in_admin_status;        /* Input port admin status */
+    enum ofp_calient_optical_port_oper_state in_oper_status;          /* Input port operational status */
+    enum ofp_calient_optical_port_oper_capability in_oper_capability; /* Input port operational capability */
+    enum ofp_calient_ocs_alarm in_alarm;/* Alarm on Input port */
+    of_str6_t inport_power;     /* Input port power */
+    pad(2);
+    of_str6_t outport_power;    /* Output port power */
+    pad(2);
+    enum ofp_calient_optical_port_admin_state out_admin_status;       /* Output port Admin status */
+    enum ofp_calient_optical_port_oper_state out_oper_status;         /* Output port operational status */
+    enum ofp_calient_optical_port_oper_capability out_oper_capability;/* Output port operational capability */
+    enum ofp_calient_ocs_alarm out_alarm;/* Alarm on Output port */
+    pad(4);
+    of_str32_t in_circuit_id;   /* Circuit id associated with the input port */
+    of_str32_t out_circuit_id;  /* Circuit id associated with the output port */
+};
+
+struct of_calient_port_stats_reply : of_calient_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 == 0x0080F958;
+    uint32_t subtype == 3;
+    uint16_t data_length;
+    pad(6);
+    list(of_calient_port_stats_entry_t) entries;
+};
+
+
diff --git a/py_gen/oftype.py b/py_gen/oftype.py
index 76eebd0..6c13015 100644
--- a/py_gen/oftype.py
+++ b/py_gen/oftype.py
@@ -132,6 +132,8 @@
     'of_serial_num_t': 32,
     'of_desc_str_t': 256,
     'of_str64_t': 64,
+    'of_str32_t': 32,
+    'of_str6_t': 6,
 }
 
 for (cls, length) in fixed_length_strings.items():
diff --git a/wireshark_gen/field_info.py b/wireshark_gen/field_info.py
index bc11170..3158697 100644
--- a/wireshark_gen/field_info.py
+++ b/wireshark_gen/field_info.py
@@ -40,6 +40,8 @@
     "of_desc_str_t": "stringz",
     "of_serial_num_t": "stringz",
     "of_str64_t": "stringz",
+    "of_str32_t": "stringz",
+    "of_str6_t": "stringz",
     "of_octets_t": "bytes",
     "of_port_no_t": "uint32",
     "of_port_desc_t": "stringz",
@@ -69,6 +71,8 @@
     "of_desc_str_t": "NONE",
     "of_serial_num_t": "NONE",
     "of_str64_t": "NONE",
+    "of_str32_t": "NONE",
+    "of_str6_t": "NONE",
     "of_octets_t": "NONE",
     "of_port_no_t": "DEC",
     "of_port_desc_t": "NONE",
diff --git a/wireshark_gen/templates/_oftype_readers.lua b/wireshark_gen/templates/_oftype_readers.lua
index 9695c59..700b236 100644
--- a/wireshark_gen/templates/_oftype_readers.lua
+++ b/wireshark_gen/templates/_oftype_readers.lua
@@ -139,6 +139,14 @@
     read_scalar(reader, subtree, field_name, 64)
 end
 
+function read_of_str32_t(reader, version, subtree, field_name)
+    read_scalar(reader, subtree, field_name, 32)
+end
+
+function read_of_str6_t(reader, version, subtree, field_name)
+    read_scalar(reader, subtree, field_name, 6)
+end
+
 function read_of_port_desc_t(reader, version, subtree, field_name)
     if reader.is_empty() then
         return