> On Fri, 16 Aug 2013 15:29:22 +0900 > YAMAMOTO Takashi <yamam...@valinux.co.jp> wrote: > >> Signed-off-by: YAMAMOTO Takashi <yamam...@valinux.co.jp> >> --- >> ryu/ofproto/ofproto_v1_0_parser.py | 6 +++++- >> 1 file changed, 5 insertions(+), 1 deletion(-) >> >> diff --git a/ryu/ofproto/ofproto_v1_0_parser.py >> b/ryu/ofproto/ofproto_v1_0_parser.py >> index 3fae86d..e1951c8 100644 >> --- a/ryu/ofproto/ofproto_v1_0_parser.py >> +++ b/ryu/ofproto/ofproto_v1_0_parser.py >> @@ -18,6 +18,7 @@ import struct >> import binascii >> >> from ofproto_parser import StringifyMixin, MsgBase, msg_pack_into, >> msg_str_attr >> +from ryu.lib import addrconv >> from ryu.lib import mac >> from . import ofproto_parser >> from . import ofproto_v1_0 >> @@ -86,6 +87,9 @@ 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) >> + i = cls._fields.index('hw_addr') >> + port = list(port) >> + port[i] = addrconv.mac.bin_to_text(port[i]) >> return cls(*port) > > Can we use unicode type here? Then _encode_value() in stringfy.py just
are you talking about "name", not "hw_addr"? the OF spec seems silent about the encoding or charset of "name". (can you, or someone with ONF membership, file a clarification request? ofp_table_features.name has the same problem.) OVS uses utf-8. (i haven't investigated what charset it allows but at least it seems to allow japanese hiragana.) LINC uses something like "Port7" or "Port\7" where port_no is 7. (the latter seems like a bug. i filed a pull request for that. https://github.com/FlowForwarding/LINC-Switch/pull/133) do you prefer just assuming utf-8? it breaks "Port\7" which might be invalid utf-8 depending on port_no. > converts unicode to utf-8? Why _encode_value() in stringfy.py uses > be64 for unicode? because there is no way for the decoder to know which python type it used to be. YAMAMOTO Takashi > > ------------------------------------------------------------------------------ > 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 > Ryu-devel@lists.sourceforge.net > 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 Ryu-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ryu-devel