Skip to content

Commit

Permalink
[cfgmgr] Fix for STATE_DB Port check (#1936)
Browse files Browse the repository at this point in the history
*Updated checks for PORT entry in STATE_DB in portmgrd, teammgrd, and intfmgrd to additionally check for presence of "state" attribute.
  • Loading branch information
qbdwlr committed Oct 11, 2021
1 parent c7eeecf commit b592ad7
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cfgmgr/intfmgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "shellcmd.h"
#include "macaddress.h"
#include "warm_restart.h"
#include <swss/redisutility.h>

using namespace std;
using namespace swss;
Expand Down Expand Up @@ -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;
}
Expand Down
7 changes: 7 additions & 0 deletions cfgmgr/portmgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "portmgr.h"
#include "exec.h"
#include "shellcmd.h"
#include <swss/redisutility.h>

using namespace std;
using namespace swss;
Expand Down Expand Up @@ -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;
}
Expand Down
8 changes: 8 additions & 0 deletions cfgmgr/teammgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "tokenize.h"
#include "warm_restart.h"
#include "portmgr.h"
#include <swss/redisutility.h>

#include <algorithm>
#include <iostream>
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit b592ad7

Please sign in to comment.