diff options
author | Minoru TAKAHASHI <takahashi.minoru7@gmail.com> | 2016-05-10 14:29:47 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2016-05-13 22:26:03 +0900 |
commit | 4bec6aca3d4b8201cc21296ff47448fce4580689 (patch) | |
tree | 2336c4066475c7fb0f4ccb5531944e144cf419dd | |
parent | 255fd1564e2703e7dec96c7e453f4f781defc2cb (diff) |
test_ofctl: Add test cases for OpenFlow 1.5
Signed-off-by: Minoru TAKAHASHI <takahashi.minoru7@gmail.com>
Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
31 files changed, 1210 insertions, 1 deletions
diff --git a/ryu/tests/unit/lib/ofctl_json/of15/libofproto-OFP15-aggregate_stats_reply.packet.json b/ryu/tests/unit/lib/ofctl_json/of15/libofproto-OFP15-aggregate_stats_reply.packet.json new file mode 100644 index 00000000..ac4f93c4 --- /dev/null +++ b/ryu/tests/unit/lib/ofctl_json/of15/libofproto-OFP15-aggregate_stats_reply.packet.json @@ -0,0 +1,10 @@ +{ + "1": [ + { + "length": 16, + "stats": { + "flow_count": 1 + } + } + ] +} diff --git a/ryu/tests/unit/lib/ofctl_json/of15/libofproto-OFP15-aggregate_stats_request.packet.json b/ryu/tests/unit/lib/ofctl_json/of15/libofproto-OFP15-aggregate_stats_request.packet.json new file mode 100644 index 00000000..845af65b --- /dev/null +++ b/ryu/tests/unit/lib/ofctl_json/of15/libofproto-OFP15-aggregate_stats_request.packet.json @@ -0,0 +1,11 @@ +{ + "flow": { + "cookie": 0, + "cookie_mask": 0, + "flags": 0, + "match": {}, + "out_group": 4294967295, + "out_port": 4294967295, + "table_id": 255 + } +} diff --git a/ryu/tests/unit/lib/ofctl_json/of15/libofproto-OFP15-desc_reply.packet.json b/ryu/tests/unit/lib/ofctl_json/of15/libofproto-OFP15-desc_reply.packet.json new file mode 100644 index 00000000..8fc54b74 --- /dev/null +++ b/ryu/tests/unit/lib/ofctl_json/of15/libofproto-OFP15-desc_reply.packet.json @@ -0,0 +1,9 @@ +{ + "1": { + "dp_desc": "dp", + "hw_desc": "hw", + "mfr_desc": "mfr", + "serial_num": "serial", + "sw_desc": "sw" + } +} diff --git a/ryu/tests/unit/lib/ofctl_json/of15/libofproto-OFP15-experimenter.packet.json b/ryu/tests/unit/lib/ofctl_json/of15/libofproto-OFP15-experimenter.packet.json new file mode 100644 index 00000000..c655f8f0 --- /dev/null +++ b/ryu/tests/unit/lib/ofctl_json/of15/libofproto-OFP15-experimenter.packet.json @@ -0,0 +1,8 @@ +{ + "exp": { + "data": "bmF6bw==", + "data_type": "base64", + "exp_type": 123456789, + "experimenter": 98765432 + } +} diff --git a/ryu/tests/unit/lib/ofctl_json/of15/libofproto-OFP15-flow_desc_reply.packet.json b/ryu/tests/unit/lib/ofctl_json/of15/libofproto-OFP15-flow_desc_reply.packet.json new file mode 100644 index 00000000..4e12f857 --- /dev/null +++ b/ryu/tests/unit/lib/ofctl_json/of15/libofproto-OFP15-flow_desc_reply.packet.json @@ -0,0 +1,26 @@ +{ + "1": [ + { + "cookie": 1234605616436508552, + "flags": 1, + "hard_timeout": 255, + "idle_timeout": 255, + "importance": 43690, + "instructions": [ + { + "table_id": 2, + "type": "GOTO_TABLE" + } + ], + "length": 64, + "match": { + "in_port": 1 + }, + "priority": 5, + "stats": { + "flow_count": 1 + }, + "table_id": 1 + } + ] +} diff --git a/ryu/tests/unit/lib/ofctl_json/of15/libofproto-OFP15-flow_desc_request.packet.json b/ryu/tests/unit/lib/ofctl_json/of15/libofproto-OFP15-flow_desc_request.packet.json new file mode 100644 index 00000000..f59aa0b2 --- /dev/null +++ b/ryu/tests/unit/lib/ofctl_json/of15/libofproto-OFP15-flow_desc_request.packet.json @@ -0,0 +1,13 @@ +{ + "flow": { + "cookie": 1234605616436508552, + "cookie_mask": 18446744073709551615, + "flags": 0, + "match": { + "in_port": 1 + }, + "out_group": 4294967295, + "out_port": 4294967295, + "table_id": 1 + } +} diff --git a/ryu/tests/unit/lib/ofctl_json/of15/libofproto-OFP15-flow_mod_no_nx.packet.json b/ryu/tests/unit/lib/ofctl_json/of15/libofproto-OFP15-flow_mod_no_nx.packet.json new file mode 100644 index 00000000..72054e33 --- /dev/null +++ b/ryu/tests/unit/lib/ofctl_json/of15/libofproto-OFP15-flow_mod_no_nx.packet.json @@ -0,0 +1,103 @@ +{ + "cmd": 0, + "flow": { + "instructions": [ + { + "actions": [ + { + "field": "vlan_vid", + "type": "SET_FIELD", + "value": 258 + }, + { + "type": "COPY_TTL_OUT" + }, + { + "type": "COPY_TTL_IN" + }, + { + "type": "COPY_TTL_IN" + }, + { + "type": "POP_PBB" + }, + { + "ethertype": 4660, + "type": "PUSH_PBB" + }, + { + "ethertype": 39030, + "type": "POP_MPLS" + }, + { + "ethertype": 34887, + "type": "PUSH_MPLS" + }, + { + "type": "POP_VLAN" + }, + { + "ethertype": 33024, + "type": "PUSH_VLAN" + }, + { + "type": "DEC_MPLS_TTL" + }, + { + "mpls_ttl": 10, + "type": "SET_MPLS_TTL" + }, + { + "type": "DEC_NW_TTL" + }, + { + "nw_ttl": 10, + "type": "SET_NW_TTL" + }, + { + "data": "AAECAwQFBgc=", + "data_type": "base64", + "experimenter": 101, + "type": "EXPERIMENTER" + }, + { + "queue_id": 3, + "type": "SET_QUEUE" + }, + { + "group_id": 99, + "type": "GROUP" + }, + { + "max_len": 65535, + "port": 6, + "type": "OUTPUT" + } + ], + "type": "WRITE_ACTIONS" + }, + { + "actions": [ + { + "field": "eth_src", + "type": "SET_FIELD", + "value": "01:02:03:04:05:06" + }, + { + "field": "pbb_uca", + "type": "SET_FIELD", + "value": 1 + } + ], + "type": "APPLY_ACTIONS" + } + ], + "buffer_id": 65535, + "importance": 0, + "match": { + "eth_dst": "f2:0b:a4:7d:f8:ea" + }, + "priority": 123, + "table_id": 1 + } +} diff --git a/ryu/tests/unit/lib/ofctl_json/of15/libofproto-OFP15-flow_stats_reply.packet.json b/ryu/tests/unit/lib/ofctl_json/of15/libofproto-OFP15-flow_stats_reply.packet.json new file mode 100644 index 00000000..385f256b --- /dev/null +++ b/ryu/tests/unit/lib/ofctl_json/of15/libofproto-OFP15-flow_stats_reply.packet.json @@ -0,0 +1,16 @@ +{ + "1": [ + { + "length": 40, + "match": { + "in_port": 1 + }, + "priority": 1, + "reason": 0, + "stats": { + "flow_count": 1 + }, + "table_id": 1 + } + ] +} diff --git a/ryu/tests/unit/lib/ofctl_json/of15/libofproto-OFP15-flow_stats_request.packet.json b/ryu/tests/unit/lib/ofctl_json/of15/libofproto-OFP15-flow_stats_request.packet.json new file mode 100644 index 00000000..a42dfef0 --- /dev/null +++ b/ryu/tests/unit/lib/ofctl_json/of15/libofproto-OFP15-flow_stats_request.packet.json @@ -0,0 +1,11 @@ +{ + "flow": { + "cookie": 0, + "cookie_mask": 0, + "flags": 0, + "match": {}, + "out_group": 4294967295, + "out_port": 4294967295, + "table_id": 0 + } +} diff --git a/ryu/tests/unit/lib/ofctl_json/of15/libofproto-OFP15-group_desc_reply.packet.json b/ryu/tests/unit/lib/ofctl_json/of15/libofproto-OFP15-group_desc_reply.packet.json new file mode 100644 index 00000000..b6b75020 --- /dev/null +++ b/ryu/tests/unit/lib/ofctl_json/of15/libofproto-OFP15-group_desc_reply.packet.json @@ -0,0 +1,27 @@ +{ + "1": [ + { + "buckets": [ + { + "actions": [ + { + "max_len": 65509, + "port": 1, + "type": "OUTPUT" + } + ], + "bucket_id": 65535, + "properties": [ + { + "type": "WEIGHT", + "weight": 65535 + } + ] + } + ], + "group_id": 1, + "properties": [], + "type": "SELECT" + } + ] +} diff --git a/ryu/tests/unit/lib/ofctl_json/of15/libofproto-OFP15-group_desc_request.packet.json b/ryu/tests/unit/lib/ofctl_json/of15/libofproto-OFP15-group_desc_request.packet.json new file mode 100644 index 00000000..f25aaff4 --- /dev/null +++ b/ryu/tests/unit/lib/ofctl_json/of15/libofproto-OFP15-group_desc_request.packet.json @@ -0,0 +1,3 @@ +{ + "group_id": 52651 +} diff --git a/ryu/tests/unit/lib/ofctl_json/of15/libofproto-OFP15-group_features_reply.packet.json b/ryu/tests/unit/lib/ofctl_json/of15/libofproto-OFP15-group_features_reply.packet.json new file mode 100644 index 00000000..2a29ac2d --- /dev/null +++ b/ryu/tests/unit/lib/ofctl_json/of15/libofproto-OFP15-group_features_reply.packet.json @@ -0,0 +1,104 @@ +{ + "1": [ + { + "actions": [ + { + "ALL": [ + "OUTPUT", + "COPY_TTL_OUT", + "COPY_TTL_IN", + "SET_MPLS_TTL", + "DEC_MPLS_TTL", + "PUSH_VLAN", + "POP_VLAN", + "PUSH_MPLS", + "POP_MPLS", + "SET_QUEUE", + "GROUP", + "SET_NW_TTL", + "DEC_NW_TTL", + "SET_FIELD" + ] + }, + { + "SELECT": [ + "OUTPUT", + "COPY_TTL_OUT", + "COPY_TTL_IN", + "SET_MPLS_TTL", + "DEC_MPLS_TTL", + "PUSH_VLAN", + "POP_VLAN", + "PUSH_MPLS", + "POP_MPLS", + "SET_QUEUE", + "GROUP", + "SET_NW_TTL", + "DEC_NW_TTL", + "SET_FIELD" + ] + }, + { + "INDIRECT": [ + "OUTPUT", + "COPY_TTL_OUT", + "COPY_TTL_IN", + "SET_MPLS_TTL", + "DEC_MPLS_TTL", + "PUSH_VLAN", + "POP_VLAN", + "PUSH_MPLS", + "POP_MPLS", + "SET_QUEUE", + "GROUP", + "SET_NW_TTL", + "DEC_NW_TTL", + "SET_FIELD" + ] + }, + { + "FF": [ + "OUTPUT", + "COPY_TTL_OUT", + "COPY_TTL_IN", + "SET_MPLS_TTL", + "DEC_MPLS_TTL", + "PUSH_VLAN", + "POP_VLAN", + "PUSH_MPLS", + "POP_MPLS", + "SET_QUEUE", + "GROUP", + "SET_NW_TTL", + "DEC_NW_TTL", + "SET_FIELD" + ] + } + ], + "capabilities": [ + "SELECT_WEIGHT", + "CHAINING" + ], + "max_groups": [ + { + "ALL": 16777216 + }, + { + "SELECT": 16777216 + }, + { + "INDIRECT": 16777216 + }, + { + "FF": 16777216 + } + ], + "types": [ + "ALL", + "SELECT", + "INDIRECT", + "FF" + ] + } + ] +} diff --git a/ryu/tests/unit/lib/ofctl_json/of15/libofproto-OFP15-group_mod.packet.json b/ryu/tests/unit/lib/ofctl_json/of15/libofproto-OFP15-group_mod.packet.json new file mode 100644 index 00000000..eca861ea --- /dev/null +++ b/ryu/tests/unit/lib/ofctl_json/of15/libofproto-OFP15-group_mod.packet.json @@ -0,0 +1,42 @@ +{ + "cmd": 3, + "group": { + "buckets": [ + { + "actions": [ + { + "len": 8, + "type": "POP_VLAN" + }, + { + "field": "ipv4_dst", + "type": "SET_FIELD", + "value": "192.168.2.9" + } + ], + "bucket_id": 305419896, + "properties": [ + { + "length": 8, + "type": "WEIGHT", + "weight": 52428 + }, + { + "length": 8, + "type": "WATCH_PORT", + "watch": 56797 + }, + { + "length": 8, + "type": "WATCH_GROUP", + "watch": 4008636142 + } + ] + } + ], + "command_bucket_id": 3149642683, + "group_id": 2863311530, + "properties": [], + "type": "SELECT" + } +} diff --git a/ryu/tests/unit/lib/ofctl_json/of15/libofproto-OFP15-group_stats_reply.packet.json b/ryu/tests/unit/lib/ofctl_json/of15/libofproto-OFP15-group_stats_reply.packet.json new file mode 100644 index 00000000..1c6f9039 --- /dev/null +++ b/ryu/tests/unit/lib/ofctl_json/of15/libofproto-OFP15-group_stats_reply.packet.json @@ -0,0 +1,19 @@ +{ + "1": [ + { + "bucket_stats": [ + { + "byte_count": 2345, + "packet_count": 234 + } + ], + "byte_count": 12345, + "duration_nsec": 609036000, + "duration_sec": 9, + "group_id": 1, + "length": 56, + "packet_count": 123, + "ref_count": 2 + } + ] +} diff --git a/ryu/tests/unit/lib/ofctl_json/of15/libofproto-OFP15-meter_desc_reply.packet.json b/ryu/tests/unit/lib/ofctl_json/of15/libofproto-OFP15-meter_desc_reply.packet.json new file mode 100644 index 00000000..d5efcd97 --- /dev/null +++ b/ryu/tests/unit/lib/ofctl_json/of15/libofproto-OFP15-meter_desc_reply.packet.json @@ -0,0 +1,19 @@ +{ + "1": [ + { + "bands": [ + { + "burst_size": 10, + "rate": 1000, + "type": "DROP" + } + ], + "flags": [ + "PKTPS", + "BURST", + "STATS" + ], + "meter_id": 100 + } + ] +} diff --git a/ryu/tests/unit/lib/ofctl_json/of15/libofproto-OFP15-meter_features_reply.packet.json b/ryu/tests/unit/lib/ofctl_json/of15/libofproto-OFP15-meter_features_reply.packet.json new file mode 100644 index 00000000..24dac7d4 --- /dev/null +++ b/ryu/tests/unit/lib/ofctl_json/of15/libofproto-OFP15-meter_features_reply.packet.json @@ -0,0 +1,19 @@ +{ + "1": [ + { + "band_types": [ + "DROP", + "DSCP_REMARK" + ], + "capabilities": [ + "KBPS", + "PKTPS", + "BURST", + "STATS" + ], + "max_bands": 255, + "max_color": 0, + "max_meter": 16777216 + } + ] +} diff --git a/ryu/tests/unit/lib/ofctl_json/of15/libofproto-OFP15-meter_mod.packet.json b/ryu/tests/unit/lib/ofctl_json/of15/libofproto-OFP15-meter_mod.packet.json new file mode 100644 index 00000000..1d881209 --- /dev/null +++ b/ryu/tests/unit/lib/ofctl_json/of15/libofproto-OFP15-meter_mod.packet.json @@ -0,0 +1,24 @@ +{ + "cmd": 0, + "meter": { + "bands": [ + { + "burst_size": 10, + "rate": 1000, + "type": "DROP" + }, + { + "burst_size": 10, + "prec_level": 1, + "rate": 1000, + "type": "DSCP_REMARK" + } + ], + "flags": [ + "PKTPS", + "BURST", + "STATS" + ], + "meter_id": 100 + } +} diff --git a/ryu/tests/unit/lib/ofctl_json/of15/libofproto-OFP15-meter_stats_reply.packet.json b/ryu/tests/unit/lib/ofctl_json/of15/libofproto-OFP15-meter_stats_reply.packet.json new file mode 100644 index 00000000..e7f9722b --- /dev/null +++ b/ryu/tests/unit/lib/ofctl_json/of15/libofproto-OFP15-meter_stats_reply.packet.json @@ -0,0 +1,19 @@ +{ + "1": [ + { + "band_stats": [ + { + "byte_band_count": 0, + "packet_band_count": 0 + } + ], + "byte_in_count": 0, + "duration_nsec": 480000, + "duration_sec": 0, + "len": 56, + "meter_id": 100, + "packet_in_count": 0, + "ref_count": 0 + } + ] +} diff --git a/ryu/tests/unit/lib/ofctl_json/of15/libofproto-OFP15-port_desc_reply.packet.json b/ryu/tests/unit/lib/ofctl_json/of15/libofproto-OFP15-port_desc_reply.packet.json new file mode 100644 index 00000000..c2f748a8 --- /dev/null +++ b/ryu/tests/unit/lib/ofctl_json/of15/libofproto-OFP15-port_desc_reply.packet.json @@ -0,0 +1,83 @@ +{ + "1": [ + { + "config": 0, + "hw_addr": "f2:0b:a4:d0:3f:70", + "length": 168, + "name": "Port7", + "port_no": 7, + "properties": [ + { + "advertised": 10240, + "curr": 10248, + "curr_speed": 5000, + "length": 32, + "max_speed": 5000, + "peer": 10248, + "supported": 10248, + "type": "ETHERNET" + }, + { + "length": 40, + "rx_grid_freq_lmda": 1500, + "rx_max_freq_lmda": 2000, + "rx_min_freq_lmda": 1000, + "supported": 1, + "tx_grid_freq_lmda": 1500, + "tx_max_freq_lmda": 2000, + "tx_min_freq_lmda": 1000, + "tx_pwr_max": 2000, + "tx_pwr_min": 1000, + "type": "OPTICAL" + }, + { + "data": [], + "exp_type": 0, + "experimenter": 101, + "length": 12, + "type": "EXPERIMENTER" + }, + { + "data": [ + 1 + ], + "exp_type": 1, + "experimenter": 101, + "length": 16, + "type": "EXPERIMENTER" + }, + { + "data": [ + 1, + 2 + ], + "exp_type": 2, + "experimenter": 101, + "length": 20, + "type": "EXPERIMENTER" + } + ], + "state": 4 + }, + { + "config": 0, + "hw_addr": "f2:0b:a4:7d:f8:ea", + "length": 72, + "name": "Port6", + "port_no": 6, + "properties": [ + { + "advertised": 10240, + "curr": 10248, + "curr_speed": 5000, + "length": 32, + "max_speed": 5000, + "peer": 10248, + "supported": 10248, + "type": "ETHERNET" + } + ], + "state": 4 + } + ] +} diff --git a/ryu/tests/unit/lib/ofctl_json/of15/libofproto-OFP15-port_desc_request.packet.json b/ryu/tests/unit/lib/ofctl_json/of15/libofproto-OFP15-port_desc_request.packet.json new file mode 100644 index 00000000..d0519e83 --- /dev/null +++ b/ryu/tests/unit/lib/ofctl_json/of15/libofproto-OFP15-port_desc_request.packet.json @@ -0,0 +1,3 @@ +{ + "port_no": 48346 +} diff --git a/ryu/tests/unit/lib/ofctl_json/of15/libofproto-OFP15-port_mod.packet.json b/ryu/tests/unit/lib/ofctl_json/of15/libofproto-OFP15-port_mod.packet.json new file mode 100644 index 00000000..be9de69d --- /dev/null +++ b/ryu/tests/unit/lib/ofctl_json/of15/libofproto-OFP15-port_mod.packet.json @@ -0,0 +1,50 @@ +{ + "port_config": { + "config": 0, + "hw_addr": "00:11:00:00:11:11", + "mask": 0, + "port_no": 1, + "properties": [ + { + "advertise": 4096, + "length": 8, + "type": "ETHERNET" + }, + { + "configure": 3, + "fl_offset": 2000, + "freq_lmda": 1500, + "grid_span": 3000, + "length": 24, + "tx_pwr": 300, + "type": "OPTICAL" + }, + { + "data": [], + "exp_type": 0, + "experimenter": 101, + "length": 12, + "type": "EXPERIMENTER" + }, + { + "data": [ + 1 + ], + "exp_type": 1, + "experimenter": 101, + "length": 16, + "type": "EXPERIMENTER" + }, + { + "data": [ + 1, + 2 + ], + "exp_type": 2, + "experimenter": 101, + "length": 20, + "type": "EXPERIMENTER" + } + ] + } +} diff --git a/ryu/tests/unit/lib/ofctl_json/of15/libofproto-OFP15-port_stats_reply.packet.json b/ryu/tests/unit/lib/ofctl_json/of15/libofproto-OFP15-port_stats_reply.packet.json new file mode 100644 index 00000000..821c9b72 --- /dev/null +++ b/ryu/tests/unit/lib/ofctl_json/of15/libofproto-OFP15-port_stats_reply.packet.json @@ -0,0 +1,93 @@ +{ + "1": [ + { + "duration_nsec": 0, + "duration_sec": 0, + "length": 224, + "port_no": 7, + "properties": [ + { + "collisions": 0, + "length": 40, + "rx_crc_err": 0, + "rx_frame_err": 0, + "rx_over_err": 0, + "type": "ETHERNET" + }, + { + "bias_current": 300, + "flags": 3, + "length": 44, + "rx_freq_lmda": 1500, + "rx_grid_span": 500, + "rx_offset": 700, + "rx_pwr": 2000, + "temperature": 273, + "tx_freq_lmda": 1500, + "tx_grid_span": 500, + "tx_offset": 700, + "tx_pwr": 2000, + "type": "OPTICAL" + }, + { + "data": [], + "exp_type": 0, + "experimenter": 101, + "length": 12, + "type": "EXPERIMENTER" + }, + { + "data": [ + 1 + ], + "exp_type": 1, + "experimenter": 101, + "length": 16, + "type": "EXPERIMENTER" + }, + { + "data": [ + 1, + 2 + ], + "exp_type": 2, + "experimenter": 101, + "length": 20, + "type": "EXPERIMENTER" + } + ], + "rx_bytes": 0, + "rx_dropped": 0, + "rx_errors": 0, + "rx_packets": 0, + "tx_bytes": 336, + "tx_dropped": 0, + "tx_errors": 0, + "tx_packets": 4 + }, + { + "duration_nsec": 0, + "duration_sec": 0, + "length": 120, + "port_no": 6, + "properties": [ + { + "collisions": 0, + "length": 40, + "rx_crc_err": 0, + "rx_frame_err": 0, + "rx_over_err": 0, + "type": "ETHERNET" + } + ], + "rx_bytes": 336, + "rx_dropped": 0, + "rx_errors": 0, + "rx_packets": 4, + "tx_bytes": 336, + "tx_dropped": 0, + "tx_errors": 0, + "tx_packets": 4 + } + ] +} diff --git a/ryu/tests/unit/lib/ofctl_json/of15/libofproto-OFP15-queue_desc_reply.packet.json b/ryu/tests/unit/lib/ofctl_json/of15/libofproto-OFP15-queue_desc_reply.packet.json new file mode 100644 index 00000000..71ca0b71 --- /dev/null +++ b/ryu/tests/unit/lib/ofctl_json/of15/libofproto-OFP15-queue_desc_reply.packet.json @@ -0,0 +1,61 @@ +{ + "1": [ + { + "len": 32, + "port_no": 7, + "properties": [ + { + "data": [], + "exp_type": 0, + "experimenter": 101, + "length": 12, + "type": "EXPERIMENTER" + } + ], + "queue_id": 0 + }, + { + "len": 88, + "port_no": 8, + "properties": [ + { + "length": 8, + "rate": 300, + "type": "MIN_RATE" + }, + { + "length": 8, + "rate": 900, + "type": "MAX_RATE" + }, + { + "data": [], + "exp_type": 0, + "experimenter": 101, + "length": 12, + "type": "EXPERIMENTER" + }, + { + "data": [ + 1 + ], + "exp_type": 1, + "experimenter": 101, + "length": 16, + "type": "EXPERIMENTER" + }, + { + "data": [ + 1, + 2 + ], + "exp_type": 2, + "experimenter": 101, + "length": 20, + "type": "EXPERIMENTER" + } + ], + "queue_id": 1 + } + ] +} diff --git a/ryu/tests/unit/lib/ofctl_json/of15/libofproto-OFP15-queue_desc_request.packet.json b/ryu/tests/unit/lib/ofctl_json/of15/libofproto-OFP15-queue_desc_request.packet.json new file mode 100644 index 00000000..9765cf31 --- /dev/null +++ b/ryu/tests/unit/lib/ofctl_json/of15/libofproto-OFP15-queue_desc_request.packet.json @@ -0,0 +1,4 @@ +{ + "port_no": 52651, + "queue_id": 57020 +} diff --git a/ryu/tests/unit/lib/ofctl_json/of15/libofproto-OFP15-queue_stats_reply.packet.json b/ryu/tests/unit/lib/ofctl_json/of15/libofproto-OFP15-queue_stats_reply.packet.json new file mode 100644 index 00000000..a6d246d0 --- /dev/null +++ b/ryu/tests/unit/lib/ofctl_json/of15/libofproto-OFP15-queue_stats_reply.packet.json @@ -0,0 +1,64 @@ +{ + "1": [ + { + "duration_nsec": 0, + "duration_sec": 0, + "length": 104, + "port_no": 7, + "properties": [ + { + "data": [], + "exp_type": 0, + "experimenter": 101, + "length": 12, + "type": "EXPERIMENTER" + }, + { + "data": [ + 1 + ], + "exp_type": 1, + "experimenter": 101, + "length": 16, + "type": "EXPERIMENTER" + }, + { + "data": [ + 1, + 2 + ], + "exp_type": 2, + "experimenter": 101, + "length": 20, + "type": "EXPERIMENTER" + } + ], + "queue_id": 1, + "tx_bytes": 0, + "tx_errors": 0, + "tx_packets": 0 + }, + { + "duration_nsec": 0, + "duration_sec": 0, + "length": 48, + "port_no": 6, + "properties": [], + "queue_id": 1, + "tx_bytes": 0, + "tx_errors": 0, + "tx_packets": 0 + }, + { + "duration_nsec": 0, + "duration_sec": 0, + "length": 48, + "port_no": 7, + "properties": [], + "queue_id": 2, + "tx_bytes": 0, + "tx_errors": 0, + "tx_packets": 0 + } + ] +} diff --git a/ryu/tests/unit/lib/ofctl_json/of15/libofproto-OFP15-table_features_reply.packet.json b/ryu/tests/unit/lib/ofctl_json/of15/libofproto-OFP15-table_features_reply.packet.json new file mode 100644 index 00000000..e16efb76 --- /dev/null +++ b/ryu/tests/unit/lib/ofctl_json/of15/libofproto-OFP15-table_features_reply.packet.json @@ -0,0 +1,25 @@ +{ + "1": [ + { + "capabilities": 4, + "command": 1, + "features": 1, + "length": 80, + "max_entries": 255, + "metadata_match": 18446744073709551615, + "metadata_write": 18446744073709551615, + "name": "table1", + "properties": [ + { + "oxm_values": [ + { + "eth_src": "aa:bb:cc:dd:ee:ff" + } + ], + "type": "PACKET_TYPES" + } + ], + "table_id": 1 + } + ] +} diff --git a/ryu/tests/unit/lib/ofctl_json/of15/libofproto-OFP15-table_stats_reply.packet.json b/ryu/tests/unit/lib/ofctl_json/of15/libofproto-OFP15-table_stats_reply.packet.json new file mode 100644 index 00000000..95b2c495 --- /dev/null +++ b/ryu/tests/unit/lib/ofctl_json/of15/libofproto-OFP15-table_stats_reply.packet.json @@ -0,0 +1,16 @@ +{ + "1": [ + { + "active_count": 4, + "lookup_count": 4, + "matched_count": 4, + "table_id": 0 + }, + { + "active_count": 4, + "lookup_count": 4, + "matched_count": 4, + "table_id": 1 + } + ] +} diff --git a/ryu/tests/unit/lib/test_ofctl.py b/ryu/tests/unit/lib/test_ofctl.py index fa818393..0254c261 100644 --- a/ryu/tests/unit/lib/test_ofctl.py +++ b/ryu/tests/unit/lib/test_ofctl.py @@ -25,6 +25,7 @@ from ryu.lib import ofctl_v1_0 from ryu.lib import ofctl_v1_2 from ryu.lib import ofctl_v1_3 from ryu.lib import ofctl_v1_4 +from ryu.lib import ofctl_v1_5 from ryu.ofproto import ofproto_parser from ryu.ofproto.ofproto_protocol import ProtocolDesc from ryu.tests import test_lib @@ -33,6 +34,7 @@ LOG = logging.getLogger(__name__) class DummyDatapath(ProtocolDesc): + def __init__(self, version): super(DummyDatapath, self).__init__(version) self.id = 1 # XXX @@ -117,6 +119,7 @@ def _add_tests(): 'of12': 0x03, 'of13': 0x04, 'of14': 0x05, + 'of15': 0x06, } _test_cases = { @@ -461,7 +464,7 @@ def _add_tests(): }, { 'method': ofctl_v1_4.mod_meter_entry, - 'request': '5-43-ofp_meter_mod.packet.json', # flow --> meter + 'request': '5-43-ofp_meter_mod.packet.json', 'reply': None }, { @@ -480,6 +483,113 @@ def _add_tests(): 'reply': None }, ], + 'of15': [ + { + 'method': ofctl_v1_5.get_desc_stats, + 'request': 'libofproto-OFP15-desc_request.packet.json', + 'reply': 'libofproto-OFP15-desc_reply.packet.json' + }, + { + 'method': ofctl_v1_5.get_queue_stats, + 'request': 'lib-ofctl-ofp_queue_stats_request.packet.json', + 'reply': 'libofproto-OFP15-queue_stats_reply.packet.json' + }, + { + 'method': ofctl_v1_5.get_queue_desc, + 'request': 'libofproto-OFP15-queue_desc_request.packet.json', + 'reply': 'libofproto-OFP15-queue_desc_reply.packet.json' + }, + { + 'method': ofctl_v1_5.get_flow_stats, + 'request': 'libofproto-OFP15-flow_stats_request.packet.json', + 'reply': 'libofproto-OFP15-flow_stats_reply.packet.json' + }, + { + 'method': ofctl_v1_5.get_flow_desc_stats, + 'request': 'libofproto-OFP15-flow_desc_request.packet.json', + 'reply': 'libofproto-OFP15-flow_desc_reply.packet.json' + }, + { + 'method': ofctl_v1_5.get_aggregate_flow_stats, + 'request': 'libofproto-OFP15-aggregate_stats_request.packet.json', + 'reply': 'libofproto-OFP15-aggregate_stats_reply.packet.json' + }, + { + 'method': ofctl_v1_5.get_table_stats, + 'request': 'libofproto-OFP15-table_stats_request.packet.json', + 'reply': 'libofproto-OFP15-table_stats_reply.packet.json' + }, + { + 'method': ofctl_v1_5.get_table_features, + 'request': 'lib-ofctl-ofp_table_features_request.packet.json', + 'reply': 'libofproto-OFP15-table_features_reply.packet.json' + }, + { + 'method': ofctl_v1_5.get_port_stats, + 'request': 'libofproto-OFP15-port_stats_request.packet.json', + 'reply': 'libofproto-OFP15-port_stats_reply.packet.json' + }, + { + 'method': ofctl_v1_5.get_meter_stats, + 'request': 'libofproto-OFP15-meter_stats_request.packet.json', + 'reply': 'libofproto-OFP15-meter_stats_reply.packet.json' + }, + { + 'method': ofctl_v1_5.get_meter_features, + 'request': 'libofproto-OFP15-meter_features_request.packet.json', + 'reply': 'libofproto-OFP15-meter_features_reply.packet.json' + }, + { + 'method': ofctl_v1_5.get_meter_desc, + 'request': 'libofproto-OFP15-meter_desc_request.packet.json', + 'reply': 'libofproto-OFP15-meter_desc_reply.packet.json' + }, + { + 'method': ofctl_v1_5.get_group_stats, + 'request': 'libofproto-OFP15-group_stats_request.packet.json', + 'reply': 'libofproto-OFP15-group_stats_reply.packet.json' + }, + { + 'method': ofctl_v1_5.get_group_features, + 'request': 'libofproto-OFP15-group_features_request.packet.json', + 'reply': 'libofproto-OFP15-group_features_reply.packet.json' + }, + { + 'method': ofctl_v1_5.get_group_desc, + 'request': 'libofproto-OFP15-group_desc_request.packet.json', + 'reply': 'libofproto-OFP15-group_desc_reply.packet.json' + }, + { + 'method': ofctl_v1_5.get_port_desc, + 'request': 'libofproto-OFP15-port_desc_request.packet.json', + 'reply': 'libofproto-OFP15-port_desc_reply.packet.json' + }, + { + 'method': ofctl_v1_5.mod_flow_entry, + 'request': 'libofproto-OFP15-flow_mod_no_nx.packet.json', + 'reply': None + }, + { + 'method': ofctl_v1_5.mod_meter_entry, + 'request': 'libofproto-OFP15-meter_mod.packet.json', + 'reply': None + }, + { + 'method': ofctl_v1_5.mod_group_entry, + 'request': 'libofproto-OFP15-group_mod.packet.json', + 'reply': None + }, + { + 'method': ofctl_v1_5.mod_port_behavior, + 'request': 'libofproto-OFP15-port_mod.packet.json', + 'reply': None + }, + { + 'method': ofctl_v1_5.send_experimenter, + 'request': 'libofproto-OFP15-experimenter.packet.json', + 'reply': None + } + ], } def _jsonfile_to_msg(datapath, jsonfile): diff --git a/ryu/tests/unit/ofproto/json/of15/lib-ofctl-ofp_queue_stats_request.packet.json b/ryu/tests/unit/ofproto/json/of15/lib-ofctl-ofp_queue_stats_request.packet.json new file mode 100644 index 00000000..41d30f70 --- /dev/null +++ b/ryu/tests/unit/ofproto/json/of15/lib-ofctl-ofp_queue_stats_request.packet.json @@ -0,0 +1,8 @@ +{ + "OFPQueueStatsRequest": { + "flags": 0, + "port_no": 4294967295, + "queue_id": 4294967295, + "type": 5 + } +} diff --git a/ryu/tests/unit/ofproto/json/of15/lib-ofctl-ofp_table_features_request.packet.json b/ryu/tests/unit/ofproto/json/of15/lib-ofctl-ofp_table_features_request.packet.json new file mode 100644 index 00000000..6501de15 --- /dev/null +++ b/ryu/tests/unit/ofproto/json/of15/lib-ofctl-ofp_table_features_request.packet.json @@ -0,0 +1,7 @@ +{ + "OFPTableFeaturesStatsRequest": { + "body": [], + "flags": 0, + "type": 12 + } +} diff --git a/ryu/tests/unit/ofproto/json/of15/libofproto-OFP15-flow_mod_no_nx.packet.json b/ryu/tests/unit/ofproto/json/of15/libofproto-OFP15-flow_mod_no_nx.packet.json new file mode 100644 index 00000000..5f789d52 --- /dev/null +++ b/ryu/tests/unit/ofproto/json/of15/libofproto-OFP15-flow_mod_no_nx.packet.json @@ -0,0 +1,202 @@ +{ + "OFPFlowMod": { + "buffer_id": 65535, + "command": 0, + "cookie": 0, + "cookie_mask": 0, + "flags": 0, + "hard_timeout": 0, + "idle_timeout": 0, + "importance": 0, + "instructions": [ + { + "OFPInstructionActions": { + "actions": [ + { + "OFPActionSetField": { + "field": { + "OXMTlv": { + "field": "vlan_vid", + "mask": null, + "value": 258 + } + }, + "len": 16, + "type": 25 + } + }, + { + "OFPActionCopyTtlOut": { + "len": 8, + "type": 11 + } + }, + { + "OFPActionCopyTtlIn": { + "len": 8, + "type": 12 + } + }, + { + "OFPActionCopyTtlIn": { + "len": 8, + "type": 12 + } + }, + { + "OFPActionPopPbb": { + "len": 8, + "type": 27 + } + }, + { + "OFPActionPushPbb": { + "ethertype": 4660, + "len": 8, + "type": 26 + } + }, + { + "OFPActionPopMpls": { + "ethertype": 39030, + "len": 8, + "type": 20 + } + }, + { + "OFPActionPushMpls": { + "ethertype": 34887, + "len": 8, + "type": 19 + } + }, + { + "OFPActionPopVlan": { + "len": 8, + "type": 18 + } + }, + { + "OFPActionPushVlan": { + "ethertype": 33024, + "len": 8, + "type": 17 + } + }, + { + "OFPActionDecMplsTtl": { + "len": 8, + "type": 16 + } + }, + { + "OFPActionSetMplsTtl": { + "len": 8, + "mpls_ttl": 10, + "type": 15 + } + }, + { + "OFPActionDecNwTtl": { + "len": 8, + "type": 24 + } + }, + { + "OFPActionSetNwTtl": { + "len": 8, + "nw_ttl": 10, + "type": 23 + } + }, + { + "OFPActionExperimenterUnknown": { + "data": "AAECAwQFBgc=", + "experimenter": 101, + "len": 16, + "type": 65535 + } + }, + { + "OFPActionSetQueue": { + "len": 8, + "queue_id": 3, + "type": 21 + } + }, + { + "OFPActionGroup": { + "group_id": 99, + "len": 8, + "type": 22 + } + }, + { + "OFPActionOutput": { + "len": 16, + "max_len": 65535, + "port": 6, + "type": 0 + } + } + ], + "len": 176, + "type": 3 + } + }, + { + "OFPInstructionActions": { + "actions": [ + { + "OFPActionSetField": { + "field": { + "OXMTlv": { + "field": "eth_src", + "mask": null, + "value": "01:02:03:04:05:06" + } + }, + "len": 16, + "type": 25 + } + }, + { + "OFPActionSetField": { + "field": { + "OXMTlv": { + "field": "pbb_uca", + "mask": null, + "value": 1 + } + }, + "len": 16, + "type": 25 + } + } + ], + "len": 40, + "type": 4 + } + } + ], + "match": { + "OFPMatch": { + "length": 14, + "oxm_fields": [ + { + "OXMTlv": { + "field": "eth_dst", + "mask": null, + "value": "f2:0b:a4:7d:f8:ea" + } + } + ], + "type": 1 + } + }, + "out_group": 4294967295, + "out_port": 4294967295, + "priority": 123, + "table_id": 1 + } +} |