-
Notifications
You must be signed in to change notification settings - Fork 235
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
[pd] add pd daemon service to support the automation of dhcpcd PD management #2360
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2360 +/- ##
==========================================
- Coverage 55.77% 45.95% -9.83%
==========================================
Files 87 105 +18
Lines 6890 12575 +5685
Branches 0 912 +912
==========================================
+ Hits 3843 5779 +1936
- Misses 3047 6482 +3435
- Partials 0 314 +314 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM overall, a few comments for code style.
Thanks!
@jwhui @sherysheng Can we prioritize getting this change in soon? It appears we're waiting on this for some PD client qualifying tests in certification. |
backup_dir = "/var/lib/ot-dhcpcd-backup" | ||
|
||
def properties_changed_handler(interface_name, changed_properties, invalidated_properties): | ||
if "Dhcp6PdState" in changed_properties: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may replace is large 'if' block with an early return.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ping on this
8653134
to
5282dfa
Compare
if os.path.isfile("/etc/dhcpcd.conf.custom"): | ||
subprocess.run(["sudo", "cp", "/etc/dhcpcd.conf.custom", "/etc/dhcpcd.conf"], check=True) | ||
try: | ||
subprocess.run(["sudo", "systemctl", "daemon-reload"], check=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this daemon-reload is not necessary?
5282dfa
to
dfa3c73
Compare
Local test result 10/31:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
b769abc
to
9dcb5f5
Compare
9dcb5f5
to
558ca76
Compare
cf64ec4
to
72bef12
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
backup_dir = "/var/lib/ot-dhcpcd-backup" | ||
|
||
def properties_changed_handler(interface_name, changed_properties, invalidated_properties): | ||
if "Dhcp6PdState" in changed_properties: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ping on this
3e14b61
to
a3033df
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
a3033df
to
1edc4f1
Compare
The changes include:
PD daemon (dhcp6_pd_daemon.py) to monitor and react to PD state changes between running and stopped/disabled.
Creation of systemd service file (dhcp6_pd_daemon.service) for managing the daemon.
Update of _dhcpv6_pd_ref to support pd daemon installation and uninstallation
This scripts essentially automate the process of setting up a machine as a dhcpcd pd reference device, handling prefix delegation.
local test log:
Terminal #1:
sherys@raspberrypi:~ $ python3 dhcp6_pd_daemon.py
2024-07-06 03:35:31,718 - INFO - Connected to D-Bus signal.
2024-07-06 03:35:41,577 - INFO - Dhcp6PdState changed to: running
2024-07-06 03:35:42,182 - INFO - Successfully restarted dhcpcd service.
Terminal #2:
Terminal #3:
signal time=1719724170.782791 sender=:1.32 -> destination=(null destination) serial=14 path=/io/openthread/BorderRouter/wpan0; interface=org.freedesktop.DBus.Properties; member=PropertiesChanged
string "io.openthread.BorderRouter"
array [
dict entry(
string "Dhcp6PdState"
variant string "running"
)
]
array [
]
signal time=1719724369.495711 sender=:1.32 -> destination=(null destination) serial=16 path=/io/openthread/BorderRouter/wpan0; interface=org.freedesktop.DBus.Properties; member=PropertiesChanged
string "io.openthread.BorderRouter"
array [
dict entry(
string "Dhcp6PdState"
variant string "disabled"
)
]
array [
]