Changes between Version 10 and Version 11 of Internal/OpenFlow/VendorTutorial


Ignore:
Timestamp:
Jan 5, 2013, 12:13:06 AM (11 years ago)
Author:
akoshibe
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Internal/OpenFlow/VendorTutorial

    v10 v11  
    33
    44We'll mostly use snippets of the Nicira vendor messages, found in org.openflow.vendor.nicira of the Floodlight source, as working examples in this page. The Nicira extensions add !OpenFlow role features, introduced in !OpenFlow v1.2, to the v1.0 protocol used in Floodlight.
     5
     6== Contents ==
     7 [#intro 1. Overview: The Vendor Message ] [[BR]]
     8 [#iface 2. openflowj ] [[BR]]
     9 [#msg  3. The OpenFlow Message ] [[BR]]
     10 [#theend 4. Conclusion, or Links ] [[BR]]
    511
    612== 1. Overview: The Vendor Message == #intro
     
    4955Where `OFNiciraVendorData` is the base class implementing `OFVendorData`, and `OFRoleRequestVendorData` and `OFRoleReplyVendorData` implement the two message types. This chart will hopefully make more sense with the following sections.
    5056
    51 === 2.1 Vendor Data Components ===
     57=== 2.2 Vendor Data Components ===
    5258What we refer to as the "vendor message header" is typically a set of variables defined in the class that implements `OFVendorData`.
    5359
     
    117123The Vendor ID and data type are the only requirements in terms of vendor header content. Given that the methods required by `OFVendorData` are provided, along with those required for message registration (which we cover next), the message implementation may be structured as needed.
    118124
    119 === 2.2 Message Registration ===
     125=== 2.3 Message Registration ===
    120126As expected from the variable structure of vendor messages, a given vendor message must be registered with openflowj before it can handle your messages properly. Registration is a two step process:
    121127
     
    172178A non-registered Vendor message data payload is interpreted simply as a byte array (an OFByteArrayVendorData object, to be precise), and cannot be cast to your message (sub)class(es) for further handling. Aside from throwing a !ClassCastException if you try, this is inconvenient since you won't be able to invoke the class methods specific to your vendor data class for message-specific processing. 
    173179
    174 === 2.3 Message Serialization === #serial
     180=== 2.4 Message Serialization === #serial
    175181As mentioned [#iface earlier], a class implementing OFVendorData must have a readFrom(!ChannelBuffer data, int length) and writeTo(!ChannelBuffer data) method for reading and writing the data from/to a !ChannelBuffer. A getLength() method that returns the size in bytes of the vendor data, minus the Vendor ID length, is also required for properly reading/writing from the !ChannelBuffer. We do not count the !OpenFlow header length since helper methods take it into account along with the Vendor ID length to produce the full message length.
    176182
     
    223229Now that we have vendor data, we can complete the full !OpenFlow message -- which brings us to the next section. 
    224230
    225 == 3. The OpenFlow Message ==
     231== 3. The OpenFlow Message == #msg
    226232This section describes how to construct the full vendor type message once we have a structured vendor data object, or alternatively, parse a vendor type message containing a known (e.g. registered) type of vendor data.   
    227233
     
    293299    }
    294300}}} 
     301
     302== 4. Conclusion == #theend
     303In this tutorial, we tried to cover the basics of developing custom messages. While this page contains a hoard of information as is, it is assumed that you also want to do something with the messages once you create them. That part delves into module development in Floodlight, and manipulating `OFChannelHandler`. The following links provides information for getting started on these two fronts:
     304
     305 * Floodlight development: http://www.openflowhub.org/display/floodlightcontroller/For+Developers - a collection of links
     306  * http://groups.google.com/a/openflowhub.org/group/floodlight-dev - floodlight-dev mailing list
     307 * Netty (The networking library used in Floodlight)
     308  * https://netty.io/Documentation/WebHome - the official docs
     309  * http://www.znetdevelopment.com/blogs/2009/04/21/netty-using-handlers/ 
     310  * http://seeallhearall.blogspot.com/2012/06/netty-tutorial-part-15-on-channel.html
     311