mirror of
https://github.com/faucetsdn/ryu.git
synced 2026-05-05 04:16:11 +02:00
test_oxm: Add UTs for 64-bit experimenter OXMs
Following Open vSwitch, introduce "dp_hash" OXM for testing. >From their commit log: (commit 508a933809f8a8ede4fb93f1c1e3212799efc16a) > Testing experimenter OXM is tricky because I do not know of any in > widespread use. Two ONF proposals use experimenter OXMs: EXT-256 and > EXT-233. EXT-256 is not suitable to implement for testing because its use > of experimenter OXM is wrong and will be changed. EXT-233 is not suitable > to implement for testing because it requires adding a new field to struct > flow and I am not yet convinced that that field and the feature that it > supports is worth having in Open vSwitch. Thus, this commit assigns an > experimenter OXM code point to an existing OVS field that is currently > restricted from use by controllers, "dp_hash", and uses that for testing. > Because controllers cannot use it, this leaves future versions of OVS free > to drop the support for the experimenter OXM for this field without causing > backward compatibility problems. Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
parent
98a9f699be
commit
be94c50ce6
@ -1179,6 +1179,12 @@ oxm_types = [
|
||||
oxm_fields.ONFExperimenter('pbb_uca', 2560, oxm_fields.Int1),
|
||||
oxm_fields.NiciraExtended1('tun_ipv4_src', 31, oxm_fields.IPv4Addr),
|
||||
oxm_fields.NiciraExtended1('tun_ipv4_dst', 32, oxm_fields.IPv4Addr),
|
||||
|
||||
# The following definition is merely for testing 64-bit experimenter OXMs.
|
||||
# Following Open vSwitch, we use dp_hash for this purpose.
|
||||
# Prefix the name with '_' to indicate this is not intended to be used
|
||||
# in wild.
|
||||
oxm_fields.NiciraExperimenter('_dp_hash', 0, oxm_fields.Int4),
|
||||
]
|
||||
|
||||
oxm_fields.generate(__name__)
|
||||
|
||||
@ -150,6 +150,10 @@ class ONFExperimenter(_Experimenter):
|
||||
self.exp_type = num
|
||||
|
||||
|
||||
class NiciraExperimenter(_Experimenter):
|
||||
experimenter_id = ofproto_common.NX_EXPERIMENTER_ID
|
||||
|
||||
|
||||
class NiciraExtended0(_OxmClass):
|
||||
"""Nicira Extended Match (NXM_0)
|
||||
|
||||
|
||||
@ -75,6 +75,25 @@ class Test_OXM(unittest.TestCase):
|
||||
)
|
||||
self._test(user, on_wire, 4)
|
||||
|
||||
def test_exp_nomask(self):
|
||||
user = ('_dp_hash', 0x12345678)
|
||||
on_wire = (
|
||||
b'\xff\xff\x00\x08'
|
||||
b'\x00\x00\x23\x20' # Nicira
|
||||
b'\x12\x34\x56\x78'
|
||||
)
|
||||
self._test(user, on_wire, 8)
|
||||
|
||||
def test_exp_mask(self):
|
||||
user = ('_dp_hash', (0x12345678, 0x7fffffff))
|
||||
on_wire = (
|
||||
b'\xff\xff\x01\x0c'
|
||||
b'\x00\x00\x23\x20' # Nicira
|
||||
b'\x12\x34\x56\x78'
|
||||
b'\x7f\xff\xff\xff'
|
||||
)
|
||||
self._test(user, on_wire, 8)
|
||||
|
||||
def test_nxm_1_nomask(self):
|
||||
user = ('tun_ipv4_src', '192.0.2.1')
|
||||
on_wire = (
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user