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

Add non-filtered interfaces to the API response (LP: #2052834) #241

Merged
merged 2 commits into from
May 30, 2024

Conversation

ghadi-rahme
Copy link
Contributor

Currently not all interfaces show up in the API response (interfaces with no IP address, in the down state, etc...).
This patch makes any interface that is not filtered out and has a valid MAC address show up in the API response. All previously included interfaces will still show up as expected.

Mainly interfaces in the down state as well as interfaces in the up state but with no IP address assigned to them will now show up in the API response as long as they have a MAC address.
The IP address, broadcast address and net-mask for these interfaces will be set to 0.0.0.0.

continue
print("result is: ", result)
Copy link
Contributor

Choose a reason for hiding this comment

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

Please remove this print from the tests

snap-http Outdated
Copy link
Contributor

Choose a reason for hiding this comment

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

We'll want to make sure this submodule is up-to-date prior to the merge

landscape/lib/tests/test_network.py Show resolved Hide resolved
@ghadi-rahme
Copy link
Contributor Author

Thank you for the review @srunde3!

I added the docstring and removed the print statement, it was a debug remnant.

Let me know if anything else needs changing.

@ghadi-rahme ghadi-rahme requested a review from srunde3 May 30, 2024 13:56
@srunde3
Copy link
Contributor

srunde3 commented May 30, 2024

Manual testing looks good:

  • Create dummy interfaces on client machine sudo ip link add dummy<n> type dummy. These won't have IP addresses.
  • Register device with server
  • Verify that network interfaces including the dummy ones are reported to server and available in the landscape-api: landscape-api get-computers --with-network --query <hostname>

Note that these additional interfaces might not appear in the UI still since I believe that data comes from the HardwareInfo plugin. The UI is getting updated anyways, so this could be a moot point.

Copy link
Contributor

@srunde3 srunde3 left a comment

Choose a reason for hiding this comment

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

LGTM. Thank you for your contribution!

@srunde3 srunde3 merged commit df70540 into canonical:master May 30, 2024
4 checks passed
@ghadi-rahme
Copy link
Contributor Author

Thank you for the review and for merging the patch!

Yes you are correct these interfaces still do no show up in the UI, my goal was for them to show up in the API requests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants