summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorSimon Horman <horms@verge.net.au>2012-03-13 09:06:12 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2012-03-13 21:41:22 -0700
commit0f8c795c997352886608d17a965068fc597ec507 (patch)
tree48de33fcb8d66bc8afc2f78f596cff82b40521b1
parentcdb513cce764e5313eb1cc113b18090d66b4cf1a (diff)
Add Nicira vendor extensions
Add framework for Nicira vendor request messages. This will be used to add support for NXT_SET_FLOW_FORMAT and NXT_FLOW_MOD messages. Signed-off-by: Simon Horman <horms@verge.net.au> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r--ryu/ofproto/ofproto_v1_0.py7
-rw-r--r--ryu/ofproto/ofproto_v1_0_parser.py19
2 files changed, 24 insertions, 2 deletions
diff --git a/ryu/ofproto/ofproto_v1_0.py b/ryu/ofproto/ofproto_v1_0.py
index 96a93cc9..1143fa0e 100644
--- a/ryu/ofproto/ofproto_v1_0.py
+++ b/ryu/ofproto/ofproto_v1_0.py
@@ -482,3 +482,10 @@ OFP_QUEUE_PROP_MIN_RATE_PACK_STR = '!H6x'
OFP_QUEUE_PROP_MIN_RATE_SIZE = 16
assert (calcsize(OFP_QUEUE_PROP_MIN_RATE_PACK_STR) +
OFP_QUEUE_PROP_HEADER_SIZE == OFP_QUEUE_PROP_MIN_RATE_SIZE)
+
+NX_VENDOR_ID = 0x00002320
+
+NICIRA_HEADER_PACK_STR = '!II'
+NICIRA_HEADER_SIZE = 16
+assert (calcsize(NICIRA_HEADER_PACK_STR) +
+ OFP_HEADER_SIZE == NICIRA_HEADER_SIZE)
diff --git a/ryu/ofproto/ofproto_v1_0_parser.py b/ryu/ofproto/ofproto_v1_0_parser.py
index b0d0e89b..a0ee2118 100644
--- a/ryu/ofproto/ofproto_v1_0_parser.py
+++ b/ryu/ofproto/ofproto_v1_0_parser.py
@@ -639,13 +639,28 @@ class OFPVendor(MsgBase):
msg.data = msg.buf[ofproto_v1_0.OFP_VENDOR_HEADER_SIZE:]
return msg
- def _serialize_body(self):
- assert self.data is not None
+ def serialize_header(self):
msg_pack_into(ofproto_v1_0.OFP_VENDOR_HEADER_PACK_STR,
self.buf, ofproto_v1_0.OFP_HEADER_SIZE, self.vendor)
+
+ def _serialize_body(self):
+ assert self.data is not None
+ self.serialize_header()
self.buf += self.data
+class NXTRequest(OFPVendor):
+ def __init__(self, datapath):
+ super(NXTRequest, self).__init__(datapath)
+ self.vendor = ofproto_v1_0.NX_VENDOR_ID
+
+ def serialize_header(self):
+ super(NXTRequest, self).serialize_header()
+ msg_pack_into(ofproto_v1_0.NICIRA_HEADER_PACK_STR,
+ self.buf, ofproto_v1_0.OFP_HEADER_SIZE,
+ self.vendor, self.subtype)
+
+
#
# asymmetric message (datapath -> controller)
# parser only