Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to support unknown IEs when decoding template sets #380

Merged

Conversation

antoninbas
Copy link
Member

Introduce a "decoding mode" configuration for the collector process, which can take one of 3 values: Strict, LenientKeepUnknown, LenientDropUnknown. When the mode is Strict, unknown IEs are rejected. This is the default mode and matches the behavior prior to this patch. When the mode is LenientKeepUnknown, unknown IEs are accepted and will be preserved in data records. When the mode is LenientDropUnknown, unknown IEs are accepted but will not be included in data records (creating a mismatch between the data record and the template).

When decoding is not strict and the IE is not found in the registry, the name and type of the IE are not known. Name is kept as an empty string. Type is always set to OctetArray. The length is known as it is included in the template record.

This change required adding support for the OctetArray type (fixed-length or variable-length).

@antoninbas antoninbas marked this pull request as draft November 1, 2024 21:14
Copy link

codecov bot commented Nov 1, 2024

Codecov Report

Attention: Patch coverage is 66.66667% with 44 lines in your changes missing coverage. Please review.

Project coverage is 67.25%. Comparing base (96bf286) to head (73c388b).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
pkg/entities/ie.go 41.93% 16 Missing and 2 partials ⚠️
pkg/entities/set.go 40.00% 10 Missing and 5 partials ⚠️
pkg/entities/ie_value.go 62.96% 10 Missing ⚠️
pkg/collector/process.go 97.50% 0 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #380      +/-   ##
==========================================
- Coverage   67.28%   67.25%   -0.03%     
==========================================
  Files          25       25              
  Lines        4374     4465      +91     
==========================================
+ Hits         2943     3003      +60     
- Misses       1241     1269      +28     
- Partials      190      193       +3     
Flag Coverage Δ
integration-tests 52.48% <63.41%> (+0.43%) ⬆️
unit-tests 66.24% <66.66%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
pkg/exporter/process.go 56.78% <100.00%> (+0.51%) ⬆️
pkg/test/util.go 94.68% <100.00%> (-0.14%) ⬇️
pkg/collector/process.go 88.76% <97.50%> (+3.57%) ⬆️
pkg/entities/ie_value.go 45.82% <62.96%> (+1.56%) ⬆️
pkg/entities/set.go 63.86% <40.00%> (-6.67%) ⬇️
pkg/entities/ie.go 47.51% <41.93%> (-0.37%) ⬇️

@antoninbas antoninbas force-pushed the accept-unknown-fields-in-template-sets branch from 4c9966e to 6044ae4 Compare November 5, 2024 20:57
Introduce a "decoding mode" configuration for the collector process,
which can take one of 3 values: Strict, LenientKeepUnknown,
LenientDropUnknown. When the mode is Strict, unknown IEs are
rejected. This is the default mode and matches the behavior prior to
this patch. When the mode is LenientKeepUnknown, unknown IEs are
accepted and will be preserved in data records. When the mode is
LenientDropUnknown, unknown IEs are accepted but will not be included in
data records (creating a mismatch between the data record and the
template).

When decoding is not strict and the IE is not found in the registry, the
name and type of the IE are not known. Name is kept as an empty
string. Type is always set to OctetArray. The length is known as it is
included in the template record.

This change required adding support for the OctetArray type
(fixed-length or variable-length).

Signed-off-by: Antonin Bas <antonin.bas@broadcom.com>
@antoninbas antoninbas force-pushed the accept-unknown-fields-in-template-sets branch from 6044ae4 to 73c388b Compare November 5, 2024 21:29
@antoninbas antoninbas marked this pull request as ready for review November 5, 2024 21:39
Copy link
Contributor

@heanlan heanlan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@antoninbas antoninbas merged commit 43c0400 into vmware:main Nov 8, 2024
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants