Skip to content

Commit

Permalink
add sanity check for aa (sonic-net#11637)
Browse files Browse the repository at this point in the history
  • Loading branch information
zjswhhh authored and mssonicbld committed Mar 22, 2024
1 parent 6ccd6c3 commit 336ae23
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
4 changes: 2 additions & 2 deletions tests/common/plugins/sanity_check/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,12 +250,12 @@ def sanity_check(localhost, duthosts, request, fanouthosts, nbrhosts, tbinfo):
if 'action' in failed_result and failed_result['action'] is not None \
and callable(failed_result['action']):
infra_recovery_actions.append(failed_result['action'])
for action in infra_recovery_actions:
action()
for dut_name, dut_results in list(dut_failed_results.items()):
# Attempt to restore DUT state
recover(duthosts[dut_name], localhost, fanouthosts, nbrhosts, tbinfo, dut_results,
recover_method)
for action in infra_recovery_actions:
action()

except BaseException as e:
request.config.cache.set("pre_sanity_check_failed", True)
Expand Down
17 changes: 12 additions & 5 deletions tests/common/plugins/sanity_check/checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from tests.common.dualtor.mux_simulator_control import get_mux_status, reset_simulator_port # noqa F401
from tests.common.dualtor.nic_simulator_control import restart_nic_simulator # noqa F401
from tests.common.dualtor.constants import UPPER_TOR, LOWER_TOR, NIC
from tests.common.dualtor.dual_tor_common import CableType
from tests.common.dualtor.dual_tor_common import CableType, active_standby_ports # noqa F401
from tests.common.cache import FactsCache
from tests.common.plugins.sanity_check.constants import STAGE_PRE_TEST, STAGE_POST_TEST
from tests.common.helpers.parallel import parallel_run, reset_ansible_local_tmp
Expand Down Expand Up @@ -519,6 +519,12 @@ def _verify_inconsistent_mux_status(duts_parsed_mux_status, dut_upper_tor, dut_l
err_msg_from_mux_status.append('Inconsistent mux status for active-standby ports on dualtors, \
please check output of "show mux status"')
dut_wrong_mux_status_ports.append(port_idx)
if cable_type == CableType.active_active:
logger.debug('Verify that active-active ports:{}'.format(duts_parsed_mux_status))
if (upper_tor_mux_status[port_idx]['status'] != 1 or lower_tor_mux_status[port_idx]['status'] != 1):
err_msg_from_mux_status.append('Inconsistent mux status for active-active ports on dualtors, \
please check output of "show mux status"')
dut_wrong_mux_status_ports.append(port_idx)

if len(dut_wrong_mux_status_ports) != 0:
return False
Expand Down Expand Up @@ -609,11 +615,12 @@ def _check_mux_status_helper():

@pytest.fixture(scope='module')
def check_mux_simulator(tbinfo, duthosts, duts_minigraph_facts, get_mux_status, # noqa F811
reset_simulator_port, restart_nic_simulator): # noqa F811

reset_simulator_port, restart_nic_simulator, # noqa F811
active_standby_ports): # noqa F811
def _recover():
duthosts.shell('config muxcable mode auto all')
reset_simulator_port()
duthosts.shell('config muxcable mode auto all; config save -y')
if active_standby_ports:
reset_simulator_port()
restart_nic_simulator()

def _check(*args, **kwargs):
Expand Down

0 comments on commit 336ae23

Please sign in to comment.