Hi,
On Fri, 31 May 2013 17:26:05 +0800
arne_goetje <[email protected]> wrote:
> 1. On your wiki, you mention that you plan to replace dpset with topology.
> What's the status now? Is topology usable already? And if yes, how to
> replace a line like:
>
> @handler.set_ev_cls(dpset.EventDP, dpset.DPSET_EV_DISPATCHER)
>
> with topology?
It can generate an event like the above however it's not ready
(especially you are interested in OF1.3).
> 2. in the OpenFlow example on the wiki, you use the following handler
> line:
>
> @set_ev_cls(ofp_event.EventOFPPacketIn, MAIN_DISPATCHER)
>
> Also, several scripts in the ryu source code use
> ofp_event.EventOFPPacketIn.
> However, I cannot find it defined anywhere in ofp_event. Why?
They are dynamically created. That's, if you add a new OF message,
the event for it is created automatically.
If you are interested in the details, look at controller/ofp_event.py
> 3. If I use my script, which works perfectly fine with OF 1.2 and want to
> test it with 1.3, the
>
> @handler.set_ev_cls(dpset.EventDP, dpset.DPSET_EV_DISPATCHER)
>
> actually causes an exception:
>
> hub: uncaught exception: Traceback (most recent call last):
> File
> "/usr/local/lib/python2.7/dist-packages/ryu-1.9-py2.7.egg/ryu/lib/hub.py",
> line 50, in _launch
> func(*args, **kwargs)
> File
> "/usr/local/lib/python2.7/dist-packages/ryu-1.9-py2.7.egg/ryu/base/app_manager.py",
>
> line 104, in _event_loop
> handler(ev)
> File
> "/usr/local/lib/python2.7/dist-packages/ryu-1.9-py2.7.egg/ryu/controller/dpset.py",
>
> line 164, in switch_features_handler
> datapath.ports = msg.ports
> AttributeError: 'OFPSwitchFeatures' object has no attribute 'ports'
dpset can't handle OF1.3. Can you try the following workaround?
diff --git a/ryu/controller/dpset.py b/ryu/controller/dpset.py
index c172aec..168bb39 100644
--- a/ryu/controller/dpset.py
+++ b/ryu/controller/dpset.py
@@ -75,11 +75,18 @@ class PortState(dict):
def add(self, port_no, port):
self[port_no] = port
+ # hacky workaround for OF1.3, should be removed.
def remove(self, port_no):
- del self[port_no]
+ try:
+ del self[port_no]
+ except:
+ pass
def modify(self, port_no, port):
- self[port_no] = port
+ try:
+ self[port_no] = port
+ except:
+ pass
# this depends on controller::Datapath and dispatchers in handler
@@ -163,7 +170,10 @@ class DPSet(app_manager.RyuApp):
def switch_features_handler(self, ev):
msg = ev.msg
datapath = msg.datapath
- datapath.ports = msg.ports
+ if datapath.ofproto.OFP_VERSION < 0x04:
+ datapath.ports = msg.ports
+ else:
+ datapath.ports = {}
@set_ev_cls(ofp_event.EventOFPPortStatus, handler.MAIN_DISPATCHER)
def port_status_handler(self, ev):
------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite
It's a free troubleshooting tool designed for production
Get down to code-level detail for bottlenecks, with <2% overhead.
Download for free and get started troubleshooting in minutes.
http://p.sf.net/sfu/appdyn_d2d_ap2
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel