diff options
author | Shinpei Muraoka <shinpei.muraoka@gmail.com> | 2016-03-22 09:51:47 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2016-03-23 22:44:13 +0900 |
commit | c9a68a429df9dbab0d6e3bb150207ab980372c14 (patch) | |
tree | f4fee446f58c6a0b8f0af27fdedc04b2b1ee6a48 | |
parent | a1a5ff08b62f356d77cf539dc3bbdf03133ded6f (diff) |
test_ofctl: Add test cases
This patch adds the following test cases.
- Specify the port number for get ports stats.
- Specify the group id for get group stats.
- Specify the meter id for get meter stats.
- Specify the meter id for get meter config.
- Specify the port number and queue id for get queue stats.
Signed-off-by: Shinpei Muraoka <shinpei.muraoka@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
25 files changed, 184 insertions, 1 deletions
diff --git a/ryu/tests/unit/lib/ofctl_json/of12/lib-ofctl-ofp_group_stats_request.packet.json b/ryu/tests/unit/lib/ofctl_json/of12/lib-ofctl-ofp_group_stats_request.packet.json new file mode 100644 index 00000000..7646a77a --- /dev/null +++ b/ryu/tests/unit/lib/ofctl_json/of12/lib-ofctl-ofp_group_stats_request.packet.json @@ -0,0 +1,3 @@ +{ + "group_id": 1 +} diff --git a/ryu/tests/unit/lib/ofctl_json/of12/lib-ofctl-ofp_port_stats_request.packet.json b/ryu/tests/unit/lib/ofctl_json/of12/lib-ofctl-ofp_port_stats_request.packet.json new file mode 100644 index 00000000..7d56f29d --- /dev/null +++ b/ryu/tests/unit/lib/ofctl_json/of12/lib-ofctl-ofp_port_stats_request.packet.json @@ -0,0 +1,3 @@ +{ + "port": 7 +} diff --git a/ryu/tests/unit/lib/ofctl_json/of12/lib-ofctl-ofp_queue_stats_request.packet1.json b/ryu/tests/unit/lib/ofctl_json/of12/lib-ofctl-ofp_queue_stats_request.packet1.json new file mode 100644 index 00000000..7d56f29d --- /dev/null +++ b/ryu/tests/unit/lib/ofctl_json/of12/lib-ofctl-ofp_queue_stats_request.packet1.json @@ -0,0 +1,3 @@ +{ + "port": 7 +} diff --git a/ryu/tests/unit/lib/ofctl_json/of12/lib-ofctl-ofp_queue_stats_request.packet2.json b/ryu/tests/unit/lib/ofctl_json/of12/lib-ofctl-ofp_queue_stats_request.packet2.json new file mode 100644 index 00000000..78077510 --- /dev/null +++ b/ryu/tests/unit/lib/ofctl_json/of12/lib-ofctl-ofp_queue_stats_request.packet2.json @@ -0,0 +1,4 @@ +{ + "port": 7, + "queue_id":1 +} diff --git a/ryu/tests/unit/lib/ofctl_json/of12/lib-ofctl-ofp_queue_stats_request.packet3.json b/ryu/tests/unit/lib/ofctl_json/of12/lib-ofctl-ofp_queue_stats_request.packet3.json new file mode 100644 index 00000000..ee465693 --- /dev/null +++ b/ryu/tests/unit/lib/ofctl_json/of12/lib-ofctl-ofp_queue_stats_request.packet3.json @@ -0,0 +1,3 @@ +{ + "queue_id":1 +} diff --git a/ryu/tests/unit/lib/ofctl_json/of13/lib-ofctl-ofp_group_stats_request.packet.json b/ryu/tests/unit/lib/ofctl_json/of13/lib-ofctl-ofp_group_stats_request.packet.json new file mode 100644 index 00000000..7646a77a --- /dev/null +++ b/ryu/tests/unit/lib/ofctl_json/of13/lib-ofctl-ofp_group_stats_request.packet.json @@ -0,0 +1,3 @@ +{ + "group_id": 1 +} diff --git a/ryu/tests/unit/lib/ofctl_json/of13/lib-ofctl-ofp_meter_config_request.packet.json b/ryu/tests/unit/lib/ofctl_json/of13/lib-ofctl-ofp_meter_config_request.packet.json new file mode 100644 index 00000000..3ad622e0 --- /dev/null +++ b/ryu/tests/unit/lib/ofctl_json/of13/lib-ofctl-ofp_meter_config_request.packet.json @@ -0,0 +1,3 @@ +{ + "meter_id": 1 +} diff --git a/ryu/tests/unit/lib/ofctl_json/of13/lib-ofctl-ofp_meter_stats_request.packet.json b/ryu/tests/unit/lib/ofctl_json/of13/lib-ofctl-ofp_meter_stats_request.packet.json new file mode 100644 index 00000000..3ad622e0 --- /dev/null +++ b/ryu/tests/unit/lib/ofctl_json/of13/lib-ofctl-ofp_meter_stats_request.packet.json @@ -0,0 +1,3 @@ +{ + "meter_id": 1 +} diff --git a/ryu/tests/unit/lib/ofctl_json/of13/lib-ofctl-ofp_port_stats_request.packet.json b/ryu/tests/unit/lib/ofctl_json/of13/lib-ofctl-ofp_port_stats_request.packet.json new file mode 100644 index 00000000..7d56f29d --- /dev/null +++ b/ryu/tests/unit/lib/ofctl_json/of13/lib-ofctl-ofp_port_stats_request.packet.json @@ -0,0 +1,3 @@ +{ + "port": 7 +} diff --git a/ryu/tests/unit/lib/ofctl_json/of13/lib-ofctl-ofp_queue_stats_request.packet1.json b/ryu/tests/unit/lib/ofctl_json/of13/lib-ofctl-ofp_queue_stats_request.packet1.json new file mode 100644 index 00000000..7d56f29d --- /dev/null +++ b/ryu/tests/unit/lib/ofctl_json/of13/lib-ofctl-ofp_queue_stats_request.packet1.json @@ -0,0 +1,3 @@ +{ + "port": 7 +} diff --git a/ryu/tests/unit/lib/ofctl_json/of13/lib-ofctl-ofp_queue_stats_request.packet2.json b/ryu/tests/unit/lib/ofctl_json/of13/lib-ofctl-ofp_queue_stats_request.packet2.json new file mode 100644 index 00000000..78077510 --- /dev/null +++ b/ryu/tests/unit/lib/ofctl_json/of13/lib-ofctl-ofp_queue_stats_request.packet2.json @@ -0,0 +1,4 @@ +{ + "port": 7, + "queue_id":1 +} diff --git a/ryu/tests/unit/lib/ofctl_json/of13/lib-ofctl-ofp_queue_stats_request.packet3.json b/ryu/tests/unit/lib/ofctl_json/of13/lib-ofctl-ofp_queue_stats_request.packet3.json new file mode 100644 index 00000000..ee465693 --- /dev/null +++ b/ryu/tests/unit/lib/ofctl_json/of13/lib-ofctl-ofp_queue_stats_request.packet3.json @@ -0,0 +1,3 @@ +{ + "queue_id":1 +} diff --git a/ryu/tests/unit/lib/test_ofctl.py b/ryu/tests/unit/lib/test_ofctl.py index 8510b03d..03155a87 100644 --- a/ryu/tests/unit/lib/test_ofctl.py +++ b/ryu/tests/unit/lib/test_ofctl.py @@ -137,6 +137,21 @@ def _add_tests(): 'reply': '3-38-ofp_queue_stats_reply.packet.json' }, { + 'method': ofctl_v1_2.get_queue_stats, + 'request': 'lib-ofctl-ofp_queue_stats_request.packet1.json', + 'reply': '3-38-ofp_queue_stats_reply.packet.json' + }, + { + 'method': ofctl_v1_2.get_queue_stats, + 'request': 'lib-ofctl-ofp_queue_stats_request.packet2.json', + 'reply': '3-38-ofp_queue_stats_reply.packet.json' + }, + { + 'method': ofctl_v1_2.get_queue_stats, + 'request': 'lib-ofctl-ofp_queue_stats_request.packet3.json', + 'reply': '3-38-ofp_queue_stats_reply.packet.json' + }, + { 'method': ofctl_v1_2.get_queue_config, 'request': '3-35-ofp_queue_get_config_request.packet.json', 'reply': '3-36-ofp_queue_get_config_reply.packet.json' @@ -162,11 +177,21 @@ def _add_tests(): 'reply': '3-30-ofp_port_stats_reply.packet.json' }, { + 'method': ofctl_v1_2.get_port_stats, + 'request': 'lib-ofctl-ofp_port_stats_request.packet.json', + 'reply': '3-30-ofp_port_stats_reply.packet.json' + }, + { 'method': ofctl_v1_2.get_group_stats, 'request': '3-61-ofp_group_stats_request.packet.json', 'reply': '3-62-ofp_group_stats_reply.packet.json' }, { + 'method': ofctl_v1_2.get_group_stats, + 'request': 'lib-ofctl-ofp_group_stats_request.packet.json', + 'reply': '3-62-ofp_group_stats_reply.packet.json' + }, + { 'method': ofctl_v1_2.get_group_features, 'request': '3-31-ofp_group_features_stats_request.packet.json', 'reply': '3-32-ofp_group_features_stats_reply.packet.json' @@ -216,6 +241,21 @@ def _add_tests(): 'reply': '4-38-ofp_queue_stats_reply.packet.json' }, { + 'method': ofctl_v1_3.get_queue_stats, + 'request': 'lib-ofctl-ofp_queue_stats_request.packet1.json', + 'reply': '4-38-ofp_queue_stats_reply.packet.json' + }, + { + 'method': ofctl_v1_3.get_queue_stats, + 'request': 'lib-ofctl-ofp_queue_stats_request.packet2.json', + 'reply': '4-38-ofp_queue_stats_reply.packet.json' + }, + { + 'method': ofctl_v1_3.get_queue_stats, + 'request': 'lib-ofctl-ofp_queue_stats_request.packet3.json', + 'reply': '4-38-ofp_queue_stats_reply.packet.json' + }, + { 'method': ofctl_v1_3.get_queue_config, 'request': '4-35-ofp_queue_get_config_request.packet.json', 'reply': '4-36-ofp_queue_get_config_reply.packet.json' @@ -246,11 +286,21 @@ def _add_tests(): 'reply': '4-30-ofp_port_stats_reply.packet.json' }, { + 'method': ofctl_v1_3.get_port_stats, + 'request': 'lib-ofctl-ofp_port_stats_request.packet.json', + 'reply': '4-30-ofp_port_stats_reply.packet.json' + }, + { 'method': ofctl_v1_3.get_meter_stats, 'request': '4-49-ofp_meter_stats_request.packet.json', 'reply': '4-50-ofp_meter_stats_reply.packet.json' }, { + 'method': ofctl_v1_3.get_meter_stats, + 'request': 'lib-ofctl-ofp_meter_stats_request.packet.json', + 'reply': '4-50-ofp_meter_stats_reply.packet.json' + }, + { 'method': ofctl_v1_3.get_meter_features, 'request': '4-51-ofp_meter_features_request.packet.json', 'reply': '4-52-ofp_meter_features_reply.packet.json' @@ -261,11 +311,21 @@ def _add_tests(): 'reply': '4-48-ofp_meter_config_reply.packet.json' }, { + 'method': ofctl_v1_3.get_meter_config, + 'request': 'lib-ofctl-ofp_meter_config_request.packet.json', + 'reply': '4-48-ofp_meter_config_reply.packet.json' + }, + { 'method': ofctl_v1_3.get_group_stats, 'request': '4-57-ofp_group_stats_request.packet.json', 'reply': '4-58-ofp_group_stats_reply.packet.json' }, { + 'method': ofctl_v1_3.get_group_stats, + 'request': 'lib-ofctl-ofp_group_stats_request.packet.json', + 'reply': '4-58-ofp_group_stats_reply.packet.json' + }, + { 'method': ofctl_v1_3.get_group_features, 'request': '4-31-ofp_group_features_request.packet.json', 'reply': '4-32-ofp_group_features_reply.packet.json' @@ -423,7 +483,7 @@ def _add_tests(): parser_json_dir = os.path.join(parser_json_root, ofp_ver) ofctl_json_dir = os.path.join(ofctl_json_root, ofp_ver) for test in tests: - name = 'test_ofctl_' + ofp_ver + '_' + test['method'].__name__ + name = 'test_ofctl_' + ofp_ver + '_' + test['request'] print('adding %s ...' % name) args = {} args_json_path = os.path.join(ofctl_json_dir, test['request']) diff --git a/ryu/tests/unit/ofproto/json/of12/lib-ofctl-ofp_group_stats_request.packet.json b/ryu/tests/unit/ofproto/json/of12/lib-ofctl-ofp_group_stats_request.packet.json new file mode 100644 index 00000000..542ae726 --- /dev/null +++ b/ryu/tests/unit/ofproto/json/of12/lib-ofctl-ofp_group_stats_request.packet.json @@ -0,0 +1,6 @@ +{ + "OFPGroupStatsRequest": { + "flags": 0, + "group_id": 1 + } +} diff --git a/ryu/tests/unit/ofproto/json/of12/lib-ofctl-ofp_port_stats_request.packet.json b/ryu/tests/unit/ofproto/json/of12/lib-ofctl-ofp_port_stats_request.packet.json new file mode 100644 index 00000000..884c5fd2 --- /dev/null +++ b/ryu/tests/unit/ofproto/json/of12/lib-ofctl-ofp_port_stats_request.packet.json @@ -0,0 +1,6 @@ +{ + "OFPPortStatsRequest": { + "flags": 0, + "port_no": 7 + } +} diff --git a/ryu/tests/unit/ofproto/json/of12/lib-ofctl-ofp_queue_stats_request.packet1.json b/ryu/tests/unit/ofproto/json/of12/lib-ofctl-ofp_queue_stats_request.packet1.json new file mode 100644 index 00000000..77535806 --- /dev/null +++ b/ryu/tests/unit/ofproto/json/of12/lib-ofctl-ofp_queue_stats_request.packet1.json @@ -0,0 +1,7 @@ +{ + "OFPQueueStatsRequest": { + "flags": 0, + "port_no": 7, + "queue_id": 4294967295 + } +} diff --git a/ryu/tests/unit/ofproto/json/of12/lib-ofctl-ofp_queue_stats_request.packet2.json b/ryu/tests/unit/ofproto/json/of12/lib-ofctl-ofp_queue_stats_request.packet2.json new file mode 100644 index 00000000..66127d31 --- /dev/null +++ b/ryu/tests/unit/ofproto/json/of12/lib-ofctl-ofp_queue_stats_request.packet2.json @@ -0,0 +1,7 @@ +{ + "OFPQueueStatsRequest": { + "flags": 0, + "port_no": 7, + "queue_id": 1 + } +} diff --git a/ryu/tests/unit/ofproto/json/of12/lib-ofctl-ofp_queue_stats_request.packet3.json b/ryu/tests/unit/ofproto/json/of12/lib-ofctl-ofp_queue_stats_request.packet3.json new file mode 100644 index 00000000..1a798837 --- /dev/null +++ b/ryu/tests/unit/ofproto/json/of12/lib-ofctl-ofp_queue_stats_request.packet3.json @@ -0,0 +1,7 @@ +{ + "OFPQueueStatsRequest": { + "flags": 0, + "port_no": 4294967295, + "queue_id": 1 + } +} diff --git a/ryu/tests/unit/ofproto/json/of13/lib-ofctl-ofp_group_stats_request.packet.json b/ryu/tests/unit/ofproto/json/of13/lib-ofctl-ofp_group_stats_request.packet.json new file mode 100644 index 00000000..311b0381 --- /dev/null +++ b/ryu/tests/unit/ofproto/json/of13/lib-ofctl-ofp_group_stats_request.packet.json @@ -0,0 +1,7 @@ +{ + "OFPGroupStatsRequest": { + "flags": 0, + "group_id": 1, + "type": 6 + } +} diff --git a/ryu/tests/unit/ofproto/json/of13/lib-ofctl-ofp_meter_config_request.packet.json b/ryu/tests/unit/ofproto/json/of13/lib-ofctl-ofp_meter_config_request.packet.json new file mode 100644 index 00000000..9967bd29 --- /dev/null +++ b/ryu/tests/unit/ofproto/json/of13/lib-ofctl-ofp_meter_config_request.packet.json @@ -0,0 +1,7 @@ +{ + "OFPMeterConfigStatsRequest": { + "flags": 0, + "meter_id": 1, + "type": 10 + } +} diff --git a/ryu/tests/unit/ofproto/json/of13/lib-ofctl-ofp_meter_stats_request.packet.json b/ryu/tests/unit/ofproto/json/of13/lib-ofctl-ofp_meter_stats_request.packet.json new file mode 100644 index 00000000..570c2b6d --- /dev/null +++ b/ryu/tests/unit/ofproto/json/of13/lib-ofctl-ofp_meter_stats_request.packet.json @@ -0,0 +1,7 @@ +{ + "OFPMeterStatsRequest": { + "flags": 0, + "meter_id": 1, + "type": 9 + } +} diff --git a/ryu/tests/unit/ofproto/json/of13/lib-ofctl-ofp_port_stats_request.packet.json b/ryu/tests/unit/ofproto/json/of13/lib-ofctl-ofp_port_stats_request.packet.json new file mode 100644 index 00000000..f1258076 --- /dev/null +++ b/ryu/tests/unit/ofproto/json/of13/lib-ofctl-ofp_port_stats_request.packet.json @@ -0,0 +1,7 @@ +{ + "OFPPortStatsRequest": { + "flags": 0, + "port_no": 7, + "type": 4 + } +} diff --git a/ryu/tests/unit/ofproto/json/of13/lib-ofctl-ofp_queue_stats_request.packet1.json b/ryu/tests/unit/ofproto/json/of13/lib-ofctl-ofp_queue_stats_request.packet1.json new file mode 100644 index 00000000..b216fe97 --- /dev/null +++ b/ryu/tests/unit/ofproto/json/of13/lib-ofctl-ofp_queue_stats_request.packet1.json @@ -0,0 +1,8 @@ +{ + "OFPQueueStatsRequest": { + "flags": 0, + "port_no": 7, + "queue_id": 4294967295, + "type": 5 + } +} diff --git a/ryu/tests/unit/ofproto/json/of13/lib-ofctl-ofp_queue_stats_request.packet2.json b/ryu/tests/unit/ofproto/json/of13/lib-ofctl-ofp_queue_stats_request.packet2.json new file mode 100644 index 00000000..cc00e1ea --- /dev/null +++ b/ryu/tests/unit/ofproto/json/of13/lib-ofctl-ofp_queue_stats_request.packet2.json @@ -0,0 +1,8 @@ +{ + "OFPQueueStatsRequest": { + "flags": 0, + "port_no": 7, + "queue_id": 1, + "type": 5 + } +} diff --git a/ryu/tests/unit/ofproto/json/of13/lib-ofctl-ofp_queue_stats_request.packet3.json b/ryu/tests/unit/ofproto/json/of13/lib-ofctl-ofp_queue_stats_request.packet3.json new file mode 100644 index 00000000..5f6579be --- /dev/null +++ b/ryu/tests/unit/ofproto/json/of13/lib-ofctl-ofp_queue_stats_request.packet3.json @@ -0,0 +1,8 @@ +{ + "OFPQueueStatsRequest": { + "flags": 0, + "port_no": 4294967295, + "queue_id": 1, + "type": 5 + } +} |