On Wed, 28 May 2014 16:58:28 -0400
Thomas F Herbert <[email protected]> wrote:
> Ryu experts,
>
> How can my app receive notification when switch features reply is
> received or when hello is received. I would like to get the datapath and
> do some other setup specific to my app before the first packet-in
> message is received.
>
> I tried setting my own handler with CONFIG_DISPATCH but I get the
> following message error:
>
> @set_ev_cls(ofp_event.EventOFPSwitchFeatures, CONFIG_DISPATCHER)
> def switch_features_handler(self, ev):
> msg = ev.msg
> self.datapath = datapath = msg.datapath
>
> self.logger.info('Received switch features handler %s', ev)
> ...
> I set the OFP version to < 1.3 to make sure that I get ports in the
> switch features too:
> ...
> class Myapp(app_manager.RyuApp):
>
> OFP_VERSIONS = [ofproto_v1_2.OFP_VERSION]
> ...
>
>
> PYTHONPATH=. ./bin/ryu-manager ryu/app/myapp.py --NetworkMask 192.168.1.1/24
> loading app ryu/app/myapp.py
> loading app ryu.controller.ofp_handler
> instantiating app ryu/app/myapp.py of Myapp
> instantiating app ryu.controller.ofp_handler of OFPHandler
> Received switch features handler
> <ryu.controller.ofp_event.EventOFPSwitchFeatures object at 0x37e9150>
> hub: uncaught exception: Traceback (most recent call last):
> File "/home/me/ryu/ryu/lib/hub.py", line 50, in _launch
> func(*args, **kwargs)
> File "/home/me/ryu/ryu/base/app_manager.py", line 256, in _event_loop
> handler(ev)
> File "/home/me/ryu/ryu/app/myapp.py", line 395, in
> switch_features_handler
> self.clean(datapath)
> File "/home/me/ryu/ryu/app/myapp.py", line 383, in clean
> datapath.send_delete_all_flows()
> File "/home/me/ryu/ryu/controller/controller.py", line 269, in
> send_delete_all_flows
> out_port=self.ofproto.OFPP_NONE, flags=0, actions=None)
> AttributeError: 'module' object has no attribute 'OFPP_NONE'
Your application uses send_delete_all_flows()? Unfortunately, the
function works only with OF1.0. You can easily do the same thing by
hand with OF1.2.
btw, if you are interested in doing something when a datapath joins, I
would recommend a different way instead of switchfeature:
http://osrg.github.io/ryu-book/en/html/traffic_monitor.html#routine-examination-of-network
------------------------------------------------------------------------------
Time is money. Stop wasting it! Get your web API in 5 minutes.
www.restlet.com/download
http://p.sf.net/sfu/restlet
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel