mirror of
https://github.com/faucetsdn/ryu.git
synced 2026-05-08 22:06:10 +02:00
Pull nx_actions for OpenFlow 1.5
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
0c9726efdf
commit
3c7012fe43
@ -27,6 +27,7 @@ from ryu.lib.pack_utils import msg_pack_into
|
||||
from ryu import utils
|
||||
from ryu.ofproto.ofproto_parser import StringifyMixin, MsgBase, MsgInMsgBase, msg_str_attr
|
||||
from . import ether
|
||||
from . import nicira_ext
|
||||
from . import ofproto_parser
|
||||
from . import ofproto_common
|
||||
from . import ofproto_v1_5 as ofproto
|
||||
@ -5464,12 +5465,12 @@ class OFPActionExperimenter(OFPAction):
|
||||
experimenter Experimenter ID
|
||||
================ ======================================================
|
||||
"""
|
||||
def __init__(self, experimenter, data=None, type_=None, len_=None):
|
||||
|
||||
def __init__(self, experimenter):
|
||||
super(OFPActionExperimenter, self).__init__()
|
||||
self.type = ofproto.OFPAT_EXPERIMENTER
|
||||
self.experimenter = experimenter
|
||||
self.data = data
|
||||
self.len = (utils.round_up(len(data), 8) +
|
||||
ofproto.OFP_ACTION_EXPERIMENTER_HEADER_SIZE)
|
||||
self.len = None
|
||||
|
||||
@classmethod
|
||||
def parser(cls, buf, offset):
|
||||
@ -5477,13 +5478,36 @@ class OFPActionExperimenter(OFPAction):
|
||||
ofproto.OFP_ACTION_EXPERIMENTER_HEADER_PACK_STR, buf, offset)
|
||||
data = buf[(offset + ofproto.OFP_ACTION_EXPERIMENTER_HEADER_SIZE
|
||||
): offset + len_]
|
||||
return cls(experimenter, data)
|
||||
if experimenter == ofproto_common.NX_EXPERIMENTER_ID:
|
||||
obj = NXAction.parse(data)
|
||||
else:
|
||||
obj = OFPActionExperimenterUnknown(experimenter, data)
|
||||
obj.len = len_
|
||||
return obj
|
||||
|
||||
def serialize(self, buf, offset):
|
||||
msg_pack_into(ofproto.OFP_ACTION_EXPERIMENTER_HEADER_PACK_STR,
|
||||
buf, offset, self.type, self.len, self.experimenter)
|
||||
if self.data:
|
||||
buf += self.data
|
||||
|
||||
|
||||
class OFPActionExperimenterUnknown(OFPActionExperimenter):
|
||||
def __init__(self, experimenter, data=None, type_=None, len_=None):
|
||||
super(OFPActionExperimenterUnknown,
|
||||
self).__init__(experimenter=experimenter)
|
||||
self.data = data
|
||||
|
||||
def serialize(self, buf, offset):
|
||||
# fixup
|
||||
data = self.data
|
||||
if data is None:
|
||||
data = bytearray()
|
||||
self.len = (utils.round_up(len(data), 8) +
|
||||
ofproto.OFP_ACTION_EXPERIMENTER_HEADER_SIZE)
|
||||
super(OFPActionExperimenterUnknown, self).serialize(buf, offset)
|
||||
msg_pack_into('!%ds' % len(self.data),
|
||||
buf,
|
||||
offset + ofproto.OFP_ACTION_EXPERIMENTER_HEADER_SIZE,
|
||||
self.data)
|
||||
|
||||
|
||||
@_set_msg_type(ofproto.OFPT_GROUP_MOD)
|
||||
@ -6100,3 +6124,11 @@ class OFPBundleAddMsg(MsgInMsgBase):
|
||||
|
||||
# Finish
|
||||
self.buf += tail_buf
|
||||
|
||||
|
||||
import nx_actions
|
||||
|
||||
nx_actions.generate(
|
||||
'ryu.ofproto.ofproto_v1_5',
|
||||
'ryu.ofproto.ofproto_v1_5_parser'
|
||||
)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user