On Thu, 22 Jan 2015 11:32:02 +0800
Che-Wei Lin <[email protected]> wrote:

> From 8972524f642ed8f757c3c2f01e5aba94f051b4d6 Mon Sep 17 00:00:00 2001
> From: Che-Wei Lin <[email protected]>
> Date: Wed, 21 Jan 2015 14:59:51 +0800
> Subject: [PATCH] Add parsing libpcap and reading/writing PCAP file
> 
> Add parsing libpcap and reading/writing PCAP file for debugging.
> Now you can easily dump the PCAP file in ryu controller.
> 
> Here is the quick example for dumping the data packets:
> 
>     from ryu.lib import pcaplib
> 
>     class SimpleSwitch13(app_manager.RyuApp):
>         OFP_VERSIONS = [ofproto_v1_3.OFP_VERSION]
> 
>         def __init__(self, *args, **kwargs):
>             super(SimpleSwitch13, self).__init__(*args, **kwargs)
>             self.mac_to_port = {}
> 
>             # Creating an instance with a PCAP filename
>             self.pcap_pen = Writer(open('mypcap.pcap', 'wb'))
> 
>         @set_ev_cls(ofp_event.EventOFPPacketIn, MAIN_DISPATCHER)
>         def _packet_in_handler(self, ev):
>             msg = ev.msg
> 
>             # Dump the data packet into PCAP file
>             self.pcap_pen.write_pkt(msg.data)
> 
> Signed-off-by: Che-Wei Lin <[email protected]>
> ---
>  ryu/lib/pcaplib.py | 286 
> +++++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 286 insertions(+)
>  create mode 100644 ryu/lib/pcaplib.py

This is really nice stuff. Thanks a lot! I've fixed some pep8 warnings
and applied.

------------------------------------------------------------------------------
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
http://p.sf.net/sfu/gigenet
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to