From 538650b84fccd8583d33f52245a13ed31d4461ad Mon Sep 17 00:00:00 2001 From: Hua Liu <58683130+liuh-80@users.noreply.github.com> Date: Thu, 13 Jun 2024 17:21:15 +0800 Subject: [PATCH] Fix convert_and_restore_config_db_to_ipv6_only reload config failure --- tests/common/fixtures/duthost_utils.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/common/fixtures/duthost_utils.py b/tests/common/fixtures/duthost_utils.py index 3d8d9078eda..ee99527e222 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 @@ -752,7 +753,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: