diff --git a/tests/common/fixtures/duthost_utils.py b/tests/common/fixtures/duthost_utils.py index 3f56b8a4928..def4f5ce2b1 100644 --- a/tests/common/fixtures/duthost_utils.py +++ b/tests/common/fixtures/duthost_utils.py @@ -9,6 +9,7 @@ import time import json +from ansible.errors import AnsibleConnectionFailure from paramiko.ssh_exception import AuthenticationException from tests.common import config_reload @@ -742,7 +743,13 @@ def convert_and_restore_config_db_to_ipv6_only(duthosts): for duthost in duthosts.nodes: if config_db_modified[duthost.hostname]: logger.info(f"config changed. Doing config reload for {duthost.hostname}") - config_reload(duthost, wait=120) + try: + config_reload(duthost, wait=120) + except AnsibleConnectionFailure as e: + # IPV4 mgmt interface been deleted by config reload + # In latest SONiC, config reload command will exit after mgmt interface restart + # Then 'duthost' will lost IPV4 connection and throw exception + logger.warning(f'Exception after config reload: {e}') duthosts.reset() for duthost in duthosts.nodes: