dp.ofproto.OFP_VERSION is a single value which represents only one version, so determining OFP_VERSION by two 'if's breaks compatibility for both OF 1.0 & 1.3 datapaths. The patch fixes get_flow_stats & mod_flow_entry broken in OF1.0 dp and get_desc_stats, get_port_stats & delete_flow_entry broken in OF1.3 dp.
It makes delete_flow_entry as a flow mod wrapper with empty flow entry for 1.3 instead of adding more methods into ofctl_v1_3.py. This is based on my last patch to ofctl_v1_3.py. Signed-off-by: Wei-Li Tang <[email protected]> --- ryu/app/ofctl_rest.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ryu/app/ofctl_rest.py b/ryu/app/ofctl_rest.py index 4e3e46f..9840b0f 100644 --- a/ryu/app/ofctl_rest.py +++ b/ryu/app/ofctl_rest.py @@ -82,6 +82,8 @@ class StatsController(ControllerBase): if dp.ofproto.OFP_VERSION == ofproto_v1_0.OFP_VERSION: desc = ofctl_v1_0.get_desc_stats(dp, self.waiters) + elif dp.ofproto.OFP_VERSION == ofproto_v1_3.OFP_VERSION: + desc = ofctl_v1_3.get_desc_stats(dp, self.waiters) else: LOG.debug('Unsupported OF protocol') return Response(status=501) @@ -96,7 +98,7 @@ class StatsController(ControllerBase): if dp.ofproto.OFP_VERSION == ofproto_v1_0.OFP_VERSION: flows = ofctl_v1_0.get_flow_stats(dp, self.waiters) - if dp.ofproto.OFP_VERSION == ofproto_v1_3.OFP_VERSION: + elif dp.ofproto.OFP_VERSION == ofproto_v1_3.OFP_VERSION: flows = ofctl_v1_3.get_flow_stats(dp, self.waiters) else: LOG.debug('Unsupported OF protocol') @@ -112,6 +114,8 @@ class StatsController(ControllerBase): if dp.ofproto.OFP_VERSION == ofproto_v1_0.OFP_VERSION: ports = ofctl_v1_0.get_port_stats(dp, self.waiters) + elif dp.ofproto.OFP_VERSION == ofproto_v1_3.OFP_VERSION: + ports = ofctl_v1_3.get_port_stats(dp, self.waiters) else: LOG.debug('Unsupported OF protocol') return Response(status=501) @@ -142,7 +146,7 @@ class StatsController(ControllerBase): if dp.ofproto.OFP_VERSION == ofproto_v1_0.OFP_VERSION: ofctl_v1_0.mod_flow_entry(dp, flow, cmd) - if dp.ofproto.OFP_VERSION == ofproto_v1_3.OFP_VERSION: + elif dp.ofproto.OFP_VERSION == ofproto_v1_3.OFP_VERSION: ofctl_v1_3.mod_flow_entry(dp, flow, cmd) else: LOG.debug('Unsupported OF protocol') @@ -157,6 +161,8 @@ class StatsController(ControllerBase): if dp.ofproto.OFP_VERSION == ofproto_v1_0.OFP_VERSION: ofctl_v1_0.delete_flow_entry(dp) + elif dp.ofproto.OFP_VERSION == ofproto_v1_3.OFP_VERSION: + ofctl_v1_3.mod_flow_entry(dp, {}, dp.ofproto.OFPFC_DELETE) else: LOG.debug('Unsupported OF protocol') return Response(status=501) -- 1.7.9.5 ------------------------------------------------------------------------------ November Webinars for C, C++, Fortran Developers Accelerate application performance with scalable programming models. Explore techniques for threading, error checking, porting, and tuning. Get the most from the latest Intel processors and coprocessors. See abstracts and register http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk _______________________________________________ Ryu-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ryu-devel
