From be892f863b5c7a0ea95c19f44c940d5bce7201e0 Mon Sep 17 00:00:00 2001 From: YAMAMOTO Takashi Date: Tue, 14 Oct 2014 12:28:40 +0900 Subject: [PATCH] oxm_fields: Add Nicira Extended Match (NXM) support Note: It wasn't clear to me which NXM stands for "Extensible" or "Extended". I chose the latter because it's in the primary specification. (nicira-ext.h) Signed-off-by: YAMAMOTO Takashi Signed-off-by: FUJITA Tomonori --- ryu/ofproto/oxm_fields.py | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/ryu/ofproto/oxm_fields.py b/ryu/ofproto/oxm_fields.py index 4aa390ee..15f351c0 100644 --- a/ryu/ofproto/oxm_fields.py +++ b/ryu/ofproto/oxm_fields.py @@ -87,6 +87,8 @@ class UnknownType(TypeDescr): from_user = staticmethod(base64.b64decode) +OFPXMC_NXM_0 = 0 # Nicira Extended Match (NXM_OF_) +OFPXMC_NXM_1 = 1 # Nicira Extended Match (NXM_NX_) OFPXMC_OPENFLOW_BASIC = 0x8000 OFPXMC_EXPERIMENTER = 0xffff @@ -95,16 +97,15 @@ class _OxmClass(object): def __init__(self, name, num, type_): self.name = name self.oxm_type = num | (self._class << 7) + # TODO(yamamoto): Clean this up later. + # Probably when we drop EXT-256 style experimenter OXMs. + self.num = self.oxm_type self.type = type_ class OpenFlowBasic(_OxmClass): _class = OFPXMC_OPENFLOW_BASIC - def __init__(self, name, num, type_): - super(OpenFlowBasic, self).__init__(name, num, type_) - self.num = self.oxm_type - class _Experimenter(_OxmClass): _class = OFPXMC_EXPERIMENTER @@ -119,6 +120,24 @@ class ONFExperimenter(_Experimenter): self.exp_type = num +class NiciraExtended0(_OxmClass): + """Nicira Extended Match (NXM_0) + + NXM header format is same as 32-bit (non-experimenter) OXMs. + """ + + _class = OFPXMC_NXM_0 + + +class NiciraExtended1(_OxmClass): + """Nicira Extended Match (NXM_1) + + NXM header format is same as 32-bit (non-experimenter) OXMs. + """ + + _class = OFPXMC_NXM_1 + + def generate(modname): import sys import string