Merge "nx_action_encap and nx_action_decap classes are defined"

This commit is contained in:
Zuul 2021-10-27 09:08:28 +00:00 committed by Gerrit Code Review
commit 8ae08171d9
2 changed files with 74 additions and 0 deletions

View File

@ -63,6 +63,8 @@ NXAST_CONTROLLER2 = 37
NXAST_SAMPLE2 = 38
NXAST_OUTPUT_TRUNC = 39
NXAST_CT_CLEAR = 43
NXAST_RAW_ENCAP = 46
NXAST_RAW_DECAP = 47
NXAST_DEC_NSH_TTL = 48
NX_ACTION_RESUBMIT_PACK_STR = '!HHIHHB3x'

View File

@ -2996,6 +2996,76 @@ def generate(ofp_name, ofpp_name):
self.max_len)
return data
class NXActionEncapEther(NXAction):
"""
Encap Ether
This action encaps package with ethernet
And equivalent to the followings action of ovs-ofctl command.
::
encap(ethernet)
Example::
actions += [parser.NXActionEncapEther()]
"""
_subtype = nicira_ext.NXAST_RAW_ENCAP
_fmt_str = '!HI'
def __init__(self,
type_=None, len_=None, vendor=None, subtype=None):
super(NXActionEncapEther, self).__init__()
self.hdr_size = 0
self.new_pkt_type = 0x00000000
@classmethod
def parser(cls, buf):
return cls()
def serialize_body(self):
data = bytearray()
msg_pack_into(self._fmt_str, data, 0, self.hdr_size, self.new_pkt_type)
return data
class NXActionEncapNsh(NXAction):
"""
Encap nsh
This action encaps package with nsh
And equivalent to the followings action of ovs-ofctl command.
::
encap(nsh(md_type=1))
Example::
actions += [parser.NXActionEncapNsh()]
"""
_subtype = nicira_ext.NXAST_RAW_ENCAP
_fmt_str = '!HI'
def __init__(self,
type_=None, len_=None, vendor=None, subtype=None):
super(NXActionEncapNsh, self).__init__()
self.hdr_size = hdr_size
self.new_pkt_type = 0x0001894F
@classmethod
def parser(cls, buf):
return cls()
def serialize_body(self):
data = bytearray()
msg_pack_into(self._fmt_str, data, 0, self.hdr_size, self.new_pkt_type)
return data
class NXActionDecNshTtl(NXAction):
"""
Decrement NSH TTL action
@ -3080,6 +3150,8 @@ def generate(ofp_name, ofpp_name):
'NXFlowSpecMatch',
'NXFlowSpecLoad',
'NXFlowSpecOutput',
'NXActionEncapNsh',
'NXActionEncapEther',
'NXActionDecNshTtl',
]
vars = locals()