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

Discover host ip address netmasks #346

Merged
merged 2 commits into from
Jul 22, 2024
Merged

Conversation

arbulu89
Copy link
Contributor

@arbulu89 arbulu89 commented Jul 17, 2024

Description

Discover host netmasks and send them in the netmasks field. Each value corresponds the value in the same position for ip_addresses.

I'm aware that this "position related" usage is not optimal, and actually, in the 1st commit I implemented a more complex struct to send complete network interfaces. But this makes compatibility between old web/new agent, new web/old agent more difficult, so I sticked to simplest solution.

If for some reason, in the future we need more information about network interfaces, I finally think that we will need something more complex implementation that eventually will require some upgrade in api versioning or even major version of agent/web.

How was this tested?

Partially tested...
We don't have any code testing host discoveries, and in fact, testing network related things is pretty difficult.
Basically the serialization as json is the unique thing that it is tested.
In any case, the used functions are not changed, just the composed final code, so as everything was working now, i expect that it will continue working

@arbulu89 arbulu89 added the enhancement New feature or request label Jul 17, 2024
@arbulu89 arbulu89 changed the title Improve host network interfaces discovery Discover host ip address netmasks Jul 17, 2024
"10.1.1.6"
],
"netmasks": [
24,
Copy link
Member

@EMaksy EMaksy Jul 18, 2024

Choose a reason for hiding this comment

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

The only thing what concerns me is we must just think about using always the correct index in trento web for ip addresses and netmasks:)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As the length of ip addresses and netmasks is always the same, you can use the standard zip and unzip functions to combine them pretty easily

Copy link
Member

Choose a reason for hiding this comment

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

Oh, today I learned about lodash zipWith. Okay, this is cool!
Then never mind.

Copy link
Member

@EMaksy EMaksy left a comment

Choose a reason for hiding this comment

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

LGTM!

@arbulu89 arbulu89 merged commit 5208bcb into main Jul 22, 2024
10 checks passed
@arbulu89 arbulu89 deleted the discover-network-interfaces branch July 22, 2024 07:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

Successfully merging this pull request may close these issues.

3 participants