On Mon, 4 Feb 2013 21:33:40 +0900 YAMADA Hideki <[email protected]> wrote:
> See "ryu/tests/unit/packet/test_lldp.py" to use this library. > > This patch is based on Yamahata's topology discovery patch series. > http://thread.gmane.org/gmane.network.ryu.devel/467 > > Signed-off-by: YAMADA Hideki <[email protected]> > --- > ryu/lib/packet/lldp.py | 496 > ++++++++++++++++++++++++++++++++++++ > ryu/lib/packet/vlan.py | 2 + > ryu/ofproto/ether.py | 1 + > ryu/tests/unit/packet/test_lldp.py | 260 +++++++++++++++++++ > 4 files changed, 759 insertions(+), 0 deletions(-) > create mode 100644 ryu/lib/packet/lldp.py > create mode 100644 ryu/tests/unit/packet/test_lldp.py > > diff --git a/ryu/lib/packet/lldp.py b/ryu/lib/packet/lldp.py > new file mode 100644 > index 0000000..5ff258f > --- /dev/null > +++ b/ryu/lib/packet/lldp.py > @@ -0,0 +1,496 @@ > +# Copyright (C) 2012 Nippon Telegraph and Telephone Corporation. > +# Copyright (C) 2012 Isaku Yamahata <yamahata at private email ne jp> > +# > +# Licensed under the Apache License, Version 2.0 (the "License"); > +# you may not use this file except in compliance with the License. > +# You may obtain a copy of the License at > +# > +# http://www.apache.org/licenses/LICENSE-2.0 > +# > +# Unless required by applicable law or agreed to in writing, software > +# distributed under the License is distributed on an "AS IS" BASIS, > +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or > +# implied. > +# See the License for the specific language governing permissions and > +# limitations under the License. > + > +""" > +Link Layer Discovery Protocol(LLDP, IEEE 802.1AB) > +http://standards.ieee.org/getieee802/download/802.1AB-2009.pdf > + > + > +basic TLV format > + > +octets | 1 | 2 | 3 ... n + 2 | > + -------------------------------------------------------- > + | TLV type | TLV information | TLV information string | > + | (7bits) | string length | ( 0 <= n <= 511 octets) | > + | | (9bits) | | > + -------------------------------------------------------- > +bits |8 2|1|8 1| > + > + > +LLDPDU format > + > + ------------------------------------------------------------------------ > + | Chassis ID | Port ID | TTL | optional TLV | ... | optional TLV | End | > + ------------------------------------------------------------------------ > + > +Chasis ID, Port ID, TTL, End are mandatory > +optional TLV may be inserted in any order > +""" > + > +import logging > +import struct > +from ryu.lib.packet import packet_base > + > + > +LOG = logging.getLogger(__name__) Thanks, I applied this with the above dropped since - looks like it's not used. - other packet libraries don't have logger. ------------------------------------------------------------------------------ Free Next-Gen Firewall Hardware Offer Buy your Sophos next-gen firewall before the end March 2013 and get the hardware for free! Learn more. http://p.sf.net/sfu/sophos-d2d-feb _______________________________________________ Ryu-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ryu-devel
