OXM/OXS: Initialize exp_type with oxm_field
OpenFlow Spec 1.5 mandates that Experimenter OXMs encode the experimenter type in the oxm_field field of the OXM header (EXT-380). Assumption: This can be applied for OXSs too. This patch initializes exp_type value of _Experimenter class with oxm_field/oxs_field value. Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
parent
8a638c088f
commit
46185c48d9
@ -38,6 +38,10 @@
|
||||
# | experimenter ID |
|
||||
# +---------------------------------------------------------------+
|
||||
|
||||
# NOTE: OpenFlow Spec 1.5 mandates that Experimenter OXMs encode
|
||||
# the experimenter type in the oxm_field field of the OXM header
|
||||
# (EXT-380).
|
||||
|
||||
# NOTE: EXT-256 had a variation of experimenter OXM header.
|
||||
# It has been rectified since then. Currently this implementation
|
||||
# supports only the old version.
|
||||
@ -106,6 +110,7 @@ class _Experimenter(_OxmClass):
|
||||
def __init__(self, name, num, type_):
|
||||
super(_Experimenter, self).__init__(name, num, type_)
|
||||
self.num = (self.experimenter_id, self.oxm_type)
|
||||
self.exp_type = self.oxm_field
|
||||
|
||||
|
||||
class ONFExperimenter(_Experimenter):
|
||||
@ -119,7 +124,7 @@ class OldONFExperimenter(_Experimenter):
|
||||
def __init__(self, name, num, type_):
|
||||
super(OldONFExperimenter, self).__init__(name, 0, type_)
|
||||
self.num = (self.experimenter_id, num)
|
||||
self.exp_type = num
|
||||
self.exp_type = 2560
|
||||
|
||||
|
||||
class NiciraExperimenter(_Experimenter):
|
||||
|
@ -50,6 +50,10 @@
|
||||
# | length | 8 | Length of OXS payload |
|
||||
# +----------------------+-------+--------------------------------------------+
|
||||
|
||||
# Assumption: The followings can be applied for OXSs too.
|
||||
# OpenFlow Spec 1.5 mandates that Experimenter OXMs encode the experimenter
|
||||
# type in the oxm_field field of the OXM header (EXT-380).
|
||||
|
||||
from ryu.ofproto.oxx_fields import (
|
||||
_from_user,
|
||||
_from_user_header,
|
||||
@ -94,6 +98,7 @@ class _Experimenter(_OxsClass):
|
||||
def __init__(self, name, num, type_):
|
||||
super(_Experimenter, self).__init__(name, num, type_)
|
||||
self.num = (self.experimenter_id, self.oxs_type)
|
||||
self.exp_type = self.oxs_field
|
||||
|
||||
|
||||
def generate(modname):
|
||||
|
@ -212,15 +212,14 @@ def _make_exp_hdr(oxx, mod, n):
|
||||
(exp_id, exp_type) = n
|
||||
assert desc.experimenter_id == exp_id
|
||||
oxx_type = getattr(desc, oxx + '_type')
|
||||
if hasattr(desc, 'exp_type'): # XXX
|
||||
if desc.exp_type == 2560:
|
||||
# XXX
|
||||
# This block implements EXT-256 style experimenter OXM.
|
||||
assert desc.exp_type == 2560
|
||||
exp_hdr_pack_str = '!IH' # experimenter_id, exp_type
|
||||
msg_pack_into(exp_hdr_pack_str, exp_hdr, 0,
|
||||
desc.experimenter_id, desc.exp_type)
|
||||
else:
|
||||
assert oxx_type == exp_type
|
||||
assert oxx_type == exp_type | (OFPXXC_EXPERIMENTER << 7)
|
||||
exp_hdr_pack_str = '!I' # experimenter_id
|
||||
msg_pack_into(exp_hdr_pack_str, exp_hdr, 0,
|
||||
desc.experimenter_id)
|
||||
|
Loading…
Reference in New Issue
Block a user