diff options
-rw-r--r-- | ryu/ofproto/ofproto_v1_0.py | 7 | ||||
-rw-r--r-- | ryu/ofproto/ofproto_v1_0_parser.py | 19 |
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 |