diff options
16 files changed, 352 insertions, 0 deletions
diff --git a/ryu/tests/packet_data/of10/ovs-ofctl-of10-action_dec_mpls_ttl.packet b/ryu/tests/packet_data/of10/ovs-ofctl-of10-action_dec_mpls_ttl.packet Binary files differnew file mode 100644 index 00000000..f2f6c279 --- /dev/null +++ b/ryu/tests/packet_data/of10/ovs-ofctl-of10-action_dec_mpls_ttl.packet diff --git a/ryu/tests/packet_data/of10/ovs-ofctl-of10-action_dec_nw_ttl.packet b/ryu/tests/packet_data/of10/ovs-ofctl-of10-action_dec_nw_ttl.packet Binary files differnew file mode 100644 index 00000000..38e0a2a2 --- /dev/null +++ b/ryu/tests/packet_data/of10/ovs-ofctl-of10-action_dec_nw_ttl.packet diff --git a/ryu/tests/packet_data/of10/ovs-ofctl-of10-action_pop_mpls.packet b/ryu/tests/packet_data/of10/ovs-ofctl-of10-action_pop_mpls.packet Binary files differnew file mode 100644 index 00000000..49c4a862 --- /dev/null +++ b/ryu/tests/packet_data/of10/ovs-ofctl-of10-action_pop_mpls.packet diff --git a/ryu/tests/packet_data/of10/ovs-ofctl-of10-action_push_mpls.packet b/ryu/tests/packet_data/of10/ovs-ofctl-of10-action_push_mpls.packet Binary files differnew file mode 100644 index 00000000..fc478e1f --- /dev/null +++ b/ryu/tests/packet_data/of10/ovs-ofctl-of10-action_push_mpls.packet diff --git a/ryu/tests/packet_data/of10/ovs-ofctl-of10-action_set_mpls_label.packet b/ryu/tests/packet_data/of10/ovs-ofctl-of10-action_set_mpls_label.packet Binary files differnew file mode 100644 index 00000000..4c529139 --- /dev/null +++ b/ryu/tests/packet_data/of10/ovs-ofctl-of10-action_set_mpls_label.packet diff --git a/ryu/tests/packet_data/of10/ovs-ofctl-of10-action_set_mpls_tc.packet b/ryu/tests/packet_data/of10/ovs-ofctl-of10-action_set_mpls_tc.packet Binary files differnew file mode 100644 index 00000000..0b6dc347 --- /dev/null +++ b/ryu/tests/packet_data/of10/ovs-ofctl-of10-action_set_mpls_tc.packet diff --git a/ryu/tests/packet_data/of10/ovs-ofctl-of10-action_set_mpls_ttl.packet b/ryu/tests/packet_data/of10/ovs-ofctl-of10-action_set_mpls_ttl.packet Binary files differnew file mode 100644 index 00000000..424f9a74 --- /dev/null +++ b/ryu/tests/packet_data/of10/ovs-ofctl-of10-action_set_mpls_ttl.packet diff --git a/ryu/tests/packet_data_generator3/gen.py b/ryu/tests/packet_data_generator3/gen.py index cb1dedf0..e5bbeed9 100644 --- a/ryu/tests/packet_data_generator3/gen.py +++ b/ryu/tests/packet_data_generator3/gen.py @@ -145,6 +145,41 @@ MESSAGES = [ 'cmd': 'add-flow', 'args': (['priority=100,tcp'] + ['actions=fin_timeout(idle_timeout=30,hard_timeout=60)'])}, + {'name': 'action_dec_nw_ttl', + 'versions': [1], + 'cmd': 'add-flow', + 'args': (['priority=100,mpls'] + + ['actions=dec_ttl'])}, + {'name': 'action_push_mpls', + 'versions': [1], + 'cmd': 'add-flow', + 'args': (['priority=100,ip'] + + ['actions=push_mpls:0x8847'])}, + {'name': 'action_pop_mpls', + 'versions': [1], + 'cmd': 'add-flow', + 'args': (['priority=100,mpls'] + + ['actions=pop_mpls:0x0800'])}, + {'name': 'action_set_mpls_ttl', + 'versions': [1], + 'cmd': 'add-flow', + 'args': (['priority=100,mpls'] + + ['actions=set_mpls_ttl(127)'])}, + {'name': 'action_dec_mpls_ttl', + 'versions': [1], + 'cmd': 'add-flow', + 'args': (['priority=100,mpls'] + + ['actions=dec_mpls_ttl'])}, + {'name': 'action_set_mpls_label', + 'versions': [1], + 'cmd': 'add-flow', + 'args': (['priority=100,mpls'] + + ['actions=set_mpls_label(10)'])}, + {'name': 'action_set_mpls_tc', + 'versions': [1], + 'cmd': 'add-flow', + 'args': (['priority=100,mpls'] + + ['actions=set_mpls_tc(10)'])}, ] buf = [] diff --git a/ryu/tests/unit/ofproto/json/of10/ovs-ofctl-of10-action_dec_mpls_ttl.packet.json b/ryu/tests/unit/ofproto/json/of10/ovs-ofctl-of10-action_dec_mpls_ttl.packet.json new file mode 100644 index 00000000..a41c2b64 --- /dev/null +++ b/ryu/tests/unit/ofproto/json/of10/ovs-ofctl-of10-action_dec_mpls_ttl.packet.json @@ -0,0 +1,37 @@ +{ + "OFPFlowMod": { + "actions": [ + { + "NXActionDecMplsTtl": { + "subtype": 26, + "vendor": 8992 + } + } + ], + "buffer_id": 4294967295, + "command": 0, + "cookie": 0, + "flags": 0, + "hard_timeout": 0, + "idle_timeout": 0, + "match": { + "OFPMatch": { + "dl_dst": "00:00:00:00:00:00", + "dl_src": "00:00:00:00:00:00", + "dl_type": 34887, + "dl_vlan": 0, + "dl_vlan_pcp": 0, + "in_port": 0, + "nw_dst": "0.0.0.0", + "nw_proto": 0, + "nw_src": "0.0.0.0", + "nw_tos": 0, + "tp_dst": 0, + "tp_src": 0, + "wildcards": 3678447 + } + }, + "out_port": 65535, + "priority": 100 + } +} diff --git a/ryu/tests/unit/ofproto/json/of10/ovs-ofctl-of10-action_dec_nw_ttl.packet.json b/ryu/tests/unit/ofproto/json/of10/ovs-ofctl-of10-action_dec_nw_ttl.packet.json new file mode 100644 index 00000000..3f6806c8 --- /dev/null +++ b/ryu/tests/unit/ofproto/json/of10/ovs-ofctl-of10-action_dec_nw_ttl.packet.json @@ -0,0 +1,37 @@ +{ + "OFPFlowMod": { + "actions": [ + { + "NXActionDecTtl": { + "subtype": 18, + "vendor": 8992 + } + } + ], + "buffer_id": 4294967295, + "command": 0, + "cookie": 0, + "flags": 0, + "hard_timeout": 0, + "idle_timeout": 0, + "match": { + "OFPMatch": { + "dl_dst": "00:00:00:00:00:00", + "dl_src": "00:00:00:00:00:00", + "dl_type": 34887, + "dl_vlan": 0, + "dl_vlan_pcp": 0, + "in_port": 0, + "nw_dst": "0.0.0.0", + "nw_proto": 0, + "nw_src": "0.0.0.0", + "nw_tos": 0, + "tp_dst": 0, + "tp_src": 0, + "wildcards": 3678447 + } + }, + "out_port": 65535, + "priority": 100 + } +} diff --git a/ryu/tests/unit/ofproto/json/of10/ovs-ofctl-of10-action_pop_mpls.packet.json b/ryu/tests/unit/ofproto/json/of10/ovs-ofctl-of10-action_pop_mpls.packet.json new file mode 100644 index 00000000..69c0d70b --- /dev/null +++ b/ryu/tests/unit/ofproto/json/of10/ovs-ofctl-of10-action_pop_mpls.packet.json @@ -0,0 +1,38 @@ +{ + "OFPFlowMod": { + "actions": [ + { + "NXActionPopMpls": { + "ethertype": 2048, + "subtype": 24, + "vendor": 8992 + } + } + ], + "buffer_id": 4294967295, + "command": 0, + "cookie": 0, + "flags": 0, + "hard_timeout": 0, + "idle_timeout": 0, + "match": { + "OFPMatch": { + "dl_dst": "00:00:00:00:00:00", + "dl_src": "00:00:00:00:00:00", + "dl_type": 34887, + "dl_vlan": 0, + "dl_vlan_pcp": 0, + "in_port": 0, + "nw_dst": "0.0.0.0", + "nw_proto": 0, + "nw_src": "0.0.0.0", + "nw_tos": 0, + "tp_dst": 0, + "tp_src": 0, + "wildcards": 3678447 + } + }, + "out_port": 65535, + "priority": 100 + } +} diff --git a/ryu/tests/unit/ofproto/json/of10/ovs-ofctl-of10-action_push_mpls.packet.json b/ryu/tests/unit/ofproto/json/of10/ovs-ofctl-of10-action_push_mpls.packet.json new file mode 100644 index 00000000..9e7853cb --- /dev/null +++ b/ryu/tests/unit/ofproto/json/of10/ovs-ofctl-of10-action_push_mpls.packet.json @@ -0,0 +1,38 @@ +{ + "OFPFlowMod": { + "actions": [ + { + "NXActionPushMpls": { + "ethertype": 34887, + "subtype": 23, + "vendor": 8992 + } + } + ], + "buffer_id": 4294967295, + "command": 0, + "cookie": 0, + "flags": 0, + "hard_timeout": 0, + "idle_timeout": 0, + "match": { + "OFPMatch": { + "dl_dst": "00:00:00:00:00:00", + "dl_src": "00:00:00:00:00:00", + "dl_type": 2048, + "dl_vlan": 0, + "dl_vlan_pcp": 0, + "in_port": 0, + "nw_dst": "0.0.0.0", + "nw_proto": 0, + "nw_src": "0.0.0.0", + "nw_tos": 0, + "tp_dst": 0, + "tp_src": 0, + "wildcards": 3678447 + } + }, + "out_port": 65535, + "priority": 100 + } +} diff --git a/ryu/tests/unit/ofproto/json/of10/ovs-ofctl-of10-action_set_mpls_label.packet.json b/ryu/tests/unit/ofproto/json/of10/ovs-ofctl-of10-action_set_mpls_label.packet.json new file mode 100644 index 00000000..4cc001b2 --- /dev/null +++ b/ryu/tests/unit/ofproto/json/of10/ovs-ofctl-of10-action_set_mpls_label.packet.json @@ -0,0 +1,38 @@ +{ + "OFPFlowMod": { + "actions": [ + { + "NXActionSetMplsLabel": { + "label": 10, + "subtype": 30, + "vendor": 8992 + } + } + ], + "buffer_id": 4294967295, + "command": 0, + "cookie": 0, + "flags": 0, + "hard_timeout": 0, + "idle_timeout": 0, + "match": { + "OFPMatch": { + "dl_dst": "00:00:00:00:00:00", + "dl_src": "00:00:00:00:00:00", + "dl_type": 34887, + "dl_vlan": 0, + "dl_vlan_pcp": 0, + "in_port": 0, + "nw_dst": "0.0.0.0", + "nw_proto": 0, + "nw_src": "0.0.0.0", + "nw_tos": 0, + "tp_dst": 0, + "tp_src": 0, + "wildcards": 3678447 + } + }, + "out_port": 65535, + "priority": 100 + } +} diff --git a/ryu/tests/unit/ofproto/json/of10/ovs-ofctl-of10-action_set_mpls_tc.packet.json b/ryu/tests/unit/ofproto/json/of10/ovs-ofctl-of10-action_set_mpls_tc.packet.json new file mode 100644 index 00000000..864fd7e7 --- /dev/null +++ b/ryu/tests/unit/ofproto/json/of10/ovs-ofctl-of10-action_set_mpls_tc.packet.json @@ -0,0 +1,38 @@ +{ + "OFPFlowMod": { + "actions": [ + { + "NXActionSetMplsTc": { + "subtype": 31, + "tc": 10, + "vendor": 8992 + } + } + ], + "buffer_id": 4294967295, + "command": 0, + "cookie": 0, + "flags": 0, + "hard_timeout": 0, + "idle_timeout": 0, + "match": { + "OFPMatch": { + "dl_dst": "00:00:00:00:00:00", + "dl_src": "00:00:00:00:00:00", + "dl_type": 34887, + "dl_vlan": 0, + "dl_vlan_pcp": 0, + "in_port": 0, + "nw_dst": "0.0.0.0", + "nw_proto": 0, + "nw_src": "0.0.0.0", + "nw_tos": 0, + "tp_dst": 0, + "tp_src": 0, + "wildcards": 3678447 + } + }, + "out_port": 65535, + "priority": 100 + } +} diff --git a/ryu/tests/unit/ofproto/json/of10/ovs-ofctl-of10-action_set_mpls_ttl.packet.json b/ryu/tests/unit/ofproto/json/of10/ovs-ofctl-of10-action_set_mpls_ttl.packet.json new file mode 100644 index 00000000..da6e86f9 --- /dev/null +++ b/ryu/tests/unit/ofproto/json/of10/ovs-ofctl-of10-action_set_mpls_ttl.packet.json @@ -0,0 +1,38 @@ +{ + "OFPFlowMod": { + "actions": [ + { + "NXActionSetMplsTtl": { + "subtype": 25, + "ttl": 127, + "vendor": 8992 + } + } + ], + "buffer_id": 4294967295, + "command": 0, + "cookie": 0, + "flags": 0, + "hard_timeout": 0, + "idle_timeout": 0, + "match": { + "OFPMatch": { + "dl_dst": "00:00:00:00:00:00", + "dl_src": "00:00:00:00:00:00", + "dl_type": 34887, + "dl_vlan": 0, + "dl_vlan_pcp": 0, + "in_port": 0, + "nw_dst": "0.0.0.0", + "nw_proto": 0, + "nw_src": "0.0.0.0", + "nw_tos": 0, + "tp_dst": 0, + "tp_src": 0, + "wildcards": 3678447 + } + }, + "out_port": 65535, + "priority": 100 + } +} diff --git a/ryu/tests/unit/ofproto/test_parser_v10.py b/ryu/tests/unit/ofproto/test_parser_v10.py index 29bc3157..576a9332 100644 --- a/ryu/tests/unit/ofproto/test_parser_v10.py +++ b/ryu/tests/unit/ofproto/test_parser_v10.py @@ -1272,6 +1272,59 @@ class TestNXActionSetTunnel(unittest.TestCase): eq_(self.tun_id['val'], res[4]) +class TestNXActionSetQueue(unittest.TestCase): + """ Test case for ofproto_v1_0_parser.NXActionSetQueue + """ + + # NX_ACTION_SET_QUEUE_PACK_STR + # '!HHIH2xI'...type, len, vendor, subtype, zfill, queue_id + type_ = {'buf': b'\xff\xff', 'val': ofproto.OFPAT_VENDOR} + len_ = {'buf': b'\x00\x10', 'val': ofproto.NX_ACTION_SET_TUNNEL_SIZE} + vendor = {'buf': b'\x00\x00\x23\x20', + 'val': ofproto_common.NX_EXPERIMENTER_ID} + subtype = {'buf': b'\x00\x04', 'val': ofproto.NXAST_SET_QUEUE} + zfill = b'\x00' * 2 + queue_id = {'buf': b'\xde\xbe\xc5\x18', 'val': 3737044248} + + buf = type_['buf'] \ + + len_['buf'] \ + + vendor['buf'] \ + + subtype['buf'] \ + + zfill \ + + queue_id['buf'] + + c = NXActionSetQueue(queue_id['val']) + + def setUp(self): + pass + + def tearDown(self): + pass + + def test_init(self): + eq_(self.subtype['val'], self.c.subtype) + eq_(self.queue_id['val'], self.c.queue_id) + + def test_parser(self): + res = OFPActionVendor.parser(self.buf, 0) + eq_(self.type_['val'], res.type) + eq_(self.len_['val'], res.len) + eq_(self.queue_id['val'], res.queue_id) + + def test_serialize(self): + buf = bytearray() + self.c.serialize(buf, 0) + + fmt = ofproto.NX_ACTION_SET_QUEUE_PACK_STR + res = struct.unpack(fmt, six.binary_type(buf)) + + eq_(self.type_['val'], res[0]) + eq_(self.len_['val'], res[1]) + eq_(self.vendor['val'], res[2]) + eq_(self.subtype['val'], res[3]) + eq_(self.queue_id['val'], res[4]) + + class TestNXActionPopQueue(unittest.TestCase): """ Test case for ofproto_v1_0_parser.NXActionPopQueue """ |