Changes between Version 14 and Version 15 of Internal/OpenFlow/VendorTutorial


Ignore:
Timestamp:
Jun 7, 2013, 5:17:02 PM (11 years ago)
Author:
akoshibe
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Internal/OpenFlow/VendorTutorial

    v14 v15  
    303303}}} 
    304304
     305
     306=== 3.3 Troubleshooting messages ===
     307When things go wrong, messages will either be thrown away and never reach your handlers, or will exceptions that may or may not reach logging. One way to minimize this is to check that the messages can be built and read/written from/to !ChannelBuffers within your controller. !BasicFactory has a !dumpBuffer() function that returns a hexdump of a message as a string that you can check more thoroughly to see if what you think you have implemented is actually what you have. 
     308
     309{{{
     310    //where msg below is your Vendor message
     311    ChannelBuffer bb = ChannelBuffers.dynamicBuffer();
     312    bb.clear();
     313    msg.writeTo(bb);
     314    bb.resetReaderIndex();
     315
     316    //print vendor data as string
     317    System.out.println(msg.getVendorData().toString());
     318    //print a hexdump
     319    System.out.println(BasicFactory.dumpBuffer(bb))
     320}}}
     321
     322The above should produce something like below as output (demonstrated with a custom message not discussed here)
     323{{{
     324 CPLCommandMsg[[UID=2561 peer=false SID=1 TID=2][RCmd=8 EType=any] Command=CONTINUE]
     325
     326 01040028 00000000 0000ffff 00000005 00000000 00000a01 01000000 02080000
     327 00000000 00000000
     328}}}
     329
     330Note, a local check won't prevent everything. In general, providing the correct getLength() value helps to prevent many common errors, so it is important to check that this function is returning the right value.   
     331
    305332== 4. Conclusion == #theend
    306333In this tutorial, we tried to cover the basics of developing custom messages. While this page describes Vendor message creation, usage delves into controller service development. The following links provides information on getting started on this front: