topology.switches: stop abusing Packet.next()
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
parent
e9ee8c90b5
commit
b7235b395a
@ -394,10 +394,11 @@ class LLDPPacket(object):
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def lldp_parse(data):
|
def lldp_parse(data):
|
||||||
pkt = packet.Packet(data)
|
pkt = packet.Packet(data)
|
||||||
eth_pkt = pkt.next()
|
i = iter(pkt)
|
||||||
|
eth_pkt = i.next()
|
||||||
assert type(eth_pkt) == ethernet.ethernet
|
assert type(eth_pkt) == ethernet.ethernet
|
||||||
|
|
||||||
lldp_pkt = pkt.next()
|
lldp_pkt = i.next()
|
||||||
if type(lldp_pkt) != lldp.lldp:
|
if type(lldp_pkt) != lldp.lldp:
|
||||||
raise LLDPPacket.LLDPUnknownFormat()
|
raise LLDPPacket.LLDPUnknownFormat()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user