Signed-off-by: Shinpei Muraoka <[email protected]>
---
 .../of10/ovs-ofctl-of10-action_dec_mpls_ttl.packet | Bin 0 -> 88 bytes
 .../of10/ovs-ofctl-of10-action_dec_nw_ttl.packet   | Bin 0 -> 88 bytes
 .../of10/ovs-ofctl-of10-action_pop_mpls.packet     | Bin 0 -> 88 bytes
 .../of10/ovs-ofctl-of10-action_push_mpls.packet    | Bin 0 -> 88 bytes
 .../ovs-ofctl-of10-action_set_mpls_label.packet    | Bin 0 -> 88 bytes
 .../of10/ovs-ofctl-of10-action_set_mpls_tc.packet  | Bin 0 -> 88 bytes
 .../of10/ovs-ofctl-of10-action_set_mpls_ttl.packet | Bin 0 -> 88 bytes
 ryu/tests/packet_data_generator3/gen.py            |  35 ++++++++++++++
 .../ovs-ofctl-of10-action_dec_mpls_ttl.packet.json |  37 ++++++++++++++
 .../ovs-ofctl-of10-action_dec_nw_ttl.packet.json   |  37 ++++++++++++++
 .../ovs-ofctl-of10-action_pop_mpls.packet.json     |  38 +++++++++++++++
 .../ovs-ofctl-of10-action_push_mpls.packet.json    |  38 +++++++++++++++
 ...vs-ofctl-of10-action_set_mpls_label.packet.json |  38 +++++++++++++++
 .../ovs-ofctl-of10-action_set_mpls_tc.packet.json  |  38 +++++++++++++++
 .../ovs-ofctl-of10-action_set_mpls_ttl.packet.json |  38 +++++++++++++++
 ryu/tests/unit/ofproto/test_parser_v10.py          |  53 +++++++++++++++++++++
 16 files changed, 352 insertions(+)
 create mode 100644 
ryu/tests/packet_data/of10/ovs-ofctl-of10-action_dec_mpls_ttl.packet
 create mode 100644 
ryu/tests/packet_data/of10/ovs-ofctl-of10-action_dec_nw_ttl.packet
 create mode 100644 
ryu/tests/packet_data/of10/ovs-ofctl-of10-action_pop_mpls.packet
 create mode 100644 
ryu/tests/packet_data/of10/ovs-ofctl-of10-action_push_mpls.packet
 create mode 100644 
ryu/tests/packet_data/of10/ovs-ofctl-of10-action_set_mpls_label.packet
 create mode 100644 
ryu/tests/packet_data/of10/ovs-ofctl-of10-action_set_mpls_tc.packet
 create mode 100644 
ryu/tests/packet_data/of10/ovs-ofctl-of10-action_set_mpls_ttl.packet
 create mode 100644 
ryu/tests/unit/ofproto/json/of10/ovs-ofctl-of10-action_dec_mpls_ttl.packet.json
 create mode 100644 
ryu/tests/unit/ofproto/json/of10/ovs-ofctl-of10-action_dec_nw_ttl.packet.json
 create mode 100644 
ryu/tests/unit/ofproto/json/of10/ovs-ofctl-of10-action_pop_mpls.packet.json
 create mode 100644 
ryu/tests/unit/ofproto/json/of10/ovs-ofctl-of10-action_push_mpls.packet.json
 create mode 100644 
ryu/tests/unit/ofproto/json/of10/ovs-ofctl-of10-action_set_mpls_label.packet.json
 create mode 100644 
ryu/tests/unit/ofproto/json/of10/ovs-ofctl-of10-action_set_mpls_tc.packet.json
 create mode 100644 
ryu/tests/unit/ofproto/json/of10/ovs-ofctl-of10-action_set_mpls_ttl.packet.json

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
new file mode 100644
index 
0000000000000000000000000000000000000000..f2f6c2796db76da3ebcb7f41d93de9493e83962f
GIT binary patch
literal 88
rcmZSNV~Ah?0SkrqU>b$!a7W={a#H?-0RzMT{|o{Q49W@&QV>M|VQULV

literal 0
HcmV?d00001

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
new file mode 100644
index 
0000000000000000000000000000000000000000..38e0a2a228be8abdc21e9e9dbd192e9576a276db
GIT binary patch
literal 88
rcmZSNV~Ah?0SkrqU>b$!a7W={a#H?-0RzMT{|o{Q49W@&LJ&m&VKWOq

literal 0
HcmV?d00001

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
new file mode 100644
index 
0000000000000000000000000000000000000000..49c4a862bd53e567455632f132156d29194527c2
GIT binary patch
literal 88
scmZSNV~Ah?0SkrqU>b$!a7W={a#H?-0RzMT{|o{Q49W@&5*%Pv0AY;_O#lD@

literal 0
HcmV?d00001

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
new file mode 100644
index 
0000000000000000000000000000000000000000..fc478e1f64129d8e1b6f688788cb94516740cfda
GIT binary patch
literal 88
scmZSNV~Ah?0SkrqU>b$sK;dEGr2Gd128RFt83Y&@loc4nJKRC)067{9OaK4?

literal 0
HcmV?d00001

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
new file mode 100644
index 
0000000000000000000000000000000000000000..4c529139f01fb4c9cd8ac328e80bd1d9511b0614
GIT binary patch
literal 88
scmZSNV~Ah?0SkrqU>b$!a7W={a#H?-0RzMT{|o{Q49W@&a$rSV0AY~}RR910

literal 0
HcmV?d00001

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
new file mode 100644
index 
0000000000000000000000000000000000000000..0b6dc347ef5e359091a5754208993f15eeab53b4
GIT binary patch
literal 88
scmZSNV~Ah?0SkrqU>b$!a7W={a#H?-0RzMT{|o{Q49W@&@?2n50Ab1tRsaA1

literal 0
HcmV?d00001

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
new file mode 100644
index 
0000000000000000000000000000000000000000..424f9a74f153f34187ee13850b28b165e2cf81ba
GIT binary patch
literal 88
scmZSNV~Ah?0SkrqU>b$!a7W={a#H?-0RzMT{|o{Q49W@&lJ#I!0AyYZ#Q*>R

literal 0
HcmV?d00001

diff --git a/ryu/tests/packet_data_generator3/gen.py 
b/ryu/tests/packet_data_generator3/gen.py
index cb1dedf..e5bbeed 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 0000000..a41c2b6
--- /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 0000000..3f6806c
--- /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 0000000..69c0d70
--- /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 0000000..9e7853c
--- /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 0000000..4cc001b
--- /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 0000000..864fd7e
--- /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 0000000..da6e86f
--- /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 29bc315..576a933 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
     """
-- 
1.9.1


------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to