Merge remote-tracking branch 'origin/master' into bsn_det_vport
Conflicts:
loxi_front_end/type_maps.py
openflow_input/bsn_l2_table
diff --git a/c_gen/c_test_gen.py b/c_gen/c_test_gen.py
index 3609f98..fe7a41d 100644
--- a/c_gen/c_test_gen.py
+++ b/c_gen/c_test_gen.py
@@ -92,7 +92,10 @@
# Non-scalars; more TBD
of_octets_t="octets",
of_meter_features_t="features",
- of_match_t="match")
+ of_match_t="match",
+ # BSN extensions
+ of_bsn_vport_q_in_q_t="vport",
+ )
if m_type.find("of_list_") == 0:
return "list"
diff --git a/c_gen/templates/loci_show.h b/c_gen/templates/loci_show.h
index 3d27827..a28a7d4 100644
--- a/c_gen/templates/loci_show.h
+++ b/c_gen/templates/loci_show.h
@@ -109,6 +109,14 @@
#define LOCI_SHOW_u8_ip_proto(writer, cookie, val) LOCI_SHOW_u8(writer, cookie, val)
#define LOCI_SHOW_u64_metadata(writer, cookie, val) LOCI_SHOW_x64(writer, cookie, val)
#define LOCI_SHOW_u8_enabled(writer, cookie, val) LOCI_SHOW_u8(writer, cookie, val)
+#define LOCI_SHOW_u32_vport_no(writer, cookie, val) LOCI_SHOW_u32(writer, cookie, val)
+#define LOCI_SHOW_u32_port_no(writer, cookie, val) LOCI_SHOW_u32(writer, cookie, val)
+#define LOCI_SHOW_u16_ingress_tpid(writer, cookie, val) LOCI_SHOW_x16(writer, cookie, val)
+#define LOCI_SHOW_u16_egress_tpid(writer, cookie, val) LOCI_SHOW_x16(writer, cookie, val)
+#define LOCI_SHOW_u16_ingress_vlan_id(writer, cookie, val) LOCI_SHOW_u16(writer, cookie, val)
+#define LOCI_SHOW_u16_egress_vlan_id(writer, cookie, val) LOCI_SHOW_u16(writer, cookie, val)
+#define LOCI_SHOW_u32_enabled(writer, cookie, val) LOCI_SHOW_u32(writer, cookie, val)
+#define LOCI_SHOW_u32_enable(writer, cookie, val) LOCI_SHOW_u32(writer, cookie, val)
diff --git a/loxi_front_end/translation.py b/loxi_front_end/translation.py
index 5f62a0a..b1b3864 100644
--- a/loxi_front_end/translation.py
+++ b/loxi_front_end/translation.py
@@ -124,5 +124,5 @@
for id_from, id_to in entry.items():
if re.match(id_from, ident):
return re.sub(id_from, id_to, ident)
- return None
+ return ident
diff --git a/loxi_front_end/type_maps.py b/loxi_front_end/type_maps.py
index 64cb40a..1b30c1f 100644
--- a/loxi_front_end/type_maps.py
+++ b/loxi_front_end/type_maps.py
@@ -83,6 +83,25 @@
of_g.VERSION_1_3:dict()
}
+bsn_vport_types = {
+ # version 1.0
+ of_g.VERSION_1_0:dict(
+ q_in_q = 0,
+ ),
+ # version 1.1
+ of_g.VERSION_1_1:dict(
+ q_in_q = 0,
+ ),
+ # version 1.2
+ of_g.VERSION_1_2:dict(
+ q_in_q = 0,
+ ),
+ # version 1.3
+ of_g.VERSION_1_3:dict(
+ q_in_q = 0,
+ )
+ }
+
oxm_types = {
of_g.VERSION_1_0:dict(),
of_g.VERSION_1_1:dict(),
@@ -120,7 +139,9 @@
of_queue_prop = queue_prop_types,
of_hello_elem = hello_elem_types,
of_table_feature_prop = table_feature_prop_types,
- of_meter_band = meter_band_types
+ of_meter_band = meter_band_types,
+ # BSN specific inheritance extensions
+ of_bsn_vport = bsn_vport_types
)
def class_is_virtual(cls):
diff --git a/of_g.py b/of_g.py
index db6bc65..bc9888f 100644
--- a/of_g.py
+++ b/of_g.py
@@ -219,6 +219,13 @@
4: "of_port_desc_t",
"short_name":"port_desc"
},
+ of_bsn_vport_t = {
+ 1: "of_bsn_vport_t",
+ 2: "of_bsn_vport_t",
+ 3: "of_bsn_vport_t",
+ 4: "of_bsn_vport_t",
+ "short_name":"bsn_vport"
+ },
of_fm_cmd_t = { # Flow mod command went from u16 to u8
1: "uint16_t",
2: "uint8_t",
diff --git a/openflow_input/bsn_bw b/openflow_input/bsn_bw
new file mode 100644
index 0000000..e0ff3e3
--- /dev/null
+++ b/openflow_input/bsn_bw
@@ -0,0 +1,90 @@
+// 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 any
+
+struct of_bsn_bw_enable_set_request {
+ uint8_t version;
+ uint8_t type == 4;
+ uint16_t length;
+ uint32_t xid;
+ uint32_t experimenter == 0x5c16c7;
+ uint32_t subtype == 18;
+ uint32_t enable; // 0 to disable the extension, 1 to enable it
+};
+
+struct of_bsn_bw_enable_set_reply {
+ uint8_t version;
+ uint8_t type == 4;
+ uint16_t length;
+ uint32_t xid;
+ uint32_t experimenter == 0x5c16c7;
+ uint32_t subtype == 23;
+ uint32_t enable; // Resulting state, 0 disabled, 1 enabled
+ uint32_t status; // Result code: 0 success
+};
+
+struct of_bsn_bw_enable_get_request {
+ uint8_t version;
+ uint8_t type == 4;
+ uint16_t length;
+ uint32_t xid;
+ uint32_t experimenter == 0x5c16c7;
+ uint32_t subtype == 19;
+};
+
+struct of_bsn_bw_enable_get_reply {
+ uint8_t version;
+ uint8_t type == 4;
+ uint16_t length;
+ uint32_t xid;
+ uint32_t experimenter == 0x5c16c7;
+ uint32_t subtype == 20;
+ uint32_t enabled; // 0 if feature is disabled; 1 if feature enabled
+};
+
+struct of_bsn_bw_clear_data_request {
+ uint8_t version;
+ uint8_t type == 4;
+ uint16_t length;
+ uint32_t xid;
+ uint32_t experimenter == 0x5c16c7;
+ uint32_t subtype == 21;
+};
+
+struct of_bsn_bw_clear_data_reply {
+ uint8_t version;
+ uint8_t type == 4;
+ uint16_t length;
+ uint32_t xid;
+ uint32_t experimenter == 0x5c16c7;
+ uint32_t subtype == 22;
+ uint32_t status; // Result code, 0 success
+};
diff --git a/openflow_input/bsn_l2_table b/openflow_input/bsn_l2_table
index 1fb48b6..e3938a8 100644
--- a/openflow_input/bsn_l2_table
+++ b/openflow_input/bsn_l2_table
@@ -28,7 +28,7 @@
#version 1
// BSN L2 table configuration messages
-struct of_bsn_set_l2_table {
+struct of_bsn_set_l2_table_request {
uint8_t version;
uint8_t type == 4;
uint16_t length;
@@ -41,6 +41,19 @@
uint8_t[4] pad;
};
+struct of_bsn_set_l2_table_reply {
+ uint8_t version;
+ uint8_t type == 4;
+ uint16_t length;
+ uint32_t xid;
+ uint32_t experimenter == 0x5c16c7;
+ uint32_t subtype == 24;
+ uint8_t l2_table_enable; // Resulting state: 1 == enabled, 0 == disabled
+ uint8_t pad;
+ uint16_t l2_table_priority; // priority used, must match request if ok
+ uint32_t status; // 0 means success
+};
+
struct of_bsn_get_l2_table_request {
uint8_t version;
uint8_t type == 4;
diff --git a/openflow_input/bsn_vport b/openflow_input/bsn_vport
new file mode 100644
index 0000000..cb197dd
--- /dev/null
+++ b/openflow_input/bsn_vport
@@ -0,0 +1,95 @@
+// 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 any
+
+// When the ingress or egress VID has this value, no outer tag should be used.
+// In this case, the corresponding TPID is ignored.
+
+enum ofp_bsn_vport_q_in_q_untagged {
+ OF_BSN_VPORT_Q_IN_Q_UNTAGGED = 0xffff,
+};
+
+// BSN Virtual port object header
+// FIXME For now, inheritance is not exercised. See below.
+struct of_bsn_vport {
+ uint16_t type; /* Discriminate virtual port type */
+ uint16_t length; /* Length in bytes of this structure with this header */
+ /* Remainder of data is specific to the port type */
+};
+
+
+// Q-in-Q virtual port specification
+
+struct of_bsn_vport_q_in_q {
+ uint16_t type == 0;
+ uint16_t length; /* 16 */
+ uint32_t port_no; /* OF port number of parent; usually phys port */
+ uint16_t ingress_tpid;
+ uint16_t ingress_vlan_id;
+ uint16_t egress_tpid;
+ uint16_t egress_vlan_id;
+};
+
+// Request from controller to switch to create vport
+struct of_bsn_virtual_port_create_request {
+ uint8_t version;
+ uint8_t type == 4;
+ uint16_t length;
+ uint32_t xid;
+ uint32_t experimenter == 0x5c16c7;
+ uint32_t subtype == 15;
+ // FIXME This should be an instance of the inheritance superclass
+ of_bsn_vport_q_in_q_t vport; // Description of vport to create
+ // Additional data follows depending on header type
+};
+
+// Reply from switch to controller indicating port number created
+// vport_no must be 16 bits to be compatible with 1.0
+struct of_bsn_virtual_port_create_reply {
+ uint8_t version;
+ uint8_t type == 4;
+ uint16_t length;
+ uint32_t xid; // Must match create_request
+ uint32_t experimenter == 0x5c16c7;
+ uint32_t subtype == 16;
+ uint32_t vport_no; // The OF port number created. 16-bits for OF 1.0
+};
+
+// Request from controller to switch to remove a vport
+struct of_bsn_virtual_port_remove {
+ uint8_t version;
+ uint8_t type == 4;
+ uint16_t length;
+ uint32_t xid;
+ uint32_t experimenter == 0x5c16c7;
+ uint32_t subtype == 17;
+ uint32_t vport_no; // The OF port number to be removed
+};