Skip to content

Commit 431487d

Browse files
JibinBaoJavier-Tan
authored andcommitted
Skip test_syslog_config_work_after_reboot due to bug sonic-net/sonic-buildimage#21201 (sonic-net#16416)
What is the motivation for this PR? Skip test_syslog_config_work_after_reboot How did you do it? when dut_mgmt_network is a sub_network of forced_mgmt_routes, skip it How did you verify/test it? run test_syslog_config_work_after_reboot Any platform specific information? no
1 parent d9ecf9b commit 431487d

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

tests/syslog/test_syslog_source_ip.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
from ipaddress import IPv4Address, IPv6Address, ip_address, ip_network, IPv6Network
1515
from tests.common.fixtures.duthost_utils import backup_and_restore_config_db_on_duts # noqa F401
1616
from tests.common.config_reload import config_reload
17+
from ipaddress import IPv4Network
1718

1819
logger = logging.getLogger(__name__)
1920

@@ -121,6 +122,38 @@ def ignore_expected_loganalyzer_exceptions(enum_rand_one_per_hwsku_frontend_host
121122
loganalyzer[enum_rand_one_per_hwsku_frontend_hostname].ignore_regex.extend(ignoreRegex)
122123

123124

125+
def skip_ssip_reboot_test_when_dut_mgmt_network_is_sub_network_forced_mgmt(duthost):
126+
"""
127+
Skip test_syslog_config_work_after_reboot due to https://github.com/sonic-net/sonic-buildimage/issues/21201.
128+
When the issue is fixed, we can remove the function
129+
"""
130+
ip_intfs = duthost.show_and_parse('show ip interface')
131+
dut_mgmt_network = ''
132+
for intf in ip_intfs:
133+
if intf['interface'] == 'eth0':
134+
dut_mgmt_network = intf['ipv4 address/mask']
135+
assert dut_mgmt_network, "Not find mgmt interface eth0"
136+
137+
cmd_get_forced_mgmt_network_info = \
138+
f'redis-cli -n 4 hget \"MGMT_INTERFACE|eth0|{dut_mgmt_network}\" forced_mgmt_routes@'
139+
forced_mgmt_routes_info = duthost.shell(cmd_get_forced_mgmt_network_info)["stdout"]
140+
forced_mgmt_routes_info_list = forced_mgmt_routes_info.split(",") if forced_mgmt_routes_info else []
141+
142+
def _is_dut_mgmt_network_subnet_forced_mgmt(dut_mgmt_network, forced_mgmt_route):
143+
"""
144+
Checks if network_a is a subnet of network_b.
145+
"""
146+
logger.info(f"dut_mgmt_network:{dut_mgmt_network}, forced_mgmt_route: {forced_mgmt_route}")
147+
net_dut_mgmt = IPv4Network(dut_mgmt_network, strict=False)
148+
net_forced_mgmt = IPv4Network(forced_mgmt_route, strict=False)
149+
return net_dut_mgmt.subnet_of(net_forced_mgmt)
150+
151+
for forced_mgmt_route in forced_mgmt_routes_info_list:
152+
if _is_dut_mgmt_network_subnet_forced_mgmt(dut_mgmt_network, forced_mgmt_route.strip()):
153+
pytest.skip(
154+
"Skip the SSIP reboot test due to the issue:https://github.com/sonic-net/sonic-buildimage/issues/21201")
155+
156+
124157
class TestSSIP:
125158

126159
@pytest.fixture(scope="class")
@@ -540,6 +573,7 @@ def test_syslog_config_work_after_reboot(self, duthosts, enum_rand_one_per_hwsku
540573
"""
541574
logger.info("Starting test_syslog_config_work_after_reboot .....")
542575
self.duthost = duthosts[enum_rand_one_per_hwsku_frontend_hostname]
576+
skip_ssip_reboot_test_when_dut_mgmt_network_is_sub_network_forced_mgmt(self.duthost)
543577
self.asichost = self.duthost.asic_instance(enum_frontend_asic_index)
544578
syslog_config_data = SYSLOG_CONFIG_COMBINATION["vrf_set_source_set_800"]
545579
port = syslog_config_data["port"]

0 commit comments

Comments
 (0)