From 8b4b31287d22d789f8e5058bfec588ebed2e6ccb Mon Sep 17 00:00:00 2001 From: Dolev Hasid Date: Mon, 11 Nov 2024 16:59:06 +0200 Subject: [PATCH 1/2] bugfix/ipfix-value-error --- netflow/ipfix.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/netflow/ipfix.py b/netflow/ipfix.py index 88c0334..f7e188a 100644 --- a/netflow/ipfix.py +++ b/netflow/ipfix.py @@ -732,7 +732,7 @@ def __init__(self, data, template: List[Union[TemplateField, TemplateFieldEnterp # See comment in IPFIXFieldTypes.get_type_unpack for more information. field_type = IPFIXFieldTypes.by_id(field_type_id) # type: Optional[FieldType] - if not field_type and type(field) is not TemplateFieldEnterprise: + if not field_type: # This should break, since the exporter seems to use a field identifier # which is not standardized by IANA. raise NotImplementedError("Field type with ID {} is not implemented".format(field_type_id)) From 27d719ccc88ad944b7a498c0ec8fa2a5a1a10e0f Mon Sep 17 00:00:00 2001 From: dolevha <93181039+dolevha@users.noreply.github.com> Date: Thu, 12 Dec 2024 15:36:14 +0200 Subject: [PATCH 2/2] Update netflow/ipfix.py --- netflow/ipfix.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/netflow/ipfix.py b/netflow/ipfix.py index f7e188a..3ff9746 100644 --- a/netflow/ipfix.py +++ b/netflow/ipfix.py @@ -733,9 +733,14 @@ def __init__(self, data, template: List[Union[TemplateField, TemplateFieldEnterp field_type = IPFIXFieldTypes.by_id(field_type_id) # type: Optional[FieldType] if not field_type: - # This should break, since the exporter seems to use a field identifier - # which is not standardized by IANA. - raise NotImplementedError("Field type with ID {} is not implemented".format(field_type_id)) + if type(field) is not TemplateFieldEnterprise: + # This should break, since the exporter seems to use a field identifier + # which is not standardized by IANA. + raise NotImplementedError("Field type with ID {} is not implemented".format(field_type_id)) + else: + # This should break, since the exporter seems to use a field identifier + # which is not suppored + raise NotImplementedError("Field type with ID {} is not suppored".format(field_type_id)) datatype = field_type.type # type: str discovered_fields.append((datatype, field_type_id))