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

Support both networkd and NetworkManger in netplan (New) #1301

Merged
merged 18 commits into from
Sep 12, 2024

Conversation

seankingyang
Copy link
Contributor

@seankingyang seankingyang commented Jun 20, 2024

Description

Netplan serves as a network configuration abstraction renderer and was officially released in the 24.04 LTS version.
Netplan functions as a configuration tool for back-end daemons managing network interfaces, such as NetworkManager or systemd-networkd.
In essence, Netplan acts as a configuration tool for back-end daemons managing network interfaces, independent of specific technologies.

In this PR, modify the wifi_client_test_netplan.py script to make it support both networkd and NetworkManger.

  • Introduce an input parameter in this script to determine whether the renderer should be networkd or NetworkManager.
  • Include a new input parameter for the func: generate_test_config to create the configuration with the specified renderer.
  • Enhance the func: wait_for_routable to support both networkd and NetworkManager.
  • Implement the func: _get_nmcli_state to retrieve the connection state for NetworkManager.
  • Integrate the func: check_routable_state to determine the appropriate _get_{nmcli | networkctl}_state based on the renderer parameter.
  • Update the func: perform_ping_test to accommodate both networkd and NetworkManager. (Obtain the Gateway method)
  • Separate the gateway retrieval into a new function get_gateway, which will select the appropriate _get_{networkctl | nmcli}_gateway based on the renderer parameter.
  • Introduce the func: _get_networkctl_gateway extracted from the func: perform_ping_test to support this functionality.
  • Implement the func: _get_nmcli_gateway to obtain the gateway IP address from NetworkManager.
  • Update the func: print_journal_entries to cater to both network and NetworkManager scenarios.

When utilizing this script in a test job, the renderer cannot be retrieved as an input parameter.
There is a limitation regarding checkbox usage: the outcome of the bootstrap resource job cannot be utilized in the command field.

An alternative approach is required until the following issues are resolved:

  • The resource job: net_if_management needs to be split into two parts, one for wireless and the other for ethernet.
  • The script: net_if_management.py should only output either wireless or ethernet information.
  • Revise all jobs that utilize the output from: net_if_management

WIFI jobs (nm and np) should avoid using device as the template-resource, instead opt for net_if_management_wireless (currently unavailable).

According to the above issue, it need to add the following action:

  • Add an input parameter: renderer for AutoDetect
    • Auto-detection involves checking all .yaml files to identify any specific renderer (networkd, NetworkManger) definitions.
  • Verify if the input renderer matches the one obtained from the .yaml file; if not AutoDetect, adjustments are necessary.

Resolved issues

#1303 (Netplan missing the key-management: psk when wpa/wpa2)

Documentation

Tests

Run cmd on systemd-networkd machine 202405-34023

Run checkbox wireless test category on machine 202405-34023

@seankingyang seankingyang marked this pull request as draft June 20, 2024 02:37
Copy link

codecov bot commented Jun 20, 2024

Codecov Report

Attention: Patch coverage is 93.45794% with 7 lines in your changes missing coverage. Please review.

Project coverage is 46.30%. Comparing base (b92edc5) to head (3cf2634).
Report is 136 commits behind head on main.

Files with missing lines Patch % Lines
providers/base/bin/wifi_client_test_netplan.py 93.45% 4 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1301      +/-   ##
==========================================
+ Coverage   45.72%   46.30%   +0.58%     
==========================================
  Files         367      367              
  Lines       39134    39224      +90     
  Branches     6618     6636      +18     
==========================================
+ Hits        17894    18164     +270     
+ Misses      20565    20374     -191     
- Partials      675      686      +11     
Flag Coverage Δ
provider-base 21.52% <92.52%> (+1.60%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@seankingyang seankingyang force-pushed the Wifi_client_test_netplan-support-networkmanger branch 8 times, most recently from 5933112 to 14accb6 Compare June 21, 2024 01:59
@zongminl zongminl changed the title Support both nertowkd and NetworkManger in netplan (New) Support both networkd and NetworkManger in netplan (New) Jun 21, 2024
@seankingyang seankingyang force-pushed the Wifi_client_test_netplan-support-networkmanger branch from 14accb6 to ac16772 Compare June 21, 2024 06:44
Hook25 added a commit that referenced this pull request Jun 21, 2024
p-gentili pushed a commit that referenced this pull request Jun 21, 2024
@seankingyang seankingyang marked this pull request as ready for review June 24, 2024 02:01
@fernando79513 fernando79513 assigned Hook25 and fernando79513 and unassigned Hook25 Jul 16, 2024
@seankingyang seankingyang force-pushed the Wifi_client_test_netplan-support-networkmanger branch from ac16772 to 6b39662 Compare August 30, 2024 08:21
@seankingyang
Copy link
Contributor Author

Rebase

Copy link
Collaborator

@fernando79513 fernando79513 left a comment

Choose a reason for hiding this comment

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

Good job here! A bunch of minor comments and suggestions but nothing big.
I think at least one of the tests is wrong (test_main_success). Please check that the test is testing the expected behavior.

providers/base/bin/wifi_client_test_netplan.py Outdated Show resolved Hide resolved
providers/base/bin/wifi_client_test_netplan.py Outdated Show resolved Hide resolved
providers/base/bin/wifi_client_test_netplan.py Outdated Show resolved Hide resolved
providers/base/tests/test_wifi_client_test_netplan.py Outdated Show resolved Hide resolved
providers/base/tests/test_wifi_client_test_netplan.py Outdated Show resolved Hide resolved
providers/base/tests/test_wifi_client_test_netplan.py Outdated Show resolved Hide resolved
@fernando79513 fernando79513 added the waiting-for-changes The review has been completed but the PR is waiting for changes from the author label Aug 30, 2024
Co-authored-by: Fernando Bravo <39527354+fernando79513@users.noreply.github.com>
seankingyang and others added 7 commits September 6, 2024 14:35
Co-authored-by: Fernando Bravo <39527354+fernando79513@users.noreply.github.com>
Co-authored-by: Fernando Bravo <39527354+fernando79513@users.noreply.github.com>
Co-authored-by: Fernando Bravo <39527354+fernando79513@users.noreply.github.com>
Co-authored-by: Fernando Bravo <39527354+fernando79513@users.noreply.github.com>
@seankingyang seankingyang force-pushed the Wifi_client_test_netplan-support-networkmanger branch from 23f6967 to ff34f12 Compare September 6, 2024 09:13
@seankingyang seankingyang removed the waiting-for-changes The review has been completed but the PR is waiting for changes from the author label Sep 9, 2024
@seankingyang
Copy link
Contributor Author

@fernando79513 please review these changes~~

fernando79513
fernando79513 previously approved these changes Sep 12, 2024
Copy link
Collaborator

@fernando79513 fernando79513 left a comment

Choose a reason for hiding this comment

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

Thanks for the changes!

providers/base/bin/wifi_client_test_netplan.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@fernando79513 fernando79513 left a comment

Choose a reason for hiding this comment

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

LGTM +1!

@fernando79513 fernando79513 merged commit 7493f19 into main Sep 12, 2024
43 checks passed
@fernando79513 fernando79513 deleted the Wifi_client_test_netplan-support-networkmanger branch September 12, 2024 11:36
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.

3 participants