add Nicira Extension NXAST_OUTPUT_REG support

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Reviewed-by: Simon Horman <horms@verge.net.au>
This commit is contained in:
FUJITA Tomonori 2012-05-14 13:53:25 +09:00
parent 17979ffefa
commit ffe34d0b6e
2 changed files with 29 additions and 0 deletions

View File

@ -241,6 +241,8 @@ NXAST_MULTIPATH = 10
NXAST_BUNDLE = 12
NXAST_BUNDLE_LOAD = 13
NXAST_RESUBMIT_TABLE = 14
NXAST_OUTPUT_REG = 15
NX_ACTION_RESUBMIT_PACK_STR = '!HHIHHB3x'
NX_ACTION_RESUBMIT_SIZE = 16
@ -270,6 +272,10 @@ NX_ACTION_BUNDLE_PACK_STR = '!HHIHHHHIHHI4x'
NX_ACTION_BUNDLE_SIZE = 32
assert calcsize(NX_ACTION_BUNDLE_PACK_STR) == NX_ACTION_BUNDLE_SIZE
NX_ACTION_OUTPUT_REG_PACK_STR = '!HHIHHIH6x'
NX_ACTION_OUTPUT_REG_SIZE = 24
assert calcsize(NX_ACTION_OUTPUT_REG_PACK_STR) == NX_ACTION_OUTPUT_REG_SIZE
NX_ACTION_HEADER_PACK_STR = '!HHIH'
NX_ACTION_HEADER_SIZE = 10
assert calcsize(NX_ACTION_HEADER_PACK_STR) == NX_ACTION_HEADER_SIZE

View File

@ -661,6 +661,29 @@ class NXActionBundleLoad(NXActionBundleBase):
return NXActionBundleBase.parser(NXActionBundleLoad, buf, offset)
@NXActionHeader.register_nx_action_subtype(ofproto_v1_0.NXAST_OUTPUT_REG)
class NXActionOutputReg(NXActionHeader):
def __init__(self, ofs_nbits, src, max_len):
super(NXActionOutputReg, self).__init__(
ofproto_v1_0.NXAST_OUTPUT_REG,
ofproto_v1_0.NX_ACTION_OUTPUT_REG_SIZE)
self.ofs_nbits = ofs_nbits
self.src = src
self.max_len = max_len
def serialize(self, buf, offset):
msg_pack_into(ofproto_v1_0.NX_ACTION_OUTPUT_REG_PACK_STR, buf, offset,
self.type, self.len, self.vendor, self.subtype,
self.ofs_nbits, self.src, self.max_len)
@classmethod
def parser(cls, buf, offset):
(type_, len_, vendor, subtype, ofs_nbits, src,
max_len) = struct.unpack_from(
ofproto_v1_0.NX_ACTION_OUTPUT_REG_PACK_STR, buf, offset)
return cls(subtype, ofs_nbits, src)
class OFPDescStats(collections.namedtuple('OFPDescStats',
('mfr_desc', 'hw_desc', 'sw_desc', 'serial_num', 'dp_desc'))):
@classmethod