2013/7/23 Isaku Yamahata <[email protected]>:
> On Tue, Jul 23, 2013 at 09:04:05PM +0900, OHMURA Kei wrote:
..
>> @@ -218,7 +225,13 @@ class RestStatsApi(app_manager.RyuApp):
>>          lock, msgs = self.waiters[dp.id][msg.xid]
>>          msgs.append(msg)
>>
>> -        if msg.flags & dp.ofproto.OFPSF_REPLY_MORE:
>> +        flags = 0
>> +        if dp.ofproto.OFP_VERSION == ofproto_v1_0.OFP_VERSION:
>> +            flags = dp.ofproto.OFPSF_REPLY_MORE
>> +        elif dp.ofproto.OFP_VERSION == ofproto_v1_0.OFP_VERSION:
>                                                      3?

Oops, thanks for your review.

>From cef68912888ded5cb7c572e37033458b886b12e1 Mon Sep 17 00:00:00 2001
From: OHMURA Kei <[email protected]>
Date: Wed, 24 Jul 2013 08:09:40 +0900
Subject: [PATCH] ryu/app/ofctl_rest: add of1.3 support

This patch allows users to manually insert flows into switches via OpenFlow1.3
in the following way:

curl -d '{"dpid":"1", "priority":"32768",\
          "actions":[{"type":"SET_FIELD","field":"vlan_vid","value":10},\
                         {"type":"OUTPUT","port":2},\
                         {"type":"GOTO_TABLE","table_id":3}],\
          "match":{"in_port":1}}' http://127.0.0.1:8080/stats/flowentry/add

Signed-off-by: OHMURA Kei <[email protected]>
---
 ryu/app/ofctl_rest.py |   17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/ryu/app/ofctl_rest.py b/ryu/app/ofctl_rest.py
index 5a5223a..4e3e46f 100644
--- a/ryu/app/ofctl_rest.py
+++ b/ryu/app/ofctl_rest.py
@@ -24,7 +24,9 @@ from ryu.controller import dpset
 from ryu.controller.handler import MAIN_DISPATCHER
 from ryu.controller.handler import set_ev_cls
 from ryu.ofproto import ofproto_v1_0
+from ryu.ofproto import ofproto_v1_3
 from ryu.lib import ofctl_v1_0
+from ryu.lib import ofctl_v1_3
 from ryu.app.wsgi import ControllerBase, WSGIApplication


@@ -94,6 +96,8 @@ 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:
+            flows = ofctl_v1_3.get_flow_stats(dp, self.waiters)
         else:
             LOG.debug('Unsupported OF protocol')
             return Response(status=501)
@@ -138,6 +142,8 @@ 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:
+            ofctl_v1_3.mod_flow_entry(dp, flow, cmd)
         else:
             LOG.debug('Unsupported OF protocol')
             return Response(status=501)
@@ -159,7 +165,8 @@ class StatsController(ControllerBase):


 class RestStatsApi(app_manager.RyuApp):
-    OFP_VERSIONS = [ofproto_v1_0.OFP_VERSION]
+    OFP_VERSIONS = [ofproto_v1_0.OFP_VERSION,
+                    ofproto_v1_3.OFP_VERSION]
     _CONTEXTS = {
         'dpset': dpset.DPSet,
         'wsgi': WSGIApplication
@@ -218,7 +225,13 @@ class RestStatsApi(app_manager.RyuApp):
         lock, msgs = self.waiters[dp.id][msg.xid]
         msgs.append(msg)

-        if msg.flags & dp.ofproto.OFPSF_REPLY_MORE:
+        flags = 0
+        if dp.ofproto.OFP_VERSION == ofproto_v1_0.OFP_VERSION:
+            flags = dp.ofproto.OFPSF_REPLY_MORE
+        elif dp.ofproto.OFP_VERSION == ofproto_v1_3.OFP_VERSION:
+            flags = dp.ofproto.OFPMPF_REPLY_MORE
+
+        if msg.flags & flags:
             return
         del self.waiters[dp.id][msg.xid]
         lock.set()
--
1.7.9.5

------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to