Implement NXActionConjunction and conj_id match for OF1.3 and OF1.5
Signed-off-by: IWAMOTO Toshihiro <iwamoto@valinux.co.jp> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
parent
5b280f4915
commit
50769ac837
@ -42,6 +42,7 @@ NXAST_EXIT = 17
|
||||
NXAST_DEC_TTL = 18
|
||||
NXAST_FIN_TIMEOUT = 19
|
||||
NXAST_CONTROLLER = 20
|
||||
NXAST_CONJUNCTION = 34
|
||||
|
||||
NX_ACTION_RESUBMIT_PACK_STR = '!HHIHHB3x'
|
||||
NX_ACTION_RESUBMIT_SIZE = 16
|
||||
|
@ -341,6 +341,45 @@ def generate(ofp_name, ofpp_name):
|
||||
msg_pack_into('!%ds' % len(data), buf, offset + payload_offset,
|
||||
bytes(data))
|
||||
|
||||
class NXActionConjunction(NXAction):
|
||||
_subtype = nicira_ext.NXAST_CONJUNCTION
|
||||
|
||||
# clause, n_clauses, id
|
||||
_fmt_str = '!BBI'
|
||||
|
||||
def __init__(self,
|
||||
clause,
|
||||
n_clauses,
|
||||
id_,
|
||||
type_=None, len_=None, experimenter=None, subtype=None):
|
||||
super(NXActionConjunction, self).__init__()
|
||||
self.clause = clause
|
||||
self.n_clauses = n_clauses
|
||||
self.id = id_
|
||||
|
||||
@classmethod
|
||||
def parse(cls, buf):
|
||||
(clause,
|
||||
n_clauses,
|
||||
id_,) = struct.unpack_from(
|
||||
NXActionConjunction._fmt_str, buf, 0)
|
||||
return cls(clause, n_clauses, id_)
|
||||
|
||||
def serialize(self, buf, offset):
|
||||
data = bytearray()
|
||||
msg_pack_into(NXActionConjunction._fmt_str, data, 0,
|
||||
self.clause,
|
||||
self.n_clauses,
|
||||
self.id)
|
||||
payload_offset = (
|
||||
ofp.OFP_ACTION_EXPERIMENTER_HEADER_SIZE +
|
||||
struct.calcsize(NXAction._fmt_str)
|
||||
)
|
||||
self.len = utils.round_up(payload_offset + len(data), 8)
|
||||
super(NXActionConjunction, self).serialize(buf, offset)
|
||||
msg_pack_into('!%ds' % len(data), buf, offset + payload_offset,
|
||||
bytes(data))
|
||||
|
||||
def add_attr(k, v):
|
||||
v.__module__ = ofpp.__name__ # Necessary for stringify stuff
|
||||
setattr(ofpp, k, v)
|
||||
@ -351,6 +390,7 @@ def generate(ofp_name, ofpp_name):
|
||||
classes = [
|
||||
'NXActionRegMove',
|
||||
'NXActionLearn',
|
||||
'NXActionConjunction',
|
||||
'_NXFlowSpec', # exported for testing
|
||||
'NXFlowSpecMatch',
|
||||
'NXFlowSpecLoad',
|
||||
|
@ -1192,6 +1192,7 @@ oxm_types = [
|
||||
oxm_fields.ONFExperimenter('actset_output', 43, type_desc.Int4),
|
||||
oxm_fields.NiciraExtended1('tun_ipv4_src', 31, type_desc.IPv4Addr),
|
||||
oxm_fields.NiciraExtended1('tun_ipv4_dst', 32, type_desc.IPv4Addr),
|
||||
oxm_fields.NiciraExtended1('conj_id', 37, type_desc.Int4),
|
||||
|
||||
# The following definition is merely for testing 64-bit experimenter OXMs.
|
||||
# Following Open vSwitch, we use dp_hash for this purpose.
|
||||
|
@ -435,6 +435,7 @@ oxm_types = [
|
||||
oxm_fields.OpenFlowBasic('packet_type', 44, type_desc.Int4),
|
||||
oxm_fields.NiciraExtended1('tun_ipv4_src', 31, type_desc.IPv4Addr),
|
||||
oxm_fields.NiciraExtended1('tun_ipv4_dst', 32, type_desc.IPv4Addr),
|
||||
oxm_fields.NiciraExtended1('conj_id', 37, type_desc.Int4),
|
||||
]
|
||||
|
||||
oxm_fields.generate(__name__)
|
||||
|
Loading…
Reference in New Issue
Block a user