mirror of
https://github.com/faucetsdn/ryu.git
synced 2026-05-08 05:46:10 +02:00
test_parser: Add test data for NXAction used only in OpenFlow1.0
Signed-off-by: Shinpei Muraoka <shinpei.muraoka@gmail.com> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
parent
3b1a314bd0
commit
8e30b1f444
Binary file not shown.
Binary file not shown.
BIN
ryu/tests/packet_data/of10/ovs-ofctl-of10-action_pop_mpls.packet
Normal file
BIN
ryu/tests/packet_data/of10/ovs-ofctl-of10-action_pop_mpls.packet
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -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 = []
|
||||
|
||||
@ -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
|
||||
}
|
||||
}
|
||||
@ -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
|
||||
}
|
||||
}
|
||||
@ -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
|
||||
}
|
||||
}
|
||||
@ -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
|
||||
}
|
||||
}
|
||||
@ -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
|
||||
}
|
||||
}
|
||||
@ -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
|
||||
}
|
||||
}
|
||||
@ -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
|
||||
}
|
||||
}
|
||||
@ -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
|
||||
"""
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user