summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorShinpei Muraoka <shinpei.muraoka@gmail.com>2016-05-10 14:29:49 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2016-05-13 22:26:15 +0900
commitead9ce79a53727fd46c9c6c58cb0017f784ea672 (patch)
treef9f9b6c02289fe311a993febc3d0008129bf4727
parente30eebbc42a68521aa927075cf4a7da3c29953bc (diff)
test_ofctl: Add test cases for new Actions of of15
This patch adds the test cases for the following actions. - Copy Field Action - Meter Action Signed-off-by: Shinpei Muraoka <shinpei.muraoka@gmail.com> 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/unit/lib/ofctl_json/of15/lib-ofctl-OFP15-flow_desc_reply.packet.json48
-rw-r--r--ryu/tests/unit/lib/ofctl_json/of15/lib-ofctl-OFP15-flow_desc_request.packet.json13
-rw-r--r--ryu/tests/unit/lib/ofctl_json/of15/lib-ofctl-OFP15-flow_mod.packet.json115
-rw-r--r--ryu/tests/unit/lib/test_ofctl.py10
-rw-r--r--ryu/tests/unit/ofproto/json/of15/lib-ofctl-OFP15-flow_desc_reply.packet.json105
-rw-r--r--ryu/tests/unit/ofproto/json/of15/lib-ofctl-OFP15-flow_desc_request.packet.json26
-rw-r--r--ryu/tests/unit/ofproto/json/of15/lib-ofctl-OFP15-flow_mod.packet.json234
7 files changed, 551 insertions, 0 deletions
diff --git a/ryu/tests/unit/lib/ofctl_json/of15/lib-ofctl-OFP15-flow_desc_reply.packet.json b/ryu/tests/unit/lib/ofctl_json/of15/lib-ofctl-OFP15-flow_desc_reply.packet.json
new file mode 100644
index 00000000..0b5e04be
--- /dev/null
+++ b/ryu/tests/unit/lib/ofctl_json/of15/lib-ofctl-OFP15-flow_desc_reply.packet.json
@@ -0,0 +1,48 @@
+{
+ "1": [
+ {
+ "cookie": 1234605616436508552,
+ "flags": 1,
+ "hard_timeout": 255,
+ "idle_timeout": 255,
+ "importance": 43690,
+ "instructions": [
+ {
+ "table_id": 2,
+ "type": "GOTO_TABLE"
+ },
+ {
+ "actions": [
+ {
+ "meter_id": 2,
+ "type": "METER"
+ }
+ ],
+ "type": "WRITE_ACTIONS"
+ },
+ {
+ "actions": [
+ {
+ "type": "COPY_FIELD",
+ "n_bits": 32,
+ "src_offset": 1,
+ "dst_offset": 2,
+ "src_oxm_id": "eth_src",
+ "dst_oxm_id": "eth_dst"
+ }
+ ],
+ "type": "APPLY_ACTIONS"
+ }
+ ],
+ "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/lib-ofctl-OFP15-flow_desc_request.packet.json b/ryu/tests/unit/lib/ofctl_json/of15/lib-ofctl-OFP15-flow_desc_request.packet.json
new file mode 100644
index 00000000..f59aa0b2
--- /dev/null
+++ b/ryu/tests/unit/lib/ofctl_json/of15/lib-ofctl-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/lib-ofctl-OFP15-flow_mod.packet.json b/ryu/tests/unit/lib/ofctl_json/of15/lib-ofctl-OFP15-flow_mod.packet.json
new file mode 100644
index 00000000..cc3ba488
--- /dev/null
+++ b/ryu/tests/unit/lib/ofctl_json/of15/lib-ofctl-OFP15-flow_mod.packet.json
@@ -0,0 +1,115 @@
+{
+ "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"
+ },
+ {
+ "meter_id": 2,
+ "type": "METER"
+ },
+ {
+ "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": "COPY_FIELD",
+ "n_bits": 32,
+ "src_offset": 1,
+ "dst_offset": 2,
+ "src_oxm_id": "eth_src",
+ "dst_oxm_id": "eth_dst"
+ }
+ ],
+ "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/test_ofctl.py b/ryu/tests/unit/lib/test_ofctl.py
index 0254c261..862ce1d3 100644
--- a/ryu/tests/unit/lib/test_ofctl.py
+++ b/ryu/tests/unit/lib/test_ofctl.py
@@ -510,6 +510,11 @@ def _add_tests():
'reply': 'libofproto-OFP15-flow_desc_reply.packet.json'
},
{
+ 'method': ofctl_v1_5.get_flow_desc_stats,
+ 'request': 'lib-ofctl-OFP15-flow_desc_request.packet.json',
+ 'reply': 'lib-ofctl-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'
@@ -570,6 +575,11 @@ def _add_tests():
'reply': None
},
{
+ 'method': ofctl_v1_5.mod_flow_entry,
+ 'request': 'lib-ofctl-OFP15-flow_mod.packet.json',
+ 'reply': None
+ },
+ {
'method': ofctl_v1_5.mod_meter_entry,
'request': 'libofproto-OFP15-meter_mod.packet.json',
'reply': None
diff --git a/ryu/tests/unit/ofproto/json/of15/lib-ofctl-OFP15-flow_desc_reply.packet.json b/ryu/tests/unit/ofproto/json/of15/lib-ofctl-OFP15-flow_desc_reply.packet.json
new file mode 100644
index 00000000..9626ceea
--- /dev/null
+++ b/ryu/tests/unit/ofproto/json/of15/lib-ofctl-OFP15-flow_desc_reply.packet.json
@@ -0,0 +1,105 @@
+{
+ "OFPFlowDescStatsReply": {
+ "body": [
+ {
+ "OFPFlowDesc": {
+ "cookie": 1234605616436508552,
+ "flags": 1,
+ "hard_timeout": 255,
+ "idle_timeout": 255,
+ "importance": 43690,
+ "instructions": [
+ {
+ "OFPInstructionGotoTable": {
+ "len": 8,
+ "table_id": 2,
+ "type": 1
+ }
+ },
+ {
+ "OFPInstructionActions": {
+ "actions": [
+ {
+ "OFPActionMeter": {
+ "len": 8,
+ "meter_id": 2,
+ "type": 29
+ }
+ }
+ ],
+ "len": 8,
+ "type": 3
+ }
+ },
+ {
+ "OFPInstructionActions": {
+ "actions": [
+ {
+ "OFPActionCopyField": {
+ "type": 28,
+ "len": 20,
+ "n_bits": 32,
+ "src_offset": 1,
+ "dst_offset": 2,
+ "oxm_ids": [
+ {
+ "OFPOxmId": {
+ "hasmask": false,
+ "length": 0,
+ "type": "eth_src"
+ }
+ },
+ {
+ "OFPOxmId": {
+ "hasmask": false,
+ "length": 0,
+ "type": "eth_dst"
+ }
+ }
+ ]
+ }
+ }
+ ],
+ "len": 28,
+ "type": 4
+ }
+ }
+ ],
+ "length": 84,
+ "match": {
+ "OFPMatch": {
+ "length": 12,
+ "oxm_fields": [
+ {
+ "OXMTlv": {
+ "field": "in_port",
+ "mask": null,
+ "value": 1
+ }
+ }
+ ],
+ "type": 1
+ }
+ },
+ "priority": 5,
+ "stats": {
+ "OFPStats": {
+ "length": 12,
+ "oxs_fields": [
+ {
+ "OXSTlv": {
+ "field": "flow_count",
+ "value": 1
+ }
+ }
+ ]
+ }
+ },
+ "table_id": 1
+ }
+ }
+ ],
+ "flags": 0,
+ "type": 1
+ }
+}
diff --git a/ryu/tests/unit/ofproto/json/of15/lib-ofctl-OFP15-flow_desc_request.packet.json b/ryu/tests/unit/ofproto/json/of15/lib-ofctl-OFP15-flow_desc_request.packet.json
new file mode 100644
index 00000000..62e46c65
--- /dev/null
+++ b/ryu/tests/unit/ofproto/json/of15/lib-ofctl-OFP15-flow_desc_request.packet.json
@@ -0,0 +1,26 @@
+{
+ "OFPFlowDescStatsRequest": {
+ "cookie": 1234605616436508552,
+ "cookie_mask": 18446744073709551615,
+ "flags": 0,
+ "match": {
+ "OFPMatch": {
+ "length": 12,
+ "oxm_fields": [
+ {
+ "OXMTlv": {
+ "field": "in_port",
+ "mask": null,
+ "value": 1
+ }
+ }
+ ],
+ "type": 1
+ }
+ },
+ "out_group": 4294967295,
+ "out_port": 4294967295,
+ "table_id": 1,
+ "type": 1
+ }
+}
diff --git a/ryu/tests/unit/ofproto/json/of15/lib-ofctl-OFP15-flow_mod.packet.json b/ryu/tests/unit/ofproto/json/of15/lib-ofctl-OFP15-flow_mod.packet.json
new file mode 100644
index 00000000..7fc12ed3
--- /dev/null
+++ b/ryu/tests/unit/ofproto/json/of15/lib-ofctl-OFP15-flow_mod.packet.json
@@ -0,0 +1,234 @@
+{
+ "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
+ }
+ },
+ {
+ "OFPActionMeter": {
+ "len": 8,
+ "meter_id": 2,
+ "type": 29
+ }
+ },
+ {
+ "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
+ }
+ },
+ {
+ "OFPActionCopyField": {
+ "type": 28,
+ "len": 20,
+ "n_bits": 32,
+ "src_offset": 1,
+ "dst_offset": 2,
+ "oxm_ids": [
+ {
+ "OFPOxmId": {
+ "hasmask": false,
+ "length": 0,
+ "type": "eth_src"
+ }
+ },
+ {
+ "OFPOxmId": {
+ "hasmask": false,
+ "length": 0,
+ "type": "eth_dst"
+ }
+ }
+ ]
+ }
+ }
+ ],
+ "len": 60,
+ "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
+ }
+}