Loxi support for Optical Transport extensions, onos-2472

Change-Id: I69b9a8839fd899aec531f68103b448dd93cbbe4a
diff --git a/openflow_input/circuit b/openflow_input/circuit
index 0f436a4..7e02014 100644
--- a/openflow_input/circuit
+++ b/openflow_input/circuit
@@ -19,7 +19,7 @@
 };
 
 /* Layer classes (families) supported for optical transport port. */
-enum ofp_port_optical_transport_layer_class {
+enum ofp_port_optical_transport_layer_class(wire_type=uint8_t){
     OFPPOTL_PORT   = 1,           /* Class of base port layer signal types */
     OFPPOTL_OCH    = 2,           /* Class of OCH layer signal types*/
     OFPPOTL_ODU    = 3,           /* Class of ODU layer signal types*/
diff --git a/openflow_input/optical_tras_ext b/openflow_input/optical_tras_ext
new file mode 100644
index 0000000..ddb08df
--- /dev/null
+++ b/openflow_input/optical_tras_ext
@@ -0,0 +1,212 @@
+/* This file input supports the Optical Transport Protocol Extentions - version 1.0 */
+
+#version 4
+/*Supported signal types for layer class OFPOTPL_ODU */
+enum ofp_odu_signal_type (wire_type=uint8_t) {
+    OFPODUT_ODU1           = 1,
+    OFPODUT_ODU2           = 2,
+    OFPODUT_ODU3           = 3,
+    OFPODUT_ODU4           = 4,
+    OFPODUT_ODU0           = 10,
+    OFPODUT_ODU2E          = 11,
+    OFPODUT_ODUfCBR        = 20,
+    OFPODUT_ODUfGFPfHAO    = 21,
+    OFPODUT_ODUfGFPf       = 22,
+};
+
+
+//enum ofp_experimenter_multipart_type_exp (wire_type=uint32_t){
+  //OFPEMPTE = 1,
+//};
+
+//enum ofp_port_desc_prop_type_exp (wire_type=uint32_t){
+ //OFPPDPT_OPTICAL_TRAMSPORT = 2,
+//};
+
+/* Supported signal types for layer class OFPPOTL_PORT */
+enum ofp_port_optical_transport_signal_type (wire_type=uint8_t) {
+     OFPPOTST_OTSn = 1,
+     OFPPOTST_OMSn = 2,
+     OFPPOTST_OPSn = 3,
+     OFPPOTST_OPSM = 4,
+     OFPPOTST_OCH  = 5,
+     OFPPOTST_OTU1 = 11,
+     OFPPOTST_OTU2 = 12,
+     OFPPOTST_OTU3 = 13,
+     OFPPOTST_OTU4 = 14,
+};
+
+
+/* Features of optical transport ports available in switch. */
+enum ofp_port_optical_transport_feature_type (wire_type=uint16_t) {
+    OFPPOTFT_OPT_INTERFACE_CLASS = 1,  /* Application code/ID encoding */
+    OFPPOTFT_LAYER_STACK         = 2,  /* Supported signal types and adaptations */
+};
+
+
+/*Supported signal types for layer class OFPOTPL_ODUCLT */
+enum ofp_oduclt_signal_type(wire_type=uint8_t) {
+   OFPODUCLT_STM16 	= 1,
+   OFPODUCLT_STM64  	= 2,
+   OFPODUCLT_STM256 	= 3,
+   OFPODUCLT_STM1       = 4,
+   OFPODUCLT_STM4       = 5,
+   OFPODUCLT_GBE1       = 6,
+   OFPODUCLT_GBE10      = 7,
+   OFPODUCLT_GBE40        = 8,
+   OFPODUCLT_GBE100	  = 9,
+   OFPODUCLT_FC100        = 10, 
+   OFPODUCLT_FC200        = 11,
+   OFPODUCLT_FC400        = 12,
+   OFPODUCLT_FC800        = 13,
+   OFPODUCLT_FC1200       = 14,
+   OFPODUCLT_GPON         = 15,
+   OFPODUCLT_XGPON        = 16,
+   OFPODUCLT_IB_SDR       = 17,
+   OFPODUCLT_IB_DDR       = 18,
+   OFPODUCLT_IB_QDR       = 19,
+   OFPODUCLT_SBCON_ESCON  = 20,
+   OFPODUCLT_DVBASI       = 21,
+   OFPODUCLT_SDI          = 22,
+   OFPODUCLT_SDI1G5       = 23,
+   OFPODUCLT_SDI3G        = 24,
+   OFPODUCLT_ATM          = 25,
+   OFPODUCLT_ETH          = 26,
+   OFPODUCLT_MPLS         = 27,
+   OFPODUCLT_IP           = 28,
+};
+
+/* Supported adaptations for optical transport port layer stack*/
+enum ofp_adaptations_type (wire_type=uint8_t){
+   OFPADAPT_OTS_OMS    = 1,
+   OFPADAPT_OMS_OCH    = 2,
+   OFPADAPT_OPS_OCHr   = 3,
+   OFPADAPT_OPSM_OTUk  = 4,
+   OFPADAPT_OCH_OTUk   = 5,
+   OFPADAPT_ODUk_ODUij    = 6,
+   OFPADAPT_ODUk_ODUj21   = 7,
+   OFPADAPT_ODUkh_ODUj21  = 8,
+   OFPADAPT_ODU0_CBRx     = 9,
+   OFPADAPT_ODUk_CBRx     = 10,
+   OFPADAPT_ODUk_CBRxg    = 11,
+   OFPADAPT_ODUk_RSn      = 12,
+   OFPADAPT_ODUk_ATM      = 13,
+   OFPADAPT_ODUk_ETH      = 14,
+   OFPADAPT_ODUkh_ETH     = 15,
+   OFPADAPT_ODUk_ETHPPOS  = 16,
+};
+
+struct of_oxm_exp_odu_sigtype : of_oxm {
+    uint32_t type_len == 0xFFFF0401; 
+    uint32_t experimenter == 0xFF000007;
+    uint8_t  value;
+};
+
+struct of_oxm_exp_odu_sig_id : of_oxm {
+     uint32_t type_len == 0xFFFF0610; 
+     uint32_t experimenter == 0xFF000007;
+     of_odu_sig_id_t value;// size of this struct is 16 bytes 2+2+10+2(pad)   
+}; 
+ 
+//This struct defenition is unnecessury for the openflow java ("make java" command )
+//It is reqiured for wireshark dissector ("make wireshark" command) 
+struct of_odu_sig_id_t { 
+    uint16_t tpn;           //Tributary Port Number 
+    uint16_t length;         // Number of Tributary Slots included in tsmap,
+			    // based on the Server ODU type and TS Granularity
+    of_octets_t tsmap;       //tsmap;
+};
+ 
+struct of_oxm_exp_och_sigtype : of_oxm {
+    uint32_t type_len == 0xFFFF0801; 
+    uint32_t experimenter == 0xFF000007;
+    uint8_t  value;
+};
+ 
+struct of_oxm_exp_och_sig_id : of_oxm {
+     uint32_t type_len == 0xFFFF0A06; 
+     uint32_t experimenter == 0xFF000007;
+     of_och_sig_id_t value;   
+}; 
+
+
+// open flow extention - support port description Extentions for OTN Ports 
+struct of_exp_port_desc_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 == 0xFF000007;
+    uint32_t subtype == 1;//enum ofp_experimenter_multipart_type exp_type == 1;
+};
+
+struct of_exp_port_desc_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 == 0xFF000007;
+    uint32_t subtype == 1;//enum ofp_experimenter_multipart_type subtype == 1;
+    list(of_exp_port_t) entries;
+};
+
+struct of_exp_port {
+  of_port_no_t port_no;
+  uint16_t length;
+  pad(2);
+  of_mac_addr_t hw_addr;
+  pad(2);
+  of_port_name_t name;
+  enum ofp_port_config config;
+  enum ofp_port_state state;
+  list(of_exp_port_desc_prop_optical_transport_t) properties;
+};
+
+struct of_exp_port_des_prop_header {
+  uint16_t type == 2; //enum ofp_port_desc_prop_type_exp type == 2;
+  uint16_t length;
+};
+
+struct of_exp_port_desc_prop_optical_transport // : of_exp_port_des_prop_header 
+{
+  uint16_t type == 2;
+  uint16_t length; // length in bytes of this property
+  enum ofp_port_optical_transport_signal_type  port_signal_type;
+                       //base port layer signal type (enum ofp_port_optical_transport_signal_type) 
+  uint8_t reserved;
+  pad(2);
+  list(of_exp_port_optical_transport_layer_stack_t) features; // list of of_port_optical_transport_feature_header 
+};
+
+struct of_exp_port_optical_transport_feature_header {
+  uint16_t feature_type == ?; // from enum ofp_port_optical_transport_feature_type
+  uint16_t length;
+};
+
+/* OTN Layer Stack Feature Encoding */ //of_port_optical_transport_layer_stack (in circuit ) 
+struct of_exp_port_optical_transport_layer_stack// : of_exp_port_optical_transport_feature_header
+{
+  uint16_t feature_type == 2; /* Set to OFPOTPF_LAYER_STACK */
+  uint16_t length;            /* length of feature excluding padding*/
+  pad(4);                     /* Zero bytes-see above for sizing */
+  list(of_exp_port_optical_transport_layer_entry_t) value; /* 0 or more fields */
+};
+
+/*OTN Layer Stack Entry Encoding */ // can be found in circut of_port_optical_transport_layer_entry
+struct of_exp_port_optical_transport_layer_entry {
+  enum ofp_port_optical_transport_layer_class layer_class;    /* OFPPOTL_* */
+  uint8_t signal_type;    /*OFP(OTP/OCH/ODU/ODUCL)T_*/
+  enum ofp_adaptations_type adaptation;/* OFPADAPT_*/
+  pad(5);         /* Align to 64-bit boundary */
+};
+
+
+
+
+