From ce244a41a5cb834f57c0e1dd94a70d7ab7eedb22 Mon Sep 17 00:00:00 2001 From: Arvindsrinivasan Lakshmi Narasimhan Date: Wed, 22 May 2024 06:59:17 +0000 Subject: [PATCH] add UT --- orchagent/intfsorch.cpp | 9 ++------- orchagent/neighorch.cpp | 11 ----------- tests/test_virtual_chassis.py | 15 ++++++++++++++- 3 files changed, 16 insertions(+), 19 deletions(-) diff --git a/orchagent/intfsorch.cpp b/orchagent/intfsorch.cpp index ebefee2aeb..2259f12158 100644 --- a/orchagent/intfsorch.cpp +++ b/orchagent/intfsorch.cpp @@ -1740,13 +1740,8 @@ void IntfsOrch::voqSyncIntfState(string &alias, bool isUp) } port_alias = port.m_system_port_info.alias; } - } - else - { - SWSS_LOG_ERROR("Port does not exist for %s!", port_alias.c_str()); - return; + SWSS_LOG_NOTICE("Syncing system interface state %s for port %s", isUp ? "up" : "down", port_alias.c_str()); + m_tableVoqSystemInterfaceTable->hset(port_alias, "oper_status", isUp ? "up" : "down"); } - SWSS_LOG_NOTICE("Syncing system interface state %s for port %s", isUp ? "up" : "down", port_alias.c_str()); - m_tableVoqSystemInterfaceTable->hset(port_alias, "oper_status", isUp ? "up" : "down"); } \ No newline at end of file diff --git a/orchagent/neighorch.cpp b/orchagent/neighorch.cpp index 48193fb90f..fdd258f254 100644 --- a/orchagent/neighorch.cpp +++ b/orchagent/neighorch.cpp @@ -1917,8 +1917,6 @@ bool NeighOrch::ifChangeInformRemoteNextHop(const string &alias, bool if_up) bool rc = true; Port inbp; gPortsOrch->getInbandPort(inbp); - SWSS_LOG_INFO("Inband port %s", inbp.m_alias.c_str()); - for (auto nbr = m_syncdNeighbors.begin(); nbr != m_syncdNeighbors.end(); ++nbr) { if (nbr->first.alias != alias) @@ -1936,15 +1934,6 @@ bool NeighOrch::ifChangeInformRemoteNextHop(const string &alias, bool if_up) { rc = setNextHopFlag(nhop, NHFLAGS_IFDOWN); } - - if (rc == true) - { - continue; - } - else - { - break; - } } return rc; } \ No newline at end of file diff --git a/tests/test_virtual_chassis.py b/tests/test_virtual_chassis.py index c92ed88c40..d0d472ac8c 100644 --- a/tests/test_virtual_chassis.py +++ b/tests/test_virtual_chassis.py @@ -976,7 +976,20 @@ def test_chassis_wred_profile_on_system_ports(self, vct): # Total number of logs = (No of system ports * No of lossless priorities) - No of lossless priorities for CPU ports assert logSeen.strip() == str(len(system_ports)*2 - 2) - + + def test_chassis_system_intf_status(self, vct): + dvss = vct.dvss + for name in dvss.keys(): + dvs = dvss[name] + if name.startswith("supervisor"): + chassis_app_db = DVSDatabase(swsscommon.CHASSIS_APP_DB, dvs.redis_chassis_sock) + keys = chassis_app_db.get_keys("SYSTEM_INTERFACE") + assert len(keys) > 0, "No system interface entries in chassis app db" + # Get the first system interface + intf = chassis_app_db.get_entry("SYSTEM_INTERFACE", keys[0]) + # Get the oper_status + oper_status = intf.get("oper_status", "unknown") + assert oper_status != "unknown", "System interface oper status is unknown" # Add Dummy always-pass test at end as workaroud # for issue when Flaky fail on final test it invokes module tear-down before retrying def test_nonflaky_dummy():