Hello,
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.
import logging
import struct
import array
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_v1_2_parser import *
from ryu.controller.handler import MAIN_DISPATCHER, set_ev_cls
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)
@set_ev_cls(ofp_event.EventOFPPacketIn, MAIN_DISPATCHER)
def packet_in_handler(self, ev):
pkt = packet.Packet(array.array('B', ev.msg.data))
print pkt.protocols
for p in pkt.protocols:
print p
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
class Datapath(object):
ofproto = ofproto_v1_2
ofproto_parser = ofproto_v1_2_parser
### I am not sure if the below is correct
actions = [ofp_parser.OFPActionOutput(ofp.OFPP_FLOOD)]
out = ofp_parser.OFPPacketOut(
datapath=dp, buffer_id=msg.buffer_id, in_port=msg.in_port,
actions=actions)
LOG.debug("Sending message out %s", out)
dp.send_msg(out)
Thanks
/Shivaram
------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel