On Sat, 3 Nov 2012 22:52:41 -0700 Shivaram Mysore <shivaram.mys...@gmail.com> wrote:
> I am trying to use Ryu against FlowForwarding.org LINC OpenFlow 1.2 switch. > I have written this very basic application which does not work. What am I > doing wrong? Any help is appreciated. The following code should work as you expect. = import logging import struct import array from ryu.controller import handler from ryu.controller import ofp_event from ryu.ofproto import ofproto_v1_2 from ryu.ofproto import ofproto_v1_2_parser from ryu.base import app_manager LOG = logging.getLogger('ryu.app.l2') class L2Switch(app_manager.RyuApp): OFP_VERSIONS = [ofproto_v1_2.OFP_VERSION] def __init__(self, *args, **kwargs): super(L2Switch, self).__init__(*args, **kwargs) @handler.set_ev_cls(ofp_event.EventOFPPacketIn, handler.MAIN_DISPATCHER) def packet_in_handler(self, ev): msg = ev.msg dp = msg.datapath for f in msg.match.fields: if f.header == ofproto_v1_2.OXM_OF_IN_PORT: in_port = f.value actions = [dp.ofproto_parser.OFPActionOutput(dp.ofproto.OFPP_FLOOD, 0)] out = dp.ofproto_parser.OFPPacketOut( datapath=dp, buffer_id=msg.buffer_id, in_port=in_port, actions=actions) LOG.debug("Sending message out %s", out) dp.send_msg(out) ------------------------------------------------------------------------------ LogMeIn Central: Instant, anywhere, Remote PC access and management. Stay in control, update software, and manage PCs from one command center Diagnose problems and improve visibility into emerging IT issues Automate, monitor and manage. Do more in less time with Central http://p.sf.net/sfu/logmein12331_d2d _______________________________________________ Ryu-devel mailing list Ryu-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ryu-devel