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

Eth hotplug check cable and routable before pinging (Bugfix) #1694

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

seankingyang
Copy link
Contributor

@seankingyang seankingyang commented Jan 22, 2025

Description

Some of the machines (most of the IOT devices) can't ping after plugging the eth cable.
Some of the machines (most of the PC devices) can ping after plugging the eth cable.

In Desktop image, the networking renderer is Networkmanager

It will delay to turn down the eth interface and keep the ip (will not send req to DHCP to get the IP) when unpluggin the cable.

  • If the tester remove the cable and connect the cable immediatly, the test case can be pass (This is the work around method for the original script)
  • If the tester remove the cable, make sure the NetworkMangager trun the eth interface down, and reconnect the cable back. In this situation, some of the device will get the ip slowly and this test case will fail. But it really can get the original ip and available to ping.

In Server/UC image, the networking renderer is systemd-networkd

It will immediatly turn the interface down when unplugging the cable.

  • If the tester remove the cable and reconnect the cable immedatly, this test case will still fail. But it really can get the original ip and available to ping.

Change

Need to make sure the networking renderer actually not routable if remove the cable; it actually routable if reconnect the cable before ping.

Flow

1, Check interface cable state (make sure this eth interface is existed)
2. Ask Tester to remove the eth cable
3. check cable is remove
4. check network renderer is Not routable
5. Ask Tester to reconnect the eth cable
6. check cable is connect
7. check network renderer is routable
8. Ping the gateway

Resolved issues

#1197 ethernet/hotplug-{{ interface }} fails without potential latency
#1260 ethernet/hotplug-.* failed due to unable to ping the host

Tests

PC Desktop image with NetworkManager: https://certification.canonical.com/hardware/202411-35941/submission/409179/
IOT UC image with systemd-networkd: https://certification.canonical.com/hardware/202307-31859/submission/409181/

@seankingyang seankingyang changed the title Fix: Eth hotplug check cable and routable before pinging(BugFix) Fix: Eth hotplug check cable and routable before pinging(Bugfix) Jan 22, 2025
@seankingyang seankingyang marked this pull request as draft January 22, 2025 10:22
@seankingyang seankingyang changed the title Fix: Eth hotplug check cable and routable before pinging(Bugfix) Eth hotplug check cable and routable before pinging (Bugfix) Jan 22, 2025
Copy link

codecov bot commented Jan 23, 2025

Codecov Report

Attention: Patch coverage is 97.80220% with 2 lines in your changes missing coverage. Please review.

Project coverage is 49.27%. Comparing base (4305ba1) to head (2c74500).
Report is 38 commits behind head on main.

Files with missing lines Patch % Lines
providers/base/bin/eth_hotplugging.py 97.80% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1694      +/-   ##
==========================================
+ Coverage   48.99%   49.27%   +0.27%     
==========================================
  Files         372      373       +1     
  Lines       40321    40472     +151     
  Branches     6811     6841      +30     
==========================================
+ Hits        19757    19943     +186     
+ Misses      19842    19803      -39     
- Partials      722      726       +4     
Flag Coverage Δ
provider-base 25.73% <97.80%> (+0.93%) ⬆️

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 marked this pull request as ready for review January 23, 2025 05:46
Copy link
Collaborator

@pieqq pieqq 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 undertaking this big change!

I noticed you used your own retry mechanism for different functions in the script. I recommend using the retry decorator available in checkbox-support (see comments inline below).

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