mirror of
https://github.com/faucetsdn/ryu.git
synced 2026-05-06 04:46:10 +02:00
test_parser: Add test data for missing NXAction
Note: The following actions are not implemented yet, because ovs-ofctl command is not supported. - NXActionRegLoad2 - NXActionOutputReg2 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
89f6945b7e
commit
8b8162ca1f
Binary file not shown.
Binary file not shown.
BIN
ryu/tests/packet_data/of13/ovs-ofctl-of13-action_sample.packet
Normal file
BIN
ryu/tests/packet_data/of13/ovs-ofctl-of13-action_sample.packet
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -180,6 +180,37 @@ MESSAGES = [
|
||||
'cmd': 'add-flow',
|
||||
'args': (['priority=100,mpls'] +
|
||||
['actions=set_mpls_tc(10)'])},
|
||||
{'name': 'action_dec_ttl_cnt_ids',
|
||||
'versions': [4],
|
||||
'cmd': 'add-flow',
|
||||
'args': (['priority=100,tcp'] +
|
||||
['actions=dec_ttl(1,2,3,4,5)'])},
|
||||
{'name': 'action_stack_push',
|
||||
'versions': [4],
|
||||
'cmd': 'add-flow',
|
||||
'args': (['priority=100'] +
|
||||
['actions=push:NXM_NX_REG2[1..5]'])},
|
||||
{'name': 'action_stack_pop',
|
||||
'versions': [4],
|
||||
'cmd': 'add-flow',
|
||||
'args': (['priority=100'] +
|
||||
['actions=pop:NXM_NX_REG2[1..5]'])},
|
||||
{'name': 'action_sample',
|
||||
'versions': [4],
|
||||
'cmd': 'add-flow',
|
||||
'args': (['priority=100'] +
|
||||
['actions=sample(probability=3,collector_set_id=1,' +
|
||||
'obs_domain_id=2,obs_point_id=3)'])},
|
||||
{'name': 'action_controller2',
|
||||
'versions': [4],
|
||||
'cmd': 'add-flow',
|
||||
'args': (['priority=100'] +
|
||||
['actions=controller(reason=packet_out,max_len=1024,' +
|
||||
'id=10,userdata=01.02.03.04.05,pause)'])},
|
||||
|
||||
# ToDo: The following actions are not eligible
|
||||
# {'name': 'action_regload2'},
|
||||
# {'name': 'action_outputreg2'},
|
||||
]
|
||||
|
||||
buf = []
|
||||
|
||||
@ -0,0 +1,51 @@
|
||||
{
|
||||
"OFPFlowMod": {
|
||||
"buffer_id": 4294967295,
|
||||
"command": 0,
|
||||
"cookie": 0,
|
||||
"cookie_mask": 0,
|
||||
"flags": 0,
|
||||
"hard_timeout": 0,
|
||||
"idle_timeout": 0,
|
||||
"instructions": [
|
||||
{
|
||||
"OFPInstructionActions": {
|
||||
"actions": [
|
||||
{
|
||||
"NXActionController2": {
|
||||
"controller_id": 10,
|
||||
"experimenter": 8992,
|
||||
"len": 64,
|
||||
"max_len": 1024,
|
||||
"pause": true,
|
||||
"reason": 5,
|
||||
"subtype": 37,
|
||||
"type": 65535,
|
||||
"userdata": [
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
5
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"len": 72,
|
||||
"type": 4
|
||||
}
|
||||
}
|
||||
],
|
||||
"match": {
|
||||
"OFPMatch": {
|
||||
"length": 4,
|
||||
"oxm_fields": [],
|
||||
"type": 1
|
||||
}
|
||||
},
|
||||
"out_group": 4294967295,
|
||||
"out_port": 4294967295,
|
||||
"priority": 100,
|
||||
"table_id": 0
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,62 @@
|
||||
{
|
||||
"OFPFlowMod": {
|
||||
"buffer_id": 4294967295,
|
||||
"command": 0,
|
||||
"cookie": 0,
|
||||
"cookie_mask": 0,
|
||||
"flags": 0,
|
||||
"hard_timeout": 0,
|
||||
"idle_timeout": 0,
|
||||
"instructions": [
|
||||
{
|
||||
"OFPInstructionActions": {
|
||||
"actions": [
|
||||
{
|
||||
"NXActionDecTtlCntIds": {
|
||||
"cnt_ids": [
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
5
|
||||
],
|
||||
"experimenter": 8992,
|
||||
"len": 32,
|
||||
"subtype": 21,
|
||||
"type": 65535
|
||||
}
|
||||
}
|
||||
],
|
||||
"len": 40,
|
||||
"type": 4
|
||||
}
|
||||
}
|
||||
],
|
||||
"match": {
|
||||
"OFPMatch": {
|
||||
"length": 15,
|
||||
"oxm_fields": [
|
||||
{
|
||||
"OXMTlv": {
|
||||
"field": "eth_type",
|
||||
"mask": null,
|
||||
"value": 2048
|
||||
}
|
||||
},
|
||||
{
|
||||
"OXMTlv": {
|
||||
"field": "ip_proto",
|
||||
"mask": null,
|
||||
"value": 6
|
||||
}
|
||||
}
|
||||
],
|
||||
"type": 1
|
||||
}
|
||||
},
|
||||
"out_group": 4294967295,
|
||||
"out_port": 4294967295,
|
||||
"priority": 100,
|
||||
"table_id": 0
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,44 @@
|
||||
{
|
||||
"OFPFlowMod": {
|
||||
"buffer_id": 4294967295,
|
||||
"command": 0,
|
||||
"cookie": 0,
|
||||
"cookie_mask": 0,
|
||||
"flags": 0,
|
||||
"hard_timeout": 0,
|
||||
"idle_timeout": 0,
|
||||
"instructions": [
|
||||
{
|
||||
"OFPInstructionActions": {
|
||||
"actions": [
|
||||
{
|
||||
"NXActionSample": {
|
||||
"collector_set_id": 1,
|
||||
"experimenter": 8992,
|
||||
"len": 24,
|
||||
"obs_domain_id": 2,
|
||||
"obs_point_id": 3,
|
||||
"probability": 3,
|
||||
"subtype": 29,
|
||||
"type": 65535
|
||||
}
|
||||
}
|
||||
],
|
||||
"len": 32,
|
||||
"type": 4
|
||||
}
|
||||
}
|
||||
],
|
||||
"match": {
|
||||
"OFPMatch": {
|
||||
"length": 4,
|
||||
"oxm_fields": [],
|
||||
"type": 1
|
||||
}
|
||||
},
|
||||
"out_group": 4294967295,
|
||||
"out_port": 4294967295,
|
||||
"priority": 100,
|
||||
"table_id": 0
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,43 @@
|
||||
{
|
||||
"OFPFlowMod": {
|
||||
"buffer_id": 4294967295,
|
||||
"command": 0,
|
||||
"cookie": 0,
|
||||
"cookie_mask": 0,
|
||||
"flags": 0,
|
||||
"hard_timeout": 0,
|
||||
"idle_timeout": 0,
|
||||
"instructions": [
|
||||
{
|
||||
"OFPInstructionActions": {
|
||||
"actions": [
|
||||
{
|
||||
"NXActionStackPop": {
|
||||
"end": 5,
|
||||
"experimenter": 8992,
|
||||
"field": "reg2",
|
||||
"len": 24,
|
||||
"start": 1,
|
||||
"subtype": 28,
|
||||
"type": 65535
|
||||
}
|
||||
}
|
||||
],
|
||||
"len": 32,
|
||||
"type": 4
|
||||
}
|
||||
}
|
||||
],
|
||||
"match": {
|
||||
"OFPMatch": {
|
||||
"length": 4,
|
||||
"oxm_fields": [],
|
||||
"type": 1
|
||||
}
|
||||
},
|
||||
"out_group": 4294967295,
|
||||
"out_port": 4294967295,
|
||||
"priority": 100,
|
||||
"table_id": 0
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,43 @@
|
||||
{
|
||||
"OFPFlowMod": {
|
||||
"buffer_id": 4294967295,
|
||||
"command": 0,
|
||||
"cookie": 0,
|
||||
"cookie_mask": 0,
|
||||
"flags": 0,
|
||||
"hard_timeout": 0,
|
||||
"idle_timeout": 0,
|
||||
"instructions": [
|
||||
{
|
||||
"OFPInstructionActions": {
|
||||
"actions": [
|
||||
{
|
||||
"NXActionStackPush": {
|
||||
"end": 5,
|
||||
"experimenter": 8992,
|
||||
"field": "reg2",
|
||||
"len": 24,
|
||||
"start": 1,
|
||||
"subtype": 27,
|
||||
"type": 65535
|
||||
}
|
||||
}
|
||||
],
|
||||
"len": 32,
|
||||
"type": 4
|
||||
}
|
||||
}
|
||||
],
|
||||
"match": {
|
||||
"OFPMatch": {
|
||||
"length": 4,
|
||||
"oxm_fields": [],
|
||||
"type": 1
|
||||
}
|
||||
},
|
||||
"out_group": 4294967295,
|
||||
"out_port": 4294967295,
|
||||
"priority": 100,
|
||||
"table_id": 0
|
||||
}
|
||||
}
|
||||
@ -1,59 +1,59 @@
|
||||
{
|
||||
"OFPFlowMod": {
|
||||
"buffer_id": 4294967295,
|
||||
"command": 1,
|
||||
"cookie": 1311768467463790320,
|
||||
"cookie_mask": 18446744073709551615,
|
||||
"flags": 0,
|
||||
"hard_timeout": 0,
|
||||
"idle_timeout": 0,
|
||||
"buffer_id": 4294967295,
|
||||
"command": 1,
|
||||
"cookie": 1311768467463790320,
|
||||
"cookie_mask": 18446744073709551615,
|
||||
"flags": 0,
|
||||
"hard_timeout": 0,
|
||||
"idle_timeout": 0,
|
||||
"instructions": [
|
||||
{
|
||||
"OFPInstructionActions": {
|
||||
"actions": [
|
||||
{
|
||||
"NXActionRegLoad": {
|
||||
"dst": "reg0",
|
||||
"experimenter": 8992,
|
||||
"len": 24,
|
||||
"end": 31,
|
||||
"start": 4,
|
||||
"subtype": 7,
|
||||
"type": 65535,
|
||||
"dst": "reg0",
|
||||
"experimenter": 8992,
|
||||
"len": 24,
|
||||
"end": 31,
|
||||
"start": 4,
|
||||
"subtype": 7,
|
||||
"type": 65535,
|
||||
"value": 233495534
|
||||
}
|
||||
}
|
||||
],
|
||||
"len": 32,
|
||||
],
|
||||
"len": 32,
|
||||
"type": 4
|
||||
}
|
||||
}
|
||||
],
|
||||
],
|
||||
"match": {
|
||||
"OFPMatch": {
|
||||
"length": 24,
|
||||
"length": 24,
|
||||
"oxm_fields": [
|
||||
{
|
||||
"OXMTlv": {
|
||||
"field": "reg0",
|
||||
"mask": null,
|
||||
"field": "reg0",
|
||||
"mask": null,
|
||||
"value": 4660
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
"OXMTlv": {
|
||||
"field": "reg5",
|
||||
"mask": 65535,
|
||||
"field": "reg5",
|
||||
"mask": 65535,
|
||||
"value": 43981
|
||||
}
|
||||
}
|
||||
],
|
||||
],
|
||||
"type": 1
|
||||
}
|
||||
},
|
||||
"out_group": 4294967295,
|
||||
"out_port": 4294967295,
|
||||
"priority": 32768,
|
||||
},
|
||||
"out_group": 4294967295,
|
||||
"out_port": 4294967295,
|
||||
"priority": 32768,
|
||||
"table_id": 3
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,60 +1,61 @@
|
||||
{
|
||||
"OFPFlowMod": {
|
||||
"buffer_id": 4294967295,
|
||||
"command": 1,
|
||||
"cookie": 1311768467463790320,
|
||||
"cookie_mask": 18446744073709551615,
|
||||
"flags": 0,
|
||||
"hard_timeout": 0,
|
||||
"idle_timeout": 0,
|
||||
"instructions": [
|
||||
{
|
||||
"OFPInstructionActions": {
|
||||
"actions": [
|
||||
{
|
||||
"NXActionRegMove": {
|
||||
"dst_field": "reg1",
|
||||
"dst_ofs": 0,
|
||||
"experimenter": 8992,
|
||||
"len": 24,
|
||||
"n_bits": 6,
|
||||
"src_field": "reg0",
|
||||
"src_ofs": 10,
|
||||
"subtype": 6,
|
||||
"type": 65535
|
||||
}
|
||||
}
|
||||
],
|
||||
"len": 32,
|
||||
"type": 4
|
||||
"OFPFlowMod": {
|
||||
"buffer_id": 4294967295,
|
||||
"command": 1,
|
||||
"cookie": 1311768467463790320,
|
||||
"cookie_mask": 18446744073709551615,
|
||||
"flags": 0,
|
||||
"hard_timeout": 0,
|
||||
"idle_timeout": 0,
|
||||
"instructions": [
|
||||
{
|
||||
"OFPInstructionActions": {
|
||||
"actions": [
|
||||
{
|
||||
"NXActionRegMove": {
|
||||
"dst_end": 5,
|
||||
"dst_field": "reg1",
|
||||
"dst_start": 0,
|
||||
"experimenter": 8992,
|
||||
"len": 24,
|
||||
"src_end": 15,
|
||||
"src_field": "reg0",
|
||||
"src_start": 10,
|
||||
"subtype": 6,
|
||||
"type": 65535
|
||||
}
|
||||
}
|
||||
],
|
||||
"len": 32,
|
||||
"type": 4
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"match": {
|
||||
"OFPMatch": {
|
||||
"length": 24,
|
||||
"oxm_fields": [
|
||||
{
|
||||
"OXMTlv": {
|
||||
"field": "reg0",
|
||||
"mask": null,
|
||||
"value": 4660
|
||||
}
|
||||
},
|
||||
{
|
||||
"OXMTlv": {
|
||||
"field": "reg5",
|
||||
"mask": 65535,
|
||||
"value": 43981
|
||||
}
|
||||
}
|
||||
],
|
||||
"type": 1
|
||||
}
|
||||
},
|
||||
"out_group": 4294967295,
|
||||
"out_port": 4294967295,
|
||||
"priority": 32768,
|
||||
"table_id": 3
|
||||
}
|
||||
}
|
||||
],
|
||||
"match": {
|
||||
"OFPMatch": {
|
||||
"length": 24,
|
||||
"oxm_fields": [
|
||||
{
|
||||
"OXMTlv": {
|
||||
"field": "reg0",
|
||||
"mask": null,
|
||||
"value": 4660
|
||||
}
|
||||
},
|
||||
{
|
||||
"OXMTlv": {
|
||||
"field": "reg5",
|
||||
"mask": 65535,
|
||||
"value": 43981
|
||||
}
|
||||
}
|
||||
],
|
||||
"type": 1
|
||||
}
|
||||
},
|
||||
"out_group": 4294967295,
|
||||
"out_port": 4294967295,
|
||||
"priority": 32768,
|
||||
"table_id": 3
|
||||
}
|
||||
}
|
||||
@ -1391,6 +1391,10 @@ class TestNXActionRegMove(unittest.TestCase):
|
||||
dst_ofs = {'buf': b'\xdc\x67', 'val': 56423}
|
||||
src_field = {'buf': b'\x00\x01\x00\x04', 'val': "reg0", "val2": 65540}
|
||||
dst_field = {'buf': b'\x00\x01\x02\x04', 'val': "reg1", "val2": 66052}
|
||||
src_start = 62371
|
||||
src_end = 78138
|
||||
dst_start = 56423
|
||||
dst_end = 72190
|
||||
|
||||
buf = type_['buf'] \
|
||||
+ len_['buf'] \
|
||||
@ -1403,10 +1407,11 @@ class TestNXActionRegMove(unittest.TestCase):
|
||||
+ dst_field['buf']
|
||||
|
||||
c = NXActionRegMove(src_field['val'],
|
||||
src_start,
|
||||
src_end,
|
||||
dst_field['val'],
|
||||
n_bits['val'],
|
||||
src_ofs['val'],
|
||||
dst_ofs['val'])
|
||||
dst_start,
|
||||
dst_end)
|
||||
|
||||
def setUp(self):
|
||||
pass
|
||||
@ -1416,22 +1421,24 @@ class TestNXActionRegMove(unittest.TestCase):
|
||||
|
||||
def test_init(self):
|
||||
eq_(self.subtype['val'], self.c.subtype)
|
||||
eq_(self.n_bits['val'], self.c.n_bits)
|
||||
eq_(self.src_ofs['val'], self.c.src_ofs)
|
||||
eq_(self.dst_ofs['val'], self.c.dst_ofs)
|
||||
eq_(self.src_field['val'], self.c.src_field)
|
||||
eq_(self.src_start, self.c.src_start)
|
||||
eq_(self.src_end, self.c.src_end)
|
||||
eq_(self.dst_field['val'], self.c.dst_field)
|
||||
eq_(self.dst_start, self.c.dst_start)
|
||||
eq_(self.dst_end, self.c.dst_end)
|
||||
|
||||
def test_parser(self):
|
||||
res = OFPActionVendor.parser(self.buf, 0)
|
||||
eq_(self.type_['val'], res.type)
|
||||
eq_(self.len_['val'], res.len)
|
||||
eq_(self.subtype['val'], res.subtype)
|
||||
eq_(self.n_bits['val'], res.n_bits)
|
||||
eq_(self.src_ofs['val'], res.src_ofs)
|
||||
eq_(self.dst_ofs['val'], res.dst_ofs)
|
||||
eq_(self.src_field['val'], res.src_field)
|
||||
eq_(self.src_start, res.src_start)
|
||||
eq_(self.src_end, res.src_end)
|
||||
eq_(self.dst_field['val'], res.dst_field)
|
||||
eq_(self.dst_start, res.dst_start)
|
||||
eq_(self.dst_end, res.dst_end)
|
||||
|
||||
def test_serialize(self):
|
||||
buf = bytearray()
|
||||
@ -1925,7 +1932,7 @@ class TestNXActionOutputReg(unittest.TestCase):
|
||||
'val': ofproto_common.NX_EXPERIMENTER_ID}
|
||||
subtype = {'buf': b'\x00\x0f', 'val': ofproto.NXAST_OUTPUT_REG}
|
||||
ofs_nbits = {'buf': b'\xfe\x78', 'val': 65144}
|
||||
src = {'buf': b'\x5e\x3a\x04\x26', 'val': 1580860454}
|
||||
src = {'buf': b'\x00\x01\x00\x04', 'val': "reg0", 'val2': 65540}
|
||||
max_len = {'buf': b'\x00\x08', 'val': ofproto.OFP_ACTION_OUTPUT_SIZE}
|
||||
zfill = b'\x00' * 6
|
||||
start = 1017
|
||||
@ -1980,7 +1987,7 @@ class TestNXActionOutputReg(unittest.TestCase):
|
||||
eq_(self.vendor['val'], res[2])
|
||||
eq_(self.subtype['val'], res[3])
|
||||
eq_(self.ofs_nbits['val'], res[4])
|
||||
eq_(self.src['val'], res[5])
|
||||
eq_(self.src['val2'], res[5])
|
||||
eq_(self.max_len['val'], res[6])
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user