From b322c10593cbaf99e1ee9cd678a4cdffe710f1b9 Mon Sep 17 00:00:00 2001 From: Ann Pokora Date: Tue, 28 Sep 2021 17:31:44 -0700 Subject: [PATCH] [cfgmgr] Fix for STATE_DB Port check --- cfgmgr/intfmgr.cpp | 6 ++++++ cfgmgr/portmgr.cpp | 7 +++++++ cfgmgr/teammgr.cpp | 8 ++++++++ 3 files changed, 21 insertions(+) diff --git a/cfgmgr/intfmgr.cpp b/cfgmgr/intfmgr.cpp index 3e0ed862be..d0eaca21d9 100644 --- a/cfgmgr/intfmgr.cpp +++ b/cfgmgr/intfmgr.cpp @@ -9,6 +9,7 @@ #include "shellcmd.h" #include "macaddress.h" #include "warm_restart.h" +#include using namespace std; using namespace swss; @@ -438,6 +439,11 @@ bool IntfMgr::isIntfStateOk(const string &alias) } else if (m_statePortTable.get(alias, temp)) { + auto state_opt = swss::fvsGetValue(temp, "state", true); + if (!state_opt) + { + return false; + } SWSS_LOG_DEBUG("Port %s is ready", alias.c_str()); return true; } diff --git a/cfgmgr/portmgr.cpp b/cfgmgr/portmgr.cpp index 8fc43ca47f..b385a5096a 100644 --- a/cfgmgr/portmgr.cpp +++ b/cfgmgr/portmgr.cpp @@ -6,6 +6,7 @@ #include "portmgr.h" #include "exec.h" #include "shellcmd.h" +#include using namespace std; using namespace swss; @@ -87,6 +88,12 @@ bool PortMgr::isPortStateOk(const string &alias) if (m_statePortTable.get(alias, temp)) { + auto state_opt = swss::fvsGetValue(temp, "state", true); + if (!state_opt) + { + return false; + } + SWSS_LOG_INFO("Port %s is ready", alias.c_str()); return true; } diff --git a/cfgmgr/teammgr.cpp b/cfgmgr/teammgr.cpp index 89377e7e2d..b0e59c89a1 100644 --- a/cfgmgr/teammgr.cpp +++ b/cfgmgr/teammgr.cpp @@ -5,6 +5,7 @@ #include "tokenize.h" #include "warm_restart.h" #include "portmgr.h" +#include #include #include @@ -72,6 +73,13 @@ bool TeamMgr::isPortStateOk(const string &alias) return false; } + auto state_opt = swss::fvsGetValue(temp, "state", true); + if (!state_opt) + { + SWSS_LOG_INFO("Port %s is not ready", alias.c_str()); + return false; + } + return true; }