Thanks! The change to oxm_serialize_header helped immensely. I'm working on adjusting the tablefeatures test packet_data. I'll also test experimenter oxm id's.
-Bill On Tue, Apr 4, 2017 at 9:59 PM, Iwase Yusuke <[email protected]> wrote: > Instead, I guess we need to extend ofproto.oxm_serialize_header() to > include the "hasmask" field. > Just an idea, how about the following? > > $ git diff > diff --git a/ryu/ofproto/oxx_fields.py b/ryu/ofproto/oxx_fields.py > index e9c1fb9..a3cc1d3 100644 > --- a/ryu/ofproto/oxx_fields.py > +++ b/ryu/ofproto/oxx_fields.py > @@ -228,7 +228,7 @@ def _make_exp_hdr(oxx, mod, n): > return n, exp_hdr > > > -def _serialize_header(oxx, mod, n, buf, offset): > +def _serialize_header(oxx, mod, n, buf, offset, hasmask=False): > try: > get_desc = getattr(mod, '_' + oxx + '_field_desc') > desc = get_desc(n) > @@ -238,8 +238,10 @@ def _serialize_header(oxx, mod, n, buf, offset): > n, exp_hdr = _make_exp_hdr(oxx, mod, n) > exp_hdr_len = len(exp_hdr) > pack_str = "!I%ds" % (exp_hdr_len,) > + if hasmask: > + value_len *= 2 > msg_pack_into(pack_str, buf, offset, > - (n << 9) | (0 << 8) | (exp_hdr_len + value_len), > + (n << 9) | (hasmask << 8) | (exp_hdr_len + value_len), > bytes(exp_hdr)) > return struct.calcsize(pack_str) > > > With this change, we can serialize oxm header field as following. > >>>> from ryu.ofproto import ofproto_v1_3 as ofproto >>>> n = ofproto.oxm_from_user_header('ipv4_src') >>>> buf = bytearray() >>>> ofproto.oxm_serialize_header(n, buf, offset=0, hasmask=True) > 4 >>>> buf > bytearray(b'\x80\x00\x17\x08') >>>> ofproto.oxm_serialize_header(n, buf, offset=0, hasmask=False) > 4 >>>> buf > bytearray(b'\x80\x00\x16\x04') ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Ryu-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ryu-devel
