Hi, On Fri, 12 Oct 2018 06:29:33 +0900, Alan Kayahan wrote: > > Hello, > > I have implemented a custom OXM match in OVS that works fine over > OpenFlow13 when used in a rule installed via ovs-ofctl add-flow. The match > definition in OVS looks as following
> diff --git a/ryu/ofproto/ofproto_v1_3.py b/ryu/ofproto/ofproto_v1_3.py > index d599c1c..018bdad 100644 > --- a/ryu/ofproto/ofproto_v1_3.py > +++ b/ryu/ofproto/ofproto_v1_3.py > @@ -175,10 +175,11 @@ > # enum ofp_oxm_class > OFPXMC_NXM_0 = 0x0000 # Backward compatibility with NXM > OFPXMC_NXM_1 = 0x0001 # Backward compatibility with NXM > OFPXMC_OPENFLOW_BASIC = 0x8000 # Basic class for OpenFlow > OFPXMC_EXPERIMENTER = 0xFFFF # Experimenter class > +OFPXMC_TRH = 0xFFFF # TRF > > # enum ofp_vlan_id > OFPVID_PRESENT = 0x1000 # bit that indicate that a VLAN id is set. > OFPVID_NONE = 0x0000 # No VLAN id was set. > > @@ -1227,10 +1228,12 @@ > # EXT-109 TCP flags match field Extension > oxm_fields.ONFExperimenter('tcp_flags', 42, type_desc.Int2), > # EXT-233 Output match Extension > # NOTE(yamamoto): The spec says uint64_t but I assume it's an error. > oxm_fields.ONFExperimenter('actset_output', 43, type_desc.Int4), > + #TRH > + oxm_fields.Trh('trh_nextuid', 45, type_desc.Int4), > ] + nicira_ext.oxm_types > > oxm_fields.generate(__name__) Please look at what oxm_fields.generate does. > diff --git a/ryu/ofproto/ofproto_v1_3_parser.py > b/ryu/ofproto/ofproto_v1_3_parser.py > index 0324c82..41977e8 100644 > --- a/ryu/ofproto/ofproto_v1_3_parser.py > +++ b/ryu/ofproto/ofproto_v1_3_parser.py > @@ -2244,21 +2256,29 @@ > def __init__(self, header, value, mask=None): > super(MTTunnelId, self).__init__(header) > self.value = value > self.mask = mask > > - > @OFPMatchField.register_field_header([ofproto.OXM_OF_IPV6_EXTHDR, > ofproto.OXM_OF_IPV6_EXTHDR_W]) > class MTIPv6ExtHdr(OFPMatchField): > pack_str = '!H' > > def __init__(self, header, value, mask=None): > super(MTIPv6ExtHdr, self).__init__(header) > self.value = value > self.mask = mask > > +@OFPMatchField.register_field_header([ofproto.OXM_TRH_NEXTUID, > + ofproto.OXM_TRH_NEXTUID_W]) > +class MTTrhNextuid(OFPMatchField): > + pack_str = '!I' > + > + def __init__(self, header, value, mask=None): > + super(MTTrhNextuid, self).__init__(header) > + self.value = value > + self.mask = mask > > @_register_parser > @_set_msg_type(ofproto.OFPT_PACKET_IN) > class OFPPacketIn(MsgBase): > """ > And the following is the error when I try to launch the controller app > > File > "/root/.local/lib/python2.7/site-packages/ryu/ofproto/ofproto_protocol.py", > line 22, in <module> > from ryu.ofproto import ofproto_v1_3_parser > File > "/root/.local/lib/python2.7/site-packages/ryu/ofproto/ofproto_v1_3_parser.py", > line 2271, in <module> > @OFPMatchField.register_field_header([ofproto.OXM_TRH_NEXTUID, > AttributeError: 'module' object has no attribute 'OXM_TRH_NEXTUID' The error message has the answer. :) Other header constants such as OXM_OF_IPV6_EXTHDR are genereted in oxm_fields.generate. You can modify this to accomodate constant generation, or more simply, you can just define the needed constants as done for NXM_NX_* constants in nicira_ext.py. -- IWAMOTO Toshihiro _______________________________________________ Ryu-devel mailing list Ryu-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ryu-devel