mirror of
https://github.com/faucetsdn/ryu.git
synced 2026-05-15 17:46:45 +02:00
Add NXTFlowMod
Allow Nicira Extension NXT_FLOW_MOD vendor messages to be serialised. This is to allow setting flows which require the use of NXM matches, for example matching on the tunnel id. Signed-off-by: Simon Horman <horms@verge.net.au> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
parent
07b1afbcfa
commit
797b5ef385
@ -487,6 +487,7 @@ NX_VENDOR_ID = 0x00002320
|
||||
|
||||
# enum nicira_type (abridged)
|
||||
NXT_SET_FLOW_FORMAT = 12
|
||||
NXT_FLOW_MOD = 13
|
||||
|
||||
# enum nx_flow_format
|
||||
NXFF_OPENFLOW10 = 0
|
||||
@ -497,6 +498,11 @@ NICIRA_HEADER_SIZE = 16
|
||||
assert (calcsize(NICIRA_HEADER_PACK_STR) +
|
||||
OFP_HEADER_SIZE == NICIRA_HEADER_SIZE)
|
||||
|
||||
NX_FLOW_MOD_PACK_STR = '!Q4HI3H6x'
|
||||
NX_FLOW_MOD_SIZE = 48
|
||||
assert (calcsize(NX_FLOW_MOD_PACK_STR) +
|
||||
NICIRA_HEADER_SIZE == NX_FLOW_MOD_SIZE)
|
||||
|
||||
NX_SET_FLOW_FORMAT_PACK_STR = '!I'
|
||||
NX_SET_FLOW_FORMAT_SIZE = 20
|
||||
assert (calcsize(NX_SET_FLOW_FORMAT_PACK_STR) +
|
||||
|
||||
@ -20,6 +20,7 @@ from ofproto_parser import MsgBase, msg_pack_into, msg_str_attr
|
||||
from ryu.lib import mac
|
||||
from . import ofproto_parser
|
||||
from . import ofproto_v1_0
|
||||
from . import nx_match
|
||||
|
||||
import logging
|
||||
LOG = logging.getLogger('ryu.ofproto.ofproto_v1_0_parser')
|
||||
@ -673,6 +674,42 @@ class NXTSetFlowFormat(NXTRequest):
|
||||
self.buf, ofproto_v1_0.NICIRA_HEADER_SIZE, self.format)
|
||||
|
||||
|
||||
class NXTFlowMod(NXTRequest):
|
||||
def __init__(self, datapath, cookie, command, idle_timeout,
|
||||
hard_timeout, priority, buffer_id, out_port,
|
||||
flags, rule, actions):
|
||||
super(NXTFlowMod, self).__init__(datapath)
|
||||
self.subtype = ofproto_v1_0.NXT_FLOW_MOD
|
||||
self.cookie = cookie
|
||||
self.command = command
|
||||
self.idle_timeout = idle_timeout
|
||||
self.hard_timeout = hard_timeout
|
||||
self.priority = priority
|
||||
self.buffer_id = buffer_id
|
||||
self.out_port = out_port
|
||||
self.flags = flags
|
||||
self.rule = rule
|
||||
self.actions = actions
|
||||
|
||||
def _serialize_body(self):
|
||||
self.serialize_header()
|
||||
|
||||
offset = ofproto_v1_0.NX_FLOW_MOD_SIZE
|
||||
match_len = nx_match.serialize_nxm_match(self.rule, self.buf, offset)
|
||||
offset += nx_match.round_up(match_len)
|
||||
|
||||
msg_pack_into(ofproto_v1_0.NX_FLOW_MOD_PACK_STR,
|
||||
self.buf, ofproto_v1_0.NICIRA_HEADER_SIZE,
|
||||
self.cookie, self.command, self.idle_timeout,
|
||||
self.hard_timeout, self.priority, self.buffer_id,
|
||||
self.out_port, self.flags, match_len)
|
||||
|
||||
if self.actions is not None:
|
||||
for a in self.actions:
|
||||
a.serialize(self.buf, offset)
|
||||
offset += a.len
|
||||
|
||||
|
||||
#
|
||||
# asymmetric message (datapath -> controller)
|
||||
# parser only
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user