Thank you. 
   This is the patch.
  
  
  
    
    
   
  On 2016/01/13 10:34
  俊 赵 <[email protected]> wrote:
  
  
  
   
    Thanks.
    
     
    
    
     I can try the patch.
    
    
     
    
    
     And I also provide you with the details but I am not sure whether it 
causes this.
    
    
     
    
    
     I want to use ryu.topology to find switches entering in the network. I am 
using Open vSwitch 2.4.0.
    
    
     
    
    
     So I use the following code
    
    
     
    
    
     from ryu.topology import api as topo_api
from ryu.topology import event as topo_event
    
    
     
    
    
     @set_ev_cls(topo_event.EventSwitchEnter)
 def _switch_enter_handler(self, ev):
 # self.datapath_ip = {}
 for sw in topo_api.get_all_switch(self):
 if sw.dp.id == ev.switch.dp.id:
 console.info("enter a switch with attributes datapath - 
"+str(sw.dp.id)+" and ip - "+sw.dp.socket.getpeername()[0])
    
    
     Every time I start the app, it shows me that warning.
    
    
     
    
    
     Thank you!
     
     
     Zhao Jun
     
     
     
      Date: Wed, 13 Jan 2016 10:19:09 +0900
      From: [email protected]
      To: [email protected]; [email protected]
      Subject: Re: [Ryu-devel] /ryu/topology/switches.py:545: UserWarning: 
Datapath#ports
      
      
      
      
       Hi,
      
      
      
       
      
      
       The warning mean that Datapath#ports is not recommended to use directory.
      
      
       But the warning should not be appear in this case.
      
      
       Because perhaps you just use ryu.topology.
       
      
      
       
      
      
       I found out the code of the cause. 
       This should be suppressed.
      
      
       https://github.com/osrg/ryu/blob/v3.29/ryu/topology/switches.py#L545
       
      
      
       
      
      
       I can make a patch to resolve the issue b
       ut I don't know how to hit the above line.
      
      
       My environment don't show the warning. (Mininet w/ Open vSwitch)
      
      
       Can you confirm the patch instead of me?
      
      
       Or please give me more details. (e.g. product name of your openflow 
switch and your procedure)
      
      
        
        
       
      
      
       Regards,
      
      
       Satoshi
      
      
       
      On 2016/01/12 14:30
      俊 赵 <[email protected]> wrote:
      
      
      
       
        Hi,
        
         
        
        
         I got warning with 
"/usr/local/lib/python2.7/dist-packages/ryu/topology/switches.py:545: 
UserWarning: Datapath#ports is kept for compatibility with the previous 
openflow versions (< 1.3). This not be updated by EventOFPPortStatus 
message. If you want to be updated, you can use 'ryu.controller.dpset' or 
'ryu.topology.switches'.
         
           for port in dp.ports.values():
         "
        
        
         
        
        
         I found this message coming from /ryu/controller/controller.py
        
        
         
        
        
         The constraint causing this is "ofproto.OFP_VERSION >= 
0x04"
        
        
         
        
        
         Does it mean that if I am using openflow 1.3, the warning message will 
trigger all the time?
        
        
         
        
        
         How can I get rid of this?
        
        
         
        
        
         Thanks.
        
        
         
         
         Zhao Jun
         
       
       
      
      
      
      
------------------------------------------------------------------------------Site24x7
 APM Insight: Get Deep Visibility into Application PerformanceAPM + Mobile APM 
+ RUM: Monitor 3 App instances at just $35/MonthMonitor end-to-end web 
transactions and take corrective actions nowTroubleshoot faster and improve 
end-user experience. Signup Now!
      http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
      _______________________________________________Ryu-devel mailing 
[email protected]
      https://lists.sourceforge.net/lists/listinfo/ryu-devel
     
     
   
   
  
  
  -- 
  Satoshi KOBAYASHI
>From 3a13870d0f6d64d7f4b72b35e9c38dbb42fae6a4 Mon Sep 17 00:00:00 2001
From: Satoshi KOBAYASHI <[email protected]>
Date: Wed, 13 Jan 2016 10:45:20 +0900
Subject: [PATCH] topology: suppress UserWarning

The warning which should be suppressed was left.
Relate to: https://www.mail-archive.com/ryu-devel%40lists.sourceforge.net/msg08747.html

Signed-off-by: Satoshi KOBAYASHI <[email protected]>
---
 ryu/topology/switches.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/ryu/topology/switches.py b/ryu/topology/switches.py
index 5fe5d26..3408982 100644
--- a/ryu/topology/switches.py
+++ b/ryu/topology/switches.py
@@ -18,6 +18,7 @@ import six
 import struct
 import time
 import json
+import warnings
 from ryu import cfg
 
 from ryu.topology import event
@@ -542,8 +543,10 @@ class Switches(app_manager.RyuApp):
         self.dps[dp.id] = dp
         if dp.id not in self.port_state:
             self.port_state[dp.id] = PortState()
-            for port in dp.ports.values():
-                self.port_state[dp.id].add(port.port_no, port)
+            with warnings.catch_warnings():
+                warnings.simplefilter('ignore')
+                for port in dp.ports.values():
+                    self.port_state[dp.id].add(port.port_no, port)
 
     def _unregister(self, dp):
         if dp.id in self.dps:
-- 
2.5.4 (Apple Git-61)

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to