Skip to content

Commit

Permalink
Make dhcpmon counter test compatible with dual tor (sonic-net#11410)
Browse files Browse the repository at this point in the history
What is the motivation for this PR?
Fix dhcpmon counter test failure on dualtor

How did you do it?
On single tor, REQUEST count is 3 because verify_dhcp_relay_pkt_with_no_padding sends two extra requests
Set dualtor REQUEST count to 1

How did you verify/test it?
Ran dhcp test suite
  • Loading branch information
kellyyeh authored Jan 31, 2024
1 parent daf1232 commit af40f65
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions tests/dhcp_relay/test_dhcp_relay.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,11 +334,18 @@ def test_dhcp_relay_default(ptfhost, dut_dhcp_relay_data, validate_dut_routes_ex
marker_standby = loganalyzer_standby.init()
loganalyzer_standby.expect_regex = [expected_standby_agg_counter_message]
start_dhcp_monitor_debug_counter(duthost)
expected_agg_counter_message = (
r".*dhcp_relay#dhcpmon\[[0-9]+\]: "
r"\[\s*Agg-%s\s*-[\sA-Za-z0-9]+\s*rx/tx\] "
r"Discover: +1/ +%d, Offer: +1/ +1, Request: +3/ +%d, ACK: +1/ +1+"
) % (dhcp_relay['downlink_vlan_iface']['name'], dhcp_server_num, dhcp_server_num * 3)
if testing_mode == DUAL_TOR_MODE:
expected_agg_counter_message = (
r".*dhcp_relay#dhcpmon\[[0-9]+\]: "
r"\[\s*Agg-%s\s*-[\sA-Za-z0-9]+\s*rx/tx\] "
r"Discover: +1/ +%d, Offer: +1/ +1, Request: +1/ +%d, ACK: +1/ +1+"
) % (dhcp_relay['downlink_vlan_iface']['name'], dhcp_server_num, dhcp_server_num)
else:
expected_agg_counter_message = (
r".*dhcp_relay#dhcpmon\[[0-9]+\]: "
r"\[\s*Agg-%s\s*-[\sA-Za-z0-9]+\s*rx/tx\] "
r"Discover: +1/ +%d, Offer: +1/ +1, Request: +3/ +%d, ACK: +1/ +1+"
) % (dhcp_relay['downlink_vlan_iface']['name'], dhcp_server_num, dhcp_server_num * 3)
loganalyzer = LogAnalyzer(ansible_host=duthost, marker_prefix="dhcpmon counter")
marker = loganalyzer.init()
loganalyzer.expect_regex = [expected_agg_counter_message]
Expand Down

0 comments on commit af40f65

Please sign in to comment.