Skip to content

Commit b592ad7

Browse files
authored
[cfgmgr] Fix for STATE_DB Port check (#1936)
*Updated checks for PORT entry in STATE_DB in portmgrd, teammgrd, and intfmgrd to additionally check for presence of "state" attribute.
1 parent c7eeecf commit b592ad7

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

cfgmgr/intfmgr.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include "shellcmd.h"
1010
#include "macaddress.h"
1111
#include "warm_restart.h"
12+
#include <swss/redisutility.h>
1213

1314
using namespace std;
1415
using namespace swss;
@@ -438,6 +439,11 @@ bool IntfMgr::isIntfStateOk(const string &alias)
438439
}
439440
else if (m_statePortTable.get(alias, temp))
440441
{
442+
auto state_opt = swss::fvsGetValue(temp, "state", true);
443+
if (!state_opt)
444+
{
445+
return false;
446+
}
441447
SWSS_LOG_DEBUG("Port %s is ready", alias.c_str());
442448
return true;
443449
}

cfgmgr/portmgr.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include "portmgr.h"
77
#include "exec.h"
88
#include "shellcmd.h"
9+
#include <swss/redisutility.h>
910

1011
using namespace std;
1112
using namespace swss;
@@ -87,6 +88,12 @@ bool PortMgr::isPortStateOk(const string &alias)
8788

8889
if (m_statePortTable.get(alias, temp))
8990
{
91+
auto state_opt = swss::fvsGetValue(temp, "state", true);
92+
if (!state_opt)
93+
{
94+
return false;
95+
}
96+
9097
SWSS_LOG_INFO("Port %s is ready", alias.c_str());
9198
return true;
9299
}

cfgmgr/teammgr.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include "tokenize.h"
66
#include "warm_restart.h"
77
#include "portmgr.h"
8+
#include <swss/redisutility.h>
89

910
#include <algorithm>
1011
#include <iostream>
@@ -72,6 +73,13 @@ bool TeamMgr::isPortStateOk(const string &alias)
7273
return false;
7374
}
7475

76+
auto state_opt = swss::fvsGetValue(temp, "state", true);
77+
if (!state_opt)
78+
{
79+
SWSS_LOG_INFO("Port %s is not ready", alias.c_str());
80+
return false;
81+
}
82+
7583
return true;
7684
}
7785

0 commit comments

Comments
 (0)