On Wed, 10 Oct 2012 15:44:23 -0300
Ramon Marques <[email protected]> wrote:
> A simple aplication that just print the packets.
> I have two handlers. Packet in handler and Event DP handlers
The following is an example about how to handle the above two
events. This can get the events with OF1.2 switch (modified OVS).
=
from ryu.controller import handler
from ryu.controller import dpset
from ryu.controller import ofp_event
from ryu.ofproto import ofproto_v1_2
from ryu.ofproto import ofproto_v1_2_parser
from ryu.ofproto import inet
from ryu.ofproto import ether
from ryu.base import app_manager
from ryu.lib.packet import packet
from ryu.ofproto.ofproto_parser import MsgBase, msg_pack_into, msg_str_attr
import array
class PacketTest(app_manager.RyuApp):
_CONTEXTS = {
'dpset': dpset.DPSet,
}
def __init__(self, *args, **kwargs):
pass
@handler.set_ev_cls(ofp_event.EventOFPPacketIn, handler.MAIN_DISPATCHER)
def packet_in_handler(self, ev):
msg = ev.msg
pkt = packet.Packet(array.array('B', msg.data))
for p in pkt:
print p.protocol_name, p
@handler.set_ev_cls(dpset.EventDP, dpset.DPSET_EV_DISPATCHER)
def handler_datapath(self, ev):
print "datapath join/leave"
------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel