Skip to content

Commit

Permalink
[dhcp_relay][telemetry] Update events test for dhcp6relay bind issue (#…
Browse files Browse the repository at this point in the history
…16216)

What is the motivation for this PR?
There are global unique ipv6 address and link local ipv6 address configured in Vlan, not need to flush all of them to trigger fail to bind issue.

How did you do it?
Only delete GUA in Vlan

How did you verify/test it?
Run test
  • Loading branch information
yaqiangz authored and mssonicbld committed Jan 10, 2025
1 parent 8dc6fd2 commit 64045a8
Showing 1 changed file with 14 additions and 6 deletions.
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

0 comments on commit 64045a8

Please sign in to comment.