Handle LLDP parse Unicode error
Closes-Bug: #2044793 Change-Id: I48c18d1648d446d426515456a4006947b79a9ef3
This commit is contained in:
parent
76f68582d6
commit
4d3101940a
@ -55,7 +55,16 @@ class ParseLLDPHook(base.InspectionHook):
|
|||||||
'node': node_uuid})
|
'node': node_uuid})
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if parser.parse_tlv(tlv_type, data):
|
try:
|
||||||
|
parsed_tlv = parser.parse_tlv(tlv_type, data)
|
||||||
|
except UnicodeDecodeError as e:
|
||||||
|
LOG.warning("LLDP TLV type %(tlv_type)d from Node '%(node)s' "
|
||||||
|
"can't be decoded: %(exc)s",
|
||||||
|
{'tlv_type': tlv_type, 'exc': e,
|
||||||
|
'node': node_uuid})
|
||||||
|
continue
|
||||||
|
|
||||||
|
if parsed_tlv:
|
||||||
LOG.debug("Handled TLV type %d. Node: %s", tlv_type, node_uuid)
|
LOG.debug("Handled TLV type %d. Node: %s", tlv_type, node_uuid)
|
||||||
else:
|
else:
|
||||||
LOG.debug("LLDP TLV type %d not handled. Node: %s", tlv_type,
|
LOG.debug("LLDP TLV type %d not handled. Node: %s", tlv_type,
|
||||||
|
9
releasenotes/notes/fix-lldp-decode-00021e76db26b2a5.yaml
Normal file
9
releasenotes/notes/fix-lldp-decode-00021e76db26b2a5.yaml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
---
|
||||||
|
fixes:
|
||||||
|
- |
|
||||||
|
In case the lldp raw data collected by the inspection process
|
||||||
|
includes non utf-8 information, the parser fails breaking
|
||||||
|
the inspection process.
|
||||||
|
This patch works around that excluding the malformed data
|
||||||
|
and adding an entry in the logs to provide information
|
||||||
|
on the failed tlv.
|
Loading…
Reference in New Issue
Block a user