Skip to content

Commit 58a324b

Browse files
santoss3mssonicbld
authored andcommitted
Fix dhcpv6 testcase failures in Dual TOR Setups (sonic-net#11695)
* ACL testcases in A/A setup need to ALLOW the keepalives to ensure both TORs don't go in STANDBY mode. * reverting_old_pr_fix * dhcpv6_dual_tor_fix * pre-commit checks * Added reference to right fixture
1 parent 52c8dfc commit 58a324b

File tree

3 files changed

+47
-22
lines changed

3 files changed

+47
-22
lines changed

ansible/roles/test/files/ptftests/py3/dhcpv6_counter_test.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ class DHCPCounterTest(DataplaneBaseTest):
6363
def __init__(self):
6464
self.test_params = testutils.test_params_get()
6565
self.client_port_index = int(self.test_params['client_port_index'])
66+
self.is_dualtor = True if self.test_params['is_dualtor'] == 'True' else False
6667
self.client_link_local = self.generate_client_interace_ipv6_link_local_address(
6768
self.client_port_index)
6869

@@ -85,18 +86,19 @@ def setUp(self):
8586
self.vlan_ip = self.test_params['vlan_ip']
8687
self.client_mac = self.dataplane.get_mac(0, self.client_port_index)
8788
self.loopback_ipv6 = self.test_params['loopback_ipv6']
88-
self.is_dualtor = True if self.test_params['is_dualtor'] == 'True' else False
8989
self.reference = 0
9090

9191
def generate_client_interace_ipv6_link_local_address(self, client_port_index):
92-
# Shutdown and startup the client interface to generate a proper IPv6 link-local address
93-
command = "ifconfig eth{} down".format(client_port_index)
94-
proc = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE)
95-
proc.communicate()
96-
97-
command = "ifconfig eth{} up".format(client_port_index)
98-
proc = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE)
99-
proc.communicate()
92+
# For DUALTOR Setup, flapping the link will disrupt ICMP HB communication and link health is impacted.
93+
# Skip this for DUALTOR.
94+
if not self.is_dualtor:
95+
# Shutdown and startup the client interface to generate a proper IPv6 link-local address
96+
command = "ifconfig eth{} down".format(client_port_index)
97+
proc = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE)
98+
proc.communicate()
99+
command = "ifconfig eth{} up".format(client_port_index)
100+
proc = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE)
101+
proc.communicate()
100102

101103
command = "ip addr show eth{} | grep inet6 | grep 'scope link' | awk '{{print $2}}' | cut -d '/' -f1"\
102104
.format(client_port_index)

ansible/roles/test/files/ptftests/py3/dhcpv6_relay_test.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ class DHCPTest(DataplaneBaseTest):
101101
def __init__(self):
102102
self.test_params = testutils.test_params_get()
103103
self.client_port_index = int(self.test_params['client_port_index'])
104+
self.is_dualtor = True if self.test_params['is_dualtor'] == 'True' else False
104105
self.client_link_local = self.generate_client_interace_ipv6_link_local_address(
105106
self.client_port_index)
106107

@@ -128,17 +129,18 @@ def setUp(self):
128129
self.client_mac = self.dataplane.get_mac(0, self.client_port_index)
129130
self.uplink_mac = self.test_params['uplink_mac']
130131
self.loopback_ipv6 = self.test_params['loopback_ipv6']
131-
self.is_dualtor = True if self.test_params['is_dualtor'] == 'True' else False
132132

133133
def generate_client_interace_ipv6_link_local_address(self, client_port_index):
134-
# Shutdown and startup the client interface to generate a proper IPv6 link-local address
135-
command = "ifconfig eth{} down".format(client_port_index)
136-
proc = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE)
137-
proc.communicate()
138-
139-
command = "ifconfig eth{} up".format(client_port_index)
140-
proc = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE)
141-
proc.communicate()
134+
# For DUALTOR Setup, flapping the link will disrupt ICMP HB communication and link health is impacted.
135+
# Skip this for DUALTOR.
136+
if not self.is_dualtor:
137+
# Shutdown and startup the client interface to generate a proper IPv6 link-local address
138+
command = "ifconfig eth{} down".format(client_port_index)
139+
proc = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE)
140+
proc.communicate()
141+
command = "ifconfig eth{} up".format(client_port_index)
142+
proc = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE)
143+
proc.communicate()
142144

