Hi All,

I have traditionally been using POX but now am in need of OFv1.3
controller. However in search of a starting point im trying to write OFv1.0
applications. Im facing some issues regarding the same.

Snippets of the code are as below:

from ryu.base import app_manager
from ryu.controller import ofp_event
from ryu.controller.handler import CONFIG_DISPATCHER, MAIN_DISPATCHER
from ryu.controller.handler import set_ev_cls
from ryu.ofproto import ofproto_v1_0
from ryu.ofproto import ofproto_v1_0_parser
from ryu.lib.packet import packet
from ryu.lib.packet import ethernet

class SimpleSwitch10(app_manager.RyuApp):
    OFP_VERSIONS = [ofproto_v1_0.OFP_VERSION]

    def __init__(self, *args, **kwargs):
        super(SimpleSwitch10, self).__init__(*args, **kwargs)
        self.mac_to_port = {}

    @set_ev_cls(ofp_event.EventOFPSwitchFeatures, CONFIG_DISPATCHER)
    def switch_features_handler(self, ev):
        datapath = ev.msg.datapath
        ofproto = datapath.ofproto
        parser = datapath.ofproto_parser

        match = parser.OFPMatch()
        actions = [parser.OFPActionOutput(2)]#Just a sample port
        self.add_flow(datapath, 0, match, actions)

    def add_flow(self, datapath, priority, match, actions):
        ofproto = datapath.ofproto
        parser = datapath.ofproto_parser

        inst = [parser.OFPInstructionActions(ofproto.OFPIT_APPLY_ACTIONS,
                                             actions)]
        mod = parser.OFPFlowMod(datapath=datapath, priority=priority,
match=match,
instructions=inst)
        datapath.send_msg(mod)


However I get the following error:

mininet@mininet-vm:~$ ryu-manager simple_switch_10.py
loading app simple_switch_13.py
loading app ryu.controller.ofp_handler
instantiating app simple_switch_13.py of SimpleSwitch13
instantiating app ryu.controller.ofp_handler of OFPHandler

hub: uncaught exception: Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/ryu/lib/hub.py", line 48, in
_launch
    func(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/ryu/base/app_manager.py",
line 142, in _event_loop
    handler(ev)
  File "/home/mininet/simple_switch_13.py", line 51, in
switch_features_handler
    self.add_flow(datapath, 0, match, actions)
  File "/home/mininet/simple_switch_13.py", line 57, in add_flow
    inst = [parser.OFPInstructionActions(ofproto.OFPIT_APPLY_ACTIONS,
AttributeError: 'module' object has no attribute 'OFPInstructionActions'

I understand what is there error but not understand how to bypass it
because 1.3 and 1.2 use the same module and theres not much documentation
regarding 1.0. I might be missing something very obvious.

I would be highly obliged if someone could help me out on this!

Regards,

Vinay Pai B.H.

-- 
Vinay Pai B.H.
Grad Student - Computer Science
Viterbi School of Engineering
University of Southern California
Los Angeles, CA, USA
------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today. 
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to