From ff61057d732e270d92fb4e95a362bdfdeda85a1e Mon Sep 17 00:00:00 2001 From: ganglyu Date: Fri, 13 Dec 2024 13:59:52 +0800 Subject: [PATCH] Address review comment --- tests/gnmi/test_gnmi_smartswitch.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/gnmi/test_gnmi_smartswitch.py b/tests/gnmi/test_gnmi_smartswitch.py index 595fbca839..6378d8b523 100644 --- a/tests/gnmi/test_gnmi_smartswitch.py +++ b/tests/gnmi/test_gnmi_smartswitch.py @@ -40,11 +40,15 @@ def test_gnmi_appldb_01(duthosts, rand_one_dut_hostname, ptfhost): target = None result = duthost.shell("show chassis module status") headers = result['stdout_lines'][0].split() + name_idx = None + oper_status_idx = None for i, header in enumerate(headers): if header == "Name": name_idx = i if header == "Oper-Status": oper_status_idx = i + assert name_idx is not None, "Can't locate Name in the headers" + assert oper_status_idx is not None, "Can't locate Oper-Status in the headers" for line in result['stdout_lines']: module_status = line.split() if module_status[oper_status_idx] == "Online":