diff --git a/docs/testplan/dhcp_relay/DHCPv4-Relay-Test-Plan.md b/docs/testplan/dhcp_relay/DHCPv4-Relay-Test-Plan.md index 6fd0847e348..050817a9048 100644 --- a/docs/testplan/dhcp_relay/DHCPv4-Relay-Test-Plan.md +++ b/docs/testplan/dhcp_relay/DHCPv4-Relay-Test-Plan.md @@ -265,10 +265,10 @@ This test plan covers comprehensive testing of DHCPv4 relay functionality in SON ### Key Helper Functions - `check_interface_status()`: Verify relay agent socket binding -- `query_dhcpcom_relay_counter_result()`: Retrieve DHCP counters -- `validate_dhcpcom_relay_counters()`: Validate counter accuracy -- `start_dhcp_monitor_debug_counter()`: Enable debug counter mode -- `init_dhcpcom_relay_counters()`: Reset counter values +- `query_dhcpmon_counter_result()`: Retrieve DHCP counters from dhcpmon +- `validate_dhcpmon_counters()`: Validate counter accuracy from dhcpmon +- `restart_dhcpmon_in_debug()`: Enable dhcpmon debug mode +- `init_dhcpmon_counters()`: Reset counter values from dhcpmon ### Fixtures - `ignore_expected_loganalyzer_exceptions`: Filter expected errors diff --git a/tests/common/dhcp_relay_utils.py b/tests/common/dhcp_relay_utils.py index 15329fc6e20..e8607ccdd57 100644 --- a/tests/common/dhcp_relay_utils.py +++ b/tests/common/dhcp_relay_utils.py @@ -26,13 +26,13 @@ def _is_dhcp_relay_ready(): pytest_assert(wait_until(120, 1, 10, _is_dhcp_relay_ready), "dhcp_relay is not ready after restarting") -def init_dhcpcom_relay_counters(duthost): +def init_dhcpmon_counters(duthost): command_output = duthost.shell("sudo sonic-clear dhcp_relay ipv4 counters") pytest_assert("Clear DHCPv4 relay counter done" == command_output["stdout"], "dhcp_relay counters are not cleared successfully, output: {}".format(command_output["stdout"])) -def query_dhcpcom_relay_counter_result(duthost, query_key): +def query_dhcpmon_counter_result(duthost, query_key): ''' Query the DHCPv4 counters from the COUNTERS_DB by the given key. The returned value is a dictionary and the counter values are converted to integers. @@ -51,15 +51,15 @@ def query_dhcpcom_relay_counter_result(duthost, query_key): } for rx_or_tx, counters in shell_result.items()} -def query_and_sum_dhcpcom_relay_counters(duthost, vlan_name, interface_name_list): +def query_and_sum_dhcpmon_counters(duthost, vlan_name, interface_name_list): '''Query the DHCPv4 counters from the COUNTERS_DB and sum the counters for the given interface names.''' if interface_name_list is None or len(interface_name_list) == 0: # If no interface names are provided, return the counters for the VLAN interface only. - return query_dhcpcom_relay_counter_result(duthost, vlan_name) + return query_dhcpmon_counter_result(duthost, vlan_name) total_counters = {} # If interface names are provided, sum all of the provided interface names' counters for interface_name in interface_name_list: - internal_shell_result = query_dhcpcom_relay_counter_result(duthost, vlan_name + ":" + interface_name) + internal_shell_result = query_dhcpmon_counter_result(duthost, vlan_name + ":" + interface_name) for rx_or_tx, counters in internal_shell_result.items(): total_value = total_counters.setdefault(rx_or_tx, {}) for dhcp_type, counter_value in counters.items(): @@ -67,14 +67,14 @@ def query_and_sum_dhcpcom_relay_counters(duthost, vlan_name, interface_name_list return total_counters -def compare_dhcpcom_relay_counters_with_warning(actual_counter, expected_counter, warning_msg, error_in_percentage=0.0): - compare_result = compare_dhcpcom_relay_counter_values( +def compare_dhcp_counters_with_warning(actual_counter, expected_counter, warning_msg, error_in_percentage=0.0): + compare_result = compare_dhcp_counters( actual_counter, expected_counter, error_in_percentage) while msg := next(compare_result, False): logger.warning(warning_msg + ": " + str(msg)) -def compare_dhcpcom_relay_counter_values(dhcp_relay_counter, expected_counter, error_in_percentage=0.0): +def compare_dhcp_counters(dhcp_relay_counter, expected_counter, error_in_percentage=0.0): """Compare the DHCP relay counter value with the expected counter.""" for dir in SUPPORTED_DIR: for dhcp_type in SUPPORTED_DHCPV4_TYPE: @@ -92,9 +92,9 @@ def compare_dhcpcom_relay_counter_values(dhcp_relay_counter, expected_counter, e .format(dir, dhcp_type, actual_value, expected_value, error_in_percentage)) -def validate_dhcpcom_relay_counters(dhcp_relay, duthost, expected_uplink_counter, - expected_downlink_counter, error_in_percentage=0.0): - """Validate the dhcpcom relay counters""" +def validate_dhcpmon_counters(dhcp_relay, duthost, expected_uplink_counter, + expected_downlink_counter, error_in_percentage=0.0): + """Validate the dhcpmon relay counters""" logger.info("Expected uplink counters: {}, expected downlink counters: {}, error in percentage: {}%".format( expected_uplink_counter, expected_downlink_counter, error_in_percentage)) downlink_vlan_iface = dhcp_relay['downlink_vlan_iface']['name'] @@ -115,15 +115,15 @@ def validate_dhcpcom_relay_counters(dhcp_relay, duthost, expected_uplink_counter for portchannel_name in uplink_portchannels_or_interfaces: if portchannel_name in portchannels.keys(): uplink_interfaces.extend(portchannels[portchannel_name]['members']) - portchannel_counters = query_and_sum_dhcpcom_relay_counters(duthost, - downlink_vlan_iface, - [portchannel_name]) - members_counters = query_and_sum_dhcpcom_relay_counters(duthost, - downlink_vlan_iface, - portchannels[portchannel_name]['members']) + portchannel_counters = query_and_sum_dhcpmon_counters(duthost, + downlink_vlan_iface, + [portchannel_name]) + members_counters = query_and_sum_dhcpmon_counters(duthost, + downlink_vlan_iface, + portchannels[portchannel_name]['members']) # If the portchannel counters and its members' counters are not equal, yield a warning message - compare_dhcpcom_relay_counters_with_warning( + compare_dhcp_counters_with_warning( portchannel_counters, members_counters, compare_warning_msg.format(portchannel_name, portchannels[portchannel_name]['members'], duthost.hostname), @@ -131,26 +131,26 @@ def validate_dhcpcom_relay_counters(dhcp_relay, duthost, expected_uplink_counter else: uplink_interfaces.append(portchannel_name) - vlan_interface_counter = query_and_sum_dhcpcom_relay_counters(duthost, downlink_vlan_iface, []) - client_interface_counter = query_and_sum_dhcpcom_relay_counters(duthost, downlink_vlan_iface, [client_iface]) - uplink_portchannels_interfaces_counter = query_and_sum_dhcpcom_relay_counters( + vlan_interface_counter = query_and_sum_dhcpmon_counters(duthost, downlink_vlan_iface, []) + client_interface_counter = query_and_sum_dhcpmon_counters(duthost, downlink_vlan_iface, [client_iface]) + uplink_portchannels_interfaces_counter = query_and_sum_dhcpmon_counters( duthost, downlink_vlan_iface, uplink_portchannels_or_interfaces ) - uplink_interface_counter = query_and_sum_dhcpcom_relay_counters(duthost, downlink_vlan_iface, uplink_interfaces) + uplink_interface_counter = query_and_sum_dhcpmon_counters(duthost, downlink_vlan_iface, uplink_interfaces) - compare_dhcpcom_relay_counters_with_warning( + compare_dhcp_counters_with_warning( vlan_interface_counter, client_interface_counter, compare_warning_msg.format(downlink_vlan_iface, client_iface, duthost.hostname), error_in_percentage) - compare_dhcpcom_relay_counters_with_warning( + compare_dhcp_counters_with_warning( uplink_portchannels_interfaces_counter, uplink_interface_counter, compare_warning_msg.format(uplink_portchannels_or_interfaces, uplink_interfaces, duthost.hostname), error_in_percentage) - compare_dhcpcom_relay_counters_with_warning( + compare_dhcp_counters_with_warning( client_interface_counter, expected_downlink_counter, compare_warning_msg.format(client_iface, "expected_downlink_counter", duthost.hostname), error_in_percentage) - compare_dhcpcom_relay_counters_with_warning( + compare_dhcp_counters_with_warning( uplink_interface_counter, expected_uplink_counter, compare_warning_msg.format(uplink_interfaces, "expected_uplink_counter", duthost.hostname), error_in_percentage) @@ -199,7 +199,7 @@ def calculate_counters_per_pkts(pkts): def validate_counters_and_pkts_consistency(dhcp_relay, duthost, pkts, interface_name_index_mapping, error_in_percentage=0.0): - """Validate the dhcpcom relay counters and packets consistence""" + """Validate the dhcpmon relay counters and packets consistence""" downlink_vlan_iface = dhcp_relay['downlink_vlan_iface']['name'] # it can be portchannel or interface, it depends on the topology uplink_portchannels_or_interfaces = dhcp_relay['uplink_interfaces'] @@ -218,12 +218,12 @@ def validate_counters_and_pkts_consistency(dhcp_relay, duthost, pkts, interface_ for portchannel_name in uplink_portchannels_or_interfaces: if portchannel_name in portchannels.keys(): uplink_interfaces.extend(portchannels[portchannel_name]['members']) - portchannel_counters = query_and_sum_dhcpcom_relay_counters(duthost, - downlink_vlan_iface, - [portchannel_name]) - members_counters = query_and_sum_dhcpcom_relay_counters(duthost, - downlink_vlan_iface, - portchannels[portchannel_name]['members']) + portchannel_counters = query_and_sum_dhcpmon_counters(duthost, + downlink_vlan_iface, + [portchannel_name]) + members_counters = query_and_sum_dhcpmon_counters(duthost, + downlink_vlan_iface, + portchannels[portchannel_name]['members']) # If the portchannel counters and its members' counters are not equal, yield a warning message @@ -240,13 +240,13 @@ def validate_counters_and_pkts_consistency(dhcp_relay, duthost, pkts, interface_ {"RX": {}, "TX": {}})) # Compare the portchannel counters from dhcp relay counter and pkts - compare_dhcpcom_relay_counters_with_warning( + compare_dhcp_counters_with_warning( portchannel_counters, portchannel_counter_from_pkts, compare_warning_msg.format(portchannel_name, portchannel_name + " from pkts", duthost.hostname), error_in_percentage) # Compare the members counters from dhcp relay counter and pkts - compare_dhcpcom_relay_counters_with_warning( + compare_dhcp_counters_with_warning( members_counters, members_counter_from_pkts, compare_warning_msg.format(portchannels[portchannel_name]['members'], str(portchannels[portchannel_name]['members']) + " from pkts", @@ -254,7 +254,7 @@ def validate_counters_and_pkts_consistency(dhcp_relay, duthost, pkts, interface_ error_in_percentage) # Compare the portchannel counters and its members' counters from dhcp relay counter - compare_dhcpcom_relay_counters_with_warning( + compare_dhcp_counters_with_warning( portchannel_counters, members_counters, compare_warning_msg.format(portchannel_name, portchannels[portchannel_name]['members'], duthost.hostname), @@ -262,7 +262,7 @@ def validate_counters_and_pkts_consistency(dhcp_relay, duthost, pkts, interface_ else: uplink_interfaces.append(portchannel_name) - vlan_interface_counter = query_and_sum_dhcpcom_relay_counters(duthost, downlink_vlan_iface, []) + vlan_interface_counter = query_and_sum_dhcpmon_counters(duthost, downlink_vlan_iface, []) # uplink_portchannels_interfaces means the item can be the portchannel or the interface # Example: @@ -270,7 +270,7 @@ def validate_counters_and_pkts_consistency(dhcp_relay, duthost, pkts, interface_ # ['PortChannel101', 'PortChannel103', 'PortChannel105', 'PortChannel106'] # If there is no portchannel, the uplink_portchannels_or_interfaces will be # ['Ethernet48', 'Ethernet49', 'Ethernet50', 'Ethernet51'] - uplink_portchannels_interfaces_counter = query_and_sum_dhcpcom_relay_counters( + uplink_portchannels_interfaces_counter = query_and_sum_dhcpmon_counters( duthost, downlink_vlan_iface, uplink_portchannels_or_interfaces ) @@ -284,7 +284,7 @@ def validate_counters_and_pkts_consistency(dhcp_relay, duthost, pkts, interface_ """ # Query the counters for uplink portchannels interfaces such as: # ['Ethernet48', 'Ethernet49', 'Ethernet50', 'Ethernet51'] - uplink_interface_counter = query_and_sum_dhcpcom_relay_counters(duthost, downlink_vlan_iface, uplink_interfaces) + uplink_interface_counter = query_and_sum_dhcpmon_counters(duthost, downlink_vlan_iface, uplink_interfaces) vlan_interface_counter_from_pkts = all_pkt_counters.get(interface_name_index_mapping[downlink_vlan_iface], {"RX": {}, "TX": {}}) @@ -308,36 +308,36 @@ def validate_counters_and_pkts_consistency(dhcp_relay, duthost, pkts, interface_ all_pkt_counters.get(interface_name_index_mapping[iface], {"RX": {}, "TX": {}})) # Compare the vlan interface counters from dhcp relay counter and pkts - compare_dhcpcom_relay_counters_with_warning( + compare_dhcp_counters_with_warning( vlan_interface_counter, vlan_interface_counter_from_pkts, compare_warning_msg.format(downlink_vlan_iface, downlink_vlan_iface + " from pkts", duthost.hostname), error_in_percentage) # Compare the sum of uplink portchannels counters from dhcp relay counter and pkts - compare_dhcpcom_relay_counters_with_warning( + compare_dhcp_counters_with_warning( uplink_portchannels_interfaces_counter, uplink_portchannels_interfaces_counter_from_pkts, compare_warning_msg.format(uplink_portchannels_or_interfaces, str(uplink_portchannels_or_interfaces) + " from pkts", duthost.hostname), error_in_percentage) # Compare the uplink portchannel interfaces counter and uplink interface counter from dhcyp relay counter - compare_dhcpcom_relay_counters_with_warning( + compare_dhcp_counters_with_warning( uplink_portchannels_interfaces_counter, uplink_interface_counter, compare_warning_msg.format(uplink_portchannels_or_interfaces, uplink_interfaces, duthost.hostname), error_in_percentage) # Compare the uplink interface counters from dhcp relay counter and pkts - compare_dhcpcom_relay_counters_with_warning( + compare_dhcp_counters_with_warning( uplink_interface_counter, uplink_interface_counter_from_pkts, compare_warning_msg.format(uplink_interfaces, str(uplink_interfaces) + " from pkts", duthost.hostname), error_in_percentage) # Compare the vlan interface counters from dhcp relay counter and pkts for vlan_member in vlan_members: - vlan_member_counter = query_and_sum_dhcpcom_relay_counters(duthost, downlink_vlan_iface, [vlan_member]) + vlan_member_counter = query_and_sum_dhcpmon_counters(duthost, downlink_vlan_iface, [vlan_member]) vlan_member_counter_from_pkts = all_pkt_counters.get(interface_name_index_mapping[vlan_member], {"RX": {}, "TX": {}}) - compare_dhcpcom_relay_counters_with_warning( + compare_dhcp_counters_with_warning( vlan_member_counter, vlan_member_counter_from_pkts, compare_warning_msg.format(vlan_member, vlan_member + " from pkts", duthost.hostname), error_in_percentage) diff --git a/tests/common/plugins/conditional_mark/tests_mark_conditions.yaml b/tests/common/plugins/conditional_mark/tests_mark_conditions.yaml index ed28d93d6ae..7029f3e6760 100644 --- a/tests/common/plugins/conditional_mark/tests_mark_conditions.yaml +++ b/tests/common/plugins/conditional_mark/tests_mark_conditions.yaml @@ -873,20 +873,20 @@ dhcp_relay: conditions: - "release in ['202412']" -dhcp_relay/test_dhcp_counter_stress.py::test_dhcpcom_relay_counters_stress: +dhcp_relay/test_dhcp_counter_stress.py::test_dhcpmon_relay_counters_stress: xfail: reason: "7215 has low performance, and can only take low stress (about 5 pps)" conditions: - "platform in ['armhf-nokia_ixs7215_52x-r0']" -dhcp_relay/test_dhcp_counter_stress.py::test_dhcpcom_relay_counters_stress[discover]: +dhcp_relay/test_dhcp_counter_stress.py::test_dhcpmon_relay_counters_stress[discover]: xfail: reason: "Need to skip for discover test cases on dualtor" conditions: - "'dualtor' in topo_name" - "https://github.com/sonic-net/sonic-mgmt/issues/19230" -dhcp_relay/test_dhcp_counter_stress.py::test_dhcpcom_relay_counters_stress[request]: +dhcp_relay/test_dhcp_counter_stress.py::test_dhcpmon_relay_counters_stress[request]: xfail: reason: "Need to skip for request test cases on dualtor" conditions: diff --git a/tests/dhcp_relay/test_dhcp_counter_stress.py b/tests/dhcp_relay/test_dhcp_counter_stress.py index 06ea251443a..4c06ccf03c0 100644 --- a/tests/dhcp_relay/test_dhcp_counter_stress.py +++ b/tests/dhcp_relay/test_dhcp_counter_stress.py @@ -5,7 +5,7 @@ from tests.common.fixtures.ptfhost_utils import copy_ptftests_directory # noqa F401 from tests.common.dualtor.mux_simulator_control import toggle_all_simulator_ports_to_rand_selected_tor_m # noqa F401 -from tests.common.dhcp_relay_utils import init_dhcpcom_relay_counters, validate_dhcpcom_relay_counters, \ +from tests.common.dhcp_relay_utils import init_dhcpmon_counters, validate_dhcpmon_counters, \ validate_counters_and_pkts_consistency from tests.common.utilities import wait_until, capture_and_check_packet_on_dut from tests.dhcp_relay.dhcp_relay_utils import check_dhcp_stress_status @@ -42,7 +42,7 @@ def ignore_expected_loganalyzer_exceptions(rand_one_dut_hostname, loganalyzer): @pytest.mark.parametrize('dhcp_type', ['discover', 'offer', 'request', 'ack']) -def test_dhcpcom_relay_counters_stress(ptfhost, ptfadapter, dut_dhcp_relay_data, validate_dut_routes_exist, +def test_dhcpmon_relay_counters_stress(ptfhost, ptfadapter, dut_dhcp_relay_data, validate_dut_routes_exist, testing_config, setup_standby_ports_on_rand_unselected_tor, toggle_all_simulator_ports_to_rand_selected_tor_m, # noqa F811 dhcp_type, clean_processes_after_stress_test, @@ -61,10 +61,10 @@ def test_dhcpcom_relay_counters_stress(ptfhost, ptfadapter, dut_dhcp_relay_data, for dhcp_relay in dut_dhcp_relay_data: client_port_id = dhcp_relay['client_iface']['port_idx'] - init_dhcpcom_relay_counters(duthost) + init_dhcpmon_counters(duthost) if testing_mode == DUAL_TOR_MODE: standby_duthost = rand_unselected_dut - init_dhcpcom_relay_counters(standby_duthost) + init_dhcpmon_counters(standby_duthost) params = { "hostname": duthost.hostname, @@ -99,8 +99,8 @@ def _verify_packets(pkts): validate_counters_and_pkts_consistency(dhcp_relay, duthost, pkts, interface_dict, error_in_percentage=error_margin) if testing_mode == DUAL_TOR_MODE: - validate_dhcpcom_relay_counters(dhcp_relay, standby_duthost, - {}, {}, 0) + validate_dhcpmon_counters(dhcp_relay, standby_duthost, + {}, {}, 0) def get_ip_link_result(duthost): # Get the output of 'ip link' command and parse it to a dictionary of index: name @@ -129,7 +129,7 @@ def get_ip_link_result(duthost): ): ptf_runner(ptfhost, "ptftests", "dhcp_relay_stress_test.DHCPStress{}Test".format(dhcp_type.capitalize()), platform_dir="ptftests", params=params, - log_file="/tmp/test_dhcpcom_relay_counters_stress.DHCPStressTest.log", + log_file="/tmp/test_dhcpmon_relay_counters_stress.DHCPStressTest.log", qlen=100000, is_python3=True, async_mode=True) check_dhcp_stress_status(duthost, packets_send_duration) pytest_assert(wait_until(600, 2, 0, _check_count_file_exists), "{} is missing".format(count_file)) diff --git a/tests/dhcp_relay/test_dhcp_relay.py b/tests/dhcp_relay/test_dhcp_relay.py index 04f3aece4e7..67deb322789 100644 --- a/tests/dhcp_relay/test_dhcp_relay.py +++ b/tests/dhcp_relay/test_dhcp_relay.py @@ -4,7 +4,7 @@ import logging import re -from tests.common.dhcp_relay_utils import init_dhcpcom_relay_counters, validate_dhcpcom_relay_counters +from tests.common.dhcp_relay_utils import init_dhcpmon_counters, validate_dhcpmon_counters from tests.common.fixtures.ptfhost_utils import copy_ptftests_directory # noqa F401 from tests.common.fixtures.ptfhost_utils import change_mac_addresses # noqa F401 from tests.common.dualtor.mux_simulator_control import toggle_all_simulator_ports_to_rand_selected_tor_m # noqa F401 @@ -127,7 +127,7 @@ def test_interface_binding(duthosts, rand_one_dut_hostname, dut_dhcp_relay_data) assert "{}:67".format(iface) in output, "{} is not found in {}".format("{}:67".format(iface), output) -def start_dhcp_monitor_debug_counter(duthost): +def restart_dhcpmon_in_debug(duthost): program_name = "dhcpmon" program_pid_list = [] program_list = duthost.shell("ps aux | grep {}".format(program_name)) @@ -210,8 +210,8 @@ def test_dhcp_relay_default(ptfhost, dut_dhcp_relay_data, validate_dut_routes_ex dhcp_server_num = len(dhcp_relay['downlink_vlan_iface']['dhcp_server_addrs']) if testing_mode == DUAL_TOR_MODE: standby_duthost = rand_unselected_dut - start_dhcp_monitor_debug_counter(standby_duthost) - init_dhcpcom_relay_counters(standby_duthost) + restart_dhcpmon_in_debug(standby_duthost) + init_dhcpmon_counters(standby_duthost) expected_standby_agg_counter_message = ( r".*dhcp_relay#dhcpmon\[[0-9]+\]: " r"\[\s*Agg-%s\s*-[\sA-Za-z0-9]+\s*rx/tx\] " @@ -220,8 +220,8 @@ def test_dhcp_relay_default(ptfhost, dut_dhcp_relay_data, validate_dut_routes_ex loganalyzer_standby = LogAnalyzer(ansible_host=standby_duthost, marker_prefix="dhcpmon counter") marker_standby = loganalyzer_standby.init() loganalyzer_standby.expect_regex = [expected_standby_agg_counter_message] - start_dhcp_monitor_debug_counter(duthost) - init_dhcpcom_relay_counters(duthost) + restart_dhcpmon_in_debug(duthost) + init_dhcpmon_counters(duthost) if testing_mode == DUAL_TOR_MODE: expected_agg_counter_message = ( r".*dhcp_relay#dhcpmon\[[0-9]+\]: " @@ -271,8 +271,8 @@ def test_dhcp_relay_default(ptfhost, dut_dhcp_relay_data, validate_dut_routes_ex if testing_mode == DUAL_TOR_MODE: loganalyzer_standby.analyze(marker_standby) dhcp_relay_request_times = 1 - # If the testing mode is DUAL_TOR_MODE, standby tor's dhcpcom relay counters should all be 0 - validate_dhcpcom_relay_counters(dhcp_relay, standby_duthost, {}, {}) + # If the testing mode is DUAL_TOR_MODE, standby tor's dhcpmon relay counters should all be 0 + validate_dhcpmon_counters(dhcp_relay, standby_duthost, {}, {}) expected_downlink_counter = { "RX": {"Unknown": 1, "Discover": 1, "Request": dhcp_relay_request_times, "Bootp": 1, "Decline": 1, "Release": 1, "Inform": 1}, @@ -284,9 +284,9 @@ def test_dhcp_relay_default(ptfhost, dut_dhcp_relay_data, validate_dut_routes_ex "Request": dhcp_server_sum * dhcp_relay_request_times, "Inform": dhcp_server_sum, "Decline": dhcp_server_sum, "Release": dhcp_server_sum} } - validate_dhcpcom_relay_counters(dhcp_relay, duthost, - expected_uplink_counter, - expected_downlink_counter) + validate_dhcpmon_counters(dhcp_relay, duthost, + expected_uplink_counter, + expected_downlink_counter) except LogAnalyzerError as err: logger.error("Unable to find expected log in syslog") raise err @@ -318,8 +318,8 @@ def test_dhcp_relay_with_source_port_ip_in_relay_enabled(ptfhost, dut_dhcp_relay dhcp_server_num = len(dhcp_relay['downlink_vlan_iface']['dhcp_server_addrs']) if testing_mode == DUAL_TOR_MODE: standby_duthost = rand_unselected_dut - start_dhcp_monitor_debug_counter(standby_duthost) - init_dhcpcom_relay_counters(standby_duthost) + restart_dhcpmon_in_debug(standby_duthost) + init_dhcpmon_counters(standby_duthost) expected_standby_agg_counter_message = ( r".*dhcp_relay#dhcpmon\[[0-9]+\]: " r"\[\s*Agg-%s\s*-[\sA-Za-z0-9]+\s*rx/tx\] " @@ -328,8 +328,8 @@ def test_dhcp_relay_with_source_port_ip_in_relay_enabled(ptfhost, dut_dhcp_relay loganalyzer_standby = LogAnalyzer(ansible_host=standby_duthost, marker_prefix="dhcpmon counter") marker_standby = loganalyzer_standby.init() loganalyzer_standby.expect_regex = [expected_standby_agg_counter_message] - start_dhcp_monitor_debug_counter(duthost) - init_dhcpcom_relay_counters(duthost) + restart_dhcpmon_in_debug(duthost) + init_dhcpmon_counters(duthost) if testing_mode == DUAL_TOR_MODE: expected_agg_counter_message = ( r".*dhcp_relay#dhcpmon\[[0-9]+\]: " @@ -381,8 +381,8 @@ def test_dhcp_relay_with_source_port_ip_in_relay_enabled(ptfhost, dut_dhcp_relay if testing_mode == DUAL_TOR_MODE: loganalyzer_standby.analyze(marker_standby) dhcp_relay_request_times = 1 - # If the testing mode is DUAL_TOR_MODE, standby tor's dhcpcom relay counters should all be 0 - validate_dhcpcom_relay_counters(dhcp_relay, standby_duthost, {}, {}) + # If the testing mode is DUAL_TOR_MODE, standby tor's dhcpmon relay counters should all be 0 + validate_dhcpmon_counters(dhcp_relay, standby_duthost, {}, {}) expected_downlink_counter = { "RX": {"Unknown": 1, "Discover": 1, "Request": dhcp_relay_request_times, "Bootp": 1, "Decline": 1, "Release": 1, "Inform": 1}, @@ -394,9 +394,9 @@ def test_dhcp_relay_with_source_port_ip_in_relay_enabled(ptfhost, dut_dhcp_relay "Request": dhcp_server_sum * dhcp_relay_request_times, "Inform": dhcp_server_sum, "Decline": dhcp_server_sum, "Release": dhcp_server_sum} } - validate_dhcpcom_relay_counters(dhcp_relay, duthost, - expected_uplink_counter, - expected_downlink_counter) + validate_dhcpmon_counters(dhcp_relay, duthost, + expected_uplink_counter, + expected_downlink_counter) except LogAnalyzerError as err: logger.error("Unable to find expected log in syslog") raise err @@ -605,10 +605,10 @@ def test_dhcp_relay_monitor_checksum_validation(ptfhost, dut_dhcp_relay_data, va for dhcp_relay in dut_dhcp_relay_data: if testing_mode == DUAL_TOR_MODE: standby_duthost = rand_unselected_dut - start_dhcp_monitor_debug_counter(standby_duthost) - init_dhcpcom_relay_counters(standby_duthost) - start_dhcp_monitor_debug_counter(duthost) - init_dhcpcom_relay_counters(duthost) + restart_dhcpmon_in_debug(standby_duthost) + init_dhcpmon_counters(standby_duthost) + restart_dhcpmon_in_debug(duthost) + init_dhcpmon_counters(duthost) # Run the DHCP relay test on the PTF host ptf_runner(ptfhost, "ptftests", @@ -637,17 +637,17 @@ def test_dhcp_relay_monitor_checksum_validation(ptfhost, dut_dhcp_relay_data, va is_python3=True) time.sleep(36) # dhcpmon debug counter prints every 18 seconds if testing_mode == DUAL_TOR_MODE: - # If the testing mode is DUAL_TOR_MODE, standby tor's dhcpcom relay counters should all be 0 - validate_dhcpcom_relay_counters(dhcp_relay, standby_duthost, {}, {}) + # If the testing mode is DUAL_TOR_MODE, standby tor's dhcpmon relay counters should all be 0 + validate_dhcpmon_counters(dhcp_relay, standby_duthost, {}, {}) expected_downlink_counter = { "RX": {"Malformed": 4} } expected_uplink_counter = { "RX": {"Malformed": 3} } - validate_dhcpcom_relay_counters(dhcp_relay, duthost, - expected_uplink_counter, - expected_downlink_counter) + validate_dhcpmon_counters(dhcp_relay, duthost, + expected_uplink_counter, + expected_downlink_counter) except LogAnalyzerError as err: logger.error("Unable to find expected log in syslog") raise err