On Thu, 22 Aug 2013 16:36:15 +0900 (JST)
FUJITA Tomonori <[email protected]> wrote:

> On Wed, 21 Aug 2013 13:01:01 -0300
> Tonhão - Antonio Brasolin <[email protected]> wrote:
> 
>> I'm trying to run an app that detects links but, for some reason, the link
>> event just isn't happening. Is it some change on an API? It works fine on
>> older versions of ryu and on the version with the GUI.
>> 
>> Thank you in advance.
>> 
>> Relevant parts of the code:
>> .
>> .
>> .
>>     _CONTEXTS = {'dpset': dpset.DPSet,  # used for EventDP
>>                  'switches': switches.Switches,  # used for EventLinkAdd
>>                  'wsgi': WSGIApplication}  # used for REST stuff
>> 
>> .
>> .
>> .
>> 
>>     @set_ev_cls(event.EventLinkAdd, MAIN_DISPATCHER)
>>     def link_handler(self, ev):
>> 
>> Command used to run the application:
>> PYTHONPATH=. bin/ryu-manager --observe-links ../myapp.py
> 
> You got an exception in switches? There is one known bug, which should
> be fixed shortly.

btw, here's a workaround.

diff --git a/ryu/ofproto/ofproto_v1_0_parser.py 
b/ryu/ofproto/ofproto_v1_0_parser.py
index 3fae86d..535d0f5 100644
--- a/ryu/ofproto/ofproto_v1_0_parser.py
+++ b/ryu/ofproto/ofproto_v1_0_parser.py
@@ -19,6 +19,7 @@ import binascii
 
 from ofproto_parser import StringifyMixin, MsgBase, msg_pack_into, msg_str_attr
 from ryu.lib import mac
+from ryu.lib import addrconv
 from . import ofproto_parser
 from . import ofproto_v1_0
 from . import nx_match
@@ -86,7 +87,7 @@ class OFPPhyPort(ofproto_parser.namedtuple('OFPPhyPort', (
     def parser(cls, buf, offset):
         port = struct.unpack_from(ofproto_v1_0.OFP_PHY_PORT_PACK_STR,
                                   buf, offset)
-        return cls(*port)
+        return cls(*(port[0], addrconv.mac.bin_to_text(port[1])) + port[2:])
 
 
 class OFPMatch(StringifyMixin):
diff --git a/ryu/ofproto/ofproto_v1_2_parser.py 
b/ryu/ofproto/ofproto_v1_2_parser.py
index a9bd0b1..5a0ed23 100644
--- a/ryu/ofproto/ofproto_v1_2_parser.py
+++ b/ryu/ofproto/ofproto_v1_2_parser.py
@@ -18,6 +18,7 @@ import struct
 import itertools
 
 from ryu.lib import mac
+from ryu.lib import addrconv
 from ryu import utils
 from ofproto_parser import StringifyMixin, MsgBase, msg_pack_into, msg_str_attr
 from . import ofproto_parser
@@ -175,7 +176,7 @@ class OFPPort(ofproto_parser.namedtuple('OFPPort', (
     @classmethod
     def parser(cls, buf, offset):
         port = struct.unpack_from(ofproto_v1_2.OFP_PORT_PACK_STR, buf, offset)
-        return cls(*port)
+        return cls(*(port[0], addrconv.mac.bin_to_text(port[1])) + port[2:])
 
 
 @_set_msg_type(ofproto_v1_2.OFPT_FEATURES_REQUEST)

------------------------------------------------------------------------------
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://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

------------------------------------------------------------------------------
Introducing Performance Central, a new site from SourceForge and 
AppDynamics. Performance Central is your source for news, insights, 
analysis and resources for efficient Application Performance Management. 
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to