summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorIWASE Yusuke <iwase.yusuke0@gmail.com>2016-01-18 10:56:15 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2016-01-19 10:52:07 +0900
commitaa3a2d594976cbc3d640b4ef1dd50b6bc0e01ef9 (patch)
tree6d92d4b347e5765bbb6fefcb6d6829495c18944b
parent7d626a55b2ff745cdabd3216215a5240a56d1174 (diff)
packet_data_generator2: Add some OFP13/15 messages
Add the following OFP13/15 Messages. - OFP13/15 Handshake Implemented: OFPT_FEATURES_REPLY TODO: OFPT_FEATURES_REQUEST - OFP13/15 Switch Configuration Messages Implemented: OFPT_SET_CONFIG, OFPT_GET_CONFIG_REPLY TODO: OFPT_GET_CONFIG_REQUEST Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r--ryu/tests/packet_data_generator2/gen.c79
1 files changed, 79 insertions, 0 deletions
diff --git a/ryu/tests/packet_data_generator2/gen.c b/ryu/tests/packet_data_generator2/gen.c
index 941016df..dbdcf4c2 100644
--- a/ryu/tests/packet_data_generator2/gen.c
+++ b/ryu/tests/packet_data_generator2/gen.c
@@ -69,6 +69,65 @@ fill_match(struct match *match)
*/
/*
+ * Handshake
+ */
+
+struct ofpbuf *
+features_reply(enum ofputil_protocol proto)
+{
+ struct ofputil_switch_features sf;
+
+ memset(&sf, 0, sizeof(sf));
+ sf.datapath_id = 1;
+ sf.n_buffers = 255;
+ sf.n_tables = 255;
+ sf.auxiliary_id = 0;
+ sf.capabilities = OFPUTIL_C_FLOW_STATS | OFPUTIL_C_TABLE_STATS |
+ OFPUTIL_C_PORT_STATS | OFPUTIL_C_GROUP_STATS |
+ OFPUTIL_C_QUEUE_STATS;
+ // sf.ofpacts is for only OFP10
+
+ ovs_be32 xid = 0;
+
+ return ofputil_encode_switch_features(&sf, proto, xid);
+}
+
+/*
+ * Switch Configuration
+ */
+
+struct ofpbuf *
+set_config(enum ofputil_protocol proto)
+{
+ struct ofputil_switch_config sc;
+
+ memset(&sc, 0, sizeof(sc));
+ sc.frag = OFPUTIL_FRAG_NORMAL;
+ // sc.invalid_ttl_to_controller is for only OFP11 and OFP12
+ sc.miss_send_len = 128; // The default of OpenFlow Spec
+
+ return ofputil_encode_set_config(
+ &sc, ofputil_protocol_to_ofp_version(proto));
+}
+
+struct ofpbuf *
+get_config_reply(enum ofputil_protocol proto)
+{
+ struct ofputil_switch_config sc;
+ struct ofp_header oh;
+
+ memset(&oh, 0, sizeof(oh));
+ oh.xid = 0;
+ oh.version = ofputil_protocol_to_ofp_version(proto);
+ memset(&sc, 0, sizeof(sc));
+ sc.frag = OFPUTIL_FRAG_NORMAL;
+ // sc.invalid_ttl_to_controller is for only OFP11 and OFP12
+ sc.miss_send_len = 128; // The default of OpenFlow Spec
+
+ return ofputil_encode_get_config_reply(&oh, &sc);
+}
+
+/*
* Modify State Messages
*/
@@ -633,6 +692,26 @@ struct message {
const struct message messages[] = {
/* Controller-to-Switch Messages */
+ /* Handshake */
+ // TODO:
+ // The following messages are not supported in Open vSwitch 2.5.90,
+ // re-generate the packet data, later.
+ // - OFP10+ Features Request Message
+ // M(features_request,
+ // ((const struct protocol_version *[]){&p13, &p15, NULL})),
+ M(features_reply,
+ ((const struct protocol_version *[]){&p13, &p15, NULL})),
+ /* Switch Configuration */
+ // TODO:
+ // The following messages are not supported in Open vSwitch 2.5.90,
+ // re-generate the packet data, later.
+ // - OFP10+ Get Switch Configuration Request Message
+ M(set_config,
+ ((const struct protocol_version *[]){&p13, &p15, NULL})),
+ // M(get_config_request,
+ // ((const struct protocol_version *[]){&p13, &p15, NULL})),
+ M(get_config_reply,
+ ((const struct protocol_version *[]){&p13, &p15, NULL})),
/* Modify State Messages */
// TODO:
// The following messages are not supported in Open vSwitch 2.4.90,