143145
command = "ip addr show eth{} | grep inet6 | grep 'scope link' | awk '{{print $2}}' | cut -d '/' -f1".\
144146
format(client_port_index)

tests/dhcp_relay/test_dhcpv6_relay.py

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313
from tests.common.utilities import wait_until
1414
from tests.common.helpers.assertions import pytest_assert
1515
from tests.common.dualtor.mux_simulator_control import toggle_all_simulator_ports_to_rand_selected_tor_m # noqa F401
16-
16+
from tests.common.dualtor.dual_tor_utils import config_active_active_dualtor_active_standby # noqa F401
17+
from tests.common.dualtor.dual_tor_utils import validate_active_active_dualtor_setup # noqa F401
18+
from tests.common.dualtor.dual_tor_common import active_active_ports # noqa F401
1719

1820
pytestmark = [
1921
pytest.mark.topology('t0', 'm0', 'mx'),
@@ -239,8 +241,27 @@ def test_interface_binding(duthosts, rand_one_dut_hostname, dut_dhcp_relay_data)
239241
("*:*" in output, "dhcp6relay socket is not properly binded")
240242

241243

244+
@pytest.fixture
245+
def setup_active_active_as_active_standby(
246+
active_active_ports, rand_selected_dut, rand_unselected_dut, tbinfo, # noqa F811
247+
config_active_active_dualtor_active_standby, validate_active_active_dualtor_setup): # noqa F811
248+
if 'dualtor' not in tbinfo['topo']['name']:
249+
logger.info("Skipping toggle on non-dualtor testbed")
250+
251+
if active_active_ports:
252+
# The traffic from active-active mux ports are ECMPed so the DHCP6 Request
253+
# May land to any TOR.
254+
# So let's configure the active-active mux ports, to let them work in active-standby mode.
255+
logger.info("Configuring {} as active".format(rand_selected_dut.hostname))
256+
logger.info("Configuring {} as standby".format(rand_unselected_dut.hostname))
257+
config_active_active_dualtor_active_standby(rand_selected_dut, rand_unselected_dut, active_active_ports)
258+
259+
return
260+
261+
242262
def test_dhcpv6_relay_counter(ptfhost, duthosts, rand_one_dut_hostname, dut_dhcp_relay_data,
243-
toggle_all_simulator_ports_to_rand_selected_tor_m): # noqa F811
263+
toggle_all_simulator_ports_to_rand_selected_tor_m, # noqa F811
264+
setup_active_active_as_active_standby): # noqa F811
244265
""" Test DHCPv6 Counter """
245266
duthost = duthosts[rand_one_dut_hostname]
246267
skip_release(duthost, ["201911", "202106"])
@@ -249,7 +270,6 @@ def test_dhcpv6_relay_counter(ptfhost, duthosts, rand_one_dut_hostname, dut_dhcp
249270
"Decline", "Reconfigure", "Information-Request", "Relay-Forward", "Relay-Reply", "Malformed"]
250271

251272
for dhcp_relay in dut_dhcp_relay_data:
252-
253273
init_counter(duthost, dhcp_relay['client_iface']['name'], message_types)
254274
init_counter(duthost, dhcp_relay['downlink_vlan_iface']['name'], message_types)
255275
if dhcp_relay['is_dualtor']:
@@ -306,7 +326,8 @@ def test_dhcpv6_relay_counter(ptfhost, duthosts, rand_one_dut_hostname, dut_dhcp
306326

307327

308328
def test_dhcp_relay_default(ptfhost, dut_dhcp_relay_data, validate_dut_routes_exist, testing_config,
309-
toggle_all_simulator_ports_to_rand_selected_tor_m): # noqa F811
329+
toggle_all_simulator_ports_to_rand_selected_tor_m, # noqa F811
330+
setup_active_active_as_active_standby): # noqa F811
310331
"""Test DHCP relay functionality on T0 topology.
311332
For each DHCP relay agent running on the DuT, verify DHCP packets are relayed properly
312333
"""

0 commit comments

Comments
 (0)