Skip to content

Commit 4280036

Browse files
jipanyanglguohan
authored andcommitted
[teammgrd] Fix inconsistent port admin status (sonic-net#755)
Signed-off-by: Jipan Yang <jipan.yang@alibaba-inc.com>
1 parent cf12bdf commit 4280036

File tree

3 files changed

+7
-10
lines changed

3 files changed

+7
-10
lines changed

cfgmgr/portmgr.cpp

-4
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@
1010
using namespace std;
1111
using namespace swss;
1212

13-
/* Port default admin status is down */
14-
#define DEFAULT_ADMIN_STATUS_STR "down"
15-
#define DEFAULT_MTU_STR "9100"
16-
1713
PortMgr::PortMgr(DBConnector *cfgDb, DBConnector *appDb, DBConnector *stateDb, const vector<string> &tableNames) :
1814
Orch(cfgDb, tableNames),
1915
m_cfgPortTable(cfgDb, CFG_PORT_TABLE_NAME),

cfgmgr/portmgr.h

+4
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010

1111
namespace swss {
1212

13+
/* Port default admin status is down */
14+
#define DEFAULT_ADMIN_STATUS_STR "down"
15+
#define DEFAULT_MTU_STR "9100"
16+
1317
class PortMgr : public Orch
1418
{
1519
public:

cfgmgr/teammgr.cpp

+3-6
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include "shellcmd.h"
55
#include "tokenize.h"
66
#include "warm_restart.h"
7+
#include "portmgr.h"
78

89
#include <algorithm>
910
#include <sstream>
@@ -16,8 +17,6 @@
1617
using namespace std;
1718
using namespace swss;
1819

19-
#define DEFAULT_ADMIN_STATUS_STR "up"
20-
#define DEFAULT_MTU_STR "9100"
2120

2221
TeamMgr::TeamMgr(DBConnector *confDb, DBConnector *applDb, DBConnector *statDb,
2322
const vector<TableConnector> &tables) :
@@ -480,7 +479,7 @@ task_process_status TeamMgr::addLagMember(const string &lag, const string &membe
480479
vector<FieldValueTuple> fvs;
481480
m_cfgPortTable.get(member, fvs);
482481

483-
// Get the member admin status (by default up)
482+
// Get the member admin status
484483
auto it = find_if(fvs.begin(), fvs.end(), [](const FieldValueTuple &fv) {
485484
return fv.first == "admin_status";
486485
});
@@ -510,9 +509,7 @@ task_process_status TeamMgr::addLagMember(const string &lag, const string &membe
510509
EXEC_WITH_ERROR_THROW(cmd.str(), res);
511510

512511
fvs.clear();
513-
FieldValueTuple fv("admin_status", admin_status);
514-
fvs.push_back(fv);
515-
fv = FieldValueTuple("mtu", mtu);
512+
FieldValueTuple fv("mtu", mtu);
516513
fvs.push_back(fv);
517514
m_appPortTable.set(member, fvs);
518515

0 commit comments

Comments
 (0)