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

[dhcp_relay][telemetry] Update events test for dhcp6relay bind issue #16216

Merged
merged 1 commit into from
Dec 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions tests/telemetry/events/dhcp-relay_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,21 +56,29 @@ def trigger_dhcp_relay_bind_failure(duthost):

vlan = dhcp_test_info["vlan"]
dhcp6_relay_process = dhcp_test_info["dhcp6relay_process"]
ipv6_ip = dhcp_test_info["ipv6_address"]
ipv6_global_unique_ip = dhcp_test_info["ipv6_address"]

try:
# Flush ipv6 address from vlan
duthost.shell("ip -6 address flush dev {}".format(vlan))
duthost.shell("ip -6 address del {} dev {}".format(ipv6_global_unique_ip, vlan))

# Restart dhcrelay process
duthost.shell("docker exec dhcp_relay supervisorctl restart {}".format(dhcp6_relay_process))
# Wait dhcp6relay to hit bind failure, dhcp6relay would try 6 times with interval 5s, hence wait 35s to hit
# bind failure
time.sleep(35)

finally:
# Add back ipv6 address to vlan
duthost.shell("ip address add {} dev {}".format(ipv6_ip, vlan))

# Restart dhcrelay process
duthost.shell("docker exec dhcp_relay supervisorctl restart {}".format(dhcp6_relay_process))
duthost.shell("ip address add {} dev {}".format(ipv6_global_unique_ip, vlan))

# After bind failure test, dhcp6relay would exit because fail to bind. It's critical process of dhcp_relay,
# hence maybe in that time dhcp_relay container has crashed, we need to restart whole dhcp_relay service to
# recover
duthost.shell("systemctl reset-failed dhcp_relay")
duthost.restart_service("dhcp_relay")
py_assert(wait_until(100, 10, 0, duthost.is_service_fully_started_per_asic_or_host, "dhcp_relay"),
"dhcp_relay not started.")


def send_dhcp_discover_packets(duthost, ptfadapter, packets_to_send=5, interval=1):
Expand Down
Loading