On Mon, Apr 08, 2013 at 06:08:57PM +0800, can. wrote: > FYI, I initially found this bug when parse the packets: > > pkt = packet.Packet(data) > for p in pkt.protocols: > print p > something_else() > > if remove __str__() entirely, would the print work correctly?
Yes, it works. It prints something like <lldp object at 0x7fac93cb1090> I wrote old lldp parser/serializer for dpkt libary before. I guess, the current lldp.py for Ryu packet library is based on it, and __str__ method was forgot to be deleted. If something more human readable is wanted, __str__ method of lldp class and LLDPBasicTLV class needs to be updated. Hmm, does it make sense to add __str__ method to all other packet parser for human readability? thanks, > > > > > 2013/4/8 Isaku Yamahata <[email protected]> > > On Sun, Apr 07, 2013 at 04:06:22PM +0800, Can Zhang wrote: > > Signed-off-by: Can Zhang <[email protected]> > > --- > > ryu/lib/packet/lldp.py | 1 - > > 1 file changed, 1 deletion(-) > > > > diff --git a/ryu/lib/packet/lldp.py b/ryu/lib/packet/lldp.py > > index f82e00a..e6d77ba 100644 > > --- a/ryu/lib/packet/lldp.py > > +++ b/ryu/lib/packet/lldp.py > > @@ -103,7 +103,6 @@ class LLDPBasicTLV(object): > > return self._LEN_MIN <= self.len and self.len <= self._LEN_MAX > > > > def __str__(self): > > - self._typelen() > > return super(LLDPBasicTLV, self).__str__() > > Good catch. > Only calling object.__str__() doesn't make much sense. > Can the method, __str__, be removed entirely from the class, LLDPBasicTLV? > (or add meaningful implementation to LLDPBasicTLV.__str__) > > thanks, > > > > > > > -- > > 1.7.11.1 > > > > > > > > ------------------------------------------------------------------------------ > > Minimize network downtime and maximize team effectiveness. > > Reduce network management and security costs.Learn how to hire > > the most talented Cisco Certified professionals. Visit the > > Employer Resources Portal > > http://www.cisco.com/web/learning/employer_resources/index.html > > _______________________________________________ > > Ryu-devel mailing list > > [email protected] > > https://lists.sourceforge.net/lists/listinfo/ryu-devel > > > > -- > yamahata > > > > > -- > Best regards, > Can Zhang > ------------------------------------------------------------------------------ > Minimize network downtime and maximize team effectiveness. > Reduce network management and security costs.Learn how to hire > the most talented Cisco Certified professionals. Visit the > Employer Resources Portal > http://www.cisco.com/web/learning/employer_resources/index.html > _______________________________________________ > Ryu-devel mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/ryu-devel -- yamahata ------------------------------------------------------------------------------ Minimize network downtime and maximize team effectiveness. Reduce network management and security costs.Learn how to hire the most talented Cisco Certified professionals. Visit the Employer Resources Portal http://www.cisco.com/web/learning/employer_resources/index.html _______________________________________________ Ryu-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ryu-devel
